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 <marek.olsak@amd.com>
This commit is contained in:
Brian Paul 2016-10-10 11:29:14 -06:00
parent a710c21ac2
commit ff00ab745c
7 changed files with 15 additions and 10 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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 =

View file

@ -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);

View file

@ -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:

View file

@ -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" ],

View file

@ -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 */