Skip to content

wined3d: Initialise GLSL outputs to avoid nVidia warning

David Gow requested to merge sulix/wine:nvglslwarn into master

nVidia's GLSL compiler spits out a warning if a value is potentially used without being initialized. This affects many of wined3d's GLSL shaders, as either some element of the (e.g.) vs_out array are not initialized, or individual vector components remain unwritten to.

As a quick way of working around this, initialize all vs_out, gs_out, and temporary Rn registers to vec4(0,0,0,0). This gets rid of all of the warnings in the cases I tried.

(A more complete solution would probably track if we're initialising these, and only add what is required. Or would just disable the warning somehow.)

Some example warnings (from a shader in the 'Pharaoh: A New Era' demo):

0264:fixme:d3d_shader:print_glsl_info_log Info log received from GLSL shader #3:
0264:fixme:d3d_shader:print_glsl_info_log     Vertex info
0264:fixme:d3d_shader:print_glsl_info_log     -----------
0264:fixme:d3d_shader:print_glsl_info_log     0(28) : warning C7050: "vs_out[2].zw" might be used before being initialized
0264:fixme:d3d_shader:print_glsl_info_log     0(28) : warning C7050: "vs_out[5].w" might be used before being initialized
0264:fixme:d3d_shader:print_glsl_info_log     0(28) : warning C7050: "vs_out[7]" might be used before being initialized
0264:fixme:d3d_shader:print_glsl_info_log     0(28) : warning C7050: "vs_out[8]" might be used before being initialized
0264:fixme:d3d_shader:print_glsl_info_log     0(28) : warning C7050: "vs_out[9]" might be used before being initialized
0264:fixme:d3d_shader:print_glsl_info_log     0(28) : warning C7050: "vs_out[10]" might be used before being initialized
0264:fixme:d3d_shader:print_glsl_info_log     0(28) : warning C7050: "vs_out[11]" might be used before being initialized
0264:fixme:d3d_shader:print_glsl_info_log     0(28) : warning C7050: "vs_out[12]" might be used before being initialized
0264:fixme:d3d_shader:print_glsl_info_log     0(28) : warning C7050: "vs_out[13]" might be used before being initialized
0264:fixme:d3d_shader:print_glsl_info_log     0(28) : warning C7050: "vs_out[14]" might be used before being initialized
0264:fixme:d3d_shader:print_glsl_info_log     0(28) : warning C7050: "vs_out[15]" might be used before being initialized

Merge request reports

Loading