summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2013-02-25 20:23:18 +0100
committerRoland Scheidegger <sroland@vmware.com>2013-02-25 20:38:23 +0100
commit20183177a5803317fe69f1f1a8dfae4d18b3702f (patch)
treee77794acca4b68049088722cc32d4fab2da0c6e4 /src/gallium/auxiliary
parent50a5d5dea0c21886bc3445c0ad0928b03e64ab10 (diff)
downloadexternal_mesa3d-20183177a5803317fe69f1f1a8dfae4d18b3702f.zip
external_mesa3d-20183177a5803317fe69f1f1a8dfae4d18b3702f.tar.gz
external_mesa3d-20183177a5803317fe69f1f1a8dfae4d18b3702f.tar.bz2
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 <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c6
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample.h4
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c8
6 files changed, 14 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index dfa8927..5020081 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 sview_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,
+ sview_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..e8e2d94 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 sview_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..8e46687 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 sview_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(sview_idx < Elements(draw->llvm->jit_context.textures));
- jit_tex = &draw->llvm->jit_context.textures[sampler_idx];
+ jit_tex = &draw->llvm->jit_context.textures[sview_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..c9f125b 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 sview_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), "");
}