radv: Interpolate less aggressively.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 23 Feb 2019 13:33:31 +0000 (14:33 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 26 Feb 2019 18:51:35 +0000 (18:51 +0000)
Seems like dxvk used integer builtins without setting the flat
interpolation decoration.

I believe in the current spec the app is required to set these,
but in the meantime to avoid breaking things in stable releases
(and so close to release for 19.0), only expand the interpolation
to float16 and struct (which cannot be builtins as our spirv parser
lowers the builtin block).

Fixes: f3247841040 "radv: Allow interpolation on non-float types."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_nir_to_llvm.c

index 36f499be2121df2acca68c9d3701ba1d660db2f3..a589ff41559911913c8ec88c41a1e816d86437c9 100644 (file)
@@ -2297,16 +2297,19 @@ handle_fs_input_decl(struct radv_shader_context *ctx,
 
        mask = ((1ull << attrib_count) - 1) << variable->data.location;
 
-       unsigned interp_type;
-       if (variable->data.sample)
-               interp_type = INTERP_SAMPLE;
-       else if (variable->data.centroid)
-               interp_type = INTERP_CENTROID;
-       else
-               interp_type = INTERP_CENTER;
-
-       interp = lookup_interp_param(&ctx->abi, variable->data.interpolation, interp_type);
+       if (glsl_get_base_type(glsl_without_array(variable->type)) == GLSL_TYPE_FLOAT ||
+           glsl_get_base_type(glsl_without_array(variable->type)) == GLSL_TYPE_FLOAT16 ||
+           glsl_get_base_type(glsl_without_array(variable->type)) == GLSL_TYPE_STRUCT) {
+               unsigned interp_type;
+               if (variable->data.sample)
+                       interp_type = INTERP_SAMPLE;
+               else if (variable->data.centroid)
+                       interp_type = INTERP_CENTROID;
+               else
+                       interp_type = INTERP_CENTER;
 
+               interp = lookup_interp_param(&ctx->abi, variable->data.interpolation, interp_type);
+       }
        if (interp == NULL)
                interp = LLVMGetUndef(ctx->ac.i32);