softpipe: add texture buffer object support
authorDave Airlie <airlied@redhat.com>
Thu, 6 Dec 2012 06:14:03 +0000 (16:14 +1000)
committerDave Airlie <airlied@redhat.com>
Sat, 8 Dec 2012 03:32:38 +0000 (13:32 +1000)
This adds TBO support to softpipe.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/softpipe/sp_tex_sample.c

index 3a38182994cc8f0a3ec951786b075076fb1b93f3..1e752fbc8c805024fa3a21647134cd8b55d2665c 100644 (file)
@@ -171,6 +171,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_QUERY_TIMESTAMP:
    case PIPE_CAP_CUBE_MAP_ARRAY:
       return 1;
+   case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
+      return 1;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
index 31eab39ef0a41b961f2e34d254bc271d0704f9a4..7558ef1117516ba709ccb7552769064069bd2610 100644 (file)
@@ -38,6 +38,7 @@
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
 #include "util/u_math.h"
+#include "util/u_format.h"
 #include "util/u_memory.h"
 #include "sp_quad.h"   /* only for #define QUAD_* tokens */
 #include "sp_tex_sample.h"
@@ -2502,6 +2503,7 @@ get_lambda_func(const union sp_sampler_key key)
       return compute_lambda_vert;
    
    switch (key.bits.target) {
+   case PIPE_BUFFER:
    case PIPE_TEXTURE_1D:
    case PIPE_TEXTURE_1D_ARRAY:
       return compute_lambda_1d;
@@ -2526,6 +2528,7 @@ get_img_filter(const union sp_sampler_key key,
                const struct pipe_sampler_state *sampler)
 {
    switch (key.bits.target) {
+   case PIPE_BUFFER:
    case PIPE_TEXTURE_1D:
       if (filter == PIPE_TEX_FILTER_NEAREST) 
          return img_filter_1d_nearest;
@@ -2648,7 +2651,6 @@ sample_get_dims(struct tgsi_sampler *tgsi_sampler, int level,
        dims[1] = texture->array_size;
        /* fallthrough */
     case PIPE_TEXTURE_1D:
-    case PIPE_BUFFER:
        return;
     case PIPE_TEXTURE_2D_ARRAY:
        dims[2] = texture->array_size;
@@ -2665,6 +2667,9 @@ sample_get_dims(struct tgsi_sampler *tgsi_sampler, int level,
     case PIPE_TEXTURE_CUBE_ARRAY:
        dims[1] = u_minify(texture->height0, level);
        dims[2] = texture->array_size / 6;
+       break;
+    case PIPE_BUFFER:
+       dims[0] /= util_format_get_blocksize(view->format);
        return;
     default:
        assert(!"unexpected texture target in sample_get_dims()");
@@ -2705,6 +2710,7 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
    layers = texture->array_size;
 
    switch(texture->target) {
+   case PIPE_BUFFER:
    case PIPE_TEXTURE_1D:
       for (j = 0; j < TGSI_QUAD_SIZE; j++) {
          int x = CLAMP(v_i[j] + offset[0], 0, width - 1);