OSDN Git Service

meta/blit: Use internal functions for sampler object access
[android-x86/external-mesa.git] / src / mesa / drivers / common / meta.h
1 /*
2  * Mesa 3-D graphics library
3  *
4  * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  */
24
25
26 #ifndef META_H
27 #define META_H
28
29 #include "main/mtypes.h"
30
31 /**
32  * \name Flags for meta operations
33  * \{
34  *
35  * These flags are passed to _mesa_meta_begin().
36  */
37 #define MESA_META_ALL                      ~0x0
38 #define MESA_META_ALPHA_TEST                0x1
39 #define MESA_META_BLEND                     0x2  /**< includes logicop */
40 #define MESA_META_COLOR_MASK                0x4
41 #define MESA_META_DEPTH_TEST                0x8
42 #define MESA_META_FOG                      0x10
43 #define MESA_META_PIXEL_STORE              0x20
44 #define MESA_META_PIXEL_TRANSFER           0x40
45 #define MESA_META_RASTERIZATION            0x80
46 #define MESA_META_SCISSOR                 0x100
47 #define MESA_META_SHADER                  0x200
48 #define MESA_META_STENCIL_TEST            0x400
49 #define MESA_META_TRANSFORM               0x800 /**< modelview/projection matrix state */
50 #define MESA_META_TEXTURE                0x1000
51 #define MESA_META_VERTEX                 0x2000
52 #define MESA_META_VIEWPORT               0x4000
53 #define MESA_META_CLAMP_FRAGMENT_COLOR   0x8000
54 #define MESA_META_CLAMP_VERTEX_COLOR    0x10000
55 #define MESA_META_CONDITIONAL_RENDER    0x20000
56 #define MESA_META_CLIP                  0x40000
57 #define MESA_META_SELECT_FEEDBACK       0x80000
58 #define MESA_META_MULTISAMPLE          0x100000
59 #define MESA_META_FRAMEBUFFER_SRGB     0x200000
60 #define MESA_META_OCCLUSION_QUERY      0x400000
61 #define MESA_META_DRAW_BUFFERS         0x800000
62 #define MESA_META_DITHER              0x1000000
63 /**\}*/
64
65 /**
66  * State which we may save/restore across meta ops.
67  * XXX this may be incomplete...
68  */
69 struct save_state
70 {
71    GLbitfield SavedState;  /**< bitmask of MESA_META_* flags */
72
73    /* Always saved/restored with meta. */
74    gl_api API;
75    uint8_t ExtensionsVersion;
76
77    /** MESA_META_CLEAR (and others?) */
78    struct gl_query_object *CurrentOcclusionObject;
79
80    /** MESA_META_ALPHA_TEST */
81    GLboolean AlphaEnabled;
82    GLenum AlphaFunc;
83    GLclampf AlphaRef;
84
85    /** MESA_META_BLEND */
86    GLbitfield BlendEnabled;
87    GLboolean ColorLogicOpEnabled;
88
89    /** MESA_META_DITHER */
90    GLboolean DitherFlag;
91
92    /** MESA_META_COLOR_MASK */
93    GLubyte ColorMask[MAX_DRAW_BUFFERS][4];
94
95    /** MESA_META_DEPTH_TEST */
96    struct gl_depthbuffer_attrib Depth;
97
98    /** MESA_META_FOG */
99    GLboolean Fog;
100
101    /** MESA_META_PIXEL_STORE */
102    struct gl_pixelstore_attrib Pack, Unpack;
103
104    /** MESA_META_PIXEL_TRANSFER */
105    GLfloat RedBias, RedScale;
106    GLfloat GreenBias, GreenScale;
107    GLfloat BlueBias, BlueScale;
108    GLfloat AlphaBias, AlphaScale;
109    GLfloat DepthBias, DepthScale;
110    GLboolean MapColorFlag;
111
112    /** MESA_META_RASTERIZATION */
113    GLenum FrontPolygonMode, BackPolygonMode;
114    GLboolean PolygonOffset;
115    GLboolean PolygonSmooth;
116    GLboolean PolygonStipple;
117    GLboolean PolygonCull;
118
119    /** MESA_META_SCISSOR */
120    struct gl_scissor_attrib Scissor;
121
122    /** MESA_META_SHADER */
123    GLboolean VertexProgramEnabled;
124    struct gl_vertex_program *VertexProgram;
125    GLboolean FragmentProgramEnabled;
126    struct gl_fragment_program *FragmentProgram;
127    GLboolean ATIFragmentShaderEnabled;
128    struct gl_shader_program *Shader[MESA_SHADER_STAGES];
129    struct gl_shader_program *ActiveShader;
130    struct gl_pipeline_object   *Pipeline;
131
132    /** MESA_META_STENCIL_TEST */
133    struct gl_stencil_attrib Stencil;
134
135    /** MESA_META_TRANSFORM */
136    GLenum MatrixMode;
137    GLfloat ModelviewMatrix[16];
138    GLfloat ProjectionMatrix[16];
139    GLfloat TextureMatrix[16];
140    /** GL_ARB_clip_control */
141    GLenum ClipOrigin;     /**< GL_LOWER_LEFT or GL_UPPER_LEFT */
142    GLenum ClipDepthMode;  /**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */
143
144    /** MESA_META_CLIP */
145    GLbitfield ClipPlanesEnabled;
146
147    /** MESA_META_TEXTURE */
148    GLuint ActiveUnit;
149    /** for unit[0] only */
150    struct gl_texture_object *CurrentTexture[NUM_TEXTURE_TARGETS];
151    /** mask of TEXTURE_2D_BIT, etc */
152    GLbitfield TexEnabled[MAX_TEXTURE_UNITS];
153    GLbitfield TexGenEnabled[MAX_TEXTURE_UNITS];
154    GLuint EnvMode;  /* unit[0] only */
155
156    /** MESA_META_VERTEX */
157    struct gl_vertex_array_object *VAO;
158
159    /** MESA_META_VIEWPORT */
160    GLfloat ViewportX, ViewportY, ViewportW, ViewportH;
161    GLclampd DepthNear, DepthFar;
162
163    /** MESA_META_CLAMP_FRAGMENT_COLOR */
164    GLenum ClampFragmentColor;
165
166    /** MESA_META_CLAMP_VERTEX_COLOR */
167    GLenum ClampVertexColor;
168
169    /** MESA_META_CONDITIONAL_RENDER */
170    struct gl_query_object *CondRenderQuery;
171    GLenum CondRenderMode;
172
173    /** MESA_META_SELECT_FEEDBACK */
174    GLenum RenderMode;
175    struct gl_selection Select;
176    struct gl_feedback Feedback;
177
178    /** MESA_META_MULTISAMPLE */
179    struct gl_multisample_attrib Multisample;
180
181    /** MESA_META_FRAMEBUFFER_SRGB */
182    GLboolean sRGBEnabled;
183
184    /** Miscellaneous (always disabled) */
185    GLboolean Lighting;
186    GLboolean RasterDiscard;
187    GLboolean TransformFeedbackNeedsResume;
188
189    GLuint DrawBufferName, ReadBufferName, RenderbufferName;
190
191    /** MESA_META_DRAW_BUFFERS */
192    GLenum ColorDrawBuffers[MAX_DRAW_BUFFERS];
193 };
194
195 /**
196  * Temporary texture used for glBlitFramebuffer, glDrawPixels, etc.
197  * This is currently shared by all the meta ops.  But we could create a
198  * separate one for each of glDrawPixel, glBlitFramebuffer, glCopyPixels, etc.
199  */
200 struct temp_texture
201 {
202    GLuint TexObj;
203    GLenum Target;         /**< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE */
204    GLsizei MinSize;       /**< Min texture size to allocate */
205    GLsizei MaxSize;       /**< Max possible texture size */
206    GLboolean NPOT;        /**< Non-power of two size OK? */
207    GLsizei Width, Height; /**< Current texture size */
208    GLenum IntFormat;
209    GLfloat Sright, Ttop;  /**< right, top texcoords */
210 };
211
212 /**
213  * State for GLSL texture sampler which is used to generate fragment
214  * shader in _mesa_meta_generate_mipmap().
215  */
216 struct blit_shader {
217    const char *type;
218    const char *func;
219    const char *texcoords;
220    GLuint shader_prog;
221 };
222
223 /**
224  * Table of all sampler types and shaders for accessing them.
225  */
226 struct blit_shader_table {
227    struct blit_shader sampler_1d;
228    struct blit_shader sampler_2d;
229    struct blit_shader sampler_3d;
230    struct blit_shader sampler_rect;
231    struct blit_shader sampler_cubemap;
232    struct blit_shader sampler_1d_array;
233    struct blit_shader sampler_2d_array;
234    struct blit_shader sampler_cubemap_array;
235 };
236
237 /**
238  * Indices in the blit_state->msaa_shaders[] array
239  *
240  * Note that setup_glsl_msaa_blit_shader() assumes that the _INT enums are five
241  * more than the corresponding non-_INT versions and _UINT are five beyond that.
242  */
243 enum blit_msaa_shader {
244    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
245    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
246    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
247    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
248    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
249    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
250    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
251    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
252    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
253    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
254    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
255    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
256    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
257    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
258    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
259    BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY,
260    BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_INT,
261    BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_UINT,
262    BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_RESOLVE,
263    BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_COPY,
264    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
265    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
266    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
267    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
268    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
269    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
270    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
271    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
272    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
273    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
274    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
275    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
276    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
277    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
278    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
279    BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY,
280    BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY_INT,
281    BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY_UINT,
282    BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_RESOLVE,
283    BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_COPY,
284    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_SCALED_RESOLVE,
285    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_SCALED_RESOLVE,
286    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_SCALED_RESOLVE,
287    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_SCALED_RESOLVE,
288    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_SCALED_RESOLVE,
289    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_SCALED_RESOLVE,
290    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_SCALED_RESOLVE,
291    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_SCALED_RESOLVE,
292    BLIT_MSAA_SHADER_COUNT,
293 };
294
295 /**
296  * State for glBlitFramebufer()
297  */
298 struct blit_state
299 {
300    GLuint VAO;
301    struct gl_buffer_object *buf_obj;
302    struct blit_shader_table shaders_with_depth;
303    struct blit_shader_table shaders_without_depth;
304    GLuint msaa_shaders[BLIT_MSAA_SHADER_COUNT];
305    struct temp_texture depthTex;
306    bool no_ctsi_fallback;
307 };
308
309 struct fb_tex_blit_state
310 {
311    GLint baseLevelSave, maxLevelSave;
312    struct gl_sampler_object *samp_obj;
313    GLuint samplerSave, stencilSamplingSave;
314    GLuint tempTex;
315 };
316
317
318 /**
319  * State for glClear()
320  */
321 struct clear_state
322 {
323    GLuint VAO;
324    struct gl_buffer_object *buf_obj;
325    GLuint ShaderProg;
326    GLuint IntegerShaderProg;
327 };
328
329
330 /**
331  * State for glCopyPixels()
332  */
333 struct copypix_state
334 {
335    GLuint VAO;
336    struct gl_buffer_object *buf_obj;
337 };
338
339
340 /**
341  * State for glDrawPixels()
342  */
343 struct drawpix_state
344 {
345    GLuint VAO;
346    struct gl_buffer_object *buf_obj;
347
348    GLuint StencilFP;  /**< Fragment program for drawing stencil images */
349    GLuint DepthFP;  /**< Fragment program for drawing depth images */
350 };
351
352
353 /**
354  * State for glBitmap()
355  */
356 struct bitmap_state
357 {
358    GLuint VAO;
359    struct gl_buffer_object *buf_obj;
360    struct temp_texture Tex;  /**< separate texture from other meta ops */
361 };
362
363 /**
364  * State for _mesa_meta_generate_mipmap()
365  */
366 struct gen_mipmap_state
367 {
368    GLuint VAO;
369    struct gl_buffer_object *buf_obj;
370    GLuint FBO;
371    GLuint Sampler;
372
373    struct blit_shader_table shaders;
374 };
375
376 /**
377  * One of the FBO states for decompress_state. There will be one for each
378  * required renderbuffer format.
379  */
380 struct decompress_fbo_state
381 {
382    GLuint FBO, RBO;
383    GLint Width, Height;
384 };
385
386 /**
387  * State for texture decompression
388  */
389 struct decompress_state
390 {
391    GLuint VAO;
392    struct decompress_fbo_state byteFBO, floatFBO;
393    struct gl_buffer_object *buf_obj;
394    GLuint Sampler;
395
396    struct blit_shader_table shaders;
397 };
398
399 /**
400  * State for glDrawTex()
401  */
402 struct drawtex_state
403 {
404    GLuint VAO;
405    struct gl_buffer_object *buf_obj;
406 };
407
408 #define MAX_META_OPS_DEPTH      8
409 /**
410  * All per-context meta state.
411  */
412 struct gl_meta_state
413 {
414    /** Stack of state saved during meta-ops */
415    struct save_state Save[MAX_META_OPS_DEPTH];
416    /** Save stack depth */
417    GLuint SaveStackDepth;
418
419    struct temp_texture TempTex;
420
421    struct blit_state Blit;    /**< For _mesa_meta_BlitFramebuffer() */
422    struct clear_state Clear;  /**< For _mesa_meta_Clear() */
423    struct copypix_state CopyPix;  /**< For _mesa_meta_CopyPixels() */
424    struct drawpix_state DrawPix;  /**< For _mesa_meta_DrawPixels() */
425    struct bitmap_state Bitmap;    /**< For _mesa_meta_Bitmap() */
426    struct gen_mipmap_state Mipmap;    /**< For _mesa_meta_GenerateMipmap() */
427    struct decompress_state Decompress;  /**< For texture decompression */
428    struct drawtex_state DrawTex;  /**< For _mesa_meta_DrawTex() */
429 };
430
431 struct vertex {
432    GLfloat x, y, z, tex[4];
433    GLfloat r, g, b, a;
434 };
435
436 extern void
437 _mesa_meta_init(struct gl_context *ctx);
438
439 extern void
440 _mesa_meta_free(struct gl_context *ctx);
441
442 extern void
443 _mesa_meta_begin(struct gl_context *ctx, GLbitfield state);
444
445 extern void
446 _mesa_meta_end(struct gl_context *ctx);
447
448 static inline bool
449 _mesa_meta_in_progress(struct gl_context *ctx)
450 {
451    return ctx->Meta->SaveStackDepth != 0;
452 }
453
454 extern void
455 _mesa_meta_fb_tex_blit_begin(const struct gl_context *ctx,
456                              struct fb_tex_blit_state *blit);
457
458 extern void
459 _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
460                            struct fb_tex_blit_state *blit);
461
462 extern GLboolean
463 _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
464                                 struct gl_renderbuffer *rb,
465                                 GLuint *tex,
466                                 struct gl_texture_object **texObj,
467                                 GLenum *target);
468
469 struct gl_sampler_object *
470 _mesa_meta_setup_sampler(struct gl_context *ctx,
471                          const struct gl_texture_object *texObj,
472                          GLenum target, GLenum filter, GLuint srcLevel);
473
474 extern GLbitfield
475 _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
476                            const struct gl_framebuffer *readFb,
477                            const struct gl_framebuffer *drawFb,
478                            GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
479                            GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
480                            GLbitfield mask, GLenum filter);
481
482 extern void
483 _mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
484                                       struct gl_framebuffer *readFb,
485                                       struct gl_framebuffer *drawFb,
486                                       GLint srcX0, GLint srcY0,
487                                       GLint srcX1, GLint srcY1,
488                                       GLint dstX0, GLint dstY0,
489                                       GLint dstX1, GLint dstY1,
490                                       GLbitfield mask, GLenum filter);
491
492 bool
493 _mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
494                                          struct gl_texture_image *src_tex_image,
495                                          struct gl_renderbuffer *src_renderbuffer,
496                                          int src_x, int src_y, int src_z,
497                                          struct gl_texture_image *dst_tex_image,
498                                          struct gl_renderbuffer *dst_renderbuffer,
499                                          int dst_x, int dst_y, int dst_z,
500                                          int src_width, int src_height);
501
502 extern void
503 _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers);
504
505 extern void
506 _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers);
507
508 extern void
509 _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
510                       GLsizei width, GLsizei height,
511                       GLint dstx, GLint dsty, GLenum type);
512
513 extern void
514 _mesa_meta_DrawPixels(struct gl_context *ctx,
515                       GLint x, GLint y, GLsizei width, GLsizei height,
516                       GLenum format, GLenum type,
517                       const struct gl_pixelstore_attrib *unpack,
518                       const GLvoid *pixels);
519
520 extern void
521 _mesa_meta_Bitmap(struct gl_context *ctx,
522                   GLint x, GLint y, GLsizei width, GLsizei height,
523                   const struct gl_pixelstore_attrib *unpack,
524                   const GLubyte *bitmap);
525
526 extern void
527 _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
528                           struct gl_texture_object *texObj);
529
530 extern bool
531 _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
532                            struct gl_texture_image *tex_image,
533                            int xoffset, int yoffset, int zoffset,
534                            int width, int height, int depth,
535                            GLenum format, GLenum type, const void *pixels,
536                            bool allocate_storage, bool create_pbo,
537                            const struct gl_pixelstore_attrib *packing);
538
539 extern bool
540 _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
541                               struct gl_texture_image *tex_image,
542                               int xoffset, int yoffset, int zoffset,
543                               int width, int height, int depth,
544                               GLenum format, GLenum type, const void *pixels,
545                               const struct gl_pixelstore_attrib *packing);
546
547 extern void
548 _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
549                            struct gl_texture_image *texImage,
550                            GLint xoffset, GLint yoffset, GLint slice,
551                            struct gl_renderbuffer *rb,
552                            GLint x, GLint y,
553                            GLsizei width, GLsizei height);
554
555 extern void
556 _mesa_meta_ClearTexSubImage(struct gl_context *ctx,
557                             struct gl_texture_image *texImage,
558                             GLint xoffset, GLint yoffset, GLint zoffset,
559                             GLsizei width, GLsizei height, GLsizei depth,
560                             const GLvoid *clearValue);
561
562 extern void
563 _mesa_meta_GetTexSubImage(struct gl_context *ctx,
564                           GLint xoffset, GLint yoffset, GLint zoffset,
565                           GLsizei width, GLsizei height, GLsizei depth,
566                           GLenum format, GLenum type, GLvoid *pixels,
567                           struct gl_texture_image *texImage);
568
569 extern void
570 _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
571                    GLfloat width, GLfloat height);
572
573 /* meta-internal functions */
574 void
575 _mesa_meta_drawbuffers_from_bitfield(GLbitfield bits);
576
577 GLuint
578 _mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target,
579                                      const GLcharARB *source);
580
581
582 GLuint
583 _mesa_meta_link_program_with_debug(struct gl_context *ctx, GLuint program);
584
585 void
586 _mesa_meta_compile_and_link_program(struct gl_context *ctx,
587                                     const char *vs_source,
588                                     const char *fs_source,
589                                     const char *name,
590                                     GLuint *program);
591
592 GLboolean
593 _mesa_meta_alloc_texture(struct temp_texture *tex,
594                          GLsizei width, GLsizei height, GLenum intFormat);
595
596 void
597 _mesa_meta_setup_texture_coords(GLenum faceTarget,
598                                 GLint slice,
599                                 GLint xoffset,
600                                 GLint yoffset,
601                                 GLint width,
602                                 GLint height,
603                                 GLint total_width,
604                                 GLint total_height,
605                                 GLint total_depth,
606                                 GLfloat coords0[4],
607                                 GLfloat coords1[4],
608                                 GLfloat coords2[4],
609                                 GLfloat coords3[4]);
610
611 struct temp_texture *
612 _mesa_meta_get_temp_texture(struct gl_context *ctx);
613
614 struct temp_texture *
615 _mesa_meta_get_temp_depth_texture(struct gl_context *ctx);
616
617 void
618 _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
619                                 GLuint *VAO, struct gl_buffer_object **buf_obj,
620                                 bool use_generic_attributes,
621                                 unsigned vertex_size, unsigned texcoord_size,
622                                 unsigned color_size);
623
624 void
625 _mesa_meta_setup_ff_tnl_for_blit(struct gl_context *ctx,
626                                  GLuint *VAO, struct gl_buffer_object **buf_obj,
627                                  unsigned texcoord_size);
628
629 void
630 _mesa_meta_setup_drawpix_texture(struct gl_context *ctx,
631                                  struct temp_texture *tex,
632                                  GLboolean newTex,
633                                  GLsizei width, GLsizei height,
634                                  GLenum format, GLenum type,
635                                  const GLvoid *pixels);
636
637 void
638 _mesa_meta_setup_copypix_texture(struct gl_context *ctx,
639                                  struct temp_texture *tex,
640                                  GLint srcX, GLint srcY,
641                                  GLsizei width, GLsizei height,
642                                  GLenum intFormat,
643                                  GLenum filter);
644
645 void
646 _mesa_meta_setup_blit_shader(struct gl_context *ctx,
647                              GLenum target,
648                              bool do_depth,
649                              struct blit_shader_table *table);
650
651 void
652 _mesa_meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit);
653
654 void
655 _mesa_meta_blit_shader_table_cleanup(struct blit_shader_table *table);
656
657 void
658 _mesa_meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
659                                         struct gen_mipmap_state *mipmap);
660
661 void
662 _mesa_meta_bind_fbo_image(GLenum target, GLenum attachment,
663                           struct gl_texture_image *texImage, GLuint layer);
664
665 #endif /* META_H */