aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-01-27 15:34:53 +1100
committerTimothy Arceri <[email protected]>2016-02-09 22:44:07 +1100
commit20823992b41285f0fed77a4ba6f421420799c819 (patch)
treee57757b3678f24c0c1fc0ef8f18d5842f45e4d49 /src/compiler
parent76cfb472077dc83c892b4cddf79333341deaa7b5 (diff)
glsl: small tidy up now that link_shaders() exits early with 0 shaders
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/linker.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 31efb57b035..69830937d3b 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4149,13 +4149,11 @@ 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) {
+ if (prog->Shaders[i]->IsES != prog->Shaders[0]->IsES) {
linker_error(prog, "all shaders must use same shading "
"language version\n");
goto done;
@@ -4173,14 +4171,14 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
/* In desktop GLSL, different shader versions may be linked together. In
* GLSL ES, all shader versions must be the same.
*/
- if (is_es_prog && min_version != max_version) {
+ if (prog->Shaders[0]->IsES && min_version != max_version) {
linker_error(prog, "all shaders must use same shading "
"language version\n");
goto done;
}
prog->Version = max_version;
- prog->IsES = is_es_prog;
+ prog->IsES = prog->Shaders[0]->IsES;
/* Some shaders have to be linked with some other shaders present.
*/
@@ -4363,7 +4361,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
*
* This rule also applies to GLSL ES 3.00.
*/
- if (max_version >= (is_es_prog ? 300 : 130)) {
+ if (max_version >= (prog->IsES ? 300 : 130)) {
struct gl_shader *sh = prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
if (sh) {
lower_discard_flow(sh->ir);