i965/miptree: Take an isl_format in prepare_texture
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 22 Jun 2017 04:10:53 +0000 (21:10 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sun, 23 Jul 2017 03:59:22 +0000 (20:59 -0700)
This will be a bit more convenient momentarily.  It's also more correct
because it makes prepare_texture take sRGB into account.

src/mesa/drivers/dri/i965/brw_draw.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.h

index b77b44e08b610d12532a285539e9e511a867a36c..20ff99fff9d525c16e898e628f05cd0467dd56ba 100644 (file)
@@ -383,8 +383,12 @@ brw_predraw_resolve_inputs(struct brw_context *brw)
       if (!tex_obj || !tex_obj->mt)
         continue;
 
+      struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, i);
+      enum isl_format view_format =
+         translate_tex_format(brw, tex_obj->_Format, sampler->sRGBDecode);
+
       bool aux_supported;
-      intel_miptree_prepare_texture(brw, tex_obj->mt, tex_obj->_Format,
+      intel_miptree_prepare_texture(brw, tex_obj->mt, view_format,
                                     &aux_supported);
 
       if (!aux_supported && brw->gen >= 9 &&
index e802affac98088c9ca11efa1cb11b877087e3951..0db05a77e62004b56352cb1781ebccda0f2f21d4 100644 (file)
@@ -2464,18 +2464,15 @@ intel_miptree_set_aux_state(struct brw_context *brw,
 static bool
 can_texture_with_ccs(struct brw_context *brw,
                      struct intel_mipmap_tree *mt,
-                     mesa_format view_format)
+                     enum isl_format view_format)
 {
    if (mt->aux_usage != ISL_AUX_USAGE_CCS_E)
       return false;
 
-   enum isl_format isl_mt_format = brw_isl_format_for_mesa_format(mt->format);
-   enum isl_format isl_view_format = brw_isl_format_for_mesa_format(view_format);
-
    if (!isl_formats_are_ccs_e_compatible(&brw->screen->devinfo,
-                                         isl_mt_format, isl_view_format)) {
+                                         mt->surf.format, view_format)) {
       perf_debug("Incompatible sampling format (%s) for rbc (%s)\n",
-                 _mesa_get_format_name(view_format),
+                 isl_format_get_layout(view_format)->name,
                  _mesa_get_format_name(mt->format));
       return false;
    }
@@ -2513,7 +2510,7 @@ intel_miptree_texture_aux_usage(struct brw_context *brw,
 static void
 intel_miptree_prepare_texture_slices(struct brw_context *brw,
                                      struct intel_mipmap_tree *mt,
-                                     mesa_format view_format,
+                                     enum isl_format view_format,
                                      uint32_t start_level, uint32_t num_levels,
                                      uint32_t start_layer, uint32_t num_layers,
                                      bool *aux_supported_out)
@@ -2526,7 +2523,7 @@ intel_miptree_prepare_texture_slices(struct brw_context *brw,
     * the sampler.  If we have a texture view, we would have to perform the
     * clear color conversion manually.  Just disable clear color.
     */
-   if (mt->format != view_format)
+   if (mt->surf.format != view_format)
       clear_supported = false;
 
    intel_miptree_prepare_access(brw, mt, start_level, num_levels,
@@ -2539,7 +2536,7 @@ intel_miptree_prepare_texture_slices(struct brw_context *brw,
 void
 intel_miptree_prepare_texture(struct brw_context *brw,
                               struct intel_mipmap_tree *mt,
-                              mesa_format view_format,
+                              enum isl_format view_format,
                               bool *aux_supported_out)
 {
    intel_miptree_prepare_texture_slices(brw, mt, view_format,
@@ -2563,7 +2560,7 @@ intel_miptree_prepare_fb_fetch(struct brw_context *brw,
                                struct intel_mipmap_tree *mt, uint32_t level,
                                uint32_t start_layer, uint32_t num_layers)
 {
-   intel_miptree_prepare_texture_slices(brw, mt, mt->format, level, 1,
+   intel_miptree_prepare_texture_slices(brw, mt, mt->surf.format, level, 1,
                                         start_layer, num_layers, NULL);
 }
 
index 5737808f56e9d3ce791fd30c7d17ca9f1304f9e8..bc49b6bb07158587806431b7299ad46dc087d24e 100644 (file)
@@ -618,7 +618,7 @@ intel_miptree_texture_aux_usage(struct brw_context *brw,
 void
 intel_miptree_prepare_texture(struct brw_context *brw,
                               struct intel_mipmap_tree *mt,
-                              mesa_format view_format,
+                              enum isl_format view_format,
                               bool *aux_supported_out);
 void
 intel_miptree_prepare_image(struct brw_context *brw,