summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2014-11-25 00:38:06 +0100
committerEmil Velikov <[email protected]>2014-12-03 22:58:54 +0000
commit8dc03bd57508b0c658d7d428a04af56a34f64c1f (patch)
tree0bc72b0b65903f619f48bb08f1e33eee0c4ee872 /src
parent41906e97640503c46832646ffbad9c45fb2b1262 (diff)
st/nine: Add pool check to SetTexture (v2)
D3DPOOL_SCRATCH is disallowed according to spec. D3DPOOL_SYSTEMMEM should be allowed but we don't handle it right for now. v2: Fixes segfault in SetTexture when unsetting the texture Cc: "10.4" <[email protected]> Tested-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> (cherry picked from commit 4eea2496bcb573d730f84f34fb76db3e1ec2e733)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/nine/device9.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index e083536c239..66d5e667f8e 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2199,6 +2199,7 @@ NineDevice9_SetTexture( struct NineDevice9 *This,
IDirect3DBaseTexture9 *pTexture )
{
struct nine_state *state = This->update;
+ struct NineBaseTexture9 *tex = NineBaseTexture9(pTexture);
DBG("This=%p Stage=%u pTexture=%p\n", This, Stage, pTexture);
@@ -2206,12 +2207,19 @@ NineDevice9_SetTexture( struct NineDevice9 *This,
Stage == D3DDMAPSAMPLER ||
(Stage >= D3DVERTEXTEXTURESAMPLER0 &&
Stage <= D3DVERTEXTEXTURESAMPLER3), D3DERR_INVALIDCALL);
+ user_assert(!tex || tex->base.pool != D3DPOOL_SCRATCH, D3DERR_INVALIDCALL);
+
+ if (unlikely(tex && tex->base.pool == D3DPOOL_SYSTEMMEM)) {
+ /* TODO: Currently not implemented. Better return error
+ * with message telling what's wrong */
+ ERR("This=%p D3DPOOL_SYSTEMMEM not implemented for SetTexture\n", This);
+ user_assert(tex->base.pool != D3DPOOL_SYSTEMMEM, D3DERR_INVALIDCALL);
+ }
if (Stage >= D3DDMAPSAMPLER)
Stage = Stage - D3DDMAPSAMPLER + NINE_MAX_SAMPLERS_PS;
if (!This->is_recording) {
- struct NineBaseTexture9 *tex = NineBaseTexture9(pTexture);
struct NineBaseTexture9 *old = state->texture[Stage];
if (old == tex)
return D3D_OK;