Merge remote-tracking branch 'refs/remotes/origin/qt-style-test' into qt-style-test

This commit is contained in:
tomboylover93 2024-12-22 14:27:58 -03:00
commit 71554606cb
4 changed files with 39 additions and 3 deletions

View File

@ -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);
}

View File

@ -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{

View File

@ -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
// actual draw hence can skip pipeline creation.
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;
}
if (regs.color_control.mode == Liverpool::ColorControl::OperationMode::FmaskDecompress) {
@ -201,6 +202,34 @@ RenderState Rasterizer::PrepareRenderState(u32 mrt_mask) {
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) {
RENDERER_TRACE;

View File

@ -71,6 +71,7 @@ private:
RenderState PrepareRenderState(u32 mrt_mask);
void BeginRendering(const GraphicsPipeline& pipeline, RenderState& state);
void Resolve();
void EliminateFastClear();
void UpdateDynamicState(const GraphicsPipeline& pipeline);
void UpdateViewportScissorState();