mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
glsl: Clean up shading language mixing check for GLSL 3.00 ES.
Previously, we prohibited mixing of shading language versions if min_version == 100 or max_version >= 130. This was technically correct (since desktop GLSL 1.30 and beyond prohibit mixing of shading language versions, as does GLSL 1.00 ES), but it was confusing. Also, we asserted that all shading language versions were between 1.00 and 1.40, which was unnecessary (since the parser already checks shading language versions) and doesn't work for GLSL 3.00 ES. This patch changes the code to explicitly check that (a) ES shaders aren't mixed with desktop shaders, (b) shaders aren't mixed between ES versions, and (c) shaders aren't mixed between desktop GLSL versions when at least one shader is GLSL 1.30 or greater. Also, it removes the unnecessary assertion. [v2, idr]: Slightly tweak the is_es_prog detection to occur outside the loop instead of doing something special on the first loop iteration. Suggested by Ken. [v3, idr]: s/IsEs(Shader|Prog)/IsES/ Suggested by Ken and Eric. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1] Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Carl Worth <cworth@cworth.org>
This commit is contained in:
parent
c150e876b4
commit
a9f34dc304
1 changed files with 11 additions and 3 deletions
|
|
@ -2421,10 +2421,18 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
|
|||
|
||||
unsigned min_version = UINT_MAX;
|
||||
unsigned max_version = 0;
|
||||
const bool is_es_prog =
|
||||
(prog->NumShaders > 0 && prog->Shaders[0]->IsES) ? true : false;
|
||||
for (unsigned i = 0; i < prog->NumShaders; i++) {
|
||||
min_version = MIN2(min_version, prog->Shaders[i]->Version);
|
||||
max_version = MAX2(max_version, prog->Shaders[i]->Version);
|
||||
|
||||
if (prog->Shaders[i]->IsES != is_es_prog) {
|
||||
linker_error(prog, "all shaders must use same shading "
|
||||
"language version\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
switch (prog->Shaders[i]->Type) {
|
||||
case GL_VERTEX_SHADER:
|
||||
vert_shader_list[num_vert_shaders] = prog->Shaders[i];
|
||||
|
|
@ -2444,10 +2452,10 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
|
|||
/* Previous to GLSL version 1.30, different compilation units could mix and
|
||||
* match shading language versions. With GLSL 1.30 and later, the versions
|
||||
* of all shaders must match.
|
||||
*
|
||||
* GLSL ES has never allowed mixing of shading language versions.
|
||||
*/
|
||||
assert(min_version >= 100);
|
||||
assert(max_version <= 140);
|
||||
if ((max_version >= 130 || min_version == 100)
|
||||
if ((is_es_prog || max_version >= 130)
|
||||
&& min_version != max_version) {
|
||||
linker_error(prog, "all shaders must use same shading "
|
||||
"language version\n");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue