for (i = 0; i < fb->nr_cbufs; i++) {
tex = r300_texture(fb->cbufs[i]->texture);
assert(tex && tex->buffer && "cbuf is marked, but NULL!");
- if (!r300_add_texture(r300->rws, tex, 0, tex->domain)) {
+ if (!r300_add_texture(r300->rws, tex, 0,
+ r300_surface(fb->cbufs[i])->domain)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
if (fb->zsbuf) {
tex = r300_texture(fb->zsbuf->texture);
assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
- if (!r300_add_texture(r300->rws, tex,
- 0, tex->domain)) {
+ if (!r300_add_texture(r300->rws, tex, 0,
+ r300_surface(fb->zsbuf)->domain)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
tex->size,
util_format_short_name(base->format));
- tex->domain = base->flags & R300_RESOURCE_FLAG_TRANSFER ? R300_DOMAIN_GTT :
- R300_DOMAIN_VRAM;
+ tex->domain = base->flags & R300_RESOURCE_FLAG_TRANSFER ?
+ R300_DOMAIN_GTT :
+ R300_DOMAIN_VRAM | R300_DOMAIN_GTT;
tex->buffer = rws->buffer_create(rws, 2048, base->bind, tex->domain,
tex->size);
surface->base.level = level;
surface->buffer = tex->buffer;
+
+ /* Prefer VRAM if there are multiple domains to choose from. */
surface->domain = tex->domain;
+ if (surface->domain & R300_DOMAIN_VRAM)
+ surface->domain &= ~R300_DOMAIN_GTT;
+
surface->offset = r300_texture_get_offset(tex, level, zslice, face);
surface->pitch = tex->fb_state.pitch[level];
surface->format = tex->fb_state.format;