aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-13 12:16:00 +0200
committermarha <marha@users.sourceforge.net>2012-07-13 12:16:00 +0200
commitdcf9ae77854778629cabd0d6943dda3678eb91fa (patch)
tree087d3bb4beb55bcc0c5857b41d2b5b10edd0e2f3 /mesalib/src/mesa/state_tracker
parent2c8d7aa6bda138693fa1827852ba6b75d1721ff8 (diff)
parentf0a7d1d88be0c31bd471f4428c4493a93f2d9321 (diff)
downloadvcxsrv-dcf9ae77854778629cabd0d6943dda3678eb91fa.tar.gz
vcxsrv-dcf9ae77854778629cabd0d6943dda3678eb91fa.tar.bz2
vcxsrv-dcf9ae77854778629cabd0d6943dda3678eb91fa.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/glx/glxext.c xorg-server/hw/xwin/InitOutput.c
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_blit.c37
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c25
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c32
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c4
7 files changed, 65 insertions, 43 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c
index 27da2c633..1486779fd 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_blit.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c
@@ -242,7 +242,7 @@ st_BlitFramebuffer(struct gl_context *ctx,
srcX0, srcY0, srcX1, srcY1,
srcAtt->Zoffset + srcAtt->CubeMapFace,
dstSurf, dstX0, dstY0, dstX1, dstY1,
- 0.0, pFilter);
+ 0.0, pFilter, TGSI_WRITEMASK_XYZW, 0);
}
else {
struct st_renderbuffer *srcRb =
@@ -257,7 +257,7 @@ st_BlitFramebuffer(struct gl_context *ctx,
srcX0, srcY0, srcX1, srcY1,
srcSurf->u.tex.first_layer,
dstSurf, dstX0, dstY0, dstX1, dstY1,
- 0.0, pFilter);
+ 0.0, pFilter, TGSI_WRITEMASK_XYZW, 0);
}
}
@@ -281,6 +281,13 @@ st_BlitFramebuffer(struct gl_context *ctx,
struct pipe_surface *dstDepthSurf =
dstDepthRb ? dstDepthRb->surface : NULL;
+ struct st_renderbuffer *srcStencilRb =
+ st_renderbuffer(readFB->Attachment[BUFFER_STENCIL].Renderbuffer);
+ struct st_renderbuffer *dstStencilRb =
+ st_renderbuffer(drawFB->Attachment[BUFFER_STENCIL].Renderbuffer);
+ struct pipe_surface *dstStencilSurf =
+ dstStencilRb ? dstStencilRb->surface : NULL;
+
if ((mask & depthStencil) == depthStencil &&
st_is_depth_stencil_combined(srcDepth, srcStencil) &&
st_is_depth_stencil_combined(dstDepth, dstStencil)) {
@@ -294,7 +301,15 @@ st_BlitFramebuffer(struct gl_context *ctx,
srcX0, srcY0, srcX1, srcY1,
srcDepthRb->surface->u.tex.first_layer,
dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
- 0.0, pFilter);
+ 0.0, pFilter, 0,
+ BLIT_WRITEMASK_Z |
+ (st->has_stencil_export ? BLIT_WRITEMASK_STENCIL
+ : 0));
+
+ if (!st->has_stencil_export) {
+ _mesa_problem(ctx, "st_BlitFramebuffer(STENCIL) "
+ "software fallback not implemented");
+ }
}
else {
/* blitting depth and stencil separately */
@@ -305,12 +320,22 @@ st_BlitFramebuffer(struct gl_context *ctx,
srcX0, srcY0, srcX1, srcY1,
srcDepthRb->surface->u.tex.first_layer,
dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
- 0.0, pFilter);
+ 0.0, pFilter, 0, BLIT_WRITEMASK_Z);
}
if (mask & GL_STENCIL_BUFFER_BIT) {
- /* blit stencil only */
- _mesa_problem(ctx, "st_BlitFramebuffer(STENCIL) not completed");
+ if (st->has_stencil_export) {
+ util_blit_pixels(st->blit, srcStencilRb->texture,
+ srcStencilRb->surface->u.tex.level,
+ srcX0, srcY0, srcX1, srcY1,
+ srcStencilRb->surface->u.tex.first_layer,
+ dstStencilSurf, dstX0, dstY0, dstX1, dstY1,
+ 0.0, pFilter, 0, BLIT_WRITEMASK_STENCIL);
+ }
+ else {
+ _mesa_problem(ctx, "st_BlitFramebuffer(STENCIL) "
+ "software fallback not implemented");
+ }
}
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 2bcbada4f..c5f36316b 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -403,6 +403,8 @@ internal_format(struct gl_context *ctx, GLenum format, GLenum type)
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
+ return GL_RGB565;
+
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
return GL_RGB5_A1;
@@ -1165,27 +1167,8 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
* The stencil is written using the shader stencil export
* functionality. */
if (write_stencil) {
- enum pipe_format stencil_format = PIPE_FORMAT_NONE;
-
- switch (pt->format) {
- case PIPE_FORMAT_Z24_UNORM_S8_UINT:
- case PIPE_FORMAT_X24S8_UINT:
- stencil_format = PIPE_FORMAT_X24S8_UINT;
- break;
- case PIPE_FORMAT_S8_UINT_Z24_UNORM:
- case PIPE_FORMAT_S8X24_UINT:
- stencil_format = PIPE_FORMAT_S8X24_UINT;
- break;
- case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
- case PIPE_FORMAT_X32_S8X24_UINT:
- stencil_format = PIPE_FORMAT_X32_S8X24_UINT;
- break;
- case PIPE_FORMAT_S8_UINT:
- stencil_format = PIPE_FORMAT_S8_UINT;
- break;
- default:
- assert(0);
- }
+ enum pipe_format stencil_format =
+ util_format_stencil_only(pt->format);
sv[1] = st_create_texture_sampler_view_format(st->pipe, pt,
stencil_format);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 67c3f9590..a7f57b96f 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -944,7 +944,7 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
struct pipe_screen *screen = pipe->screen;
enum pipe_format dest_format, src_format;
GLboolean matching_base_formats;
- GLuint format_writemask, sample_count;
+ GLuint color_writemask, zs_writemask, sample_count;
struct pipe_surface *dest_surface = NULL;
GLboolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
struct pipe_surface surf_tmpl;
@@ -1025,15 +1025,17 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
}
if (texBaseFormat == GL_DEPTH_COMPONENT) {
- format_writemask = TGSI_WRITEMASK_XYZW;
+ color_writemask = 0;
+ zs_writemask = BLIT_WRITEMASK_Z;
dst_usage = PIPE_BIND_DEPTH_STENCIL;
}
else {
- format_writemask = compatible_src_dst_formats(ctx, &strb->Base, texImage);
+ color_writemask = compatible_src_dst_formats(ctx, &strb->Base, texImage);
+ zs_writemask = 0;
dst_usage = PIPE_BIND_RENDER_TARGET;
}
- if (!format_writemask ||
+ if ((!color_writemask && !zs_writemask) ||
!screen->is_format_supported(screen, src_format,
PIPE_TEXTURE_2D, sample_count,
PIPE_BIND_SAMPLER_VIEW) ||
@@ -1066,17 +1068,17 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
dest_surface = pipe->create_surface(pipe, stImage->pt,
&surf_tmpl);
- util_blit_pixels_writemask(st->blit,
- strb->texture,
- strb->surface->u.tex.level,
- srcX, srcY0,
- srcX + width, srcY1,
- strb->surface->u.tex.first_layer,
- dest_surface,
- destX, destY,
- destX + width, destY + height,
- 0.0, PIPE_TEX_MIPFILTER_NEAREST,
- format_writemask);
+ util_blit_pixels(st->blit,
+ strb->texture,
+ strb->surface->u.tex.level,
+ srcX, srcY0,
+ srcX + width, srcY1,
+ strb->surface->u.tex.first_layer,
+ dest_surface,
+ destX, destY,
+ destX + width, destY + height,
+ 0.0, PIPE_TEX_MIPFILTER_NEAREST,
+ color_writemask, zs_writemask);
pipe_surface_reference(&dest_surface, NULL);
/* Restore conditional rendering state. */
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 132dcc02f..117ea90f8 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -187,6 +187,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe )
st->pixel_xfer.cache = _mesa_new_program_cache();
st->force_msaa = st_get_msaa();
+ st->has_stencil_export =
+ screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT);
/* GL limits and extensions */
st_init_limits(st);
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index 734b4d9c1..a3f44b3ab 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -81,7 +81,7 @@ struct st_context
struct draw_stage *rastpos_stage; /**< For glRasterPos */
GLboolean clamp_frag_color_in_shader;
GLboolean clamp_vert_color_in_shader;
-
+ boolean has_stencil_export; /**< can do shader stencil export? */
/* On old libGL's for linux we need to invalidate the drawables
* on glViewpport calls, this is set via a option.
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 5b333ad2c..5099acdb5 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -355,6 +355,7 @@ void st_init_extensions(struct st_context *st)
{ o(ARB_shadow), PIPE_CAP_TEXTURE_SHADOW_MAP },
{ o(ARB_texture_non_power_of_two), PIPE_CAP_NPOT_TEXTURES },
{ o(ARB_transform_feedback2), PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME },
+ { o(ARB_transform_feedback3), PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME },
{ o(EXT_blend_equation_separate), PIPE_CAP_BLEND_EQUATION_SEPARATE },
{ o(EXT_draw_buffers2), PIPE_CAP_INDEP_BLEND_ENABLE },
@@ -641,4 +642,9 @@ void st_init_extensions(struct st_context *st)
screen->get_param(screen, PIPE_CAP_QUERY_TIMESTAMP)) {
ctx->Extensions.ARB_timer_query = GL_TRUE;
}
+
+ if (ctx->Extensions.ARB_transform_feedback2 &&
+ ctx->Extensions.ARB_draw_instanced) {
+ ctx->Extensions.ARB_transform_feedback_instanced = GL_TRUE;
+ }
}
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 4265d14b4..57d34411f 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -793,6 +793,10 @@ static const struct format_mapping format_map[] = {
{ PIPE_FORMAT_B5G6R5_UNORM, PIPE_FORMAT_B5G5R5A1_UNORM,
DEFAULT_RGBA_FORMATS }
},
+ {
+ { GL_RGB565 },
+ { PIPE_FORMAT_B5G6R5_UNORM, DEFAULT_RGBA_FORMATS }
+ },
/* basic Alpha formats */
{