Add Chromium-only Blender WebEngine parity work
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/* SPDX-FileCopyrightText: 2025 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "vk_backbuffer_blit_infos.hh"
|
||||
|
||||
COMPUTE_SHADER_CREATE_INFO(vk_backbuffer_blit)
|
||||
|
||||
float srgb_to_linearrgb(float c)
|
||||
{
|
||||
if (c < 0.04045f) {
|
||||
return (c < 0.0f) ? 0.0f : c * (1.0f / 12.92f);
|
||||
}
|
||||
|
||||
return pow((c + 0.055f) * (1.0f / 1.055f), 2.4f);
|
||||
}
|
||||
|
||||
float3 nonlinear_to_linear_scrgb(float3 c)
|
||||
{
|
||||
#ifdef USE_GAMMA22
|
||||
return pow(c, float3(2.2f));
|
||||
#else
|
||||
return float3(srgb_to_linearrgb(c.r), srgb_to_linearrgb(c.g), srgb_to_linearrgb(c.b));
|
||||
#endif
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
int2 dst_texel = int2(gl_GlobalInvocationID.xy);
|
||||
int2 src_size = int2(imageSize(src_img));
|
||||
int2 src_texel = int2(dst_texel.x, src_size.y - dst_texel.y - 1);
|
||||
float4 color = imageLoad(src_img, int2(src_texel));
|
||||
/*
|
||||
* Convert from extended sRGB non-linear to linear.
|
||||
*
|
||||
* Preserves negative wide gamut values with sign/abs. May use either gamma 2.2
|
||||
* decode to match most SDR sRGB displays, or the piecewise sRGB function to
|
||||
* match Windows SDR applications in HDR node.
|
||||
*/
|
||||
color.rgb = sign(color.rgb) * nonlinear_to_linear_scrgb(abs(color.rgb)) * sdr_scale;
|
||||
imageStore(dst_img, int2(dst_texel), color);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/* SPDX-FileCopyrightText: 2025 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#ifdef GPU_SHADER
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
GPU_SHADER_CREATE_INFO(vk_backbuffer_blit)
|
||||
LOCAL_GROUP_SIZE(16, 16)
|
||||
IMAGE(0, SFLOAT_16_16_16_16, read, Float2D, src_img)
|
||||
IMAGE(1, SFLOAT_16_16_16_16, write, Float2D, dst_img)
|
||||
PUSH_CONSTANT(float, sdr_scale)
|
||||
PUSH_CONSTANT(bool, use_gamma22)
|
||||
COMPUTE_SOURCE("vk_backbuffer_blit_comp.glsl")
|
||||
ADDITIONAL_INFO(gpu_srgb_to_framebuffer_space)
|
||||
DO_STATIC_COMPILATION()
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(vk_backbuffer_blit_gamma22)
|
||||
ADDITIONAL_INFO(vk_backbuffer_blit)
|
||||
DEFINE("USE_GAMMA22")
|
||||
DO_STATIC_COMPILATION()
|
||||
GPU_SHADER_CREATE_END()
|
||||
Reference in New Issue
Block a user