On 1/19/19 1:32 AM, Nanley Chery wrote: >> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c >> b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c >> index e214fae140..4d1eafac91 100644 >> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c >> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c >> @@ -329,6 +329,17 @@ brw_get_texture_swizzle(const struct gl_context *ctx, >> { >> const struct gl_texture_image *img = t->Image[0][t->BaseLevel]; >> >> + struct brw_context *brw = brw_context((struct gl_context *)ctx); >> + const struct gen_device_info *devinfo = &brw->screen->devinfo; >> + bool is_fake_etc = _mesa_is_format_etc2(img->TexFormat) && >> + devinfo->gen < 8; >> + >> + mesa_format format; >> + if (is_fake_etc) >> + format = intel_lower_compressed_format(brw, img->TexFormat); >> + else >> + format = img->TexFormat; >> + > > Why is modifying this function necessary?
Hi, I'll try to explain this modification: After the changes we made: - the image TexFormat remains ETC2 to match the main miptree's format - the main miptree stores the compressed data (ETC2) so that the GetCompressed* functions work - the shadow miptree stores the RGBA data and we map it for the drawing This texture swizzle function is called before the drawing and it can't access the miptrees. Instead it reads the format of the texture we are supposed to have in the memory from the gl_texture_image struct directly so in this case it reads the ETC2 format. At this time, the texture that we have in the memory and is about to be used in the drawing is RGBA (from the shadow miptree). As a result, we end up calculating the swizzle of the ETC2 format used in the original image (+the main miptree) for the RGBA texture that we have in the memory. As a result the texture is not rendered properly. The solution was to use the corresponding RGBA format when we fake the ETC2, but as I couldn't read it from the shadow miptree inside this function, I took it by calling intel_lower_compressed_format for the original ETC2 format of the gl_texture_image. I hope that this change is more clear now, I will add a comment explaining this just in case, Thank you! Eleni _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev