[Piglit] [PATCH] arb blend func extended - check errors at glBegin
Eric Anholt
eric at anholt.net
Tue Mar 27 19:25:12 PDT 2012
On Tue, 27 Mar 2012 20:15:07 +0100, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> The spec says we should error after Begin if the blend factors are applied
> to an illegal draw buffer.
> diff --git a/tests/spec/arb_blend_func_extended/api/error-at-begin.c b/tests/spec/arb_blend_func_extended/api/error-at-begin.c
> new file mode 100644
> index 0000000..bc345c8
> --- /dev/null
> +++ b/tests/spec/arb_blend_func_extended/api/error-at-begin.c
> + * \author Dave Airlie
> + * ARB_blend_func_extended states in ERRORS section
> + * The error INVALID_OPERATION is generated by Begin or any procedure that
> + * implicitly calls Begin if any draw buffer has a blend function requiring the
> + * second color input (SRC1_COLOR, ONE_MINUS_SRC1_COLOR, SRC1_ALPHA or
> + * ONE_MINUS_SRC1_ALPHA), and a framebuffer is bound that has more than
> + * the value of MAX_DUAL_SOURCE_DRAW_BUFFERS-1 active color attachements.
> + */
Some formatting indicating the quote would be nice.
> +static void
> +create_fbo(void)
> +{
> + GLuint rb[32];
> + int i;
> +
> + glGenFramebuffersEXT(1, &fbo);
> + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
> +
> + glGenRenderbuffersEXT(max_buffers, rb);
> +
> + for (i = 0; i < max_buffers; i++) {
> + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb[i]);
> +
> + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
> + GL_COLOR_ATTACHMENT0 + i,
> + GL_RENDERBUFFER_EXT,
> + rb[i]);
> + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA,
> + piglit_width, piglit_height);
> + }
> +}
tab-indent
Given that you're requiring GL 3.0, there's no need for EXT on your FBO
calls.
> +void piglit_init(int argc, char **argv)
> +{
> + GLint max_dual_source;
> + GLenum buffers[32];
> + int i;
> + piglit_require_gl_version(30);
> + piglit_require_extension("GL_ARB_blend_func_extended");
> + for (i = 0; i < max_buffers; i++)
> + buffers[i] = GL_COLOR_ATTACHMENT0_EXT + i;
> +
> + glDrawBuffersARB(max_buffers, buffers);
> +
trailing whitespace.
> + for (i = 0; i < max_buffers; i++) {
> + if (i >= max_dual_source)
> + glBlendFunciARB(i, GL_SRC1_ALPHA, GL_ONE_MINUS_SRC1_ALPHA);
> + else
> + glBlendFunciARB(i, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
> + glEnableIndexedEXT(GL_BLEND, i);
You didn't require GL_ARB_draw_buffers_blend. Given the
glEnable(GL_BLEND) below, I think you can just drop this line.
> + }
> +
> + glEnable(GL_BLEND);
> +
> + glBegin(GL_QUADS);
indentation
> +
> + if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> + piglit_report_result(PIGLIT_FAIL);
> + else
> + piglit_report_result(PIGLIT_PASS);
> +}
trailing whitespace
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120327/d44756c2/attachment.pgp>
More information about the Piglit
mailing list