Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 03-06-11, 02:29 PM   #1
Tronic
Registered User
 
Join Date: Jul 2004
Posts: 35
Default [BUG] gl_Position.w affects unrelated shader variables if gl_ViewportIndex is used

Testcase http://pastebin.com/zFKCXWPF

The fourth component of vertex position multiplies the first component of the first fragment shader input variable (no matter what variable that might be). No issues on GTX 460 but is broken on 8800 GTS 640 MB. Unfortunately I haven't been able to test other hardware.

Expected results:


Actual results:
Attached Files
File Type: gz nvidia-bug-report.log.gz (56.3 KB, 61 views)
Tronic is offline   Reply With Quote
Old 03-10-11, 04:42 AM   #2
Tronic
Registered User
 
Join Date: Jul 2004
Posts: 35
Default Re: [BUG] gl_Position.w affects unrelated shader variables if gl_ViewportIndex is use

Any comment from Nvidia?
Tronic is offline   Reply With Quote
Old 03-13-11, 02:22 PM   #3
Tronic
Registered User
 
Join Date: Jul 2004
Posts: 35
Default Re: [BUG] gl_Position.w affects unrelated shader variables if gl_ViewportIndex is use

Also displayed by this same test case is a bogus compiler warning because it incorrectly considers that the contents of the for loop might not get executed (even though it is clear by simple static analysis that it gets executed and I would expect the compiler to unroll the loop in any case, to avoid branching). This also affects new hardware.

for (int i = 0; i < 3; ++i) {
gl_Position = gl_in[i].gl_Position;
EmitVertex();
}

0(9) : warning C7050: "gl_Position" might be used before being initialized

The problem can be worked around by either by doing an extra write to the variable before the loop begins or by rewriting the loop as do-while but neither of these should be required.

int i = 0;
do {
gl_Position = gl_in[i].gl_Position;
EmitVertex();
} while (++i < gl_in.length());
Tronic is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:51 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.