From 33a838beb913c011b5ee8158c2717b7c8c351b17 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 10 Aug 2009 13:35:58 -0600 Subject: mesa: new driver meta-ops module Implement glClear() in terms of quad rendering, implement glBlitFramebuffer() in terms of glCopyTexImage2D + textured quad, etc. There have been several places in the drivers where we've implemented meta rendering similar to this. This is an effort to do it in a more portable and more efficient form. The _mesa_meta_begin/end() functions act like glPush/PopAttrib() but are lighter-weight. Plus, _mesa_meta_begin() resets GL state back to default values (texturing off, identity vertex transform, etc) so the meta drawing functions don't have to worry about it. For now only _mesa_mesa_blit_framebuffer() and _mesa_meta_clear() are implemented. glDrawPixels() and glCopyPixels() would be the next candidates. --- src/mesa/drivers/common/meta.h | 67 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/mesa/drivers/common/meta.h (limited to 'src/mesa/drivers/common/meta.h') diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h new file mode 100644 index 0000000000..b63ad99d5e --- /dev/null +++ b/src/mesa/drivers/common/meta.h @@ -0,0 +1,67 @@ +/* + * Mesa 3-D graphics library + * Version: 7.6 + * + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef META_H +#define META_H + + +/** + * Flags passed to _mesa_meta_begin(). + * XXX these flags may evolve... + */ +/*@{*/ +#define META_ALPHA_TEST 0x1 +#define META_BLEND 0x2 /**< includes logicop */ +#define META_COLOR_MASK 0x4 +#define META_DEPTH_TEST 0x8 +#define META_RASTERIZATION 0x10 +#define META_SCISSOR 0x20 +#define META_SHADER 0x40 +#define META_STENCIL_TEST 0x80 +#define META_TRANSFORM 0x100 /**< modelview, projection */ +#define META_TEXTURE 0x200 +#define META_VERTEX 0x400 +#define META_VIEWPORT 0x800 +#define META_ALL ~0x0 +/*@}*/ + + +extern void +_mesa_meta_init(GLcontext *ctx); + +extern void +_mesa_meta_free(GLcontext *ctx); + +extern void +_mesa_meta_blit_framebuffer(GLcontext *ctx, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter); + +extern void +_mesa_meta_clear(GLcontext *ctx, GLbitfield buffers); + + +#endif /* META_H */ -- cgit v1.2.3