mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
intel/fs: Don't use pixel_z for Gen4-5 source_depth_to_render_target
The source_depth_to_render_target flag can get set on old gen4-5 HW in a
few cases which are independent of the app writing gl_FragDepth. It
should be safe to just use fetch_payload_reg in that case instead of
depending in interpolation setup. This fixes a bug with certain very
simple shaders where we might end up not including the depth when we
should have.
While we're here, rework the logic around setting src_depth and add a
comment so it's more clear what's going on.
Fixes: 6d4070f3dd "intel/compiler: add support for fragment coordinate..."
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10596>
This commit is contained in:
parent
71cff8171c
commit
3f36e027d3
1 changed files with 12 additions and 5 deletions
|
|
@ -613,11 +613,18 @@ fs_visitor::emit_single_fb_write(const fs_builder &bld,
|
|||
const fs_reg dst_depth = fetch_payload_reg(bld, payload.dest_depth_reg);
|
||||
fs_reg src_depth, src_stencil;
|
||||
|
||||
if (source_depth_to_render_target) {
|
||||
if (nir->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
|
||||
src_depth = frag_depth;
|
||||
else
|
||||
src_depth = this->pixel_z;
|
||||
if (nir->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
|
||||
src_depth = frag_depth;
|
||||
} else if (source_depth_to_render_target) {
|
||||
/* If we got here, we're in one of those strange Gen4-5 cases where
|
||||
* we're forced to pass the source depth, unmodified, to the FB write.
|
||||
* In this case, we don't want to use pixel_z because we may not have
|
||||
* set up interpolation. It's also perfectly safe because it only
|
||||
* happens on old hardware (no coarse interpolation) and this is
|
||||
* explicitly the pass-through case.
|
||||
*/
|
||||
assert(devinfo->ver <= 5);
|
||||
src_depth = fetch_payload_reg(bld, payload.source_depth_reg);
|
||||
}
|
||||
|
||||
if (nir->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_STENCIL))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue