Fix independent blend parameter on Vulkan, D3d11 and D3d12

This commit is contained in:
gogoprog 2023-02-11 09:25:24 +01:00
parent dcf926f624
commit f6280ebb72
3 changed files with 9 additions and 4 deletions

View File

@ -5955,7 +5955,7 @@ namespace bgfx { namespace d3d11
currentBind.clear(); currentBind.clear();
setBlendState(newFlags); setBlendState(newFlags, draw.m_rgba);
setDepthStencilState(newFlags, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) ); setDepthStencilState(newFlags, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) );
const uint64_t pt = newFlags&BGFX_STATE_PT_MASK; const uint64_t pt = newFlags&BGFX_STATE_PT_MASK;

View File

@ -2185,6 +2185,7 @@ namespace bgfx { namespace d3d12
const VertexLayout* layouts[1] = { &m_vertexLayouts[_blitter.m_vb->layoutHandle.idx] }; const VertexLayout* layouts[1] = { &m_vertexLayouts[_blitter.m_vb->layoutHandle.idx] };
ID3D12PipelineState* pso = getPipelineState(state ID3D12PipelineState* pso = getPipelineState(state
, 0
, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) , packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT)
, 1 , 1
, layouts , layouts
@ -3047,6 +3048,7 @@ namespace bgfx { namespace d3d12
ID3D12PipelineState* getPipelineState( ID3D12PipelineState* getPipelineState(
uint64_t _state uint64_t _state
, uint64_t _rgba
, uint64_t _stencil , uint64_t _stencil
, uint8_t _numStreams , uint8_t _numStreams
, const VertexLayout** _layouts , const VertexLayout** _layouts
@ -3216,7 +3218,7 @@ namespace bgfx { namespace d3d12
desc.StreamOutput.NumStrides = 0; desc.StreamOutput.NumStrides = 0;
desc.StreamOutput.RasterizedStream = 0; desc.StreamOutput.RasterizedStream = 0;
setBlendState(desc.BlendState, _state); setBlendState(desc.BlendState, _state, _rgba);
desc.SampleMask = UINT32_MAX; desc.SampleMask = UINT32_MAX;
setRasterizerState(desc.RasterizerState, _state); setRasterizerState(desc.RasterizerState, _state);
setDepthStencilState(desc.DepthStencilState, _state, _stencil); setDepthStencilState(desc.DepthStencilState, _state, _stencil);
@ -6879,6 +6881,7 @@ namespace bgfx { namespace d3d12
ID3D12PipelineState* pso = getPipelineState( ID3D12PipelineState* pso = getPipelineState(
state state
, draw.m_rgba
, draw.m_stencil , draw.m_stencil
, numStreams , numStreams
, layouts , layouts

View File

@ -2592,6 +2592,7 @@ VK_IMPORT_DEVICE
const VertexLayout* layout = &m_vertexLayouts[_blitter.m_vb->layoutHandle.idx]; const VertexLayout* layout = &m_vertexLayouts[_blitter.m_vb->layoutHandle.idx];
VkPipeline pso = getPipeline(state VkPipeline pso = getPipeline(state
, 0
, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) , packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT)
, 1 , 1
, &layout , &layout
@ -3525,7 +3526,7 @@ VK_IMPORT_DEVICE
return pipeline; return pipeline;
} }
VkPipeline getPipeline(uint64_t _state, uint64_t _stencil, uint8_t _numStreams, const VertexLayout** _layouts, ProgramHandle _program, uint8_t _numInstanceData) VkPipeline getPipeline(uint64_t _state, uint64_t _rgba, uint64_t _stencil, uint8_t _numStreams, const VertexLayout** _layouts, ProgramHandle _program, uint8_t _numInstanceData)
{ {
ProgramVK& program = m_program[_program.idx]; ProgramVK& program = m_program[_program.idx];
@ -3597,7 +3598,7 @@ VK_IMPORT_DEVICE
VkPipelineColorBlendAttachmentState blendAttachmentState[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; VkPipelineColorBlendAttachmentState blendAttachmentState[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
VkPipelineColorBlendStateCreateInfo colorBlendState; VkPipelineColorBlendStateCreateInfo colorBlendState;
colorBlendState.pAttachments = blendAttachmentState; colorBlendState.pAttachments = blendAttachmentState;
setBlendState(colorBlendState, _state); setBlendState(colorBlendState, _state, _rgba);
VkPipelineInputAssemblyStateCreateInfo inputAssemblyState; VkPipelineInputAssemblyStateCreateInfo inputAssemblyState;
inputAssemblyState.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; inputAssemblyState.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
@ -8549,6 +8550,7 @@ VK_DESTROY
const VkPipeline pipeline = const VkPipeline pipeline =
getPipeline(draw.m_stateFlags getPipeline(draw.m_stateFlags
, draw.m_rgba
, draw.m_stencil , draw.m_stencil
, numStreams , numStreams
, layouts , layouts