radeonsi: support gl_FragCoord at integer pixel center
authorMarek Olšák <marek.olsak@amd.com>
Mon, 17 Nov 2014 19:51:56 +0000 (20:51 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 18 Nov 2014 13:27:54 +0000 (14:27 +0100)
No known benefit for OpenGL, but it doesn't hurt.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_pipe.c
src/gallium/drivers/radeonsi/si_state_draw.c

index 61a3885c645aea68265afe51bc1400f2ca6ba76c..19ad75ae04ef7a9541e2943ce9f770ee64d85570 100644 (file)
@@ -183,6 +183,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
        case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
        case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
        case PIPE_CAP_SM3:
        case PIPE_CAP_SEAMLESS_CUBE_MAP:
        case PIPE_CAP_PRIMITIVE_RESTART:
@@ -240,7 +241,6 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
 
        /* Unsupported features. */
        case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
-       case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
        case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
        case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
        case PIPE_CAP_VERTEX_COLOR_CLAMPED:
index f10828271112c776a55d0b26037f05e041ace709..674b4a04e39ff0ca541760cb63f4d6e2eb1be785 100644 (file)
@@ -262,6 +262,10 @@ static void si_shader_ps(struct si_shader *shader)
                                spi_baryc_cntl |= S_0286E0_POS_FLOAT_LOCATION(2);
                                break;
                        }
+
+                       if (info->properties[TGSI_PROPERTY_FS_COORD_PIXEL_CENTER] ==
+                           TGSI_FS_COORD_PIXEL_CENTER_INTEGER)
+                               spi_baryc_cntl |= S_0286E0_POS_FLOAT_ULC(1);
                        break;
                }
        }