rhi: gl: Add support for bool members in uniform blocks

Note that SPIRV-Cross does not translate 'bool' to GLSL versions
that do not have uint. So in practice we will still need to use
'int' instead in shaders that also target old GL versions.

Change-Id: I070f5414fe761796ab92937034b7182cdfb73a14
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
bb10
Laszlo Agocs 2019-07-31 15:08:11 +02:00
parent b4b2a066c0
commit 804ddcfb17
1 changed files with 12 additions and 0 deletions

View File

@ -2337,6 +2337,18 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC
case QShaderDescription::Uint4:
f->glUniform4uiv(uniform.glslLocation, 1, reinterpret_cast<const quint32 *>(src));
break;
case QShaderDescription::Bool: // a glsl bool is 4 bytes, like (u)int
f->glUniform1i(uniform.glslLocation, *reinterpret_cast<const qint32 *>(src));
break;
case QShaderDescription::Bool2:
f->glUniform2iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(src));
break;
case QShaderDescription::Bool3:
f->glUniform3iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(src));
break;
case QShaderDescription::Bool4:
f->glUniform4iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(src));
break;
// ### more types
default:
break;