diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-06-10 11:36:00 -0700 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-07-15 15:53:48 -0700 |
commit | 1e45349e82e15100f51127213a537e7e5c9ab335 (patch) | |
tree | 39f4242dcd4108482b28f7f510e15748de7577ed /src | |
parent | f665a3da7213818ca1cebe364500c4b190a491ce (diff) |
i965/miptree: Add a helper for getting the ISL clear color from a miptree
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 4 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 5c439fc9e32..2191bf59655 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -3167,3 +3167,29 @@ intel_miptree_get_isl_surf(struct brw_context *brw, surf->usage = 0; /* TODO */ } + +union isl_color_value +intel_miptree_get_isl_clear_color(struct brw_context *brw, + const struct intel_mipmap_tree *mt) +{ + union isl_color_value clear_color; + + if (brw->gen >= 9) { + clear_color.i32[0] = mt->gen9_fast_clear_color.i[0]; + clear_color.i32[1] = mt->gen9_fast_clear_color.i[1]; + clear_color.i32[2] = mt->gen9_fast_clear_color.i[2]; + clear_color.i32[3] = mt->gen9_fast_clear_color.i[3]; + } else if (_mesa_is_format_integer(mt->format)) { + clear_color.i32[0] = (mt->fast_clear_color_value & (1u << 31)) != 0; + clear_color.i32[1] = (mt->fast_clear_color_value & (1u << 30)) != 0; + clear_color.i32[2] = (mt->fast_clear_color_value & (1u << 29)) != 0; + clear_color.i32[3] = (mt->fast_clear_color_value & (1u << 28)) != 0; + } else { + clear_color.f32[0] = (mt->fast_clear_color_value & (1u << 31)) != 0; + clear_color.f32[1] = (mt->fast_clear_color_value & (1u << 30)) != 0; + clear_color.f32[2] = (mt->fast_clear_color_value & (1u << 29)) != 0; + clear_color.f32[3] = (mt->fast_clear_color_value & (1u << 28)) != 0; + } + + return clear_color; +} diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h index cf5d1a6528d..a50f181690d 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h @@ -802,6 +802,10 @@ intel_miptree_get_isl_surf(struct brw_context *brw, const struct intel_mipmap_tree *mt, struct isl_surf *surf); +union isl_color_value +intel_miptree_get_isl_clear_color(struct brw_context *brw, + const struct intel_mipmap_tree *mt); + void intel_get_image_dims(struct gl_texture_image *image, int *width, int *height, int *depth); |