i915g: Add support for blitting compressed textures.

Previously we would assertion fail on s3tc uploads.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12367>
This commit is contained in:
Emma Anholt
2021-08-13 16:57:15 -07:00
committed by Marge Bot
parent 5a088aead5
commit f46850d3b3
2 changed files with 23 additions and 18 deletions
@@ -258,7 +258,6 @@ spec@arb_point_parameters@arb_point_parameters-point-attenuation@Aliased combina
spec@arb_provoking_vertex@arb-provoking-vertex-render,Fail
spec@arb_sampler_objects@gl_ext_texture_srgb_decode,Fail
spec@arb_shader_texture_lod@execution@glsl-fs-texturelod-01,Fail
spec@arb_texture_compression@fbo-generatemipmap-formats,Crash
spec@arb_texture_compression@texwrap formats bordercolor,Fail
spec@arb_texture_compression@texwrap formats bordercolor@GL_COMPRESSED_ALPHA- border color only,Fail
spec@arb_texture_compression@texwrap formats bordercolor@GL_COMPRESSED_INTENSITY- border color only,Fail
@@ -429,15 +428,9 @@ spec@ext_packed_depth_stencil@fbo-depthstencil-gl_depth24_stencil8-clear,Fail
spec@ext_packed_depth_stencil@fbo-stencil-gl_depth24_stencil8-blit,Fail
spec@ext_packed_depth_stencil@texwrap formats bordercolor,Fail
spec@ext_packed_depth_stencil@texwrap formats bordercolor@GL_DEPTH24_STENCIL8- border color only,Fail
spec@ext_texture_compression_s3tc@compressedteximage gl_compressed_rgb_s3tc_dxt1_ext,Crash
spec@ext_texture_compression_s3tc@compressedteximage gl_compressed_rgba_s3tc_dxt1_ext,Crash
spec@ext_texture_compression_s3tc@compressedteximage gl_compressed_rgba_s3tc_dxt3_ext,Crash
spec@ext_texture_compression_s3tc@compressedteximage gl_compressed_rgba_s3tc_dxt5_ext,Crash
spec@ext_texture_compression_s3tc@compressedteximage gl_compressed_srgb_alpha_s3tc_dxt1_ext,Crash
spec@ext_texture_compression_s3tc@compressedteximage gl_compressed_srgb_alpha_s3tc_dxt3_ext,Fail
spec@ext_texture_compression_s3tc@compressedteximage gl_compressed_srgb_alpha_s3tc_dxt5_ext,Crash
spec@ext_texture_compression_s3tc@compressedteximage gl_compressed_srgb_s3tc_dxt1_ext,Fail
spec@ext_texture_compression_s3tc@fbo-generatemipmap-formats,Crash
spec@ext_texture_compression_s3tc@s3tc-targeted,Fail
spec@ext_texture_compression_s3tc@texwrap formats bordercolor,Fail
spec@ext_texture_compression_s3tc@texwrap formats bordercolor@GL_COMPRESSED_RGBA_S3TC_DXT1_EXT- border color only,Fail
+23 -11
View File
@@ -221,20 +221,32 @@ i915_surface_copy_blitter(struct pipe_context *pipe, struct pipe_resource *dst,
assert(src_box->z == 0);
src_offset = i915_texture_offset(src_tex, src_level, src_box->z);
assert(util_format_get_blocksize(dpt->format) ==
util_format_get_blocksize(spt->format));
assert(util_format_get_blockwidth(dpt->format) ==
util_format_get_blockwidth(spt->format));
assert(util_format_get_blockheight(dpt->format) ==
util_format_get_blockheight(spt->format));
assert(util_format_get_blockwidth(dpt->format) == 1);
assert(util_format_get_blockheight(dpt->format) == 1);
int block_width = util_format_get_blockwidth(dpt->format);
int block_height = util_format_get_blockheight(dpt->format);
int block_size = util_format_get_blocksize(dpt->format);
assert(util_format_get_blocksize(spt->format) == block_size);
assert(util_format_get_blockwidth(spt->format) == block_width);
assert(util_format_get_blockheight(spt->format) == block_height);
i915_copy_blit(i915_context(pipe), util_format_get_blocksize(dpt->format),
dstx /= block_width;
dsty /= block_height;
int srcx = src_box->x / block_width;
int srcy = src_box->y / block_height;
int width = DIV_ROUND_UP(src_box->width, block_width);
int height = DIV_ROUND_UP(src_box->height, block_height);
if (block_size > 4) {
srcx *= (block_size / 4);
dstx *= (block_size / 4);
width *= (block_size / 4);
block_size = 4;
}
i915_copy_blit(i915_context(pipe), block_size,
(unsigned short)src_tex->stride, src_tex->buffer, src_offset,
(unsigned short)dst_tex->stride, dst_tex->buffer, dst_offset,
(short)src_box->x, (short)src_box->y, (short)dstx,
(short)dsty, (short)src_box->width, (short)src_box->height);
(short)srcx, (short)srcy, (short)dstx, (short)dsty,
(short)width, (short)height);
}
static void