From cd33353097e31ccc56db161e6bcc222a4b5c1ca0 Mon Sep 17 00:00:00 2001 From: Ryan Neph Date: Thu, 3 Mar 2022 10:32:58 -0800 Subject: [PATCH] vrend: simple refactor to vrend_hw_emit_framebuffer_state() no functional change. Signed-off-by: Ryan Neph Reviewed-by: Gert Wollny Part-of: --- src/vrend_renderer.c | 48 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 6fb3eb5..802c6c1 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -2647,31 +2647,31 @@ static void vrend_hw_emit_framebuffer_state(struct vrend_sub_context *sub_ctx) sub_ctx->swizzle_output_rgb_to_bgr = 0; sub_ctx->needs_manual_srgb_encode_bitmask = 0; for (int i = 0; i < sub_ctx->nr_cbufs; i++) { - if (sub_ctx->surf[i]) { - struct vrend_surface *surf = sub_ctx->surf[i]; - - /* glTextureView() is not applied to eglimage-backed surfaces, because it - * causes unintended format interpretation errors. But a swizzle may still - * be necessary, e.g. for rgb* views on bgr* resources. Ensure this - * happens by adding a shader swizzle to the final write of such surfaces. - */ - if (!vrend_resource_supports_view(surf->texture, surf->format) && - !vrend_format_is_bgra(surf->format)) { - sub_ctx->swizzle_output_rgb_to_bgr |= 1 << i; - } + struct vrend_surface *surf = sub_ctx->surf[i]; + if (!surf) + continue; - /* glTextureView() on eglimage-backed bgr* textures for is not supported. - * To work around this for colorspace conversion, views are avoided - * manual colorspace conversion is instead injected in the fragment - * shader writing to such surfaces and during glClearColor(). */ - if (util_format_is_srgb(surf->format) && - !vrend_resource_supports_view(surf->texture, surf->format)) { - VREND_DEBUG(dbg_tex, sub_ctx->parent, - "manually converting linear->srgb for EGL-backed framebuffer color attachment 0x%x" - " (surface format is %s; resource format is %s)\n", - i, util_format_name(surf->format), util_format_name(surf->texture->base.format)); - sub_ctx->needs_manual_srgb_encode_bitmask |= 1 << i; - } + /* glTextureView() is not applied to eglimage-backed surfaces, because it + * causes unintended format interpretation errors. But a swizzle may still + * be necessary, e.g. for rgb* views on bgr* resources. Ensure this + * happens by adding a shader swizzle to the final write of such surfaces. + */ + if (!vrend_resource_supports_view(surf->texture, surf->format) && + !vrend_format_is_bgra(surf->format)) { + sub_ctx->swizzle_output_rgb_to_bgr |= 1 << i; + } + + /* glTextureView() on eglimage-backed bgr* textures for is not supported. + * To work around this for colorspace conversion, views are avoided + * manual colorspace conversion is instead injected in the fragment + * shader writing to such surfaces and during glClearColor(). */ + if (util_format_is_srgb(surf->format) && + !vrend_resource_supports_view(surf->texture, surf->format)) { + VREND_DEBUG(dbg_tex, sub_ctx->parent, + "manually converting linear->srgb for EGL-backed framebuffer color attachment 0x%x" + " (surface format is %s; resource format is %s)\n", + i, util_format_name(surf->format), util_format_name(surf->texture->base.format)); + sub_ctx->needs_manual_srgb_encode_bitmask |= 1 << i; } }