nine: assume that user constant buffers are always supported
authorMarek Olšák <marek.olsak@amd.com>
Wed, 10 Jan 2018 19:02:48 +0000 (20:02 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 17 Jan 2018 19:17:59 +0000 (20:17 +0100)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/gallium/state_trackers/nine/device9.c
src/gallium/state_trackers/nine/device9.h
src/gallium/state_trackers/nine/nine_ff.c
src/gallium/state_trackers/nine/nine_state.c

index 34f903a6947d8ae33ce6d8a7d8b5c1860e41c59c..127f2ae195bd530f080d4feeeabec34a9b9d46e5 100644 (file)
@@ -473,12 +473,8 @@ NineDevice9_ctor( struct NineDevice9 *This,
     /* Allocate upload helper for drivers that suck (from st pov ;). */
 
     This->driver_caps.user_vbufs = GET_PCAP(USER_VERTEX_BUFFERS) && !This->csmt_active;
-    This->driver_caps.user_cbufs = GET_PCAP(USER_CONSTANT_BUFFERS);
     This->driver_caps.user_sw_vbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_VERTEX_BUFFERS);
-    This->driver_caps.user_sw_cbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_CONSTANT_BUFFERS);
     This->vertex_uploader = This->csmt_active ? This->pipe_secondary->stream_uploader : This->context.pipe->stream_uploader;
-    if (!This->driver_caps.user_cbufs)
-        This->constbuf_alignment = GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT);
     This->driver_caps.window_space_position_support = GET_PCAP(TGSI_VS_WINDOW_SPACE_POSITION);
     This->driver_caps.vs_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS);
     This->driver_caps.ps_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_INTEGERS);
index c5fd8f76c6353b81ae7f59c858f94e42c2bd9609..4cce29a28e0d43de569a0971961506cb4a7966b3 100644 (file)
@@ -127,9 +127,7 @@ struct NineDevice9
 
     struct {
         boolean user_vbufs;
-        boolean user_cbufs;
         boolean user_sw_vbufs;
-        boolean user_sw_cbufs;
         boolean window_space_position_support;
         boolean vs_integer;
         boolean ps_integer;
@@ -141,7 +139,6 @@ struct NineDevice9
     } driver_bugs;
 
     struct u_upload_mgr *vertex_uploader;
-    unsigned constbuf_alignment;
 
     struct nine_range_pool range_pool;
 
index 39fcb8b1591e0d6e9c87b7628695751b5ea458e9..eb673e4aff9fa3cafd82f248b6128065835d64b3 100644 (file)
@@ -2060,19 +2060,7 @@ nine_ff_update(struct NineDevice9 *device)
         cb.user_buffer = device->ff.vs_const;
         cb.buffer_size = NINE_FF_NUM_VS_CONST * 4 * sizeof(float);
 
-        if (!device->driver_caps.user_cbufs) {
-            context->pipe_data.cb_vs_ff.buffer_size = cb.buffer_size;
-            u_upload_data(device->context.pipe->const_uploader,
-                          0,
-                          cb.buffer_size,
-                          device->constbuf_alignment,
-                          cb.user_buffer,
-                          &context->pipe_data.cb_vs_ff.buffer_offset,
-                          &context->pipe_data.cb_vs_ff.buffer);
-            u_upload_unmap(device->context.pipe->const_uploader);
-            context->pipe_data.cb_vs_ff.user_buffer = NULL;
-        } else
-            context->pipe_data.cb_vs_ff = cb;
+        context->pipe_data.cb_vs_ff = cb;
         context->commit |= NINE_STATE_COMMIT_CONST_VS;
     }
 
@@ -2084,19 +2072,7 @@ nine_ff_update(struct NineDevice9 *device)
         cb.user_buffer = device->ff.ps_const;
         cb.buffer_size = NINE_FF_NUM_PS_CONST * 4 * sizeof(float);
 
-        if (!device->driver_caps.user_cbufs) {
-            context->pipe_data.cb_ps_ff.buffer_size = cb.buffer_size;
-            u_upload_data(device->context.pipe->const_uploader,
-                          0,
-                          cb.buffer_size,
-                          device->constbuf_alignment,
-                          cb.user_buffer,
-                          &context->pipe_data.cb_ps_ff.buffer_offset,
-                          &context->pipe_data.cb_ps_ff.buffer);
-            u_upload_unmap(device->context.pipe->const_uploader);
-            context->pipe_data.cb_ps_ff.user_buffer = NULL;
-        } else
-            context->pipe_data.cb_ps_ff = cb;
+        context->pipe_data.cb_ps_ff = cb;
         context->commit |= NINE_STATE_COMMIT_CONST_PS;
     }
 
index a9a41af66ec8a35b355e349f4568d1d95ac3d3c2..26b2dea3bd528534563d7a3d6549f28cfb0b2466 100644 (file)
@@ -382,9 +382,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 *device)
             cb.user_buffer = dst;
         }
 
-        /* Do not erase the buffer field.
-         * It is either NULL (user_cbufs), or a resource.
-         * u_upload_data will do the proper refcount */
         context->pipe_data.cb0_swvp.buffer_offset = cb.buffer_offset;
         context->pipe_data.cb0_swvp.buffer_size = cb.buffer_size;
         context->pipe_data.cb0_swvp.user_buffer = cb.user_buffer;
@@ -423,52 +420,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 *device)
         context->changed.vs_const_b = 0;
     }
 
-    if (!device->driver_caps.user_cbufs) {
-        struct pipe_constant_buffer *cb = &(context->pipe_data.cb0_swvp);
-        u_upload_data(device->context.pipe->const_uploader,
-                      0,
-                      cb->buffer_size,
-                      device->constbuf_alignment,
-                      cb->user_buffer,
-                      &(cb->buffer_offset),
-                      &(cb->buffer));
-        u_upload_unmap(device->context.pipe->const_uploader);
-        cb->user_buffer = NULL;
-
-        cb = &(context->pipe_data.cb1_swvp);
-        u_upload_data(device->context.pipe->const_uploader,
-                      0,
-                      cb->buffer_size,
-                      device->constbuf_alignment,
-                      cb->user_buffer,
-                      &(cb->buffer_offset),
-                      &(cb->buffer));
-        u_upload_unmap(device->context.pipe->const_uploader);
-        cb->user_buffer = NULL;
-
-        cb = &(context->pipe_data.cb2_swvp);
-        u_upload_data(device->context.pipe->const_uploader,
-                      0,
-                      cb->buffer_size,
-                      device->constbuf_alignment,
-                      cb->user_buffer,
-                      &(cb->buffer_offset),
-                      &(cb->buffer));
-        u_upload_unmap(device->context.pipe->const_uploader);
-        cb->user_buffer = NULL;
-
-        cb = &(context->pipe_data.cb3_swvp);
-        u_upload_data(device->context.pipe->const_uploader,
-                      0,
-                      cb->buffer_size,
-                      device->constbuf_alignment,
-                      cb->user_buffer,
-                      &(cb->buffer_offset),
-                      &(cb->buffer));
-        u_upload_unmap(device->context.pipe->const_uploader);
-        cb->user_buffer = NULL;
-    }
-
     context->changed.group &= ~NINE_STATE_VS_CONST;
     context->commit |= NINE_STATE_COMMIT_CONST_VS;
 }
@@ -522,20 +473,7 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device)
         cb.user_buffer = dst;
     }
 
-    if (!device->driver_caps.user_cbufs) {
-        context->pipe_data.cb_vs.buffer_size = cb.buffer_size;
-        u_upload_data(device->context.pipe->const_uploader,
-                      0,
-                      cb.buffer_size,
-                      device->constbuf_alignment,
-                      cb.user_buffer,
-                      &context->pipe_data.cb_vs.buffer_offset,
-                      &context->pipe_data.cb_vs.buffer);
-        u_upload_unmap(device->context.pipe->const_uploader);
-        context->pipe_data.cb_vs.user_buffer = NULL;
-    } else
-        context->pipe_data.cb_vs = cb;
-
+    context->pipe_data.cb_vs = cb;
     context->changed.vs_const_f = 0;
 
     context->changed.group &= ~NINE_STATE_VS_CONST;
@@ -593,20 +531,7 @@ prepare_ps_constants_userbuf(struct NineDevice9 *device)
     if (!cb.buffer_size)
         return;
 
-    if (!device->driver_caps.user_cbufs) {
-        context->pipe_data.cb_ps.buffer_size = cb.buffer_size;
-        u_upload_data(device->context.pipe->const_uploader,
-                      0,
-                      cb.buffer_size,
-                      device->constbuf_alignment,
-                      cb.user_buffer,
-                      &context->pipe_data.cb_ps.buffer_offset,
-                      &context->pipe_data.cb_ps.buffer);
-        u_upload_unmap(device->context.pipe->const_uploader);
-        context->pipe_data.cb_ps.user_buffer = NULL;
-    } else
-        context->pipe_data.cb_ps = cb;
-
+    context->pipe_data.cb_ps = cb;
     context->changed.ps_const_f = 0;
 
     context->changed.group &= ~NINE_STATE_PS_CONST;
@@ -3348,34 +3273,12 @@ update_vs_constants_sw(struct NineDevice9 *device)
         }
 
         buf = cb.user_buffer;
-        if (!device->driver_caps.user_sw_cbufs) {
-            u_upload_data(device->pipe_sw->const_uploader,
-                          0,
-                          cb.buffer_size,
-                          16,
-                          cb.user_buffer,
-                          &(cb.buffer_offset),
-                          &(cb.buffer));
-            u_upload_unmap(device->pipe_sw->const_uploader);
-            cb.user_buffer = NULL;
-        }
 
         pipe_sw->set_constant_buffer(pipe_sw, PIPE_SHADER_VERTEX, 0, &cb);
         if (cb.buffer)
             pipe_resource_reference(&cb.buffer, NULL);
 
         cb.user_buffer = (char *)buf + 4096 * sizeof(float[4]);
-        if (!device->driver_caps.user_sw_cbufs) {
-            u_upload_data(device->pipe_sw->const_uploader,
-                          0,
-                          cb.buffer_size,
-                          16,
-                          cb.user_buffer,
-                          &(cb.buffer_offset),
-                          &(cb.buffer));
-            u_upload_unmap(device->pipe_sw->const_uploader);
-            cb.user_buffer = NULL;
-        }
 
         pipe_sw->set_constant_buffer(pipe_sw, PIPE_SHADER_VERTEX, 1, &cb);
         if (cb.buffer)
@@ -3390,18 +3293,6 @@ update_vs_constants_sw(struct NineDevice9 *device)
         cb.buffer_size = 2048 * sizeof(float[4]);
         cb.user_buffer = state->vs_const_i;
 
-        if (!device->driver_caps.user_sw_cbufs) {
-            u_upload_data(device->pipe_sw->const_uploader,
-                          0,
-                          cb.buffer_size,
-                          16,
-                          cb.user_buffer,
-                          &(cb.buffer_offset),
-                          &(cb.buffer));
-            u_upload_unmap(device->pipe_sw->const_uploader);
-            cb.user_buffer = NULL;
-        }
-
         pipe_sw->set_constant_buffer(pipe_sw, PIPE_SHADER_VERTEX, 2, &cb);
         if (cb.buffer)
             pipe_resource_reference(&cb.buffer, NULL);
@@ -3415,18 +3306,6 @@ update_vs_constants_sw(struct NineDevice9 *device)
         cb.buffer_size = 512 * sizeof(float[4]);
         cb.user_buffer = state->vs_const_b;
 
-        if (!device->driver_caps.user_sw_cbufs) {
-            u_upload_data(device->pipe_sw->const_uploader,
-                          0,
-                          cb.buffer_size,
-                          16,
-                          cb.user_buffer,
-                          &(cb.buffer_offset),
-                          &(cb.buffer));
-            u_upload_unmap(device->pipe_sw->const_uploader);
-            cb.user_buffer = NULL;
-        }
-
         pipe_sw->set_constant_buffer(pipe_sw, PIPE_SHADER_VERTEX, 3, &cb);
         if (cb.buffer)
             pipe_resource_reference(&cb.buffer, NULL);