MTL: Allow null fragment shader for depth only programs.

This commit is contained in:
Branimir Karadžić 2018-03-06 09:49:04 -08:00
parent 9422aec753
commit 6fe21f1019
1 changed files with 7 additions and 12 deletions

View File

@ -485,7 +485,7 @@ namespace bgfx { namespace mtl
reset(m_renderPipelineDescriptor);
m_renderPipelineDescriptor.colorAttachments[0].pixelFormat = m_metalLayer.pixelFormat;
m_renderPipelineDescriptor.vertexFunction = m_screenshotBlitProgram.m_vsh->m_function;
m_renderPipelineDescriptor.vertexFunction = m_screenshotBlitProgram.m_vsh->m_function;
m_renderPipelineDescriptor.fragmentFunction = m_screenshotBlitProgram.m_fsh->m_function;
m_screenshotBlitRenderPipelineState = m_device.newRenderPipelineStateWithDescriptor(m_renderPipelineDescriptor);
@ -1062,7 +1062,7 @@ namespace bgfx { namespace mtl
RenderPipelineState pipelineState = program.getRenderPipelineState(state, 0, fbh, _blitter.m_vb->decl, 0);
rce.setRenderPipelineState(pipelineState);
uint32_t vertexUniformBufferSize = program.m_vshConstantBufferSize;
uint32_t vertexUniformBufferSize = program.m_vshConstantBufferSize;
uint32_t fragmentUniformBufferSize = program.m_fshConstantBufferSize;
if (vertexUniformBufferSize )
@ -1235,7 +1235,7 @@ namespace bgfx { namespace mtl
MTL_RELEASE(m_screenshotBlitRenderPipelineState)
reset(m_renderPipelineDescriptor);
m_renderPipelineDescriptor.colorAttachments[0].pixelFormat = m_metalLayer.pixelFormat;
m_renderPipelineDescriptor.vertexFunction = m_screenshotBlitProgram.m_vsh->m_function;
m_renderPipelineDescriptor.vertexFunction = m_screenshotBlitProgram.m_vsh->m_function;
m_renderPipelineDescriptor.fragmentFunction = m_screenshotBlitProgram.m_fsh->m_function;
m_screenshotBlitRenderPipelineState = m_device.newRenderPipelineStateWithDescriptor(m_renderPipelineDescriptor);
}
@ -1949,12 +1949,7 @@ namespace bgfx { namespace mtl
{
BX_CHECK(NULL != _vsh->m_function.m_obj, "Vertex shader doesn't exist.");
m_vsh = _vsh;
if (NULL != _fsh)
{
BX_CHECK(NULL != _fsh->m_function.m_obj, "Fragment shader doesn't exist.");
m_fsh = _fsh;
}
m_fsh = _fsh;
// get attributes
bx::memSet(m_attributes, 0xff, sizeof(m_attributes) );
@ -2193,7 +2188,7 @@ namespace bgfx { namespace mtl
}
pd.vertexFunction = m_vsh->m_function;
pd.fragmentFunction = m_fsh->m_function;
pd.fragmentFunction = m_fsh != NULL ? m_fsh->m_function : NULL;
if (isValid(_declHandle) )
{
@ -3721,14 +3716,14 @@ namespace bgfx { namespace mtl
uint32_t vertexUniformBufferSize = program.m_vshConstantBufferSize;
uint32_t fragmentUniformBufferSize = program.m_fshConstantBufferSize;
if (vertexUniformBufferSize)
if (0 != vertexUniformBufferSize)
{
m_uniformBufferVertexOffset = BX_ALIGN_MASK(m_uniformBufferVertexOffset, program.m_vshConstantBufferAlignmentMask);
rce.setVertexBuffer(m_uniformBuffer, m_uniformBufferVertexOffset, 0);
}
m_uniformBufferFragmentOffset = m_uniformBufferVertexOffset + vertexUniformBufferSize;
if (fragmentUniformBufferSize)
if (0 != fragmentUniformBufferSize)
{
m_uniformBufferFragmentOffset = BX_ALIGN_MASK(m_uniformBufferFragmentOffset, program.m_fshConstantBufferAlignmentMask);
rce.setFragmentBuffer(m_uniformBuffer, m_uniformBufferFragmentOffset, 0);