r300g: refuse to create too large textures

This commit is contained in:
Marek Olšák 2012-12-01 22:40:00 +01:00
parent e694ea09f5
commit 8ad9d42b33
1 changed files with 15 additions and 0 deletions

View File

@ -980,6 +980,21 @@ r300_texture_create_object(struct r300_screen *rscreen,
r300_texture_desc_init(rscreen, tex, base);
/* Figure out the ideal placement for the texture.. */
if (tex->domain & RADEON_DOMAIN_VRAM &&
tex->tex.size_in_bytes >= rscreen->info.vram_size) {
tex->domain &= ~RADEON_DOMAIN_VRAM;
tex->domain |= RADEON_DOMAIN_GTT;
}
if (tex->domain & RADEON_DOMAIN_GTT &&
tex->tex.size_in_bytes >= rscreen->info.gart_size) {
tex->domain &= ~RADEON_DOMAIN_GTT;
}
/* Just fail if the texture is too large. */
if (!tex->domain) {
goto fail;
}
/* Create the backing buffer if needed. */
if (!tex->buf) {
tex->buf = rws->buffer_create(rws, tex->tex.size_in_bytes, 2048,