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

@ -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;
}
// 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);