bjoern
July 5, 2023, 9:39am
#1
Shader looks like this:
shader Invert_Advanced_Internal_ShaderFX : ComputeFloat4, InvertOperations
{
[Default(0.0, 0.0, 0.0, 1.0)]
compose ComputeFloat4 ColorIn;
[Default(1.0)]
compose ComputeFloat Factor;
bool InvertAlpha = false;
int InvertType;
override float4 Compute()
{
return Invert(ColorIn.Compute(), Factor.Compute(), InvertAlpha, InvertType);
}
};
When I change InvertType in the patch it does not update in the shader, no matter if I use an enum, Enum2Ord or an integer directly.
It works though if the int is changed inside the code, for example by setting a default, like so:
int InvertType = 2;
Same thing as TextureFX works without problems.
shader Invert_Internal_TextureFX : FilterBase, InvertOperations
{
[Default(1.0)]
compose ComputeFloat Factor;
bool InvertAlpha = false;
int InvertType;
float4 Filter(float4 tex0col)
{
return Invert(tex0col, Factor.Compute(), InvertAlpha, InvertType);
}
};
SFX-Int.7z (33.3 KB)
Do other types work, like float and bool? Or is this a general thing for uniform inputs?
Made an issue for it:
opened 10:01AM - 05 Jul 23 UTC
VL.Stride
**Describe the bug**
https://discourse.vvvv.org/t/integer-input-of-shaderfx-doe… s-not-update/21635
It looks like the shader sink that builds the shader doesn't get the shader key/name for the pin of that ShaderFX node. This also happens when using ShaderFX nodes with MaterialExtension.
Example patch in the forums thread.
**Is there an earlier version where this still works?**
maybe, hard to find out.
**Additional context**
Might be related to other pin issues #75 #72 #70.
1 Like
bjoern
July 5, 2023, 11:33am
#3
Also happens with float and bool.
SFX-Float-Bool.7z (3.0 KB)
1 Like
It works if you add the stage
keyword, but then you can only have one instance of a node per shader graph. because stage
makes sure there is only one variable of that name per compiled shader.
The original ShaderFX Lerp doesn’t have this issue, so it is definitely some bug with the shader key management.
bjoern
July 5, 2023, 12:02pm
#6
What counts as one graph in this context?
Like so, And B wouldn’t work when Switch uses the stage
keyword?
Yes, a graph is all nodes that are part of one final shader. B would be compiled, but the Condition input would only exist once in the shader and therefore the last change would set both switches.