Am 09.03.2016 um 15:53 schrieb Marek Olšák:
On Wed, Mar 9, 2016 at 4:54 AM, Michel Dänzer <mic...@daenzer.net> wrote:
On 08.03.2016 21:21, Christian König wrote:
From: Christian König <christian.koe...@amd.com>

Linear layout should work for all formats as well.
The hardware actually doesn't support linear e.g. for compressed formats
or depth/stencil formats.
The driver ignores the flag for compressed formats. It doesn't ignore
the flag for depth/stencil formats, but it does support binding a
linear depth/stencil buffer as a color buffer.

That said, I think PIPE_BIND_LINEAR should not be an allowed parameter
of is_format_supported (unless we have a very good reason to allow it).

Why not? In my use case the state tracker just translates the format it got from the application into the internal representation and queries the driver if the result would be supported or not.

I could query without the linear flag as well, but I think that this wouldn't be the correct approach.

How about the attached updated patch? I'm allowing PIPE_BIND_LINEAR now when it's not depth/stencil or compressed.

Regards,
Christian.
>From e63465efecf8b302d6384379878f7967bc39aece Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koe...@amd.com>
Date: Thu, 14 Jan 2016 13:38:10 +0100
Subject: [PATCH] radeonsi: ignore PIPE_BIND_LINEAR in si_is_format_supported
 v2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Linear layout should work for all not compressed or depth/stencil formats.

v2: restrict it a bit more

Signed-off-by: Christian König <christian.koe...@amd.com>
---
 src/gallium/drivers/radeonsi/si_state.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index f823af1..788e75b 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2046,6 +2046,11 @@ boolean si_is_format_supported(struct pipe_screen *screen,
 	if (usage & PIPE_BIND_TRANSFER_WRITE)
 		retval |= PIPE_BIND_TRANSFER_WRITE;
 
+	if ((usage & PIPE_BIND_LINEAR) &&
+	    !util_format_is_compressed(format) &&
+	    !(usage & PIPE_BIND_DEPTH_STENCIL))
+		retval |= PIPE_BIND_LINEAR;
+
 	return retval == usage;
 }
 
-- 
2.5.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to