[Mesa-dev] [PATCH 4/6] softpipe: add texture buffer object support

Dave Airlie airlied at gmail.com
Wed Dec 5 22:24:32 PST 2012


From: Dave Airlie <airlied at redhat.com>

This adds TBO support to softpipe.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/gallium/drivers/softpipe/sp_screen.c     | 2 ++
 src/gallium/drivers/softpipe/sp_tex_sample.c | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 3a38182..1e752fb 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -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);
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 31eab39..7558ef1 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -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);
-- 
1.8.0.1



More information about the mesa-dev mailing list