mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-06 17:32:40 +00:00
Merge remote-tracking branch 'refs/remotes/origin/qt-style-test' into qt-style-test
This commit is contained in:
commit
71554606cb
@ -12,8 +12,14 @@ layout(push_constant) uniform settings {
|
|||||||
float gamma;
|
float gamma;
|
||||||
} pp;
|
} 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()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 color_linear = texture(texSampler, uv);
|
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 =
|
const auto& fs_module =
|
||||||
Vulkan::Compile(pp_shaders[1], vk::ShaderStageFlagBits::eFragment, instance.GetDevice());
|
Vulkan::Compile(pp_shaders[1], vk::ShaderStageFlagBits::eFragment, instance.GetDevice());
|
||||||
ASSERT(fs_module);
|
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{
|
const std::array shaders_ci{
|
||||||
vk::PipelineShaderStageCreateInfo{
|
vk::PipelineShaderStageCreateInfo{
|
||||||
|
@ -52,7 +52,8 @@ bool Rasterizer::FilterDraw() {
|
|||||||
// There are several cases (e.g. FCE, FMask/HTile decompression) where we don't need to do an
|
// There are several cases (e.g. FCE, FMask/HTile decompression) where we don't need to do an
|
||||||
// actual draw hence can skip pipeline creation.
|
// actual draw hence can skip pipeline creation.
|
||||||
if (regs.color_control.mode == Liverpool::ColorControl::OperationMode::EliminateFastClear) {
|
if (regs.color_control.mode == Liverpool::ColorControl::OperationMode::EliminateFastClear) {
|
||||||
LOG_TRACE(Render_Vulkan, "FCE pass skipped");
|
// Clears the render target if FCE is launched before any draws
|
||||||
|
EliminateFastClear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (regs.color_control.mode == Liverpool::ColorControl::OperationMode::FmaskDecompress) {
|
if (regs.color_control.mode == Liverpool::ColorControl::OperationMode::FmaskDecompress) {
|
||||||
@ -201,6 +202,34 @@ RenderState Rasterizer::PrepareRenderState(u32 mrt_mask) {
|
|||||||
return {vertex_offset, instance_offset};
|
return {vertex_offset, instance_offset};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Rasterizer::EliminateFastClear() {
|
||||||
|
auto& col_buf = liverpool->regs.color_buffers[0];
|
||||||
|
if (!col_buf || !col_buf.info.fast_clear) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!texture_cache.IsMetaCleared(col_buf.CmaskAddress(), col_buf.view.slice_start)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (u32 slice = col_buf.view.slice_start; slice <= col_buf.view.slice_max; ++slice) {
|
||||||
|
texture_cache.TouchMeta(col_buf.CmaskAddress(), slice, false);
|
||||||
|
}
|
||||||
|
const auto& hint = liverpool->last_cb_extent[0];
|
||||||
|
VideoCore::TextureCache::RenderTargetDesc desc(col_buf, hint);
|
||||||
|
const auto& image_view = texture_cache.FindRenderTarget(desc);
|
||||||
|
const auto& image = texture_cache.GetImage(image_view.image_id);
|
||||||
|
const vk::ImageSubresourceRange range = {
|
||||||
|
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||||
|
.baseMipLevel = 0,
|
||||||
|
.levelCount = 1,
|
||||||
|
.baseArrayLayer = col_buf.view.slice_start,
|
||||||
|
.layerCount = col_buf.view.slice_max - col_buf.view.slice_start + 1,
|
||||||
|
};
|
||||||
|
scheduler.EndRendering();
|
||||||
|
scheduler.CommandBuffer().clearColorImage(image.image, vk::ImageLayout::eColorAttachmentOptimal,
|
||||||
|
LiverpoolToVK::ColorBufferClearValue(col_buf).color,
|
||||||
|
range);
|
||||||
|
}
|
||||||
|
|
||||||
void Rasterizer::Draw(bool is_indexed, u32 index_offset) {
|
void Rasterizer::Draw(bool is_indexed, u32 index_offset) {
|
||||||
RENDERER_TRACE;
|
RENDERER_TRACE;
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ private:
|
|||||||
RenderState PrepareRenderState(u32 mrt_mask);
|
RenderState PrepareRenderState(u32 mrt_mask);
|
||||||
void BeginRendering(const GraphicsPipeline& pipeline, RenderState& state);
|
void BeginRendering(const GraphicsPipeline& pipeline, RenderState& state);
|
||||||
void Resolve();
|
void Resolve();
|
||||||
|
void EliminateFastClear();
|
||||||
|
|
||||||
void UpdateDynamicState(const GraphicsPipeline& pipeline);
|
void UpdateDynamicState(const GraphicsPipeline& pipeline);
|
||||||
void UpdateViewportScissorState();
|
void UpdateViewportScissorState();
|
||||||
|
Loading…
Reference in New Issue
Block a user