mesa/glsl/i965: set and use tcs vertices_out directly
authorTimothy Arceri <timothy.arceri@collabora.com>
Tue, 22 Nov 2016 02:10:18 +0000 (13:10 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Thu, 19 Jan 2017 06:05:26 +0000 (17:05 +1100)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/compiler/glsl/linker.cpp
src/mesa/drivers/dri/i965/brw_tcs.c
src/mesa/main/shaderapi.c

index dea78384a38ef5538389818e59f3ed8bfdba2850..7073eac9d918e30b9c8db721551c5f25d17ba664 100644 (file)
@@ -1659,15 +1659,15 @@ link_xfb_stride_layout_qualifiers(struct gl_context *ctx,
  */
 static void
 link_tcs_out_layout_qualifiers(struct gl_shader_program *prog,
-                               struct gl_linked_shader *linked_shader,
+                               struct gl_program *gl_prog,
                                struct gl_shader **shader_list,
                                unsigned num_shaders)
 {
-   linked_shader->info.TessCtrl.VerticesOut = 0;
-
-   if (linked_shader->Stage != MESA_SHADER_TESS_CTRL)
+   if (gl_prog->info.stage != MESA_SHADER_TESS_CTRL)
       return;
 
+   gl_prog->info.tess.tcs_vertices_out = 0;
+
    /* From the GLSL 4.0 spec (chapter 4.3.8.2):
     *
     *     "All tessellation control shader layout declarations in a program
@@ -1682,16 +1682,16 @@ link_tcs_out_layout_qualifiers(struct gl_shader_program *prog,
       struct gl_shader *shader = shader_list[i];
 
       if (shader->info.TessCtrl.VerticesOut != 0) {
-         if (linked_shader->info.TessCtrl.VerticesOut != 0 &&
-             linked_shader->info.TessCtrl.VerticesOut !=
-             shader->info.TessCtrl.VerticesOut) {
+         if (gl_prog->info.tess.tcs_vertices_out != 0 &&
+             gl_prog->info.tess.tcs_vertices_out !=
+             (unsigned) shader->info.TessCtrl.VerticesOut) {
             linker_error(prog, "tessellation control shader defined with "
                          "conflicting output vertex count (%d and %d)\n",
-                         linked_shader->info.TessCtrl.VerticesOut,
+                         gl_prog->info.tess.tcs_vertices_out,
                          shader->info.TessCtrl.VerticesOut);
             return;
          }
-         linked_shader->info.TessCtrl.VerticesOut =
+         gl_prog->info.tess.tcs_vertices_out =
             shader->info.TessCtrl.VerticesOut;
       }
    }
@@ -1700,7 +1700,7 @@ link_tcs_out_layout_qualifiers(struct gl_shader_program *prog,
     * since we already know we're in the right type of shader program
     * for doing it.
     */
-   if (linked_shader->info.TessCtrl.VerticesOut == 0) {
+   if (gl_prog->info.tess.tcs_vertices_out == 0) {
       linker_error(prog, "tessellation control shader didn't declare "
                    "vertices out layout qualifier\n");
       return;
@@ -2218,7 +2218,7 @@ link_intrastage_shaders(void *mem_ctx,
    clone_ir_list(mem_ctx, linked->ir, main->ir);
 
    link_fs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders);
-   link_tcs_out_layout_qualifiers(prog, linked, shader_list, num_shaders);
+   link_tcs_out_layout_qualifiers(prog, gl_prog, shader_list, num_shaders);
    link_tes_in_layout_qualifiers(prog, linked, shader_list, num_shaders);
    link_gs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders);
    link_cs_input_layout_qualifiers(prog, linked, shader_list, num_shaders);
@@ -2431,7 +2431,7 @@ resize_tes_inputs(struct gl_context *ctx,
     * known until draw time.
     */
    const int num_vertices = tcs
-      ? tcs->info.TessCtrl.VerticesOut
+      ? tcs->Program->info.tess.tcs_vertices_out
       : ctx->Const.MaxPatchVertices;
 
    array_resize_visitor input_resize_visitor(num_vertices, prog,
index bbba7496fa609bb6923b92e581e6c2edb5e6313d..cafa4b4b411ae156307a25cb836f2a600b9a9b22 100644 (file)
@@ -380,10 +380,8 @@ brw_tcs_precompile(struct gl_context *ctx,
    brw_setup_tex_for_precompile(brw, &key.tex, prog);
 
    /* Guess that the input and output patches have the same dimensionality. */
-   if (brw->gen < 8) {
-      key.input_vertices = shader_prog->
-         _LinkedShaders[MESA_SHADER_TESS_CTRL]->info.TessCtrl.VerticesOut;
-   }
+   if (brw->gen < 8)
+      key.input_vertices = prog->info.tess.tcs_vertices_out;
 
    struct brw_program *btep;
    if (tes) {
index 00577dc35956a38eacc7d85c8151c40b5c23121d..3502cb2ee606042cdfb84495153dd089622689c0 100644 (file)
@@ -823,7 +823,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
          break;
       if (check_tcs_query(ctx, shProg)) {
          *params = shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]->
-            info.TessCtrl.VerticesOut;
+            Program->info.tess.tcs_vertices_out;
       }
       return;
    case GL_TESS_GEN_MODE:
@@ -2209,10 +2209,6 @@ _mesa_copy_linked_program_data(const struct gl_shader_program *src,
       dst->ClipDistanceArraySize = src->Vert.ClipDistanceArraySize;
       dst->CullDistanceArraySize = src->Vert.CullDistanceArraySize;
       break;
-   case MESA_SHADER_TESS_CTRL: {
-      dst->info.tess.tcs_vertices_out = dst_sh->info.TessCtrl.VerticesOut;
-      break;
-   }
    case MESA_SHADER_TESS_EVAL: {
       dst->info.tess.primitive_mode = dst_sh->info.TessEval.PrimitiveMode;
       dst->info.tess.spacing = dst_sh->info.TessEval.Spacing;