st/nine: Revert to userbuf path when needed
authorAxel Davy <axel.davy@ens.fr>
Sun, 16 Aug 2015 12:59:52 +0000 (14:59 +0200)
committerAxel Davy <axel.davy@ens.fr>
Fri, 21 Aug 2015 20:21:47 +0000 (22:21 +0200)
Automatically switch to userbuf path when
we would need to upload fog or bumpmat
constants

Signed-off-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/nine_state.c

index 53efa56d081680b35ee999635e429a69074e1eec..e185b025134db4708e65e05597cd9a719a2fc62c 100644 (file)
@@ -61,6 +61,9 @@ prepare_rasterizer(struct NineDevice9 *device)
     device->state.commit |= NINE_STATE_COMMIT_RASTERIZER;
 }
 
+static void
+prepare_ps_constants_userbuf(struct NineDevice9 *device);
+
 #define DO_UPLOAD_CONST_F(buf,p,c,d) \
     do { \
         DBG("upload ConstantF [%u .. %u]\n", x, (x) + (c) - 1); \
@@ -122,6 +125,14 @@ upload_constants(struct NineDevice9 *device, unsigned shader_type)
         device->state.changed.group &= ~NINE_STATE_VS_CONST;
     } else {
         DBG("PS\n");
+        /* features only implemented on the userbuf path */
+        if (device->state.ps->bumpenvmat_needed || (
+            device->state.ps->byte_code.version < 0x30 &&
+            device->state.rs[D3DRS_FOGENABLE])) {
+            device->prefer_user_constbuf = TRUE;
+            prepare_ps_constants_userbuf(device);
+            return;
+        }
         buf = device->constbuf_ps;
 
         const_f = device->state.ps_const_f;