Browse Source

mesa/glsl/i965: set and use tcs vertices_out directly

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
tags/17.1-branchpoint
Timothy Arceri 9 years ago
parent
commit
5c93d27423
3 changed files with 15 additions and 21 deletions
  1. 12
    12
      src/compiler/glsl/linker.cpp
  2. 2
    4
      src/mesa/drivers/dri/i965/brw_tcs.c
  3. 1
    5
      src/mesa/main/shaderapi.c

+ 12
- 12
src/compiler/glsl/linker.cpp View File

*/ */
static void static void
link_tcs_out_layout_qualifiers(struct gl_shader_program *prog, 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, struct gl_shader **shader_list,
unsigned num_shaders) 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; return;


gl_prog->info.tess.tcs_vertices_out = 0;

/* From the GLSL 4.0 spec (chapter 4.3.8.2): /* From the GLSL 4.0 spec (chapter 4.3.8.2):
* *
* "All tessellation control shader layout declarations in a program * "All tessellation control shader layout declarations in a program
struct gl_shader *shader = shader_list[i]; struct gl_shader *shader = shader_list[i];


if (shader->info.TessCtrl.VerticesOut != 0) { 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 " linker_error(prog, "tessellation control shader defined with "
"conflicting output vertex count (%d and %d)\n", "conflicting output vertex count (%d and %d)\n",
linked_shader->info.TessCtrl.VerticesOut,
gl_prog->info.tess.tcs_vertices_out,
shader->info.TessCtrl.VerticesOut); shader->info.TessCtrl.VerticesOut);
return; return;
} }
linked_shader->info.TessCtrl.VerticesOut =
gl_prog->info.tess.tcs_vertices_out =
shader->info.TessCtrl.VerticesOut; shader->info.TessCtrl.VerticesOut;
} }
} }
* since we already know we're in the right type of shader program * since we already know we're in the right type of shader program
* for doing it. * 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 " linker_error(prog, "tessellation control shader didn't declare "
"vertices out layout qualifier\n"); "vertices out layout qualifier\n");
return; return;
clone_ir_list(mem_ctx, linked->ir, main->ir); clone_ir_list(mem_ctx, linked->ir, main->ir);


link_fs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders); 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_tes_in_layout_qualifiers(prog, linked, shader_list, num_shaders);
link_gs_inout_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); link_cs_input_layout_qualifiers(prog, linked, shader_list, num_shaders);
* known until draw time. * known until draw time.
*/ */
const int num_vertices = tcs const int num_vertices = tcs
? tcs->info.TessCtrl.VerticesOut
? tcs->Program->info.tess.tcs_vertices_out
: ctx->Const.MaxPatchVertices; : ctx->Const.MaxPatchVertices;


array_resize_visitor input_resize_visitor(num_vertices, prog, array_resize_visitor input_resize_visitor(num_vertices, prog,

+ 2
- 4
src/mesa/drivers/dri/i965/brw_tcs.c View File

brw_setup_tex_for_precompile(brw, &key.tex, prog); brw_setup_tex_for_precompile(brw, &key.tex, prog);


/* Guess that the input and output patches have the same dimensionality. */ /* 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; struct brw_program *btep;
if (tes) { if (tes) {

+ 1
- 5
src/mesa/main/shaderapi.c View File

break; break;
if (check_tcs_query(ctx, shProg)) { if (check_tcs_query(ctx, shProg)) {
*params = shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]-> *params = shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]->
info.TessCtrl.VerticesOut;
Program->info.tess.tcs_vertices_out;
} }
return; return;
case GL_TESS_GEN_MODE: case GL_TESS_GEN_MODE:
dst->ClipDistanceArraySize = src->Vert.ClipDistanceArraySize; dst->ClipDistanceArraySize = src->Vert.ClipDistanceArraySize;
dst->CullDistanceArraySize = src->Vert.CullDistanceArraySize; dst->CullDistanceArraySize = src->Vert.CullDistanceArraySize;
break; break;
case MESA_SHADER_TESS_CTRL: {
dst->info.tess.tcs_vertices_out = dst_sh->info.TessCtrl.VerticesOut;
break;
}
case MESA_SHADER_TESS_EVAL: { case MESA_SHADER_TESS_EVAL: {
dst->info.tess.primitive_mode = dst_sh->info.TessEval.PrimitiveMode; dst->info.tess.primitive_mode = dst_sh->info.TessEval.PrimitiveMode;
dst->info.tess.spacing = dst_sh->info.TessEval.Spacing; dst->info.tess.spacing = dst_sh->info.TessEval.Spacing;

Loading…
Cancel
Save