vkd3d-shader/hlsl: Add missing src1 and src2 constants to sincos on SM2.
1 unresolved thread
1 unresolved thread
The sincos instruction expects two specific constants on 2.0 and 2.1 profiles.
Consider the following shader:
uniform float u;
float4 main() : sv_target
{
return sin(u);
}
On native, with ps_2_0, this compiles as:
ps_2_0
def c3, 0.159154937, 0.5, 6.28318548, -3.14159274
def c1, -1.55009923e-006, -2.17013894e-005, 0.00260416674, 0.00026041668
def c2, -0.020833334, -0.125, 1, 0.5
mov r0.xy, c3
mad r0.x, c0.x, r0.x, r0.y
frc r0.x, r0.x
mad r0.x, r0.x, c3.z, c3.w
sincos r1.y, r0.x, c1, c2
mov r0, r1.y
mov oC0, r0
We are not emitting the src1 and src2 constant arguments of sincos (c1 and c2 on this compilation) before this patch.
Edited by Francisco Casas
Merge request reports
Activity
+ ctx->d3dsincosconst1 = allocate_numeric_registers_for_type(ctx, allocator, 1, UINT_MAX, type); + TRACE("Allocated D3DSINCOSCONST1 to %s.\n", debug_register('c', ctx->d3dsincosconst1, type)); + record_constant(ctx, ctx->d3dsincosconst1.id * 4 + 0, -1.5500992e-006f); + record_constant(ctx, ctx->d3dsincosconst1.id * 4 + 1, -2.1701389e-005f); + record_constant(ctx, ctx->d3dsincosconst1.id * 4 + 2, 0.0026041667f); + record_constant(ctx, ctx->d3dsincosconst1.id * 4 + 3, 0.00026041668f); + + ctx->d3dsincosconst2 = allocate_numeric_registers_for_type(ctx, allocator, 1, UINT_MAX, type); + TRACE("Allocated D3DSINCOSCONST2 to %s.\n", debug_register('c', ctx->d3dsincosconst2, type)); + record_constant(ctx, ctx->d3dsincosconst2.id * 4 + 0, -0.020833334f); + record_constant(ctx, ctx->d3dsincosconst2.id * 4 + 1, -0.12500000f); + record_constant(ctx, ctx->d3dsincosconst2.id * 4 + 2, 1.0f); + record_constant(ctx, ctx->d3dsincosconst2.id * 4 + 3, 0.50000000f);
The formatting of the constants is oddly inconsistent. I suppose they're listed that way on MSDN, among other places, but could we do better?
added 1 commit
- 4c04b1b6 - vkd3d-shader/hlsl: Add missing src1 and src2 constants to sincos on SM2.
added 34 commits
-
4c04b1b6...9f4a5688 - 33 commits from branch
wine:master
- e6e82ad3 - vkd3d-shader/hlsl: Add missing src1 and src2 constants to sincos on SM2.
-
4c04b1b6...9f4a5688 - 33 commits from branch
Please register or sign in to reply