mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-06-08 03:13:52 +00:00
D3D11/D3D12/VK/WebGPU: Fixed independent blend _rgba. (#3736)
This commit is contained in:
committed by
GitHub
parent
04fb4b0780
commit
944ccff1e4
@@ -6017,7 +6017,7 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
currentBind.clear();
|
||||
|
||||
setBlendState(newFlags);
|
||||
setBlendState(newFlags, draw.m_rgba);
|
||||
setDepthStencilState(newFlags, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) );
|
||||
|
||||
const uint64_t pt = newFlags&BGFX_STATE_PT_MASK;
|
||||
|
||||
@@ -2536,6 +2536,7 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
const VertexLayout* layouts[1] = { &m_vertexLayouts[_blitter.m_vb->layoutHandle.idx] };
|
||||
ID3D12PipelineState* pso = getPipelineState(state
|
||||
, 0
|
||||
, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT)
|
||||
, 1
|
||||
, layouts
|
||||
@@ -3384,6 +3385,7 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
ID3D12PipelineState* getPipelineState(
|
||||
uint64_t _state
|
||||
, uint32_t _rgba
|
||||
, uint64_t _stencil
|
||||
, uint8_t _numStreams
|
||||
, const VertexLayout** _layouts
|
||||
@@ -3429,6 +3431,7 @@ namespace bgfx { namespace d3d12
|
||||
bx::HashMurmur2A murmur;
|
||||
murmur.begin();
|
||||
murmur.add(_state);
|
||||
murmur.add(!!(BGFX_STATE_BLEND_INDEPENDENT & _state) ? _rgba : 0);
|
||||
murmur.add(_stencil);
|
||||
murmur.add(program.m_vsh->m_hash);
|
||||
murmur.add(program.m_vsh->m_attrMask, sizeof(program.m_vsh->m_attrMask) );
|
||||
@@ -3491,7 +3494,7 @@ namespace bgfx { namespace d3d12
|
||||
desc.StreamOutput.NumStrides = 0;
|
||||
desc.StreamOutput.RasterizedStream = 0;
|
||||
|
||||
setBlendState(desc.BlendState, _state);
|
||||
setBlendState(desc.BlendState, _state, _rgba);
|
||||
desc.SampleMask = UINT32_MAX;
|
||||
setRasterizerState(desc.RasterizerState, _state);
|
||||
setDepthStencilState(desc.DepthStencilState, _state, _stencil);
|
||||
@@ -7585,6 +7588,7 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
ID3D12PipelineState* pso = getPipelineState(
|
||||
state
|
||||
, draw.m_rgba
|
||||
, draw.m_stencil
|
||||
, numStreams
|
||||
, layouts
|
||||
|
||||
@@ -2830,6 +2830,7 @@ VK_IMPORT_DEVICE
|
||||
|
||||
const VertexLayout* layout = &m_vertexLayouts[_blitter.m_vb->layoutHandle.idx];
|
||||
VkPipeline pso = getPipeline(state
|
||||
, 0
|
||||
, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT)
|
||||
, 1
|
||||
, &layout
|
||||
@@ -3831,7 +3832,7 @@ VK_IMPORT_DEVICE
|
||||
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, uint32_t _rgba, uint64_t _stencil, uint8_t _numStreams, const VertexLayout** _layouts, ProgramHandle _program, uint8_t _numInstanceData)
|
||||
{
|
||||
ProgramVK& program = m_program[_program.idx];
|
||||
|
||||
@@ -3874,6 +3875,7 @@ VK_IMPORT_DEVICE
|
||||
bx::HashMurmur2A murmur;
|
||||
murmur.begin();
|
||||
murmur.add(_state);
|
||||
murmur.add(!!(BGFX_STATE_BLEND_INDEPENDENT & _state) ? _rgba : 0);
|
||||
murmur.add(_stencil);
|
||||
murmur.add(program.m_vsh->m_hash);
|
||||
murmur.add(program.m_vsh->m_attrMask, sizeof(program.m_vsh->m_attrMask) );
|
||||
@@ -3903,7 +3905,7 @@ VK_IMPORT_DEVICE
|
||||
VkPipelineColorBlendAttachmentState blendAttachmentState[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
|
||||
VkPipelineColorBlendStateCreateInfo colorBlendState;
|
||||
colorBlendState.pAttachments = blendAttachmentState;
|
||||
setBlendState(colorBlendState, _state);
|
||||
setBlendState(colorBlendState, _state, _rgba);
|
||||
|
||||
VkPipelineInputAssemblyStateCreateInfo inputAssemblyState;
|
||||
inputAssemblyState.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
|
||||
@@ -9646,6 +9648,7 @@ VK_DESTROY
|
||||
|
||||
const VkPipeline pipeline =
|
||||
getPipeline(draw.m_stateFlags
|
||||
, draw.m_rgba
|
||||
, draw.m_stencil
|
||||
, numStreams
|
||||
, layouts
|
||||
|
||||
@@ -1990,6 +1990,7 @@ WGPU_IMPORT
|
||||
, BGFX_INVALID_HANDLE
|
||||
, 1
|
||||
, state
|
||||
, 0
|
||||
, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT)
|
||||
, 1
|
||||
, &stream
|
||||
@@ -2114,6 +2115,7 @@ WGPU_IMPORT
|
||||
, _fbh
|
||||
, _msaaCount
|
||||
, state
|
||||
, 0
|
||||
, stencil
|
||||
, 1
|
||||
, &stream
|
||||
@@ -2674,6 +2676,7 @@ WGPU_IMPORT
|
||||
, FrameBufferHandle _fbh
|
||||
, uint32_t _msaaCount
|
||||
, uint64_t _state
|
||||
, uint32_t _rgba
|
||||
, uint64_t _stencil
|
||||
, uint32_t _streamMask
|
||||
, const Stream* _stream
|
||||
@@ -2728,6 +2731,7 @@ WGPU_IMPORT
|
||||
bx::HashMurmur2A murmur;
|
||||
murmur.begin();
|
||||
murmur.add(_state);
|
||||
murmur.add(!!(BGFX_STATE_BLEND_INDEPENDENT & _state) ? _rgba : 0);
|
||||
murmur.add(_stencil);
|
||||
murmur.add(&_renderBind.m_bind, sizeof(_renderBind.m_bind) );
|
||||
murmur.add(program.m_vsh->m_hash);
|
||||
@@ -2910,7 +2914,7 @@ WGPU_IMPORT
|
||||
|
||||
const bool hasFragmentShader = NULL != program.m_fsh;
|
||||
|
||||
const uint32_t targetCount = hasFragmentShader ? setColorTargetState(blendState, colorTragetState, fb, _state) : 0;
|
||||
const uint32_t targetCount = hasFragmentShader ? setColorTargetState(blendState, colorTragetState, fb, _state, _rgba) : 0;
|
||||
|
||||
if (NULL != depthStencilTextureView)
|
||||
{
|
||||
@@ -5981,6 +5985,7 @@ m_resolution.formatColor = TextureFormat::BGRA8;
|
||||
, fbh
|
||||
, msaaCount
|
||||
, draw.m_stateFlags
|
||||
, draw.m_rgba
|
||||
, draw.m_stencil
|
||||
, draw.m_streamMask
|
||||
, draw.m_stream
|
||||
|
||||
Reference in New Issue
Block a user