diff options
author | Timothy Arceri <tarceri@itsqueeze.com> | 2018-07-18 21:15:38 +1000 |
---|---|---|
committer | Timothy Arceri <tarceri@itsqueeze.com> | 2018-07-21 09:32:29 +1000 |
commit | 372703f3c5f4bfd6a2a7bea21f93e1cc7f0fd184 (patch) | |
tree | a120c339261cc484aab0935bbfa87c02924ba85b /run.c | |
parent | 109520bae5b2ce725eb3ddfd8e0fe95a8713ee9d (diff) |
shader-db: simplify and improve SSO handling
This does two things:
1. Allows cross shader optimisations to be preformed on SSO
programs that contain more than one stage (seems like I
don't have any of these in my shader-db collection).
2. Allows us to write compilation errors to stderr. With this
change I discovered a Deus Ex: MD shader was failing to
compile (I've reported it to Feral).
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'run.c')
-rw-r--r-- | run.c | 29 |
1 files changed, 4 insertions, 25 deletions
@@ -881,34 +881,13 @@ main(int argc, char **argv) if (num_shaders == 1 && type != TYPE_VP && type != TYPE_FP) use_separate_shader_objects = true; - if (use_separate_shader_objects) { - for (unsigned i = 0; i < num_shaders; i++) { - const char *const_text; - unsigned size = shader[i].length + 1; - /* Using alloca crashes in the GLSL compiler. */ - char *text = malloc(size); - memset(text, 0, size); - - /* Make it zero-terminated. */ - memcpy(text, shader[i].text, shader[i].length); - text[shader[i].length] = 0; - - const_text = text; - GLuint prog = glCreateShaderProgramv(shader[i].type, 1, - &const_text); - - if (generate_prog_bin) - fprintf(stderr, - "Currently, program binary generation " - "doesn't support SSO.\n"); - - glDeleteProgram(prog); - free(text); - } - } else if (type == TYPE_CORE || type == TYPE_COMPAT || type == TYPE_ES) { + if (type == TYPE_CORE || type == TYPE_COMPAT || type == TYPE_ES) { GLuint prog = glCreateProgram(); GLint param; + if (use_separate_shader_objects) + glProgramParameteri(prog, GL_PROGRAM_SEPARABLE, GL_TRUE); + for (unsigned i = 0; i < num_shaders; i++) { GLuint s = glCreateShader(shader[i].type); glShaderSource(s, 1, &shader[i].text, &shader[i].length); |