st/nine: Do not return invalidcall on getrenderstate
authorAxel Davy <davyaxel0@gmail.com>
Mon, 3 Jun 2019 20:22:59 +0000 (22:22 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 15 May 2020 15:43:57 +0000 (15:43 +0000)
To be fair I don't remember why I wrote this patch,
but it seems reasonable.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5015>

src/gallium/frontends/nine/device9.c

index 841d62bc6cecb11f0254cd19e0f820ec402c3ab5..fd8e9274327c2320fd897e82aaa83f852a6195b4 100644 (file)
@@ -2283,7 +2283,7 @@ NineDevice9_SetRenderState( struct NineDevice9 *This,
     DBG("This=%p State=%u(%s) Value=%08x\n", This,
         State, nine_d3drs_to_string(State), Value);
 
-    user_assert(State < D3DRS_COUNT, D3DERR_INVALIDCALL);
+    user_assert(State < D3DRS_COUNT, D3D_OK);
 
     if (unlikely(This->is_recording)) {
         state->rs_advertised[State] = Value;
@@ -2307,7 +2307,11 @@ NineDevice9_GetRenderState( struct NineDevice9 *This,
                             DWORD *pValue )
 {
     user_assert(!This->pure, D3DERR_INVALIDCALL);
-    user_assert(State < D3DRS_COUNT, D3DERR_INVALIDCALL);
+    /* TODO: This needs tests */
+    if (State >= D3DRS_COUNT) {
+        *pValue = 0;
+        return D3D_OK;
+    }
 
     *pValue = This->state.rs_advertised[State];
     return D3D_OK;