Fixing shaders for 4.0
- matsilagi
- Topic Author
Less
More
Hi.
I have some old shaders which are giving me errors, despite themn working fine on pre-4.0 ReShade
The error most of them gives me is: "value must be a literal scalar expression"
As an example, here is the troubling line on one of the shaders:
Those values are defined as following:
How do i fix that? Its the error that old shaders are most giving to me, and i need the code / values to be done on that specific way for it to work correctly.
I'll post again if there are more errors and after i get help with those.
Full code is available on one of my githubs (The Unity one), im pretty sure its an easy fix, but i have no idea on how to fix it.
I have some old shaders which are giving me errors, despite themn working fine on pre-4.0 ReShade
The error most of them gives me is: "value must be a literal scalar expression"
As an example, here is the troubling line on one of the shaders:
texture2D _TapeTex { Width = TEXWIDTH; Height = TEXHEIGHT; Format = RGBA8; };
Those values are defined as following:
#define TEXHEIGHT int(min(noiseLinesRes, screenLinesRes))
#define TEXWIDTH int(((float)TEXHEIGHT*(float)BUFFER_WIDTH/(float)BUFFER_HEIGHT))
How do i fix that? Its the error that old shaders are most giving to me, and i need the code / values to be done on that specific way for it to work correctly.
I'll post again if there are more errors and after i get help with those.
Full code is available on one of my githubs (The Unity one), im pretty sure its an easy fix, but i have no idea on how to fix it.
Please Log in or Create an account to join the conversation.
- seri14
Less
More
5 years 2 months ago - 5 years 2 months ago #2
by seri14
Replied by seri14 on topic Fixing shaders for 4.0
replace TEXHEIGHT to 240.
Last edit: 5 years 2 months ago by seri14.
Please Log in or Create an account to join the conversation.
I tried but it only made stuff worse, it now gives lots of different errors.
It worked fine on ReShade 3.X, but on 4.X, the new compiler doesn't like those too much.
It worked fine on ReShade 3.X, but on 4.X, the new compiler doesn't like those too much.
Please Log in or Create an account to join the conversation.
- crosire
Less
More
5 years 2 months ago - 5 years 2 months ago #4
by crosire
Replied by crosire on topic Fixing shaders for 4.0
The new compiler does not accept intrinsic functions inside literal expressions. This was an active design decision to simplify code. You are using the "min" function, which is not allowed in this context. Only basic operations like "+ - * /" and casting is allowed to compute constant values (and the "Width", "Height" etc. properties expect constant values).
Last edit: 5 years 2 months ago by crosire.
The following user(s) said Thank You: BeTa
Please Log in or Create an account to join the conversation.
- Marty McFly
Less
More
I solved it for him already, did the min with bitwise.
The following user(s) said Thank You: BeTa
Please Log in or Create an account to join the conversation.
- Mynameislol
Less
More
Could you share the fixed result? I am trying to fix the same VHSPRO fx for 4.3
Please Log in or Create an account to join the conversation.
- Bapho
Less
More
VHSPro.fx is fixed:
github.com/Bapho/reshade-shaders/blob/master/Shaders/VHSPro.fx
github.com/Bapho/reshade-shaders/blob/master/Shaders/VHSPro.fx
Please Log in or Create an account to join the conversation.