vkd3d-shader: Add constant folding for the 'dot' operation.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Merge request reports
Activity
- Resolved by Nikolay Sivov
294 294 return true; 295 295 } 296 296 297 static bool fold_dot(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, 298 const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2) 299 { 300 enum hlsl_base_type type = dst_type->base_type; 301 unsigned int k; 302 303 assert(type == src1->node.data_type->base_type); 304 assert(type == src2->node.data_type->base_type); 305 assert(src1->node.data_type->dimx == src2->node.data_type->dimx); 306 assert(type == HLSL_TYPE_FLOAT || type == HLSL_TYPE_HALF); This is not wrong, given that at this point all dot operations on other types should already have been lowered, but it is inconsistent with the other operations, for which unknown types are just logged with
FIXME()
and ignored. I think it should be better to do the same here, so in case this pass is used in other places thanhlsl_emit_bytecode()
we don'tassert()
for no real reason.changed this line in version 3 of the diff
Thanks, that's ok for me. Notice that we're not dealing with a lot of complications that come with floating point numbers. For example, SM1-3 doesn't allow infinities or NaNs (AFAIU), so I'm not sure of what should happen if the dot folding results in one of those. However, most of the constant folding code doesn't care, so I'm ignoring the issue for the time being.
Also, we usually keep
switch
cases separated with newlines.
added 143 commits
-
7bbe05a9...f95ab2a5 - 141 commits from branch
wine:master
- 44163eda - vkd3d-shader: Add constant folding for the 'dot' operation.
- 5e4a481f - vkd3d-shader: Add constant folding for 'dp2add' operation.
-
7bbe05a9...f95ab2a5 - 141 commits from branch
added 40 commits
-
5e4a481f...5d75731d - 38 commits from branch
wine:master
- 6e21b657 - vkd3d-shader: Add constant folding for the 'dot' operation.
- eade61d1 - vkd3d-shader: Add constant folding for 'dp2add' operation.
-
5e4a481f...5d75731d - 38 commits from branch
added 14 commits
-
eade61d1...983d01df - 12 commits from branch
wine:master
- 25ff5676 - vkd3d-shader: Add constant folding for the 'dot' operation.
- 7e99188d - vkd3d-shader: Add constant folding for 'dp2add' operation.
-
eade61d1...983d01df - 12 commits from branch