mirror of https://github.com/bkaradzic/bgfx
Merge pull request #1736 from attilaz/mtl-constant-buffer-fix
fixed uninitialized constant buffer memory
This commit is contained in:
commit
d1ab0c175f
|
@ -3953,7 +3953,6 @@ namespace bgfx { namespace mtl
|
|||
const RenderCompute& compute = renderItem.compute;
|
||||
|
||||
bool programChanged = false;
|
||||
bool constantsChanged = compute.m_uniformBegin < compute.m_uniformEnd;
|
||||
rendererUpdateUniforms(this, _render->m_uniformBuffer[compute.m_uniformIdx], compute.m_uniformBegin, compute.m_uniformEnd);
|
||||
|
||||
if (key.m_program.idx != currentProgram.idx)
|
||||
|
@ -3969,8 +3968,7 @@ namespace bgfx { namespace mtl
|
|||
}
|
||||
|
||||
m_computeCommandEncoder.setComputePipelineState(currentPso->m_cps);
|
||||
programChanged =
|
||||
constantsChanged = true;
|
||||
programChanged = true;
|
||||
}
|
||||
|
||||
if (isValid(currentProgram)
|
||||
|
@ -3984,13 +3982,10 @@ namespace bgfx { namespace mtl
|
|||
m_computeCommandEncoder.setBuffer(m_uniformBuffer, m_uniformBufferVertexOffset, 0);
|
||||
}
|
||||
|
||||
if (constantsChanged)
|
||||
UniformBuffer* vcb = currentPso->m_vshConstantBuffer;
|
||||
if (NULL != vcb)
|
||||
{
|
||||
UniformBuffer* vcb = currentPso->m_vshConstantBuffer;
|
||||
if (NULL != vcb)
|
||||
{
|
||||
commit(*vcb);
|
||||
}
|
||||
commit(*vcb);
|
||||
}
|
||||
|
||||
viewState.setPredefined<4>(this, view, *currentPso, _render, compute);
|
||||
|
@ -4233,7 +4228,6 @@ namespace bgfx { namespace mtl
|
|||
}
|
||||
|
||||
bool programChanged = false;
|
||||
bool constantsChanged = draw.m_uniformBegin < draw.m_uniformEnd;
|
||||
rendererUpdateUniforms(this, _render->m_uniformBuffer[draw.m_uniformIdx], draw.m_uniformBegin, draw.m_uniformEnd);
|
||||
|
||||
bool vertexStreamChanged = hasVertexStreamChanged(currentState, draw);
|
||||
|
@ -4333,8 +4327,7 @@ namespace bgfx { namespace mtl
|
|||
rce.setVertexBuffer(inst.m_ptr, draw.m_instanceDataOffset, numStreams+1);
|
||||
}
|
||||
|
||||
programChanged =
|
||||
constantsChanged = true;
|
||||
programChanged = true;
|
||||
}
|
||||
|
||||
if (isValid(currentProgram) )
|
||||
|
@ -4355,19 +4348,16 @@ namespace bgfx { namespace mtl
|
|||
rce.setFragmentBuffer(m_uniformBuffer, m_uniformBufferFragmentOffset, 0);
|
||||
}
|
||||
|
||||
if (constantsChanged)
|
||||
UniformBuffer* vcb = currentPso->m_vshConstantBuffer;
|
||||
if (NULL != vcb)
|
||||
{
|
||||
UniformBuffer* vcb = currentPso->m_vshConstantBuffer;
|
||||
if (NULL != vcb)
|
||||
{
|
||||
commit(*vcb);
|
||||
}
|
||||
commit(*vcb);
|
||||
}
|
||||
|
||||
UniformBuffer* fcb = currentPso->m_fshConstantBuffer;
|
||||
if (NULL != fcb)
|
||||
{
|
||||
commit(*fcb);
|
||||
}
|
||||
UniformBuffer* fcb = currentPso->m_fshConstantBuffer;
|
||||
if (NULL != fcb)
|
||||
{
|
||||
commit(*fcb);
|
||||
}
|
||||
|
||||
viewState.setPredefined<4>(this, view, *currentPso, _render, draw);
|
||||
|
|
Loading…
Reference in New Issue