From 0cf1a55568dc7e511cbd8e3f5277ccfc272e4feb Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 22 Sep 2011 16:43:19 +0200 Subject: [PATCH] d3d1x: setup draw info primitive restart parameters --- .../state_trackers/d3d1x/gd3d11/d3d11_context.h | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index fcb82a1..6cb1933 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -71,6 +71,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl 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 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 } 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 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 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 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 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 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 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); } -- 2.7.4