[Mesa-dev] [PATCH] llvmpipe: support GL_ARB_texture_buffer_object/GL_ARB_texture_buffer_range
sroland at vmware.com
sroland at vmware.com
Fri Feb 22 11:09:14 PST 2013
From: Roland Scheidegger <sroland at vmware.com>
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).
---
src/gallium/auxiliary/draw/draw_context.c | 4 +-
src/gallium/auxiliary/draw/draw_context.h | 2 +-
src/gallium/auxiliary/draw/draw_llvm.c | 6 +-
src/gallium/auxiliary/draw/draw_llvm.h | 2 +-
src/gallium/auxiliary/gallivm/lp_bld_sample.h | 4 +-
src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 8 +-
src/gallium/drivers/llvmpipe/lp_jit.h | 4 +-
src/gallium/drivers/llvmpipe/lp_screen.c | 4 +-
src/gallium/drivers/llvmpipe/lp_setup.c | 134 ++++++++++++++-------
src/gallium/drivers/llvmpipe/lp_state_sampler.c | 87 ++++++++-----
src/gallium/drivers/llvmpipe/lp_texture.c | 22 ----
src/gallium/drivers/llvmpipe/lp_texture.h | 21 ++++
12 files changed, 190 insertions(+), 108 deletions(-)
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index dfa8927..c2b6851 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -799,7 +799,7 @@ draw_set_samplers(struct draw_context *draw,
void
draw_set_mapped_texture(struct draw_context *draw,
unsigned shader_stage,
- unsigned sampler_idx,
+ unsigned sv_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,
const void *base_ptr,
@@ -811,7 +811,7 @@ draw_set_mapped_texture(struct draw_context *draw,
#ifdef HAVE_LLVM
if (draw->llvm)
draw_llvm_set_mapped_texture(draw,
- sampler_idx,
+ sv_idx,
width, height, depth, first_level,
last_level, base_ptr,
row_stride, img_stride, mip_offsets);
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index a4937b6..5928e75 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -151,7 +151,7 @@ draw_set_samplers(struct draw_context *draw,
void
draw_set_mapped_texture(struct draw_context *draw,
unsigned shader_stage,
- unsigned sampler_idx,
+ unsigned sv_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,
const void *base,
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 2467e5a..993f03c 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1497,7 +1497,7 @@ draw_llvm_dump_variant_key(struct draw_llvm_variant_key *key)
void
draw_llvm_set_mapped_texture(struct draw_context *draw,
- unsigned sampler_idx,
+ unsigned sv_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,
const void *base_ptr,
@@ -1508,9 +1508,9 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
unsigned j;
struct draw_jit_texture *jit_tex;
- assert(sampler_idx < Elements(draw->llvm->jit_context.textures));
+ assert(sv_idx < Elements(draw->llvm->jit_context.textures));
- jit_tex = &draw->llvm->jit_context.textures[sampler_idx];
+ jit_tex = &draw->llvm->jit_context.textures[sv_idx];
jit_tex->width = width;
jit_tex->height = height;
diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h
index 17ca304..8f99f27 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.h
+++ b/src/gallium/auxiliary/draw/draw_llvm.h
@@ -333,7 +333,7 @@ draw_llvm_set_sampler_state(struct draw_context *draw);
void
draw_llvm_set_mapped_texture(struct draw_context *draw,
- unsigned sampler_idx,
+ unsigned sv_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,
const void *base_ptr,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index f502216..6306455 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -127,7 +127,7 @@ struct lp_sampler_dynamic_state
{
/* First callbacks for sampler view state */
- /** Obtain the base texture width (returns int32) */
+ /** Obtain the base texture width (or number of elements) (returns int32) */
LLVMValueRef
(*width)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
@@ -139,7 +139,7 @@ struct lp_sampler_dynamic_state
struct gallivm_state *gallivm,
unsigned texture_unit);
- /** Obtain the base texture depth (returns int32) */
+ /** Obtain the base texture depth (or array size) (returns int32) */
LLVMValueRef
(*depth)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index c5b48b5..50ccd2a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1422,7 +1422,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
struct lp_static_sampler_state derived_sampler_state = *static_sampler_state;
LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context);
LLVMBuilderRef builder = gallivm->builder;
- LLVMValueRef tex_width, tex_height, tex_depth;
+ LLVMValueRef tex_width;
LLVMValueRef s;
LLVMValueRef t;
LLVMValueRef r;
@@ -1514,8 +1514,6 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
/* Get the dynamic state */
tex_width = dynamic_state->width(dynamic_state, gallivm, texture_index);
- tex_height = dynamic_state->height(dynamic_state, gallivm, texture_index);
- tex_depth = dynamic_state->depth(dynamic_state, gallivm, texture_index);
bld.row_stride_array = dynamic_state->row_stride(dynamic_state, gallivm, texture_index);
bld.img_stride_array = dynamic_state->img_stride(dynamic_state, gallivm, texture_index);
bld.base_ptr = dynamic_state->base_ptr(dynamic_state, gallivm, texture_index);
@@ -1534,9 +1532,13 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
bld.int_size = LLVMBuildInsertElement(builder, bld.int_size_in_bld.undef,
tex_width, LLVMConstInt(i32t, 0, 0), "");
if (dims >= 2) {
+ LLVMValueRef tex_height =
+ dynamic_state->height(dynamic_state, gallivm, texture_index);
bld.int_size = LLVMBuildInsertElement(builder, bld.int_size,
tex_height, LLVMConstInt(i32t, 1, 0), "");
if (dims >= 3) {
+ LLVMValueRef tex_depth =
+ dynamic_state->depth(dynamic_state, gallivm, texture_index);
bld.int_size = LLVMBuildInsertElement(builder, bld.int_size,
tex_depth, LLVMConstInt(i32t, 2, 0), "");
}
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h
index 472d391..4eddb2a 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.h
+++ b/src/gallium/drivers/llvmpipe/lp_jit.h
@@ -49,9 +49,9 @@ struct llvmpipe_screen;
struct lp_jit_texture
{
- uint32_t width;
+ uint32_t width; /* same as number of elements */
uint32_t height;
- uint32_t depth;
+ uint32_t depth; /* doubles as array size */
uint32_t first_level;
uint32_t last_level;
const void *base;
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index b9c1567..05bbca5 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -216,9 +216,11 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TEXTURE_MULTISAMPLE:
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
case PIPE_CAP_CUBE_MAP_ARRAY:
+ return 0;
case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
+ return 1;
case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
- return 0;
+ return 1;
}
/* should only get here on unhandled cases */
debug_printf("Unexpected PIPE_CAP %d query\n", param);
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index b0bc4a8..bbe5a9e 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -674,70 +674,112 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
struct pipe_sampler_view *view = i < num ? views[i] : NULL;
if (view) {
- struct pipe_resource *tex = view->texture;
- struct llvmpipe_resource *lp_tex = llvmpipe_resource(tex);
+ struct pipe_resource *res = view->texture;
+ struct llvmpipe_resource *lp_tex = llvmpipe_resource(res);
struct lp_jit_texture *jit_tex;
jit_tex = &setup->fs.current.jit_context.textures[i];
- jit_tex->width = tex->width0;
- jit_tex->height = tex->height0;
- jit_tex->first_level = view->u.tex.first_level;
- jit_tex->last_level = tex->last_level;
-
- if (tex->target == PIPE_TEXTURE_3D) {
- jit_tex->depth = tex->depth0;
- }
- else {
- jit_tex->depth = tex->array_size;
- }
/* We're referencing the texture's internal data, so save a
* reference to it.
*/
- pipe_resource_reference(&setup->fs.current_tex[i], tex);
+ pipe_resource_reference(&setup->fs.current_tex[i], res);
if (!lp_tex->dt) {
/* regular texture - setup array of mipmap level offsets */
void *mip_ptr;
int j;
- /*
- * XXX this is messed up we don't want to accidentally trigger
- * tiled->linear conversion for levels we don't need.
- * So ask for first_level data (which will allocate all levels)
- * then if successful get base ptr.
- */
- mip_ptr = llvmpipe_get_texture_image_all(lp_tex, view->u.tex.first_level,
- LP_TEX_USAGE_READ,
- LP_TEX_LAYOUT_LINEAR);
+ unsigned first_level = 0;
+ unsigned last_level = 0;
+
+ if (resource_is_texture(res)) {
+ /* XXX Unsure if we need to sanitize parameters? */
+ first_level = view->u.tex.first_level;
+ last_level = view->u.tex.last_level;
+ assert(first_level <= last_level);
+ assert(last_level <= res->last_level);
+
+ /*
+ * XXX this is messed up we don't want to accidentally trigger
+ * tiled->linear conversion for levels we don't need.
+ * So ask for first_level data (which will allocate all levels)
+ * then if successful get base ptr.
+ */
+ mip_ptr = llvmpipe_get_texture_image_all(lp_tex, first_level,
+ LP_TEX_USAGE_READ,
+ LP_TEX_LAYOUT_LINEAR);
+ jit_tex->base = lp_tex->linear_img.data;
+ }
+ else {
+ mip_ptr = lp_tex->data;
+ jit_tex->base = mip_ptr;
+ }
+
if ((LP_PERF & PERF_TEX_MEM) || !mip_ptr) {
/* out of memory - use dummy tile memory */
+ /* Note if using PERF_TEX_MEM will also skip tile conversion */
jit_tex->base = lp_dummy_tile;
jit_tex->width = TILE_SIZE/8;
jit_tex->height = TILE_SIZE/8;
jit_tex->depth = 1;
jit_tex->first_level = 0;
jit_tex->last_level = 0;
+ jit_tex->mip_offsets[j] = 0;
+ jit_tex->row_stride[j] = 0;
+ jit_tex->img_stride[j] = 0;
}
else {
- jit_tex->base = lp_tex->linear_img.data;
- }
- for (j = view->u.tex.first_level; j <= tex->last_level; j++) {
- mip_ptr = llvmpipe_get_texture_image_all(lp_tex, j,
- LP_TEX_USAGE_READ,
- LP_TEX_LAYOUT_LINEAR);
- jit_tex->mip_offsets[j] = (uint8_t *)mip_ptr - (uint8_t *)jit_tex->base;
- /*
- * could get mip offset directly but need call above to
- * invoke tiled->linear conversion.
- */
- assert(lp_tex->linear_mip_offsets[j] == jit_tex->mip_offsets[j]);
- jit_tex->row_stride[j] = lp_tex->row_stride[j];
- jit_tex->img_stride[j] = lp_tex->img_stride[j];
-
- if (jit_tex->base == lp_dummy_tile) {
- /* out of memory - use dummy tile memory */
- jit_tex->mip_offsets[j] = 0;
- jit_tex->row_stride[j] = 0;
- jit_tex->img_stride[j] = 0;
+ jit_tex->width = res->width0;
+ jit_tex->height = res->height0;
+ jit_tex->depth = res->depth0;
+ jit_tex->first_level = first_level;
+ jit_tex->last_level = last_level;
+
+ if (resource_is_texture(res)) {
+ for (j = first_level; j <= last_level; j++) {
+ mip_ptr = llvmpipe_get_texture_image_all(lp_tex, j,
+ LP_TEX_USAGE_READ,
+ LP_TEX_LAYOUT_LINEAR);
+ jit_tex->mip_offsets[j] = (uint8_t *)mip_ptr - (uint8_t *)jit_tex->base;
+ /*
+ * could get mip offset directly but need call above to
+ * invoke tiled->linear conversion.
+ */
+ assert(lp_tex->linear_mip_offsets[j] == jit_tex->mip_offsets[j]);
+ jit_tex->row_stride[j] = lp_tex->row_stride[j];
+ jit_tex->img_stride[j] = lp_tex->img_stride[j];
+ }
+
+ /*
+ * We don't use anything like first_element (for buffers) or
+ * first_layer (for arrays), instead adjust the last_element
+ * (width) or last_layer (depth) plus the base pointer.
+ * Less parameters and faster at shader execution.
+ * XXX Could do the same for mip levels.
+ */
+ if (res->target == PIPE_TEXTURE_1D_ARRAY ||
+ res->target == PIPE_TEXTURE_2D_ARRAY) {
+ jit_tex->depth = view->u.tex.last_layer - view->u.tex.first_layer + 1;
+ jit_tex->base = (uint8_t *)jit_tex->base +
+ view->u.tex.first_layer * lp_tex->img_stride[0];
+ /* XXX Unsure if we need to sanitize parameters? */
+ assert(view->u.tex.first_layer <= view->u.tex.last_layer);
+ assert(view->u.tex.last_layer < res->array_size);
+ }
+ }
+ else {
+ unsigned view_blocksize = util_format_get_blocksize(view->format);
+ /* probably don't really need to fill that out */
+ jit_tex->mip_offsets[0] = 0;
+ jit_tex->row_stride[0] = 0;
+ jit_tex->row_stride[0] = 0;
+
+ /* everything specified in number of elements here. */
+ jit_tex->width = view->u.buf.last_element - view->u.buf.first_element + 1;
+ jit_tex->base = (uint8_t *)jit_tex->base + view->u.buf.first_element *
+ view_blocksize;
+ /* XXX Unsure if we need to sanitize parameters? */
+ assert(view->u.buf.first_element <= view->u.buf.last_element);
+ assert(view->u.buf.last_element * view_blocksize < res->width0);
}
}
}
@@ -746,13 +788,17 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
/*
* XXX: Where should this be unmapped?
*/
- struct llvmpipe_screen *screen = llvmpipe_screen(tex->screen);
+ struct llvmpipe_screen *screen = llvmpipe_screen(res->screen);
struct sw_winsys *winsys = screen->winsys;
jit_tex->base = winsys->displaytarget_map(winsys, lp_tex->dt,
PIPE_TRANSFER_READ);
jit_tex->row_stride[0] = lp_tex->row_stride[0];
jit_tex->img_stride[0] = lp_tex->img_stride[0];
jit_tex->mip_offsets[0] = 0;
+ jit_tex->width = res->width0;
+ jit_tex->height = res->height0;
+ jit_tex->depth = res->depth0;
+ jit_tex->first_level = jit_tex->last_level = 0;
assert(jit_tex->base);
}
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index 9736ca9..887e648 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -268,14 +268,10 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp,
if (view) {
struct pipe_resource *tex = view->texture;
struct llvmpipe_resource *lp_tex = llvmpipe_resource(tex);
- unsigned num_layers;
-
- if (tex->target == PIPE_TEXTURE_3D) {
- num_layers = tex->depth0;
- }
- else {
- num_layers = tex->array_size;
- }
+ unsigned width0 = tex->width0;
+ unsigned num_layers = tex->depth0;
+ unsigned first_level = 0;
+ unsigned last_level = 0;
/* We're referencing the texture's internal data, so save a
* reference to it.
@@ -283,27 +279,64 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp,
pipe_resource_reference(&lp->mapped_vs_tex[i], tex);
if (!lp_tex->dt) {
- /* regular texture - setup array of mipmap level pointers */
- /* XXX this may fail due to OOM ? */
+ /* regular texture - setup array of mipmap level offsets */
+ struct pipe_resource *res = view->texture;
int j;
void *mip_ptr;
- /* must trigger allocation first before we can get base ptr */
- mip_ptr = llvmpipe_get_texture_image_all(lp_tex, view->u.tex.first_level,
- LP_TEX_USAGE_READ,
- LP_TEX_LAYOUT_LINEAR);
- addr = lp_tex->linear_img.data;
- for (j = view->u.tex.first_level; j <= tex->last_level; j++) {
- mip_ptr = llvmpipe_get_texture_image_all(lp_tex, j,
+
+ if (resource_is_texture(res)) {
+ /* XXX Unsure if we need to sanitize parameters? */
+ first_level = view->u.tex.first_level;
+ last_level = view->u.tex.last_level;
+ assert(first_level <= last_level);
+ assert(last_level <= res->last_level);
+
+ /* must trigger allocation first before we can get base ptr */
+ /* XXX this may fail due to OOM ? */
+ mip_ptr = llvmpipe_get_texture_image_all(lp_tex, view->u.tex.first_level,
LP_TEX_USAGE_READ,
LP_TEX_LAYOUT_LINEAR);
- mip_offsets[j] = (uint8_t *)mip_ptr - (uint8_t *)addr;
- /*
- * could get mip offset directly but need call above to
- * invoke tiled->linear conversion.
- */
- assert(lp_tex->linear_mip_offsets[j] == mip_offsets[j]);
- row_stride[j] = lp_tex->row_stride[j];
- img_stride[j] = lp_tex->img_stride[j];
+ addr = lp_tex->linear_img.data;
+
+ for (j = first_level; j <= last_level; j++) {
+ mip_ptr = llvmpipe_get_texture_image_all(lp_tex, j,
+ LP_TEX_USAGE_READ,
+ LP_TEX_LAYOUT_LINEAR);
+ mip_offsets[j] = (uint8_t *)mip_ptr - (uint8_t *)addr;
+ /*
+ * could get mip offset directly but need call above to
+ * invoke tiled->linear conversion.
+ */
+ assert(lp_tex->linear_mip_offsets[j] == mip_offsets[j]);
+ row_stride[j] = lp_tex->row_stride[j];
+ img_stride[j] = lp_tex->img_stride[j];
+ }
+ if (res->target == PIPE_TEXTURE_1D_ARRAY ||
+ res->target == PIPE_TEXTURE_2D_ARRAY) {
+ num_layers = view->u.tex.last_layer - view->u.tex.first_layer + 1;
+ addr = (uint8_t *)addr +
+ view->u.tex.first_layer * lp_tex->img_stride[0];
+ /* XXX Unsure if we need to sanitize parameters? */
+ assert(view->u.tex.first_layer <= view->u.tex.last_layer);
+ assert(view->u.tex.last_layer < res->array_size);
+ }
+ }
+ else {
+ unsigned view_blocksize = util_format_get_blocksize(view->format);
+ mip_ptr = lp_tex->data;
+ addr = mip_ptr;
+ /* probably don't really need to fill that out */
+ mip_offsets[0] = 0;
+ row_stride[0] = 0;
+ row_stride[0] = 0;
+
+ /* everything specified in number of elements here. */
+ width0 = view->u.buf.last_element - view->u.buf.first_element + 1;
+ addr = (uint8_t *)addr + view->u.buf.first_element *
+ view_blocksize;
+ /* XXX Unsure if we need to sanitize parameters? */
+ assert(view->u.buf.first_element <= view->u.buf.last_element);
+ assert(view->u.buf.last_element * view_blocksize < res->width0);
}
}
else {
@@ -323,8 +356,8 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp,
draw_set_mapped_texture(lp->draw,
PIPE_SHADER_VERTEX,
i,
- tex->width0, tex->height0, num_layers,
- view->u.tex.first_level, tex->last_level,
+ width0, tex->height0, num_layers,
+ first_level, last_level,
addr,
row_stride, img_stride, mip_offsets);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index d55985b..c6f6dc2 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.
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h
index 172228d..0e6872a 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.h
+++ b/src/gallium/drivers/llvmpipe/lp_texture.h
@@ -52,6 +52,27 @@ enum lp_texture_layout
};
+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;
+ }
+}
+
+
struct pipe_context;
struct pipe_screen;
struct llvmpipe_context;
--
1.7.9.5
More information about the mesa-dev
mailing list