radeonsi/nir: handle key.mono.u.ps.interpolate_at_sample_force_center
authorMarek Olšák <marek.olsak@amd.com>
Tue, 30 Jul 2019 02:04:16 +0000 (22:04 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 6 Aug 2019 21:08:39 +0000 (17:08 -0400)
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
src/amd/common/ac_nir_to_llvm.c
src/amd/common/ac_shader_abi.h
src/gallium/drivers/radeonsi/si_shader_nir.c

index 5e25e838f8f3f78c5d7a1590768f95bde4d0a828..879d32f50d61e3cd1cfbdf5c91c2e0bdb591325c 100644 (file)
@@ -3080,6 +3080,9 @@ static LLVMValueRef barycentric_at_sample(struct ac_nir_context *ctx,
                                          unsigned mode,
                                          LLVMValueRef sample_id)
 {
+       if (ctx->abi->interp_at_sample_force_center)
+               return barycentric_center(ctx, mode);
+
        LLVMValueRef halfval = LLVMConstReal(ctx->ac.f32, 0.5f);
 
        /* fetch sample ID */
index d6db398ee7b276ac474f0decbdae0901db3ea470..3033ae0cac2a2778339a52a80c64f1645f9f8011 100644 (file)
@@ -203,6 +203,7 @@ struct ac_shader_abi {
        /* Whether to clamp the shadow reference value to [0,1]on GFX8. Radeonsi currently
         * uses it due to promoting D16 to D32, but radv needs it off. */
        bool clamp_shadow_reference;
+       bool interp_at_sample_force_center;
 
        /* Whether to workaround GFX9 ignoring the stride for the buffer size if IDXEN=0
        * and LLVM optimizes an indexed load with constant index to IDXEN=0. */
index 56d35e533e5e5cf0355e42c5afbb3db130e3e58d..5ca4e178b86f635b223cf764df40ad43289ee578 100644 (file)
@@ -1243,7 +1243,10 @@ bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *nir)
                                 ac_to_integer(&ctx->ac,
                                               ac_build_gather_values(&ctx->ac, values, 4));
                 }
-        }
+
+               ctx->abi.interp_at_sample_force_center =
+                       ctx->shader->key.mono.u.ps.interpolate_at_sample_force_center;
+       }
 
        ctx->abi.inputs = &ctx->inputs[0];
        ctx->abi.load_sampler_desc = si_nir_load_sampler_desc;