14a49301eSmrg/*
24a49301eSmrg * Mesa 3-D graphics library
34a49301eSmrg *
44a49301eSmrg * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
54a49301eSmrg *
64a49301eSmrg * Permission is hereby granted, free of charge, to any person obtaining a
74a49301eSmrg * copy of this software and associated documentation files (the "Software"),
84a49301eSmrg * to deal in the Software without restriction, including without limitation
94a49301eSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
104a49301eSmrg * and/or sell copies of the Software, and to permit persons to whom the
114a49301eSmrg * Software is furnished to do so, subject to the following conditions:
124a49301eSmrg *
134a49301eSmrg * The above copyright notice and this permission notice shall be included
144a49301eSmrg * in all copies or substantial portions of the Software.
154a49301eSmrg *
164a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
174a49301eSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
184a49301eSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE.
234a49301eSmrg */
244a49301eSmrg
254a49301eSmrg
264a49301eSmrg#ifndef META_H
274a49301eSmrg#define META_H
284a49301eSmrg
29af69d88dSmrg#include "main/mtypes.h"
30af69d88dSmrg
31af69d88dSmrg/**
32af69d88dSmrg * \name Flags for meta operations
33af69d88dSmrg * \{
34af69d88dSmrg *
35af69d88dSmrg * These flags are passed to _mesa_meta_begin().
36af69d88dSmrg */
37af69d88dSmrg#define MESA_META_ALL                      ~0x0
38af69d88dSmrg#define MESA_META_ALPHA_TEST                0x1
39af69d88dSmrg#define MESA_META_BLEND                     0x2  /**< includes logicop */
40af69d88dSmrg#define MESA_META_COLOR_MASK                0x4
41af69d88dSmrg#define MESA_META_DEPTH_TEST                0x8
42af69d88dSmrg#define MESA_META_FOG                      0x10
43af69d88dSmrg#define MESA_META_PIXEL_STORE              0x20
44af69d88dSmrg#define MESA_META_PIXEL_TRANSFER           0x40
45af69d88dSmrg#define MESA_META_RASTERIZATION            0x80
46af69d88dSmrg#define MESA_META_SCISSOR                 0x100
47af69d88dSmrg#define MESA_META_SHADER                  0x200
48af69d88dSmrg#define MESA_META_STENCIL_TEST            0x400
49af69d88dSmrg#define MESA_META_TRANSFORM               0x800 /**< modelview/projection matrix state */
50af69d88dSmrg#define MESA_META_TEXTURE                0x1000
51af69d88dSmrg#define MESA_META_VERTEX                 0x2000
52af69d88dSmrg#define MESA_META_VIEWPORT               0x4000
53af69d88dSmrg#define MESA_META_CLAMP_FRAGMENT_COLOR   0x8000
54af69d88dSmrg#define MESA_META_CLAMP_VERTEX_COLOR    0x10000
55af69d88dSmrg#define MESA_META_CONDITIONAL_RENDER    0x20000
56af69d88dSmrg#define MESA_META_CLIP                  0x40000
57af69d88dSmrg#define MESA_META_SELECT_FEEDBACK       0x80000
58af69d88dSmrg#define MESA_META_MULTISAMPLE          0x100000
59af69d88dSmrg#define MESA_META_FRAMEBUFFER_SRGB     0x200000
60af69d88dSmrg#define MESA_META_OCCLUSION_QUERY      0x400000
61af69d88dSmrg#define MESA_META_DRAW_BUFFERS         0x800000
62af69d88dSmrg#define MESA_META_DITHER              0x1000000
63af69d88dSmrg/**\}*/
64af69d88dSmrg
65af69d88dSmrg/**
66af69d88dSmrg * State which we may save/restore across meta ops.
67af69d88dSmrg * XXX this may be incomplete...
68af69d88dSmrg */
69af69d88dSmrgstruct save_state
70af69d88dSmrg{
71af69d88dSmrg   GLbitfield SavedState;  /**< bitmask of MESA_META_* flags */
72af69d88dSmrg
73af69d88dSmrg   /* Always saved/restored with meta. */
74af69d88dSmrg   gl_api API;
7501e04c3fSmrg   uint8_t ExtensionsVersion;
76af69d88dSmrg
77af69d88dSmrg   /** MESA_META_CLEAR (and others?) */
78af69d88dSmrg   struct gl_query_object *CurrentOcclusionObject;
79af69d88dSmrg
80af69d88dSmrg   /** MESA_META_ALPHA_TEST */
81af69d88dSmrg   GLboolean AlphaEnabled;
82af69d88dSmrg   GLenum AlphaFunc;
83af69d88dSmrg   GLclampf AlphaRef;
84af69d88dSmrg
85af69d88dSmrg   /** MESA_META_BLEND */
86af69d88dSmrg   GLbitfield BlendEnabled;
87af69d88dSmrg   GLboolean ColorLogicOpEnabled;
88af69d88dSmrg
89af69d88dSmrg   /** MESA_META_DITHER */
90af69d88dSmrg   GLboolean DitherFlag;
91af69d88dSmrg
92af69d88dSmrg   /** MESA_META_COLOR_MASK */
9301e04c3fSmrg   GLbitfield ColorMask;
94af69d88dSmrg
95af69d88dSmrg   /** MESA_META_DEPTH_TEST */
96af69d88dSmrg   struct gl_depthbuffer_attrib Depth;
97af69d88dSmrg
98af69d88dSmrg   /** MESA_META_FOG */
99af69d88dSmrg   GLboolean Fog;
100af69d88dSmrg
101af69d88dSmrg   /** MESA_META_PIXEL_STORE */
102af69d88dSmrg   struct gl_pixelstore_attrib Pack, Unpack;
103af69d88dSmrg
104af69d88dSmrg   /** MESA_META_PIXEL_TRANSFER */
105af69d88dSmrg   GLfloat RedBias, RedScale;
106af69d88dSmrg   GLfloat GreenBias, GreenScale;
107af69d88dSmrg   GLfloat BlueBias, BlueScale;
108af69d88dSmrg   GLfloat AlphaBias, AlphaScale;
109af69d88dSmrg   GLfloat DepthBias, DepthScale;
110af69d88dSmrg   GLboolean MapColorFlag;
111af69d88dSmrg
112af69d88dSmrg   /** MESA_META_RASTERIZATION */
113af69d88dSmrg   GLenum FrontPolygonMode, BackPolygonMode;
114af69d88dSmrg   GLboolean PolygonOffset;
115af69d88dSmrg   GLboolean PolygonSmooth;
116af69d88dSmrg   GLboolean PolygonStipple;
117af69d88dSmrg   GLboolean PolygonCull;
118af69d88dSmrg
119af69d88dSmrg   /** MESA_META_SCISSOR */
120af69d88dSmrg   struct gl_scissor_attrib Scissor;
121af69d88dSmrg
122af69d88dSmrg   /** MESA_META_SHADER */
123af69d88dSmrg   GLboolean VertexProgramEnabled;
12401e04c3fSmrg   struct gl_program *VertexProgram;
125af69d88dSmrg   GLboolean FragmentProgramEnabled;
12601e04c3fSmrg   struct gl_program *FragmentProgram;
127af69d88dSmrg   GLboolean ATIFragmentShaderEnabled;
12801e04c3fSmrg   struct gl_program *Program[MESA_SHADER_STAGES];
129af69d88dSmrg   struct gl_shader_program *ActiveShader;
130af69d88dSmrg   struct gl_pipeline_object   *Pipeline;
131af69d88dSmrg
132af69d88dSmrg   /** MESA_META_STENCIL_TEST */
133af69d88dSmrg   struct gl_stencil_attrib Stencil;
134af69d88dSmrg
135af69d88dSmrg   /** MESA_META_TRANSFORM */
136af69d88dSmrg   GLfloat ModelviewMatrix[16];
137af69d88dSmrg   GLfloat ProjectionMatrix[16];
138af69d88dSmrg   GLfloat TextureMatrix[16];
13901e04c3fSmrg   /** GL_ARB_clip_control */
14001e04c3fSmrg   GLenum ClipOrigin;     /**< GL_LOWER_LEFT or GL_UPPER_LEFT */
14101e04c3fSmrg   GLenum ClipDepthMode;  /**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */
142af69d88dSmrg
143af69d88dSmrg   /** MESA_META_CLIP */
144af69d88dSmrg   GLbitfield ClipPlanesEnabled;
145af69d88dSmrg
146af69d88dSmrg   /** MESA_META_TEXTURE */
147af69d88dSmrg   GLuint ActiveUnit;
148af69d88dSmrg   /** for unit[0] only */
149af69d88dSmrg   struct gl_texture_object *CurrentTexture[NUM_TEXTURE_TARGETS];
150af69d88dSmrg   /** mask of TEXTURE_2D_BIT, etc */
151af69d88dSmrg   GLbitfield TexEnabled[MAX_TEXTURE_UNITS];
152af69d88dSmrg   GLbitfield TexGenEnabled[MAX_TEXTURE_UNITS];
153af69d88dSmrg   GLuint EnvMode;  /* unit[0] only */
154af69d88dSmrg
155af69d88dSmrg   /** MESA_META_VERTEX */
156af69d88dSmrg   struct gl_vertex_array_object *VAO;
157af69d88dSmrg
158af69d88dSmrg   /** MESA_META_VIEWPORT */
159af69d88dSmrg   GLfloat ViewportX, ViewportY, ViewportW, ViewportH;
16001e04c3fSmrg   GLclampf DepthNear, DepthFar;
161af69d88dSmrg
162af69d88dSmrg   /** MESA_META_CLAMP_FRAGMENT_COLOR */
163af69d88dSmrg   GLenum ClampFragmentColor;
164af69d88dSmrg
165af69d88dSmrg   /** MESA_META_CLAMP_VERTEX_COLOR */
166af69d88dSmrg   GLenum ClampVertexColor;
167af69d88dSmrg
168af69d88dSmrg   /** MESA_META_CONDITIONAL_RENDER */
169af69d88dSmrg   struct gl_query_object *CondRenderQuery;
170af69d88dSmrg   GLenum CondRenderMode;
171af69d88dSmrg
172af69d88dSmrg   /** MESA_META_SELECT_FEEDBACK */
173af69d88dSmrg   GLenum RenderMode;
174af69d88dSmrg   struct gl_selection Select;
175af69d88dSmrg   struct gl_feedback Feedback;
176af69d88dSmrg
177af69d88dSmrg   /** MESA_META_MULTISAMPLE */
178af69d88dSmrg   struct gl_multisample_attrib Multisample;
179af69d88dSmrg
180af69d88dSmrg   /** MESA_META_FRAMEBUFFER_SRGB */
181af69d88dSmrg   GLboolean sRGBEnabled;
182af69d88dSmrg
183af69d88dSmrg   /** Miscellaneous (always disabled) */
184af69d88dSmrg   GLboolean Lighting;
185af69d88dSmrg   GLboolean RasterDiscard;
186af69d88dSmrg   GLboolean TransformFeedbackNeedsResume;
187af69d88dSmrg
18801e04c3fSmrg   struct gl_framebuffer *DrawBuffer;
18901e04c3fSmrg   struct gl_framebuffer *ReadBuffer;
190af69d88dSmrg
191af69d88dSmrg   /** MESA_META_DRAW_BUFFERS */
19201e04c3fSmrg   GLenum16 ColorDrawBuffers[MAX_DRAW_BUFFERS];
193af69d88dSmrg};
194af69d88dSmrg
195af69d88dSmrg/**
196af69d88dSmrg * Temporary texture used for glBlitFramebuffer, glDrawPixels, etc.
197af69d88dSmrg * This is currently shared by all the meta ops.  But we could create a
198af69d88dSmrg * separate one for each of glDrawPixel, glBlitFramebuffer, glCopyPixels, etc.
199af69d88dSmrg */
200af69d88dSmrgstruct temp_texture
201af69d88dSmrg{
20201e04c3fSmrg   struct gl_texture_object *tex_obj;
203af69d88dSmrg   GLenum Target;         /**< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE */
204af69d88dSmrg   GLsizei MinSize;       /**< Min texture size to allocate */
205af69d88dSmrg   GLsizei MaxSize;       /**< Max possible texture size */
206af69d88dSmrg   GLboolean NPOT;        /**< Non-power of two size OK? */
207af69d88dSmrg   GLsizei Width, Height; /**< Current texture size */
208af69d88dSmrg   GLenum IntFormat;
209af69d88dSmrg   GLfloat Sright, Ttop;  /**< right, top texcoords */
210af69d88dSmrg};
211af69d88dSmrg
212af69d88dSmrg/**
213af69d88dSmrg * State for GLSL texture sampler which is used to generate fragment
214af69d88dSmrg * shader in _mesa_meta_generate_mipmap().
215af69d88dSmrg */
216af69d88dSmrgstruct blit_shader {
217af69d88dSmrg   const char *type;
218af69d88dSmrg   const char *func;
219af69d88dSmrg   const char *texcoords;
22001e04c3fSmrg   struct gl_shader_program *shader_prog;
221af69d88dSmrg};
222af69d88dSmrg
223af69d88dSmrg/**
224af69d88dSmrg * Table of all sampler types and shaders for accessing them.
225af69d88dSmrg */
226af69d88dSmrgstruct blit_shader_table {
227af69d88dSmrg   struct blit_shader sampler_1d;
228af69d88dSmrg   struct blit_shader sampler_2d;
229af69d88dSmrg   struct blit_shader sampler_3d;
230af69d88dSmrg   struct blit_shader sampler_rect;
231af69d88dSmrg   struct blit_shader sampler_cubemap;
232af69d88dSmrg   struct blit_shader sampler_1d_array;
233af69d88dSmrg   struct blit_shader sampler_2d_array;
234af69d88dSmrg   struct blit_shader sampler_cubemap_array;
235af69d88dSmrg};
236af69d88dSmrg
237af69d88dSmrg/**
238af69d88dSmrg * State for glBlitFramebufer()
239af69d88dSmrg */
240af69d88dSmrgstruct blit_state
241af69d88dSmrg{
242af69d88dSmrg   GLuint VAO;
24301e04c3fSmrg   struct gl_buffer_object *buf_obj;
24401e04c3fSmrg   struct blit_shader_table shaders_with_depth;
24501e04c3fSmrg   struct blit_shader_table shaders_without_depth;
246af69d88dSmrg   struct temp_texture depthTex;
247af69d88dSmrg   bool no_ctsi_fallback;
248af69d88dSmrg};
249af69d88dSmrg
250af69d88dSmrgstruct fb_tex_blit_state
251af69d88dSmrg{
252af69d88dSmrg   GLint baseLevelSave, maxLevelSave;
25301e04c3fSmrg   struct gl_sampler_object *samp_obj;
25401e04c3fSmrg   struct gl_sampler_object *samp_obj_save;
25501e04c3fSmrg   struct gl_texture_object *tex_obj;
25601e04c3fSmrg   struct gl_texture_object *temp_tex_obj;
25701e04c3fSmrg   GLuint stencilSamplingSave;
258af69d88dSmrg};
259af69d88dSmrg
260af69d88dSmrg
261af69d88dSmrg/**
262af69d88dSmrg * State for glClear()
263af69d88dSmrg */
264af69d88dSmrgstruct clear_state
265af69d88dSmrg{
266af69d88dSmrg   GLuint VAO;
26701e04c3fSmrg   struct gl_buffer_object *buf_obj;
26801e04c3fSmrg   struct gl_shader_program *ShaderProg;
269af69d88dSmrg};
270af69d88dSmrg
271af69d88dSmrg
272af69d88dSmrg/**
273af69d88dSmrg * State for glCopyPixels()
274af69d88dSmrg */
275af69d88dSmrgstruct copypix_state
276af69d88dSmrg{
277af69d88dSmrg   GLuint VAO;
27801e04c3fSmrg   struct gl_buffer_object *buf_obj;
279af69d88dSmrg};
280af69d88dSmrg
281af69d88dSmrg
282af69d88dSmrg/**
283af69d88dSmrg * State for glDrawPixels()
284af69d88dSmrg */
285af69d88dSmrgstruct drawpix_state
286af69d88dSmrg{
287af69d88dSmrg   GLuint VAO;
28801e04c3fSmrg   struct gl_buffer_object *buf_obj;
289af69d88dSmrg
290af69d88dSmrg   GLuint StencilFP;  /**< Fragment program for drawing stencil images */
291af69d88dSmrg   GLuint DepthFP;  /**< Fragment program for drawing depth images */
292af69d88dSmrg};
293af69d88dSmrg
294af69d88dSmrg
295af69d88dSmrg/**
296af69d88dSmrg * State for glBitmap()
297af69d88dSmrg */
298af69d88dSmrgstruct bitmap_state
299af69d88dSmrg{
300af69d88dSmrg   GLuint VAO;
30101e04c3fSmrg   struct gl_buffer_object *buf_obj;
302af69d88dSmrg   struct temp_texture Tex;  /**< separate texture from other meta ops */
303af69d88dSmrg};
304af69d88dSmrg
305af69d88dSmrg/**
306af69d88dSmrg * State for _mesa_meta_generate_mipmap()
307af69d88dSmrg */
308af69d88dSmrgstruct gen_mipmap_state
309af69d88dSmrg{
310af69d88dSmrg   GLuint VAO;
31101e04c3fSmrg   struct gl_buffer_object *buf_obj;
31201e04c3fSmrg   struct gl_framebuffer *fb;
31301e04c3fSmrg   struct gl_sampler_object *samp_obj;
314af69d88dSmrg
315af69d88dSmrg   struct blit_shader_table shaders;
316af69d88dSmrg};
317af69d88dSmrg
318af69d88dSmrg/**
319af69d88dSmrg * One of the FBO states for decompress_state. There will be one for each
320af69d88dSmrg * required renderbuffer format.
321af69d88dSmrg */
322af69d88dSmrgstruct decompress_fbo_state
323af69d88dSmrg{
32401e04c3fSmrg   struct gl_renderbuffer *rb;
32501e04c3fSmrg   struct gl_framebuffer *fb;
326af69d88dSmrg   GLint Width, Height;
327af69d88dSmrg};
328af69d88dSmrg
329af69d88dSmrg/**
330af69d88dSmrg * State for texture decompression
331af69d88dSmrg */
332af69d88dSmrgstruct decompress_state
333af69d88dSmrg{
334af69d88dSmrg   GLuint VAO;
335af69d88dSmrg   struct decompress_fbo_state byteFBO, floatFBO;
33601e04c3fSmrg   struct gl_buffer_object *buf_obj;
33701e04c3fSmrg   struct gl_sampler_object *samp_obj;
338af69d88dSmrg
339af69d88dSmrg   struct blit_shader_table shaders;
340af69d88dSmrg};
341af69d88dSmrg
342af69d88dSmrg/**
343af69d88dSmrg * State for glDrawTex()
344af69d88dSmrg */
345af69d88dSmrgstruct drawtex_state
346af69d88dSmrg{
347af69d88dSmrg   GLuint VAO;
34801e04c3fSmrg   struct gl_buffer_object *buf_obj;
349af69d88dSmrg};
350af69d88dSmrg
351af69d88dSmrg#define MAX_META_OPS_DEPTH      8
352af69d88dSmrg/**
353af69d88dSmrg * All per-context meta state.
354af69d88dSmrg */
355af69d88dSmrgstruct gl_meta_state
356af69d88dSmrg{
357af69d88dSmrg   /** Stack of state saved during meta-ops */
358af69d88dSmrg   struct save_state Save[MAX_META_OPS_DEPTH];
359af69d88dSmrg   /** Save stack depth */
360af69d88dSmrg   GLuint SaveStackDepth;
361af69d88dSmrg
362af69d88dSmrg   struct temp_texture TempTex;
363af69d88dSmrg
364af69d88dSmrg   struct blit_state Blit;    /**< For _mesa_meta_BlitFramebuffer() */
365af69d88dSmrg   struct clear_state Clear;  /**< For _mesa_meta_Clear() */
366af69d88dSmrg   struct copypix_state CopyPix;  /**< For _mesa_meta_CopyPixels() */
367af69d88dSmrg   struct drawpix_state DrawPix;  /**< For _mesa_meta_DrawPixels() */
368af69d88dSmrg   struct bitmap_state Bitmap;    /**< For _mesa_meta_Bitmap() */
369af69d88dSmrg   struct gen_mipmap_state Mipmap;    /**< For _mesa_meta_GenerateMipmap() */
370af69d88dSmrg   struct decompress_state Decompress;  /**< For texture decompression */
371af69d88dSmrg   struct drawtex_state DrawTex;  /**< For _mesa_meta_DrawTex() */
372af69d88dSmrg};
373af69d88dSmrg
374af69d88dSmrgstruct vertex {
375af69d88dSmrg   GLfloat x, y, z, tex[4];
376af69d88dSmrg   GLfloat r, g, b, a;
377af69d88dSmrg};
3784a49301eSmrg
3794a49301eSmrgextern void
3803464ebd5Sriastradh_mesa_meta_init(struct gl_context *ctx);
3814a49301eSmrg
3824a49301eSmrgextern void
3833464ebd5Sriastradh_mesa_meta_free(struct gl_context *ctx);
3844a49301eSmrg
3854a49301eSmrgextern void
386af69d88dSmrg_mesa_meta_begin(struct gl_context *ctx, GLbitfield state);
387af69d88dSmrg
388af69d88dSmrgextern void
389af69d88dSmrg_mesa_meta_end(struct gl_context *ctx);
390af69d88dSmrg
39101e04c3fSmrgstatic inline bool
39201e04c3fSmrg_mesa_meta_in_progress(struct gl_context *ctx)
39301e04c3fSmrg{
39401e04c3fSmrg   return ctx->Meta->SaveStackDepth != 0;
39501e04c3fSmrg}
396af69d88dSmrg
397af69d88dSmrgextern void
39801e04c3fSmrg_mesa_meta_fb_tex_blit_begin(struct gl_context *ctx,
399af69d88dSmrg                             struct fb_tex_blit_state *blit);
400af69d88dSmrg
401af69d88dSmrgextern void
402af69d88dSmrg_mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
403af69d88dSmrg                           struct fb_tex_blit_state *blit);
404af69d88dSmrg
405af69d88dSmrgextern GLbitfield
4063464ebd5Sriastradh_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
40701e04c3fSmrg                           const struct gl_framebuffer *readFb,
40801e04c3fSmrg                           const struct gl_framebuffer *drawFb,
4094a49301eSmrg                           GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
4104a49301eSmrg                           GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
4114a49301eSmrg                           GLbitfield mask, GLenum filter);
4124a49301eSmrg
413af69d88dSmrgextern void
414af69d88dSmrg_mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
41501e04c3fSmrg                                      struct gl_framebuffer *readFb,
41601e04c3fSmrg                                      struct gl_framebuffer *drawFb,
417af69d88dSmrg                                      GLint srcX0, GLint srcY0,
418af69d88dSmrg                                      GLint srcX1, GLint srcY1,
419af69d88dSmrg                                      GLint dstX0, GLint dstY0,
420af69d88dSmrg                                      GLint dstX1, GLint dstY1,
421af69d88dSmrg                                      GLbitfield mask, GLenum filter);
422af69d88dSmrg
4234a49301eSmrgextern void
4243464ebd5Sriastradh_mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers);
4254a49301eSmrg
426af69d88dSmrgextern void
427af69d88dSmrg_mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers);
428af69d88dSmrg
4294a49301eSmrgextern void
4303464ebd5Sriastradh_mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
4314a49301eSmrg                      GLsizei width, GLsizei height,
4324a49301eSmrg                      GLint dstx, GLint dsty, GLenum type);
4334a49301eSmrg
4344a49301eSmrgextern void
4353464ebd5Sriastradh_mesa_meta_DrawPixels(struct gl_context *ctx,
4364a49301eSmrg                      GLint x, GLint y, GLsizei width, GLsizei height,
4374a49301eSmrg                      GLenum format, GLenum type,
4384a49301eSmrg                      const struct gl_pixelstore_attrib *unpack,
4394a49301eSmrg                      const GLvoid *pixels);
4404a49301eSmrg
4414a49301eSmrgextern void
4423464ebd5Sriastradh_mesa_meta_Bitmap(struct gl_context *ctx,
4434a49301eSmrg                  GLint x, GLint y, GLsizei width, GLsizei height,
4444a49301eSmrg                  const struct gl_pixelstore_attrib *unpack,
4454a49301eSmrg                  const GLubyte *bitmap);
4464a49301eSmrg
4474a49301eSmrgextern void
4483464ebd5Sriastradh_mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
4494a49301eSmrg                          struct gl_texture_object *texObj);
4504a49301eSmrg
4514a49301eSmrgextern void
452af69d88dSmrg_mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
453af69d88dSmrg                           struct gl_texture_image *texImage,
454af69d88dSmrg                           GLint xoffset, GLint yoffset, GLint slice,
455af69d88dSmrg                           struct gl_renderbuffer *rb,
456af69d88dSmrg                           GLint x, GLint y,
457af69d88dSmrg                           GLsizei width, GLsizei height);
4584a49301eSmrg
4594a49301eSmrgextern void
460af69d88dSmrg_mesa_meta_ClearTexSubImage(struct gl_context *ctx,
461af69d88dSmrg                            struct gl_texture_image *texImage,
462af69d88dSmrg                            GLint xoffset, GLint yoffset, GLint zoffset,
463af69d88dSmrg                            GLsizei width, GLsizei height, GLsizei depth,
464af69d88dSmrg                            const GLvoid *clearValue);
4654a49301eSmrg
4664a49301eSmrgextern void
46701e04c3fSmrg_mesa_meta_GetTexSubImage(struct gl_context *ctx,
46801e04c3fSmrg                          GLint xoffset, GLint yoffset, GLint zoffset,
46901e04c3fSmrg                          GLsizei width, GLsizei height, GLsizei depth,
47001e04c3fSmrg                          GLenum format, GLenum type, GLvoid *pixels,
47101e04c3fSmrg                          struct gl_texture_image *texImage);
4724a49301eSmrg
4734a49301eSmrgextern void
474af69d88dSmrg_mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
475af69d88dSmrg                   GLfloat width, GLfloat height);
4764a49301eSmrg
477af69d88dSmrg/* meta-internal functions */
478af69d88dSmrgvoid
479af69d88dSmrg_mesa_meta_drawbuffers_from_bitfield(GLbitfield bits);
4804a49301eSmrg
48101e04c3fSmrgvoid
48201e04c3fSmrg_mesa_meta_link_program_with_debug(struct gl_context *ctx,
48301e04c3fSmrg                                   struct gl_shader_program *sh_prog);
4844a49301eSmrg
485af69d88dSmrgvoid
486af69d88dSmrg_mesa_meta_compile_and_link_program(struct gl_context *ctx,
487af69d88dSmrg                                    const char *vs_source,
488af69d88dSmrg                                    const char *fs_source,
489af69d88dSmrg                                    const char *name,
49001e04c3fSmrg                                    struct gl_shader_program **sh_prog_ptr);
49101e04c3fSmrg
49201e04c3fSmrgextern void
49301e04c3fSmrg_mesa_meta_use_program(struct gl_context *ctx,
49401e04c3fSmrg                       struct gl_shader_program *sh_prog);
495af69d88dSmrg
496af69d88dSmrgGLboolean
497af69d88dSmrg_mesa_meta_alloc_texture(struct temp_texture *tex,
498af69d88dSmrg                         GLsizei width, GLsizei height, GLenum intFormat);
499af69d88dSmrg
500af69d88dSmrgvoid
501af69d88dSmrg_mesa_meta_setup_texture_coords(GLenum faceTarget,
502af69d88dSmrg                                GLint slice,
50301e04c3fSmrg                                GLint xoffset,
50401e04c3fSmrg                                GLint yoffset,
505af69d88dSmrg                                GLint width,
506af69d88dSmrg                                GLint height,
50701e04c3fSmrg                                GLint total_width,
50801e04c3fSmrg                                GLint total_height,
50901e04c3fSmrg                                GLint total_depth,
510af69d88dSmrg                                GLfloat coords0[4],
511af69d88dSmrg                                GLfloat coords1[4],
512af69d88dSmrg                                GLfloat coords2[4],
513af69d88dSmrg                                GLfloat coords3[4]);
514af69d88dSmrg
515af69d88dSmrgstruct temp_texture *
516af69d88dSmrg_mesa_meta_get_temp_texture(struct gl_context *ctx);
517af69d88dSmrg
518af69d88dSmrgstruct temp_texture *
519af69d88dSmrg_mesa_meta_get_temp_depth_texture(struct gl_context *ctx);
520af69d88dSmrg
521af69d88dSmrgvoid
52201e04c3fSmrg_mesa_meta_setup_vertex_objects(struct gl_context *ctx,
52301e04c3fSmrg                                GLuint *VAO, struct gl_buffer_object **buf_obj,
524af69d88dSmrg                                bool use_generic_attributes,
525af69d88dSmrg                                unsigned vertex_size, unsigned texcoord_size,
526af69d88dSmrg                                unsigned color_size);
527af69d88dSmrg
528af69d88dSmrgvoid
52901e04c3fSmrg_mesa_meta_setup_ff_tnl_for_blit(struct gl_context *ctx,
53001e04c3fSmrg                                 GLuint *VAO, struct gl_buffer_object **buf_obj,
531af69d88dSmrg                                 unsigned texcoord_size);
532af69d88dSmrg
533af69d88dSmrgvoid
534af69d88dSmrg_mesa_meta_setup_drawpix_texture(struct gl_context *ctx,
535af69d88dSmrg                                 struct temp_texture *tex,
536af69d88dSmrg                                 GLboolean newTex,
537af69d88dSmrg                                 GLsizei width, GLsizei height,
538af69d88dSmrg                                 GLenum format, GLenum type,
539af69d88dSmrg                                 const GLvoid *pixels);
540af69d88dSmrg
541af69d88dSmrgvoid
542af69d88dSmrg_mesa_meta_setup_copypix_texture(struct gl_context *ctx,
543af69d88dSmrg                                 struct temp_texture *tex,
544af69d88dSmrg                                 GLint srcX, GLint srcY,
545af69d88dSmrg                                 GLsizei width, GLsizei height,
546af69d88dSmrg                                 GLenum intFormat,
547af69d88dSmrg                                 GLenum filter);
548af69d88dSmrg
549af69d88dSmrgvoid
550af69d88dSmrg_mesa_meta_setup_blit_shader(struct gl_context *ctx,
551af69d88dSmrg                             GLenum target,
55201e04c3fSmrg                             bool do_depth,
553af69d88dSmrg                             struct blit_shader_table *table);
554af69d88dSmrg
555af69d88dSmrgvoid
55601e04c3fSmrg_mesa_meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit);
557af69d88dSmrg
558af69d88dSmrgvoid
55901e04c3fSmrg_mesa_meta_blit_shader_table_cleanup(struct gl_context *ctx,
56001e04c3fSmrg                                     struct blit_shader_table *table);
561af69d88dSmrg
562af69d88dSmrgvoid
56301e04c3fSmrg_mesa_meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
56401e04c3fSmrg                                        struct gen_mipmap_state *mipmap);
5654a49301eSmrg
566af69d88dSmrgvoid
56701e04c3fSmrg_mesa_meta_framebuffer_texture_image(struct gl_context *ctx,
56801e04c3fSmrg                                     struct gl_framebuffer *fb,
56901e04c3fSmrg                                     GLenum attachment,
57001e04c3fSmrg                                     struct gl_texture_image *texImage,
57101e04c3fSmrg                                     GLuint layer);
5724a49301eSmrg
5734a49301eSmrg#endif /* META_H */
574