vkd3d-shader/hlsl: Add fwidth() function.
1 unresolved thread
1 unresolved thread
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Merge request reports
Activity
- Resolved by Nikolay Sivov
Can we have a test, please? :-)
- Resolved by Nikolay Sivov
2960 static bool intrinsic_fwidth(struct hlsl_ctx *ctx, 2961 const struct parse_initializer *params, const struct vkd3d_shader_location *loc) 2962 { 2963 struct hlsl_ir_function_decl *func; 2964 struct hlsl_type *type; 2965 char *body; 2966 2967 static const char template[] = 2968 "%s fwidth(%s x)\n" 2969 "{\n" 2970 " return abs(ddx(x)) + abs(ddy(x));\n" 2971 "}"; 2972 2973 if (!(type = elementwise_intrinsic_get_common_type(ctx, params, loc))) 2974 return false; 2975 type = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_FLOAT, type->dimx, type->dimy); Yes, but you still have to detect the correct type to convert to. It seems that the general philosophy behind the HLSL compiler is that for expressions that only make sense for floating point numbers you convert every integral type (
int
,uint
andbool
) tofloat
, and everything else doesn't need conversion. That's whatelementwise_intrinsic_float_convert_args()
does. I would assume that here the same happens, unless there is evidence of the contrary.changed this line in version 3 of the diff
added 57 commits
-
7f5746a7...45541dd9 - 56 commits from branch
wine:master
- 6a2e69b5 - vkd3d-shader/hlsl: Add fwidth() function.
-
7f5746a7...45541dd9 - 56 commits from branch
Please register or sign in to reply