diff options
author | Dave Airlie <[email protected]> | 2011-09-15 12:38:10 +0100 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-09-16 09:25:48 +0100 |
commit | 21c5607e64ca4ef68730d8e846d8e7744ecdd024 (patch) | |
tree | e73d01045a1cad7f34546c7de227aa7e6425c3a6 /src/gallium/drivers/r600/r600_shader.c | |
parent | de3218664a03ee116ca58db571f90a6914299a81 (diff) |
r600g: add flat non-interpolation support.
TGSI CONSTANT interpolation is just flat, and we just read the values
direct from the LDS into the GPR without doing any interpolation on them.
This is needed to pass integer types into the fragment shader.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_shader.c')
-rw-r--r-- | src/gallium/drivers/r600/r600_shader.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 7f7f7453732..32aaf15b7f5 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -299,6 +299,32 @@ static int evergreen_interp_alu(struct r600_shader_ctx *ctx, int input) return 0; } +static int evergreen_interp_flat(struct r600_shader_ctx *ctx, int input) +{ + int i, r; + struct r600_bytecode_alu alu; + + for (i = 0; i < 4; i++) { + memset(&alu, 0, sizeof(struct r600_bytecode_alu)); + + alu.inst = EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_LOAD_P0; + + alu.dst.sel = ctx->shader->input[input].gpr; + alu.dst.write = 1; + + alu.dst.chan = i; + + alu.src[0].sel = V_SQ_ALU_SRC_PARAM_BASE + ctx->shader->input[input].lds_pos; + alu.src[0].chan = i; + + if (i == 3) + alu.last = 1; + r = r600_bytecode_add_alu(ctx->bc, &alu); + if (r) + return r; + } + return 0; +} static int tgsi_declaration(struct r600_shader_ctx *ctx) { @@ -316,10 +342,13 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx) ctx->shader->input[i].gpr = ctx->file_offset[TGSI_FILE_INPUT] + i; if (ctx->type == TGSI_PROCESSOR_FRAGMENT && ctx->bc->chip_class >= EVERGREEN) { /* turn input into interpolate on EG */ - if (ctx->shader->input[i].name != TGSI_SEMANTIC_POSITION) { + if (ctx->shader->input[i].name != TGSI_SEMANTIC_POSITION && + ctx->shader->input[i].name != TGSI_SEMANTIC_FACE) { + ctx->shader->input[i].lds_pos = ctx->shader->nlds++; if (ctx->shader->input[i].interpolate > 0) { - ctx->shader->input[i].lds_pos = ctx->shader->nlds++; evergreen_interp_alu(ctx, i); + } else { + evergreen_interp_flat(ctx, i); } } } |