diff --git a/bindings/bf/bgfx.bf b/bindings/bf/bgfx.bf
index f0d7be1d4..280dbc5d6 100644
--- a/bindings/bf/bgfx.bf
+++ b/bindings/bf/bgfx.bf
@@ -1369,6 +1369,25 @@ public static class bgfx
NegativeZ = 0x00000005,
}
+ [AllowDuplicates]
+ public enum FrameFlags : uint32
+ {
+ ///
+ /// No frame flags.
+ ///
+ None = 0x00000000,
+
+ ///
+ /// Capture frame with graphics debugger.
+ ///
+ DebugCapture = 0x00000001,
+
+ ///
+ /// Discard all draw calls.
+ ///
+ Discard = 0x00000002,
+ }
+
[AllowDuplicates]
public enum Fatal : uint32
{
@@ -2712,10 +2731,10 @@ public static class bgfx
/// singlethreaded renderer this call does frame rendering.
///
///
- /// Capture frame with graphics debugger.
+ /// Frame flags. See: `BGFX_FRAME_*` for more info. - `BGFX_FRAME_NONE` - No frame flag. - `BGFX_FRAME_DEBUG_CAPTURE` - Capture frame with graphics debugger. - `BGFX_FRAME_DISCARD` - Discard all draw calls.
///
[LinkName("bgfx_frame")]
- public static extern uint32 frame(bool _capture);
+ public static extern uint32 frame(uint8 _flags);
///
/// Returns current renderer backend API type.
diff --git a/bindings/c3/bgfx.c3 b/bindings/c3/bgfx.c3
index d04463788..d7b7aaef8 100644
--- a/bindings/c3/bgfx.c3
+++ b/bindings/c3/bgfx.c3
@@ -862,6 +862,18 @@ enum CubeMapFlags : const uint
NEGATIVEZ = 0x00000005,
}
+enum FrameFlags : const uint
+{
+ // No frame flags.
+ NONE = 0x00000000,
+
+ // Capture frame with graphics debugger.
+ DEBUGCAPTURE = 0x00000001,
+
+ // Discard all draw calls.
+ DISCARD = 0x00000002,
+}
+
enum Fatal : uint
{
DEBUGCHECK,
@@ -2036,8 +2048,8 @@ extern fn void reset(uint _width, uint _height, uint _flags, TextureFormat _form
// Advance to next frame. When using multithreaded renderer, this call
// just swaps internal buffers, kicks render thread, and returns. In
// singlethreaded renderer this call does frame rendering.
-// _capture : `Capture frame with graphics debugger.`
-extern fn uint frame(bool _capture) @extern("bgfx_frame");
+// _flags : `Frame flags. See: `BGFX_FRAME_*` for more info. - `BGFX_FRAME_NONE` - No frame flag. - `BGFX_FRAME_DEBUG_CAPTURE` - Capture frame with graphics debugger. - `BGFX_FRAME_DISCARD` - Discard all draw calls.`
+extern fn uint frame(char _flags) @extern("bgfx_frame");
// Returns current renderer backend API type.
// @remarks
diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs
index 7100d6ce7..5b3741996 100644
--- a/bindings/cs/bgfx.cs
+++ b/bindings/cs/bgfx.cs
@@ -1368,6 +1368,25 @@ public static partial class bgfx
NegativeZ = 0x00000005,
}
+ [Flags]
+ public enum FrameFlags : uint
+ {
+ ///
+ /// No frame flags.
+ ///
+ None = 0x00000000,
+
+ ///
+ /// Capture frame with graphics debugger.
+ ///
+ DebugCapture = 0x00000001,
+
+ ///
+ /// Discard all draw calls.
+ ///
+ Discard = 0x00000002,
+ }
+
public enum Fatal
{
DebugCheck,
@@ -2662,10 +2681,10 @@ public static partial class bgfx
/// singlethreaded renderer this call does frame rendering.
///
///
- /// Capture frame with graphics debugger.
+ /// Frame flags. See: `BGFX_FRAME_*` for more info. - `BGFX_FRAME_NONE` - No frame flag. - `BGFX_FRAME_DEBUG_CAPTURE` - Capture frame with graphics debugger. - `BGFX_FRAME_DISCARD` - Discard all draw calls.
///
[DllImport(DllName, EntryPoint="bgfx_frame", CallingConvention = CallingConvention.Cdecl)]
- public static extern unsafe uint frame(bool _capture);
+ public static extern unsafe uint frame(byte _flags);
///
/// Returns current renderer backend API type.
diff --git a/bindings/d/package.d b/bindings/d/package.d
index a8319648a..5ca264289 100644
--- a/bindings/d/package.d
+++ b/bindings/d/package.d
@@ -9,7 +9,7 @@ import bindbc.common.types: c_int64, c_uint64, va_list;
import bindbc.bgfx.config;
static import bgfx.impl;
-enum uint apiVersion = 137;
+enum uint apiVersion = 138;
alias ViewID = ushort;
@@ -579,6 +579,13 @@ enum CubeMap: CubeMap_{
negativeZ = 0x05, ///Cubemap -z.
}
+alias Frame_ = ubyte;
+enum Frame: Frame_{
+ none = 0x00, ///No frame flags.
+ debugCapture = 0x01, ///Capture frame with graphics debugger.
+ discard = 0x02, ///Discard all draw calls.
+}
+
///Fatal error enum.
enum Fatal: bgfx.impl.Fatal.Enum{
debugCheck = bgfx.impl.Fatal.Enum.debugCheck,
@@ -2069,9 +2076,12 @@ mixin(joinFnBinds((){
* just swaps internal buffers, kicks render thread, and returns. In
* singlethreaded renderer this call does frame rendering.
Params:
- capture = Capture frame with graphics debugger.
+ flags = Frame flags. See: `BGFX_FRAME_*` for more info.
+ - `BGFX_FRAME_NONE` - No frame flag.
+ - `BGFX_FRAME_DEBUG_CAPTURE` - Capture frame with graphics debugger.
+ - `BGFX_FRAME_DISCARD` - Discard all draw calls.
*/
- {q{uint}, q{frame}, q{bool capture=false}, ext: `C++, "bgfx"`},
+ {q{uint}, q{frame}, q{ubyte flags=BGFX_FRAME_NONE}, ext: `C++, "bgfx"`},
/**
* Returns current renderer backend API type.
diff --git a/bindings/zig/bgfx.zig b/bindings/zig/bgfx.zig
index 0c1a16113..6b544e09d 100644
--- a/bindings/zig/bgfx.zig
+++ b/bindings/zig/bgfx.zig
@@ -835,6 +835,16 @@ pub const CubeMapFlags_PositiveZ: CubeMapFlags = 0x00000004;
/// Cubemap -z.
pub const CubeMapFlags_NegativeZ: CubeMapFlags = 0x00000005;
+pub const FrameFlags = u32;
+/// No frame flags.
+pub const FrameFlags_None: FrameFlags = 0x00000000;
+
+/// Capture frame with graphics debugger.
+pub const FrameFlags_DebugCapture: FrameFlags = 0x00000001;
+
+/// Discard all draw calls.
+pub const FrameFlags_Discard: FrameFlags = 0x00000002;
+
pub const Fatal = enum(c_int) {
DebugCheck,
InvalidShader,
@@ -2156,11 +2166,11 @@ extern fn bgfx_reset(_width: u32, _height: u32, _flags: u32, _format: TextureFor
/// Advance to next frame. When using multithreaded renderer, this call
/// just swaps internal buffers, kicks render thread, and returns. In
/// singlethreaded renderer this call does frame rendering.
-/// Capture frame with graphics debugger.
-pub inline fn frame(_capture: bool) u32 {
- return bgfx_frame(_capture);
+/// Frame flags. See: `BGFX_FRAME_*` for more info. - `BGFX_FRAME_NONE` - No frame flag. - `BGFX_FRAME_DEBUG_CAPTURE` - Capture frame with graphics debugger. - `BGFX_FRAME_DISCARD` - Discard all draw calls.
+pub inline fn frame(_flags: u8) u32 {
+ return bgfx_frame(_flags);
}
-extern fn bgfx_frame(_capture: bool) u32;
+extern fn bgfx_frame(_flags: u8) u32;
/// Returns current renderer backend API type.
/// @remarks
diff --git a/docs/bgfx.rst b/docs/bgfx.rst
index f1c896ed1..6c77323e0 100644
--- a/docs/bgfx.rst
+++ b/docs/bgfx.rst
@@ -68,6 +68,10 @@ Reset
Frame
*****
+.. doxygendefine:: BGFX_FRAME_NONE
+.. doxygendefine:: BGFX_FRAME_DEBUG_CAPTURE
+.. doxygendefine:: BGFX_FRAME_DISCARD
+
.. doxygenfunction:: bgfx::frame
Debug
diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h
index f04f92bf0..86bf80573 100644
--- a/include/bgfx/bgfx.h
+++ b/include/bgfx/bgfx.h
@@ -2132,7 +2132,7 @@ namespace bgfx
/// just swaps internal buffers, kicks render thread, and returns. In
/// singlethreaded renderer this call does frame rendering.
///
- /// @param[in] _capture Capture frame with graphics debugger.
+ /// @param[in] _flags Frame flags. See: `BGFX_FRAME_*`.
///
/// @returns Current frame number. This might be used in conjunction with
/// double/multi buffering data outside the library and passing it to
@@ -2140,7 +2140,7 @@ namespace bgfx
///
/// @attention C99's equivalent binding is `bgfx_frame`.
///
- uint32_t frame(bool _capture = false);
+ uint32_t frame(uint8_t _flags = BGFX_FRAME_NONE);
/// Returns current renderer backend API type.
///
diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h
index df373e35d..3d08e28e9 100644
--- a/include/bgfx/c99/bgfx.h
+++ b/include/bgfx/c99/bgfx.h
@@ -1250,14 +1250,17 @@ BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags, b
* just swaps internal buffers, kicks render thread, and returns. In
* singlethreaded renderer this call does frame rendering.
*
- * @param[in] _capture Capture frame with graphics debugger.
+ * @param[in] _flags Frame flags. See: `BGFX_FRAME_*` for more info.
+ * - `BGFX_FRAME_NONE` - No frame flag.
+ * - `BGFX_FRAME_DEBUG_CAPTURE` - Capture frame with graphics debugger.
+ * - `BGFX_FRAME_DISCARD` - Discard all draw calls.
*
* @returns Current frame number. This might be used in conjunction with
* double/multi buffering data outside the library and passing it to
* library via `bgfx::makeRef` calls.
*
*/
-BGFX_C_API uint32_t bgfx_frame(bool _capture);
+BGFX_C_API uint32_t bgfx_frame(uint8_t _flags);
/**
* Returns current renderer backend API type.
@@ -3829,7 +3832,7 @@ struct bgfx_interface_vtbl
bool (*init)(const bgfx_init_t * _init);
void (*shutdown)(void);
void (*reset)(uint32_t _width, uint32_t _height, uint32_t _flags, bgfx_texture_format_t _format);
- uint32_t (*frame)(bool _capture);
+ uint32_t (*frame)(uint8_t _flags);
bgfx_renderer_type_t (*get_renderer_type)(void);
const bgfx_caps_t* (*get_caps)(void);
const bgfx_stats_t* (*get_stats)(void);
diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h
index 5bd95b47a..4f7cce8b2 100644
--- a/include/bgfx/defines.h
+++ b/include/bgfx/defines.h
@@ -15,7 +15,7 @@
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
-#define BGFX_API_VERSION UINT32_C(137)
+#define BGFX_API_VERSION UINT32_C(138)
/**
* Color RGB/alpha/depth write. When it's not specified write will be disabled.
@@ -541,6 +541,10 @@
#define BGFX_CUBE_MAP_POSITIVE_Z UINT8_C(0x04) //!< Cubemap +z.
#define BGFX_CUBE_MAP_NEGATIVE_Z UINT8_C(0x05) //!< Cubemap -z.
+#define BGFX_FRAME_NONE UINT8_C(0x00) //!< No frame flags.
+#define BGFX_FRAME_DEBUG_CAPTURE UINT8_C(0x01) //!< Capture frame with graphics debugger.
+#define BGFX_FRAME_DISCARD UINT8_C(0x02) //!< Discard all draw calls.
+
/// Blend function separate.
#define BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) (UINT64_C(0) \
diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl
index e6c5e0574..6be4d3e0d 100644
--- a/scripts/bgfx.idl
+++ b/scripts/bgfx.idl
@@ -1,7 +1,7 @@
-- vim: syntax=lua
-- bgfx interface
-version(137)
+version(138)
typedef "bool"
typedef "char"
@@ -28,7 +28,7 @@ funcptr.ReleaseFn
.userData "void*" --- User defined data if needed.
--- Color RGB/alpha/depth write. When it's not specified write will be disabled.
-flag.StateWrite { bits = 64 , base = 1 }
+flag.StateWrite { bits = 64, base = 1 }
.R --- Enable R write.
.G --- Enable G write.
.B --- Enable B write.
@@ -450,6 +450,12 @@ flag.CubeMap { bits = 8, const }
.NegativeZ (0x05) --- Cubemap -z.
()
+flag.Frame { bits = 8 }
+ .None --- No frame flags.
+ .DebugCapture --- Capture frame with graphics debugger.
+ .Discard --- Discard all draw calls.
+ ()
+
--- Fatal error enum.
enum.Fatal { underscore, comment = "" }
.DebugCheck
@@ -1240,11 +1246,13 @@ func.reset
--- just swaps internal buffers, kicks render thread, and returns. In
--- singlethreaded renderer this call does frame rendering.
func.frame
- "uint32_t" --- Current frame number. This might be used in conjunction with
- --- double/multi buffering data outside the library and passing it to
- --- library via `bgfx::makeRef` calls.
- .capture "bool" --- Capture frame with graphics debugger.
- { default = false }
+ "uint32_t" --- Current frame number. This might be used in conjunction with
+ --- double/multi buffering data outside the library and passing it to
+ --- library via `bgfx::makeRef` calls.
+ .flags "uint8_t" --- Frame flags. See: `BGFX_FRAME_*` for more info.
+ { default = "BGFX_FRAME_NONE" } --- - `BGFX_FRAME_NONE` - No frame flag.
+ --- - `BGFX_FRAME_DEBUG_CAPTURE` - Capture frame with graphics debugger.
+ --- - `BGFX_FRAME_DISCARD` - Discard all draw calls.
--- Returns current renderer backend API type.
---
diff --git a/src/bgfx.cpp b/src/bgfx.cpp
index 59803e84a..46252216b 100644
--- a/src/bgfx.cpp
+++ b/src/bgfx.cpp
@@ -2400,7 +2400,7 @@ namespace bgfx
#endif // BGFX_CONFIG_MULTITHREADED
}
- uint32_t Context::frame(bool _capture)
+ uint32_t Context::frame(uint8_t _flags)
{
m_encoder[0].end(true);
@@ -2413,7 +2413,12 @@ namespace bgfx
encoderApiWait();
#endif // BGFX_CONFIG_MULTITHREADED
- m_submit->m_capture = _capture;
+ if (0 != (_flags & BGFX_FRAME_DISCARD) )
+ {
+ m_submit->m_numRenderItems = 0;
+ }
+
+ m_submit->m_capture = 0 != (_flags & BGFX_FRAME_DEBUG_CAPTURE);
uint32_t frameNum = m_submit->m_frameNum;
@@ -4234,10 +4239,10 @@ namespace bgfx
s_ctx->end(_encoder);
}
- uint32_t frame(bool _capture)
+ uint32_t frame(uint8_t _flags)
{
BGFX_CHECK_API_THREAD();
- return s_ctx->frame(_capture);
+ return s_ctx->frame(_flags);
}
const Caps* getCaps()
diff --git a/src/bgfx.idl.inl b/src/bgfx.idl.inl
index bd7543348..08aa722b0 100644
--- a/src/bgfx.idl.inl
+++ b/src/bgfx.idl.inl
@@ -172,9 +172,9 @@ BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags, b
bgfx::reset(_width, _height, _flags, (bgfx::TextureFormat::Enum)_format);
}
-BGFX_C_API uint32_t bgfx_frame(bool _capture)
+BGFX_C_API uint32_t bgfx_frame(uint8_t _flags)
{
- return bgfx::frame(_capture);
+ return bgfx::frame(_flags);
}
BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type(void)
diff --git a/src/bgfx_p.h b/src/bgfx_p.h
index 001f10cc1..19156be84 100644
--- a/src/bgfx_p.h
+++ b/src/bgfx_p.h
@@ -5804,7 +5804,7 @@ namespace bgfx
BGFX_API_FUNC(void end(Encoder* _encoder) );
- BGFX_API_FUNC(uint32_t frame(bool _capture = false) );
+ BGFX_API_FUNC(uint32_t frame(uint8_t _flags = BGFX_FRAME_NONE) );
uint32_t getSeqIncr(ViewId _id)
{
diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp
index e24c4462a..56cf674c6 100644
--- a/src/renderer_d3d11.cpp
+++ b/src/renderer_d3d11.cpp
@@ -1918,7 +1918,7 @@ namespace bgfx { namespace d3d11
bx::write(&writer, tc, bx::ErrorAssert{});
texture.destroy();
- texture.create(mem, texture.m_flags, 0, NULL);
+ texture.create(mem, texture.m_flags, 0, 0);
release(mem);
}
@@ -4656,7 +4656,7 @@ namespace bgfx { namespace d3d11
&& !writeOnly
;
- if (NULL != _external)
+ if (0 != _external)
{
if (externalShared)
{