Welcome, Guest.
Username: Password: Remember me

TOPIC: Shader works on OpenGL but not on DirectX

Shader works on OpenGL but not on DirectX 3 years 1 month ago #1

Can someone help me?
So , a friend did a shader for me, it works fine on OpenGL, but gives warnings (or errors if it doesn't compile) on D3D.

I suspect of the float4 origcolors on some of the passes are the ones that gives errors, but since I have no experience with HLSL, I couldn't fix it, hence why I'm asking for someone to fix it for me.

The errors it gives are:

C:\TmUnitedForever\Shader@0x222B5018(80,1): warning X4008: floating point division by zero
C:\TmUnitedForever\Shader@0x222B5018(80,73): warning X4008: floating point division by zero (Yellow if the shader compiles, red when it fails)

C:\TmUnitedForever\Shader@0x0AD7F470(83,5): error X3017: cannot implicitly convert from 'const float2' to 'float4' (Red, only happens if the TapeNoise, DirtyCRT or the VCR pass is enabled and only in D3D)

The shader code is here : pastebin.com/kz9atkUt

I don't mind the warnings but I would love to see it compile when the other passes are enabled.

Oh, also, is there a say to slow the timer? It makes parts of the shader work too fast.
The administrator has disabled public write access.

Shader works on OpenGL but not on DirectX 3 years 1 month ago #2

Those are internal errors, after ReShade compiled the shader to HLSL code. Could you create a tracelog and post a link to it here? It contains the generated HLSL code.
Cheers, crosire =)
The administrator has disabled public write access.

Shader works on OpenGL but not on DirectX 3 years 1 month ago #3

crosire wrote:
Those are internal errors, after ReShade compiled the shader to HLSL code. Could you create a tracelog and post a link to it here? It contains the generated HLSL code.

Sure, imma post it later (not in a PC ATM).
The administrator has disabled public write access.

Shader works on OpenGL but not on DirectX 3 years 1 month ago #4

matsilagi wrote:
crosire wrote:
Those are internal errors, after ReShade compiled the shader to HLSL code. Could you create a tracelog and post a link to it here? It contains the generated HLSL code.

Sure, imma post it later (not in a PC ATM).

Here's the Tracelog: pastebin.com/HVR21LU4
The administrator has disabled public write access.

Shader works on OpenGL but not on DirectX 3 years 1 month ago #5

Replace line 269:
uv = floor(uv.xy*RFX_ScreenSize.xy/one_y)*one_y;
with the following:
uv.xy = floor(uv.xy*RFX_ScreenSize.xy/one_y)*one_y;
Cheers, crosire =)
The administrator has disabled public write access.
The following user(s) said Thank You: matsilagi, Iddqd

Shader works on OpenGL but not on DirectX 3 years 1 month ago #6

crosire wrote:
Replace line 269:
uv = floor(uv.xy*RFX_ScreenSize.xy/one_y)*one_y;
with the following:
uv.xy = floor(uv.xy*RFX_ScreenSize.xy/one_y)*one_y;
Thanks, now imma enable the rest to see if there's any other bugs.
Last Edit: 3 years 1 month ago by matsilagi.
The administrator has disabled public write access.

Shader works on OpenGL but not on DirectX 3 years 1 month ago #7

Ok, second tracelog, this time for the VCRDistort effect.
After this one, there's just 1 more that doesn't compile.

pastebin.com/7aiW1YEe
Errors are:
B:\ReShade Framework 1.0.0\Shader@0x10298648(76,21): error X3013: 'tex2Dlod': intrinsic function does not take 2 parameters
B:\ReShade Framework 1.0.0\Shader@0x10298648(76,21): error X3013: Possible intrinsic functions are:
B:\ReShade Framework 1.0.0\Shader@0x10298648(76,21): error X3013: tex2Dlod(sampler2D, float4)
B:\ReShade Framework 1.0.0\Shader@0x10298648(74,13): warning X3206: '_NSnn': implicit truncation of vector type

Aand the last one: pastebin.com/Q2iQ1eTM

Errors are:
B:\ReShade Framework 1.0.0\Shader@0x1034A428(69,16): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
B:\ReShade Framework 1.0.0\Shader@0x1034A428(69,58): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
B:\ReShade Framework 1.0.0\Shader@0x1034A428(86,10): error X4000: variable 'color' used without having been completely initialized
B:\ReShade Framework 1.0.0\Shader@0x104B59C0(74,13): warning X3206: '_NSnn': implicit truncation of vector type
Last Edit: 3 years 1 month ago by matsilagi.
The administrator has disabled public write access.

Shader works on OpenGL but not on DirectX 3 years 1 month ago #8

Line 462 from:
float4 color;
to:
float4 color = float4(0, 0, 0, 0);

Line 336 from:
float4 origcolor3=tex2Dlod(RFX_backbufferColor, texcoord);
to:
float4 origcolor3=tex2Dlod(RFX_backbufferColor, float4(texcoord, 0, 0));
Cheers, crosire =)
Last Edit: 3 years 1 month ago by crosire.
The administrator has disabled public write access.
The following user(s) said Thank You: matsilagi, Iddqd

Shader works on OpenGL but not on DirectX 3 years 1 month ago #9

crosire wrote:
Line 462 from:
float4 color;
to:
float4 color = float4(0, 0, 0, 0);

Line 336 from:
float4 origcolor3=tex2Dlod(RFX_backbufferColor, texcoord);
to:
float4 origcolor3=tex2Dlod(RFX_backbufferColor, float4(texcoord, 0, 0));

Cool, now only the VCRDistort pass needs fixes, this worked and DirtyCRT is now fixed
Last Edit: 3 years 1 month ago by matsilagi.
The administrator has disabled public write access.

Shader works on OpenGL but not on DirectX 3 years 1 month ago #10

Apparently my tracelog for the VCR one was wrong yesterday, here's the correct one: pastebin.com/ewRNThWs
The administrator has disabled public write access.