d3d1x: setup draw info primitive restart parameters
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Thu, 22 Sep 2011 14:43:19 +0000 (16:43 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Thu, 22 Sep 2011 14:53:54 +0000 (16:53 +0200)
src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h

index fcb82a19624bc9db0cfed8c37175d1192388f407..6cb19330f226a43286257a407cb15b2e35c8816d 100644 (file)
@@ -71,6 +71,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
        D3D11_PRIMITIVE_TOPOLOGY primitive_topology;
        DXGI_FORMAT index_format;
        unsigned index_offset;
+       uint32_t strip_cut_index;
        BOOL render_predicate_value;
        float blend_color[4];
        unsigned sample_mask;
@@ -174,6 +175,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
                primitive_topology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
                index_format = DXGI_FORMAT_UNKNOWN;
                index_offset = 0;
+               strip_cut_index = 0xffffffff;
                render_predicate_value = 0;
                memset(blend_color, 0, sizeof(blend_color));
                sample_mask = ~0;
@@ -673,12 +675,20 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
                }
                else
                {
-                       if(index_format == DXGI_FORMAT_R32_UINT)
+                       switch(index_format) {
+                       case DXGI_FORMAT_R32_UINT:
                                ib.index_size = 4;
-                       else if(index_format == DXGI_FORMAT_R16_UINT)
+                               strip_cut_index = 0xffffffff;
+                               break;
+                       case DXGI_FORMAT_R16_UINT:
                                ib.index_size = 2;
-                       else
+                               strip_cut_index = 0xffff;
+                               break;
+                       default:
                                ib.index_size = 1;
+                               strip_cut_index = 0xff;
+                               break;
+                       }
                        ib.offset = index_offset;
                        ib.buffer = index_buffer ? ((GalliumD3D11Buffer*)index_buffer.p)->resource : 0;
                }
@@ -755,6 +765,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
                info.max_index = ~0;
                info.start_instance = 0;
                info.instance_count = 1;
+               info.primitive_restart = FALSE;
 
                pipe->draw_vbo(pipe, &info);
        }
@@ -777,6 +788,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
                info.max_index = ~0;
                info.start_instance = 0;
                info.instance_count = 1;
+               info.primitive_restart = TRUE;
+               info.restart_index = strip_cut_index;
 
                pipe->draw_vbo(pipe, &info);
        }
@@ -802,6 +815,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
                info.max_index = ~0;
                info.start_instance = start_instance_location;
                info.instance_count = instance_count;
+               info.primitive_restart = FALSE;
 
                pipe->draw_vbo(pipe, &info);
        }
@@ -826,6 +840,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
                info.max_index = ~0;
                info.start_instance = start_instance_location;
                info.instance_count = instance_count;
+               info.primitive_restart = TRUE;
+               info.restart_index = strip_cut_index;
 
                pipe->draw_vbo(pipe, &info);
        }
@@ -869,6 +885,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
                info.max_index = ~0;
                info.start_instance = 0;
                info.instance_count = data.instance_count;
+               info.primitive_restart = FALSE;
 
                pipe->draw_vbo(pipe, &info);
        }
@@ -899,6 +916,8 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
                info.max_index = ~0;
                info.start_instance = 0;
                info.instance_count = data.instance_count;
+               info.primitive_restart = TRUE;
+               info.restart_index = strip_cut_index;
 
                pipe->draw_vbo(pipe, &info);
        }