diff options
author | marha <marha@users.sourceforge.net> | 2014-02-07 23:28:38 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-02-07 23:38:15 +0100 |
commit | 982ac918afe6a1c02d5cf735d7b6c56443a048cc (patch) | |
tree | e737eb3f7bb18d933e14f0967c1c1aa5ce5e06f6 /mesalib/src/glsl/linker.cpp | |
parent | 30af30b78075159fce477ae99cc72540133714d0 (diff) | |
download | vcxsrv-982ac918afe6a1c02d5cf735d7b6c56443a048cc.tar.gz vcxsrv-982ac918afe6a1c02d5cf735d7b6c56443a048cc.tar.bz2 vcxsrv-982ac918afe6a1c02d5cf735d7b6c56443a048cc.zip |
xkbcomp xkeyboard-config libxcb libxtrans fontconfig libX11 libxcb mesa xserver git update 7 Feb 2014
Update to openssl1.0.1f
xserver commit 83e38eb73fd8c852513aac2da2975b4c01070ec2
libxcb commit d7eb0bdf3b5b11ee9f40ee5e73df8fc0bdfa59f3
xkeyboard-config commit 7596672b96315465df8d8d691e3a567a52f70743
libX11 commit aacf95dacc7c598e7297894580d4d655593813b2
xkbcomp commit 31b90ee4ffc774e0da540277907fc5540c0b012c
libxtrans commit 3f0de269abe59353acbd7a5587d68ce0da91db67
fontconfig commit e310d2fac2d874d5aa76c609df70cc7b871c0b6d
mesa commit dd2229d4c68ed78a50104637aef904f8ab6d7dd3
Diffstat (limited to 'mesalib/src/glsl/linker.cpp')
-rw-r--r-- | mesalib/src/glsl/linker.cpp | 79 |
1 files changed, 75 insertions, 4 deletions
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp index 93b475497..bcd739476 100644 --- a/mesalib/src/glsl/linker.cpp +++ b/mesalib/src/glsl/linker.cpp @@ -1287,6 +1287,69 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, prog->Geom.VerticesOut = linked_shader->Geom.VerticesOut; } + +/** + * Perform cross-validation of compute shader local_size_{x,y,z} layout + * qualifiers for the attached compute shaders, and propagate them to the + * linked CS and linked shader program. + */ +static void +link_cs_input_layout_qualifiers(struct gl_shader_program *prog, + struct gl_shader *linked_shader, + struct gl_shader **shader_list, + unsigned num_shaders) +{ + for (int i = 0; i < 3; i++) + linked_shader->Comp.LocalSize[i] = 0; + + /* This function is called for all shader stages, but it only has an effect + * for compute shaders. + */ + if (linked_shader->Stage != MESA_SHADER_COMPUTE) + return; + + /* From the ARB_compute_shader spec, in the section describing local size + * declarations: + * + * If multiple compute shaders attached to a single program object + * declare local work-group size, the declarations must be identical; + * otherwise a link-time error results. Furthermore, if a program + * object contains any compute shaders, at least one must contain an + * input layout qualifier specifying the local work sizes of the + * program, or a link-time error will occur. + */ + for (unsigned sh = 0; sh < num_shaders; sh++) { + struct gl_shader *shader = shader_list[sh]; + + if (shader->Comp.LocalSize[0] != 0) { + if (linked_shader->Comp.LocalSize[0] != 0) { + for (int i = 0; i < 3; i++) { + if (linked_shader->Comp.LocalSize[i] != + shader->Comp.LocalSize[i]) { + linker_error(prog, "compute shader defined with conflicting " + "local sizes\n"); + return; + } + } + } + for (int i = 0; i < 3; i++) + linked_shader->Comp.LocalSize[i] = shader->Comp.LocalSize[i]; + } + } + + /* Just do the intrastage -> interstage propagation right now, + * since we already know we're in the right type of shader program + * for doing it. + */ + if (linked_shader->Comp.LocalSize[0] == 0) { + linker_error(prog, "compute shader didn't declare local size\n"); + return; + } + for (int i = 0; i < 3; i++) + prog->Comp.LocalSize[i] = linked_shader->Comp.LocalSize[i]; +} + + /** * Combine a group of shaders for a single stage to generate a linked shader * @@ -1391,6 +1454,7 @@ link_intrastage_shaders(void *mem_ctx, ralloc_steal(linked, linked->UniformBlocks); link_gs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders); + link_cs_input_layout_qualifiers(prog, linked, shader_list, num_shaders); populate_symbol_table(linked); @@ -2045,6 +2109,13 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) goto done; } + /* Compute shaders have additional restrictions. */ + if (num_shaders[MESA_SHADER_COMPUTE] > 0 && + num_shaders[MESA_SHADER_COMPUTE] != prog->NumShaders) { + linker_error(prog, "Compute shaders may not be linked with any other " + "type of shader\n"); + } + for (unsigned int i = 0; i < MESA_SHADER_STAGES; i++) { if (prog->_LinkedShaders[i] != NULL) ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]); @@ -2098,7 +2169,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) unsigned prev; - for (prev = 0; prev < MESA_SHADER_STAGES; prev++) { + for (prev = 0; prev <= MESA_SHADER_FRAGMENT; prev++) { if (prog->_LinkedShaders[prev] != NULL) break; } @@ -2106,7 +2177,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) /* Validate the inputs of each stage with the output of the preceding * stage. */ - for (unsigned i = prev + 1; i < MESA_SHADER_STAGES; i++) { + for (unsigned i = prev + 1; i <= MESA_SHADER_FRAGMENT; i++) { if (prog->_LinkedShaders[i] == NULL) continue; @@ -2201,7 +2272,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) } unsigned first; - for (first = 0; first < MESA_SHADER_STAGES; first++) { + for (first = 0; first <= MESA_SHADER_FRAGMENT; first++) { if (prog->_LinkedShaders[first] != NULL) break; } @@ -2233,7 +2304,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) * eliminated if they are (transitively) not used in a later stage. */ int last, next; - for (last = MESA_SHADER_STAGES-1; last >= 0; last--) { + for (last = MESA_SHADER_FRAGMENT; last >= 0; last--) { if (prog->_LinkedShaders[last] != NULL) break; } |