summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2014-02-22 07:15:59 +1300
committerChris Forbes <[email protected]>2014-04-10 18:27:41 +1200
commit771c2ae0afc485a63e4668f0eb7713ea161f1b97 (patch)
tree954e4abf674b6b65a6eae9c5317f3b4ba8263b39 /src/mesa/drivers/dri
parentb7f011fdc9007c35921f6271b983ef4ccc6799e4 (diff)
i965: Add _Format to intel_texobj.
This is the actual mesa_format to use. In non-view cases this is always the same as the mt's format. V4: Comment style Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex.c9
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_obj.h6
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_validate.c1
3 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_tex.c b/src/mesa/drivers/dri/i965/intel_tex.c
index 3b14796d844..b69018e4be7 100644
--- a/src/mesa/drivers/dri/i965/intel_tex.c
+++ b/src/mesa/drivers/dri/i965/intel_tex.c
@@ -168,6 +168,7 @@ intel_alloc_texture_storage(struct gl_context *ctx,
intel_texobj->needs_validate = false;
intel_texobj->validated_first_level = 0;
intel_texobj->validated_last_level = levels - 1;
+ intel_texobj->_Format = intel_texobj->mt->format;
return true;
}
@@ -242,6 +243,7 @@ intel_texture_view(struct gl_context *ctx,
struct gl_texture_object *texObj,
struct gl_texture_object *origTexObj)
{
+ struct brw_context *brw = brw_context(ctx);
struct intel_texture_object *intel_tex = intel_texture_object(texObj);
struct intel_texture_object *intel_orig_tex = intel_texture_object(origTexObj);
@@ -274,6 +276,13 @@ intel_texture_view(struct gl_context *ctx,
intel_tex->validated_first_level = 0;
intel_tex->validated_last_level = numLevels - 1;
+ /* Set the validated texture format, with the same adjustments that
+ * would have been applied to determine the underlying texture's
+ * mt->format.
+ */
+ intel_tex->_Format = intel_depth_format_for_depthstencil_format(
+ intel_lower_compressed_format(brw, texObj->Image[0][0]->TexFormat));
+
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/i965/intel_tex_obj.h b/src/mesa/drivers/dri/i965/intel_tex_obj.h
index 78a0990a699..2d2211b0045 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_obj.h
+++ b/src/mesa/drivers/dri/i965/intel_tex_obj.h
@@ -54,6 +54,12 @@ struct intel_texture_object
* might not all be the mipmap tree above.
*/
bool needs_validate;
+
+ /* Mesa format for the validated texture object. For non-views this
+ * will always be the same as mt->format. For views, it may differ
+ * since the mt is shared across views with differing formats.
+ */
+ mesa_format _Format;
};
diff --git a/src/mesa/drivers/dri/i965/intel_tex_validate.c b/src/mesa/drivers/dri/i965/intel_tex_validate.c
index 48a41584cef..07f31744141 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_validate.c
@@ -173,6 +173,7 @@ intel_finalize_mipmap_tree(struct brw_context *brw, GLuint unit)
intelObj->validated_first_level = validate_first_level;
intelObj->validated_last_level = validate_last_level;
+ intelObj->_Format = intelObj->mt->format;
intelObj->needs_validate = false;
return true;