zink: implement support for derivative-control
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 30 Jan 2020 15:50:59 +0000 (16:50 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 31 Jan 2020 08:56:55 +0000 (08:56 +0000)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3645>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3645>

src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
src/gallium/drivers/zink/zink_screen.c

index 34bb14379c4b2b963703c04d557a3790f0473e2d..af1ddef11bdf0f6c80abf3bbe5d77ae896a46d04 100644 (file)
@@ -911,7 +911,11 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
    UNOP(nir_op_ineg, SpvOpSNegate)
    UNOP(nir_op_fneg, SpvOpFNegate)
    UNOP(nir_op_fddx, SpvOpDPdx)
+   UNOP(nir_op_fddx_coarse, SpvOpDPdxCoarse)
+   UNOP(nir_op_fddx_fine, SpvOpDPdxFine)
    UNOP(nir_op_fddy, SpvOpDPdy)
+   UNOP(nir_op_fddy_coarse, SpvOpDPdyCoarse)
+   UNOP(nir_op_fddy_fine, SpvOpDPdyFine)
    UNOP(nir_op_f2i32, SpvOpConvertFToS)
    UNOP(nir_op_f2u32, SpvOpConvertFToU)
    UNOP(nir_op_i2f32, SpvOpConvertSToF)
@@ -1846,6 +1850,7 @@ nir_to_spirv(struct nir_shader *s)
    if (s->info.stage == MESA_SHADER_FRAGMENT) {
       spirv_builder_emit_cap(&ctx.builder, SpvCapabilitySampled1D);
       spirv_builder_emit_cap(&ctx.builder, SpvCapabilityImageQuery);
+      spirv_builder_emit_cap(&ctx.builder, SpvCapabilityDerivativeControl);
    }
 
    ctx.stage = s->info.stage;
index 9e29a51862ac08c69480cf257794f03903f700c5..9503194711630cca10ee8d826bc914dcc6ad1fd8 100644 (file)
@@ -211,6 +211,9 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET:
       return screen->props.limits.maxTexelGatherOffset;
 
+   case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
+      return 1;
+
    case PIPE_CAP_VENDOR_ID:
       return screen->props.vendorID;
    case PIPE_CAP_DEVICE_ID: