mirror of https://github.com/axmolengine/axmol.git
More clearly comment
This commit is contained in:
parent
ef755ba3ad
commit
e0be836453
|
@ -423,8 +423,8 @@ void CommandBufferMTL::doSetTextures(bool isVertex) const
|
||||||
for(const auto& iter : bindTextureInfos)
|
for(const auto& iter : bindTextureInfos)
|
||||||
{
|
{
|
||||||
/* About mutli textures support
|
/* About mutli textures support
|
||||||
* a. sampler2DArray, not implemented in Metal Renderer
|
* a. TODO: sampler2DArray, not implemented in Metal Renderer currently
|
||||||
* b. texture slot, one BackendTexture, multi GPU texture handlers, used by etc1
|
* b. texture slot, one BackendTexture, multi GPU texture handlers, used by etc1, restrict: textures must have same size
|
||||||
* c. Bind multi BackendTexture to 1 Shader Program, see the ShaderTest
|
* c. Bind multi BackendTexture to 1 Shader Program, see the ShaderTest
|
||||||
* d. iter.second.slots not used for Metal Renderer
|
* d. iter.second.slots not used for Metal Renderer
|
||||||
*/
|
*/
|
||||||
|
@ -432,24 +432,22 @@ void CommandBufferMTL::doSetTextures(bool isVertex) const
|
||||||
auto& textures = iter.second.textures;
|
auto& textures = iter.second.textures;
|
||||||
auto& indexs = iter.second.indexs;
|
auto& indexs = iter.second.indexs;
|
||||||
|
|
||||||
int i = 0;
|
auto texture = textures[0];
|
||||||
for (const auto& texture : textures)
|
auto index = indexs[0];
|
||||||
|
|
||||||
|
if (isVertex)
|
||||||
{
|
{
|
||||||
if (isVertex)
|
[_mtlRenderEncoder setVertexTexture:getMTLTexture(texture, index)
|
||||||
{
|
atIndex:location];
|
||||||
[_mtlRenderEncoder setVertexTexture:getMTLTexture(texture, indexs[i])
|
[_mtlRenderEncoder setVertexSamplerState:getMTLSamplerState(texture)
|
||||||
atIndex:location];
|
atIndex:location];
|
||||||
[_mtlRenderEncoder setVertexSamplerState:getMTLSamplerState(texture)
|
}
|
||||||
atIndex:location];
|
else
|
||||||
}
|
{
|
||||||
else
|
[_mtlRenderEncoder setFragmentTexture:getMTLTexture(texture, index)
|
||||||
{
|
atIndex:location];
|
||||||
[_mtlRenderEncoder setFragmentTexture:getMTLTexture(texture, indexs[i])
|
[_mtlRenderEncoder setFragmentSamplerState:getMTLSamplerState(texture)
|
||||||
atIndex:location];
|
atIndex:location];
|
||||||
[_mtlRenderEncoder setFragmentSamplerState:getMTLSamplerState(texture)
|
|
||||||
atIndex:location];
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -480,7 +480,7 @@ void CommandBufferGL::setUniforms(ProgramGL* program) const
|
||||||
{
|
{
|
||||||
/* About mutli textures support
|
/* About mutli textures support
|
||||||
* a. sampler2DArray, sampler2D[2], bind BackendTexture one by one, not use GL_TEXTURE_2D_ARRAY, not used at all engine interanl
|
* a. sampler2DArray, sampler2D[2], bind BackendTexture one by one, not use GL_TEXTURE_2D_ARRAY, not used at all engine interanl
|
||||||
* b. texture slot, one BackendTexture, multi GPU texture handlers, used by etc1
|
* b. texture slot, one BackendTexture, multi GPU texture handlers, used by etc1, restrict: textures must have same size
|
||||||
* c. Bind multi BackendTexture to 1 Shader Program, see the ShaderTest
|
* c. Bind multi BackendTexture to 1 Shader Program, see the ShaderTest
|
||||||
*/
|
*/
|
||||||
auto& textures = iter.second.textures;
|
auto& textures = iter.second.textures;
|
||||||
|
@ -498,7 +498,7 @@ void CommandBufferGL::setUniforms(ProgramGL* program) const
|
||||||
}
|
}
|
||||||
|
|
||||||
auto arrayCount = slots.size();
|
auto arrayCount = slots.size();
|
||||||
if (arrayCount == 1) // If not use sampler2DArray, always 1
|
if (arrayCount == 1) // Most of the time, not use sampler2DArray, should be 1
|
||||||
glUniform1i(location, slots[0]);
|
glUniform1i(location, slots[0]);
|
||||||
else
|
else
|
||||||
glUniform1iv(location, (uint32_t)arrayCount, (GLint*)slots.data());
|
glUniform1iv(location, (uint32_t)arrayCount, (GLint*)slots.data());
|
||||||
|
|
|
@ -63,7 +63,7 @@ struct TextureInfoGL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// update shader texture
|
/// Apply shader texture
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="slot">the slot in shader</param>
|
/// <param name="slot">the slot in shader</param>
|
||||||
/// <param name="index">the index in meta textrues</param>
|
/// <param name="index">the index in meta textrues</param>
|
||||||
|
|
Loading…
Reference in New Issue