Integer input of ShaderFX does not update

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:

1 Like

Also happens with float and bool.

image

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.

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.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.