summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-09-24 14:28:31 +0200
committerLuca Barbieri <[email protected]>2010-09-24 15:12:19 +0200
commitf1063cfee213ba92f7c9e34199caccf4bed78c1c (patch)
tree9809f5757858ae40faff1e313b26f36d01e8923e
parentb632d9fce3bd541795a863eb02ef8fbb72cdb9a2 (diff)
d3d1x: don't crash on drivers not supporting vertex or geometry sampling
-rw-r--r--src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp1
-rw-r--r--src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h10
-rw-r--r--src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h4
3 files changed, 13 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
index 42678fab4d0..27cfebc1b9c 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
@@ -125,6 +125,7 @@ struct GalliumD3D11Caps
bool render_condition;
unsigned constant_buffers[D3D11_STAGES];
unsigned stages;
+ unsigned stages_with_sampling;
};
typedef GalliumDXGIDevice<
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
index d7c1c921b71..4abb4ac6b0f 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
@@ -158,6 +158,12 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
}
if(!pipe->set_stream_output_buffers)
caps.so = false;
+ if(!pipe->set_geometry_sampler_views)
+ caps.stages_with_sampling &=~ (1 << PIPE_SHADER_GEOMETRY);
+ if(!pipe->set_fragment_sampler_views)
+ caps.stages_with_sampling &=~ (1 << PIPE_SHADER_FRAGMENT);
+ if(!pipe->set_vertex_sampler_views)
+ caps.stages_with_sampling &=~ (1 << PIPE_SHADER_VERTEX);
update_flags = 0;
@@ -505,7 +511,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
{
while(num_shader_resource_views[s] && !sampler_views[s][num_shader_resource_views[s] - 1]) \
--num_shader_resource_views[s];
- if(s < caps.stages)
+ if((1 << s) & caps.stages_with_sampling)
{
struct pipe_sampler_view* views_to_bind[PIPE_MAX_SAMPLERS];
unsigned num_views_to_bind = shaders[s] ? shaders[s]->slot_to_resource.size() : 0;
@@ -532,7 +538,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
{
while(num_samplers[s] && !sampler_csos[s].v[num_samplers[s] - 1])
--num_samplers[s];
- if(s < caps.stages)
+ if((1 << s) & caps.stages_with_sampling)
{
void* samplers_to_bind[PIPE_MAX_SAMPLERS];
unsigned num_samplers_to_bind = shaders[s] ? shaders[s]->slot_to_sampler.size() : 0;
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
index 528d32c4b1e..1ecd67ca474 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
@@ -101,6 +101,10 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
screen_caps.stages = i + 1;
}
+ screen_caps.stages_with_sampling = (1 << screen_caps.stages) - 1;
+ if(!screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS))
+ screen_caps.stages_with_sampling &=~ (1 << PIPE_SHADER_VERTEX);
+
memset(format_support, 0xff, sizeof(format_support));
float default_level;