From b4cac17b9379f655521d5224687b1cd44207a5de Mon Sep 17 00:00:00 2001 From: Cedric Guillemet Date: Tue, 21 Jan 2020 09:56:56 +0100 Subject: [PATCH] default parameters --- bindings/cs/bgfx.cs | 14 ++++++------- bindings/d/funcs.d | 8 ++++---- bindings/d/types.d | 14 ++++++------- examples/23-vectordisplay/vectordisplay.cpp | 2 +- include/bgfx/bgfx.h | 4 ++-- include/bgfx/c99/bgfx.h | 8 ++++---- include/bgfx/defines.h | 22 +++++++++++++-------- scripts/bgfx.idl | 20 ++++++++++--------- src/bgfx.cpp | 22 ++++++++++----------- src/bgfx.idl.inl | 4 ++-- src/bgfx_p.h | 10 +++++----- src/renderer_d3d11.cpp | 12 +++++------ src/renderer_d3d12.cpp | 16 +++++++-------- src/renderer_d3d9.cpp | 6 +++--- src/renderer_gl.cpp | 12 +++++------ src/renderer_mtl.mm | 12 +++++------ src/renderer_vk.cpp | 4 ++-- 17 files changed, 97 insertions(+), 93 deletions(-) diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs index 70b4f0032..dc75e293c 100644 --- a/bindings/cs/bgfx.cs +++ b/bindings/cs/bgfx.cs @@ -215,24 +215,22 @@ public static partial class bgfx /// /// Discard only texture samplers /// - DiscardTextureSamplers = 0x0000000000000003, + DiscardTextureSamplers = 0x0000000000000004, /// /// Discard only Compute shader related state /// - DiscardCompute = 0x0000000000000004, + DiscardCompute = 0x0000000000000008, /// /// Discard only state /// - DiscardState = 0x0000000000000005, + DiscardState = 0x0000000000000010, /// /// Discard every rendering states /// - DiscardAll = 0xffffffffffffffff, - DiscardShift = 0, - DiscardMask = 0x0000000000000007, + DiscardDefault = 0x000000000000001f, AlphaRefShift = 40, AlphaRefMask = 0x0000ff0000000000, @@ -3825,7 +3823,7 @@ public static partial class bgfx /// rendering states to discard /// [DllImport(DllName, EntryPoint="bgfx_encoder_discard", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void encoder_discard(Encoder* _this, ulong _flags); + public static extern unsafe void encoder_discard(Encoder* _this, byte _flags); /// /// Blit 2D texture region between two 2D textures. @@ -4340,7 +4338,7 @@ public static partial class bgfx /// rendering states to discard /// [DllImport(DllName, EntryPoint="bgfx_discard", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void discard(ulong _flags); + public static extern unsafe void discard(byte _flags); /// /// Blit 2D texture region between two 2D textures. diff --git a/bindings/d/funcs.d b/bindings/d/funcs.d index 027dc8c79..bacbe5745 100644 --- a/bindings/d/funcs.d +++ b/bindings/d/funcs.d @@ -1575,7 +1575,7 @@ version(BindBgfx_Static) * Params: * _flags = rendering states to discard */ - void bgfx_encoder_discard(bgfx_encoder_t* _this, ulong _flags); + void bgfx_encoder_discard(bgfx_encoder_t* _this, byte _flags); /** * Blit 2D texture region between two 2D textures. @@ -2034,7 +2034,7 @@ version(BindBgfx_Static) * Params: * _flags = rendering states to discard */ - void bgfx_discard(ulong _flags); + void bgfx_discard(byte _flags); /** * Blit 2D texture region between two 2D textures. @@ -3771,7 +3771,7 @@ else * Params: * _flags = rendering states to discard */ - alias da_bgfx_encoder_discard = void function(bgfx_encoder_t* _this, ulong _flags); + alias da_bgfx_encoder_discard = void function(bgfx_encoder_t* _this, byte _flags); da_bgfx_encoder_discard bgfx_encoder_discard; /** @@ -4272,7 +4272,7 @@ else * Params: * _flags = rendering states to discard */ - alias da_bgfx_discard = void function(ulong _flags); + alias da_bgfx_discard = void function(byte _flags); da_bgfx_discard bgfx_discard; /** diff --git a/bindings/d/types.d b/bindings/d/types.d index 2c41cc7a9..cb3279800 100644 --- a/bindings/d/types.d +++ b/bindings/d/types.d @@ -76,14 +76,12 @@ 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 ulong BGFX_STATE_DISCARD_INDEX_BUFFER = 0x0000000000000001; /// Discard only Index Buffer -enum ulong BGFX_STATE_DISCARD_VERTEX_STREAMS = 0x0000000000000002; /// Discard only Vertex Streams -enum ulong BGFX_STATE_DISCARD_TEXTURE_SAMPLERS = 0x0000000000000003; /// Discard only texture samplers -enum ulong BGFX_STATE_DISCARD_COMPUTE = 0x0000000000000004; /// Discard only Compute shader related state -enum ulong BGFX_STATE_DISCARD_STATE = 0x0000000000000005; /// Discard only state -enum ulong BGFX_STATE_DISCARD_ALL = 0xffffffffffffffff; /// Discard every rendering states -enum ulong BGFX_STATE_DISCARD_SHIFT = 0; /// Discard flags bit shift -enum ulong BGFX_STATE_DISCARD_MASK = 0x0000000000000007; /// Discard flags bit mask +enum ubyte BGFX_STATE_DISCARD_INDEX_BUFFER = 0x01; /// Discard only Index Buffer +enum ubyte BGFX_STATE_DISCARD_VERTEX_STREAMS = 0x02; /// Discard only Vertex Streams +enum ubyte BGFX_STATE_DISCARD_TEXTURE_SAMPLERS = 0x04; /// Discard only texture samplers +enum ubyte BGFX_STATE_DISCARD_COMPUTE = 0x08; /// Discard only Compute shader related state +enum ubyte BGFX_STATE_DISCARD_STATE = 0x10; /// Discard only state +enum ubyte BGFX_STATE_DISCARD_DEFAULT = 0x1f; /// Discard every rendering states /// Alpha reference value. enum ulong BGFX_STATE_ALPHA_REF_SHIFT = 40; /// Alpha reference bit shift diff --git a/examples/23-vectordisplay/vectordisplay.cpp b/examples/23-vectordisplay/vectordisplay.cpp index 5f58efabf..7bface50c 100644 --- a/examples/23-vectordisplay/vectordisplay.cpp +++ b/examples/23-vectordisplay/vectordisplay.cpp @@ -272,7 +272,7 @@ void VectorDisplay::endFrame() } } - bgfx::discard(BGFX_STATE_DISCARD_ALL); + bgfx::discard(); //now do last pass, combination of blur and normal buffer to screen bgfx::setViewTransform(viewCounter, NULL, proj); diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index bf4325a65..29767f180 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -1590,7 +1590,7 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_encoder_discard`. /// - void discard(uint64_t flags); + void discard(uint8_t flags); /// Blit texture 2D region between two 2D textures. /// @@ -3985,7 +3985,7 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_discard`. /// - void discard(uint64_t flags); + void discard(uint8_t flags = BGFX_STATE_DISCARD_DEFAULT); /// Blit 2D texture region between two 2D textures. /// diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h index f2e41fc64..ebff1faa8 100644 --- a/include/bgfx/c99/bgfx.h +++ b/include/bgfx/c99/bgfx.h @@ -2675,7 +2675,7 @@ BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_ * @param[in] _flags rendering states to discard * */ -BGFX_C_API void bgfx_encoder_discard(bgfx_encoder_t* _this, uint64_t _flags); +BGFX_C_API void bgfx_encoder_discard(bgfx_encoder_t* _this, uint8_t _flags); /** * Blit 2D texture region between two 2D textures. @@ -3193,7 +3193,7 @@ BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t * @param[in] _flags rendering states to discard * */ -BGFX_C_API void bgfx_discard(uint64_t _flags); +BGFX_C_API void bgfx_discard(uint8_t _flags); /** * Blit 2D texture region between two 2D textures. @@ -3558,7 +3558,7 @@ struct bgfx_interface_vtbl void (*encoder_set_image)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); void (*encoder_dispatch)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ); void (*encoder_dispatch_indirect)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num); - void (*encoder_discard)(bgfx_encoder_t* _this, uint64_t _flags); + void (*encoder_discard)(bgfx_encoder_t* _this, uint8_t _flags); void (*encoder_blit)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); void (*request_screen_shot)(bgfx_frame_buffer_handle_t _handle, const char* _filePath); bgfx_render_frame_t (*render_frame)(int32_t _msecs); @@ -3600,7 +3600,7 @@ struct bgfx_interface_vtbl void (*set_image)(uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); void (*dispatch)(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ); void (*dispatch_indirect)(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num); - void (*discard)(uint64_t _flags); + void (*discard)(uint8_t _flags); void (*blit)(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); }; diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h index a7ecc0ef1..6ab270fd1 100644 --- a/include/bgfx/defines.h +++ b/include/bgfx/defines.h @@ -103,14 +103,20 @@ * Rendering state discard. When state is preserved in submit, rendering states can be discarded on a finer grain. * */ -#define BGFX_STATE_DISCARD_INDEX_BUFFER UINT64_C(0x0000000000000001) //!< Discard only Index Buffer -#define BGFX_STATE_DISCARD_VERTEX_STREAMS UINT64_C(0x0000000000000002) //!< Discard only Vertex Streams -#define BGFX_STATE_DISCARD_TEXTURE_SAMPLERS UINT64_C(0x0000000000000003) //!< Discard only texture samplers -#define BGFX_STATE_DISCARD_COMPUTE UINT64_C(0x0000000000000004) //!< Discard only Compute shader related state -#define BGFX_STATE_DISCARD_STATE UINT64_C(0x0000000000000005) //!< Discard only state -#define BGFX_STATE_DISCARD_ALL UINT64_C(0xffffffffffffffff) //!< Discard every rendering states -#define BGFX_STATE_DISCARD_SHIFT 0 //!< Discard flags bit shift -#define BGFX_STATE_DISCARD_MASK UINT64_C(0x0000000000000007) //!< Discard flags bit mask +#define BGFX_STATE_DISCARD_INDEX_BUFFER UINT8_C(0x01) //!< Discard only Index Buffer +#define BGFX_STATE_DISCARD_VERTEX_STREAMS UINT8_C(0x02) //!< Discard only Vertex Streams +#define BGFX_STATE_DISCARD_TEXTURE_SAMPLERS UINT8_C(0x04) //!< Discard only texture samplers +#define BGFX_STATE_DISCARD_COMPUTE UINT8_C(0x08) //!< Discard only Compute shader related state +#define BGFX_STATE_DISCARD_STATE UINT8_C(0x10) //!< Discard only state +/// Discard every rendering states +#define BGFX_STATE_DISCARD_DEFAULT (0 \ + | BGFX_STATE_DISCARD_INDEX_BUFFER \ + | BGFX_STATE_DISCARD_VERTEX_STREAMS \ + | BGFX_STATE_DISCARD_TEXTURE_SAMPLERS \ + | BGFX_STATE_DISCARD_COMPUTE \ + | BGFX_STATE_DISCARD_STATE \ + ) + /** * Alpha reference value. diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl index 958e026e4..e28f0842b 100644 --- a/scripts/bgfx.idl +++ b/scripts/bgfx.idl @@ -84,13 +84,13 @@ flag.StateCull { bits = 64, shift = 36, range = 2, base = 1, desc = "Culling mod () --- Rendering state discard. When state is preserved in submit, rendering states can be discarded on a finer grain. -flag.StateDiscard { bits = 64, shift = 0, range = 3, 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 (0xffffffffffffffff) --- Discard every rendering states +flag.StateDiscard { 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 + .Default { "IndexBuffer", "VertexStreams", "TextureSamplers", "Compute", "State" } --- Discard every rendering states () --- Alpha reference value. @@ -2451,7 +2451,8 @@ func.Encoder.dispatch { cname = "dispatch_indirect" } --- Discard previously set state for draw or compute call. func.Encoder.discard "void" - .flags "uint64_t" --- rendering states to discard + .flags "uint8_t" --- rendering states to discard + { default = "Default" } --- Blit 2D texture region between two 2D textures. --- @@ -2962,7 +2963,8 @@ func.dispatch { cname = "dispatch_indirect" } --- Discard previously set state for draw or compute call. func.discard "void" - .flags "uint64_t" --- rendering states to discard + .flags "uint8_t" --- rendering states to discard + { default = "Default" } --- Blit 2D texture region between two 2D textures. --- diff --git a/src/bgfx.cpp b/src/bgfx.cpp index c0a9a5c7b..20fe6b4f0 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -1184,14 +1184,14 @@ namespace bgfx if (m_discard) { - discard(BGFX_STATE_DISCARD_ALL); + discard(); return; } if (0 == m_draw.m_numVertices && 0 == m_draw.m_numIndices) { - discard(BGFX_STATE_DISCARD_ALL); + discard(); ++m_numDropped; return; } @@ -1199,7 +1199,7 @@ namespace bgfx const uint32_t renderItemIdx = bx::atomicFetchAndAddsat(&m_frame->m_numRenderItems, 1, BGFX_CONFIG_MAX_DRAW_CALLS); if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= renderItemIdx) { - discard(BGFX_STATE_DISCARD_ALL); + discard(); ++m_numDropped; return; } @@ -1266,8 +1266,8 @@ namespace bgfx if (!_preserveState) { - m_draw.clear(BGFX_STATE_DISCARD_ALL); - m_bind.clear(BGFX_STATE_DISCARD_ALL); + m_draw.clear(); + m_bind.clear(); m_uniformBegin = m_uniformEnd; } } @@ -1281,14 +1281,14 @@ namespace bgfx if (m_discard) { - discard(BGFX_STATE_DISCARD_ALL); + discard(); return; } const uint32_t renderItemIdx = bx::atomicFetchAndAddsat(&m_frame->m_numRenderItems, 1, BGFX_CONFIG_MAX_DRAW_CALLS); if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= renderItemIdx) { - discard(BGFX_STATE_DISCARD_ALL); + discard(); ++m_numDropped; return; } @@ -1319,8 +1319,8 @@ namespace bgfx m_frame->m_renderItem[renderItemIdx].compute = m_compute; m_frame->m_renderItemBind[renderItemIdx] = m_bind; - m_compute.clear(BGFX_STATE_DISCARD_ALL); - m_bind.clear(BGFX_STATE_DISCARD_ALL); + m_compute.clear(); + m_bind.clear(); m_uniformBegin = m_uniformEnd; } @@ -3780,7 +3780,7 @@ namespace bgfx BGFX_ENCODER(dispatch(_id, _program, _indirectHandle, _start, _num) ); } - void Encoder::discard(uint64_t flags) + void Encoder::discard(uint8_t flags) { BGFX_ENCODER(discard(flags) ); } @@ -4992,7 +4992,7 @@ namespace bgfx s_ctx->m_encoder0->dispatch(_id, _handle, _indirectHandle, _start, _num); } - void discard(uint64_t flags) + void discard(uint8_t flags) { BGFX_CHECK_API_THREAD(); s_ctx->m_encoder0->discard(flags); diff --git a/src/bgfx.idl.inl b/src/bgfx.idl.inl index fd245cacc..a64c2c57f 100644 --- a/src/bgfx.idl.inl +++ b/src/bgfx.idl.inl @@ -912,7 +912,7 @@ BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_ This->dispatch((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num); } -BGFX_C_API void bgfx_encoder_discard(bgfx_encoder_t* _this, uint64_t _flags) +BGFX_C_API void bgfx_encoder_discard(bgfx_encoder_t* _this, uint8_t _flags) { bgfx::Encoder* This = (bgfx::Encoder*)_this; This->discard(_flags); @@ -1154,7 +1154,7 @@ BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t bgfx::dispatch((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num); } -BGFX_C_API void bgfx_discard(uint64_t _flags) +BGFX_C_API void bgfx_discard(uint8_t _flags) { bgfx::discard(_flags); } diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 7407de821..b19c583f7 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -1543,7 +1543,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA BX_ALIGN_DECL_CACHE_LINE(struct) RenderBind { - void clear(uint64_t flags) + void clear(uint8_t flags = BGFX_STATE_DISCARD_DEFAULT) { if (flags & BGFX_STATE_DISCARD_TEXTURE_SAMPLERS) { @@ -1562,7 +1562,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA BX_ALIGN_DECL_CACHE_LINE(struct) RenderDraw { - void clear(uint64_t flags) + void clear(uint8_t flags = BGFX_STATE_DISCARD_DEFAULT) { if (flags & BGFX_STATE_DISCARD_STATE) { @@ -1638,7 +1638,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA BX_ALIGN_DECL_CACHE_LINE(struct) RenderCompute { - void clear(uint64_t flags) + void clear(uint8_t flags = BGFX_STATE_DISCARD_DEFAULT) { if (flags & BGFX_STATE_DISCARD_COMPUTE) { @@ -2199,7 +2199,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA { EncoderImpl() { - discard(BGFX_STATE_DISCARD_ALL); + discard(); } void begin(Frame* _frame, uint8_t _idx) @@ -2494,7 +2494,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA bind.m_mip = _mip; } - void discard(uint64_t flags) + void discard(uint8_t flags = BGFX_STATE_DISCARD_DEFAULT) { if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) { diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 066e4a15e..e851cec86 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -5309,12 +5309,12 @@ namespace bgfx { namespace d3d11 _render->sort(); RenderDraw currentState; - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); RenderBind currentBind; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); static ViewState viewState; viewState.reset(_render); @@ -5617,9 +5617,9 @@ namespace bgfx { namespace d3d11 { if (resetState) { - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_scissor = !draw.m_scissor; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); } continue; @@ -5640,14 +5640,14 @@ namespace bgfx { namespace d3d11 { wasCompute = false; - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_scissor = !draw.m_scissor; changedFlags = BGFX_STATE_MASK; changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK); currentState.m_stateFlags = newFlags; currentState.m_stencil = newStencil; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); setBlendState(newFlags); setDepthStencilState(newFlags, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) ); diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 81a05a19c..6fd962c39 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -5753,12 +5753,12 @@ namespace bgfx { namespace d3d12 _render->sort(); RenderDraw currentState; - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); RenderBind currentBind; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); static ViewState viewState; viewState.reset(_render); @@ -6174,9 +6174,9 @@ namespace bgfx { namespace d3d12 { if (resetState) { - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_scissor = !draw.m_scissor; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); commandListChanged = true; } @@ -6196,14 +6196,14 @@ namespace bgfx { namespace d3d12 { wasCompute = false; - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_scissor = !draw.m_scissor; changedFlags = BGFX_STATE_MASK; changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK); currentState.m_stateFlags = newFlags; currentState.m_stencil = newStencil; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); commandListChanged = true; } @@ -6223,14 +6223,14 @@ namespace bgfx { namespace d3d12 currentBindHash = 0; currentSamplerStateIdx = kInvalidHandle; currentProgram = BGFX_INVALID_HANDLE; - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_scissor = !draw.m_scissor; changedFlags = BGFX_STATE_MASK; changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK); currentState.m_stateFlags = newFlags; currentState.m_stencil = newStencil; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); const uint64_t pt = newFlags&BGFX_STATE_PT_MASK; primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT); diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 67942f39c..34c50d673 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -3746,12 +3746,12 @@ namespace bgfx { namespace d3d9 _render->sort(); RenderDraw currentState; - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); RenderBind currentBind; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); static ViewState viewState; viewState.reset(_render); @@ -3839,7 +3839,7 @@ namespace bgfx { namespace d3d9 if (key.m_view != view) { - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_scissor = !draw.m_scissor; changedFlags = BGFX_STATE_MASK; changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK); diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index dfe58ad95..ba6407e1f 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -6482,12 +6482,12 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) ); _render->sort(); RenderDraw currentState; - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); RenderBind currentBind; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); static ViewState viewState; viewState.reset(_render); @@ -6769,9 +6769,9 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) ); { if (resetState) { - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_scissor = !draw.m_scissor; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); } continue; @@ -6788,14 +6788,14 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) ); if (resetState) { - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_scissor = !draw.m_scissor; changedFlags = BGFX_STATE_MASK; changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK); currentState.m_stateFlags = newFlags; currentState.m_stencil = newStencil; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); } uint16_t scissor = draw.m_scissor; diff --git a/src/renderer_mtl.mm b/src/renderer_mtl.mm index d9c1c3781..7d2407c38 100644 --- a/src/renderer_mtl.mm +++ b/src/renderer_mtl.mm @@ -3687,12 +3687,12 @@ namespace bgfx { namespace mtl _render->sort(); RenderDraw currentState; - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); RenderBind currentBind; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); static ViewState viewState; viewState.reset(_render); @@ -4136,9 +4136,9 @@ namespace bgfx { namespace mtl { if (resetState) { - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_scissor = !draw.m_scissor; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); } continue; @@ -4155,14 +4155,14 @@ namespace bgfx { namespace mtl if (resetState) { - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_scissor = !draw.m_scissor; changedFlags = BGFX_STATE_MASK; changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK); currentState.m_stateFlags = newFlags; currentState.m_stencil = newStencil; - currentBind.clear(BGFX_STATE_DISCARD_ALL); + currentBind.clear(); currentProgram = BGFX_INVALID_HANDLE; setDepthStencilState(newFlags, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) ); diff --git a/src/renderer_vk.cpp b/src/renderer_vk.cpp index 988862966..1aff87088 100644 --- a/src/renderer_vk.cpp +++ b/src/renderer_vk.cpp @@ -5733,7 +5733,7 @@ VK_DESTROY _render->sort(); RenderDraw currentState; - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); @@ -6138,7 +6138,7 @@ VK_DESTROY currentDslHash = 0; currentSamplerStateIdx = kInvalidHandle; currentProgram = BGFX_INVALID_HANDLE; - currentState.clear(BGFX_STATE_DISCARD_ALL); + currentState.clear(); currentState.m_scissor = !draw.m_scissor; changedFlags = BGFX_STATE_MASK; changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK);