[virglrenderer-devel] [PATCH 2/6] renderer/sampler views: use view->format instead of format

Dave Airlie airlied at gmail.com
Fri Jun 8 01:18:51 UTC 2018


From: Dave Airlie <airlied at redhat.com>

I want to change the incoming format to use some bits for texture
view support, so this is precursor to avoid causing problems.
---
 src/vrend_renderer.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 02cf683..1115aaa 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -1386,7 +1386,7 @@ int vrend_create_sampler_view(struct vrend_context *ctx,
          view->srgb_decode = GL_SKIP_DECODE_EXT;
    }
 
-   if (!(util_format_has_alpha(format) || util_format_is_depth_or_stencil(format))) {
+   if (!(util_format_has_alpha(view->format) || util_format_is_depth_or_stencil(view->format))) {
       if (swizzle[0] == PIPE_SWIZZLE_ALPHA)
           swizzle[0] = PIPE_SWIZZLE_ONE;
       if (swizzle[1] == PIPE_SWIZZLE_ALPHA)
@@ -1397,15 +1397,15 @@ int vrend_create_sampler_view(struct vrend_context *ctx,
           swizzle[3] = PIPE_SWIZZLE_ONE;
    }
 
-   if (tex_conv_table[format].flags & VREND_BIND_NEED_SWIZZLE) {
+   if (tex_conv_table[view->format].flags & VREND_BIND_NEED_SWIZZLE) {
       if (swizzle[0] <= PIPE_SWIZZLE_ALPHA)
-         swizzle[0] = tex_conv_table[format].swizzle[swizzle[0]];
+         swizzle[0] = tex_conv_table[view->format].swizzle[swizzle[0]];
       if (swizzle[1] <= PIPE_SWIZZLE_ALPHA)
-         swizzle[1] = tex_conv_table[format].swizzle[swizzle[1]];
+         swizzle[1] = tex_conv_table[view->format].swizzle[swizzle[1]];
       if (swizzle[2] <= PIPE_SWIZZLE_ALPHA)
-         swizzle[2] = tex_conv_table[format].swizzle[swizzle[2]];
+         swizzle[2] = tex_conv_table[view->format].swizzle[swizzle[2]];
       if (swizzle[3] <= PIPE_SWIZZLE_ALPHA)
-         swizzle[3] = tex_conv_table[format].swizzle[swizzle[3]];
+         swizzle[3] = tex_conv_table[view->format].swizzle[swizzle[3]];
    }
 
    view->gl_swizzle_r = to_gl_swizzle(swizzle[0]);
-- 
2.14.3



More information about the virglrenderer-devel mailing list