summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2016-10-10 11:29:14 -0600
committerBrian Paul <[email protected]>2016-10-13 17:38:49 -0600
commitff00ab745c9a9d6ef35239ea656a5db0c76de52d (patch)
tree0ea17a68c9eeafdb5d43b2ebaf8105ca1a131a92 /src
parenta710c21ac200fc1c80a6209862e837f0a75f4cc5 (diff)
mesa: replace gl_framebuffer::_IntegerColor wih _IntegerBuffers
Use a bitmask to indicate which color buffers are integer-valued, rather than a bool. Also, the old field was mis-computed. If an integer buffer was followed by a non-integer buffer, the _IntegerColor field was wrongly set to false. This fixes the new piglit gl-3.1-mixed-int-float-fbo test. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/common/meta.c2
-rw-r--r--src/mesa/main/api_validate.c2
-rw-r--r--src/mesa/main/blend.c2
-rw-r--r--src/mesa/main/fbobject.c10
-rw-r--r--src/mesa/main/get.c4
-rw-r--r--src/mesa/main/get_hash_params.py2
-rw-r--r--src/mesa/main/mtypes.h3
7 files changed, 15 insertions, 10 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index fdc4748602f..890e98a06b6 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1750,7 +1750,7 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
z = invert_z(ctx->Depth.Clear);
}
- if (fb->_IntegerColor) {
+ if (fb->_IntegerBuffers) {
assert(glsl);
_mesa_meta_use_program(ctx, clear->IntegerShaderProg);
_mesa_Uniform4iv(0, 1, ctx->Color.ClearColor.i);
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index c3c5a696928..d3b4cab7d5b 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -152,7 +152,7 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
/* If drawing to integer-valued color buffers, there must be an
* active fragment shader (GL_EXT_texture_integer).
*/
- if (ctx->DrawBuffer && ctx->DrawBuffer->_IntegerColor) {
+ if (ctx->DrawBuffer && ctx->DrawBuffer->_IntegerBuffers) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(integer format but no fragment shader)", where);
return GL_FALSE;
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index ad79ee011d2..0322799af54 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -945,7 +945,7 @@ _mesa_update_clamp_fragment_color(struct gl_context *ctx,
* - there is an integer colorbuffer
*/
if (!drawFb || !drawFb->_HasSNormOrFloatColorBuffer ||
- drawFb->_IntegerColor)
+ drawFb->_IntegerBuffers)
ctx->Color._ClampFragmentColor = GL_FALSE;
else
ctx->Color._ClampFragmentColor =
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 3b55e79f4a0..9204606c670 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -970,6 +970,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
fb->_AllColorBuffersFixedPoint = GL_TRUE;
fb->_HasSNormOrFloatColorBuffer = GL_FALSE;
fb->_HasAttachments = true;
+ fb->_IntegerBuffers = 0;
/* Start at -2 to more easily loop over all attachment points.
* -2: depth buffer
@@ -1090,13 +1091,14 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
continue;
}
- /* check if integer color */
- fb->_IntegerColor = _mesa_is_format_integer_color(attFormat);
-
- /* Update _AllColorBuffersFixedPoint and _HasSNormOrFloatColorBuffer. */
+ /* Update flags describing color buffer datatypes */
if (i >= 0) {
GLenum type = _mesa_get_format_datatype(attFormat);
+ /* check if integer color */
+ if (_mesa_is_format_integer_color(attFormat))
+ fb->_IntegerBuffers |= (1 << i);
+
fb->_AllColorBuffersFixedPoint =
fb->_AllColorBuffersFixedPoint &&
(type == GL_UNSIGNED_NORMALIZED || type == GL_SIGNED_NORMALIZED);
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index bd85befa125..c11bcde207a 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1076,6 +1076,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
case GL_SAMPLE_BUFFERS:
v->value_int = _mesa_geometric_samples(ctx->DrawBuffer) > 0;
break;
+ /* GL_EXT_textrue_integer */
+ case GL_RGBA_INTEGER_MODE_EXT:
+ v->value_int = (ctx->DrawBuffer->_IntegerBuffers != 0);
+ break;
/* GL_ATI_meminfo & GL_NVX_gpu_memory_info */
case GL_VBO_FREE_MEMORY_ATI:
case GL_TEXTURE_FREE_MEMORY_ATI:
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 6849b5b7d58..3c6b7129afb 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -890,7 +890,7 @@ descriptor=[
[ "TEXTURE_CUBE_MAP_SEAMLESS", "CONTEXT_BOOL(Texture.CubeMapSeamless), extra_ARB_seamless_cube_map" ],
# GL_EXT_texture_integer
- [ "RGBA_INTEGER_MODE_EXT", "BUFFER_BOOL(_IntegerColor), extra_EXT_texture_integer_and_new_buffers" ],
+ [ "RGBA_INTEGER_MODE_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_texture_integer_and_new_buffers" ],
# GL_ARB_transform_feedback3
[ "MAX_TRANSFORM_FEEDBACK_BUFFERS", "CONTEXT_INT(Const.MaxTransformFeedbackBuffers), extra_ARB_transform_feedback3" ],
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ab9839c7516..61d6bf1a6e9 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3334,8 +3334,7 @@ struct gl_framebuffer
*/
bool _HasAttachments;
- /** Integer color values */
- GLboolean _IntegerColor;
+ GLbitfield _IntegerBuffers; /**< Which color buffers are integer valued */
/* ARB_color_buffer_float */
GLboolean _AllColorBuffersFixedPoint; /* no integer, no float */