st/mesa: call is_format_supported() for compressed formats
[mesa.git] / src / mesa / state_tracker / st_atom_constbuf.c
index d70cf877e84973eaec0062e1e736fbc88d4c8fa3..a8f2b879d532c511c8d04476ac94c063532c128b 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
+#include "util/u_inlines.h"
 
 #include "st_debug.h"
 #include "st_context.h"
@@ -57,7 +57,7 @@ void st_upload_constants( struct st_context *st,
                           unsigned shader_type)
 {
    struct pipe_context *pipe = st->pipe;
-   struct pipe_buffer **cbuf = &st->state.constants[shader_type];
+   struct pipe_resource **cbuf = &st->state.constants[shader_type];
 
    assert(shader_type == PIPE_SHADER_VERTEX ||
           shader_type == PIPE_SHADER_FRAGMENT);
@@ -71,10 +71,10 @@ void st_upload_constants( struct st_context *st,
       /* We always need to get a new buffer, to keep the drivers simple and
        * avoid gratuitous rendering synchronization.
        */
-      pipe_buffer_reference(cbuf, NULL );
-      *cbuf = pipe_buffer_create(pipe->screen, 16,
-                                        PIPE_BUFFER_USAGE_CONSTANT,
-                                       paramBytes );
+      pipe_resource_reference(cbuf, NULL );
+      *cbuf = pipe_buffer_create(pipe->screen,
+                                PIPE_BIND_CONSTANT_BUFFER,
+                                paramBytes );
 
       if (ST_DEBUG & DEBUG_CONSTANTS) {
         debug_printf("%s(shader=%d, numParams=%d, stateFlags=0x%x)\n", 
@@ -84,10 +84,9 @@ void st_upload_constants( struct st_context *st,
       }
 
       /* load Mesa constants into the constant buffer */
-      if (cbuf)
-         st_no_flush_pipe_buffer_write(st, *cbuf,
-                                      0, paramBytes,
-                                      params->ParameterValues);
+      st_no_flush_pipe_buffer_write(st, *cbuf,
+                                   0, paramBytes,
+                                   params->ParameterValues);
 
       st->pipe->set_constant_buffer(st->pipe, shader_type, 0, *cbuf);
    }