rhi: gl: Prevent breaking with ES when querying the sampler mapping table
Send the full QShaderVersion down the line, not just the version number. Change-Id: I895d552fc47e0eb4ca92f32f117cd5a1d4d9015a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
e4c2460507
commit
0739170d4b
@ -4127,7 +4127,7 @@ static inline GLenum toGlShaderType(QRhiShaderStage::Type type)
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray QRhiGles2::shaderSource(const QRhiShaderStage &shaderStage, int *glslVersion)
|
||||
QByteArray QRhiGles2::shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion)
|
||||
{
|
||||
const QShader bakedShader = shaderStage.shader();
|
||||
QList<int> versionsToTry;
|
||||
@ -4146,8 +4146,8 @@ QByteArray QRhiGles2::shaderSource(const QRhiShaderStage &shaderStage, int *glsl
|
||||
QShaderVersion ver(v, QShaderVersion::GlslEs);
|
||||
source = bakedShader.shader({ QShader::GlslShader, ver, shaderStage.shaderVariant() }).shader();
|
||||
if (!source.isEmpty()) {
|
||||
if (glslVersion)
|
||||
*glslVersion = v;
|
||||
if (shaderVersion)
|
||||
*shaderVersion = ver;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4180,8 +4180,8 @@ QByteArray QRhiGles2::shaderSource(const QRhiShaderStage &shaderStage, int *glsl
|
||||
for (int v : versionsToTry) {
|
||||
source = bakedShader.shader({ QShader::GlslShader, v, shaderStage.shaderVariant() }).shader();
|
||||
if (!source.isEmpty()) {
|
||||
if (glslVersion)
|
||||
*glslVersion = v;
|
||||
if (shaderVersion)
|
||||
*shaderVersion = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4193,9 +4193,9 @@ QByteArray QRhiGles2::shaderSource(const QRhiShaderStage &shaderStage, int *glsl
|
||||
return source;
|
||||
}
|
||||
|
||||
bool QRhiGles2::compileShader(GLuint program, const QRhiShaderStage &shaderStage, int *glslVersion)
|
||||
bool QRhiGles2::compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion)
|
||||
{
|
||||
const QByteArray source = shaderSource(shaderStage, glslVersion);
|
||||
const QByteArray source = shaderSource(shaderStage, shaderVersion);
|
||||
if (source.isEmpty())
|
||||
return false;
|
||||
|
||||
@ -5337,18 +5337,18 @@ bool QGles2GraphicsPipeline::create()
|
||||
QShader::SeparateToCombinedImageSamplerMappingList fsSamplerMappingList;
|
||||
for (const QRhiShaderStage &shaderStage : qAsConst(m_shaderStages)) {
|
||||
QShader shader = shaderStage.shader();
|
||||
int glslVersion = 0;
|
||||
QShaderVersion shaderVersion;
|
||||
if (shaderStage.type() == QRhiShaderStage::Vertex) {
|
||||
vsDesc = shader.description();
|
||||
if (!rhiD->shaderSource(shaderStage, &glslVersion).isEmpty()) {
|
||||
if (!rhiD->shaderSource(shaderStage, &shaderVersion).isEmpty()) {
|
||||
vsSamplerMappingList = shader.separateToCombinedImageSamplerMappingList(
|
||||
{ QShader::GlslShader, glslVersion, shaderStage.shaderVariant() });
|
||||
{ QShader::GlslShader, shaderVersion, shaderStage.shaderVariant() });
|
||||
}
|
||||
} else if (shaderStage.type() == QRhiShaderStage::Fragment) {
|
||||
fsDesc = shader.description();
|
||||
if (!rhiD->shaderSource(shaderStage, &glslVersion).isEmpty()) {
|
||||
if (!rhiD->shaderSource(shaderStage, &shaderVersion).isEmpty()) {
|
||||
fsSamplerMappingList = shader.separateToCombinedImageSamplerMappingList(
|
||||
{ QShader::GlslShader, glslVersion, shaderStage.shaderVariant() });
|
||||
{ QShader::GlslShader, shaderVersion, shaderStage.shaderVariant() });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5482,10 +5482,10 @@ bool QGles2ComputePipeline::create()
|
||||
|
||||
const QShaderDescription csDesc = m_shaderStage.shader().description();
|
||||
QShader::SeparateToCombinedImageSamplerMappingList csSamplerMappingList;
|
||||
int glslVersion = 0;
|
||||
if (!rhiD->shaderSource(m_shaderStage, &glslVersion).isEmpty()) {
|
||||
QShaderVersion shaderVersion;
|
||||
if (!rhiD->shaderSource(m_shaderStage, &shaderVersion).isEmpty()) {
|
||||
csSamplerMappingList = m_shaderStage.shader().separateToCombinedImageSamplerMappingList(
|
||||
{ QShader::GlslShader, glslVersion, m_shaderStage.shaderVariant() });
|
||||
{ QShader::GlslShader, shaderVersion, m_shaderStage.shaderVariant() });
|
||||
}
|
||||
|
||||
program = rhiD->f->glCreateProgram();
|
||||
|
@ -875,8 +875,8 @@ public:
|
||||
bool *wantsColorClear = nullptr, bool *wantsDsClear = nullptr);
|
||||
void enqueueBarriersForPass(QGles2CommandBuffer *cbD);
|
||||
int effectiveSampleCount(int sampleCount) const;
|
||||
QByteArray shaderSource(const QRhiShaderStage &shaderStage, int *glslVersion);
|
||||
bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, int *glslVersion);
|
||||
QByteArray shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
|
||||
bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
|
||||
bool linkProgram(GLuint program);
|
||||
void registerUniformIfActive(const QShaderDescription::BlockVariable &var,
|
||||
const QByteArray &namePrefix, int binding, int baseOffset,
|
||||
|
Loading…
Reference in New Issue
Block a user