Merge remote-tracking branch 'mesa-public/master' into vulkan
[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 GLuint ClientActiveUnit;
150 /** for unit[0] only */
151 struct gl_texture_object *CurrentTexture[NUM_TEXTURE_TARGETS];
152 /** mask of TEXTURE_2D_BIT, etc */
153 GLbitfield TexEnabled[MAX_TEXTURE_UNITS];
154 GLbitfield TexGenEnabled[MAX_TEXTURE_UNITS];
155 GLuint EnvMode; /* unit[0] only */
156
157 /** MESA_META_VERTEX */
158 struct gl_vertex_array_object *VAO;
159 struct gl_buffer_object *ArrayBufferObj;
160
161 /** MESA_META_VIEWPORT */
162 GLfloat ViewportX, ViewportY, ViewportW, ViewportH;
163 GLclampd DepthNear, DepthFar;
164
165 /** MESA_META_CLAMP_FRAGMENT_COLOR */
166 GLenum ClampFragmentColor;
167
168 /** MESA_META_CLAMP_VERTEX_COLOR */
169 GLenum ClampVertexColor;
170
171 /** MESA_META_CONDITIONAL_RENDER */
172 struct gl_query_object *CondRenderQuery;
173 GLenum CondRenderMode;
174
175 /** MESA_META_SELECT_FEEDBACK */
176 GLenum RenderMode;
177 struct gl_selection Select;
178 struct gl_feedback Feedback;
179
180 /** MESA_META_MULTISAMPLE */
181 struct gl_multisample_attrib Multisample;
182
183 /** MESA_META_FRAMEBUFFER_SRGB */
184 GLboolean sRGBEnabled;
185
186 /** Miscellaneous (always disabled) */
187 GLboolean Lighting;
188 GLboolean RasterDiscard;
189 GLboolean TransformFeedbackNeedsResume;
190
191 GLuint DrawBufferName, ReadBufferName, RenderbufferName;
192
193 /** MESA_META_DRAW_BUFFERS */
194 GLenum ColorDrawBuffers[MAX_DRAW_BUFFERS];
195 };
196
197 /**
198 * Temporary texture used for glBlitFramebuffer, glDrawPixels, etc.
199 * This is currently shared by all the meta ops. But we could create a
200 * separate one for each of glDrawPixel, glBlitFramebuffer, glCopyPixels, etc.
201 */
202 struct temp_texture
203 {
204 GLuint TexObj;
205 GLenum Target; /**< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE */
206 GLsizei MinSize; /**< Min texture size to allocate */
207 GLsizei MaxSize; /**< Max possible texture size */
208 GLboolean NPOT; /**< Non-power of two size OK? */
209 GLsizei Width, Height; /**< Current texture size */
210 GLenum IntFormat;
211 GLfloat Sright, Ttop; /**< right, top texcoords */
212 };
213
214 /**
215 * State for GLSL texture sampler which is used to generate fragment
216 * shader in _mesa_meta_generate_mipmap().
217 */
218 struct blit_shader {
219 const char *type;
220 const char *func;
221 const char *texcoords;
222 GLuint shader_prog;
223 };
224
225 /**
226 * Table of all sampler types and shaders for accessing them.
227 */
228 struct blit_shader_table {
229 struct blit_shader sampler_1d;
230 struct blit_shader sampler_2d;
231 struct blit_shader sampler_3d;
232 struct blit_shader sampler_rect;
233 struct blit_shader sampler_cubemap;
234 struct blit_shader sampler_1d_array;
235 struct blit_shader sampler_2d_array;
236 struct blit_shader sampler_cubemap_array;
237 };
238
239 /**
240 * Indices in the blit_state->msaa_shaders[] array
241 *
242 * Note that setup_glsl_msaa_blit_shader() assumes that the _INT enums are five
243 * more than the corresponding non-_INT versions and _UINT are five beyond that.
244 */
245 enum blit_msaa_shader {
246 BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
247 BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
248 BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
249 BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
250 BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
251 BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
252 BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
253 BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
254 BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
255 BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
256 BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
257 BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
258 BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
259 BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
260 BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
261 BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY,
262 BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_INT,
263 BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_UINT,
264 BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_RESOLVE,
265 BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_COPY,
266 BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
267 BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
268 BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
269 BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
270 BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
271 BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
272 BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
273 BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
274 BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
275 BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
276 BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
277 BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
278 BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
279 BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
280 BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
281 BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY,
282 BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY_INT,
283 BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY_UINT,
284 BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_RESOLVE,
285 BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_COPY,
286 BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_SCALED_RESOLVE,
287 BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_SCALED_RESOLVE,
288 BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_SCALED_RESOLVE,
289 BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_SCALED_RESOLVE,
290 BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_SCALED_RESOLVE,
291 BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_SCALED_RESOLVE,
292 BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_SCALED_RESOLVE,
293 BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_SCALED_RESOLVE,
294 BLIT_MSAA_SHADER_COUNT,
295 };
296
297 /**
298 * State for glBlitFramebufer()
299 */
300 struct blit_state
301 {
302 GLuint VAO;
303 GLuint VBO;
304 struct blit_shader_table shaders_with_depth;
305 struct blit_shader_table shaders_without_depth;
306 GLuint msaa_shaders[BLIT_MSAA_SHADER_COUNT];
307 struct temp_texture depthTex;
308 bool no_ctsi_fallback;
309 };
310
311 struct fb_tex_blit_state
312 {
313 GLint baseLevelSave, maxLevelSave;
314 GLuint sampler, samplerSave, stencilSamplingSave;
315 GLuint tempTex;
316 };
317
318
319 /**
320 * State for glClear()
321 */
322 struct clear_state
323 {
324 GLuint VAO;
325 GLuint VBO;
326 GLuint ShaderProg;
327 GLint ColorLocation;
328 GLint LayerLocation;
329
330 GLuint IntegerShaderProg;
331 GLint IntegerColorLocation;
332 GLint IntegerLayerLocation;
333 };
334
335
336 /**
337 * State for glCopyPixels()
338 */
339 struct copypix_state
340 {
341 GLuint VAO;
342 GLuint VBO;
343 };
344
345
346 /**
347 * State for glDrawPixels()
348 */
349 struct drawpix_state
350 {
351 GLuint VAO;
352 GLuint VBO;
353
354 GLuint StencilFP; /**< Fragment program for drawing stencil images */
355 GLuint DepthFP; /**< Fragment program for drawing depth images */
356 };
357
358
359 /**
360 * State for glBitmap()
361 */
362 struct bitmap_state
363 {
364 GLuint VAO;
365 GLuint VBO;
366 struct temp_texture Tex; /**< separate texture from other meta ops */
367 };
368
369 /**
370 * State for _mesa_meta_generate_mipmap()
371 */
372 struct gen_mipmap_state
373 {
374 GLuint VAO;
375 GLuint VBO;
376 GLuint FBO;
377 GLuint Sampler;
378
379 struct blit_shader_table shaders;
380 };
381
382 /**
383 * One of the FBO states for decompress_state. There will be one for each
384 * required renderbuffer format.
385 */
386 struct decompress_fbo_state
387 {
388 GLuint FBO, RBO;
389 GLint Width, Height;
390 };
391
392 /**
393 * State for texture decompression
394 */
395 struct decompress_state
396 {
397 GLuint VAO;
398 struct decompress_fbo_state byteFBO, floatFBO;
399 GLuint VBO, Sampler;
400
401 struct blit_shader_table shaders;
402 };
403
404 /**
405 * State for glDrawTex()
406 */
407 struct drawtex_state
408 {
409 GLuint VAO;
410 GLuint VBO;
411 };
412
413 #define MAX_META_OPS_DEPTH 8
414 /**
415 * All per-context meta state.
416 */
417 struct gl_meta_state
418 {
419 /** Stack of state saved during meta-ops */
420 struct save_state Save[MAX_META_OPS_DEPTH];
421 /** Save stack depth */
422 GLuint SaveStackDepth;
423
424 struct temp_texture TempTex;
425
426 struct blit_state Blit; /**< For _mesa_meta_BlitFramebuffer() */
427 struct clear_state Clear; /**< For _mesa_meta_Clear() */
428 struct copypix_state CopyPix; /**< For _mesa_meta_CopyPixels() */
429 struct drawpix_state DrawPix; /**< For _mesa_meta_DrawPixels() */
430 struct bitmap_state Bitmap; /**< For _mesa_meta_Bitmap() */
431 struct gen_mipmap_state Mipmap; /**< For _mesa_meta_GenerateMipmap() */
432 struct decompress_state Decompress; /**< For texture decompression */
433 struct drawtex_state DrawTex; /**< For _mesa_meta_DrawTex() */
434 };
435
436 struct vertex {
437 GLfloat x, y, z, tex[4];
438 GLfloat r, g, b, a;
439 };
440
441 extern void
442 _mesa_meta_init(struct gl_context *ctx);
443
444 extern void
445 _mesa_meta_free(struct gl_context *ctx);
446
447 extern void
448 _mesa_meta_begin(struct gl_context *ctx, GLbitfield state);
449
450 extern void
451 _mesa_meta_end(struct gl_context *ctx);
452
453 static inline bool
454 _mesa_meta_in_progress(struct gl_context *ctx)
455 {
456 return ctx->Meta->SaveStackDepth != 0;
457 }
458
459 extern void
460 _mesa_meta_fb_tex_blit_begin(const struct gl_context *ctx,
461 struct fb_tex_blit_state *blit);
462
463 extern void
464 _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
465 struct fb_tex_blit_state *blit);
466
467 extern GLboolean
468 _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
469 struct gl_renderbuffer *rb,
470 GLuint *tex,
471 struct gl_texture_object **texObj,
472 GLenum *target);
473
474 GLuint
475 _mesa_meta_setup_sampler(struct gl_context *ctx,
476 const struct gl_texture_object *texObj,
477 GLenum target, GLenum filter, GLuint srcLevel);
478
479 extern GLbitfield
480 _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
481 const struct gl_framebuffer *readFb,
482 const struct gl_framebuffer *drawFb,
483 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
484 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
485 GLbitfield mask, GLenum filter);
486
487 extern void
488 _mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
489 struct gl_framebuffer *readFb,
490 struct gl_framebuffer *drawFb,
491 GLint srcX0, GLint srcY0,
492 GLint srcX1, GLint srcY1,
493 GLint dstX0, GLint dstY0,
494 GLint dstX1, GLint dstY1,
495 GLbitfield mask, GLenum filter);
496
497 bool
498 _mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
499 struct gl_texture_image *src_tex_image,
500 struct gl_renderbuffer *src_renderbuffer,
501 int src_x, int src_y, int src_z,
502 struct gl_texture_image *dst_tex_image,
503 struct gl_renderbuffer *dst_renderbuffer,
504 int dst_x, int dst_y, int dst_z,
505 int src_width, int src_height);
506
507 extern void
508 _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers);
509
510 extern void
511 _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers);
512
513 extern void
514 _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
515 GLsizei width, GLsizei height,
516 GLint dstx, GLint dsty, GLenum type);
517
518 extern void
519 _mesa_meta_DrawPixels(struct gl_context *ctx,
520 GLint x, GLint y, GLsizei width, GLsizei height,
521 GLenum format, GLenum type,
522 const struct gl_pixelstore_attrib *unpack,
523 const GLvoid *pixels);
524
525 extern void
526 _mesa_meta_Bitmap(struct gl_context *ctx,
527 GLint x, GLint y, GLsizei width, GLsizei height,
528 const struct gl_pixelstore_attrib *unpack,
529 const GLubyte *bitmap);
530
531 extern void
532 _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
533 struct gl_texture_object *texObj);
534
535 extern bool
536 _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
537 struct gl_texture_image *tex_image,
538 int xoffset, int yoffset, int zoffset,
539 int width, int height, int depth,
540 GLenum format, GLenum type, const void *pixels,
541 bool allocate_storage, bool create_pbo,
542 const struct gl_pixelstore_attrib *packing);
543
544 extern bool
545 _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
546 struct gl_texture_image *tex_image,
547 int xoffset, int yoffset, int zoffset,
548 int width, int height, int depth,
549 GLenum format, GLenum type, const void *pixels,
550 const struct gl_pixelstore_attrib *packing);
551
552 extern void
553 _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
554 struct gl_texture_image *texImage,
555 GLint xoffset, GLint yoffset, GLint slice,
556 struct gl_renderbuffer *rb,
557 GLint x, GLint y,
558 GLsizei width, GLsizei height);
559
560 extern void
561 _mesa_meta_ClearTexSubImage(struct gl_context *ctx,
562 struct gl_texture_image *texImage,
563 GLint xoffset, GLint yoffset, GLint zoffset,
564 GLsizei width, GLsizei height, GLsizei depth,
565 const GLvoid *clearValue);
566
567 extern void
568 _mesa_meta_GetTexSubImage(struct gl_context *ctx,
569 GLint xoffset, GLint yoffset, GLint zoffset,
570 GLsizei width, GLsizei height, GLsizei depth,
571 GLenum format, GLenum type, GLvoid *pixels,
572 struct gl_texture_image *texImage);
573
574 extern void
575 _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
576 GLfloat width, GLfloat height);
577
578 /* meta-internal functions */
579 void
580 _mesa_meta_drawbuffers_from_bitfield(GLbitfield bits);
581
582 GLuint
583 _mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target,
584 const GLcharARB *source);
585
586
587 GLuint
588 _mesa_meta_link_program_with_debug(struct gl_context *ctx, GLuint program);
589
590 void
591 _mesa_meta_compile_and_link_program(struct gl_context *ctx,
592 const char *vs_source,
593 const char *fs_source,
594 const char *name,
595 GLuint *program);
596
597 GLboolean
598 _mesa_meta_alloc_texture(struct temp_texture *tex,
599 GLsizei width, GLsizei height, GLenum intFormat);
600
601 void
602 _mesa_meta_setup_texture_coords(GLenum faceTarget,
603 GLint slice,
604 GLint xoffset,
605 GLint yoffset,
606 GLint width,
607 GLint height,
608 GLint total_width,
609 GLint total_height,
610 GLint total_depth,
611 GLfloat coords0[4],
612 GLfloat coords1[4],
613 GLfloat coords2[4],
614 GLfloat coords3[4]);
615
616 struct temp_texture *
617 _mesa_meta_get_temp_texture(struct gl_context *ctx);
618
619 struct temp_texture *
620 _mesa_meta_get_temp_depth_texture(struct gl_context *ctx);
621
622 void
623 _mesa_meta_setup_vertex_objects(GLuint *VAO, GLuint *VBO,
624 bool use_generic_attributes,
625 unsigned vertex_size, unsigned texcoord_size,
626 unsigned color_size);
627
628 void
629 _mesa_meta_setup_ff_tnl_for_blit(GLuint *VAO, GLuint *VBO,
630 unsigned texcoord_size);
631
632 void
633 _mesa_meta_setup_drawpix_texture(struct gl_context *ctx,
634 struct temp_texture *tex,
635 GLboolean newTex,
636 GLsizei width, GLsizei height,
637 GLenum format, GLenum type,
638 const GLvoid *pixels);
639
640 void
641 _mesa_meta_setup_copypix_texture(struct gl_context *ctx,
642 struct temp_texture *tex,
643 GLint srcX, GLint srcY,
644 GLsizei width, GLsizei height,
645 GLenum intFormat,
646 GLenum filter);
647
648 void
649 _mesa_meta_setup_blit_shader(struct gl_context *ctx,
650 GLenum target,
651 bool do_depth,
652 struct blit_shader_table *table);
653
654 void
655 _mesa_meta_glsl_blit_cleanup(struct blit_state *blit);
656
657 void
658 _mesa_meta_blit_shader_table_cleanup(struct blit_shader_table *table);
659
660 void
661 _mesa_meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap);
662
663 void
664 _mesa_meta_bind_fbo_image(GLenum target, GLenum attachment,
665 struct gl_texture_image *texImage, GLuint layer);
666
667 #endif /* META_H */