vkd3d-shader/hlsl: Add determinant() function.
I wanted to use ._xy element access to make it shorter, but that attempt was crushed by the reality - such indexing apparently compiles but does not produce correct element access loads. I'm going to update once this is fixed.
Merge request reports
Activity
- Resolved by Nikolay Sivov
- Resolved by Nikolay Sivov
added 1 commit
- 7895d067 - vkd3d-shader/hlsl: Add determinant() function.
added 1 commit
- 14cac1b4 - vkd3d-shader/hlsl: Add determinant() function.
- Resolved by Nikolay Sivov
2883 if (type->class != HLSL_CLASS_SCALAR && type->class != HLSL_CLASS_MATRIX) 2884 { 2885 hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, "Invalid argument type."); 2886 return false; 2887 } 2888 2889 dim = min(type->dimx, type->dimy); 2890 if (dim == 1) 2891 { 2892 if (!(arg = intrinsic_float_convert_arg(ctx, params, arg, loc))) 2893 return false; 2894 return hlsl_add_load_component(ctx, params->instrs, arg, 0, loc); 2895 } 2896 2897 if (!(func = hlsl_compile_internal_function(ctx, "determinant", bodies[dim]))) 2898 return false; Yeah, it's quite unfortunate. Though notice that in !310 (comment 43922) a kind of solution was suggested for avoiding writing the type too many times. We might even introduce some helper doing
sprintf()
, compilation and memory handling all at once.I don't think I care enough on this question. It seems easy, but halves are indeed rarely used. We'll need to fix lit() though; I'll send a patch for that one.
If we really care about not specifying the printf argument multiple times, we can use something like [1] and [2]. I do worry though, since this means we're not using ANSI stdio anymore, and maybe that'll break something subtle.
Making sure I get this right. The proper solution would be to generate float vs half functions? For positional arguments we'll have a single "%1$s" format with a single typename argument?
Yes, that's what I would try. Zeb has some concerns about breaking something with her patch that plugs in
_vsprintf_p()
, though. I'm willing to take the risk, though, but she definitely knows better about these kind of issues than I do. We're probably waiting for 1.9 to be released anyway.
- Resolved by Nikolay Sivov
Also, could you please add a test like this one:
[pixel shader] float3x4 m; float4 main() : sv_target { return determinant(m); } [test] uniform 0 float4 1.0 2.0 3.0 0.0 uniform 4 float4 5.0 -6.0 7.0 0.0 uniform 8 float4 9.0 10.0 11.0 0.0 uniform 12 float4 0.0 0.0 0.0 0.0 draw quad probe all rgba (192.0, 192.0, 192.0, 192.0)
I.e., I want to check what happens for a non-square matrix whose smallest dimension is not 1.
Edited by Giovanni Mascellani
added 20 commits
-
14cac1b4...cab1f57e - 19 commits from branch
wine:master
- 8a91bdc7 - vkd3d-shader/hlsl: Add determinant() function.
-
14cac1b4...cab1f57e - 19 commits from branch
added 1 commit
- 8ed15e93 - vkd3d-shader/hlsl: Add determinant() function.
added 145 commits
-
8ed15e93...1006e8cb - 144 commits from branch
wine:master
- 849fd6bb - vkd3d-shader/hlsl: Add determinant() function.
-
8ed15e93...1006e8cb - 144 commits from branch
added 1 commit
- 267c09d0 - vkd3d-shader/hlsl: Add determinant() function.
I pushed an update that's using more compact matrix swizzle access, that was fixed since the initial version. I'll happily move this to position printf formatting, once it's merged from mentioned @zfigura's commits.
added 832 commits
-
267c09d0...edc8e38b - 831 commits from branch
wine:master
- 207c3c02 - vkd3d-shader/hlsl: Add determinant() function.
-
267c09d0...edc8e38b - 831 commits from branch
Friendly reminder that from my point of view this still needs to have
float
andhalf
variants depending on the argument type. I don't care too much about theprintf()
variant that is used, but I would like to seehalf
treated consistently with how we do in (most of) the rest of the HLSL compiler.
added 51 commits
-
207c3c02...a0d52dc3 - 50 commits from branch
wine:master
- ded722d5 - vkd3d-shader/hlsl: Add determinant() function.
-
207c3c02...a0d52dc3 - 50 commits from branch