summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_shader.cpp
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2017-05-31 11:24:08 -0500
committerTim Rowley <[email protected]>2017-06-16 16:20:16 -0500
commit36ac8ba511bc1dd634194ac7a86dc4a527db7a2e (patch)
tree79ddffd622a14597acaccef19df04a2d13e9c1ee /src/gallium/drivers/swr/swr_shader.cpp
parent8716e0d8b45194f34b57ec963d95abbcf40b66c4 (diff)
swr/rast: Remove explicit primitive id slot in the vertex layout
- Remove any special casing in the PS stage when primitive ID is input. Treat as a normal attribute that must be set up properly in the FE linkage. - Remove primitive id from the PS_CONTEXT and TRI_FLAGS Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_shader.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_shader.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp
index 2f495f59c23..44988892691 100644
--- a/src/gallium/drivers/swr/swr_shader.cpp
+++ b/src/gallium/drivers/swr/swr_shader.cpp
@@ -406,8 +406,6 @@ BuilderSWR::swr_gs_llvm_emit_vertex(const struct lp_build_tgsi_gs_iface *gs_base
uint32_t attribSlot = attrib;
if (iface->info->output_semantic_name[attrib] == TGSI_SEMANTIC_PSIZE)
attribSlot = VERTEX_POINT_SIZE_SLOT;
- else if (iface->info->output_semantic_name[attrib] == TGSI_SEMANTIC_PRIMID)
- attribSlot = VERTEX_PRIMID_SLOT;
else if (iface->info->output_semantic_name[attrib] == TGSI_SEMANTIC_LAYER)
attribSlot = VERTEX_RTAI_SLOT;
@@ -534,7 +532,6 @@ BuilderSWR::CompileGS(struct swr_context *ctx, swr_jit_gs_key &key)
pGS->instanceCount = info->properties[TGSI_PROPERTY_GS_INVOCATIONS];
pGS->emitsRenderTargetArrayIndex = info->writes_layer;
- pGS->emitsPrimitiveID = info->writes_primid;
pGS->emitsViewportArrayIndex = info->writes_viewport_index;
// XXX: single stream for now...
@@ -1043,23 +1040,23 @@ BuilderSWR::CompileFS(struct swr_context *ctx, swr_jit_fs_key &key)
inputs[attrib][3] =
wrap(LOAD(pPS, {0, SWR_PS_CONTEXT_vOneOverW, PixelPositions_center}, "vOneOverW"));
continue;
- } else if (semantic_name == TGSI_SEMANTIC_PRIMID) {
- Value *primID = LOAD(pPS, {0, SWR_PS_CONTEXT_primID}, "primID");
- inputs[attrib][0] = wrap(VECTOR_SPLAT(JM()->mVWidth, primID));
- inputs[attrib][1] = wrap(VIMMED1(0));
- inputs[attrib][2] = wrap(VIMMED1(0));
- inputs[attrib][3] = wrap(VIMMED1(0));
- continue;
}
unsigned linkedAttrib =
locate_linkage(semantic_name, semantic_idx, pPrevShader);
- if (semantic_name == TGSI_SEMANTIC_GENERIC &&
+ uint32_t extraAttribs = 0;
+ if (semantic_name == TGSI_SEMANTIC_PRIMID && !ctx->gs) {
+ /* non-gs generated primID - need to grab from swizzleMap override */
+ linkedAttrib = pPrevShader->num_outputs - 1;
+ swr_fs->constantMask |= 1 << linkedAttrib;
+ extraAttribs++;
+ } else if (semantic_name == TGSI_SEMANTIC_GENERIC &&
key.sprite_coord_enable & (1 << semantic_idx)) {
/* we add an extra attrib to the backendState in swr_update_derived. */
- linkedAttrib = pPrevShader->num_outputs - 1;
+ linkedAttrib = pPrevShader->num_outputs + extraAttribs - 1;
swr_fs->pointSpriteMask |= (1 << linkedAttrib);
+ extraAttribs++;
} else if (linkedAttrib == 0xFFFFFFFF) {
inputs[attrib][0] = wrap(VIMMED1(0.0f));
inputs[attrib][1] = wrap(VIMMED1(0.0f));