r300g: fix breakage after the gallium-sampler-view merge
This commit is contained in:
parent
f6e987ce78
commit
afae089194
|
@ -1050,9 +1050,11 @@ validate:
|
|||
}
|
||||
/* ...textures... */
|
||||
for (i = 0; i < texstate->count; i++) {
|
||||
tex = (struct r300_texture*)texstate->fragment_sampler_views[i]->texture;
|
||||
if (!tex || !texstate->sampler_states[i])
|
||||
if (!(texstate->tx_enable & (1 << i))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
tex = (struct r300_texture*)texstate->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);
|
||||
|
|
|
@ -973,6 +973,7 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
|
|||
struct r300_context* r300 = r300_context(pipe);
|
||||
struct r300_textures_state* state =
|
||||
(struct r300_textures_state*)r300->textures_state.state;
|
||||
struct r300_texture *texture;
|
||||
unsigned i;
|
||||
boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
|
||||
boolean dirty_tex = FALSE;
|
||||
|
@ -984,15 +985,18 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
|
|||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (state->fragment_sampler_views[i] != views[i]) {
|
||||
struct r300_texture *texture;
|
||||
|
||||
pipe_sampler_view_reference(&state->fragment_sampler_views[i],
|
||||
views[i]);
|
||||
|
||||
if (!views[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* A new sampler view (= texture)... */
|
||||
dirty_tex = TRUE;
|
||||
|
||||
texture = (struct r300_texture *)views[i]->texture;
|
||||
|
||||
/* R300-specific - set the texrect factor in the fragment shader */
|
||||
texture = (struct r300_texture *)views[i]->texture;
|
||||
if (!is_r500 && texture->is_npot) {
|
||||
/* XXX It would be nice to re-emit just 1 constant,
|
||||
* XXX not all of them */
|
||||
|
|
|
@ -335,20 +335,25 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
|
|||
(struct r300_textures_state*)r300->textures_state.state;
|
||||
struct r300_texture_sampler_state *texstate;
|
||||
struct r300_sampler_state *sampler;
|
||||
struct pipe_sampler_view *view;
|
||||
struct r300_texture *tex;
|
||||
unsigned min_level, max_level, i, size;
|
||||
unsigned count = MIN2(state->texture_count, state->sampler_count);
|
||||
|
||||
state->tx_enable = 0;
|
||||
state->count = 0;
|
||||
size = 2;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (state->fragment_sampler_views[i] && state->sampler_states[i]) {
|
||||
state->tx_enable |= 1 << i;
|
||||
|
||||
tex = (struct r300_texture *)state->fragment_sampler_views[i]->texture;
|
||||
view = state->fragment_sampler_views[i];
|
||||
tex = (struct r300_texture *)view->texture;
|
||||
sampler = state->sampler_states[i];
|
||||
|
||||
assert(view->format == tex->tex.format);
|
||||
|
||||
texstate = &state->regs[i];
|
||||
memcpy(texstate->format, &tex->state, sizeof(uint32_t)*3);
|
||||
texstate->filter[0] = sampler->filter0;
|
||||
|
@ -370,8 +375,10 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
|
|||
} else {
|
||||
/* determine min/max levels */
|
||||
/* the MAX_MIP level is the largest (finest) one */
|
||||
max_level = MIN2(sampler->max_lod, tex->tex.last_level);
|
||||
min_level = MIN2(sampler->min_lod, max_level);
|
||||
max_level = MIN3(sampler->max_lod, tex->tex.last_level,
|
||||
view->last_level);
|
||||
min_level = MIN2(MAX2(sampler->min_lod, view->first_level),
|
||||
max_level);
|
||||
texstate->format[0] |= R300_TX_NUM_LEVELS(max_level);
|
||||
texstate->filter[0] |= R300_TX_MAX_MIP_LEVEL(min_level);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue