diff options
author | Ilia Mirkin <[email protected]> | 2014-07-01 20:54:01 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2014-07-09 19:26:32 -0400 |
commit | 4c97ed4411e3653a082875b79587fb308c284a99 (patch) | |
tree | bc6f1666166da83a51525f6460d49c7d6d473166 /src/gallium/auxiliary | |
parent | e3b16294cb56bc0f3ee4a68a525884db0ce6806d (diff) |
gallium: switch dedicated centroid field to interpolation location
The new location field can be either center, centroid, or sample, which
indicates the location that the shader should interpolate at.
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_build.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_dump.c | 5 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_scan.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_scan.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_strings.c | 7 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.c | 12 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.h | 2 |
8 files changed, 25 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 7621b6a02c9..bef5c75ac76 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -200,7 +200,7 @@ tgsi_default_declaration_interp( void ) struct tgsi_declaration_interp di; di.Interpolate = TGSI_INTERPOLATE_CONSTANT; - di.Centroid = 0; + di.Location = TGSI_INTERPOLATE_LOC_CENTER; di.CylindricalWrap = 0; di.Padding = 0; @@ -209,7 +209,7 @@ tgsi_default_declaration_interp( void ) static struct tgsi_declaration_interp tgsi_build_declaration_interp(unsigned interpolate, - unsigned centroid, + unsigned interpolate_location, unsigned cylindrical_wrap, struct tgsi_declaration *declaration, struct tgsi_header *header) @@ -217,7 +217,7 @@ tgsi_build_declaration_interp(unsigned interpolate, struct tgsi_declaration_interp di; di.Interpolate = interpolate; - di.Centroid = centroid; + di.Location = interpolate_location; di.CylindricalWrap = cylindrical_wrap; di.Padding = 0; @@ -433,7 +433,7 @@ tgsi_build_full_declaration( size++; *di = tgsi_build_declaration_interp(full_decl->Interp.Interpolate, - full_decl->Interp.Centroid, + full_decl->Interp.Location, full_decl->Interp.CylindricalWrap, declaration, header); diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 8e09bacf4cf..884d8cf9354 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -349,8 +349,9 @@ iter_declaration( ENM( decl->Interp.Interpolate, tgsi_interpolate_names ); } - if (decl->Interp.Centroid) { - TXT( ", CENTROID" ); + if (decl->Interp.Location != TGSI_INTERPOLATE_LOC_CENTER) { + TXT( ", " ); + ENM( decl->Interp.Location, tgsi_interpolate_locations ); } if (decl->Interp.CylindricalWrap) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 00fdcfb76e6..563d2c55f60 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -187,7 +187,7 @@ tgsi_scan_shader(const struct tgsi_token *tokens, info->input_semantic_name[reg] = (ubyte) semName; info->input_semantic_index[reg] = (ubyte) semIndex; info->input_interpolate[reg] = (ubyte)fulldecl->Interp.Interpolate; - info->input_centroid[reg] = (ubyte)fulldecl->Interp.Centroid; + info->input_interpolate_loc[reg] = (ubyte)fulldecl->Interp.Location; info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Interp.CylindricalWrap; info->num_inputs++; diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h index 0be2febb072..1869b41e74e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h @@ -45,7 +45,7 @@ struct tgsi_shader_info ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; /**< TGSI_SEMANTIC_x */ ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; ubyte input_interpolate[PIPE_MAX_SHADER_INPUTS]; - ubyte input_centroid[PIPE_MAX_SHADER_INPUTS]; + ubyte input_interpolate_loc[PIPE_MAX_SHADER_INPUTS]; ubyte input_usage_mask[PIPE_MAX_SHADER_INPUTS]; ubyte input_cylindrical_wrap[PIPE_MAX_SHADER_INPUTS]; ubyte output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; /**< TGSI_SEMANTIC_x */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index 713631fbec4..3c108a8c1c9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -142,6 +142,13 @@ const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] = "COLOR" }; +const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] = +{ + "CENTER", + "CENTROID", + "SAMPLE", +}; + const char *tgsi_primitive_names[PIPE_PRIM_MAX] = { "POINTS", diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h b/src/gallium/auxiliary/tgsi/tgsi_strings.h index 3477d50b8ad..1c37c290974 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h @@ -50,6 +50,8 @@ extern const char *tgsi_type_names[5]; extern const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT]; +extern const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT]; + extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; extern const char *tgsi_fs_coord_origin_names[2]; diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index bd0a3f79fbd..39216e59124 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -103,7 +103,7 @@ struct ureg_program unsigned semantic_index; unsigned interp; unsigned char cylindrical_wrap; - unsigned char centroid; + unsigned interp_location; } fs_input[UREG_MAX_INPUT]; unsigned nr_fs_inputs; @@ -345,7 +345,7 @@ ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg, unsigned semantic_index, unsigned interp_mode, unsigned cylindrical_wrap, - unsigned centroid) + unsigned interp_location) { unsigned i; @@ -361,7 +361,7 @@ ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg, ureg->fs_input[i].semantic_index = semantic_index; ureg->fs_input[i].interp = interp_mode; ureg->fs_input[i].cylindrical_wrap = cylindrical_wrap; - ureg->fs_input[i].centroid = centroid; + ureg->fs_input[i].interp_location = interp_location; ureg->nr_fs_inputs++; } else { set_bad(ureg); @@ -1288,7 +1288,7 @@ emit_decl_fs(struct ureg_program *ureg, unsigned semantic_index, unsigned interpolate, unsigned cylindrical_wrap, - unsigned centroid) + unsigned interpolate_location) { union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 4); @@ -1307,7 +1307,7 @@ emit_decl_fs(struct ureg_program *ureg, out[2].value = 0; out[2].decl_interp.Interpolate = interpolate; out[2].decl_interp.CylindricalWrap = cylindrical_wrap; - out[2].decl_interp.Centroid = centroid; + out[2].decl_interp.Location = interpolate_location; out[3].value = 0; out[3].decl_semantic.Name = semantic_name; @@ -1539,7 +1539,7 @@ static void emit_decls( struct ureg_program *ureg ) ureg->fs_input[i].semantic_index, ureg->fs_input[i].interp, ureg->fs_input[i].cylindrical_wrap, - ureg->fs_input[i].centroid); + ureg->fs_input[i].interp_location); } } else { for (i = 0; i < ureg->nr_gs_inputs; i++) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 28edea6cdae..2c3746c77f2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -199,7 +199,7 @@ ureg_DECL_fs_input_cyl_centroid(struct ureg_program *, unsigned semantic_index, unsigned interp_mode, unsigned cylindrical_wrap, - unsigned centroid); + unsigned interp_location); static INLINE struct ureg_src ureg_DECL_fs_input_cyl(struct ureg_program *ureg, |