diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs index 49e457dad..89f23ad55 100644 --- a/bindings/cs/bgfx.cs +++ b/bindings/cs/bgfx.cs @@ -204,7 +204,7 @@ public static partial class bgfx } [Flags] - public enum DiscardFlagsFlags : uint + public enum DiscardFlags : uint { /// /// Discard only Index Buffer diff --git a/bindings/d/types.d b/bindings/d/types.d index 9120a1ff2..4e8cd7c44 100644 --- a/bindings/d/types.d +++ b/bindings/d/types.d @@ -10,7 +10,7 @@ public import core.stdc.stdarg : va_list; extern(C) @nogc nothrow: -enum uint BGFX_API_VERSION = 102; +enum uint BGFX_API_VERSION = 103; alias bgfx_view_id_t = ushort; @@ -75,13 +75,16 @@ enum ulong BGFX_STATE_CULL_CCW = 0x0000002000000000; /// Cull counter-clockwise enum ulong BGFX_STATE_CULL_SHIFT = 36; /// Culling mode bit shift enum ulong BGFX_STATE_CULL_MASK = 0x0000003000000000; /// Culling mode bit mask -/// Rendering state discard. When state is preserved in submit, rendering states can be discarded on a finer grain. -enum ubyte BGFX_DISCARD_FLAGS_INDEX_BUFFER = 0x01; /// Discard only Index Buffer -enum ubyte BGFX_DISCARD_FLAGS_VERTEX_STREAMS = 0x02; /// Discard only Vertex Streams -enum ubyte BGFX_DISCARD_FLAGS_TEXTURE_SAMPLERS = 0x04; /// Discard only texture samplers -enum ubyte BGFX_DISCARD_FLAGS_COMPUTE = 0x08; /// Discard only Compute shader related state -enum ubyte BGFX_DISCARD_FLAGS_STATE = 0x10; /// Discard only state -enum ubyte BGFX_DISCARD_FLAGS_ALL = 0x1f; /// Discard every rendering states +/** + * Rendering state discard. When state is preserved in submit, rendering states can be discarded + * on a finer grain. + */ +enum ubyte BGFX_DISCARD_INDEX_BUFFER = 0x01; /// Discard only Index Buffer +enum ubyte BGFX_DISCARD_VERTEX_STREAMS = 0x02; /// Discard only Vertex Streams +enum ubyte BGFX_DISCARD_TEXTURE_SAMPLERS = 0x04; /// Discard only texture samplers +enum ubyte BGFX_DISCARD_COMPUTE = 0x08; /// Discard only Compute shader related state +enum ubyte BGFX_DISCARD_STATE = 0x10; /// Discard only state +enum ubyte BGFX_DISCARD_ALL = 0x1f; /// Discard every rendering states /// Alpha reference value. enum ulong BGFX_STATE_ALPHA_REF_SHIFT = 40; /// Alpha reference bit shift diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index 723a0776e..ceac682dc 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -3985,7 +3985,7 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_discard`. /// - void discard(uint8_t flags = BGFX_DISCARD_FLAGS_ALL); + void discard(uint8_t flags = BGFX_DISCARD_ALL); /// Blit 2D texture region between two 2D textures. /// diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h index ec883b2d6..6bdf520a6 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(102) +#define BGFX_API_VERSION UINT32_C(103) /** * Color RGB/alpha/depth write. When it's not specified write will be disabled. @@ -100,21 +100,22 @@ #define BGFX_STATE_CULL_MASK UINT64_C(0x0000003000000000) //!< Culling mode bit mask /** - * Rendering state discard. When state is preserved in submit, rendering states can be discarded on a finer grain. + * Rendering state discard. When state is preserved in submit, rendering states can be discarded + * on a finer grain. * */ -#define BGFX_DISCARD_FLAGS_INDEX_BUFFER UINT8_C(0x01) //!< Discard only Index Buffer -#define BGFX_DISCARD_FLAGS_VERTEX_STREAMS UINT8_C(0x02) //!< Discard only Vertex Streams -#define BGFX_DISCARD_FLAGS_TEXTURE_SAMPLERS UINT8_C(0x04) //!< Discard only texture samplers -#define BGFX_DISCARD_FLAGS_COMPUTE UINT8_C(0x08) //!< Discard only Compute shader related state -#define BGFX_DISCARD_FLAGS_STATE UINT8_C(0x10) //!< Discard only state +#define BGFX_DISCARD_INDEX_BUFFER UINT8_C(0x01) //!< Discard only Index Buffer +#define BGFX_DISCARD_VERTEX_STREAMS UINT8_C(0x02) //!< Discard only Vertex Streams +#define BGFX_DISCARD_TEXTURE_SAMPLERS UINT8_C(0x04) //!< Discard only texture samplers +#define BGFX_DISCARD_COMPUTE UINT8_C(0x08) //!< Discard only Compute shader related state +#define BGFX_DISCARD_STATE UINT8_C(0x10) //!< Discard only state /// Discard every rendering states -#define BGFX_DISCARD_FLAGS_ALL (0 \ - | BGFX_DISCARD_FLAGS_INDEX_BUFFER \ - | BGFX_DISCARD_FLAGS_VERTEX_STREAMS \ - | BGFX_DISCARD_FLAGS_TEXTURE_SAMPLERS \ - | BGFX_DISCARD_FLAGS_COMPUTE \ - | BGFX_DISCARD_FLAGS_STATE \ +#define BGFX_DISCARD_ALL (0 \ + | BGFX_DISCARD_INDEX_BUFFER \ + | BGFX_DISCARD_VERTEX_STREAMS \ + | BGFX_DISCARD_TEXTURE_SAMPLERS \ + | BGFX_DISCARD_COMPUTE \ + | BGFX_DISCARD_STATE \ ) diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl index 4d092e1bd..68a3a0554 100644 --- a/scripts/bgfx.idl +++ b/scripts/bgfx.idl @@ -1,7 +1,7 @@ -- vim: syntax=lua -- bgfx interface -version(102) +version(103) typedef "bool" typedef "char" @@ -83,8 +83,9 @@ flag.StateCull { bits = 64, shift = 36, range = 2, base = 1, desc = "Culling mod .Ccw --- Cull counter-clockwise triangles. () ---- Rendering state discard. When state is preserved in submit, rendering states can be discarded on a finer grain. -flag.DiscardFlags { bits = 8, base = 1, desc = "Discard flags" } +--- Rendering state discard. When state is preserved in submit, rendering states can be discarded +--- on a finer grain. +flag.Discard { bits = 8, base = 1, desc = "Discard flags" } .IndexBuffer --- Discard only Index Buffer .VertexStreams --- Discard only Vertex Streams .TextureSamplers --- Discard only texture samplers diff --git a/src/bgfx_p.h b/src/bgfx_p.h index e26278176..b6d8b0803 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -1543,9 +1543,9 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA BX_ALIGN_DECL_CACHE_LINE(struct) RenderBind { - void clear(uint8_t flags = BGFX_DISCARD_FLAGS_ALL) + void clear(uint8_t flags = BGFX_DISCARD_ALL) { - if (flags & BGFX_DISCARD_FLAGS_TEXTURE_SAMPLERS) + if (flags & BGFX_DISCARD_TEXTURE_SAMPLERS) { for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++ii) { @@ -1562,9 +1562,9 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA BX_ALIGN_DECL_CACHE_LINE(struct) RenderDraw { - void clear(uint8_t flags = BGFX_DISCARD_FLAGS_ALL) + void clear(uint8_t flags = BGFX_DISCARD_ALL) { - if (flags & BGFX_DISCARD_FLAGS_STATE) + if (flags & BGFX_DISCARD_STATE) { m_uniformBegin = 0; m_uniformEnd = 0; @@ -1589,12 +1589,12 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA m_occlusionQuery.idx = kInvalidHandle; m_uniformIdx = UINT8_MAX; } - if (flags & BGFX_DISCARD_FLAGS_VERTEX_STREAMS) + if (flags & BGFX_DISCARD_VERTEX_STREAMS) { m_streamMask = 0; m_stream[0].clear(); } - if (flags & BGFX_DISCARD_FLAGS_INDEX_BUFFER) + if (flags & BGFX_DISCARD_INDEX_BUFFER) { m_indexBuffer.idx = kInvalidHandle; } @@ -1638,9 +1638,9 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA BX_ALIGN_DECL_CACHE_LINE(struct) RenderCompute { - void clear(uint8_t flags = BGFX_DISCARD_FLAGS_ALL) + void clear(uint8_t flags = BGFX_DISCARD_ALL) { - if (flags & BGFX_DISCARD_FLAGS_COMPUTE) + if (flags & BGFX_DISCARD_COMPUTE) { m_uniformBegin = 0; m_uniformEnd = 0; @@ -2494,7 +2494,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA bind.m_mip = _mip; } - void discard(uint8_t flags = BGFX_DISCARD_FLAGS_ALL) + void discard(uint8_t flags = BGFX_DISCARD_ALL) { if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) {