diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 9502430ef5a..34c3f061a94 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -3668,10 +3668,10 @@ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader, if (args->super.srgb_correction) { shader_addline(buffer, "PARAM srgb_consts0 = "); - shader_arb_append_imm_vec4(buffer, wined3d_srgb_const0); + shader_arb_append_imm_vec4(buffer, &wined3d_srgb_const[0].x); shader_addline(buffer, ";\n"); shader_addline(buffer, "PARAM srgb_consts1 = "); - shader_arb_append_imm_vec4(buffer, wined3d_srgb_const1); + shader_arb_append_imm_vec4(buffer, &wined3d_srgb_const[1].x); shader_addline(buffer, ";\n"); } @@ -6371,10 +6371,10 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con if (settings->sRGB_write) { shader_addline(&buffer, "PARAM srgb_consts0 = "); - shader_arb_append_imm_vec4(&buffer, wined3d_srgb_const0); + shader_arb_append_imm_vec4(&buffer, &wined3d_srgb_const[0].x); shader_addline(&buffer, ";\n"); shader_addline(&buffer, "PARAM srgb_consts1 = "); - shader_arb_append_imm_vec4(&buffer, wined3d_srgb_const1); + shader_arb_append_imm_vec4(&buffer, &wined3d_srgb_const[1].x); shader_addline(&buffer, ";\n"); } diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 0f1a319872f..76c3f9fc99c 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -7701,10 +7701,10 @@ static GLuint shader_glsl_generate_fragment_shader(const struct wined3d_context_ if (args->srgb_correction) { shader_addline(buffer, "const vec4 srgb_const0 = "); - shader_glsl_append_imm_vec(buffer, wined3d_srgb_const0, 4, gl_info); + shader_glsl_append_imm_vec(buffer, &wined3d_srgb_const[0].x, 4, gl_info); shader_addline(buffer, ";\n"); shader_addline(buffer, "const vec4 srgb_const1 = "); - shader_glsl_append_imm_vec(buffer, wined3d_srgb_const1, 4, gl_info); + shader_glsl_append_imm_vec(buffer, &wined3d_srgb_const[1].x, 4, gl_info); shader_addline(buffer, ";\n"); } if (reg_maps->vpos || reg_maps->usesdsy) @@ -9555,10 +9555,10 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv * if (settings->sRGB_write) { shader_addline(buffer, "const vec4 srgb_const0 = "); - shader_glsl_append_imm_vec(buffer, wined3d_srgb_const0, 4, gl_info); + shader_glsl_append_imm_vec(buffer, &wined3d_srgb_const[0].x, 4, gl_info); shader_addline(buffer, ";\n"); shader_addline(buffer, "const vec4 srgb_const1 = "); - shader_glsl_append_imm_vec(buffer, wined3d_srgb_const1, 4, gl_info); + shader_glsl_append_imm_vec(buffer, &wined3d_srgb_const[1].x, 4, gl_info); shader_addline(buffer, ";\n"); } diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 4961dca1ce0..3b9a96abc69 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -32,10 +32,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); -/* pow, mul_high, sub_high, mul_low */ -const float wined3d_srgb_const0[] = {0.41666f, 1.055f, 0.055f, 12.92f}; -/* cmp */ -const float wined3d_srgb_const1[] = {0.0031308f, 0.0f, 0.0f, 0.0f}; +const struct wined3d_vec4 wined3d_srgb_const[] = +{ + /* pow, mul_high, sub_high, mul_low */ + {0.41666f, 1.055f, 0.055f, 12.92f}, + /* cmp */ + {0.0031308f, 0.0f, 0.0f, 0.0f}, +}; static const char * const shader_opcode_names[] = { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 68250f0be38..e5d52ea38f8 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1482,17 +1482,16 @@ static inline void wined3d_color_from_d3dcolor(struct wined3d_color *wined3d_col wined3d_color->a = D3DCOLOR_B_A(d3d_color) / 255.0f; } -extern const float wined3d_srgb_const0[] DECLSPEC_HIDDEN; -extern const float wined3d_srgb_const1[] DECLSPEC_HIDDEN; +extern const struct wined3d_vec4 wined3d_srgb_const[] DECLSPEC_HIDDEN; static inline float wined3d_srgb_from_linear(float colour) { if (colour < 0.0f) return 0.0f; - if (colour < wined3d_srgb_const1[0]) - return colour * wined3d_srgb_const0[3]; + if (colour < wined3d_srgb_const[1].x) + return colour * wined3d_srgb_const[0].w; if (colour < 1.0f) - return wined3d_srgb_const0[1] * powf(colour, wined3d_srgb_const0[0]) - wined3d_srgb_const0[2]; + return wined3d_srgb_const[0].y * powf(colour, wined3d_srgb_const[0].x) - wined3d_srgb_const[0].z; return 1.0f; }