swr/rast: Handle instanceID offset / Instance Stride enable
Supported in JitGatherVertices(); FetchJit::JitLoadVertices() may require similar changes, will need address this if it is determined that this path is still in use. Handle Force Sequential Access in FetchJit::Create. Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
This commit is contained in:
parent
68d8dd1fb5
commit
5a2bca5db5
|
@ -222,6 +222,18 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
|
||||||
default: SWR_INVALID("Unsupported index type"); vIndices = nullptr; break;
|
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;
|
Value* vVertexId = vIndices;
|
||||||
#if USE_SIMD16_SHADERS
|
#if USE_SIMD16_SHADERS
|
||||||
Value* vVertexId2 = vIndices2;
|
Value* vVertexId2 = vIndices2;
|
||||||
|
@ -275,12 +287,6 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
|
||||||
: JitGatherVertices(fetchState, streams, vIndices, pVtxOut);
|
: JitGatherVertices(fetchState, streams, vIndices, pVtxOut);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fetchState.bInstanceIDOffsetEnable)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
SWR_ASSERT((0), "Add support for handling InstanceID Offset Enable.");
|
|
||||||
}
|
|
||||||
|
|
||||||
RET_VOID();
|
RET_VOID();
|
||||||
|
|
||||||
JitManager::DumpToFile(fetch, "src");
|
JitManager::DumpToFile(fetch, "src");
|
||||||
|
@ -362,6 +368,11 @@ void FetchJit::JitLoadVertices(const FETCH_COMPILE_STATE &fetchState, Value* str
|
||||||
|
|
||||||
vectors.clear();
|
vectors.clear();
|
||||||
|
|
||||||
|
if (fetchState.bInstanceIDOffsetEnable)
|
||||||
|
{
|
||||||
|
SWR_ASSERT((0), "TODO: Fill out more once driver sends this down");
|
||||||
|
}
|
||||||
|
|
||||||
Value *vCurIndices;
|
Value *vCurIndices;
|
||||||
Value *startOffset;
|
Value *startOffset;
|
||||||
if(ied.InstanceEnable)
|
if(ied.InstanceEnable)
|
||||||
|
@ -831,8 +842,16 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE &fetchState,
|
||||||
minVertex = LOAD(minVertex);
|
minVertex = LOAD(minVertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fetchState.bInstanceIDOffsetEnable)
|
||||||
|
{
|
||||||
|
// the InstanceID (curInstance) value is offset by StartInstanceLocation
|
||||||
|
curInstance = ADD(curInstance, startInstance);
|
||||||
|
}
|
||||||
|
|
||||||
Value *vCurIndices;
|
Value *vCurIndices;
|
||||||
Value *startOffset;
|
Value *startOffset;
|
||||||
|
Value *vInstanceStride = VIMMED1(0);
|
||||||
|
|
||||||
if(ied.InstanceEnable)
|
if(ied.InstanceEnable)
|
||||||
{
|
{
|
||||||
Value* stepRate = C(ied.InstanceAdvancementState);
|
Value* stepRate = C(ied.InstanceAdvancementState);
|
||||||
|
@ -853,11 +872,19 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE &fetchState,
|
||||||
}
|
}
|
||||||
else if (ied.InstanceStrideEnable)
|
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.");
|
SWR_ASSERT((0), "TODO: Fill out more once driver sends this down.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// offset indices by baseVertex
|
// offset indices by baseVertex
|
||||||
vCurIndices = ADD(vIndices, vBaseVertex);
|
vCurIndices = ADD(vIndices, vBaseVertex);
|
||||||
|
|
||||||
startOffset = startVertex;
|
startOffset = startVertex;
|
||||||
|
@ -925,6 +952,11 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE &fetchState,
|
||||||
Value* vOffsets = MUL(vCurIndices, vStride);
|
Value* vOffsets = MUL(vCurIndices, vStride);
|
||||||
vOffsets = ADD(vOffsets, vAlignmentOffsets);
|
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
|
// Packing and component control
|
||||||
ComponentEnable compMask = (ComponentEnable)ied.ComponentPacking;
|
ComponentEnable compMask = (ComponentEnable)ied.ComponentPacking;
|
||||||
const ComponentControl compCtrl[4] { (ComponentControl)ied.ComponentControl0, (ComponentControl)ied.ComponentControl1,
|
const ComponentControl compCtrl[4] { (ComponentControl)ied.ComponentControl0, (ComponentControl)ied.ComponentControl1,
|
||||||
|
|
Loading…
Reference in New Issue