Why static constants gives me comp error?

  • v00d00m4n
  • Topic Author
More
6 years 1 month ago #1 by v00d00m4n Why static constants gives me comp error? was created by v00d00m4n
What is wrong with this code? Why it gives me compilation errors like x3011 - initial value must be literal expression ?
// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
static const float3x3 ACESInputMat =
{
    {0.59719, 0.35458, 0.04823},
    {0.07600, 0.90834, 0.01566},
    {0.02840, 0.13383, 0.83777}
};

// ODT_SAT => XYZ => D60_2_D65 => sRGB
static const float3x3 ACESOutputMat =
{
    { 1.60475, -0.53108, -0.07367},
    {-0.10208,  1.10813, -0.00605},
    {-0.00327, -0.07276,  1.07602}
};

float3 RRTAndODTFit(float3 v)
{
    float3 a = v * (v + 0.0245786f) - 0.000090537f;
    float3 b = v * (0.983729f * v + 0.4329510f) + 0.238081f;
    return a / b;
}

float3 ACESFitted(float3 color)
{
    color = mul(ACESInputMat, color);

    // Apply RRT and ODT
    color = RRTAndODTFit(color);

    color = mul(ACESOutputMat, color);

    // Clamp to [0, 1]
    color = saturate(color);

    return color;
}

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

  • crosire
More
6 years 1 month ago #2 by crosire Replied by crosire on topic Why static constants gives me comp error?
ReShade FX does not support the initializer list syntax. Do this instead:
static const float3x3 ACESOutputMat = float3x3(1.60475, ...);

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

  • Fu-Bama
More
6 years 1 month ago #3 by Fu-Bama Replied by Fu-Bama on topic Why static constants gives me comp error?
Is it possible to do the same with array?
static const float Weight[11] =
{
	0.082607,
	0.080977,
	0.076276,
	0.069041,
	0.060049,
	0.050187,
	0.040306,
	0.031105,
	0.023066,
	0.016436,
	0.011254
};

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

  • crosire
More
6 years 1 month ago - 6 years 1 month ago #4 by crosire Replied by crosire on topic Why static constants gives me comp error?
Nope. The constant folder doesn't understand arrays right now, so constant global arrays are not possible. You can however define a constant array locally inside a function scope (drop the "static" keyword in that case too).
Last edit: 6 years 1 month ago by crosire.

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.