- Posts: 154
condition with float constant return always false
- seri14
-
Topic Author
- Offline
Less More
3 years 2 months ago #1 by seri14
condition with float constant return always false was created by seri14
Input codeResult (from [Show HLSL/GLSL])
void test()
{
float R;
const float V = 10.0;
if (V > 1.0)
R = 1.0;
}
#line 63
void F__test()
{
const float _74 = 0.00000000;
#line 65
float R;
#line 65
R = _74;
const bool _79 = false;
#line 67
if (_79)
{
const float _80 = 1.00000000;
#line 68
R = _80;
}
return;
}
The following user(s) said Thank You: Wicked Sick
Please Log in or Create an account to join the conversation.
- crosire
-
- Offline
Less More
- Posts: 3990
3 years 2 months ago #2 by crosire
Replied by crosire on topic condition with float constant return always false
Whoops! Fixed: github.com/crosire/reshade/commit/8809f0...2d1b00f89fb1ec12a00c.
The following user(s) said Thank You: Wicked Sick, seri14
Please Log in or Create an account to join the conversation.
- seri14
-
Topic Author
- Offline
Less More
- Posts: 154
3 years 2 months ago - 3 years 2 months ago #3 by seri14
Replied by seri14 on topic condition with float constant return always false
After this commit, compile of some effects will fail.
github.com/Mortalitas/GShade-Shaders/blo...haders/MagicBloom.fx
github.com/Mortalitas/GShade-Shaders/blo...aders/qUINT_bloom.fx
github.com/Mortalitas/GShade-Shaders/blo...ers/qUINT_common.fxh
github.com/Mortalitas/GShade-Shaders/blo...haders/MagicBloom.fx
github.com/Mortalitas/GShade-Shaders/blo...aders/qUINT_bloom.fx
github.com/Mortalitas/GShade-Shaders/blo...ers/qUINT_common.fxh
2019-03-21T13:14:33:124 [12608] | ERROR | Failed to compile "C:\...\reshade-shaders\Shaders\MagicBloom.fx":
C:\...\reshade-shaders\Shaders\MagicBloom.fx(91, 34): error X3082: int or unsigned int type required
C:\...\reshade-shaders\Shaders\MagicBloom.fx(91, 122): error X3000: syntax error: unexpected '|', expected expression
C:\...\reshade-shaders\Shaders\MagicBloom.fx(193, 10): error X3011: value must be a literal expression
C:\...\reshade-shaders\Shaders\MagicBloom.fx(216, 109): error X3538: value must be a literal scalar expression
2019-03-21T13:14:33:243 [15272] | ERROR | Failed to compile "C:\...\reshade-shaders\Shaders\qUINT_bloom.fx":
C:\...\reshade-shaders\Shaders\qUINT_bloom.fx(136, 43): error X3082: int or unsigned int type required
C:\...\reshade-shaders\Shaders\qUINT_bloom.fx(136, 113): error X3000: syntax error: unexpected '|', expected expression
C:\...\reshade-shaders\Shaders\qUINT_bloom.fx(145, 100): error X3538: value must be a literal scalar expression
Last edit: 3 years 2 months ago by seri14.
The following user(s) said Thank You: Wicked Sick
Please Log in or Create an account to join the conversation.
- crosire
-
- Offline
Less More
- Posts: 3990
3 years 2 months ago #4 by crosire
Replied by crosire on topic condition with float constant return always false
The following user(s) said Thank You: Wicked Sick, seri14, Marot
Please Log in or Create an account to join the conversation.
- thrive4
-
- Offline
Less More
- Posts: 10
3 years 1 month ago #5 by thrive4
Replied by thrive4 on topic condition with float constant return always false
Great catch!
But I'm a bit stumped, and I do hate doing the why would
you do this, but I really would like to know under which
condition you would set up code this way?
const float V = 10.0;
if (V > 1.0)
V is always going to be larger then 1.0....
But I'm a bit stumped, and I do hate doing the why would
you do this, but I really would like to know under which
condition you would set up code this way?
const float V = 10.0;
if (V > 1.0)
V is always going to be larger then 1.0....

Please Log in or Create an account to join the conversation.
- klotim
-
- Offline
Less More
- Posts: 202
3 years 1 month ago #6 by klotim
Why yes ofc. But that's just to easily provide that something doesn't work.
In real-life scenarios it would be dynamic variables.
Replied by klotim on topic condition with float constant return always false
Great catch!
But I'm a bit stumped, and I do hate doing the why would
you do this, but I really would like to know under which
condition you would set up code this way?
const float V = 10.0;
if (V > 1.0)
V is always going to be larger then 1.0....
Why yes ofc. But that's just to easily provide that something doesn't work.
In real-life scenarios it would be dynamic variables.
Please Log in or Create an account to join the conversation.
- crosire
-
- Offline
Less More
- Posts: 3990
3 years 1 month ago #7 by crosire
Replied by crosire on topic condition with float constant return always false
Nah. Dynamic variables worked fine. This was a very specific case. But can happen when you are debugging with constants to check if a certain code path is working for example.
Please Log in or Create an account to join the conversation.
- klotim
-
- Offline
Less More
- Posts: 202
3 years 1 month ago #8 by klotim
Alright, Glad that it was solved!
Replied by klotim on topic condition with float constant return always false
Nah. Dynamic variables worked fine. This was a very specific case. But can happen when you are debugging with constants to check if a certain code path is working for example.
Alright, Glad that it was solved!
Please Log in or Create an account to join the conversation.
- thrive4
-
- Offline
Less More
- Posts: 10
3 years 1 month ago #9 by thrive4
Replied by thrive4 on topic condition with float constant return always false
Ok, a debugging method thanks for the explanation.
Please Log in or Create an account to join the conversation.