summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSinclair Yeh <[email protected]>2016-03-01 15:55:53 -0800
committerBrian Paul <[email protected]>2016-03-04 07:57:41 -0700
commitf1410c5b910911e690290e8a95aeb9f95e7cc470 (patch)
treec4789e3ba0a653a36b2457f536afc06f19fdced0 /src
parent8366701f4cb6d297623607e922d151dc05f69811 (diff)
svga: Force an RGBA view creation for an RGBA resource
glXCreatePixmap() may specify a GLX_TEXTURE_FORMAT_RGB_EXT format for an RGBA resource, causing us to create an RGBX view for an RGBA resource, a combination vgpu10 does not support. When this is detected, change the request to create an RGBA view instead. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/svga/svga_state_sampler.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gallium/drivers/svga/svga_state_sampler.c b/src/gallium/drivers/svga/svga_state_sampler.c
index e7b540cc707..6179a797fa2 100644
--- a/src/gallium/drivers/svga/svga_state_sampler.c
+++ b/src/gallium/drivers/svga/svga_state_sampler.c
@@ -103,8 +103,17 @@ svga_validate_pipe_sampler_view(struct svga_context *svga,
SVGA3dSurfaceFormat format;
SVGA3dResourceType resourceDim;
SVGA3dShaderResourceViewDesc viewDesc;
+ enum pipe_format pformat = sv->base.format;
- format = svga_translate_format(ss, sv->base.format,
+ /* vgpu10 cannot create a BGRX view for a BGRA resource, so force it to
+ * create a BGRA view.
+ */
+ if (pformat == PIPE_FORMAT_B8G8R8X8_UNORM &&
+ sv->base.texture->format == PIPE_FORMAT_B8G8R8A8_UNORM) {
+ pformat = PIPE_FORMAT_B8G8R8A8_UNORM;
+ }
+
+ format = svga_translate_format(ss, pformat,
PIPE_BIND_SAMPLER_VIEW);
assert(format != SVGA3D_FORMAT_INVALID);