<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:jfonseca@vmware.com" title="Jose Fonseca <jfonseca@vmware.com>"> <span class="fn">Jose Fonseca</span></a>
</span> changed
<a class="bz_bug_link
bz_status_NEW "
title="NEW - Incorrect viewport range when GL_CLIP_ORIGIN is GL_UPPER_LEFT"
href="https://bugs.freedesktop.org/show_bug.cgi?id=93813">bug 93813</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>brianp@vmware.com, jfonseca@vmware.com, sroland@vmware.com
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Incorrect viewport range when GL_CLIP_ORIGIN is GL_UPPER_LEFT"
href="https://bugs.freedesktop.org/show_bug.cgi?id=93813#c5">Comment # 5</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Incorrect viewport range when GL_CLIP_ORIGIN is GL_UPPER_LEFT"
href="https://bugs.freedesktop.org/show_bug.cgi?id=93813">bug 93813</a>
from <span class="vcard"><a class="email" href="mailto:jfonseca@vmware.com" title="Jose Fonseca <jfonseca@vmware.com>"> <span class="fn">Jose Fonseca</span></a>
</span></b>
<pre>(In reply to Ilia Mirkin from <a href="show_bug.cgi?id=93813#c3">comment #3</a>)
<span class="quote">> A bit of potentially-relevant spec quote from ARB_clip_control:
>
> 12) Does setting the clip control origin to GL_UPPER_LEFT change the
> origin of the window coordinate system use for commands such as
> glViewport, glScissor, glWindowPos2i, and glReadPixels?
>
> RESOLVED: No.
>
> The (x,y) window space location passed to these commands have the
> (0,0) origin at the lower left corner of the window, independent
> of the state of the clip control origin.
>
> Still unsure whether that rules in favor of Mesa or of the test case :)
> Hopefully someone more knowledgeable can weigh in.</span >
Hi Ilia,
First of all, let me warn that I'm not an expert on this extension. I
appreciate your perseverance getting to the bottom at this though. In fact, we
(at VMware) actually ran into issues using this extension, but the person most
knowledgeable about it is currently on PTO.
FWIW, I looked into this, and the way I interpret it, the text of issue 12) is
actually conclusive evidence that Mesa is *wrong*:
- The attached draws a red rectangle covering the whole viewport, as xyzw
coordinates before clipping will be
-1.0, -1.0, 0.5, 1.0
3.0, -1.0, 0.5, 1.0
-1.0, 3.0, 0.5, 1.0
3.0, 3.0, 0.5, 1.0
hence the expected rendering is that all pixels inside viewport will be red,
all outside will be black (the clear color)
- Issue 12) states that the _window coordinate system_ for glViewport should be
the same
- Hence, we should get the _exact_ same rendering, whether we comment or not
the
glClipControl(GL_UPPER_LEFT, GL_ZERO_TO_ONE)
call in the attached example.
That is, it should doesn't matter where's the clip origin, as the primitive
completely cover the viewport, and all fragments have the same color.
- But that's not what's happening:
- if one comments out glClipControl one gets the viewport pixels painted red
- if one does not comment the glClipControl only some viewport pixels are
painted red, but some are painted black, which really shouldn't happen.
For reference, this are a few modifications I did to the attached sample to
better understand it:
--- fdo121191.c.orig 2016-02-09 11:37:33.122145252 +0000
+++ fdo121191.c 2016-02-09 11:40:23.597820907 +0000
@@ -68,7 +68,8 @@
typedef void (APIENTRYP PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum
depth);
const auto glClipControl = reinterpret_cast<PFNGLCLIPCONTROLPROC>(
SDL_GL_GetProcAddress("glClipControl"));
- glClipControl(GL_UPPER_LEFT, GL_ZERO_TO_ONE);
+ // XXX: We should get the same rendering regardless we have 1 or 0 here
+ if (1) glClipControl(GL_UPPER_LEFT, GL_ZERO_TO_ONE);
GLuint texture;
glGenTextures(1, &texture);
@@ -160,7 +161,12 @@
assert(glGetError() == GL_NO_ERROR);
- std::cout << colours[0] << ", " << colours[2] << "\n";
+ for (unsigned y = 0; y < textureSizeY; ++y) {
+ for (unsigned x = 0; x < textureSizeX; ++x) {
+ std::cout << colours[y*textureSizeX + x] << "\t";
+ }
+ std::cout << "\n";
+ }
// This was outside the viewport, so should be black from the clear
assert(colours[0] == 0.0f);
// This was inside the viewport, so should be red from the draw</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>