<div dir="ltr">On 29 December 2012 04:35, Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Signed-off-by: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>><br>
---<br>
src/mesa/main/enable.c | 15 +++++++++++++++<br>
src/mesa/main/get.c | 9 +++++++++<br>
src/mesa/main/get_hash_params.py | 2 ++<br>
src/mesa/main/mtypes.h | 6 +++++-<br>
src/mesa/main/multisample.c | 16 ++++++++++++++--<br>
5 files changed, 45 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c<br>
index b48794f..aeeab15 100644<br>
--- a/src/mesa/main/enable.c<br>
+++ b/src/mesa/main/enable.c<br>
@@ -988,6 +988,14 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)<br>
}<br>
break;<br>
<br>
+ /* ARB_texture_multisample */<br>
+ case GL_SAMPLE_MASK:<br></blockquote><div><br></div><div>I think you need to add:<br><br></div><div>if (!_mesa_is_desktop_gl(ctx))<br></div><div> goto invalid_enum_error;<br></div><div>CHECK_EXTENSION(ARB_texture_multisample);<br>
<br></div><div>(as you do in _mesa_IsEnabled() below). <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ if (ctx->Multisample.SampleMask == state)<br>
+ return;<br>
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);<br>
+ ctx->Multisample.SampleMask = state;<br>
+ break;<br>
+<br>
default:<br>
goto invalid_enum_error;<br>
}<br>
@@ -1556,6 +1564,13 @@ _mesa_IsEnabled( GLenum cap )<br>
CHECK_EXTENSION(OES_EGL_image_external);<br>
return is_texture_enabled(ctx, TEXTURE_EXTERNAL_BIT);<br>
<br>
+ /* ARB_texture_multisample */<br>
+ case GL_SAMPLE_MASK:<br>
+ if (!_mesa_is_desktop_gl(ctx))<br>
+ goto invalid_enum_error;<br>
+ CHECK_EXTENSION(ARB_texture_multisample);<br>
+ return ctx->Multisample.SampleMask;<br>
+<br>
default:<br>
goto invalid_enum_error;<br>
}<br>
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c<br>
index 4c227a8..e15cbf8 100644<br>
--- a/src/mesa/main/get.c<br>
+++ b/src/mesa/main/get.c<br>
@@ -1618,6 +1618,15 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)<br>
goto invalid_enum;<br>
v->value_int = ctx->UniformBufferBindings[index].Size;<br>
return TYPE_INT;<br>
+<br>
+ /* ARB_texture_multisample / GL3.2 */<br>
+ case GL_SAMPLE_MASK_VALUE:<br>
+ if (index != 0)<br>
+ goto invalid_value;<br>
+ if (!ctx->Extensions.ARB_texture_multisample)<br>
+ goto invalid_enum;<br>
+ v->value_int = ctx->Multisample.SampleMaskValue;<br>
+ return TYPE_INT;<br>
}<br>
<br>
invalid_enum:<br>
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py<br>
index 689a7e0..8e053a4 100644<br>
--- a/src/mesa/main/get_hash_params.py<br>
+++ b/src/mesa/main/get_hash_params.py<br>
@@ -644,6 +644,8 @@ descriptor=[<br>
[ "MAX_COLOR_TEXTURE_SAMPLES", "CONTEXT_INT(Const.MaxColorTextureSamples), extra_ARB_texture_multisample" ],<br>
[ "MAX_DEPTH_TEXTURE_SAMPLES", "CONTEXT_INT(Const.MaxDepthTextureSamples), extra_ARB_texture_multisample" ],<br>
[ "MAX_INTEGER_SAMPLES", "CONTEXT_INT(Const.MaxIntegerSamples), extra_ARB_texture_multisample" ],<br>
+ [ "SAMPLE_MASK", "CONTEXT_BOOL(Multisample.SampleMask), extra_ARB_texture_multisample" ],<br>
+ [ "MAX_SAMPLE_MASK_WORDS", "CONST(1), extra_ARB_texture_multisample" ],<br>
<br>
<br>
# GL_ARB_sampler_objects / GL 3.3<br>
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
index 6f6cdaa..dda6a3e 100644<br>
--- a/src/mesa/main/mtypes.h<br>
+++ b/src/mesa/main/mtypes.h<br>
@@ -980,7 +980,6 @@ struct gl_list_attrib<br>
GLuint ListBase;<br>
};<br>
<br>
-<br>
/**<br>
* Multisample attribute group (GL_MULTISAMPLE_BIT).<br>
*/<br>
@@ -993,6 +992,11 @@ struct gl_multisample_attrib<br>
GLboolean SampleCoverage;<br>
GLfloat SampleCoverageValue;<br>
GLboolean SampleCoverageInvert;<br>
+<br>
+ /* ARB_texture_multisample / GL3.2 additions */<br>
+ GLboolean SampleMask;<br>
+ GLbitfield SampleMaskValue; /* GL spec defines this as an array but >32x MSAA is<br>
+ madness */<br>
};<br>
<br>
<br>
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c<br>
index ee9e263..d277ff8 100644<br>
--- a/src/mesa/main/multisample.c<br>
+++ b/src/mesa/main/multisample.c<br>
@@ -59,6 +59,10 @@ _mesa_init_multisample(struct gl_context *ctx)<br>
ctx->Multisample.SampleCoverage = GL_FALSE;<br>
ctx->Multisample.SampleCoverageValue = 1.0;<br>
ctx->Multisample.SampleCoverageInvert = GL_FALSE;<br>
+<br>
+ /* ARB_texture_multisample / GL3.2 additions */<br>
+ ctx->Multisample.SampleMask = GL_FALSE;<br>
+ ctx->Multisample.SampleMaskValue = ~(GLbitfield)0;<br>
}<br>
<br>
void GLAPIENTRY<br>
@@ -88,7 +92,15 @@ _mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat * val)<br>
void GLAPIENTRY<br>
_mesa_SampleMaski(GLuint index, GLbitfield mask)<br>
{<br>
- assert(!"Not implemented");<br>
- // TODO: make this work<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );<br>
+<br>
+ if (index != 0) {<br>
+ _mesa_error(ctx, GL_INVALID_VALUE, "glSampleMaski(index)");<br>
+ return;<br>
+ }<br>
+<br>
+ ctx->Multisample.SampleMaskValue = mask;<br>
+ ctx->NewState |= _NEW_MULTISAMPLE;<br>
}<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
1.8.0.3<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>