<p dir="ltr">Reviewed-by: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br>
</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Oct 12, 2016 4:08 AM, "Brian Paul" <<a href="mailto:brianp@vmware.com">brianp@vmware.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Use a bitmask to indicate which color buffers are integer-valued, rather<br>
than a bool. Also, the old field was mis-computed. If an integer buffer<br>
was followed by a non-integer buffer, the _IntegerColor field was wrongly<br>
set to false.<br>
<br>
This fixes the new piglit gl-3.1-mixed-int-float-fbo test.<br>
---<br>
src/mesa/drivers/common/meta.c | 2 +-<br>
src/mesa/main/api_validate.c | 2 +-<br>
src/mesa/main/blend.c | 2 +-<br>
src/mesa/main/fbobject.c | 10 ++++++----<br>
src/mesa/main/get.c | 4 ++++<br>
src/mesa/main/get_hash_params.<wbr>py | 2 +-<br>
src/mesa/main/mtypes.h | 3 +--<br>
7 files changed, 15 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/common/<wbr>meta.c b/src/mesa/drivers/common/<wbr>meta.c<br>
index fdc4748..890e98a 100644<br>
--- a/src/mesa/drivers/common/<wbr>meta.c<br>
+++ b/src/mesa/drivers/common/<wbr>meta.c<br>
@@ -1750,7 +1750,7 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)<br>
z = invert_z(ctx->Depth.Clear);<br>
}<br>
<br>
- if (fb->_IntegerColor) {<br>
+ if (fb->_IntegerBuffers) {<br>
assert(glsl);<br>
_mesa_meta_use_program(ctx, clear->IntegerShaderProg);<br>
_mesa_Uniform4iv(0, 1, ctx->Color.ClearColor.i);<br>
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c<br>
index c3c5a69..d3b4cab 100644<br>
--- a/src/mesa/main/api_validate.c<br>
+++ b/src/mesa/main/api_validate.c<br>
@@ -152,7 +152,7 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)<br>
/* If drawing to integer-valued color buffers, there must be an<br>
* active fragment shader (GL_EXT_texture_integer).<br>
*/<br>
- if (ctx->DrawBuffer && ctx->DrawBuffer->_<wbr>IntegerColor) {<br>
+ if (ctx->DrawBuffer && ctx->DrawBuffer->_<wbr>IntegerBuffers) {<br>
_mesa_error(ctx, GL_INVALID_OPERATION,<br>
"%s(integer format but no fragment shader)", where);<br>
return GL_FALSE;<br>
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c<br>
index ad79ee0..0322799 100644<br>
--- a/src/mesa/main/blend.c<br>
+++ b/src/mesa/main/blend.c<br>
@@ -945,7 +945,7 @@ _mesa_update_clamp_fragment_<wbr>color(struct gl_context *ctx,<br>
* - there is an integer colorbuffer<br>
*/<br>
if (!drawFb || !drawFb->_<wbr>HasSNormOrFloatColorBuffer ||<br>
- drawFb->_IntegerColor)<br>
+ drawFb->_IntegerBuffers)<br>
ctx->Color._ClampFragmentColor = GL_FALSE;<br>
else<br>
ctx->Color._ClampFragmentColor =<br>
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c<br>
index 3b55e79..9204606 100644<br>
--- a/src/mesa/main/fbobject.c<br>
+++ b/src/mesa/main/fbobject.c<br>
@@ -970,6 +970,7 @@ _mesa_test_framebuffer_<wbr>completeness(struct gl_context *ctx,<br>
fb->_AllColorBuffersFixedPoint = GL_TRUE;<br>
fb->_<wbr>HasSNormOrFloatColorBuffer = GL_FALSE;<br>
fb->_HasAttachments = true;<br>
+ fb->_IntegerBuffers = 0;<br>
<br>
/* Start at -2 to more easily loop over all attachment points.<br>
* -2: depth buffer<br>
@@ -1090,13 +1091,14 @@ _mesa_test_framebuffer_<wbr>completeness(struct gl_context *ctx,<br>
continue;<br>
}<br>
<br>
- /* check if integer color */<br>
- fb->_IntegerColor = _mesa_is_format_integer_color(<wbr>attFormat);<br>
-<br>
- /* Update _AllColorBuffersFixedPoint and _HasSNormOrFloatColorBuffer. */<br>
+ /* Update flags describing color buffer datatypes */<br>
if (i >= 0) {<br>
GLenum type = _mesa_get_format_datatype(<wbr>attFormat);<br>
<br>
+ /* check if integer color */<br>
+ if (_mesa_is_format_integer_<wbr>color(attFormat))<br>
+ fb->_IntegerBuffers |= (1 << i);<br>
+<br>
fb->_AllColorBuffersFixedPoint =<br>
fb->_AllColorBuffersFixedPoint &&<br>
(type == GL_UNSIGNED_NORMALIZED || type == GL_SIGNED_NORMALIZED);<br>
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c<br>
index bd85bef..c11bcde 100644<br>
--- a/src/mesa/main/get.c<br>
+++ b/src/mesa/main/get.c<br>
@@ -1076,6 +1076,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu<br>
case GL_SAMPLE_BUFFERS:<br>
v->value_int = _mesa_geometric_samples(ctx-><wbr>DrawBuffer) > 0;<br>
break;<br>
+ /* GL_EXT_textrue_integer */<br>
+ case GL_RGBA_INTEGER_MODE_EXT:<br>
+ v->value_int = (ctx->DrawBuffer->_<wbr>IntegerBuffers != 0);<br>
+ break;<br>
/* GL_ATI_meminfo & GL_NVX_gpu_memory_info */<br>
case GL_VBO_FREE_MEMORY_ATI:<br>
case GL_TEXTURE_FREE_MEMORY_ATI:<br>
diff --git a/src/mesa/main/get_hash_<wbr>params.py b/src/mesa/main/get_hash_<wbr>params.py<br>
index 6849b5b..3c6b712 100644<br>
--- a/src/mesa/main/get_hash_<wbr>params.py<br>
+++ b/src/mesa/main/get_hash_<wbr>params.py<br>
@@ -890,7 +890,7 @@ descriptor=[<br>
[ "TEXTURE_CUBE_MAP_SEAMLESS", "CONTEXT_BOOL(Texture.<wbr>CubeMapSeamless), extra_ARB_seamless_cube_map" ],<br>
<br>
# GL_EXT_texture_integer<br>
- [ "RGBA_INTEGER_MODE_EXT", "BUFFER_BOOL(_IntegerColor), extra_EXT_texture_integer_and_<wbr>new_buffers" ],<br>
+ [ "RGBA_INTEGER_MODE_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_texture_integer_and_<wbr>new_buffers" ],<br>
<br>
# GL_ARB_transform_feedback3<br>
[ "MAX_TRANSFORM_FEEDBACK_<wbr>BUFFERS", "CONTEXT_INT(Const.<wbr>MaxTransformFeedbackBuffers), extra_ARB_transform_feedback3" ],<br>
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
index ab9839c..61d6bf1 100644<br>
--- a/src/mesa/main/mtypes.h<br>
+++ b/src/mesa/main/mtypes.h<br>
@@ -3334,8 +3334,7 @@ struct gl_framebuffer<br>
*/<br>
bool _HasAttachments;<br>
<br>
- /** Integer color values */<br>
- GLboolean _IntegerColor;<br>
+ GLbitfield _IntegerBuffers; /**< Which color buffers are integer valued */<br>
<br>
/* ARB_color_buffer_float */<br>
GLboolean _AllColorBuffersFixedPoint; /* no integer, no float */<br>
--<br>
1.9.1<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>