From: Christoph Bumiller Date: Thu, 12 Jan 2012 18:28:03 +0000 (+0100) Subject: nv50/ir: make use of TGSI_INTERPOLATE_COLOR X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=af0ce1dba8219ff8628f1fa61cf93c11a77dab94;p=mesa.git nv50/ir: make use of TGSI_INTERPOLATE_COLOR Flat SHADE_MODEL still overrides any non-flat interpolation qualifier, but pulling that state out of the rasterizer cso isn't really worth the effort, is it ? NOTE: This is a candidate for the 8.0 branch. --- diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h b/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h index a37a29a99a6..84a514091c6 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h @@ -42,6 +42,7 @@ struct nv50_ir_varying unsigned mask : 4; /* vec4 mask */ unsigned linear : 1; /* linearly interpolated if true (and not flat) */ unsigned flat : 1; + unsigned sc : 1; /* special colour interpolation mode (SHADE_MODEL) */ unsigned centroid : 1; unsigned patch : 1; /* patch constant value */ unsigned regular : 1; /* driver-specific meaning (e.g. input in sreg) */ diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp index c104dbe9670..3fb679b29de 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp @@ -817,9 +817,11 @@ bool Source::scanDeclaration(const struct tgsi_full_declaration *decl) case TGSI_INTERPOLATE_CONSTANT: info->in[i].flat = 1; break; + case TGSI_INTERPOLATE_COLOR: + info->in[i].sc = 1; + break; case TGSI_INTERPOLATE_LINEAR: - if (sn != TGSI_SEMANTIC_COLOR) // GL_NICEST - info->in[i].linear = 1; + info->in[i].linear = 1; break; default: break; @@ -1141,7 +1143,7 @@ Converter::makeSym(uint tgsiFile, int fileIdx, int idx, int c, uint32_t address) static inline uint8_t translateInterpMode(const struct nv50_ir_varying *var, operation& op) { - uint8_t mode; + uint8_t mode = NV50_IR_INTERP_PERSPECTIVE; if (var->flat) mode = NV50_IR_INTERP_FLAT; @@ -1149,9 +1151,11 @@ translateInterpMode(const struct nv50_ir_varying *var, operation& op) if (var->linear) mode = NV50_IR_INTERP_LINEAR; else - mode = NV50_IR_INTERP_PERSPECTIVE; + if (var->sc) + mode = NV50_IR_INTERP_SC; - op = (mode == NV50_IR_INTERP_PERSPECTIVE) ? OP_PINTERP : OP_LINTERP; + op = (mode == NV50_IR_INTERP_PERSPECTIVE || mode == NV50_IR_INTERP_SC) + ? OP_PINTERP : OP_LINTERP; if (var->centroid) mode |= NV50_IR_INTERP_CENTROID; diff --git a/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp index 5f906e4ed15..1c19651f1cf 100644 --- a/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp +++ b/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp @@ -703,11 +703,6 @@ NVC0LoweringPass::visit(Instruction *i) assert(prog->getType() != Program::TYPE_FRAGMENT); } break; - case OP_PINTERP: - if (i->getSrc(0)->reg.data.offset >= 0x280 && - i->getSrc(0)->reg.data.offset < 0x2c0) - i->setInterpolate(i->getSampleMode() | NV50_IR_INTERP_SC); - break; default: break; }