diff options
author | Rob Clark <[email protected]> | 2015-09-10 17:25:18 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2015-09-17 19:55:43 -0400 |
commit | e523f69b1d2f0cb3ff7659e3c55b9a2e40240c9c (patch) | |
tree | 297df077ee72e725c652d071e288b319a24e77c6 /src/gallium/drivers/freedreno/ir3 | |
parent | e844e1007d3baac09ff2cc78879d6974be18ecaf (diff) |
freedreno/ir3: switch to shader_enums.h interp constants
A small step towards un-TGSI'ifying ir3.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/ir3')
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 40 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_shader.h | 11 |
2 files changed, 16 insertions, 35 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index 83a138515b5..e4dbe64f753 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -1359,7 +1359,7 @@ static void add_sysval_input(struct ir3_compile *ctx, unsigned name, so->inputs[n].semantic = ir3_semantic_name(name, 0); so->inputs[n].compmask = 1; so->inputs[n].regid = r; - so->inputs[n].interpolate = TGSI_INTERPOLATE_CONSTANT; + so->inputs[n].interpolate = INTERP_QUALIFIER_FLAT; so->total_in++; ctx->ir->ninputs = MAX2(ctx->ir->ninputs, r + 1); @@ -2141,23 +2141,9 @@ setup_input(struct ir3_compile *ctx, nir_variable *in) so->inputs[n].compmask = (1 << ncomp) - 1; so->inputs[n].inloc = ctx->next_inloc; - so->inputs[n].interpolate = 0; + so->inputs[n].interpolate = INTERP_QUALIFIER_NONE; so->inputs_count = MAX2(so->inputs_count, n + 1); - - /* the fdN_program_emit() code expects tgsi consts here, so map - * things back to tgsi for now: - */ - switch (in->data.interpolation) { - case INTERP_QUALIFIER_FLAT: - so->inputs[n].interpolate = TGSI_INTERPOLATE_CONSTANT; - break; - case INTERP_QUALIFIER_NOPERSPECTIVE: - so->inputs[n].interpolate = TGSI_INTERPOLATE_LINEAR; - break; - case INTERP_QUALIFIER_SMOOTH: - so->inputs[n].interpolate = TGSI_INTERPOLATE_PERSPECTIVE; - break; - } + so->inputs[n].interpolate = in->data.interpolation; if (ctx->so->type == SHADER_FRAGMENT) { unsigned semantic_name, semantic_index; @@ -2183,27 +2169,19 @@ setup_input(struct ir3_compile *ctx, nir_variable *in) } else { bool use_ldlv = false; - /* with NIR, we need to infer TGSI_INTERPOLATE_COLOR - * from the semantic name: + /* detect the special case for front/back colors where + * we need to do flat vs smooth shading depending on + * rast state: */ if ((in->data.interpolation == INTERP_QUALIFIER_NONE) && ((semantic_name == TGSI_SEMANTIC_COLOR) || (semantic_name == TGSI_SEMANTIC_BCOLOR))) - so->inputs[n].interpolate = TGSI_INTERPOLATE_COLOR; + so->inputs[n].rasterflat = true; if (ctx->flat_bypass) { - /* with NIR, we need to infer TGSI_INTERPOLATE_COLOR - * from the semantic name: - */ - switch (so->inputs[n].interpolate) { - case TGSI_INTERPOLATE_COLOR: - if (!ctx->so->key.rasterflat) - break; - /* fallthrough */ - case TGSI_INTERPOLATE_CONSTANT: + if ((so->inputs[n].interpolate == INTERP_QUALIFIER_FLAT) || + (so->inputs[n].rasterflat && ctx->so->key.rasterflat)) use_ldlv = true; - break; - } } so->inputs[n].bary = true; diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h index 1bbbdbd224d..13b3f6a2a85 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h @@ -30,6 +30,7 @@ #define IR3_SHADER_H_ #include "pipe/p_state.h" +#include "glsl/shader_enums.h" #include "ir3.h" #include "disasm.h" @@ -82,8 +83,8 @@ struct ir3_shader_key { */ unsigned color_two_side : 1; unsigned half_precision : 1; - /* used when shader needs to handle flat varyings (a4xx), - * for TGSI_INTERPOLATE_COLOR: + /* used when shader needs to handle flat varyings (a4xx) + * for front/back color inputs to frag shader: */ unsigned rasterflat : 1; }; @@ -174,8 +175,10 @@ struct ir3_shader_variant { * spots where inloc is used. */ uint8_t inloc; - uint8_t bary; - uint8_t interpolate; + /* fragment shader specfic: */ + bool bary : 1; /* fetched varying (vs one loaded into reg) */ + bool rasterflat : 1; /* special handling for emit->rasterflat */ + enum glsl_interp_qualifier interpolate; } inputs[16 + 2]; /* +POSITION +FACE */ unsigned total_in; /* sum of inputs (scalar) */ |