summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2012-12-06 16:14:03 +1000
committerDave Airlie <[email protected]>2012-12-08 13:32:38 +1000
commita6256f1e678cf72a2c0cb407a2118afa92bd1b20 (patch)
tree36afdcc2bf739b50f78089e7876eb69a49f62885 /src
parent22439f24a2403aaf8428a80da23fc95fc16454fa (diff)
softpipe: add texture buffer object support
This adds TBO support to softpipe. Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 3a38182994c..1e752fbc8c8 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 31eab39ef0a..7558ef11175 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);