d3d1x: don't crash on drivers not supporting vertex or geometry sampling

This commit is contained in:
Luca Barbieri 2010-09-24 14:28:31 +02:00
parent b632d9fce3
commit f1063cfee2
3 changed files with 13 additions and 2 deletions

View File

@ -125,6 +125,7 @@ struct GalliumD3D11Caps
bool render_condition;
unsigned constant_buffers[D3D11_STAGES];
unsigned stages;
unsigned stages_with_sampling;
};
typedef GalliumDXGIDevice<

View File

@ -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;

View File

@ -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;