mirror of
https://github.com/AxioDL/boo.git
synced 2025-06-07 15:13:35 +00:00
support for nullptr in texture binding array
This commit is contained in:
parent
c01b0b4c6a
commit
bec368dfe7
@ -517,7 +517,7 @@ IShaderPipeline* GLDataFactory::Context::newShaderPipeline
|
|||||||
{
|
{
|
||||||
GLint texLoc = glGetUniformLocation(shader.m_prog, texNames[i]);
|
GLint texLoc = glGetUniformLocation(shader.m_prog, texNames[i]);
|
||||||
if (texLoc < 0)
|
if (texLoc < 0)
|
||||||
Log.report(logvisor::Error, "unable to find sampler variable '%s'", texNames[i]);
|
Log.report(logvisor::Warning, "unable to find sampler variable '%s'", texNames[i]);
|
||||||
else
|
else
|
||||||
glUniform1i(texLoc, i);
|
glUniform1i(texLoc, i);
|
||||||
}
|
}
|
||||||
@ -583,14 +583,8 @@ struct GLShaderDataBinding : IShaderDataBinding
|
|||||||
m_ubufs[i] = ubufs[i];
|
m_ubufs[i] = ubufs[i];
|
||||||
}
|
}
|
||||||
for (size_t i=0 ; i<texCount ; ++i)
|
for (size_t i=0 ; i<texCount ; ++i)
|
||||||
{
|
|
||||||
#ifndef NDEBUG
|
|
||||||
if (!texs[i])
|
|
||||||
Log.report(logvisor::Fatal, "null texture %d provided to newShaderDataBinding", int(i));
|
|
||||||
#endif
|
|
||||||
m_texs[i] = texs[i];
|
m_texs[i] = texs[i];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
void bind(int b) const
|
void bind(int b) const
|
||||||
{
|
{
|
||||||
GLuint prog = m_pipeline->bind();
|
GLuint prog = m_pipeline->bind();
|
||||||
@ -629,6 +623,8 @@ struct GLShaderDataBinding : IShaderDataBinding
|
|||||||
for (size_t i=0 ; i<m_texCount ; ++i)
|
for (size_t i=0 ; i<m_texCount ; ++i)
|
||||||
{
|
{
|
||||||
ITexture* tex = m_texs[i];
|
ITexture* tex = m_texs[i];
|
||||||
|
if (tex)
|
||||||
|
{
|
||||||
switch (tex->type())
|
switch (tex->type())
|
||||||
{
|
{
|
||||||
case TextureType::Dynamic:
|
case TextureType::Dynamic:
|
||||||
@ -647,6 +643,7 @@ struct GLShaderDataBinding : IShaderDataBinding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IShaderDataBinding*
|
IShaderDataBinding*
|
||||||
|
@ -1982,13 +1982,7 @@ struct VulkanShaderDataBinding : IShaderDataBinding
|
|||||||
m_ubufs[i] = ubufs[i];
|
m_ubufs[i] = ubufs[i];
|
||||||
}
|
}
|
||||||
for (size_t i=0 ; i<texCount ; ++i)
|
for (size_t i=0 ; i<texCount ; ++i)
|
||||||
{
|
|
||||||
#ifndef NDEBUG
|
|
||||||
if (!texs[i])
|
|
||||||
Log.report(logvisor::Fatal, "null texture %d provided to newShaderDataBinding", int(i));
|
|
||||||
#endif
|
|
||||||
m_texs[i] = texs[i];
|
m_texs[i] = texs[i];
|
||||||
}
|
|
||||||
|
|
||||||
size_t totalDescs = ubufCount + texCount;
|
size_t totalDescs = ubufCount + texCount;
|
||||||
if (totalDescs > 0)
|
if (totalDescs > 0)
|
||||||
@ -2099,7 +2093,7 @@ struct VulkanShaderDataBinding : IShaderDataBinding
|
|||||||
|
|
||||||
for (size_t i=0 ; i<BOO_GLSL_MAX_TEXTURE_COUNT ; ++i)
|
for (size_t i=0 ; i<BOO_GLSL_MAX_TEXTURE_COUNT ; ++i)
|
||||||
{
|
{
|
||||||
if (i<m_texCount)
|
if (i<m_texCount && m_texs[i])
|
||||||
{
|
{
|
||||||
writes[totalWrites].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
writes[totalWrites].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||||
writes[totalWrites].pNext = nullptr;
|
writes[totalWrites].pNext = nullptr;
|
||||||
@ -2137,7 +2131,7 @@ struct VulkanShaderDataBinding : IShaderDataBinding
|
|||||||
size_t totalWrites = 0;
|
size_t totalWrites = 0;
|
||||||
for (size_t i=0 ; i<BOO_GLSL_MAX_TEXTURE_COUNT ; ++i)
|
for (size_t i=0 ; i<BOO_GLSL_MAX_TEXTURE_COUNT ; ++i)
|
||||||
{
|
{
|
||||||
if (i<m_texCount)
|
if (i<m_texCount && m_texs[i])
|
||||||
{
|
{
|
||||||
const VkDescriptorImageInfo* resComp = GetTextureGPUResource(m_texs[i], b);
|
const VkDescriptorImageInfo* resComp = GetTextureGPUResource(m_texs[i], b);
|
||||||
if (resComp->imageView != m_knownViewHandles[b][i])
|
if (resComp->imageView != m_knownViewHandles[b][i])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user