Shader works on OpenGL but not on DirectX

  • matsilagi
  • Topic Author
More
10 years 2 months ago #1 by matsilagi Shader works on OpenGL but not on DirectX was created by matsilagi
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.

Please Log in or Create an account to join the conversation.

  • crosire
More
10 years 2 months ago #2 by crosire Replied by crosire on topic Shader works on OpenGL but not on DirectX
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.

Please Log in or Create an account to join the conversation.

  • matsilagi
  • Topic Author
More
10 years 2 months ago #3 by matsilagi Replied by matsilagi on topic Shader works on OpenGL but not on DirectX

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).

Please Log in or Create an account to join the conversation.

  • matsilagi
  • Topic Author
More
10 years 2 months ago #4 by matsilagi Replied by matsilagi on topic Shader works on OpenGL but not on DirectX

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

Please Log in or Create an account to join the conversation.

  • crosire
More
10 years 2 months ago #5 by crosire Replied by crosire on topic Shader works on OpenGL but not on DirectX
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;
The following user(s) said Thank You: matsilagi, Iddqd

Please Log in or Create an account to join the conversation.

  • matsilagi
  • Topic Author
More
10 years 2 months ago - 10 years 2 months ago #6 by matsilagi Replied by matsilagi on topic Shader works on OpenGL but not on DirectX

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: 10 years 2 months ago by matsilagi.

Please Log in or Create an account to join the conversation.

  • matsilagi
  • Topic Author
More
10 years 2 months ago - 10 years 2 months ago #7 by matsilagi Replied by matsilagi on topic Shader works on OpenGL but not on DirectX
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: 10 years 2 months ago by matsilagi.

Please Log in or Create an account to join the conversation.

  • crosire
More
10 years 2 months ago - 10 years 2 months ago #8 by crosire Replied by crosire on topic Shader works on OpenGL but not on DirectX
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));
Last edit: 10 years 2 months ago by crosire.
The following user(s) said Thank You: matsilagi, Iddqd

Please Log in or Create an account to join the conversation.

  • matsilagi
  • Topic Author
More
10 years 2 months ago - 10 years 2 months ago #9 by matsilagi Replied by matsilagi on topic Shader works on OpenGL but not on DirectX

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: 10 years 2 months ago by matsilagi.

Please Log in or Create an account to join the conversation.

  • matsilagi
  • Topic Author
More
10 years 2 months ago #10 by matsilagi Replied by matsilagi on topic Shader works on OpenGL but not on DirectX
Apparently my tracelog for the VCR one was wrong yesterday, here's the correct one: pastebin.com/ewRNThWs

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.