Bug 96903 - Hoard renders thick white fog
Summary: Hoard renders thick white fog
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-12 16:09 UTC by Béla Gyebrószki
Modified: 2018-04-13 11:34 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
screenshot (42.87 KB, image/jpeg)
2016-07-12 16:09 UTC, Béla Gyebrószki
Details

Description Béla Gyebrószki 2016-07-12 16:09:18 UTC
Created attachment 125033 [details]
screenshot

I'm running the game Hoard in Wine.
The splash screen/loading screen is displayed properly, but once the game is loaded, I can only see the menu buttons because the screen is covered with white "fog". This happens when the game option "Graphics quality" is set to 'high'. Using 'low' setting the game renders properly.

The problem is present with the software renderer, too (LIBGL_ALWAYS_SOFTWARE=1)
Nvidia binary driver doesn't have this bug.

Trace file (uncompressed 43M):
https://drive.google.com/open?id=0B-tTbLKBl-tONnZBQlh4dVhqNUE

Fedora 24
Kernel 4.7.0-rc6
Libdrm 2.4.68+git
OpenGL vendor string: nouveau
OpenGL renderer string: Gallium 0.4 on NV106
OpenGL core profile version string: 4.3 (Core Profile) Mesa 12.1.0-devel (git-6624174)
OpenGL core profile shading language version string: 4.30
Comment 1 Ilia Mirkin 2016-07-12 16:28:00 UTC
From the trace:

"""
16981 glCreateShader(type = GL_FRAGMENT_SHADER) = 12
16982 glShaderSource(shader = 12, count = 1, string = &"//!!FS
// ======================= Begin fragment shader program ===================================
uniform sampler2D Tex0;
uniform sampler2D Tex1;

vec2 encodeNormal(vec3 n)
{
    float p = sqrt(n.z * 8.0 + 8.0);
    return vec2(n.xy / p + 0.5);
}

vec2 encodeColor(vec3 rgb24)
{
        rgb24 *= 255.0f;
        // nvidia int3 rgb16 = rgb24 / int3(8,4,8);
        ivec3 rgb16 = ivec3(rgb24) / ivec3(8,4,8);
        float greenSplit = rgb16.g / 8.0f;
        vec2 stuff;
        stuff.x = rgb16.r * 8 + floor(greenSplit);
        // nvidia stuff.y = frac(greenSplit) * 256 + rgb16.b; 
        stuff.y = fract(greenSplit) * 256 + rgb16.b;
        stuff /= 255.0f;
        return stuff;
}

void main(void)
{
        vec4 tex0 = texture2D(Tex0,gl_TexCoord[0].st);

    if(tex0.a < 0.5)
    {
                discard;
    }

    gl_FragColor = vec4(encodeColor(tex0.rgb * gl_Color.rgb),encodeNormal(gl_TexCoord[2].xyz));
}

// ======================= End fragment shader program ===================================
", length = NULL)
16983 glCompileShader(shader = 12)
16984 glGetShaderiv(shader = 12, pname = GL_INFO_LOG_LENGTH, params = &580)
16985 glGetShaderInfoLog(shader = 12, bufSize = 581, length = NULL, infoLog = "0:14(11): warning: Float suffixes are invalid in GLSL 1.10
0:17(31): warning: Float suffixes are invalid in GLSL 1.10
0:22(11): warning: Float suffixes are invalid in GLSL 1.10
0:17(21): error: could not implicitly convert operands to arithmetic operator
0:19(32): warning: `greenSplit' used uninitialized
0:19(12): error: could not implicitly convert operands to arithmetic operator
0:21(18): warning: `greenSplit' used uninitialized
0:21(12): error: could not implicitly convert operands to arithmetic operator
0:21(12): error: operands to arithmetic operators must be numeric
")
"""

I tried running it with force_glsl_version=130 -- that seems to help with st/mesa, but it doesn't appear to be hooked up for i965 (??? it used to be! it hought...)

I'm not sure when float <-> int autoconversion was added, maybe in 1.20? But it also uses textureSize, which was only added in 1.30.
Comment 2 Ilia Mirkin 2016-07-21 16:36:40 UTC
BTW, I believe the correct solution here is to add a "force_glsl_version" option to drirc. Should be easy to do with the executable name (hopefully it's not "wine"). Can you test adding something like

        <application name="Hard" executable="Hoard">
            <option name="force_glsl_version" value="130"/>
        </application>

into an appropriate place in your drirc? Probably have to play around with the executable. You can also just stick that into the environment.
Comment 3 Kenneth Graunke 2016-07-26 07:32:06 UTC
Not to ask a stupid question, but...why are you running this in Wine?  There's a native Linux version of the game which renders correctly without any workarounds, at least on i965.
Comment 4 Béla Gyebrószki 2016-07-26 14:26:53 UTC
(In reply to Kenneth Graunke from comment #3)
> Not to ask a stupid question, but...why are you running this in Wine? 
> There's a native Linux version of the game which renders correctly without
> any workarounds, at least on i965.

Yes, I know that the native Linux version runs properly on Mesa.
I just thought it was worth noting that this bug still exists under Wine (I observed this bug over a year ago but didn't bother reporting it).


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.