Intel Gen7 GPUs don't support the ETC2 formats natively and in order to show the pixels properly we decompress them and create decompressed miptrees. The problem with that is that the functions that map the miptrees for reading (for example the GetCompressed* calls), and would be supposed to read compressed pixel values, would read decompressed values instead unless if we prevented this with assertions that make the user programs either crash or misfunction.
These patches are an attempt to give a solution to this problem by using 2 miptrees: the main to store the ETC values and the generic shadow (mt->shadow) to store the decompressed values. Each time that the main miptree is mapped for writing we set a flag that the shadow will need update and we check this flag before every draw call to update the shadow miptree. (We perform the check right before drawing to avoid missing changes from functions like the CopyImageSubData in the next frame). Then we map the shadow for sampling. This way, we can render the images using the decompressed pixels of the shadow but we return the compressed ones from the main when the texture is mapped for reading. Also, the OES_copy_image extension that couldn't work on Gen 7 due to the lack of the ETC support is now enabled back. Finally, the following glcts and piglit tests pass: On HSW (previously failing): ---------------------------- KHR-GL46.direct_state_access.textures_compressed_subimage On HSW and IVB (previously skipped): ------------------------------------- dEQP-GLES31.functional.texture.border_clamp.formats.compressed_srgb8_alpha8_etc2_eac.* (6 tests) dEQP-GLES31.functional.texture.border_clamp.formats.compressed_srgb8_etc2.* (6 tests) dEQP-GLES31.functional.texture.border_clamp.formats.compressed_srgb8_punchthrough_alpha1_etc2.* (6 tests) On HSW, IVB, SNB (previously skipped): --------------------------------------- dEQP-GLES3.functional.texture.format.compressed.* (12 tests) dEQP-GLES3.functional.texture.wrap.etc2_eac_srgb8_alpha8.* (36 tests) dEQP-GLES3.functional.texture.wrap.etc2_srgb8.* (36 tests) dEQP-GLES3.functional.texture.wrap.etc2_srgb8_punchthrough_alpha1.* (36 tests) piglit.spec.!opengl es 3_0.oes_compressed_etc2_texture-miptree_gles3 (srgb8, srgb8-alpha, srgb8-punchthrough-alpha1) piglit.spec.arb_es3_compatibility.oes_compressed_etc2_texture-miptree (srgb8 compat, srgb8 core, srgb8-alpha8 compat, srgb8-alpha8 core, srgb8-punchthrough-alpha1 compat, srgb8-punchthrough-alpha1 core) (9 tests) Total tests passing: 148 Eleni Maria Stea (4): i965: Faking the ETC2 compression on Gen < 8 GPUs using two miptrees. i965: Fixed the CopyImageSubData for ETC2 on Gen < 8 i965: Enabled the OES_copy_image extension on Gen 7 GPUs i965: Removed the field etc_format from the struct intel_mipmap_tree Nanley Chery (1): i965: Rename intel_mipmap_tree::r8stencil_* -> ::shadow_* src/mesa/drivers/dri/i965/brw_draw.c | 5 + .../drivers/dri/i965/brw_wm_surface_state.c | 15 +- src/mesa/drivers/dri/i965/intel_extensions.c | 16 +- src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 170 ++++++++++-------- src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 48 +++-- 5 files changed, 149 insertions(+), 105 deletions(-) -- 2.20.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev