summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/rasterizer/jitter
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-08-05 16:19:10 -0600
committerTim Rowley <[email protected]>2016-08-10 11:08:33 -0500
commitd86e2487a0fb3b3d1f88a07d0eff723f3b30c737 (patch)
tree7f949439b1d8e1e806aa755b42fe44a9cdef7767 /src/gallium/drivers/swr/rasterizer/jitter
parent6625fd08db0a24fad54d69ca1eb3935304b3a53e (diff)
swr: [rasterizer jitter] fetch support for offsetting VertexID
Signed-off-by: Tim Rowley <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/jitter')
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp12
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.h8
2 files changed, 16 insertions, 4 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index 2c2d68eb592..3da0e4064d9 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -158,8 +158,18 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
default: SWR_ASSERT(0, "Unsupported index type"); vIndices = nullptr; break;
}
+ Value* vVertexId = vIndices;
+ if (fetchState.bVertexIDOffsetEnable)
+ {
+ // Assuming one of baseVertex or startVertex is 0, so adding both should be functionally correct
+ Value* vBaseVertex = VBROADCAST(LOAD(mpFetchInfo, { 0, SWR_FETCH_CONTEXT_BaseVertex }));
+ Value* vStartVertex = VBROADCAST(LOAD(mpFetchInfo, { 0, SWR_FETCH_CONTEXT_StartVertex }));
+ vVertexId = ADD(vIndices, vBaseVertex);
+ vVertexId = ADD(vVertexId, vStartVertex);
+ }
+
// store out vertex IDs
- STORE(vIndices, GEP(mpFetchInfo, { 0, SWR_FETCH_CONTEXT_VertexID }));
+ STORE(vVertexId, GEP(mpFetchInfo, { 0, SWR_FETCH_CONTEXT_VertexID }));
// store out cut mask if enabled
if (fetchState.bEnableCutIndex)
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.h b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.h
index d3181cd29ec..15474536d4b 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.h
@@ -100,9 +100,10 @@ struct FETCH_COMPILE_STATE
uint32_t cutIndex{ 0xffffffff };
// Options that effect the JIT'd code
- bool bDisableVGATHER; // if enabled, FetchJit will generate loads/shuffles instead of VGATHERs
- bool bDisableIndexOOBCheck; // if enabled, FetchJit will exclude index OOB check
- bool bEnableCutIndex{ false }; // compares indices with the cut index and returns a cut mask
+ bool bDisableVGATHER; // If enabled, FetchJit will generate loads/shuffles instead of VGATHERs
+ bool bDisableIndexOOBCheck; // If enabled, FetchJit will exclude index OOB check
+ bool bEnableCutIndex{ false }; // Compares indices with the cut index and returns a cut mask
+ bool bVertexIDOffsetEnable{ false }; // Offset vertexID by StartVertex for non-indexed draws or BaseVertex for indexed draws
FETCH_COMPILE_STATE(bool disableVGATHER = false, bool diableIndexOOBCheck = false):
bDisableVGATHER(disableVGATHER), bDisableIndexOOBCheck(diableIndexOOBCheck){ };
@@ -115,6 +116,7 @@ struct FETCH_COMPILE_STATE
if (bDisableIndexOOBCheck != other.bDisableIndexOOBCheck) return false;
if (bEnableCutIndex != other.bEnableCutIndex) return false;
if (cutIndex != other.cutIndex) return false;
+ if (bVertexIDOffsetEnable != other.bVertexIDOffsetEnable) return false;
for(uint32_t i = 0; i < numAttribs; ++i)
{