diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2017-05-20 15:00:42 -0700 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2017-06-07 08:54:54 -0700 |
commit | f9fd976e8adba733b08dacd597e09a513503c116 (patch) | |
tree | 00dfd2b1792c887090d24397b3e4f6be362147a8 /src/intel | |
parent | 1253d58983b2b6ba4ed16444a344327e8117f333 (diff) |
i965/miptree: Store fast clear colors in an isl_color_value
This commit, out of necessity, makes a number of changes at once:
1) Changes intel_mipmap_tree to store the clear color for both color
and depth as an isl_color_value.
2) Changes the depth/stencil emit code to do the format conversion of
the depth clear value on Haswell and earlier instead of pulling a
uint32_t directly from the miptree.
3) Changes ISL's depth/stencil emit code to perform the format
conversion of the depth clear value on Haswell and earlier instead
of assuming that the depth value in the float is pre-converted.
4) Changes blorp to pass the depth value through as a float.
5) Changes the Vulkan driver to pass the depth value to blorp as a
float rather than a uint.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/blorp/blorp_genX_exec.h | 2 | ||||
-rw-r--r-- | src/intel/isl/isl_emit_depth_stencil.c | 19 | ||||
-rw-r--r-- | src/intel/vulkan/anv_blorp.c | 2 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h index 59c1d36494..a354cea117 100644 --- a/src/intel/blorp/blorp_genX_exec.h +++ b/src/intel/blorp/blorp_genX_exec.h @@ -1402,7 +1402,7 @@ blorp_emit_depth_stencil_config(struct blorp_batch *batch, blorp_emit_reloc(batch, dw + isl_dev->ds.hiz_offset / 4, hiz_address, 0); - info.depth_clear_value = params->depth.clear_color.u32[0]; + info.depth_clear_value = params->depth.clear_color.f32[0]; } } diff --git a/src/intel/isl/isl_emit_depth_stencil.c b/src/intel/isl/isl_emit_depth_stencil.c index 41a01be6f1..339da28bb8 100644 --- a/src/intel/isl/isl_emit_depth_stencil.c +++ b/src/intel/isl/isl_emit_depth_stencil.c @@ -177,7 +177,26 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch, #endif clear.DepthClearValueValid = true; +#if GEN_GEN >= 8 clear.DepthClearValue = info->depth_clear_value; +#else + switch (info->depth_surf->format) { + case ISL_FORMAT_R32_FLOAT: { + union { float f; uint32_t u; } fu; + fu.f = info->depth_clear_value; + clear.DepthClearValue = fu.u; + break; + } + case ISL_FORMAT_R24_UNORM_X8_TYPELESS: + clear.DepthClearValue = info->depth_clear_value * ((1u << 24) - 1); + break; + case ISL_FORMAT_R16_UNORM: + clear.DepthClearValue = info->depth_clear_value * ((1u << 16) - 1); + break; + default: + unreachable("Invalid depth type"); + } +#endif } #endif /* GEN_GEN >= 6 */ diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index 45cbbb8690..3ba65d40c5 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -1721,7 +1721,7 @@ anv_gen8_hiz_op_resolve(struct anv_cmd_buffer *cmd_buffer, }; surf.aux_usage = ISL_AUX_USAGE_HIZ; - surf.clear_color.u32[0] = (uint32_t) ANV_HZ_FC_VAL; + surf.clear_color.f32[0] = ANV_HZ_FC_VAL; blorp_gen6_hiz_op(&batch, &surf, 0, 0, op); blorp_batch_finish(&batch); |