On 30 August 2012 08:23, Brian Paul <span dir="ltr"><<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 08/30/2012 09:14 AM, Paul Berry wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
From: Brian Paul<<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>><br>
<br>
This partially reverts d638da23d2ec2e9c52655b1ea13824<u></u>9e7f8bcccb.<br>
<br>
With gallium the meta code is not always built so the call to<br>
_meta_in_progress() was unresolved. Simply special-case the<br>
GL_MULTISAMPLE case in the meta code. There might be other special<br>
cases in the future given all the differences between legacy GL,<br>
core GL, GLES, etc.<br>
<br>
Fixes <a href="https://bugs.freedesktop.org/show_bug.cgi?id=54234" target="_blank">https://bugs.freedesktop.org/<u></u>show_bug.cgi?id=54234</a><br>
and <a href="https://bugs.freedesktop.org/show_bug.cgi?id=54239" target="_blank">https://bugs.freedesktop.org/<u></u>show_bug.cgi?id=54239</a><br>
<br>
v2 (Paul Berry<<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>><u></u>): keep _meta_in_progress<br>
function, since it's needed by the i965 driver, but don't call it from<br>
core mesa.<br>
---<br>
src/mesa/drivers/common/meta.c | 33 ++++++++++++++++++++++++++++++<u></u>+--<br>
src/mesa/main/enable.c | 7 +------<br>
2 files changed, 32 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/common/<u></u>meta.c b/src/mesa/drivers/common/<u></u>meta.c<br>
index abb7d4e..e38759f 100644<br>
--- a/src/mesa/drivers/common/<u></u>meta.c<br>
+++ b/src/mesa/drivers/common/<u></u>meta.c<br>
@@ -438,6 +438,35 @@ _mesa_meta_free(struct gl_context *ctx)<br>
<br>
<br>
/**<br>
+ * This is an alternative to _mesa_set_enable() to handle some special cases.<br>
+ * See comments inside.<br>
+ */<br>
+static void<br>
+meta_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)<br>
+{<br>
+ switch (cap) {<br>
+ case GL_MULTISAMPLE:<br>
+ /* We need to enable/disable multisample when using GLES but this enum<br>
+ * is not supported there.<br>
+ */<br>
+ if (ctx->Multisample.Enabled == state)<br>
+ return;<br>
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);<br>
+ ctx->Multisample.Enabled = state;<br>
+ break;<br>
+ default:<br>
+ _mesa_problem(ctx, "Unexpected cap in _meta_set_enable()");<br>
+ return;<br>
+ }<br>
+<br>
+ if (ctx->Driver.Enable) {<br>
+ ctx->Driver.Enable(ctx, cap, state);<br>
+ }<br>
+}<br>
+<br>
+<br>
+<br>
+/**<br>
* Enter meta state. This is like a light-weight version of glPushAttrib<br>
* but it also resets most GL state back to default values.<br>
*<br>
@@ -755,7 +784,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)<br></div></div>
if (state& MESA_META_MULTISAMPLE) {<div class="im"><br>
save->MultisampleEnabled = ctx->Multisample.Enabled;<br>
if (ctx->Multisample.Enabled)<br>
- _mesa_set_enable(ctx, GL_MULTISAMPLE, GL_FALSE);<br>
+ meta_set_enable(ctx, GL_MULTISAMPLE, GL_FALSE);<br>
}<br>
<br>
/* misc */<br>
@@ -1057,7 +1086,7 @@ _mesa_meta_end(struct gl_context *ctx)<br>
<br></div>
if (state& MESA_META_MULTISAMPLE) {<div class="im"><br>
if (ctx->Multisample.Enabled != save->MultisampleEnabled)<br>
- _mesa_set_enable(ctx, GL_MULTISAMPLE, save->MultisampleEnabled);<br>
+ meta_set_enable(ctx, GL_MULTISAMPLE, save->MultisampleEnabled);<br>
}<br>
<br>
/* misc */<br>
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c<br>
index b713f5f..14eea53 100644<br>
--- a/src/mesa/main/enable.c<br>
+++ b/src/mesa/main/enable.c<br>
@@ -765,13 +765,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)<br>
<br>
/* GL_ARB_multisample */<br>
case GL_MULTISAMPLE_ARB:<br>
- /* Technically speaking, this should not be allowed for OpenGL ES 2.0<br>
- * or 3.0. However, meta really needs it.<br>
- */<br>
- if (!_mesa_meta_in_progress(ctx)&<u></u>& !_mesa_is_desktop_gl(ctx)<br></div>
-&& ctx->API != API_OPENGLES)<br>
+ if (!_mesa_is_desktop_gl(ctx)&& ctx->API != API_OPENGLES)<div class="im"><br>
goto invalid_enum_error;<br>
-<br>
if (ctx->Multisample.Enabled == state)<br>
return;<br>
FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);<br>
</div></blockquote>
<br>
Signed-off-by: Brian Paul <<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>><br>
<br>
Go ahead and commit, Paul. Thanks.<span class="HOEnZb"><font color="#888888"><br>
<br>
-Brian<br>
</font></span></blockquote></div><br>Pushed. Thanks for your help getting this fixed quickly, Brian.<br>