Bläddra i källkod

fix image is not set in pipeline state object in metal renderer (#2780)

* always set pipeline state object 'm_bindingTypes' when argument is texture

* fix the typo error casue cash
Kitchen 3 år sedan
förälder
incheckning
2568ce7311
1 ändrade filer med 10 tillägg och 8 borttagningar
  1. 10 8
      src/renderer_mtl.mm

+ 10 - 8
src/renderer_mtl.mm

@@ -2016,19 +2016,21 @@ namespace bgfx { namespace mtl
 						else if (arg.type == MTLArgumentTypeTexture)
 						{
 							const char* name = utf8String(arg.name);
-							const UniformRegInfo* info = s_renderMtl->m_uniformReg.find(name);
-							BX_WARN(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name);
-
-							if (NULL != info)
+							if (arg.index >= BGFX_CONFIG_MAX_TEXTURE_SAMPLERS)
 							{
-								if (arg.index >= BGFX_CONFIG_MAX_TEXTURE_SAMPLERS)
+								BX_WARN(false, "Binding index is too large %d max is %d. User defined uniform '%s' won't be set.", int(arg.index), BGFX_CONFIG_MAX_TEXTURE_SAMPLERS - 1, name);
+							}
+							else
+							{
+								ps->m_bindingTypes[arg.index] = fragmentBit ? PipelineStateMtl::BindToFragmentShader : PipelineStateMtl::BindToVertexShader;
+								const UniformRegInfo* info = s_renderMtl->m_uniformReg.find(name);
+								if (info)
 								{
-									BX_WARN(false, "Binding index is too large %d max is %d. User defined uniform '%s' won't be set.", int(arg.index), BGFX_CONFIG_MAX_TEXTURE_SAMPLERS - 1, name);
+									BX_TRACE("texture %s %d index:%d", name, info->m_handle, uint32_t(arg.index) );
 								}
 								else
 								{
-									ps->m_bindingTypes[arg.index] = fragmentBit ? PipelineStateMtl::BindToFragmentShader : PipelineStateMtl::BindToVertexShader;
-									BX_TRACE("texture %s %d index:%d", name, info->m_handle, uint32_t(arg.index) );
+									BX_TRACE("image %s index:%d", name, uint32_t(arg.index) );
 								}
 							}
 						}