From f40b5723f017bfb9e3819a5463184627ee727cc1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 22 Jul 2012 23:06:19 +0200 Subject: [PATCH] st/mesa: set the centroid qualifier in fragment shader inputs This fixes some centroid tests in the EXT_framebuffer_multisample piglit group. Reviewed-by: Brian Paul --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 10 ++++++---- src/mesa/state_tracker/st_glsl_to_tgsi.h | 1 + src/mesa/state_tracker/st_program.c | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 50c450ea40c..45136ded2bc 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -4481,6 +4481,7 @@ st_translate_program( const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], + const GLboolean is_centroid[], GLuint numOutputs, const GLuint outputMapping[], const ubyte outputSemanticName[], @@ -4522,10 +4523,11 @@ st_translate_program( */ if (procType == TGSI_PROCESSOR_FRAGMENT) { for (i = 0; i < numInputs; i++) { - t->inputs[i] = ureg_DECL_fs_input(ureg, - inputSemanticName[i], - inputSemanticIndex[i], - interpMode[i]); + t->inputs[i] = ureg_DECL_fs_input_cyl_centroid(ureg, + inputSemanticName[i], + inputSemanticIndex[i], + interpMode[i], 0, + is_centroid[i]); } if (proginfo->InputsRead & FRAG_BIT_WPOS) { diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.h b/src/mesa/state_tracker/st_glsl_to_tgsi.h index 55d59d571bb..a3fe91f7e80 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.h +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.h @@ -45,6 +45,7 @@ enum pipe_error st_translate_program( const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], + const GLboolean is_centroid[], GLuint numOutputs, const GLuint outputMapping[], const ubyte outputSemanticName[], diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 9f98298b4a0..36015f69adf 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -347,6 +347,7 @@ st_translate_vertex_program(struct st_context *st, NULL, /* input semantic name */ NULL, /* input semantic index */ NULL, /* interp mode */ + NULL, /* is centroid */ /* outputs */ stvp->num_outputs, stvp->result_to_output, @@ -484,6 +485,7 @@ st_translate_fragment_program(struct st_context *st, ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; + GLboolean is_centroid[PIPE_MAX_SHADER_INPUTS]; uint fs_num_inputs = 0; ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; @@ -537,6 +539,7 @@ st_translate_fragment_program(struct st_context *st, const GLuint slot = fs_num_inputs++; inputMapping[attr] = slot; + is_centroid[slot] = (stfp->Base.IsCentroid & BITFIELD64_BIT(attr)) != 0; switch (attr) { case FRAG_ATTRIB_WPOS: @@ -716,6 +719,7 @@ st_translate_fragment_program(struct st_context *st, input_semantic_name, input_semantic_index, interpMode, + is_centroid, /* outputs */ fs_num_outputs, outputMapping, -- 2.30.2