On Wednesday, July 18, 2018 4:22:41 AM PDT Timothy Arceri wrote: > 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). > --- > run.c | 23 ++++------------------- > 1 file changed, 4 insertions(+), 19 deletions(-) > > diff --git a/run.c b/run.c > index fdb610d..aa64d2c 100644 > --- a/run.c > +++ b/run.c > @@ -809,27 +809,12 @@ 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); > - 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(); > > + 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); >
This looks good to me. It looks like MESA_SHADER_CAPTURE_PATH would dump multiple shaders to the same file, with "SSO ENABLED" set, if a SSO program contained multiple shader stages. At which point, we'd want to compile them together...which your patch arranges for. If there's only one stage in a program, then your patch should be equivalent. Also, it's much less code. Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev