Commit 127328bf authored by Roland Scheidegger's avatar Roland Scheidegger

mesa/st: adapt to interface changes

adapt to blit changes, and also handle a bit more msaa state in theory
(incomplete, doesn't handle resolves in any way for now).
parent 815b7570
......@@ -151,6 +151,7 @@ if env['platform'] != 'winddk':
'state_tracker/st_atom_constbuf.c',
'state_tracker/st_atom_depth.c',
'state_tracker/st_atom_framebuffer.c',
'state_tracker/st_atom_msaa.c',
'state_tracker/st_atom_pixeltransfer.c',
'state_tracker/st_atom_sampler.c',
'state_tracker/st_atom_scissor.c',
......
......@@ -195,6 +195,7 @@ STATETRACKER_SOURCES = \
state_tracker/st_atom_constbuf.c \
state_tracker/st_atom_depth.c \
state_tracker/st_atom_framebuffer.c \
state_tracker/st_atom_msaa.c \
state_tracker/st_atom_pixeltransfer.c \
state_tracker/st_atom_sampler.c \
state_tracker/st_atom_scissor.c \
......
......@@ -57,6 +57,7 @@ static const struct st_tracked_state *atoms[] =
&st_update_sampler,
&st_update_texture,
&st_update_framebuffer,
&st_update_msaa,
&st_update_vs_constants,
&st_update_fs_constants,
&st_update_pixel_transfer
......
......@@ -54,6 +54,7 @@ extern const struct st_tracked_state st_update_polygon_stipple;
extern const struct st_tracked_state st_update_viewport;
extern const struct st_tracked_state st_update_scissor;
extern const struct st_tracked_state st_update_blend;
extern const struct st_tracked_state st_update_msaa;
extern const struct st_tracked_state st_update_sampler;
extern const struct st_tracked_state st_update_texture;
extern const struct st_tracked_state st_finalize_textures;
......
......@@ -257,6 +257,15 @@ update_blend( struct st_context *st )
if (st->ctx->Color.DitherFlag)
blend->dither = 1;
if (st->ctx->Multisample.Enabled) {
/* unlike in gallium/d3d10 these operations are only performed
if msaa is enabled */
if (st->ctx->Multisample.SampleAlphaToCoverage)
blend->alpha_to_coverage = 1;
if (st->ctx->Multisample.SampleAlphaToOne)
blend->alpha_to_one = 1;
}
cso_set_blend(st->cso_context, blend);
{
......@@ -270,7 +279,7 @@ update_blend( struct st_context *st )
const struct st_tracked_state st_update_blend = {
"st_update_blend", /* name */
{ /* dirty */
(_NEW_COLOR), /* XXX _NEW_BLEND someday? */ /* mesa */
(_NEW_COLOR | _NEW_MULTISAMPLE), /* XXX _NEW_BLEND someday? */ /* mesa */
0, /* st */
},
update_blend, /* update */
......
......@@ -73,9 +73,7 @@ update_renderbuffer_surface(struct st_context *st,
strb->rtt_face,
level,
strb->rtt_slice,
PIPE_BIND_RENDER_TARGET |
PIPE_BIND_BLIT_SOURCE |
PIPE_BIND_BLIT_DESTINATION );
PIPE_BIND_RENDER_TARGET);
#if 0
printf("-- alloc new surface %d x %d into tex %p\n",
strb->surface->width, strb->surface->height,
......
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS 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 "st_context.h"
#include "pipe/p_context.h"
#include "st_atom.h"
#include "cso_cache/cso_context.h"
/* Second state atom for user clip planes:
*/
static void update_sample_mask( struct st_context *st )
{
unsigned sample_mask = 0xffffffff;
unsigned sample_count = 1;
struct pipe_framebuffer_state *framebuffer = &st->state.framebuffer;
/* dependency here on bound surface (or rather, sample count) is worrying */
if (framebuffer->zsbuf)
sample_count = framebuffer->zsbuf->texture->nr_samples;
else if (framebuffer->cbufs[0])
sample_count = framebuffer->cbufs[0]->texture->nr_samples;
if (st->ctx->Multisample.Enabled && sample_count > 1) {
/* unlike in gallium/d3d10 the mask is only active if msaa is enabled */
if (st->ctx->Multisample.SampleCoverage) {
unsigned nr_bits;
nr_bits = st->ctx->Multisample.SampleCoverageValue * (float)sample_count;
/* there's lot of ways how to do this. We just use first few bits,
since we have no knowledge of sample positions here. When
app-supplied mask though is used too might need to be smarter.
Also, there's a interface restriction here in theory it is
encouraged this mask not be the same at each pixel. */
sample_mask = (1 << nr_bits) - 1;
if (st->ctx->Multisample.SampleCoverageInvert)
sample_mask = ~sample_mask;
}
/* TODO merge with app-supplied sample mask */
}
/* mask off unused bits or don't care? */
if (sample_mask != st->state.sample_mask) {
st->state.sample_mask = sample_mask;
cso_set_sample_mask(st->cso_context, sample_mask);
}
}
const struct st_tracked_state st_update_msaa = {
"st_update_msaa", /* name */
{ /* dirty */
(_NEW_MULTISAMPLE | _NEW_BUFFERS), /* mesa */
ST_NEW_FRAMEBUFFER, /* st */
},
update_sample_mask /* update */
};
......@@ -123,7 +123,7 @@ create_color_map_texture(GLcontext *ctx)
/* find an RGBA texture format */
format = st_choose_format(pipe->screen, GL_RGBA,
PIPE_TEXTURE_2D, PIPE_BIND_SAMPLER_VIEW);
PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW);
/* create texture for color map/table */
pt = st_texture_create(st, PIPE_TEXTURE_2D, format, 0,
......
......@@ -807,15 +807,15 @@ st_init_bitmap(struct st_context *st)
st->bitmap.rasterizer.gl_rasterization_rules = 1;
/* find a usable texture format */
if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D,
if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM;
}
else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, PIPE_TEXTURE_2D,
else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
st->bitmap.tex_format = PIPE_FORMAT_A8_UNORM;
}
else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D,
else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM;
}
......
......@@ -112,33 +112,23 @@ st_BlitFramebuffer(GLcontext *ctx,
&readFB->Attachment[readFB->_ColorReadBufferIndex];
if(srcAtt->Type == GL_TEXTURE) {
struct pipe_screen *screen = pipe->screen;
struct st_texture_object *srcObj =
st_texture_object(srcAtt->Texture);
struct st_renderbuffer *dstRb =
st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
struct pipe_surface *srcSurf;
struct pipe_subresource srcSub;
struct pipe_surface *dstSurf = dstRb->surface;
if (!srcObj->pt)
return;
srcSurf = screen->get_tex_surface(screen,
srcObj->pt,
srcAtt->CubeMapFace,
srcAtt->TextureLevel,
srcAtt->Zoffset,
PIPE_BIND_BLIT_SOURCE);
if(!srcSurf)
return;
srcSub.face = srcAtt->CubeMapFace;
srcSub.level = srcAtt->TextureLevel;
util_blit_pixels(st->blit,
srcSurf, st_get_texture_sampler_view(srcObj, pipe),
srcX0, srcY0, srcX1, srcY1,
util_blit_pixels(st->blit, srcObj->pt, srcSub,
srcX0, srcY0, srcX1, srcY1, srcAtt->Zoffset,
dstSurf, dstX0, dstY0, dstX1, dstY1,
0.0, pFilter);
pipe_surface_reference(&srcSurf, NULL);
}
else {
struct st_renderbuffer *srcRb =
......@@ -146,11 +136,15 @@ st_BlitFramebuffer(GLcontext *ctx,
struct st_renderbuffer *dstRb =
st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
struct pipe_surface *srcSurf = srcRb->surface;
struct pipe_sampler_view *srcView = st_get_renderbuffer_sampler_view(srcRb, pipe);
struct pipe_surface *dstSurf = dstRb->surface;
struct pipe_subresource srcSub;
srcSub.face = srcSurf->face;
srcSub.level = srcSurf->level;
util_blit_pixels(st->blit,
srcSurf, srcView, srcX0, srcY0, srcX1, srcY1,
srcRb->texture, srcSub, srcX0, srcY0, srcX1, srcY1,
srcSurf->zslice,
dstSurf, dstX0, dstY0, dstX1, dstY1,
0.0, pFilter);
}
......@@ -182,13 +176,17 @@ st_BlitFramebuffer(GLcontext *ctx,
if ((mask & depthStencil) == depthStencil &&
srcDepthSurf == srcStencilSurf &&
dstDepthSurf == dstStencilSurf) {
struct pipe_sampler_view *srcView = st_get_renderbuffer_sampler_view(srcDepthRb, pipe);
struct pipe_subresource srcSub;
srcSub.face = srcDepthRb->surface->face;
srcSub.level = srcDepthRb->surface->level;
/* Blitting depth and stencil values between combined
* depth/stencil buffers. This is the ideal case for such buffers.
*/
util_blit_pixels(st->blit,
srcDepthSurf, srcView, srcX0, srcY0, srcX1, srcY1,
srcDepthRb->texture, srcSub, srcX0, srcY0, srcX1, srcY1,
srcDepthRb->surface->zslice,
dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
0.0, pFilter);
}
......
......@@ -180,9 +180,7 @@ st_bufferobj_data(GLcontext *ctx,
switch(target) {
case GL_PIXEL_PACK_BUFFER_ARB:
case GL_PIXEL_UNPACK_BUFFER_ARB:
buffer_usage = (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_BLIT_SOURCE |
PIPE_BIND_BLIT_DESTINATION);
buffer_usage = PIPE_BIND_RENDER_TARGET;
break;
case GL_ARRAY_BUFFER_ARB:
buffer_usage = PIPE_BIND_VERTEX_BUFFER;
......
......@@ -968,6 +968,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
enum pipe_format srcFormat, texFormat;
GLboolean invertTex = GL_FALSE;
GLint readX, readY, readW, readH;
GLuint sample_count;
struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
......@@ -994,9 +995,15 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
}
sample_count = rbRead->texture->nr_samples;
/* I believe this would be legal, presumably would need to do a resolve
for color, and for depth/stencil spec says to just use one of the
depth/stencil samples per pixel? Need some transfer clarifications. */
assert(sample_count < 2);
srcFormat = rbRead->texture->format;
if (screen->is_format_supported(screen, srcFormat, PIPE_TEXTURE_2D,
if (screen->is_format_supported(screen, srcFormat, PIPE_TEXTURE_2D, sample_count,
PIPE_BIND_SAMPLER_VIEW, 0)) {
texFormat = srcFormat;
}
......@@ -1004,14 +1011,14 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
/* srcFormat can't be used as a texture format */
if (type == GL_DEPTH) {
texFormat = st_choose_format(screen, GL_DEPTH_COMPONENT,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_2D, sample_count,
PIPE_BIND_DEPTH_STENCIL);
assert(texFormat != PIPE_FORMAT_NONE);
}
else {
/* default color format */
texFormat = st_choose_format(screen, GL_RGBA, PIPE_TEXTURE_2D,
PIPE_BIND_SAMPLER_VIEW);
sample_count, PIPE_BIND_SAMPLER_VIEW);
assert(texFormat != PIPE_FORMAT_NONE);
}
}
......@@ -1050,27 +1057,20 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
/* Make temporary texture which is a copy of the src region.
*/
if (srcFormat == texFormat) {
struct pipe_subresource srcsub, dstsub;
srcsub.face = 0;
srcsub.level = 0;
dstsub.face = 0;
dstsub.level = 0;
/* copy source framebuffer surface into mipmap/texture */
struct pipe_surface *psRead = screen->get_tex_surface(screen,
rbRead->texture, 0, 0, 0,
PIPE_BIND_BLIT_SOURCE);
struct pipe_surface *psTex = screen->get_tex_surface(screen, pt, 0, 0, 0,
PIPE_BIND_RENDER_TARGET |
PIPE_BIND_BLIT_DESTINATION);
pipe->surface_copy(pipe,
psTex, /* dest surf */
pack.SkipPixels, pack.SkipRows, /* dest pos */
psRead, /* src surf */
readX, readY, readW, readH); /* src region */
if (0) {
/* debug */
debug_dump_surface(pipe, "copypixsrcsurf", psRead);
debug_dump_surface(pipe, "copypixtemptex", psTex);
}
pipe->resource_copy_region(pipe,
pt, /* dest tex */
dstsub,
pack.SkipPixels, pack.SkipRows, 0, /* dest pos */
rbRead->texture, /* src tex */
srcsub,
readX, readY, 0, readW, readH); /* src region */
pipe_surface_reference(&psRead, NULL);
pipe_surface_reference(&psTex, NULL);
}
else {
/* CPU-based fallback/conversion */
......
......@@ -79,7 +79,7 @@ st_egl_image_target_renderbuffer_storage(GLcontext *ctx,
struct pipe_surface *ps;
unsigned usage;
usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_BLIT_SOURCE | PIPE_BIND_BLIT_DESTINATION;
usage = PIPE_BIND_RENDER_TARGET;
ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
if (ps) {
strb->Base.Width = ps->width;
......@@ -142,7 +142,7 @@ st_egl_image_target_texture_2d(GLcontext *ctx, GLenum target,
struct pipe_surface *ps;
unsigned usage;
usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_BLIT_DESTINATION | PIPE_BIND_BLIT_SOURCE;
usage = PIPE_BIND_SAMPLER_VIEW;
ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
if (ps) {
st_bind_surface(ctx, target, texObj, texImage, ps);
......
......@@ -72,7 +72,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
if (strb->format != PIPE_FORMAT_NONE)
format = strb->format;
else
format = st_choose_renderbuffer_format(screen, internalFormat);
format = st_choose_renderbuffer_format(screen, internalFormat, rb->NumSamples);
/* init renderbuffer fields */
strb->Base.Width = width;
......@@ -441,8 +441,8 @@ st_validate_attachment(struct pipe_screen *screen,
if (!stObj)
return GL_FALSE;
return screen->is_format_supported(screen, stObj->pt->format,
PIPE_TEXTURE_2D, bindings, 0);
return screen->is_format_supported(screen, stObj->pt->format, stObj->pt->nr_samples,
PIPE_TEXTURE_2D, bindings, 0);
}
......@@ -545,6 +545,7 @@ void st_init_fbo_functions(struct dd_function_table *functions)
functions->ReadBuffer = st_ReadBuffer;
}
/* XXX unused ? */
struct pipe_sampler_view *
st_get_renderbuffer_sampler_view(struct st_renderbuffer *rb,
struct pipe_context *pipe)
......
......@@ -73,6 +73,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw);
extern void
st_init_fbo_functions(struct dd_function_table *functions);
/* XXX unused ? */
extern struct pipe_sampler_view *
st_get_renderbuffer_sampler_view(struct st_renderbuffer *rb,
struct pipe_context *pipe);
......
......@@ -221,7 +221,7 @@ default_bindings(struct st_context *st, enum pipe_format format)
else
bindings = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
if (screen->is_format_supported(screen, format, target, bindings, geom))
if (screen->is_format_supported(screen, format, target, 0, bindings, geom))
return bindings;
else
return PIPE_BIND_SAMPLER_VIEW;
......@@ -428,7 +428,7 @@ compress_with_blit(GLcontext * ctx,
/* get destination surface (in the compressed texture) */
dst_surface = screen->get_tex_surface(screen, stImage->pt,
stImage->face, stImage->level, 0,
PIPE_BIND_BLIT_DESTINATION);
0 /* flags */);
if (!dst_surface) {
/* can't render into this format (or other problem) */
return GL_FALSE;
......@@ -652,7 +652,7 @@ st_TexImage(GLcontext * ctx,
_mesa_is_format_compressed(texImage->TexFormat) &&
screen->is_format_supported(screen,
stImage->pt->format,
stImage->pt->target,
stImage->pt->target, 0,
PIPE_BIND_RENDER_TARGET, 0)) {
if (!pixels)
goto done;
......@@ -848,8 +848,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
struct pipe_surface *dst_surface;
struct pipe_resource *dst_texture;
struct pipe_transfer *tex_xfer;
unsigned bind = (PIPE_BIND_BLIT_DESTINATION |
PIPE_BIND_RENDER_TARGET | /* util_blit may choose to render */
unsigned bind = (PIPE_BIND_RENDER_TARGET | /* util_blit may choose to render */
PIPE_BIND_TRANSFER_READ);
/* create temp / dest surface */
......@@ -1080,7 +1079,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
_mesa_is_format_compressed(texImage->TexFormat) &&
screen->is_format_supported(screen,
stImage->pt->format,
stImage->pt->target,
stImage->pt->target, 0,
PIPE_BIND_RENDER_TARGET, 0)) {
if (compress_with_blit(ctx, target, level,
xoffset, yoffset, zoffset,
......@@ -1508,7 +1507,7 @@ st_copy_texsubimage(GLcontext *ctx,
enum pipe_format dest_format, src_format;
GLboolean use_fallback = GL_TRUE;
GLboolean matching_base_formats;
GLuint format_writemask;
GLuint format_writemask, sample_count;
struct pipe_surface *dest_surface = NULL;
GLboolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
......@@ -1534,6 +1533,12 @@ st_copy_texsubimage(GLcontext *ctx,
return;
}
sample_count = strb->surface->texture->nr_samples;
/* I believe this would be legal, presumably would need to do a resolve
for color, and for depth/stencil spec says to just use one of the
depth/stencil samples per pixel? Need some transfer clarifications. */
assert(sample_count < 2);
if (srcX < 0) {
width -= -srcX;
destX += -srcX;
......@@ -1589,42 +1594,45 @@ st_copy_texsubimage(GLcontext *ctx,
!do_flip)
{
/* use surface_copy() / blit */
dest_surface = screen->get_tex_surface(screen, stImage->pt,
stImage->face, stImage->level,
destZ,
PIPE_BIND_BLIT_DESTINATION);
/* for surface_copy(), y=0=top, always */
pipe->surface_copy(pipe,
/* dest */
dest_surface,
destX, destY,
/* src */
strb->surface,
srcX, srcY,
/* size */
width, height);
struct pipe_subresource subdst, subsrc;
subdst.face = stImage->face;
subdst.level = stImage->level;
subsrc.face = strb->surface->face;
subsrc.level = strb->surface->level;
/* for resource_copy_region(), y=0=top, always */
pipe->resource_copy_region(pipe,
/* dest */
stImage->pt,
subdst,
destX, destY, destZ,
/* src */
strb->texture,
subsrc,
srcX, srcY, strb->surface->zslice,
/* size */
width, height);
use_fallback = GL_FALSE;
}
else if (format_writemask &&
texBaseFormat != GL_DEPTH_COMPONENT &&
texBaseFormat != GL_DEPTH_STENCIL &&
screen->is_format_supported(screen, src_format,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_2D, sample_count,
PIPE_BIND_SAMPLER_VIEW,
0) &&
screen->is_format_supported(screen, dest_format,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_2D, 0,
PIPE_BIND_RENDER_TARGET,
0)) {
/* draw textured quad to do the copy */
GLint srcY0, srcY1;
struct pipe_subresource subsrc;
dest_surface = screen->get_tex_surface(screen, stImage->pt,
stImage->face, stImage->level,
destZ,
PIPE_BIND_BLIT_DESTINATION);
PIPE_BIND_RENDER_TARGET);
if (do_flip) {
srcY1 = strb->Base.Height - srcY - height;
......@@ -1634,11 +1642,15 @@ st_copy_texsubimage(GLcontext *ctx,
srcY0 = srcY;
srcY1 = srcY0 + height;
}
subsrc.face = strb->surface->face;
subsrc.level = strb->surface->level;
util_blit_pixels_writemask(st->blit,
strb->surface,
st_get_renderbuffer_sampler_view(strb, pipe),
strb->texture,
subsrc,
srcX, srcY0,
srcX + width, srcY1,
strb->surface->zslice,
dest_surface,
destX, destY,
destX + width, destY + height,
......
......@@ -99,19 +99,6 @@ st_get_msaa(void)
}
/** Default method for pipe_context::surface_copy() */
static void
st_surface_copy(struct pipe_context *pipe,
struct pipe_surface *dst,
unsigned dst_x, unsigned dst_y,
struct pipe_surface *src,
unsigned src_x, unsigned src_y,
unsigned w, unsigned h)
{
util_surface_copy(pipe, FALSE, dst, dst_x, dst_y, src, src_x, src_y, w, h);
}
static struct st_context *
st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
{
......@@ -181,10 +168,6 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
st_init_limits(st);
st_init_extensions(st);
/* plug in helper driver functions if needed */
if (!pipe->surface_copy)
pipe->surface_copy = st_surface_copy;
return st;
}
......
......@@ -94,6 +94,7 @@ struct st_context
struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
struct pipe_scissor_state scissor;
struct pipe_viewport_state viewport;
unsigned sample_mask;
GLuint num_samplers;
GLuint num_textures;
......
......@@ -287,39 +287,39 @@ void st_init_extensions(struct st_context *st)
* a depth/stencil buffer and texture from depth/stencil source.
*/
if (screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_2D, 0,
PIPE_BIND_DEPTH_STENCIL, 0) &&
screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
}
else if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_2D, 0,
PIPE_BIND_DEPTH_STENCIL, 0) &&
screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
}
/* sRGB support */
if (screen->is_format_supported(screen, PIPE_FORMAT_A8B8G8R8_SRGB,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW,