mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-26 17:37:03 +00:00
post-processing: rework gamma correction (#1756)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
This commit is contained in:
parent
ab5240d8d2
commit
8a409d86d4
|
@ -12,8 +12,14 @@ layout(push_constant) uniform settings {
|
|||
float gamma;
|
||||
} pp;
|
||||
|
||||
const float cutoff = 0.0031308, a = 1.055, b = 0.055, d = 12.92;
|
||||
vec3 gamma(vec3 rgb)
|
||||
{
|
||||
return mix(a * pow(rgb, vec3(1.0 / (2.4 + 1.0 - pp.gamma))) - b, d * rgb / pp.gamma, lessThan(rgb, vec3(cutoff)));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color_linear = texture(texSampler, uv);
|
||||
color = pow(color_linear, vec4(1.0/(2.2 + 1.0 - pp.gamma)));
|
||||
color = vec4(gamma(color_linear.rgb), color_linear.a);
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ void Presenter::CreatePostProcessPipeline() {
|
|||
const auto& fs_module =
|
||||
Vulkan::Compile(pp_shaders[1], vk::ShaderStageFlagBits::eFragment, instance.GetDevice());
|
||||
ASSERT(fs_module);
|
||||
Vulkan::SetObjectName(instance.GetDevice(), vs_module, "post_process.frag");
|
||||
Vulkan::SetObjectName(instance.GetDevice(), fs_module, "post_process.frag");
|
||||
|
||||
const std::array shaders_ci{
|
||||
vk::PipelineShaderStageCreateInfo{
|
||||
|
|
Loading…
Reference in a new issue