From 06f217d80f3d1318da4974bf7b31ea7edcf5eb0b Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Fri, 18 Nov 2011 15:45:03 +0100 Subject: gallium: implement ARB_conservative_depth This adds a new TGSI property to represent the GLSL layout qualifier in TGSI. --- src/gallium/auxiliary/tgsi/tgsi_dump.c | 1 + src/gallium/auxiliary/tgsi/tgsi_ureg.c | 16 ++++++++++++++++ src/gallium/auxiliary/tgsi/tgsi_ureg.h | 5 +++++ src/gallium/include/pipe/p_shader_tokens.h | 10 +++++++++- 4 files changed, 31 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 91bc1245223..e830aa53f20 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -174,6 +174,7 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] = "FS_COORD_ORIGIN", "FS_COORD_PIXEL_CENTER", "FS_COLOR0_WRITES_ALL_CBUFS", + "FS_DEPTH_LAYOUT" }; static const char *tgsi_type_names[] = diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index cd445a6daa6..ee013a5d687 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -161,6 +161,7 @@ struct ureg_program unsigned char property_fs_coord_origin; /* = TGSI_FS_COORD_ORIGIN_* */ unsigned char property_fs_coord_pixel_center; /* = TGSI_FS_COORD_PIXEL_CENTER_* */ unsigned char property_fs_color0_writes_all_cbufs; /* = TGSI_FS_COLOR0_WRITES_ALL_CBUFS * */ + unsigned char property_fs_depth_layout; /* TGSI_FS_DEPTH_LAYOUT */ unsigned nr_addrs; unsigned nr_preds; @@ -304,6 +305,13 @@ ureg_property_fs_color0_writes_all_cbufs(struct ureg_program *ureg, ureg->property_fs_color0_writes_all_cbufs = fs_color0_writes_all_cbufs; } +void +ureg_property_fs_depth_layout(struct ureg_program *ureg, + unsigned fs_depth_layout) +{ + ureg->property_fs_depth_layout = fs_depth_layout; +} + struct ureg_src ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg, unsigned semantic_name, @@ -1388,6 +1396,14 @@ static void emit_decls( struct ureg_program *ureg ) ureg->property_fs_color0_writes_all_cbufs); } + if (ureg->property_fs_depth_layout) { + assert(ureg->processor == TGSI_PROCESSOR_FRAGMENT); + + emit_property(ureg, + TGSI_PROPERTY_FS_DEPTH_LAYOUT, + ureg->property_fs_depth_layout); + } + if (ureg->processor == TGSI_PROCESSOR_VERTEX) { for (i = 0; i < UREG_MAX_INPUT; i++) { if (ureg->vs_inputs[i/32] & (1 << (i%32))) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 8f5f22e1750..a70d30f873f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -157,6 +157,11 @@ void ureg_property_fs_color0_writes_all_cbufs(struct ureg_program *ureg, unsigned fs_color0_writes_all_cbufs); +void +ureg_property_fs_depth_layout(struct ureg_program *ureg, + unsigned fs_depth_layout); + + /*********************************************************************** * Build shader declarations: */ diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index b04e26d308e..10cfaf69ade 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -188,7 +188,8 @@ union tgsi_immediate_data #define TGSI_PROPERTY_FS_COORD_ORIGIN 3 #define TGSI_PROPERTY_FS_COORD_PIXEL_CENTER 4 #define TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS 5 -#define TGSI_PROPERTY_COUNT 6 +#define TGSI_PROPERTY_FS_DEPTH_LAYOUT 6 +#define TGSI_PROPERTY_COUNT 7 struct tgsi_property { unsigned Type : 4; /**< TGSI_TOKEN_TYPE_PROPERTY */ @@ -203,6 +204,13 @@ struct tgsi_property { #define TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER 0 #define TGSI_FS_COORD_PIXEL_CENTER_INTEGER 1 +#define TGSI_FS_DEPTH_LAYOUT_NONE 0 +#define TGSI_FS_DEPTH_LAYOUT_ANY 1 +#define TGSI_FS_DEPTH_LAYOUT_GREATER 2 +#define TGSI_FS_DEPTH_LAYOUT_LESS 3 +#define TGSI_FS_DEPTH_LAYOUT_UNCHANGED 4 + + struct tgsi_property_data { unsigned Data; }; -- cgit v1.2.3