swr/rast: Fetch compile state changes
authorTim Rowley <timothy.o.rowley@intel.com>
Thu, 7 Sep 2017 23:53:03 +0000 (18:53 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Wed, 13 Sep 2017 15:09:54 +0000 (10:09 -0500)
Add InstanceStrideEnable field and rename InstanceDataStepRate to
InstanceAdvancementState in INPUT_ELEMENT_DESC structure.

Add stubs for handling InstanceStrideEnable in FetchJit::JitLoadVertices()
and FetchJit::JitGatherVertices() and assert if they are triggered.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.h
src/gallium/drivers/swr/swr_state.cpp

index 761c58ca27ede24ff7d8fdb29e3cc4cf508a72ad..f3a4b27d9a9d6344445aea24ce522754ea01dcda 100644 (file)
@@ -360,7 +360,7 @@ void FetchJit::JitLoadVertices(const FETCH_COMPILE_STATE &fetchState, Value* str
         Value *startOffset;
         if(ied.InstanceEnable)
         {
-            Value* stepRate = C(ied.InstanceDataStepRate);
+            Value* stepRate = C(ied.InstanceAdvancementState);
 
             // prevent a div by 0 for 0 step rate
             Value* isNonZeroStep = ICMP_UGT(stepRate, C(0));
@@ -376,6 +376,10 @@ void FetchJit::JitLoadVertices(const FETCH_COMPILE_STATE &fetchState, Value* str
 
             startOffset = startInstance;
         }
+        else if (ied.InstanceStrideEnable)
+        {
+            SWR_ASSERT((0), "TODO: Fill out more once driver sends this down.");
+        }
         else
         {
             // offset indices by baseVertex
@@ -825,7 +829,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE &fetchState,
         Value *startOffset;
         if(ied.InstanceEnable)
         {
-            Value* stepRate = C(ied.InstanceDataStepRate);
+            Value* stepRate = C(ied.InstanceAdvancementState);
 
             // prevent a div by 0 for 0 step rate
             Value* isNonZeroStep = ICMP_UGT(stepRate, C(0));
@@ -841,6 +845,10 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE &fetchState,
 
             startOffset = startInstance;
         }
+        else if (ied.InstanceStrideEnable)
+        {
+            SWR_ASSERT((0), "TODO: Fill out more once driver sends this down.");
+        }
         else
         {
             // offset indices by baseVertex            
index 4f456afffce4fa65baa3fed5464257b31f1c43b4..0dd6de759adb33eb1fa92607dc2e734bdc86487e 100644 (file)
@@ -45,16 +45,17 @@ struct INPUT_ELEMENT_DESC
             uint32_t            Format : 10;
             uint32_t            StreamIndex : 6;
             uint32_t            InstanceEnable : 1;
+            uint32_t            InstanceStrideEnable : 1;
             uint32_t            ComponentControl0 : 3;
             uint32_t            ComponentControl1 : 3;
             uint32_t            ComponentControl2 : 3;
             uint32_t            ComponentControl3 : 3;
             uint32_t            ComponentPacking : 4;
-            uint32_t            _reserved : 19;
+            uint32_t            _reserved : 18;
         };
         uint64_t bits;
     };
-    uint32_t InstanceDataStepRate;
+    uint32_t InstanceAdvancementState;
 };
 
 // used to set ComponentPacking
@@ -124,7 +125,7 @@ struct FETCH_COMPILE_STATE
         {
             if((layout[i].bits != other.layout[i].bits) ||
                ((layout[i].InstanceEnable == 1) &&
-                (layout[i].InstanceDataStepRate != other.layout[i].InstanceDataStepRate))){
+                (layout[i].InstanceAdvancementState != other.layout[i].InstanceAdvancementState))){
                 return false;
             }
         }
index 1491868eaeb5418c1b1a0f38626c45b474f58670..93108de06551bdc1a84bd853c95183885dfa9796 100644 (file)
@@ -531,7 +531,7 @@ swr_create_vertex_elements_state(struct pipe_context *pipe,
             ? ComponentControl::StoreSrc
             : ComponentControl::Store1Fp;
          velems->fsState.layout[i].ComponentPacking = ComponentEnable::XYZW;
-         velems->fsState.layout[i].InstanceDataStepRate =
+         velems->fsState.layout[i].InstanceAdvancementState =
             attribs[i].instance_divisor;
 
          /* Calculate the pitch of each stream */