summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2007-12-11 14:39:37 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2007-12-11 14:39:37 +0000
commitc3af68dc5022715cc8f126b7df12f3f5248aefe7 (patch)
tree587d4fbb480ad63d9326f6d214414b2a7bbee67d /src
parent94cadef31f9d4ee9fce1bfa66fabb0a403a6f049 (diff)
gallium: remove set_sampler_units interface
The effect of this mapping can be acheived by the state tracker and setting up the pipe texture state pointers to incorporate its affects.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/cell/ppu/cell_context.c1
-rw-r--r--src/mesa/pipe/cell/ppu/cell_context.h1
-rw-r--r--src/mesa/pipe/cell/ppu/cell_state.h3
-rw-r--r--src/mesa/pipe/cell/ppu/cell_state_sampler.c20
-rw-r--r--src/mesa/pipe/failover/fo_context.h1
-rw-r--r--src/mesa/pipe/failover/fo_state.c23
-rw-r--r--src/mesa/pipe/failover/fo_state_emit.c2
-rw-r--r--src/mesa/pipe/i915simple/i915_context.h1
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c19
-rw-r--r--src/mesa/pipe/i965simple/brw_state.c10
-rw-r--r--src/mesa/pipe/llvm/gallivm.cpp8
-rw-r--r--src/mesa/pipe/llvm/gallivm.h3
-rw-r--r--src/mesa/pipe/llvm/llvm_base_shader.cpp2
-rw-r--r--src/mesa/pipe/llvm/llvm_entry.c3
-rw-r--r--src/mesa/pipe/p_context.h12
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c3
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h1
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_fs.c3
-rw-r--r--src/mesa/pipe/softpipe/sp_state.h5
-rw-r--r--src/mesa/pipe/softpipe/sp_state_sampler.c17
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_exec.c3
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_exec.h1
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c15
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c32
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c4
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c4
-rw-r--r--src/mesa/state_tracker/st_cb_texture.h3
-rw-r--r--src/mesa/state_tracker/st_context.h2
28 files changed, 65 insertions, 137 deletions
diff --git a/src/mesa/pipe/cell/ppu/cell_context.c b/src/mesa/pipe/cell/ppu/cell_context.c
index 68543ecf30..5534d82ccf 100644
--- a/src/mesa/pipe/cell/ppu/cell_context.c
+++ b/src/mesa/pipe/cell/ppu/cell_context.c
@@ -217,7 +217,6 @@ cell_create_context(struct pipe_winsys *winsys, struct cell_winsys *cws)
cell->pipe.set_framebuffer_state = cell_set_framebuffer_state;
cell->pipe.set_polygon_stipple = cell_set_polygon_stipple;
- cell->pipe.set_sampler_units = cell_set_sampler_units;
cell->pipe.set_scissor_state = cell_set_scissor_state;
cell->pipe.set_texture_state = cell_set_texture_state;
cell->pipe.set_viewport_state = cell_set_viewport_state;
diff --git a/src/mesa/pipe/cell/ppu/cell_context.h b/src/mesa/pipe/cell/ppu/cell_context.h
index a64692081d..12073b93a0 100644
--- a/src/mesa/pipe/cell/ppu/cell_context.h
+++ b/src/mesa/pipe/cell/ppu/cell_context.h
@@ -58,7 +58,6 @@ struct cell_context
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX];
- uint sampler_units[PIPE_MAX_SAMPLERS];
uint dirty;
/** The primitive drawing context */
diff --git a/src/mesa/pipe/cell/ppu/cell_state.h b/src/mesa/pipe/cell/ppu/cell_state.h
index 033767d29b..4bad45950b 100644
--- a/src/mesa/pipe/cell/ppu/cell_state.h
+++ b/src/mesa/pipe/cell/ppu/cell_state.h
@@ -93,9 +93,6 @@ void cell_set_constant_buffer(struct pipe_context *pipe,
void cell_set_polygon_stipple( struct pipe_context *,
const struct pipe_poly_stipple * );
-void cell_set_sampler_units( struct pipe_context *,
- uint numSamplers, const uint *units );
-
void cell_set_scissor_state( struct pipe_context *,
const struct pipe_scissor_state * );
diff --git a/src/mesa/pipe/cell/ppu/cell_state_sampler.c b/src/mesa/pipe/cell/ppu/cell_state_sampler.c
index c2a180ed30..495567b16c 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_sampler.c
+++ b/src/mesa/pipe/cell/ppu/cell_state_sampler.c
@@ -69,32 +69,22 @@ cell_delete_sampler_state(struct pipe_context *pipe,
void
-cell_set_texture_state(struct pipe_context *pipe,
- unsigned unit,
- struct pipe_texture *texture)
+cell_set_sampler_texture(struct pipe_context *pipe,
+ unsigned sampler,
+ struct pipe_texture *texture)
{
struct cell_context *cell = cell_context(pipe);
assert(unit < PIPE_MAX_SAMPLERS);
#if 0
- cell->texture[unit] = cell_texture(texture); /* ptr, not struct */
- cell_tile_cache_set_texture(cell->tex_cache[unit], texture);
+ cell->texture[sampler] = cell_texture(texture); /* ptr, not struct */
+ cell_tile_cache_set_texture(cell->tex_cache[sampler], texture);
#endif
cell->dirty |= CELL_NEW_TEXTURE;
}
-void
-cell_set_sampler_units(struct pipe_context *pipe,
- uint num_samplers, const uint *units )
-{
- struct cell_context *cell = cell_context(pipe);
- uint i;
- for (i = 0; i < num_samplers; i++)
- cell->sampler_units[i] = units[i];
- cell->dirty |= CELL_NEW_SAMPLER;
-}
diff --git a/src/mesa/pipe/failover/fo_context.h b/src/mesa/pipe/failover/fo_context.h
index 2423eb4556..f5eaa0b5fa 100644
--- a/src/mesa/pipe/failover/fo_context.h
+++ b/src/mesa/pipe/failover/fo_context.h
@@ -83,7 +83,6 @@ struct failover_context {
struct pipe_framebuffer_state framebuffer;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
- uint sampler_units[PIPE_MAX_SAMPLERS];
struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
diff --git a/src/mesa/pipe/failover/fo_state.c b/src/mesa/pipe/failover/fo_state.c
index 689d2fa3c7..6b4f1517ac 100644
--- a/src/mesa/pipe/failover/fo_state.c
+++ b/src/mesa/pipe/failover/fo_state.c
@@ -284,18 +284,6 @@ failover_set_polygon_stipple( struct pipe_context *pipe,
failover->hw->set_polygon_stipple( failover->hw, stipple );
}
-static void
-failover_set_sampler_units( struct pipe_context *pipe,
- uint num_samplers, const uint *units )
-{
- struct failover_context *failover = failover_context(pipe);
- uint i;
-
- for (i = 0; i < num_samplers; i++)
- failover->sampler_units[i] = units[i];
- failover->dirty |= FO_NEW_SAMPLER;
- failover->hw->set_sampler_units(failover->hw, num_samplers, units);
-}
static void *
failover_create_rasterizer_state(struct pipe_context *pipe,
@@ -390,16 +378,16 @@ failover_delete_sampler_state(struct pipe_context *pipe, void *sampler)
static void
-failover_set_texture_state(struct pipe_context *pipe,
- unsigned unit,
- struct pipe_texture *texture)
+failover_set_sampler_texture(struct pipe_context *pipe,
+ unsigned unit,
+ struct pipe_texture *texture)
{
struct failover_context *failover = failover_context(pipe);
failover->texture[unit] = texture;
failover->dirty |= FO_NEW_TEXTURE;
failover->dirty_texture |= (1<<unit);
- failover->hw->set_texture_state( failover->hw, unit, texture );
+ failover->hw->set_sampler_texture( failover->hw, unit, texture );
}
@@ -472,9 +460,8 @@ failover_init_state_functions( struct failover_context *failover )
failover->pipe.set_clip_state = failover_set_clip_state;
failover->pipe.set_framebuffer_state = failover_set_framebuffer_state;
failover->pipe.set_polygon_stipple = failover_set_polygon_stipple;
- failover->pipe.set_sampler_units = failover_set_sampler_units;
failover->pipe.set_scissor_state = failover_set_scissor_state;
- failover->pipe.set_texture_state = failover_set_texture_state;
+ failover->pipe.set_sampler_texture = failover_set_sampler_texture;
failover->pipe.set_viewport_state = failover_set_viewport_state;
failover->pipe.set_vertex_buffer = failover_set_vertex_buffer;
failover->pipe.set_vertex_element = failover_set_vertex_element;
diff --git a/src/mesa/pipe/failover/fo_state_emit.c b/src/mesa/pipe/failover/fo_state_emit.c
index 612b0a6ca3..c99ecd4f8d 100644
--- a/src/mesa/pipe/failover/fo_state_emit.c
+++ b/src/mesa/pipe/failover/fo_state_emit.c
@@ -109,7 +109,7 @@ failover_state_emit( struct failover_context *failover )
if (failover->dirty & FO_NEW_TEXTURE) {
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
if (failover->dirty_texture & (1<<i)) {
- failover->sw->set_texture_state( failover->sw, i,
+ failover->sw->set_sampler_texture( failover->sw, i,
failover->texture[i] );
}
}
diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h
index a239c8f72e..80df7f0fba 100644
--- a/src/mesa/pipe/i915simple/i915_context.h
+++ b/src/mesa/pipe/i915simple/i915_context.h
@@ -199,7 +199,6 @@ struct i915_context
struct pipe_framebuffer_state framebuffer;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
- uint sampler_units[PIPE_MAX_SAMPLERS];
struct i915_texture *texture[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index a8c6565a54..2a9a587a37 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -431,14 +431,6 @@ static void i915_set_polygon_stipple( struct pipe_context *pipe,
{
}
-static void i915_set_sampler_units(struct pipe_context *pipe,
- uint numSamplers, const uint *units)
-{
- struct i915_context *i915 = i915_context(pipe);
- uint i;
- for (i = 0; i < numSamplers; i++)
- i915->sampler_units[i] = units[i];
-}
static void * i915_create_fs_state(struct pipe_context *pipe,
const struct pipe_shader_state *templ)
@@ -523,13 +515,13 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
}
-static void i915_set_texture_state(struct pipe_context *pipe,
- unsigned unit,
- struct pipe_texture *texture)
+static void i915_set_sampler_texture(struct pipe_context *pipe,
+ unsigned sampler,
+ struct pipe_texture *texture)
{
struct i915_context *i915 = i915_context(pipe);
- i915->texture[unit] = (struct i915_texture*)texture; /* ptr, not struct */
+ i915->texture[sampler] = (struct i915_texture*)texture; /* ptr, not struct */
i915->dirty |= I915_NEW_TEXTURE;
}
@@ -714,9 +706,8 @@ i915_init_state_functions( struct i915_context *i915 )
i915->pipe.set_framebuffer_state = i915_set_framebuffer_state;
i915->pipe.set_polygon_stipple = i915_set_polygon_stipple;
- i915->pipe.set_sampler_units = i915_set_sampler_units;
i915->pipe.set_scissor_state = i915_set_scissor_state;
- i915->pipe.set_texture_state = i915_set_texture_state;
+ i915->pipe.set_sampler_texture = i915_set_sampler_texture;
i915->pipe.set_viewport_state = i915_set_viewport_state;
i915->pipe.set_vertex_buffer = i915_set_vertex_buffer;
i915->pipe.set_vertex_element = i915_set_vertex_element;
diff --git a/src/mesa/pipe/i965simple/brw_state.c b/src/mesa/pipe/i965simple/brw_state.c
index 7731c2e01f..ff4ae7999b 100644
--- a/src/mesa/pipe/i965simple/brw_state.c
+++ b/src/mesa/pipe/i965simple/brw_state.c
@@ -110,11 +110,6 @@ static void brw_delete_sampler_state(struct pipe_context *pipe,
}
-static void brw_set_sampler_units(struct pipe_context *pipe,
- uint numSamplers, const uint *units)
-{
-}
-
/************************************************************************
* Depth stencil
*/
@@ -349,7 +344,7 @@ static void brw_set_constant_buffer(struct pipe_context *pipe,
*/
-static void brw_set_texture_state(struct pipe_context *pipe,
+static void brw_set_sampler_texture(struct pipe_context *pipe,
unsigned unit,
struct pipe_texture *texture)
{
@@ -448,9 +443,8 @@ brw_init_state_functions( struct brw_context *brw )
// brw->pipe.set_feedback_buffer = brw_set_feedback_buffer;
brw->pipe.set_polygon_stipple = brw_set_polygon_stipple;
- brw->pipe.set_sampler_units = brw_set_sampler_units;
brw->pipe.set_scissor_state = brw_set_scissor_state;
- brw->pipe.set_texture_state = brw_set_texture_state;
+ brw->pipe.set_sampler_texture = brw_set_sampler_texture;
brw->pipe.set_viewport_state = brw_set_viewport_state;
brw->pipe.set_vertex_buffer = brw_set_vertex_buffer;
brw->pipe.set_vertex_element = brw_set_vertex_element;
diff --git a/src/mesa/pipe/llvm/gallivm.cpp b/src/mesa/pipe/llvm/gallivm.cpp
index bd8bfac208..a60440022a 100644
--- a/src/mesa/pipe/llvm/gallivm.cpp
+++ b/src/mesa/pipe/llvm/gallivm.cpp
@@ -927,23 +927,21 @@ typedef int (*fragment_shader_runner)(float x, float y,
float (*inputs)[16][4],
int num_attribs,
float (*consts)[4], int num_consts,
- struct tgsi_sampler *samplers,
- unsigned *sampler_units);
+ struct tgsi_sampler *samplers);
int gallivm_fragment_shader_exec(struct gallivm_prog *prog,
float fx, float fy,
float (*dests)[16][4],
float (*inputs)[16][4],
float (*consts)[4],
- struct tgsi_sampler *samplers,
- unsigned *sampler_units)
+ struct tgsi_sampler *samplers)
{
fragment_shader_runner runner = reinterpret_cast<fragment_shader_runner>(prog->function);
assert(runner);
runner(fx, fy, dests, inputs, prog->num_interp,
consts, prog->num_consts,
- samplers, sampler_units);
+ samplers);
return 0;
}
diff --git a/src/mesa/pipe/llvm/gallivm.h b/src/mesa/pipe/llvm/gallivm.h
index 6a05a55db4..fd9a11e5b6 100644
--- a/src/mesa/pipe/llvm/gallivm.h
+++ b/src/mesa/pipe/llvm/gallivm.h
@@ -67,8 +67,7 @@ int gallivm_fragment_shader_exec(struct gallivm_prog *prog,
float (*dests)[PIPE_MAX_SHADER_INPUTS][4],
float (*inputs)[PIPE_MAX_SHADER_INPUTS][4],
float (*consts)[4],
- struct tgsi_sampler *samplers,
- unsigned *sampler_units);
+ struct tgsi_sampler *samplers);
void gallivm_prog_inputs_interpolate(struct gallivm_prog *prog,
float (*inputs)[PIPE_MAX_SHADER_INPUTS][4],
const struct tgsi_interp_coef *coefs);
diff --git a/src/mesa/pipe/llvm/llvm_base_shader.cpp b/src/mesa/pipe/llvm/llvm_base_shader.cpp
index f141ea2da0..a703ba3862 100644
--- a/src/mesa/pipe/llvm/llvm_base_shader.cpp
+++ b/src/mesa/pipe/llvm/llvm_base_shader.cpp
@@ -770,8 +770,6 @@ Module* createBaseShader() {
int32_num_consts_125->setName("num_consts");
Value* ptr_samplers = args++;
ptr_samplers->setName("samplers");
- Value* ptr_sampler_units = args++;
- ptr_sampler_units->setName("sampler_units");
BasicBlock* label_entry_126 = new BasicBlock("entry",func_run_fragment_shader,0);
BasicBlock* label_forbody6_i_127 = new BasicBlock("forbody6.i",func_run_fragment_shader,0);
diff --git a/src/mesa/pipe/llvm/llvm_entry.c b/src/mesa/pipe/llvm/llvm_entry.c
index fe32e7810d..cbe4965ef6 100644
--- a/src/mesa/pipe/llvm/llvm_entry.c
+++ b/src/mesa/pipe/llvm/llvm_entry.c
@@ -219,8 +219,7 @@ int run_fragment_shader(float x, float y,
int num_inputs,
float (*aconsts)[4],
int num_consts,
- struct tgsi_sampler *samplers,
- unsigned *sampler_units)
+ struct tgsi_sampler *samplers)
{
float4 inputs[4][16];
float4 consts[32];
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index 6b97844445..83b4ab07fb 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -142,15 +142,15 @@ struct pipe_context {
void (*set_polygon_stipple)( struct pipe_context *,
const struct pipe_poly_stipple * );
- void (*set_sampler_units)( struct pipe_context *,
- uint num_samplers, const uint *units );
-
void (*set_scissor_state)( struct pipe_context *,
const struct pipe_scissor_state * );
- void (*set_texture_state)( struct pipe_context *,
- unsigned unit,
- struct pipe_texture * );
+
+ /* Currently a sampler is constrained to sample from a single texture:
+ */
+ void (*set_sampler_texture)( struct pipe_context *,
+ unsigned sampler,
+ struct pipe_texture * );
void (*set_viewport_state)( struct pipe_context *,
const struct pipe_viewport_state * );
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index 43f23dc1e8..7d243aaabb 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -307,9 +307,8 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
softpipe->pipe.set_constant_buffer = softpipe_set_constant_buffer;
softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
- softpipe->pipe.set_sampler_units = softpipe_set_sampler_units;
softpipe->pipe.set_scissor_state = softpipe_set_scissor_state;
- softpipe->pipe.set_texture_state = softpipe_set_texture_state;
+ softpipe->pipe.set_sampler_texture = softpipe_set_sampler_texture;
softpipe->pipe.set_viewport_state = softpipe_set_viewport_state;
softpipe->pipe.set_vertex_buffer = softpipe_set_vertex_buffer;
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index 45d15c720e..afdd0ec88e 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -91,7 +91,6 @@ struct softpipe_context {
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX];
- uint sampler_units[PIPE_MAX_SAMPLERS];
unsigned dirty;
/*
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index 75576a9bde..9307ed233d 100644
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -98,7 +98,6 @@ shade_quad(
/* Consts does not require 16 byte alignment. */
machine->Consts = softpipe->mapped_constants[PIPE_SHADER_FRAGMENT];
- machine->SamplerUnits = softpipe->sampler_units;
machine->InterpCoefs = quad->coef;
machine->Inputs[0].xyzw[0].f[0] = fx;
@@ -206,7 +205,7 @@ shade_quad_llvm(struct quad_stage *qs,
/*quad->mask &=*/
gallivm_fragment_shader_exec(llvm, fx, fy, dests, inputs,
softpipe->mapped_constants[PIPE_SHADER_FRAGMENT],
- qss->samplers, softpipe->sampler_units);
+ qss->samplers);
#if DLLVM
printf("OUT LLVM = 1[%f %f %f %f], 2[%f %f %f %f]\n",
dests[0][0][0], dests[0][0][1], dests[0][0][2], dests[0][0][3],
diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h
index 80a1cba25a..a3bd078a71 100644
--- a/src/mesa/pipe/softpipe/sp_state.h
+++ b/src/mesa/pipe/softpipe/sp_state.h
@@ -111,13 +111,10 @@ void softpipe_delete_vs_state(struct pipe_context *, void *);
void softpipe_set_polygon_stipple( struct pipe_context *,
const struct pipe_poly_stipple * );
-void softpipe_set_sampler_units( struct pipe_context *,
- uint numSamplers, const uint *units );
-
void softpipe_set_scissor_state( struct pipe_context *,
const struct pipe_scissor_state * );
-void softpipe_set_texture_state( struct pipe_context *,
+void softpipe_set_sampler_texture( struct pipe_context *,
unsigned unit,
struct pipe_texture * );
diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/mesa/pipe/softpipe/sp_state_sampler.c
index 173901f04e..3842e71503 100644
--- a/src/mesa/pipe/softpipe/sp_state_sampler.c
+++ b/src/mesa/pipe/softpipe/sp_state_sampler.c
@@ -67,9 +67,9 @@ softpipe_delete_sampler_state(struct pipe_context *pipe,
void
-softpipe_set_texture_state(struct pipe_context *pipe,
- unsigned unit,
- struct pipe_texture *texture)
+softpipe_set_sampler_texture(struct pipe_context *pipe,
+ unsigned unit,
+ struct pipe_texture *texture)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
@@ -82,15 +82,4 @@ softpipe_set_texture_state(struct pipe_context *pipe,
}
-void
-softpipe_set_sampler_units(struct pipe_context *pipe,
- uint num_samplers, const uint *units )
-{
- struct softpipe_context *softpipe = softpipe_context(pipe);
- uint i;
- for (i = 0; i < num_samplers; i++)
- softpipe->sampler_units[i] = units[i];
- softpipe->dirty |= SP_NEW_SAMPLER;
-}
-
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
index ab83f27c1b..8636271a34 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
@@ -1217,8 +1217,7 @@ exec_tex(struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst,
boolean biasLod)
{
- const uint sampler = inst->FullSrcRegisters[1].SrcRegister.Index;
- const uint unit = mach->SamplerUnits[sampler];
+ const uint unit = inst->FullSrcRegisters[1].SrcRegister.Index;
union tgsi_exec_channel r[8];
uint chan_index;
float lodBias;
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.h b/src/mesa/pipe/tgsi/exec/tgsi_exec.h
index 2c62b30f15..e7952a08e3 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.h
+++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.h
@@ -162,7 +162,6 @@ struct tgsi_exec_machine
struct tgsi_exec_vector *Temps;
struct tgsi_exec_vector *Addrs;
- uint *SamplerUnits;
struct tgsi_sampler *Samplers;
float Imms[TGSI_EXEC_NUM_IMMEDIATES][4];
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 67a9159069..052b6dd144 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -172,26 +172,13 @@ update_samplers(struct st_context *st)
st->pipe->bind_sampler_state(st->pipe, u, cso->data);
}
}
-
-
- /* mapping from sampler vars to texture units */
- {
- struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
- uint sample_units[PIPE_MAX_SAMPLERS];
- uint s;
- for (s = 0; s < PIPE_MAX_SAMPLERS; s++) {
- sample_units[s] = fprog->Base.SamplerUnits[s];
- }
-
- st->pipe->set_sampler_units(st->pipe, PIPE_MAX_SAMPLERS, sample_units);
- }
}
const struct st_tracked_state st_update_sampler = {
.name = "st_update_sampler",
.dirty = {
- .mesa = _NEW_TEXTURE | _NEW_PROGRAM,
+ .mesa = _NEW_TEXTURE,
.st = 0,
},
.update = update_samplers
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index c4e5af02d5..fb21d29c40 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -46,20 +46,24 @@
static void
update_textures(struct st_context *st)
{
- GLuint u;
+ GLuint s;
- for (u = 0; u < st->ctx->Const.MaxTextureImageUnits; u++) {
+ /* ST_NEW_FRAGMENT_PROGRAM
+ */
+ struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
+
+ for (s = 0; s < st->ctx->Const.MaxTextureCoordUnits; s++) {
+ GLuint su = fprog->Base.SamplerUnits[s];
+
struct gl_texture_object *texObj
- = st->ctx->Texture.Unit[u]._Current;
+ = st->ctx->Texture.Unit[su]._Current;
+
struct pipe_texture *pt;
+
if (texObj) {
GLboolean flush, retval;
- retval = st_finalize_texture(st->ctx, st->pipe, u, &flush);
-#if 0
- printf("finalize_texture returned %d, flush = %d\n",
- retval, flush);
-#endif
+ retval = st_finalize_texture(st->ctx, st->pipe, texObj, &flush);
pt = st_get_texobj_texture(texObj);
}
@@ -67,8 +71,14 @@ update_textures(struct st_context *st)
pt = NULL;
}
- st->state.texture[u] = pt;
- st->pipe->set_texture_state(st->pipe, u, pt);
+ /* XXX: need to ensure that textures are unbound/removed from
+ * this table before being deleted, otherwise the pointer
+ * comparison below could fail.
+ */
+ if (st->state.sampler_texture[s] != pt) {
+ st->state.sampler_texture[s] = pt;
+ st->pipe->set_sampler_texture(st->pipe, s, pt);
+ }
}
}
@@ -77,7 +87,7 @@ const struct st_tracked_state st_update_texture = {
.name = "st_update_texture",
.dirty = {
.mesa = _NEW_TEXTURE,
- .st = 0,
+ .st = ST_NEW_FRAGMENT_PROGRAM,
},
.update = update_textures
};
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 0179000353..5d4c443c01 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -697,7 +697,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
/* texture state: */
{
- pipe->set_texture_state(pipe, unit, pt);
+ pipe->set_sampler_texture(pipe, unit, pt);
}
/* Compute window coords (y=0=bottom) with pixel zoom.
@@ -719,7 +719,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
pipe->bind_rasterizer_state(pipe, ctx->st->state.rasterizer->data);
pipe->bind_fs_state(pipe, ctx->st->state.fs->data);
pipe->bind_vs_state(pipe, ctx->st->state.vs->data);
- pipe->set_texture_state(pipe, unit, ctx->st->state.texture[unit]);
+ pipe->set_sampler_texture(pipe, unit, ctx->st->state.sampler_texture[unit]);
pipe->bind_sampler_state(pipe, unit, ctx->st->state.sampler[unit]->data);
pipe->set_viewport_state(pipe, &ctx->st->state.viewport);
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 2c93a2f3dd..39dd21dc59 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1412,10 +1412,10 @@ copy_image_data_to_texture(struct st_context *st,
*/
GLboolean
st_finalize_texture(GLcontext *ctx,
- struct pipe_context *pipe, GLuint unit,
+ struct pipe_context *pipe,
+ struct gl_texture_object *tObj,
GLboolean *needFlush)
{
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
struct st_texture_object *stObj = st_texture_object(tObj);
int comp_byte = 0;
int cpp;
diff --git a/src/mesa/state_tracker/st_cb_texture.h b/src/mesa/state_tracker/st_cb_texture.h
index 7f8082b029..878256ec26 100644
--- a/src/mesa/state_tracker/st_cb_texture.h
+++ b/src/mesa/state_tracker/st_cb_texture.h
@@ -8,7 +8,8 @@ st_get_texobj_texture(struct gl_texture_object *texObj);
extern GLboolean
st_finalize_texture(GLcontext *ctx,
- struct pipe_context *pipe, GLuint unit,
+ struct pipe_context *pipe,
+ struct gl_texture_object *tObj,
GLboolean *needFlush);
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 4855961d09..87646b3c71 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -106,7 +106,7 @@ struct st_context
struct pipe_clip_state clip;
struct pipe_constant_buffer constants[2];
struct pipe_framebuffer_state framebuffer;
- struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
+ struct pipe_texture *sampler_texture[PIPE_MAX_SAMPLERS];
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_viewport_state viewport;