softpipe: Add support for ARB_derivative_control
authorGert Wollny <gert.wollny@collabora.com>
Tue, 13 Aug 2019 16:08:34 +0000 (18:08 +0200)
committerGert Wollny <gw.fossdev@gmail.com>
Wed, 14 Aug 2019 07:03:15 +0000 (07:03 +0000)
Enables and passes piglits:

spec/ARB_drivative_control/
        dfdx-coarse
        dfdx-dfdy
        dfdx-fine
        dfdy-coarse
        dfdy-fine

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
docs/features.txt
src/gallium/auxiliary/tgsi/tgsi_exec.c
src/gallium/drivers/softpipe/sp_screen.c

index 831a9a6884baf9fc5e014a626f9fe4efd8c7ac77..3e5cfe04e2960d00c9ef72ffec0aa8600524f464 100644 (file)
@@ -215,7 +215,7 @@ GL 4.5, GLSL 4.50 -- all DONE: nvc0, radeonsi, r600
   GL_ARB_clip_control                                   DONE (freedreno, i965, nv50, llvmpipe, softpipe, swr)
   GL_ARB_conditional_render_inverted                    DONE (freedreno, i965, nv50, llvmpipe, softpipe, swr, virgl)
   GL_ARB_cull_distance                                  DONE (i965, nv50, llvmpipe, softpipe, swr, virgl)
-  GL_ARB_derivative_control                             DONE (i965, nv50, virgl)
+  GL_ARB_derivative_control                             DONE (i965, nv50, softpipe, virgl)
   GL_ARB_direct_state_access                            DONE (all drivers)
   GL_ARB_get_texture_sub_image                          DONE (all drivers)
   GL_ARB_shader_texture_image_samples                   DONE (i965, nv50, virgl)
index 18ee27502b443ff2a41446014f4de11fff5f49ef..0633a4e708c64ba81cd1cdeda4d02a1238619389 100644 (file)
@@ -217,6 +217,17 @@ micro_ddx(union tgsi_exec_channel *dst,
    dst->f[3] = src->f[TILE_BOTTOM_RIGHT] - src->f[TILE_BOTTOM_LEFT];
 }
 
+static void
+micro_ddx_fine(union tgsi_exec_channel *dst,
+          const union tgsi_exec_channel *src)
+{
+   dst->f[0] =
+   dst->f[1] = src->f[TILE_TOP_RIGHT] - src->f[TILE_TOP_LEFT];
+   dst->f[2] =
+   dst->f[3] = src->f[TILE_BOTTOM_RIGHT] - src->f[TILE_BOTTOM_LEFT];
+}
+
+
 static void
 micro_ddy(union tgsi_exec_channel *dst,
           const union tgsi_exec_channel *src)
@@ -227,6 +238,16 @@ micro_ddy(union tgsi_exec_channel *dst,
    dst->f[3] = src->f[TILE_BOTTOM_LEFT] - src->f[TILE_TOP_LEFT];
 }
 
+static void
+micro_ddy_fine(union tgsi_exec_channel *dst,
+          const union tgsi_exec_channel *src)
+{
+   dst->f[0] =
+   dst->f[2] = src->f[TILE_BOTTOM_LEFT] - src->f[TILE_TOP_LEFT];
+   dst->f[1] =
+   dst->f[3] = src->f[TILE_BOTTOM_RIGHT] - src->f[TILE_TOP_RIGHT];
+}
+
 static void
 micro_dmul(union tgsi_double_channel *dst,
            const union tgsi_double_channel *src)
@@ -5398,10 +5419,18 @@ exec_instruction(
       exec_scalar_unary(mach, inst, micro_cos, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
       break;
 
+   case TGSI_OPCODE_DDX_FINE:
+      exec_vector_unary(mach, inst, micro_ddx_fine, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
+      break;
+
    case TGSI_OPCODE_DDX:
       exec_vector_unary(mach, inst, micro_ddx, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
       break;
 
+   case TGSI_OPCODE_DDY_FINE:
+      exec_vector_unary(mach, inst, micro_ddy_fine, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
+      break;
+
    case TGSI_OPCODE_DDY:
       exec_vector_unary(mach, inst, micro_ddy, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
       break;
index 9c1a98ec4eac88828750c10610994667cfbf47d9..b51e14470c11770ebfd4acc80875ee3383e5bad0 100644 (file)
@@ -218,7 +218,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
       return 1;
    case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
-      return 0;
+      return 1;
    case PIPE_CAP_SAMPLER_VIEW_TARGET:
       return 1;
    case PIPE_CAP_FAKE_SW_MSAA: