default: SWR_INVALID("Unsupported index type"); vIndices = nullptr; break;
}
+ if(fetchState.bForceSequentialAccessEnable)
+ {
+ Value* pOffsets = C({ 0, 1, 2, 3, 4, 5, 6, 7 });
+
+ // VertexData buffers are accessed sequentially, the index is equal to the vertex number
+ vIndices = VBROADCAST(LOAD(mpFetchInfo, { 0, SWR_FETCH_CONTEXT_StartVertex }));
+ vIndices = ADD(vIndices, pOffsets);
+#if USE_SIMD16_SHADERS
+ vIndices2 = ADD(vIndices, VIMMED1(8));
+#endif
+ }
+
Value* vVertexId = vIndices;
#if USE_SIMD16_SHADERS
Value* vVertexId2 = vIndices2;
: JitGatherVertices(fetchState, streams, vIndices, pVtxOut);
#endif
- if (fetchState.bInstanceIDOffsetEnable)
- {
- // TODO:
- SWR_ASSERT((0), "Add support for handling InstanceID Offset Enable.");
- }
-
RET_VOID();
JitManager::DumpToFile(fetch, "src");
vectors.clear();
+ if (fetchState.bInstanceIDOffsetEnable)
+ {
+ SWR_ASSERT((0), "TODO: Fill out more once driver sends this down");
+ }
+
Value *vCurIndices;
Value *startOffset;
if(ied.InstanceEnable)
minVertex = LOAD(minVertex);
}
+ if (fetchState.bInstanceIDOffsetEnable)
+ {
+ // the InstanceID (curInstance) value is offset by StartInstanceLocation
+ curInstance = ADD(curInstance, startInstance);
+ }
+
Value *vCurIndices;
Value *startOffset;
+ Value *vInstanceStride = VIMMED1(0);
+
if(ied.InstanceEnable)
{
Value* stepRate = C(ied.InstanceAdvancementState);
}
else if (ied.InstanceStrideEnable)
{
+ // grab the instance advancement state, determines stride in bytes from one instance to the next
+ Value* stepRate = C(ied.InstanceAdvancementState);
+ vInstanceStride = VBROADCAST(MUL(curInstance, stepRate));
+
+ // offset indices by baseVertex
+ vCurIndices = ADD(vIndices, vBaseVertex);
+
+ startOffset = startVertex;
SWR_ASSERT((0), "TODO: Fill out more once driver sends this down.");
}
else
{
- // offset indices by baseVertex
+ // offset indices by baseVertex
vCurIndices = ADD(vIndices, vBaseVertex);
startOffset = startVertex;
Value* vOffsets = MUL(vCurIndices, vStride);
vOffsets = ADD(vOffsets, vAlignmentOffsets);
+ // if instance stride enable is:
+ // true - add product of the instanceID and advancement state to the offst into the VB
+ // false - value of vInstanceStride has been initialialized to zero
+ vOffsets = ADD(vOffsets, vInstanceStride);
+
// Packing and component control
ComponentEnable compMask = (ComponentEnable)ied.ComponentPacking;
const ComponentControl compCtrl[4] { (ComponentControl)ied.ComponentControl0, (ComponentControl)ied.ComponentControl1,