r300->blitter, state->sampler_count, (void**)state->sampler_states);
util_blitter_save_fragment_sampler_views(
- r300->blitter, r300->fragment_sampler_view_count,
- r300->fragment_sampler_views);
+ r300->blitter, state->texture_count,
+ state->fragment_sampler_views);
/* Do a copy */
util_blitter_copy(r300->blitter,
struct r300_textures_state {
/* Textures. */
- struct r300_texture *textures[8];
+ struct pipe_sampler_view *fragment_sampler_views[8];
int texture_count;
/* Sampler states. */
struct r300_sampler_state *sampler_states[8];
struct r300_atom rs_block_state;
/* Scissor state. */
struct r300_atom scissor_state;
- /* Sampler view states. */
- struct pipe_sampler_view* fragment_sampler_views[8];
- int fragment_sampler_view_count;
+ /* Textures state. */
+ struct r300_atom textures_state;
/* Vertex stream formatting state. */
struct r300_atom vertex_stream_state;
/* VAP (vertex shader) output mapping state. */
/* Factor for converting rectangle coords to
* normalized coords. Should only show up on non-r500. */
case RC_STATE_R300_TEXRECT_FACTOR:
- tex = r300->fragment_sampler_views[constant->u.State[1]]->texture;
+ tex = texstate->fragment_sampler_views[constant->u.State[1]]->texture;
vec[0] = 1.0 / tex->width0;
vec[1] = 1.0 / tex->height0;
break;
OUT_CS_REG(R300_TX_FORMAT2_0 + (i * 4), texstate->format[2]);
OUT_CS_REG_SEQ(R300_TX_OFFSET_0 + (i * 4), 1);
- OUT_CS_TEX_RELOC(allstate->textures[i], texstate->tile_config,
- RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0, 0);
+ OUT_CS_TEX_RELOC((struct r300_texture *)allstate->fragment_sampler_views[i]->texture,
+ texstate->tile_config,
+ RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0, 0);
}
}
END_CS;
}
}
/* ...textures... */
- for (i = 0; i < r300->fragment_sampler_view_count; i++) {
- if (!r300->fragment_sampler_views[i])
+ for (i = 0; i < texstate->count; i++) {
+ tex = (struct r300_texture*)texstate->fragment_sampler_views[i]->texture;
+ if (!tex || !texstate->sampler_states[i])
continue;
- tex = (struct r300_texture *)r300->fragment_sampler_views[i]->texture;
if (!r300_add_texture(r300->rws, tex,
RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
r300->context.flush(&r300->context, 0, NULL);
struct pipe_sampler_view** views)
{
struct r300_context* r300 = r300_context(pipe);
+ struct r300_textures_state* state =
+ (struct r300_textures_state*)r300->textures_state.state;
unsigned i;
boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
boolean dirty_tex = FALSE;
}
for (i = 0; i < count; i++) {
- if (r300->fragment_sampler_views[i] != views[i]) {
+ if (state->fragment_sampler_views[i] != views[i]) {
struct r300_texture *texture;
-
- pipe_sampler_view_reference(&r300->fragment_sampler_views[i],
- views[i]);
+
+ pipe_sampler_view_reference(&state->fragment_sampler_views[i],
+ views[i]);
dirty_tex = TRUE;
texture = (struct r300_texture *)views[i]->texture;
- /* R300-specific - set the texrect factor in a fragment shader */
+ /* R300-specific - set the texrect factor in the fragment shader */
if (!is_r500 && texture->is_npot) {
/* XXX It would be nice to re-emit just 1 constant,
* XXX not all of them */
}
for (i = count; i < 8; i++) {
- if (r300->fragment_sampler_views[i]) {
- pipe_sampler_view_reference(&r300->fragment_sampler_views[i],
- NULL);
+ if (state->fragment_sampler_views[i]) {
+ pipe_sampler_view_reference(&state->fragment_sampler_views[i],
+ NULL);
}
}
- r300->fragment_sampler_view_count = count;
+ state->texture_count = count;
r300->textures_state.dirty = TRUE;
struct pipe_texture *texture,
const struct pipe_sampler_view *templ)
{
- struct r300_context *r300 = r300_context(pipe);
struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
if (view) {
size = 2;
for (i = 0; i < count; i++) {
- if (state->textures[i] && state->sampler_states[i]) {
+ if (state->fragment_sampler_views[i] && state->sampler_states[i]) {
state->tx_enable |= 1 << i;
- tex = state->textures[i];
+ tex = (struct r300_texture *)state->fragment_sampler_views[i]->texture;
sampler = state->sampler_states[i];
texstate = &state->regs[i];