summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/device9.c
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2015-01-24 12:02:04 +0100
committerAxel Davy <[email protected]>2015-02-06 00:07:19 +0100
commit2c54d154e86cd93caed527824166f468a6c24c70 (patch)
treee50e40a696e31b35ad548b1de9f7d11b9a00fdab /src/gallium/state_trackers/nine/device9.c
parent9ac74e604bbce3b24565a9c277dc8f8fe9826e97 (diff)
st/nine: Dummy sampler should have a=1
Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/device9.c')
-rw-r--r--src/gallium/state_trackers/nine/device9.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 25e1444f6b4..e0524644f8a 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -298,6 +298,43 @@ NineDevice9_ctor( struct NineDevice9 *This,
return E_OUTOFMEMORY;
}
+ /* allocate dummy texture/sampler for when there are missing ones bound */
+ {
+ struct pipe_resource tmplt;
+ struct pipe_sampler_view templ;
+
+ tmplt.target = PIPE_TEXTURE_2D;
+ tmplt.width0 = 1;
+ tmplt.height0 = 1;
+ tmplt.depth0 = 1;
+ tmplt.last_level = 0;
+ tmplt.array_size = 1;
+ tmplt.usage = PIPE_USAGE_DEFAULT;
+ tmplt.flags = 0;
+ tmplt.format = PIPE_FORMAT_B8G8R8A8_UNORM;
+ tmplt.bind = PIPE_BIND_SAMPLER_VIEW;
+ tmplt.nr_samples = 0;
+
+ This->dummy_texture = This->screen->resource_create(This->screen, &tmplt);
+ if (!This->dummy_texture)
+ return D3DERR_DRIVERINTERNALERROR;
+
+ templ.format = PIPE_FORMAT_B8G8R8A8_UNORM;
+ templ.u.tex.first_layer = 0;
+ templ.u.tex.last_layer = 0;
+ templ.u.tex.first_level = 0;
+ templ.u.tex.last_level = 0;
+ templ.swizzle_r = PIPE_SWIZZLE_ZERO;
+ templ.swizzle_g = PIPE_SWIZZLE_ZERO;
+ templ.swizzle_b = PIPE_SWIZZLE_ZERO;
+ templ.swizzle_a = PIPE_SWIZZLE_ONE;
+ templ.target = This->dummy_texture->target;
+
+ This->dummy_sampler = This->pipe->create_sampler_view(This->pipe, This->dummy_texture, &templ);
+ if (!This->dummy_sampler)
+ return D3DERR_DRIVERINTERNALERROR;
+ }
+
/* Allocate upload helper for drivers that suck (from st pov ;). */
{
unsigned bind = 0;
@@ -346,6 +383,8 @@ NineDevice9_dtor( struct NineDevice9 *This )
nine_bind(&This->record, NULL);
+ pipe_sampler_view_reference(&This->dummy_sampler, NULL);
+ pipe_resource_reference(&This->dummy_texture, NULL);
pipe_resource_reference(&This->constbuf_vs, NULL);
pipe_resource_reference(&This->constbuf_ps, NULL);
FREE(This->state.vs_const_f);