From 880f932cb82b4fceabd0a6a83c4552ff75982927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Wed, 22 Jan 2020 19:54:14 -0800 Subject: [PATCH] Fixed issue #2002. --- bindings/cs/bgfx.cs | 255 ++++++----------------------------------- bindings/d/types.d | 22 ++-- include/bgfx/defines.h | 40 +++---- scripts/bgfx.idl | 22 ++-- 4 files changed, 76 insertions(+), 263 deletions(-) diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs index 4a7a31dd4..d4c035ba5 100644 --- a/bindings/cs/bgfx.cs +++ b/bindings/cs/bgfx.cs @@ -195,227 +195,6 @@ public static partial class bgfx /// CullCw = 0x0000001000000000, - /// - /// Cull counter-clockwise triangles. - /// - CullCcw = 0x0000002000000000, - CullShift = 36, - CullMask = 0x0000003000000000, - } - - [Flags] - public enum DiscardFlags : uint - { - /// - /// Discard only Index Buffer - /// - IndexBuffer = 0x00000001, - - /// - /// Discard only Vertex Streams - /// - VertexStreams = 0x00000002, - - /// - /// Discard only texture samplers - /// - TextureSamplers = 0x00000004, - - /// - /// Discard only Compute shader related state - /// - Compute = 0x00000008, - - /// - /// Discard only state - /// - State = 0x00000010, - - /// - /// Discard every rendering states - /// - All = 0x0000001f, - } - - [Flags] - public enum StateFlags : ulong - { - /// - /// Enable R write. - /// - WriteR = 0x0000000000000001, - - /// - /// Enable G write. - /// - WriteG = 0x0000000000000002, - - /// - /// Enable B write. - /// - WriteB = 0x0000000000000004, - - /// - /// Enable alpha write. - /// - WriteA = 0x0000000000000008, - - /// - /// Enable depth write. - /// - WriteZ = 0x0000004000000000, - - /// - /// Enable RGB write. - /// - WriteRgb = 0x0000000000000007, - - /// - /// Write all channels mask. - /// - WriteMask = 0x000000400000000f, - - /// - /// Enable depth test, less. - /// - DepthTestLess = 0x0000000000000010, - - /// - /// Enable depth test, less or equal. - /// - DepthTestLequal = 0x0000000000000020, - - /// - /// Enable depth test, equal. - /// - DepthTestEqual = 0x0000000000000030, - - /// - /// Enable depth test, greater or equal. - /// - DepthTestGequal = 0x0000000000000040, - - /// - /// Enable depth test, greater. - /// - DepthTestGreater = 0x0000000000000050, - - /// - /// Enable depth test, not equal. - /// - DepthTestNotequal = 0x0000000000000060, - - /// - /// Enable depth test, never. - /// - DepthTestNever = 0x0000000000000070, - - /// - /// Enable depth test, always. - /// - DepthTestAlways = 0x0000000000000080, - DepthTestShift = 4, - DepthTestMask = 0x00000000000000f0, - - /// - /// 0, 0, 0, 0 - /// - BlendZero = 0x0000000000001000, - - /// - /// 1, 1, 1, 1 - /// - BlendOne = 0x0000000000002000, - - /// - /// Rs, Gs, Bs, As - /// - BlendSrcColor = 0x0000000000003000, - - /// - /// 1-Rs, 1-Gs, 1-Bs, 1-As - /// - BlendInvSrcColor = 0x0000000000004000, - - /// - /// As, As, As, As - /// - BlendSrcAlpha = 0x0000000000005000, - - /// - /// 1-As, 1-As, 1-As, 1-As - /// - BlendInvSrcAlpha = 0x0000000000006000, - - /// - /// Ad, Ad, Ad, Ad - /// - BlendDstAlpha = 0x0000000000007000, - - /// - /// 1-Ad, 1-Ad, 1-Ad ,1-Ad - /// - BlendInvDstAlpha = 0x0000000000008000, - - /// - /// Rd, Gd, Bd, Ad - /// - BlendDstColor = 0x0000000000009000, - - /// - /// 1-Rd, 1-Gd, 1-Bd, 1-Ad - /// - BlendInvDstColor = 0x000000000000a000, - - /// - /// f, f, f, 1; f = min(As, 1-Ad) - /// - BlendSrcAlphaSat = 0x000000000000b000, - - /// - /// Blend factor - /// - BlendFactor = 0x000000000000c000, - - /// - /// 1-Blend factor - /// - BlendInvFactor = 0x000000000000d000, - BlendShift = 12, - BlendMask = 0x000000000ffff000, - - /// - /// Blend add: src + dst. - /// - BlendEquationAdd = 0x0000000000000000, - - /// - /// Blend subtract: src - dst. - /// - BlendEquationSub = 0x0000000010000000, - - /// - /// Blend reverse subtract: dst - src. - /// - BlendEquationRevsub = 0x0000000020000000, - - /// - /// Blend min: min(src, dst). - /// - BlendEquationMin = 0x0000000030000000, - - /// - /// Blend max: max(src, dst). - /// - BlendEquationMax = 0x0000000040000000, - BlendEquationShift = 28, - BlendEquationMask = 0x00000003f0000000, - - /// - /// Cull clockwise triangles. - /// - CullCw = 0x0000001000000000, - /// /// Cull counter-clockwise triangles. /// @@ -750,6 +529,40 @@ public static partial class bgfx DiscardMask = 0x1ff8, } + [Flags] + public enum DiscardFlags : uint + { + /// + /// Discard only Index Buffer + /// + IndexBuffer = 0x00000001, + + /// + /// Discard only Vertex Streams + /// + VertexStreams = 0x00000002, + + /// + /// Discard only texture samplers + /// + TextureSamplers = 0x00000004, + + /// + /// Discard only Compute shader related state + /// + Compute = 0x00000008, + + /// + /// Discard only state + /// + State = 0x00000010, + + /// + /// Discard every rendering states + /// + All = 0x0000001f, + } + [Flags] public enum DebugFlags : uint { diff --git a/bindings/d/types.d b/bindings/d/types.d index 4e8cd7c44..a59821364 100644 --- a/bindings/d/types.d +++ b/bindings/d/types.d @@ -75,17 +75,6 @@ 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_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 enum ulong BGFX_STATE_ALPHA_REF_MASK = 0x0000ff0000000000; /// Alpha reference bit mask @@ -200,6 +189,17 @@ enum ushort BGFX_CLEAR_DISCARD_STENCIL = 0x1000; /// Discard frame buffer stenci enum ushort BGFX_CLEAR_DISCARD_COLOR_MASK = 0x07f8; enum ushort BGFX_CLEAR_DISCARD_MASK = 0x1ff8; +/** + * 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 + enum uint BGFX_DEBUG_NONE = 0x00000000; /// No debug. enum uint BGFX_DEBUG_WIREFRAME = 0x00000001; /// Enable wireframe for all primitives. /** diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h index 6bdf520a6..89cefd460 100644 --- a/include/bgfx/defines.h +++ b/include/bgfx/defines.h @@ -99,26 +99,6 @@ #define BGFX_STATE_CULL_SHIFT 36 //!< Culling mode bit shift #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. - * - */ -#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_ALL (0 \ - | BGFX_DISCARD_INDEX_BUFFER \ - | BGFX_DISCARD_VERTEX_STREAMS \ - | BGFX_DISCARD_TEXTURE_SAMPLERS \ - | BGFX_DISCARD_COMPUTE \ - | BGFX_DISCARD_STATE \ - ) - - /** * Alpha reference value. * @@ -273,6 +253,26 @@ ) +/** + * Rendering state discard. When state is preserved in submit, rendering states can be discarded + * on a finer grain. + * + */ +#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_ALL (0 \ + | BGFX_DISCARD_INDEX_BUFFER \ + | BGFX_DISCARD_VERTEX_STREAMS \ + | BGFX_DISCARD_TEXTURE_SAMPLERS \ + | BGFX_DISCARD_COMPUTE \ + | BGFX_DISCARD_STATE \ + ) + + #define BGFX_DEBUG_NONE UINT32_C(0x00000000) //!< No debug. #define BGFX_DEBUG_WIREFRAME UINT32_C(0x00000001) //!< Enable wireframe for all primitives. /// Enable infinitely fast hardware test. No draw calls will be submitted to driver. diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl index 0f33dc8ad..379b32202 100644 --- a/scripts/bgfx.idl +++ b/scripts/bgfx.idl @@ -83,17 +83,6 @@ 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.Discard { bits = 8, base = 1, desc = "Discard flags" } - .IndexBuffer --- Discard only Index Buffer - .VertexStreams --- Discard only Vertex Streams - .TextureSamplers --- Discard only texture samplers - .Compute --- Discard only Compute shader related state - .State --- Discard only state - .All { "IndexBuffer", "VertexStreams", "TextureSamplers", "Compute", "State" } --- Discard every rendering states - () - --- Alpha reference value. flag.StateAlphaRef { bits = 64, shift = 40, range = 8, desc = "Alpha reference", "helper" } @@ -210,6 +199,17 @@ flag.Clear { bits = 16 } "DiscardStencil" } +--- 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 + .Compute --- Discard only Compute shader related state + .State --- Discard only state + .All { "IndexBuffer", "VertexStreams", "TextureSamplers", "Compute", "State" } --- Discard every rendering states + () + flag.Debug { bits = 32 } .None --- No debug. .Wireframe --- Enable wireframe for all primitives.