2 * Mesa 3-D graphics library
4 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
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:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
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.
25 #include "main/glheader.h"
26 #include "main/mtypes.h"
27 #include "main/imports.h"
28 #include "main/arbprogram.h"
29 #include "main/arrayobj.h"
30 #include "main/blend.h"
31 #include "main/condrender.h"
32 #include "main/depth.h"
33 #include "main/enable.h"
34 #include "main/enums.h"
35 #include "main/fbobject.h"
36 #include "main/macros.h"
37 #include "main/matrix.h"
38 #include "main/multisample.h"
39 #include "main/objectlabel.h"
40 #include "main/readpix.h"
41 #include "main/shaderapi.h"
42 #include "main/texobj.h"
43 #include "main/texenv.h"
44 #include "main/teximage.h"
45 #include "main/texparam.h"
46 #include "main/varray.h"
47 #include "main/viewport.h"
48 #include "swrast/swrast.h"
49 #include "drivers/common/meta.h"
50 #include "../glsl/ralloc.h"
52 /** Return offset in bytes of the field within a vertex struct */
53 #define OFFSET(FIELD) ((void *) offsetof(struct vertex, FIELD))
56 setup_glsl_msaa_blit_shader(struct gl_context
*ctx
,
57 struct blit_state
*blit
,
58 struct gl_renderbuffer
*src_rb
,
61 const char *vs_source
;
65 enum blit_msaa_shader shader_index
;
66 bool dst_is_msaa
= false;
68 const char *vec4_prefix
;
72 src_datatype
= _mesa_get_format_datatype(src_rb
->Format
);
74 /* depth-or-color glCopyTexImage fallback path that passes a NULL rb and
75 * doesn't handle integer.
77 src_datatype
= GL_UNSIGNED_NORMALIZED
;
80 if (ctx
->DrawBuffer
->Visual
.samples
> 1) {
81 /* If you're calling meta_BlitFramebuffer with the destination
82 * multisampled, this is the only path that will work -- swrast and
83 * CopyTexImage won't work on it either.
85 assert(ctx
->Extensions
.ARB_sample_shading
);
89 /* We need shader invocation per sample, not per pixel */
90 _mesa_set_enable(ctx
, GL_MULTISAMPLE
, GL_TRUE
);
91 _mesa_set_enable(ctx
, GL_SAMPLE_SHADING
, GL_TRUE
);
92 _mesa_MinSampleShading(1.0);
96 case GL_TEXTURE_2D_MULTISAMPLE
:
97 if (src_rb
->_BaseFormat
== GL_DEPTH_COMPONENT
||
98 src_rb
->_BaseFormat
== GL_DEPTH_STENCIL
) {
100 shader_index
= BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_COPY
;
102 shader_index
= BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_RESOLVE
;
105 shader_index
= BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY
;
107 shader_index
= BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE
;
111 _mesa_problem(ctx
, "Unkown texture target %s\n",
112 _mesa_lookup_enum_by_nr(target
));
113 shader_index
= BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE
;
116 /* We rely on the enum being sorted this way. */
117 STATIC_ASSERT(BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT
==
118 BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE
+ 1);
119 STATIC_ASSERT(BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT
==
120 BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE
+ 2);
121 if (src_datatype
== GL_INT
) {
124 } else if (src_datatype
== GL_UNSIGNED_INT
) {
131 if (blit
->msaa_shaders
[shader_index
]) {
132 _mesa_UseProgram(blit
->msaa_shaders
[shader_index
]);
136 mem_ctx
= ralloc_context(NULL
);
138 if (shader_index
== BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_RESOLVE
||
139 shader_index
== BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_COPY
) {
141 const char *arb_sample_shading_extension_string
;
144 arb_sample_shading_extension_string
= "#extension GL_ARB_sample_shading : enable";
145 sample_index
= "gl_SampleID";
146 name
= "depth MSAA copy";
148 /* Don't need that extension, since we're drawing to a single-sampled
151 arb_sample_shading_extension_string
= "";
152 /* From the GL 4.3 spec:
154 * "If there is a multisample buffer (the value of SAMPLE_BUFFERS
155 * is one), then values are obtained from the depth samples in
156 * this buffer. It is recommended that the depth value of the
157 * centermost sample be used, though implementations may choose
158 * any function of the depth sample values at each pixel.
160 * We're slacking and instead of choosing centermost, we've got 0.
163 name
= "depth MSAA resolve";
166 vs_source
= ralloc_asprintf(mem_ctx
,
168 "in vec2 position;\n"
169 "in vec2 textureCoords;\n"
170 "out vec2 texCoords;\n"
173 " texCoords = textureCoords;\n"
174 " gl_Position = vec4(position, 0.0, 1.0);\n"
176 fs_source
= ralloc_asprintf(mem_ctx
,
178 "#extension GL_ARB_texture_multisample : enable\n"
180 "uniform sampler2DMS texSampler;\n"
181 "in vec2 texCoords;\n"
182 "out vec4 out_color;\n"
186 " gl_FragDepth = texelFetch(texSampler, ivec2(texCoords), %s).r;\n"
188 arb_sample_shading_extension_string
,
191 /* You can create 2D_MULTISAMPLE textures with 0 sample count (meaning 1
192 * sample). Yes, this is ridiculous.
195 char *sample_resolve
;
196 const char *arb_sample_shading_extension_string
;
197 const char *merge_function
;
198 name
= ralloc_asprintf(mem_ctx
, "%svec4 MSAA %s",
200 dst_is_msaa
? "copy" : "resolve");
202 samples
= MAX2(src_rb
->NumSamples
, 1);
205 arb_sample_shading_extension_string
= "#extension GL_ARB_sample_shading : enable";
206 sample_resolve
= ralloc_asprintf(mem_ctx
, " out_color = texelFetch(texSampler, ivec2(texCoords), gl_SampleID);");
212 if (src_datatype
== GL_INT
|| src_datatype
== GL_UNSIGNED_INT
) {
214 "gvec4 merge(gvec4 a, gvec4 b) { return (a >> gvec4(1)) + (b >> gvec4(1)) + (a & b & gvec4(1)); }\n";
216 /* The divide will happen at the end for floats. */
218 "vec4 merge(vec4 a, vec4 b) { return (a + b); }\n";
221 arb_sample_shading_extension_string
= "";
223 /* We're assuming power of two samples for this resolution procedure.
225 * To avoid losing any floating point precision if the samples all
226 * happen to have the same value, we merge pairs of values at a time
227 * (so the floating point exponent just gets increased), rather than
228 * doing a naive sum and dividing.
230 assert((samples
& (samples
- 1)) == 0);
231 /* Fetch each individual sample. */
232 sample_resolve
= rzalloc_size(mem_ctx
, 1);
233 for (i
= 0; i
< samples
; i
++) {
234 ralloc_asprintf_append(&sample_resolve
,
235 " gvec4 sample_1_%d = texelFetch(texSampler, ivec2(texCoords), %d);\n",
238 /* Now, merge each pair of samples, then merge each pair of those,
241 for (step
= 2; step
<= samples
; step
*= 2) {
242 for (i
= 0; i
< samples
; i
+= step
) {
243 ralloc_asprintf_append(&sample_resolve
,
244 " gvec4 sample_%d_%d = merge(sample_%d_%d, sample_%d_%d);\n",
247 step
/ 2, i
+ step
/ 2);
251 /* Scale the final result. */
252 if (src_datatype
== GL_UNSIGNED_INT
|| src_datatype
== GL_INT
) {
253 ralloc_asprintf_append(&sample_resolve
,
254 " out_color = sample_%d_0;\n",
257 ralloc_asprintf_append(&sample_resolve
,
258 " out_color = sample_%d_0 / %f;\n",
259 samples
, (float)samples
);
263 vs_source
= ralloc_asprintf(mem_ctx
,
265 "in vec2 position;\n"
266 "in vec2 textureCoords;\n"
267 "out vec2 texCoords;\n"
270 " texCoords = textureCoords;\n"
271 " gl_Position = vec4(position, 0.0, 1.0);\n"
273 fs_source
= ralloc_asprintf(mem_ctx
,
275 "#extension GL_ARB_texture_multisample : enable\n"
277 "#define gvec4 %svec4\n"
278 "uniform %ssampler2DMS texSampler;\n"
279 "in vec2 texCoords;\n"
280 "out gvec4 out_color;\n"
282 "%s" /* merge_function */
285 "%s\n" /* sample_resolve */
287 arb_sample_shading_extension_string
,
294 vs
= _mesa_meta_compile_shader_with_debug(ctx
, GL_VERTEX_SHADER
, vs_source
);
295 fs
= _mesa_meta_compile_shader_with_debug(ctx
, GL_FRAGMENT_SHADER
, fs_source
);
297 blit
->msaa_shaders
[shader_index
] = _mesa_CreateProgram();
298 _mesa_AttachShader(blit
->msaa_shaders
[shader_index
], fs
);
299 _mesa_DeleteShader(fs
);
300 _mesa_AttachShader(blit
->msaa_shaders
[shader_index
], vs
);
301 _mesa_DeleteShader(vs
);
302 _mesa_BindAttribLocation(blit
->msaa_shaders
[shader_index
], 0, "position");
303 _mesa_BindAttribLocation(blit
->msaa_shaders
[shader_index
], 1, "texcoords");
304 _mesa_meta_link_program_with_debug(ctx
, blit
->msaa_shaders
[shader_index
]);
305 _mesa_ObjectLabel(GL_PROGRAM
, blit
->msaa_shaders
[shader_index
], -1, name
);
306 ralloc_free(mem_ctx
);
308 _mesa_UseProgram(blit
->msaa_shaders
[shader_index
]);
312 setup_glsl_blit_framebuffer(struct gl_context
*ctx
,
313 struct blit_state
*blit
,
314 struct gl_renderbuffer
*src_rb
,
317 /* target = GL_TEXTURE_RECTANGLE is not supported in GLES 3.0 */
318 assert(_mesa_is_desktop_gl(ctx
) || target
== GL_TEXTURE_2D
);
320 _mesa_meta_setup_vertex_objects(&blit
->VAO
, &blit
->VBO
, true, 2, 2, 0);
322 if (target
== GL_TEXTURE_2D_MULTISAMPLE
) {
323 setup_glsl_msaa_blit_shader(ctx
, blit
, src_rb
, target
);
325 _mesa_meta_setup_blit_shader(ctx
, target
, &blit
->shaders
);
330 * Try to do a color or depth glBlitFramebuffer using texturing.
332 * We can do this when the src renderbuffer is actually a texture, or when the
333 * driver exposes BindRenderbufferTexImage().
336 blitframebuffer_texture(struct gl_context
*ctx
,
337 GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
338 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
339 GLenum filter
, GLint flipX
, GLint flipY
,
340 GLboolean glsl_version
, GLboolean do_depth
)
342 const struct gl_framebuffer
*readFb
= ctx
->ReadBuffer
;
343 int att_index
= do_depth
? BUFFER_DEPTH
: readFb
->_ColorReadBufferIndex
;
344 const struct gl_renderbuffer_attachment
*readAtt
=
345 &readFb
->Attachment
[att_index
];
346 struct blit_state
*blit
= &ctx
->Meta
->Blit
;
347 const GLint dstX
= MIN2(dstX0
, dstX1
);
348 const GLint dstY
= MIN2(dstY0
, dstY1
);
349 const GLint dstW
= abs(dstX1
- dstX0
);
350 const GLint dstH
= abs(dstY1
- dstY0
);
351 struct gl_texture_object
*texObj
;
356 GLuint sampler
, samplerSave
=
357 ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
].Sampler
?
358 ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
].Sampler
->Name
: 0;
360 struct gl_renderbuffer
*rb
= readAtt
->Renderbuffer
;
361 struct temp_texture
*meta_temp_texture
;
363 if (rb
->NumSamples
&& !ctx
->Extensions
.ARB_texture_multisample
)
366 if (filter
== GL_SCALED_RESOLVE_FASTEST_EXT
||
367 filter
== GL_SCALED_RESOLVE_NICEST_EXT
) {
371 if (readAtt
->Texture
&&
372 (readAtt
->Texture
->Target
== GL_TEXTURE_2D
||
373 readAtt
->Texture
->Target
== GL_TEXTURE_RECTANGLE
||
374 readAtt
->Texture
->Target
== GL_TEXTURE_2D_MULTISAMPLE
)) {
375 /* If there's a texture attached of a type we can handle, then just use
378 srcLevel
= readAtt
->TextureLevel
;
379 texObj
= readAtt
->Texture
;
380 target
= texObj
->Target
;
381 } else if (!readAtt
->Texture
&& ctx
->Driver
.BindRenderbufferTexImage
) {
382 /* Otherwise, we need the driver to be able to bind a renderbuffer as
385 struct gl_texture_image
*texImage
;
387 if (rb
->NumSamples
> 1)
388 target
= GL_TEXTURE_2D_MULTISAMPLE
;
390 target
= GL_TEXTURE_2D
;
392 _mesa_GenTextures(1, &tempTex
);
393 _mesa_BindTexture(target
, tempTex
);
395 texObj
= _mesa_lookup_texture(ctx
, tempTex
);
396 texImage
= _mesa_get_tex_image(ctx
, texObj
, target
, srcLevel
);
398 if (!ctx
->Driver
.BindRenderbufferTexImage(ctx
, rb
, texImage
)) {
399 _mesa_DeleteTextures(1, &tempTex
);
402 if (ctx
->Driver
.FinishRenderTexture
&&
403 !rb
->NeedsFinishRenderTexture
) {
404 rb
->NeedsFinishRenderTexture
= true;
405 ctx
->Driver
.FinishRenderTexture(ctx
, rb
);
408 if (_mesa_is_winsys_fbo(readFb
)) {
410 srcY0
= rb
->Height
- srcY1
;
411 srcY1
= rb
->Height
- temp
;
416 GLenum tex_base_format
;
417 int srcW
= abs(srcY1
- srcY0
);
418 int srcH
= abs(srcY1
- srcY0
);
419 /* Fall back to doing a CopyTexSubImage to get the destination
420 * renderbuffer into a texture.
422 if (ctx
->Meta
->Blit
.no_ctsi_fallback
)
425 if (rb
->NumSamples
> 1)
429 meta_temp_texture
= _mesa_meta_get_temp_depth_texture(ctx
);
430 tex_base_format
= GL_DEPTH_COMPONENT
;
432 meta_temp_texture
= _mesa_meta_get_temp_texture(ctx
);
434 _mesa_base_tex_format(ctx
, rb
->InternalFormat
);
438 target
= meta_temp_texture
->Target
;
439 texObj
= _mesa_lookup_texture(ctx
, meta_temp_texture
->TexObj
);
441 _mesa_meta_setup_copypix_texture(ctx
, meta_temp_texture
,
454 baseLevelSave
= texObj
->BaseLevel
;
455 maxLevelSave
= texObj
->MaxLevel
;
458 setup_glsl_blit_framebuffer(ctx
, blit
, rb
, target
);
461 _mesa_meta_setup_ff_tnl_for_blit(&ctx
->Meta
->Blit
.VAO
,
462 &ctx
->Meta
->Blit
.VBO
,
466 _mesa_GenSamplers(1, &sampler
);
467 _mesa_BindSampler(ctx
->Texture
.CurrentUnit
, sampler
);
470 printf("Blit from texture!\n");
471 printf(" srcAtt %p dstAtt %p\n", readAtt, drawAtt);
472 printf(" srcTex %p dstText %p\n", texObj, drawAtt->Texture);
475 /* Prepare src texture state */
476 _mesa_BindTexture(target
, texObj
->Name
);
477 _mesa_SamplerParameteri(sampler
, GL_TEXTURE_MIN_FILTER
, filter
);
478 _mesa_SamplerParameteri(sampler
, GL_TEXTURE_MAG_FILTER
, filter
);
479 if (target
!= GL_TEXTURE_RECTANGLE_ARB
) {
480 _mesa_TexParameteri(target
, GL_TEXTURE_BASE_LEVEL
, srcLevel
);
481 _mesa_TexParameteri(target
, GL_TEXTURE_MAX_LEVEL
, srcLevel
);
483 _mesa_SamplerParameteri(sampler
, GL_TEXTURE_WRAP_S
, GL_CLAMP_TO_EDGE
);
484 _mesa_SamplerParameteri(sampler
, GL_TEXTURE_WRAP_T
, GL_CLAMP_TO_EDGE
);
486 /* Always do our blits with no net sRGB decode or encode.
488 * However, if both the src and dst can be srgb decode/encoded, enable them
489 * so that we do any blending (from scaling or from MSAA resolves) in the
492 * Our choice of not doing any net encode/decode is from the GL 3.0
495 * "Blit operations bypass the fragment pipeline. The only fragment
496 * operations which affect a blit are the pixel ownership test and the
499 * The GL 4.4 specification disagrees and says that the sRGB part of the
500 * fragment pipeline applies, but this was found to break applications.
502 if (ctx
->Extensions
.EXT_texture_sRGB_decode
) {
503 if (_mesa_get_format_color_encoding(rb
->Format
) == GL_SRGB
&&
504 ctx
->DrawBuffer
->Visual
.sRGBCapable
) {
505 _mesa_SamplerParameteri(sampler
, GL_TEXTURE_SRGB_DECODE_EXT
,
507 _mesa_set_framebuffer_srgb(ctx
, GL_TRUE
);
509 _mesa_SamplerParameteri(sampler
, GL_TEXTURE_SRGB_DECODE_EXT
,
511 /* set_framebuffer_srgb was set by _mesa_meta_begin(). */
516 _mesa_TexEnvi(GL_TEXTURE_ENV
, GL_TEXTURE_ENV_MODE
, GL_REPLACE
);
517 _mesa_set_enable(ctx
, target
, GL_TRUE
);
520 /* Prepare vertex data (the VBO was previously created and bound) */
522 struct vertex verts
[4];
523 GLfloat s0
, t0
, s1
, t1
;
525 if (target
== GL_TEXTURE_2D
) {
526 const struct gl_texture_image
*texImage
527 = _mesa_select_tex_image(ctx
, texObj
, target
, srcLevel
);
528 s0
= srcX0
/ (float) texImage
->Width
;
529 s1
= srcX1
/ (float) texImage
->Width
;
530 t0
= srcY0
/ (float) texImage
->Height
;
531 t1
= srcY1
/ (float) texImage
->Height
;
534 assert(target
== GL_TEXTURE_RECTANGLE_ARB
||
535 target
== GL_TEXTURE_2D_MULTISAMPLE
);
542 /* Silence valgrind warnings about reading uninitialized stack. */
543 memset(verts
, 0, sizeof(verts
));
545 /* setup vertex positions */
546 verts
[0].x
= -1.0F
* flipX
;
547 verts
[0].y
= -1.0F
* flipY
;
548 verts
[1].x
= 1.0F
* flipX
;
549 verts
[1].y
= -1.0F
* flipY
;
550 verts
[2].x
= 1.0F
* flipX
;
551 verts
[2].y
= 1.0F
* flipY
;
552 verts
[3].x
= -1.0F
* flipX
;
553 verts
[3].y
= 1.0F
* flipY
;
555 verts
[0].tex
[0] = s0
;
556 verts
[0].tex
[1] = t0
;
557 verts
[1].tex
[0] = s1
;
558 verts
[1].tex
[1] = t0
;
559 verts
[2].tex
[0] = s1
;
560 verts
[2].tex
[1] = t1
;
561 verts
[3].tex
[0] = s0
;
562 verts
[3].tex
[1] = t1
;
564 _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB
, 0, sizeof(verts
), verts
);
568 _mesa_set_viewport(ctx
, 0, dstX
, dstY
, dstW
, dstH
);
569 _mesa_ColorMask(!do_depth
, !do_depth
, !do_depth
, !do_depth
);
570 _mesa_set_enable(ctx
, GL_DEPTH_TEST
, do_depth
);
571 _mesa_DepthMask(do_depth
);
572 _mesa_DepthFunc(GL_ALWAYS
);
574 _mesa_DrawArrays(GL_TRIANGLE_FAN
, 0, 4);
576 /* Restore texture object state, the texture binding will
577 * be restored by _mesa_meta_end().
579 if (target
!= GL_TEXTURE_RECTANGLE_ARB
) {
580 _mesa_TexParameteri(target
, GL_TEXTURE_BASE_LEVEL
, baseLevelSave
);
581 _mesa_TexParameteri(target
, GL_TEXTURE_MAX_LEVEL
, maxLevelSave
);
584 _mesa_BindSampler(ctx
->Texture
.CurrentUnit
, samplerSave
);
585 _mesa_DeleteSamplers(1, &sampler
);
587 _mesa_DeleteTextures(1, &tempTex
);
593 * Meta implementation of ctx->Driver.BlitFramebuffer() in terms
594 * of texture mapping and polygon rendering.
597 _mesa_meta_BlitFramebuffer(struct gl_context
*ctx
,
598 GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
599 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
600 GLbitfield mask
, GLenum filter
)
602 const GLint dstW
= abs(dstX1
- dstX0
);
603 const GLint dstH
= abs(dstY1
- dstY0
);
604 const GLint dstFlipX
= (dstX1
- dstX0
) / dstW
;
605 const GLint dstFlipY
= (dstY1
- dstY0
) / dstH
;
606 const GLboolean use_glsl_version
= ctx
->Extensions
.ARB_vertex_shader
&&
607 ctx
->Extensions
.ARB_fragment_shader
;
609 /* Multisample texture blit support requires texture multisample. */
610 if (ctx
->ReadBuffer
->Visual
.samples
> 0 &&
611 !ctx
->Extensions
.ARB_texture_multisample
) {
615 /* only scissor effects blit so save/clear all other relevant state */
616 _mesa_meta_begin(ctx
, ~MESA_META_SCISSOR
);
618 /* Try faster, direct texture approach first */
619 if (mask
& GL_COLOR_BUFFER_BIT
) {
620 if (blitframebuffer_texture(ctx
, srcX0
, srcY0
, srcX1
, srcY1
,
621 dstX0
, dstY0
, dstX1
, dstY1
,
622 filter
, dstFlipX
, dstFlipY
,
623 use_glsl_version
, false)) {
624 mask
&= ~GL_COLOR_BUFFER_BIT
;
632 if (mask
& GL_DEPTH_BUFFER_BIT
&& use_glsl_version
) {
633 if (blitframebuffer_texture(ctx
, srcX0
, srcY0
, srcX1
, srcY1
,
634 dstX0
, dstY0
, dstX1
, dstY1
,
635 filter
, dstFlipX
, dstFlipY
,
636 use_glsl_version
, true)) {
637 mask
&= ~GL_DEPTH_BUFFER_BIT
;
645 if (mask
& GL_STENCIL_BUFFER_BIT
) {
646 /* XXX can't easily do stencil */
653 _swrast_BlitFramebuffer(ctx
, srcX0
, srcY0
, srcX1
, srcY1
,
654 dstX0
, dstY0
, dstX1
, dstY1
, mask
, filter
);
659 _mesa_meta_glsl_blit_cleanup(struct blit_state
*blit
)
662 _mesa_DeleteVertexArrays(1, &blit
->VAO
);
664 _mesa_DeleteBuffers(1, &blit
->VBO
);
668 _mesa_meta_blit_shader_table_cleanup(&blit
->shaders
);
670 _mesa_DeleteTextures(1, &blit
->depthTex
.TexObj
);
671 blit
->depthTex
.TexObj
= 0;