mirror of https://github.com/AxioDL/boo.git
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,13 +583,7 @@ 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
|
||||||
{
|
{
|
||||||
|
@ -629,21 +623,24 @@ 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];
|
||||||
switch (tex->type())
|
if (tex)
|
||||||
{
|
{
|
||||||
case TextureType::Dynamic:
|
switch (tex->type())
|
||||||
static_cast<GLTextureD*>(tex)->bind(i, b);
|
{
|
||||||
break;
|
case TextureType::Dynamic:
|
||||||
case TextureType::Static:
|
static_cast<GLTextureD*>(tex)->bind(i, b);
|
||||||
static_cast<GLTextureS*>(tex)->bind(i);
|
break;
|
||||||
break;
|
case TextureType::Static:
|
||||||
case TextureType::StaticArray:
|
static_cast<GLTextureS*>(tex)->bind(i);
|
||||||
static_cast<GLTextureSA*>(tex)->bind(i);
|
break;
|
||||||
break;
|
case TextureType::StaticArray:
|
||||||
case TextureType::Render:
|
static_cast<GLTextureSA*>(tex)->bind(i);
|
||||||
static_cast<GLTextureR*>(tex)->bind(i);
|
break;
|
||||||
break;
|
case TextureType::Render:
|
||||||
default: break;
|
static_cast<GLTextureR*>(tex)->bind(i);
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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…
Reference in New Issue