aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-02-14 14:46:43 +0000
committermarha <marha@users.sourceforge.net>2011-02-14 14:46:43 +0000
commit0f63823d473bf956ec5bddf06da6e4b591e994f8 (patch)
treec8fa2b17686616a7443c583e09bbf6eceec883c2 /mesalib/src/mesa/state_tracker
parent9acb2b3cd11b530debce5008074fa03587ac3331 (diff)
parent026b85e62b3d8812afb5f04df29aeac28c52b331 (diff)
downloadvcxsrv-0f63823d473bf956ec5bddf06da6e4b591e994f8.tar.gz
vcxsrv-0f63823d473bf956ec5bddf06da6e4b591e994f8.tar.bz2
vcxsrv-0f63823d473bf956ec5bddf06da6e4b591e994f8.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c29
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c15
2 files changed, 29 insertions, 15 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index b778ecf0b..2934f9ffb 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -448,11 +448,14 @@ st_finish_render_texture(struct gl_context *ctx,
* Validate a renderbuffer attachment for a particular set of bindings.
*/
static GLboolean
-st_validate_attachment(struct pipe_screen *screen,
+st_validate_attachment(struct gl_context *ctx,
+ struct pipe_screen *screen,
const struct gl_renderbuffer_attachment *att,
unsigned bindings)
{
const struct st_texture_object *stObj = st_texture_object(att->Texture);
+ enum pipe_format format;
+ gl_format texFormat;
/* Only validate texture attachments for now, since
* st_renderbuffer_alloc_storage makes sure that
@@ -464,7 +467,20 @@ st_validate_attachment(struct pipe_screen *screen,
if (!stObj)
return GL_FALSE;
- return screen->is_format_supported(screen, stObj->pt->format,
+ format = stObj->pt->format;
+ texFormat =
+ stObj->base.Image[att->CubeMapFace][att->TextureLevel]->TexFormat;
+
+ /* If the encoding is sRGB and sRGB rendering cannot be enabled,
+ * check for linear format support instead.
+ * Later when we create a surface, we change the format to a linear one. */
+ if (!ctx->Const.sRGBCapable &&
+ _mesa_get_format_color_encoding(texFormat) == GL_SRGB) {
+ const gl_format linearFormat = _mesa_get_srgb_format_linear(texFormat);
+ format = st_mesa_format_to_pipe_format(linearFormat);
+ }
+
+ return screen->is_format_supported(screen, format,
PIPE_TEXTURE_2D,
stObj->pt->nr_samples, bindings, 0);
}
@@ -528,20 +544,23 @@ st_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
return;
}
- if (!st_validate_attachment(screen,
+ if (!st_validate_attachment(ctx,
+ screen,
depth,
PIPE_BIND_DEPTH_STENCIL)) {
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
return;
}
- if (!st_validate_attachment(screen,
+ if (!st_validate_attachment(ctx,
+ screen,
stencil,
PIPE_BIND_DEPTH_STENCIL)) {
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
return;
}
for (i = 0; i < ctx->Const.MaxColorAttachments; i++) {
- if (!st_validate_attachment(screen,
+ if (!st_validate_attachment(ctx,
+ screen,
&fb->Attachment[BUFFER_COLOR0 + i],
PIPE_BIND_RENDER_TARGET)) {
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index 3b54eb7b8..5684e9768 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -426,19 +426,13 @@ st_framebuffer_create(struct st_framebuffer_iface *stfbi)
struct gl_config mode;
gl_buffer_index idx;
+ if (!stfbi)
+ return NULL;
+
stfb = CALLOC_STRUCT(st_framebuffer);
if (!stfb)
return NULL;
- /* for FBO-only context */
- if (!stfbi) {
- struct gl_framebuffer *base = _mesa_get_incomplete_framebuffer();
-
- stfb->Base = *base;
-
- return stfb;
- }
-
st_visual_to_context_mode(stfbi->visual, &mode);
_mesa_initialize_window_framebuffer(&stfb->Base, &mode);
@@ -764,7 +758,8 @@ st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
ret = _mesa_make_current(st->ctx, &stdraw->Base, &stread->Base);
}
else {
- ret = FALSE;
+ struct gl_framebuffer *incomplete = _mesa_get_incomplete_framebuffer();
+ ret = _mesa_make_current(st->ctx, incomplete, incomplete);
}
st_framebuffer_reference(&stdraw, NULL);