r600g: get s3tc working on cards with crappy 64/128 bit types.
Some cards don't appear to work correctly with the UNORM type, so switch to the integer type, however since gallium has no integer types yet from what I can see we need to do a hack to workaround it for the blitter. Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
5cc35124b3
commit
231bf886da
|
@ -385,6 +385,12 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte
|
||||||
r600_texture_depth_flush(ctx, texture, TRUE);
|
r600_texture_depth_flush(ctx, texture, TRUE);
|
||||||
tmp = tmp->flushed_depth_texture;
|
tmp = tmp->flushed_depth_texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tmp->force_int_type) {
|
||||||
|
word4 &= C_030010_NUM_FORMAT_ALL;
|
||||||
|
word4 |= S_030010_NUM_FORMAT_ALL(V_030010_SQ_NUM_FORMAT_INT);
|
||||||
|
}
|
||||||
|
|
||||||
rbuffer = &tmp->resource;
|
rbuffer = &tmp->resource;
|
||||||
bo[0] = rbuffer->bo;
|
bo[0] = rbuffer->bo;
|
||||||
bo[1] = rbuffer->bo;
|
bo[1] = rbuffer->bo;
|
||||||
|
@ -673,6 +679,11 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state
|
||||||
|
|
||||||
format = r600_translate_colorformat(surf->base.format);
|
format = r600_translate_colorformat(surf->base.format);
|
||||||
swap = r600_translate_colorswap(surf->base.format);
|
swap = r600_translate_colorswap(surf->base.format);
|
||||||
|
|
||||||
|
/* disable when gallium grows int textures */
|
||||||
|
if ((format == FMT_32_32_32_32 || format == FMT_16_16_16_16) && rtex->force_int_type)
|
||||||
|
ntype = 4;
|
||||||
|
|
||||||
color_info = S_028C70_FORMAT(format) |
|
color_info = S_028C70_FORMAT(format) |
|
||||||
S_028C70_COMP_SWAP(swap) |
|
S_028C70_COMP_SWAP(swap) |
|
||||||
S_028C70_ARRAY_MODE(rtex->array_mode[level]) |
|
S_028C70_ARRAY_MODE(rtex->array_mode[level]) |
|
||||||
|
|
|
@ -229,6 +229,7 @@ static void r600_s3tc_to_blittable(struct pipe_resource *tex,
|
||||||
unsigned level,
|
unsigned level,
|
||||||
struct texture_orig_info *orig)
|
struct texture_orig_info *orig)
|
||||||
{
|
{
|
||||||
|
struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
|
||||||
unsigned pixsize = util_format_get_blocksize(tex->format);
|
unsigned pixsize = util_format_get_blocksize(tex->format);
|
||||||
int new_format;
|
int new_format;
|
||||||
int new_height, new_width;
|
int new_height, new_width;
|
||||||
|
@ -245,6 +246,7 @@ static void r600_s3tc_to_blittable(struct pipe_resource *tex,
|
||||||
new_width = util_format_get_nblocksx(tex->format, orig->width0);
|
new_width = util_format_get_nblocksx(tex->format, orig->width0);
|
||||||
new_height = util_format_get_nblocksy(tex->format, orig->height0);
|
new_height = util_format_get_nblocksy(tex->format, orig->height0);
|
||||||
|
|
||||||
|
rtex->force_int_type = true;
|
||||||
tex->width0 = new_width;
|
tex->width0 = new_width;
|
||||||
tex->height0 = new_height;
|
tex->height0 = new_height;
|
||||||
tex->format = new_format;
|
tex->format = new_format;
|
||||||
|
@ -255,6 +257,9 @@ static void r600_reset_blittable_to_s3tc(struct pipe_resource *tex,
|
||||||
unsigned level,
|
unsigned level,
|
||||||
struct texture_orig_info *orig)
|
struct texture_orig_info *orig)
|
||||||
{
|
{
|
||||||
|
struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
|
||||||
|
rtex->force_int_type = false;
|
||||||
|
|
||||||
tex->format = orig->format;
|
tex->format = orig->format;
|
||||||
tex->width0 = orig->width0;
|
tex->width0 = orig->width0;
|
||||||
tex->height0 = orig->height0;
|
tex->height0 = orig->height0;
|
||||||
|
|
|
@ -64,6 +64,10 @@ struct r600_resource_texture {
|
||||||
unsigned dirty_db;
|
unsigned dirty_db;
|
||||||
struct r600_resource_texture *flushed_depth_texture;
|
struct r600_resource_texture *flushed_depth_texture;
|
||||||
boolean is_flushing_texture;
|
boolean is_flushing_texture;
|
||||||
|
|
||||||
|
/* on some cards we have to use integer 64/128-bit types
|
||||||
|
for s3tc blits, do this until gallium grows int formats */
|
||||||
|
boolean force_int_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define R600_TEX_IS_TILED(tex, level) ((tex)->array_mode[level] != V_038000_ARRAY_LINEAR_GENERAL && (tex)->array_mode[level] != V_038000_ARRAY_LINEAR_ALIGNED)
|
#define R600_TEX_IS_TILED(tex, level) ((tex)->array_mode[level] != V_038000_ARRAY_LINEAR_GENERAL && (tex)->array_mode[level] != V_038000_ARRAY_LINEAR_ALIGNED)
|
||||||
|
|
|
@ -434,6 +434,11 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c
|
||||||
r600_texture_depth_flush(ctx, texture, TRUE);
|
r600_texture_depth_flush(ctx, texture, TRUE);
|
||||||
tmp = tmp->flushed_depth_texture;
|
tmp = tmp->flushed_depth_texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tmp->force_int_type) {
|
||||||
|
word4 &= C_038010_NUM_FORMAT_ALL;
|
||||||
|
word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT);
|
||||||
|
}
|
||||||
rbuffer = &tmp->resource;
|
rbuffer = &tmp->resource;
|
||||||
bo[0] = rbuffer->bo;
|
bo[0] = rbuffer->bo;
|
||||||
bo[1] = rbuffer->bo;
|
bo[1] = rbuffer->bo;
|
||||||
|
@ -724,6 +729,11 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta
|
||||||
|
|
||||||
format = r600_translate_colorformat(surf->base.format);
|
format = r600_translate_colorformat(surf->base.format);
|
||||||
swap = r600_translate_colorswap(surf->base.format);
|
swap = r600_translate_colorswap(surf->base.format);
|
||||||
|
|
||||||
|
/* disable when gallium grows int textures */
|
||||||
|
if ((format == FMT_32_32_32_32 || format == FMT_16_16_16_16) && rtex->force_int_type)
|
||||||
|
ntype = 4;
|
||||||
|
|
||||||
color_info = S_0280A0_FORMAT(format) |
|
color_info = S_0280A0_FORMAT(format) |
|
||||||
S_0280A0_COMP_SWAP(swap) |
|
S_0280A0_COMP_SWAP(swap) |
|
||||||
S_0280A0_ARRAY_MODE(rtex->array_mode[level]) |
|
S_0280A0_ARRAY_MODE(rtex->array_mode[level]) |
|
||||||
|
|
Loading…
Reference in New Issue