[Solved] Sky is rendered close to camera on panfrost GPU driver

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
Post Reply
icecream95
Posts: 8
Joined: 03 Feb 2018, 07:56

[Solved] Sky is rendered close to camera on panfrost GPU driver

Post by icecream95 » 08 Oct 2019, 04:38

With the panfrost GPU driver, the sky is rendered as if it was very close to the camera, and in front of some buildings,

I know this is a driver bug, but I have three questions:

1. How does OpenMW draw the sky, so that with a working GPU driver the sky is always behind objects?
2. What is a quick hack I could do to fix this problem (I don't care if it breaks how the sky looks)?
3. What does the GPU driver do wrong / doesn't implement that makes this happen?
Attachments
fallensky.png
The sky is in front of some buildings
fallensky.png (755.46 KiB) Viewed 320 times

icecream95
Posts: 8
Joined: 03 Feb 2018, 07:56

Re: The sky is falling!

Post by icecream95 » 08 Oct 2019, 04:43

Ignore the artefacting in the sky itself; that was from a workaround for s3tc decompression that I don't have to do any more after finding out about OPENMW_DECOMPRESS_TEXTURES 8-).

icecream95
Posts: 8
Joined: 03 Feb 2018, 07:56

Re: The sky is falling!

Post by icecream95 » 06 Nov 2019, 01:26

This got fixed a day ago:

Code: Select all

From 28440820eff55d412fbce3243c24bc9f58c3b8e6 Mon Sep 17 00:00:00 2001
From: Boris Brezillon <[email protected]>
Date: Mon, 4 Nov 2019 11:57:22 +0100
Subject: [PATCH] panfrost: MALI_DEPTH_TEST is actually MALI_DEPTH_WRITEMASK

MALI_DEPTH_TEST should only be set when depth->writemask is true,
not when the depth test is enabled. Let's rename the flag and patch
panfrost_bind_depth_stencil_state() to do the right thing.

Signed-off-by: Boris Brezillon <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
---
 .gitlab-ci/deqp-panfrost-t760-fails.txt    | 690 ---------------------
 .gitlab-ci/deqp-panfrost-t860-fails.txt    | 690 ---------------------
 src/gallium/drivers/panfrost/pan_context.c |   3 +-
 src/panfrost/include/panfrost-job.h        |   2 +-
 src/panfrost/pandecode/decode.c            |   4 +-
 5 files changed, 5 insertions(+), 1384 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 69b3b96295d..285936c5c26 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -2346,7 +2346,8 @@ panfrost_bind_depth_stencil_state(struct pipe_context *pipe,
         ctx->fragment_shader_core.stencil_mask_back = depth_stencil->stencil[back_index].writemask;
 
         /* Depth state (TODO: Refactor) */
-        SET_BIT(ctx->fragment_shader_core.unknown2_3, MALI_DEPTH_TEST, depth_stencil->depth.enabled);
+        SET_BIT(ctx->fragment_shader_core.unknown2_3, MALI_DEPTH_WRITEMASK,
+                depth_stencil->depth.writemask);
 
         int func = depth_stencil->depth.enabled ? depth_stencil->depth.func : PIPE_FUNC_ALWAYS;
 
diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h
index 2e766a0c56f..286c663e41e 100644
--- a/src/panfrost/include/panfrost-job.h
+++ b/src/panfrost/include/panfrost-job.h
@@ -123,7 +123,7 @@ enum mali_alt_func {
 #define MALI_GET_DEPTH_FUNC(flags) ((flags >> 8) & 0x7)
 #define MALI_DEPTH_FUNC_MASK	   MALI_DEPTH_FUNC(0x7)
 
-#define MALI_DEPTH_TEST		(1 << 11)
+#define MALI_DEPTH_WRITEMASK    (1 << 11)
 
 /* Next flags to unknown2_4 */
 #define MALI_STENCIL_TEST      	(1 << 0)
diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c
index 9beb1049a69..a310582ebe8 100644
--- a/src/panfrost/pandecode/decode.c
+++ b/src/panfrost/pandecode/decode.c
@@ -223,7 +223,7 @@ static const struct pandecode_flag_info u3_flag_info[] = {
         FLAG_INFO(HAS_MSAA),
         FLAG_INFO(CAN_DISCARD),
         FLAG_INFO(HAS_BLEND_SHADER),
-        FLAG_INFO(DEPTH_TEST),
+        FLAG_INFO(DEPTH_WRITEMASK),
         {}
 };
 
@@ -2141,7 +2141,7 @@ pandecode_vertex_tiler_postfix_pre(
 
                         /* We're not quite sure what these flags mean without the depth test, if anything */
 
-                        if (unknown2_3 & (MALI_DEPTH_TEST | MALI_DEPTH_FUNC_MASK)) {
+                        if (unknown2_3 & (MALI_DEPTH_WRITEMASK | MALI_DEPTH_FUNC_MASK)) {
                                 const char *func = pandecode_func(MALI_GET_DEPTH_FUNC(unknown2_3));
                                 unknown2_3 &= ~MALI_DEPTH_FUNC_MASK;
 
-- 
2.22.0



Post Reply