aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/common
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-08-11 21:14:48 +0200
committermarha <marha@users.sourceforge.net>2014-08-11 21:14:48 +0200
commitfdbedba4d50e1b28b0249c83ba11c029f096e400 (patch)
treea80ccb6275fd99644c79c67856e9c1bf1b323d62 /mesalib/src/mesa/drivers/common
parentb33b8d8ae86876b50df96881b96074b3fe177cce (diff)
downloadvcxsrv-fdbedba4d50e1b28b0249c83ba11c029f096e400.tar.gz
vcxsrv-fdbedba4d50e1b28b0249c83ba11c029f096e400.tar.bz2
vcxsrv-fdbedba4d50e1b28b0249c83ba11c029f096e400.zip
fontconfig libX11 libxcb libxcb/xcb-proto mesa xserver xkeyboard-config git update 11 Aug 2014
xserver commit 3714f5401690b288045090c4bcd9cb01c6e4860e libxcb commit 966fba6ba4838949d0727dfa45eeb9392d1f85d9 libxcb/xcb-proto commit 4b384d2a015c50d0e93dcacda4b8260a3fd37640 xkeyboard-config commit 651a00ab656a1754b9183a383970a735209bbb50 libX11 commit 368a6401c6a3275d3497fec38a3dcbc38cd9df60 libXdmcp commit fe8eab93e9bcdbe8bb8052434bb5e676e3a0ee8f libXext commit efdcbb7634501e1117d422636a0a75d7ea84b16b libfontenc commit 0037a42107b952c9d903719615747e760e4e7247 libXinerama commit edd95182b26eb5d576d4878c559e0f17dddaa909 libXau commit 1e4635be11154dd8262f37b379511bd627defa2a xkbcomp commit d4e02a09258063c6d024c3ccd42d6b22212e6e18 pixman commit 6d2cf40166d81bfc63108504c8022dc4fec37ff5 xextproto commit 66afec3f49e8eb0d4c2e9af7088fc3116d4bafd7 randrproto commit a4a6694c059d74247c16527eef4a0ec9f56bbef6 glproto commit f84853d97d5749308992412a215fa518b6536eb3 mkfontscale commit 47908fd7a0d061fdcd21e3498da4e223ca9136d9 xwininfo commit 017b3736489985999d8dcf4d9e473e1fd6dd3647 libXft commit 214f9b5306d833e2787c75fe41dfdc9228fcb738 libXmu commit 22d9c590901e121936f50dee97dc60c4f7defb63 libxtrans commit a57a7f62242e1ea972b81414741729bf3dbae0a4 fontconfig commit 841753a93f0e5698663b7931b8456e7b96259f54 mesa commit f24be7340162c6a831b392d46d6637e9656e7a8a
Diffstat (limited to 'mesalib/src/mesa/drivers/common')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c66
-rw-r--r--mesalib/src/mesa/drivers/common/meta.h10
-rw-r--r--mesalib/src/mesa/drivers/common/meta_blit.c5
-rw-r--r--mesalib/src/mesa/drivers/common/meta_copy_image.c199
-rw-r--r--mesalib/src/mesa/drivers/common/meta_generate_mipmap.c4
5 files changed, 247 insertions, 37 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index b12898f26..a1d06d412 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -84,7 +84,7 @@
#include "drivers/common/meta.h"
#include "main/enums.h"
#include "main/glformats.h"
-#include "../glsl/ralloc.h"
+#include "util/ralloc.h"
/** Return offset in bytes of the field within a vertex struct */
#define OFFSET(FIELD) ((void *) offsetof(struct vertex, FIELD))
@@ -101,18 +101,18 @@ static void meta_decompress_cleanup(struct decompress_state *decompress);
static void meta_drawpix_cleanup(struct drawpix_state *drawpix);
void
-_mesa_meta_bind_fbo_image(GLenum attachment,
+_mesa_meta_bind_fbo_image(GLenum fboTarget, GLenum attachment,
struct gl_texture_image *texImage, GLuint layer)
{
struct gl_texture_object *texObj = texImage->TexObject;
int level = texImage->Level;
- GLenum target = texObj->Target;
+ GLenum texTarget = texObj->Target;
- switch (target) {
+ switch (texTarget) {
case GL_TEXTURE_1D:
- _mesa_FramebufferTexture1D(GL_FRAMEBUFFER,
+ _mesa_FramebufferTexture1D(fboTarget,
attachment,
- target,
+ texTarget,
texObj->Name,
level);
break;
@@ -121,19 +121,19 @@ _mesa_meta_bind_fbo_image(GLenum attachment,
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
case GL_TEXTURE_CUBE_MAP_ARRAY:
case GL_TEXTURE_3D:
- _mesa_FramebufferTextureLayer(GL_FRAMEBUFFER,
+ _mesa_FramebufferTextureLayer(fboTarget,
attachment,
texObj->Name,
level,
layer);
break;
default: /* 2D / cube */
- if (target == GL_TEXTURE_CUBE_MAP)
- target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face;
+ if (texTarget == GL_TEXTURE_CUBE_MAP)
+ texTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face;
- _mesa_FramebufferTexture2D(GL_FRAMEBUFFER,
+ _mesa_FramebufferTexture2D(fboTarget,
attachment,
- target,
+ texTarget,
texObj->Name,
level);
}
@@ -2732,9 +2732,9 @@ _mesa_meta_blit_shader_table_cleanup(struct blit_shader_table *table)
static GLenum
get_temp_image_type(struct gl_context *ctx, mesa_format format)
{
- GLenum baseFormat;
-
- baseFormat = _mesa_get_format_base_format(format);
+ const GLenum baseFormat = _mesa_get_format_base_format(format);
+ const GLenum datatype = _mesa_get_format_datatype(format);
+ const GLint format_red_bits = _mesa_get_format_bits(format, GL_RED_BITS);
switch (baseFormat) {
case GL_RGBA:
@@ -2745,30 +2745,24 @@ get_temp_image_type(struct gl_context *ctx, mesa_format format)
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
case GL_INTENSITY:
- if (ctx->DrawBuffer->Visual.redBits <= 8) {
+ if (datatype == GL_INT || datatype == GL_UNSIGNED_INT) {
+ return datatype;
+ } else if (format_red_bits <= 8) {
return GL_UNSIGNED_BYTE;
- } else if (ctx->DrawBuffer->Visual.redBits <= 16) {
+ } else if (format_red_bits <= 16) {
return GL_UNSIGNED_SHORT;
- } else {
- GLenum datatype = _mesa_get_format_datatype(format);
- if (datatype == GL_INT || datatype == GL_UNSIGNED_INT)
- return datatype;
- return GL_FLOAT;
}
- case GL_DEPTH_COMPONENT: {
- GLenum datatype = _mesa_get_format_datatype(format);
+ return GL_FLOAT;
+ case GL_DEPTH_COMPONENT:
if (datatype == GL_FLOAT)
return GL_FLOAT;
else
return GL_UNSIGNED_INT;
- }
- case GL_DEPTH_STENCIL: {
- GLenum datatype = _mesa_get_format_datatype(format);
+ case GL_DEPTH_STENCIL:
if (datatype == GL_FLOAT)
return GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
else
return GL_UNSIGNED_INT_24_8;
- }
default:
_mesa_problem(ctx, "Unexpected format %d in get_temp_image_type()",
baseFormat);
@@ -2808,17 +2802,20 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims,
if (rb->_BaseFormat == GL_DEPTH_STENCIL ||
rb->_BaseFormat == GL_DEPTH_COMPONENT) {
- _mesa_meta_bind_fbo_image(GL_DEPTH_ATTACHMENT, texImage, zoffset);
+ _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ texImage, zoffset);
mask = GL_DEPTH_BUFFER_BIT;
if (rb->_BaseFormat == GL_DEPTH_STENCIL &&
texImage->_BaseFormat == GL_DEPTH_STENCIL) {
- _mesa_meta_bind_fbo_image(GL_STENCIL_ATTACHMENT, texImage, zoffset);
+ _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ texImage, zoffset);
mask |= GL_STENCIL_BUFFER_BIT;
}
_mesa_DrawBuffer(GL_NONE);
} else {
- _mesa_meta_bind_fbo_image(GL_COLOR_ATTACHMENT0, texImage, zoffset);
+ _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ texImage, zoffset);
mask = GL_COLOR_BUFFER_BIT;
_mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
}
@@ -3362,7 +3359,8 @@ cleartexsubimage_color(struct gl_context *ctx,
GLenum datatype;
GLenum status;
- _mesa_meta_bind_fbo_image(GL_COLOR_ATTACHMENT0, texImage, zoffset);
+ _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ texImage, zoffset);
status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE)
@@ -3408,10 +3406,12 @@ cleartexsubimage_depth_stencil(struct gl_context *ctx,
GLfloat depthValue;
GLenum status;
- _mesa_meta_bind_fbo_image(GL_DEPTH_ATTACHMENT, texImage, zoffset);
+ _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ texImage, zoffset);
if (texImage->_BaseFormat == GL_DEPTH_STENCIL)
- _mesa_meta_bind_fbo_image(GL_STENCIL_ATTACHMENT, texImage, zoffset);
+ _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ texImage, zoffset);
status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE)
diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h
index b269dceed..e2da2f427 100644
--- a/mesalib/src/mesa/drivers/common/meta.h
+++ b/mesalib/src/mesa/drivers/common/meta.h
@@ -440,6 +440,14 @@ _mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
+bool
+_mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
+ struct gl_texture_image *src_tex_image,
+ int src_x, int src_y, int src_z,
+ struct gl_texture_image *dst_tex_image,
+ int dst_x, int dst_y, int dst_z,
+ int src_width, int src_height);
+
extern void
_mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers);
@@ -570,7 +578,7 @@ void
_mesa_meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap);
void
-_mesa_meta_bind_fbo_image(GLenum attachment,
+_mesa_meta_bind_fbo_image(GLenum target, GLenum attachment,
struct gl_texture_image *texImage, GLuint layer);
#endif /* META_H */
diff --git a/mesalib/src/mesa/drivers/common/meta_blit.c b/mesalib/src/mesa/drivers/common/meta_blit.c
index bbf0c3c45..955e73f57 100644
--- a/mesalib/src/mesa/drivers/common/meta_blit.c
+++ b/mesalib/src/mesa/drivers/common/meta_blit.c
@@ -49,7 +49,7 @@
#include "main/viewport.h"
#include "swrast/swrast.h"
#include "drivers/common/meta.h"
-#include "../glsl/ralloc.h"
+#include "util/ralloc.h"
/** Return offset in bytes of the field within a vertex struct */
#define OFFSET(FIELD) ((void *) offsetof(struct vertex, FIELD))
@@ -709,6 +709,9 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
*/
_mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_DRAW_BUFFERS);
+ /* Dithering shouldn't be performed for glBlitFramebuffer */
+ _mesa_set_enable(ctx, GL_DITHER, GL_FALSE);
+
/* If the clipping earlier changed the destination rect at all, then
* enable the scissor to clip to it.
*/
diff --git a/mesalib/src/mesa/drivers/common/meta_copy_image.c b/mesalib/src/mesa/drivers/common/meta_copy_image.c
new file mode 100644
index 000000000..c40c2f011
--- /dev/null
+++ b/mesalib/src/mesa/drivers/common/meta_copy_image.c
@@ -0,0 +1,199 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2014 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glheader.h"
+#include "context.h"
+#include "enums.h"
+#include "imports.h"
+#include "macros.h"
+#include "teximage.h"
+#include "texobj.h"
+#include "fbobject.h"
+#include "buffers.h"
+#include "state.h"
+#include "mtypes.h"
+#include "meta.h"
+
+/* This function makes a texture view without bothering with all of the API
+ * checks. Most of them are the same for CopyTexSubImage so checking would
+ * be redundant. The one major difference is that we don't check for
+ * whether the texture is immutable or not. However, since the view will
+ * be created and then immediately destroyed, this should not be a problem.
+ */
+static bool
+make_view(struct gl_context *ctx, struct gl_texture_image *tex_image,
+ struct gl_texture_image **view_tex_image, GLuint *view_tex_name,
+ GLenum internal_format)
+{
+ struct gl_texture_object *tex_obj = tex_image->TexObject;
+ struct gl_texture_object *view_tex_obj;
+ mesa_format tex_format;
+
+ /* Set up the new texture object */
+ _mesa_GenTextures(1, view_tex_name);
+ view_tex_obj = _mesa_lookup_texture(ctx, *view_tex_name);
+ if (!view_tex_obj)
+ return false;
+
+ tex_format = _mesa_choose_texture_format(ctx, view_tex_obj, tex_obj->Target,
+ 0, internal_format,
+ GL_NONE, GL_NONE);
+
+ if (!ctx->Driver.TestProxyTexImage(ctx, tex_obj->Target, 0, tex_format,
+ tex_image->Width, tex_image->Height,
+ tex_image->Depth, 0)) {
+ return false;
+ }
+
+ view_tex_obj->Target = tex_obj->Target;
+
+ *view_tex_image = _mesa_get_tex_image(ctx, view_tex_obj, tex_obj->Target, 0);
+ _mesa_init_teximage_fields(ctx, *view_tex_image,
+ tex_image->Width, tex_image->Height,
+ tex_image->Depth,
+ 0, internal_format, tex_format);
+
+ view_tex_obj->MinLevel = 0;
+ view_tex_obj->NumLevels = 1;
+ view_tex_obj->MinLayer = tex_obj->MinLayer;
+ view_tex_obj->NumLayers = tex_obj->NumLayers;
+ view_tex_obj->Immutable = tex_obj->Immutable;
+ view_tex_obj->ImmutableLevels = tex_obj->ImmutableLevels;
+ view_tex_obj->Target = tex_obj->Target;
+
+ if (ctx->Driver.TextureView != NULL &&
+ !ctx->Driver.TextureView(ctx, view_tex_obj, tex_obj)) {
+ _mesa_DeleteTextures(1, view_tex_name);
+ *view_tex_name = 0;
+ return false; /* driver recorded error */
+ }
+
+ return true;
+}
+
+/** A partial implementation of glCopyImageSubData
+ *
+ * This is a partial implementation of glCopyImageSubData that works only
+ * if both textures are uncompressed and the destination texture is
+ * renderable. It uses a slight abuse of a texture view (see make_view) to
+ * turn the source texture into the destination texture type and then uses
+ * _mesa_meta_BlitFramebuffers to do the copy.
+ */
+bool
+_mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
+ struct gl_texture_image *src_tex_image,
+ int src_x, int src_y, int src_z,
+ struct gl_texture_image *dst_tex_image,
+ int dst_x, int dst_y, int dst_z,
+ int src_width, int src_height)
+{
+ GLuint src_view_texture = 0;
+ struct gl_texture_image *src_view_tex_image;
+ GLuint fbos[2];
+ bool success = false;
+ GLbitfield mask;
+ GLenum status, attachment;
+
+ if (_mesa_is_format_compressed(dst_tex_image->TexFormat))
+ return false;
+
+ if (_mesa_is_format_compressed(src_tex_image->TexFormat))
+ return false;
+
+ if (src_tex_image->InternalFormat == dst_tex_image->InternalFormat) {
+ src_view_tex_image = src_tex_image;
+ } else {
+ if (!make_view(ctx, src_tex_image, &src_view_tex_image, &src_view_texture,
+ dst_tex_image->InternalFormat))
+ goto cleanup;
+ }
+
+ /* We really only need to stash the bound framebuffers. */
+ _mesa_meta_begin(ctx, 0);
+
+ _mesa_GenFramebuffers(2, fbos);
+ _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbos[0]);
+ _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbos[1]);
+
+ switch (_mesa_get_format_base_format(src_tex_image->TexFormat)) {
+ case GL_DEPTH_COMPONENT:
+ attachment = GL_DEPTH_ATTACHMENT;
+ mask = GL_DEPTH_BUFFER_BIT;
+ break;
+ case GL_DEPTH_STENCIL:
+ attachment = GL_DEPTH_STENCIL_ATTACHMENT;
+ mask = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
+ break;
+ case GL_STENCIL_INDEX:
+ attachment = GL_STENCIL_ATTACHMENT;
+ mask = GL_STENCIL_BUFFER_BIT;
+ break;
+ default:
+ attachment = GL_COLOR_ATTACHMENT0;
+ mask = GL_COLOR_BUFFER_BIT;
+ _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
+ _mesa_ReadBuffer(GL_COLOR_ATTACHMENT0);
+ }
+
+ _mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, attachment,
+ src_view_tex_image, src_z);
+
+ status = _mesa_CheckFramebufferStatus(GL_READ_FRAMEBUFFER);
+ if (status != GL_FRAMEBUFFER_COMPLETE)
+ goto meta_end;
+
+ _mesa_meta_bind_fbo_image(GL_DRAW_FRAMEBUFFER, attachment,
+ dst_tex_image, dst_z);
+
+ status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
+ if (status != GL_FRAMEBUFFER_COMPLETE)
+ goto meta_end;
+
+ /* Since we've bound a new draw framebuffer, we need to update its
+ * derived state -- _Xmin, etc -- for BlitFramebuffer's clipping to
+ * be correct.
+ */
+ _mesa_update_state(ctx);
+
+ /* We skip the core BlitFramebuffer checks for format consistency.
+ * We have already created views to ensure that the texture formats
+ * match.
+ */
+ ctx->Driver.BlitFramebuffer(ctx, src_x, src_y,
+ src_x + src_width, src_y + src_height,
+ dst_x, dst_y,
+ dst_x + src_width, dst_y + src_height,
+ mask, GL_NEAREST);
+
+ success = true;
+
+meta_end:
+ _mesa_DeleteFramebuffers(2, fbos);
+ _mesa_meta_end(ctx);
+
+cleanup:
+ _mesa_DeleteTextures(1, &src_view_texture);
+
+ return success;
+}
diff --git a/mesalib/src/mesa/drivers/common/meta_generate_mipmap.c b/mesalib/src/mesa/drivers/common/meta_generate_mipmap.c
index 4b1718df9..8ffd8da3b 100644
--- a/mesalib/src/mesa/drivers/common/meta_generate_mipmap.c
+++ b/mesalib/src/mesa/drivers/common/meta_generate_mipmap.c
@@ -104,7 +104,7 @@ fallback_required(struct gl_context *ctx, GLenum target,
_mesa_GenFramebuffers(1, &mipmap->FBO);
_mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO);
- _mesa_meta_bind_fbo_image(GL_COLOR_ATTACHMENT0, baseImage, 0);
+ _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, baseImage, 0);
status = _mesa_CheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
@@ -327,7 +327,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts),
verts, GL_DYNAMIC_DRAW_ARB);
- _mesa_meta_bind_fbo_image(GL_COLOR_ATTACHMENT0, dstImage, layer);
+ _mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, dstImage, layer);
/* sanity check */
if (_mesa_CheckFramebufferStatus(GL_FRAMEBUFFER) !=