aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_cb_texture.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-06-04 09:07:26 +0200
committermarha <marha@users.sourceforge.net>2013-06-04 09:07:26 +0200
commit150771e7aabf4c864b0b970c5b8d773634793abe (patch)
tree3d544cc0d8d06dd70e843d6ca7e4b0ef421d2758 /mesalib/src/mesa/state_tracker/st_cb_texture.c
parentfbe681216618af573ce29ca03b382b39b5919a52 (diff)
downloadvcxsrv-150771e7aabf4c864b0b970c5b8d773634793abe.tar.gz
vcxsrv-150771e7aabf4c864b0b970c5b8d773634793abe.tar.bz2
vcxsrv-150771e7aabf4c864b0b970c5b8d773634793abe.zip
xwininfo fontconfig libX11 libXau libXdmcp libXext mesa libXinerama libxcb libxcb/xcb-proto libfontenc pixman xkbcomp mkfontscale xkeyboard-config git update 4 Jun 2013
xserver commit c21344add2fc589df83b29be5831c36a372201bd libxcb commit 9ae84ad187e2ba440c40f44b8eb21c82c2fdbf12 libxcb/xcb-proto commit bdfedfa57a13ff805580cfacafc70f9cc55df363 xkeyboard-config commit dad9ade4e83d1ef5a517fcc4cc9ad3a79b47acce libX11 commit 8496122eb00ce6cd5d2308ee54f64b68c378e455 libXdmcp commit 0b443c1b769b9c9a3b45b4252afe07e18b709ff4 libXext commit d8366afbb0d2e4fbb1e419b1187f490522270bea libfontenc commit 3acba630d8b57084f7e92c15732408711ed5137a libXinerama commit 6e1d1dc328ba8162bba2f4694e7f3c706a1491ff libXau commit 899790011304c4029e15abf410e49ce7cec17e0a xkbcomp commit ed582f4fccd4e23abcfba8b3b03649fea6414f44 pixman commit 2acfac5f8e097ee2ae225d986f981b55d65dd152 mkfontscale commit 19e2cb7c6a3ec2c5b1bc0d24866fa685eef0ee13 xwininfo commit ba0d1b0da21d2dbdd81098ed5778f3792b472e13 fontconfig commit cd9b1033a68816a7acfbba1718ba0aa5888f6ec7 mesa commit 7bafd88c153e395274b632e7eae4bc9fc3aec1d2
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c51
1 files changed, 42 insertions, 9 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 0cd0d77af..56dbe85c0 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -25,7 +25,6 @@
*
**************************************************************************/
-#include "main/mfeatures.h"
#include "main/bufferobj.h"
#include "main/enums.h"
#include "main/fbobject.h"
@@ -78,6 +77,8 @@ gl_target_to_pipe(GLenum target)
case GL_TEXTURE_2D:
case GL_PROXY_TEXTURE_2D:
case GL_TEXTURE_EXTERNAL_OES:
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE:
return PIPE_TEXTURE_2D;
case GL_TEXTURE_RECTANGLE_NV:
case GL_PROXY_TEXTURE_RECTANGLE_NV:
@@ -99,6 +100,8 @@ gl_target_to_pipe(GLenum target)
return PIPE_TEXTURE_1D_ARRAY;
case GL_TEXTURE_2D_ARRAY_EXT:
case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY:
return PIPE_TEXTURE_2D_ARRAY;
case GL_TEXTURE_BUFFER:
return PIPE_BUFFER;
@@ -408,7 +411,7 @@ guess_and_alloc_texture(struct st_context *st,
ptWidth,
ptHeight,
ptDepth,
- ptLayers,
+ ptLayers, 0,
bindings);
stObj->lastLevel = lastLevel;
@@ -496,7 +499,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx,
ptWidth,
ptHeight,
ptDepth,
- ptLayers,
+ ptLayers, 0,
bindings);
return stImage->pt != NULL;
}
@@ -1492,7 +1495,7 @@ st_finalize_texture(struct gl_context *ctx,
GLuint face;
struct st_texture_image *firstImage;
enum pipe_format firstImageFormat;
- GLuint ptWidth, ptHeight, ptDepth, ptLayers;
+ GLuint ptWidth, ptHeight, ptDepth, ptLayers, ptNumSamples;
if (_mesa_is_texture_complete(tObj, &tObj->Sampler)) {
/* The texture is complete and we know exactly how many mipmap levels
@@ -1537,6 +1540,11 @@ st_finalize_texture(struct gl_context *ctx,
pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
}
+ /* If this texture comes from a window system, there is nothing else to do. */
+ if (stObj->surface_based) {
+ return GL_TRUE;
+ }
+
/* Find gallium format for the Mesa texture */
firstImageFormat = st_mesa_format_to_pipe_format(firstImage->base.TexFormat);
@@ -1556,6 +1564,7 @@ st_finalize_texture(struct gl_context *ctx,
/* convert GL dims to Gallium dims */
st_gl_texture_dims_to_pipe_dims(stObj->base.Target, width, height, depth,
&ptWidth, &ptHeight, &ptDepth, &ptLayers);
+ ptNumSamples = firstImage->base.NumSamples;
}
/* If we already have a gallium texture, check that it matches the texture
@@ -1563,11 +1572,12 @@ st_finalize_texture(struct gl_context *ctx,
*/
if (stObj->pt) {
if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
- !st_sampler_compat_formats(stObj->pt->format, firstImageFormat) ||
+ stObj->pt->format != firstImageFormat ||
stObj->pt->last_level < stObj->lastLevel ||
stObj->pt->width0 != ptWidth ||
stObj->pt->height0 != ptHeight ||
stObj->pt->depth0 != ptDepth ||
+ stObj->pt->nr_samples != ptNumSamples ||
stObj->pt->array_size != ptLayers)
{
/* The gallium texture does not match the Mesa texture so delete the
@@ -1591,7 +1601,7 @@ st_finalize_texture(struct gl_context *ctx,
ptWidth,
ptHeight,
ptDepth,
- ptLayers,
+ ptLayers, ptNumSamples,
bindings);
if (!stObj->pt) {
@@ -1637,11 +1647,14 @@ st_AllocTextureStorage(struct gl_context *ctx,
GLsizei height, GLsizei depth)
{
const GLuint numFaces = _mesa_num_tex_faces(texObj->Target);
+ struct gl_texture_image *texImage = texObj->Image[0][0];
struct st_context *st = st_context(ctx);
struct st_texture_object *stObj = st_texture_object(texObj);
+ struct pipe_screen *screen = st->pipe->screen;
GLuint ptWidth, ptHeight, ptDepth, ptLayers, bindings;
enum pipe_format fmt;
GLint level;
+ int num_samples = texImage->NumSamples;
assert(levels > 0);
@@ -1651,10 +1664,30 @@ st_AllocTextureStorage(struct gl_context *ctx,
stObj->depth0 = depth;
stObj->lastLevel = levels - 1;
- fmt = st_mesa_format_to_pipe_format(texObj->Image[0][0]->TexFormat);
+ fmt = st_mesa_format_to_pipe_format(texImage->TexFormat);
bindings = default_bindings(st, fmt);
+ /* Raise the sample count if the requested one is unsupported. */
+ if (num_samples > 1) {
+ boolean found = FALSE;
+
+ for (; num_samples <= ctx->Const.MaxSamples; num_samples++) {
+ if (screen->is_format_supported(screen, fmt, PIPE_TEXTURE_2D,
+ num_samples,
+ PIPE_BIND_SAMPLER_VIEW)) {
+ /* Update the sample count in gl_texture_image as well. */
+ texImage->NumSamples = num_samples;
+ found = TRUE;
+ break;
+ }
+ }
+
+ if (!found) {
+ return GL_FALSE;
+ }
+ }
+
st_gl_texture_dims_to_pipe_dims(texObj->Target,
width, height, depth,
&ptWidth, &ptHeight, &ptDepth, &ptLayers);
@@ -1662,11 +1695,11 @@ st_AllocTextureStorage(struct gl_context *ctx,
stObj->pt = st_texture_create(st,
gl_target_to_pipe(texObj->Target),
fmt,
- levels,
+ levels - 1,
ptWidth,
ptHeight,
ptDepth,
- ptLayers,
+ ptLayers, num_samples,
bindings);
if (!stObj->pt)
return GL_FALSE;