i965/program_cache: Cast the key to char * before adding key_size
[mesa.git] / src / mesa / drivers / dri / i965 / intel_mipmap_tree.h
index 1a7507023a16e90884cd79cf27ebecffa60f4512..3e53a0049cc63cd5646030b667903b5d23bb63d4 100644 (file)
@@ -215,21 +215,11 @@ struct intel_mipmap_tree
     * MESA_FORMAT_Z_FLOAT32, otherwise for MESA_FORMAT_Z24_UNORM_S8_UINT objects it will be
     * MESA_FORMAT_Z24_UNORM_X8_UINT.
     *
-    * For ETC1/ETC2 textures, this is one of the uncompressed mesa texture
-    * formats if the hardware lacks support for ETC1/ETC2. See @ref etc_format.
-    *
     * @see RENDER_SURFACE_STATE.SurfaceFormat
     * @see 3DSTATE_DEPTH_BUFFER.SurfaceFormat
     */
    mesa_format format;
 
-   /**
-    * This variable stores the value of ETC compressed texture format
-    *
-    * @see RENDER_SURFACE_STATE.SurfaceFormat
-    */
-   mesa_format etc_format;
-
    GLuint first_level;
    GLuint last_level;
 
@@ -301,6 +291,8 @@ struct intel_mipmap_tree
     *
     * This miptree may be used for:
     * - Stencil texturing (pre-BDW) as required by GL_ARB_stencil_texturing.
+    * - To store the decompressed ETC/EAC data in case we emulate the ETC
+    *   compression on Gen 7 or earlier GPUs.
     */
    struct intel_mipmap_tree *shadow_mt;
    bool shadow_needs_update;
@@ -730,6 +722,28 @@ isl_memcpy_type
 intel_miptree_get_memcpy_type(mesa_format tiledFormat, GLenum format, GLenum type,
                               uint32_t *cpp);
 
+static inline bool
+intel_miptree_needs_fake_etc(struct brw_context *brw,
+                             struct intel_mipmap_tree *mt)
+{
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
+   bool is_etc = _mesa_is_format_etc2(mt->format) ||
+                 (mt->format == MESA_FORMAT_ETC1_RGB8);
+
+   return devinfo->gen < 8 && !devinfo->is_baytrail && is_etc;
+}
+
+static inline bool
+intel_miptree_has_etc_shadow(struct brw_context *brw,
+                             struct intel_mipmap_tree *mt)
+{
+   return intel_miptree_needs_fake_etc(brw, mt) && mt->shadow_mt;
+}
+
+void
+intel_miptree_update_etc_shadow_levels(struct brw_context *brw,
+                                       struct intel_mipmap_tree *mt);
+
 #ifdef __cplusplus
 }
 #endif