Bug 32000 - [glsl] Texture value get's corrupt as soon as it appears in if statement
Summary: [glsl] Texture value get's corrupt as soon as it appears in if statement
Status: RESOLVED WORKSFORME
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 7.9
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-30 05:44 UTC by Sandro Mani
Modified: 2011-06-09 11:24 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Shadow Mapping demo (5.28 KB, application/x-gzip)
2010-11-30 05:44 UTC, Sandro Mani
Details

Description Sandro Mani 2010-11-30 05:44:54 UTC
Created attachment 40668 [details]
Shadow Mapping demo

Attached is a simple shadow mapping demo.
Problem:
In the fragment shader, as soon as the distanceFromLight variable or any variable which had distanceFromLight as (part of) it's rvalue is placed inside _any_ if statement, it's value becomes corrupt. distanceFromLight is the value read via texture2D from a GL_DEPTH_ATTACHMENT texture.

Details:
See FragmentShader.glsl, where 5 main observations are made.

Notes:
- The program works fine with the nvidia proprietary driver
- glxinfo: 
OpenGL vendor string: Tungsten Graphics, Inc
OpenGL renderer string: Mesa DRI Mobile Intel® GM45 Express Chipset GEM 20100330 DEVELOPMENT 
OpenGL version string: 2.1 Mesa 7.9
OpenGL shading language version string: 1.20

- driver: xorg-x11-drv-intel-2.12.0-6.fc14.1.x86_64
Comment 1 Ian Romanick 2011-06-09 11:24:21 UTC
The shader code incorrectly uses GLSL 1.30 'in' and 'out' for varyings.  In GLSL 1.20 and earlier, you must use 'varying'.  Our compiler currently generates the following error:

Vertex shader errors / warnings in file VertexShader.glsl:
0:3(21): error: `out' qualifier in declaration of `ShadowCoord' only valid for function parameters in GLSL 1.20.

NVIDIA is very sloppy and lets all kinds of invalid code through.

Changing 'in' and 'out' to 'varying' makes this demo produce what I believe are correct results on the current 7.10 branch (which will soon be the 7.10.3 release) and on master.  It seems unlikely that there will ever be another 7.9 release.


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.