diff options
Diffstat (limited to 'src/Runtime/Source/Qt3DSRender/Source/backends')
-rw-r--r-- | src/Runtime/Source/Qt3DSRender/Source/backends/gl/Qt3DSRenderBackendGL4.cpp | 9 | ||||
-rw-r--r-- | src/Runtime/Source/Qt3DSRender/Source/backends/gl/Qt3DSRenderBackendGLBase.cpp | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/Runtime/Source/Qt3DSRender/Source/backends/gl/Qt3DSRenderBackendGL4.cpp b/src/Runtime/Source/Qt3DSRender/Source/backends/gl/Qt3DSRenderBackendGL4.cpp index 47a26e7f..08ff9bb0 100644 --- a/src/Runtime/Source/Qt3DSRender/Source/backends/gl/Qt3DSRenderBackendGL4.cpp +++ b/src/Runtime/Source/Qt3DSRender/Source/backends/gl/Qt3DSRenderBackendGL4.cpp @@ -513,8 +513,13 @@ namespace render { case GL_SAMPLER_2D_ARRAY: case GL_SAMPLER_2D_SHADOW: case GL_SAMPLER_CUBE: { - GLint sampler = *(GLint *)value; - GL_CALL_EXTRA_FUNCTION(glProgramUniform1i(programID, id, sampler)); + if (count <= 1) { + GLint sampler = *(GLint *)value; + GL_CALL_EXTRA_FUNCTION(glProgramUniform1i(programID, id, sampler)); + } else { + GLint *sampler = (GLint *)value; + GL_CALL_EXTRA_FUNCTION(glProgramUniform1iv(programID, id, count, sampler)); + } } break; default: qCCritical(INTERNAL_ERROR, "Unknown shader type format %d", type); diff --git a/src/Runtime/Source/Qt3DSRender/Source/backends/gl/Qt3DSRenderBackendGLBase.cpp b/src/Runtime/Source/Qt3DSRender/Source/backends/gl/Qt3DSRenderBackendGLBase.cpp index 7a780e24..0fb26b35 100644 --- a/src/Runtime/Source/Qt3DSRender/Source/backends/gl/Qt3DSRenderBackendGLBase.cpp +++ b/src/Runtime/Source/Qt3DSRender/Source/backends/gl/Qt3DSRenderBackendGLBase.cpp @@ -1962,8 +1962,13 @@ namespace render { case GL_SAMPLER_2D_ARRAY: case GL_SAMPLER_2D_SHADOW: case GL_SAMPLER_CUBE: { - GLint sampler = *(GLint *)value; - GL_CALL_FUNCTION(glUniform1i(id, sampler)); + if (count > 1) { + GLint *sampler = (GLint *)value; + GL_CALL_FUNCTION(glUniform1iv(id, count, sampler)); + } else { + GLint sampler = *(GLint *)value; + GL_CALL_FUNCTION(glUniform1i(id, sampler)); + } } break; default: qCCritical(INTERNAL_ERROR, "Unknown shader type format %d", type); |