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)
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){ };
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)
{