diff options
author | marha <marha@users.sourceforge.net> | 2014-05-23 19:43:56 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-05-23 19:43:56 +0200 |
commit | 1c96f09adce1625dcbae5fe303d7c551a6c1bad3 (patch) | |
tree | 70b5bbde90432287ae91513b8a4edcc55fcf9e9e /mesalib/src/mesa/drivers | |
parent | 697c9a1917acd36a1b99e0d263baf2514446ca11 (diff) | |
parent | 63bfcd0be46413dda8c22b914d12f66ea5d5c66d (diff) | |
download | vcxsrv-1c96f09adce1625dcbae5fe303d7c551a6c1bad3.tar.gz vcxsrv-1c96f09adce1625dcbae5fe303d7c551a6c1bad3.tar.bz2 vcxsrv-1c96f09adce1625dcbae5fe303d7c551a6c1bad3.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/src/mapi/glapi/gen/gl_gentable.py
xorg-server/include/servermd.h
Diffstat (limited to 'mesalib/src/mesa/drivers')
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.c | 106 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.h | 10 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta_blit.c | 52 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/Makefile.am | 2 |
4 files changed, 92 insertions, 78 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 3ef3f7971..fec0d2be5 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -242,10 +242,25 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx, GLenum target, struct blit_shader_table *table) { - const char *vs_source; - char *fs_source; + char *vs_source, *fs_source; void *const mem_ctx = ralloc_context(NULL); struct blit_shader *shader = choose_blit_shader(target, table); + const char *vs_input, *vs_output, *fs_input, *vs_preprocess, *fs_preprocess; + + if (ctx->Const.GLSLVersion < 130) { + vs_preprocess = ""; + vs_input = "attribute"; + vs_output = "varying"; + fs_preprocess = "#extension GL_EXT_texture_array : enable"; + fs_input = "varying"; + } else { + vs_preprocess = "#version 130"; + vs_input = "in"; + vs_output = "out"; + fs_preprocess = "#version 130"; + fs_input = "in"; + shader->func = "texture"; + } assert(shader != NULL); @@ -254,57 +269,30 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx, return; } - if (ctx->Const.GLSLVersion < 130) { - vs_source = - "attribute vec2 position;\n" - "attribute vec4 textureCoords;\n" - "varying vec4 texCoords;\n" - "void main()\n" - "{\n" - " texCoords = textureCoords;\n" - " gl_Position = vec4(position, 0.0, 1.0);\n" - "}\n"; - - fs_source = ralloc_asprintf(mem_ctx, - "#extension GL_EXT_texture_array : enable\n" - "#extension GL_ARB_texture_cube_map_array: enable\n" - "uniform %s texSampler;\n" - "varying vec4 texCoords;\n" - "void main()\n" - "{\n" - " gl_FragColor = %s(texSampler, %s);\n" - " gl_FragDepth = gl_FragColor.x;\n" - "}\n", - shader->type, - shader->func, shader->texcoords); - } - else { - vs_source = ralloc_asprintf(mem_ctx, - "#version 130\n" - "in vec2 position;\n" - "in vec4 textureCoords;\n" - "out vec4 texCoords;\n" - "void main()\n" - "{\n" - " texCoords = textureCoords;\n" - " gl_Position = vec4(position, 0.0, 1.0);\n" - "}\n"); - fs_source = ralloc_asprintf(mem_ctx, - "#version 130\n" - "#extension GL_ARB_texture_cube_map_array: enable\n" - "uniform %s texSampler;\n" - "in vec4 texCoords;\n" - "out vec4 out_color;\n" - "\n" - "void main()\n" - "{\n" - " out_color = texture(texSampler, %s);\n" - " gl_FragDepth = out_color.x;\n" - "}\n", - shader->type, - shader->texcoords); - } - + vs_source = ralloc_asprintf(mem_ctx, + "%s\n" + "%s vec2 position;\n" + "%s vec4 textureCoords;\n" + "%s vec4 texCoords;\n" + "void main()\n" + "{\n" + " texCoords = textureCoords;\n" + " gl_Position = vec4(position, 0.0, 1.0);\n" + "}\n", + vs_preprocess, vs_input, vs_input, vs_output); + + fs_source = ralloc_asprintf(mem_ctx, + "%s\n" + "#extension GL_ARB_texture_cube_map_array: enable\n" + "uniform %s texSampler;\n" + "%s vec4 texCoords;\n" + "void main()\n" + "{\n" + " gl_FragColor = %s(texSampler, %s);\n" + " gl_FragDepth = gl_FragColor.x;\n" + "}\n", + fs_preprocess, shader->type, fs_input, + shader->func, shader->texcoords); _mesa_meta_compile_and_link_program(ctx, vs_source, fs_source, ralloc_asprintf(mem_ctx, "%s blit", @@ -2860,13 +2848,13 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims, * are too strict for CopyTexImage. We know meta will be fine with format * changes. */ - _mesa_meta_BlitFramebuffer(ctx, x, y, - x + width, y + height, - xoffset, yoffset, - xoffset + width, yoffset + height, - mask, GL_NEAREST); + mask = _mesa_meta_BlitFramebuffer(ctx, x, y, + x + width, y + height, + xoffset, yoffset, + xoffset + width, yoffset + height, + mask, GL_NEAREST); ctx->Meta->Blit.no_ctsi_fallback = false; - success = true; + success = mask == 0x0; out: _mesa_lock_texture(ctx, texObj); diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h index 2186a39f8..007f1040b 100644 --- a/mesalib/src/mesa/drivers/common/meta.h +++ b/mesalib/src/mesa/drivers/common/meta.h @@ -422,13 +422,21 @@ _mesa_meta_setup_sampler(struct gl_context *ctx, const struct gl_texture_object *texObj, GLenum target, GLenum filter, GLuint srcLevel); -extern void +extern GLbitfield _mesa_meta_BlitFramebuffer(struct gl_context *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_and_swrast_BlitFramebuffer(struct gl_context *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(struct gl_context *ctx, GLbitfield buffers); extern void diff --git a/mesalib/src/mesa/drivers/common/meta_blit.c b/mesalib/src/mesa/drivers/common/meta_blit.c index e5a0a9ad0..707269dd6 100644 --- a/mesalib/src/mesa/drivers/common/meta_blit.c +++ b/mesalib/src/mesa/drivers/common/meta_blit.c @@ -325,10 +325,15 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx, struct gl_renderbuffer *src_rb, GLenum target) { + unsigned texcoord_size; + /* target = GL_TEXTURE_RECTANGLE is not supported in GLES 3.0 */ assert(_mesa_is_desktop_gl(ctx) || target == GL_TEXTURE_2D); - _mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0); + texcoord_size = 2 + (src_rb->Depth > 1 ? 1 : 0); + + _mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true, + 2, texcoord_size, 0); if (target == GL_TEXTURE_2D_MULTISAMPLE || target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) { @@ -533,12 +538,16 @@ blitframebuffer_texture(struct gl_context *ctx, verts[0].tex[0] = s0; verts[0].tex[1] = t0; + verts[0].tex[2] = readAtt->Zoffset; verts[1].tex[0] = s1; verts[1].tex[1] = t0; + verts[1].tex[2] = readAtt->Zoffset; verts[2].tex[0] = s1; verts[2].tex[1] = t1; + verts[2].tex[2] = readAtt->Zoffset; verts[3].tex[0] = s0; verts[3].tex[1] = t1; + verts[3].tex[2] = readAtt->Zoffset; _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); } @@ -644,7 +653,7 @@ _mesa_meta_setup_sampler(struct gl_context *ctx, * Meta implementation of ctx->Driver.BlitFramebuffer() in terms * of texture mapping and polygon rendering. */ -void +GLbitfield _mesa_meta_BlitFramebuffer(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, @@ -669,7 +678,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, /* Multisample texture blit support requires texture multisample. */ if (ctx->ReadBuffer->Visual.samples > 0 && !ctx->Extensions.ARB_texture_multisample) { - goto fallback; + return mask; } /* Clip a copy of the blit coordinates. If these differ from the input @@ -678,7 +687,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, if (!_mesa_clip_blit(ctx, &clip.srcX0, &clip.srcY0, &clip.srcX1, &clip.srcY1, &clip.dstX0, &clip.dstY0, &clip.dstX1, &clip.dstY1)) { /* clipped/scissored everything away */ - return; + return 0; } /* Only scissor affects blit, but we're doing to set a custom scissor if @@ -705,10 +714,6 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, filter, dstFlipX, dstFlipY, use_glsl_version, false)) { mask &= ~GL_COLOR_BUFFER_BIT; - if (mask == 0x0) { - _mesa_meta_end(ctx); - return; - } } } @@ -718,10 +723,6 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, filter, dstFlipX, dstFlipY, use_glsl_version, true)) { mask &= ~GL_DEPTH_BUFFER_BIT; - if (mask == 0x0) { - _mesa_meta_end(ctx); - return; - } } } @@ -731,11 +732,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, _mesa_meta_end(ctx); -fallback: - if (mask && !ctx->Meta->Blit.no_ctsi_fallback) { - _swrast_BlitFramebuffer(ctx, srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, mask, filter); - } + return mask; } void @@ -753,3 +750,24 @@ _mesa_meta_glsl_blit_cleanup(struct blit_state *blit) _mesa_DeleteTextures(1, &blit->depthTex.TexObj); blit->depthTex.TexObj = 0; } + +void +_mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx, + GLint srcX0, GLint srcY0, + GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, + GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) +{ + mask = _mesa_meta_BlitFramebuffer(ctx, + srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); + if (mask == 0x0) + return; + + _swrast_BlitFramebuffer(ctx, + srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); +} diff --git a/mesalib/src/mesa/drivers/dri/Makefile.am b/mesalib/src/mesa/drivers/dri/Makefile.am index e8076120d..70039f9ad 100644 --- a/mesalib/src/mesa/drivers/dri/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/Makefile.am @@ -52,7 +52,7 @@ nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp mesa_dri_drivers_la_SOURCES = mesa_dri_drivers_la_LDFLAGS = \ -module -avoid-version -shared -shrext .so \ - -Wl,-Bsymbolic \ + $(BSYMBOLIC) \ $(GC_SECTIONS) \ $() mesa_dri_drivers_la_LIBADD = \ |