Bug 43125

Summary: [bisected] Start screen in Amnesia too dark after "Rewrite the way uniforms are tracked and handled" commit
Product: Mesa Reporter: Jure Repinc <jlp.bugs>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: pavel.ondracka
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
URL: http://www.amnesiagame.com/#demo
Whiteboard:
i915 platform: i915 features:
Attachments: amnesia-bad.png
amnesia-good.png

Description Jure Repinc 2011-11-20 19:36:26 UTC
I have a laptop with ATI Technologies Inc Manhattan [Mobility Radeon HD 5400 Series] graphics card and using the r600g driver from mesa. The kernel is Linux 3.2-rc1.

When I start the game of Amnesia - The Dark Descent it offers me a screen where I can select a profile to play with. This screen is too dark in latest git checkouts. I did a bisection and this commit was pointed out as problematic:
719909698c67c287a393d2380278e7b7495ae018 
    mesa: Rewrite the way uniforms are tracked and handled
    
    Switch all of the code in ir_to_mesa, st_glsl_to_tgsi, glUniform*,
    glGetUniform, glGetUniformLocation, and glGetActiveUniforms to use the
    gl_uniform_storage structures in the gl_shader_program.
    
    A couple of notes:
    
     * Like most rewrite-the-world patches, this should be reviewed by
       applying the patch and examining the modified functions.
    
     * This leaves a lot of dead code around in linker.cpp and
       uniform_query.cpp.  This will be deleted in the next patches.
    
    v2: Update the comment block (previously a FINISHME) in _mesa_uniform
    about generating GL_INVALID_VALUE when an out-of-range sampler index
    is specified.
Comment 1 Jure Repinc 2011-11-20 19:39:53 UTC
Created attachment 53729 [details]
amnesia-bad.png
Comment 2 Jure Repinc 2011-11-20 19:53:55 UTC
Created attachment 53730 [details]
amnesia-good.png
Comment 3 Ian Romanick 2011-11-21 11:49:17 UTC
Does the application generate any errors in a log?  Does running a debug build of Mesa cause any Mesa warnings to be logged?
Comment 4 Ian Romanick 2011-11-21 11:55:07 UTC
I just posted a patch to the mesa-dev mailing list that may fix this issue:

http://lists.freedesktop.org/archives/mesa-dev/2011-November/014913.html
Comment 5 Jure Repinc 2011-11-21 14:26:54 UTC
IF I did everything right applying this patch, then it unfortunately doesn't appear to help. I get this output when I run the game:
$
 libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/jlp/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/jlp/.drirc: No such file or directory.
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
aDiffuseMap: 1
avLightColor: 4
aDiffuseMap: 1
avLightColor: 4
aSSAOMap: 1
aDiffuseMap: 1
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
depthTexture: 1
depthMap: 1
occMap: 1
afFarPlane: 1
depthMap: 1
occMap: 1
afFarPlane: 1
scatterDisk: 1
depthMap: 1
avScreenSize: 2
afDepthDiffMul: 1
avScatterLengthLimits: 2
afScatterLengthMul: 1
afFarPlane: 1
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
depthTexture: 1
normalTexture: 1
depthTexture: 1
screenTexture: 1
afFarPlane: 1
aDiffuseMap: 1
afBlurSize: 1
diffuseMap: 1
afBlurSize: 1
diffuseMap: 1
avRgbToIntensity: 3
diffuseMap: 1
blurMap: 1
convMap: 1
diffuseMap: 1
afFadeAlpha: 1
convMap: 1
diffuseMap: 1
afAlpha: 1
diffuseMap: 1
avHalfScreenSize: 2
afBlurStartDist: 1
afSize: 1
diffuseMap: 1
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
afColorMul: 1
aDiffuse: 1
afColorMul: 1
aDiffuse: 1
gvColor: 3
alphaMap: 1
gvColor: 3
aDiffuseMap: 1
afBlurSize: 1
diffuseMap: 1
afBlurSize: 1
diffuseMap: 1
afZoomAlpha: 1
afWaveAlpha: 1
afAmpT: 1
avScreenSize: 2
afT: 1
zoomMap: 1
ampMap1: 1
ampMap0: 1
diffuseMap: 1
diffuseMap: 1
diffuseMap: 1
diffuseMap: 1
diffuseMap: 1
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
sampler_0: 1
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)
sampler_0: 1
afLightLevel: 1
afAlpha: 1
aDiffuseMap: 1
afFalloffExp: 1
afOneMinusFogAlpha: 1
avFogStartAndLength: 2
afLightLevel: 1
afAlpha: 1
aDiffuseMap: 1
afDissolveAmount: 1
aDissolveMap: 1
afInvFarPlane: 1
avHeightMapScaleAndBias: 2
aHeightMap: 1
aSpecularMap: 1
aNormalMap: 1
aDiffuseMap: 1
afColorMul: 1
aDiffuse: 1
afInvFarPlane: 1
aSpecularMap: 1
aNormalMap: 1
aDiffuseMap: 1
aDiffuseMap: 1
afInvFarPlane: 1
aSpecularMap: 1
aDiffuseMap: 1
aDiffuseMap: 1
afDissolveAmount: 1
aDissolveMap: 1
aDiffuseMap: 1
afInvFarPlane: 1
aDiffuseMap: 1
afLightLevel: 1
afAlpha: 1
aDiffuseMap: 1
afFalloffExp: 1
afOneMinusFogAlpha: 1
avFogStartAndLength: 2
afLightLevel: 1
afAlpha: 1
aDiffuseMap: 1
avRimLightMulPow: 2
avFrenselBiasPow: 2
a_mtxInvViewRotation: 16
afRefractionScale: 1
afLightLevel: 1
afAlpha: 1
aEnvMap: 1
aRefractionMap: 1
aNormalMap: 1
aDiffuseMap: 1
avRimLightMulPow: 2
avFrenselBiasPow: 2
a_mtxInvViewRotation: 16
afFalloffExp: 1
afOneMinusFogAlpha: 1
avFogStartAndLength: 2
afRefractionScale: 1
afLightLevel: 1
afAlpha: 1
aEnvMap: 1
aRefractionMap: 1
aNormalMap: 1
aDiffuseMap: 1
sampler_2: 1
sampler_1: 1
sampler_0: 1
afNegFarPlane: 1
aAttenuationMap: 1
aDepthMap: 1
aNormalMap: 1
aDiffuseMap: 1
avLightColor: 4
afInvLightRadius: 1
avLightPos: 3
afFalloffExp: 1
avFogColor: 4
avFogStartAndLength: 2
afNegFarPlane: 1
aDepthMap: 1
sampler_0: 1
Comment 6 Pavel Ondračka 2011-12-30 14:10:19 UTC
Also affects llvmpipe and r300g. Reproducible with the demo.
Comment 7 Vadim Girlin 2011-12-30 16:30:56 UTC
I guess this patch could help:

http://lists.freedesktop.org/archives/mesa-dev/2011-December/016347.html
Comment 8 Pavel Ondračka 2011-12-31 00:37:16 UTC
(In reply to comment #7)
> I guess this patch could help:
> 
> http://lists.freedesktop.org/archives/mesa-dev/2011-December/016347.html

Yes, that patch fixes Amnesia here.
Comment 9 Jure Repinc 2012-01-01 13:17:29 UTC
I also confirm that the patch fixes the problem
Comment 10 Alex Deucher 2012-01-03 06:32:15 UTC
pushed:
d4bf5cefb0943a196c603360187493e270a66442

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.