aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_texture.c
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2013-02-25 20:23:18 +0100
committerRoland Scheidegger <[email protected]>2013-02-25 20:38:23 +0100
commit20183177a5803317fe69f1f1a8dfae4d18b3702f (patch)
treee77794acca4b68049088722cc32d4fab2da0c6e4 /src/gallium/drivers/llvmpipe/lp_texture.c
parent50a5d5dea0c21886bc3445c0ad0928b03e64ab10 (diff)
llvmpipe: support GL_ARB_texture_buffer_object/GL_ARB_texture_buffer_range
This also fixes not honoring first/last_layer view parameters for array textures, plus not honoring last_level view parameter for all textures (neither is really used by OpenGL). This mostly passes piglit arb_texture_buffer_object tests (it needs, however, glsl 140 version override, plus GL 3.1 override, the latter only because mesa does not allow ARB_tbo in non-core contexts). Most arb_texture_buffer_object tests pass, with the exception of arb_texture_buffer_object-formats. With "arb" parameter it passes most weirdo formats before it segfaults in the state tracker, this looks to be some issue with using legacy formats in core context (fails the same in softpipe). With "core" parameter it passes with "fs", however fails with "vs" (for most formats). This will be fixed later (debugging shows we're completely missing the shader recompile depending on format). v2: based on Jose's feedback, fix comments, variable/function names. Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_texture.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c36
1 files changed, 7 insertions, 29 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index f34882808a4..f9232923733 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -60,28 +60,6 @@ static struct llvmpipe_resource resource_list;
static unsigned id_counter = 0;
-static INLINE boolean
-resource_is_texture(const struct pipe_resource *resource)
-{
- switch (resource->target) {
- case PIPE_BUFFER:
- return FALSE;
- case PIPE_TEXTURE_1D:
- case PIPE_TEXTURE_1D_ARRAY:
- case PIPE_TEXTURE_2D:
- case PIPE_TEXTURE_2D_ARRAY:
- case PIPE_TEXTURE_RECT:
- case PIPE_TEXTURE_3D:
- case PIPE_TEXTURE_CUBE:
- return TRUE;
- default:
- assert(0);
- return FALSE;
- }
-}
-
-
-
/**
* Allocate storage for llvmpipe_texture::layout array.
* The number of elements is width_in_tiles * height_in_tiles.
@@ -294,7 +272,7 @@ llvmpipe_resource_create(struct pipe_screen *_screen,
/* assert(lpr->base.bind); */
- if (resource_is_texture(&lpr->base)) {
+ if (llvmpipe_resource_is_texture(&lpr->base)) {
if (lpr->base.bind & (PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) {
@@ -357,7 +335,7 @@ llvmpipe_resource_destroy(struct pipe_screen *pscreen,
FREE(lpr->layout[0]);
}
- else if (resource_is_texture(pt)) {
+ else if (llvmpipe_resource_is_texture(pt)) {
/* regular texture */
uint level;
@@ -447,7 +425,7 @@ llvmpipe_resource_map(struct pipe_resource *resource,
return map2;
}
- else if (resource_is_texture(resource)) {
+ else if (llvmpipe_resource_is_texture(resource)) {
map = llvmpipe_get_texture_image(lpr, layer, level,
tex_usage, layout);
@@ -492,7 +470,7 @@ llvmpipe_resource_data(struct pipe_resource *resource)
{
struct llvmpipe_resource *lpr = llvmpipe_resource(resource);
- assert(!resource_is_texture(resource));
+ assert(!llvmpipe_resource_is_texture(resource));
return lpr->data;
}
@@ -967,7 +945,7 @@ llvmpipe_get_texture_tile_layout(const struct llvmpipe_resource *lpr,
unsigned x, unsigned y)
{
uint i;
- assert(resource_is_texture(&lpr->base));
+ assert(llvmpipe_resource_is_texture(&lpr->base));
assert(x < lpr->tiles_per_row[level]);
i = face_slice * lpr->tiles_per_image[level]
+ y * lpr->tiles_per_row[level] + x;
@@ -982,7 +960,7 @@ llvmpipe_set_texture_tile_layout(struct llvmpipe_resource *lpr,
enum lp_texture_layout layout)
{
uint i;
- assert(resource_is_texture(&lpr->base));
+ assert(llvmpipe_resource_is_texture(&lpr->base));
assert(x < lpr->tiles_per_row[level]);
i = face_slice * lpr->tiles_per_image[level]
+ y * lpr->tiles_per_row[level] + x;
@@ -1264,7 +1242,7 @@ llvmpipe_get_texture_tile_linear(struct llvmpipe_resource *lpr,
boolean convert;
uint8_t *tiled_image, *linear_image;
- assert(resource_is_texture(&lpr->base));
+ assert(llvmpipe_resource_is_texture(&lpr->base));
assert(x % TILE_SIZE == 0);
assert(y % TILE_SIZE == 0);