mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-11-23 11:20:07 +00:00
Misc fixes (#517)
* Misc fixes * Removed the skip for draw calls without RTs * Remove Srgb image stores to rework later
This commit is contained in:
parent
dfd305ff77
commit
79680c50c0
@ -366,6 +366,9 @@ bool AvPlayerSource::GetAudioData(SceAvPlayerFrameInfo& audio_info) {
|
||||
}
|
||||
|
||||
u64 AvPlayerSource::CurrentTime() {
|
||||
if (!IsActive()) {
|
||||
return 0;
|
||||
}
|
||||
using namespace std::chrono;
|
||||
return duration_cast<milliseconds>(high_resolution_clock::now() - m_start_time).count();
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/libraries/system/msgdialog.h"
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
namespace Libraries::MsgDialog {
|
||||
|
||||
int PS4_SYSV_ABI sceMsgDialogClose() {
|
||||
@ -30,9 +32,22 @@ int PS4_SYSV_ABI sceMsgDialogInitialize() {
|
||||
|
||||
s32 PS4_SYSV_ABI sceMsgDialogOpen(const OrbisMsgDialogParam* param) {
|
||||
LOG_ERROR(Lib_MsgDlg, "(STUBBED) called");
|
||||
OrbisMsgDialogUserMessageParam* userMsgParam = param->userMsgParam;
|
||||
const char* msg = userMsgParam->msg;
|
||||
printf("sceMsgDialogOpen msg : %s", msg);
|
||||
switch (param->mode) {
|
||||
case ORBIS_MSG_DIALOG_MODE_USER_MSG:
|
||||
LOG_INFO(Lib_MsgDlg, "sceMsgDialogOpen userMsg type = %s msg = %s",
|
||||
magic_enum::enum_name(param->userMsgParam->buttonType), param->userMsgParam->msg);
|
||||
break;
|
||||
case ORBIS_MSG_DIALOG_MODE_PROGRESS_BAR:
|
||||
LOG_INFO(Lib_MsgDlg, "sceMsgDialogOpen progressBar type = %s msg = %s",
|
||||
magic_enum::enum_name(param->progBarParam->barType), param->progBarParam->msg);
|
||||
break;
|
||||
case ORBIS_MSG_DIALOG_MODE_SYSTEM_MSG:
|
||||
LOG_INFO(Lib_MsgDlg, "sceMsgDialogOpen systemMsg type: %s",
|
||||
magic_enum::enum_name(param->sysMsgParam->sysMsgType));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
@ -848,6 +848,7 @@ struct Liverpool {
|
||||
u32 raw;
|
||||
BitField<0, 1, u32> depth_clear_enable;
|
||||
BitField<1, 1, u32> stencil_clear_enable;
|
||||
BitField<5, 1, u32> stencil_compress_disable;
|
||||
BitField<6, 1, u32> depth_compress_disable;
|
||||
};
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include "video_core/amdgpu/pixel_format.h"
|
||||
#include "video_core/renderer_vulkan/liverpool_to_vk.h"
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
namespace Vulkan::LiverpoolToVK {
|
||||
|
||||
using DepthBuffer = Liverpool::DepthBuffer;
|
||||
@ -588,6 +590,8 @@ vk::Format AdjustColorBufferFormat(vk::Format base_format,
|
||||
return is_vo_surface ? vk::Format::eB8G8R8A8Unorm : vk::Format::eB8G8R8A8Srgb;
|
||||
case vk::Format::eB8G8R8A8Srgb:
|
||||
return is_vo_surface ? vk::Format::eR8G8B8A8Unorm : vk::Format::eR8G8B8A8Srgb;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (is_vo_surface && base_format == vk::Format::eR8G8B8A8Srgb) {
|
||||
@ -601,27 +605,29 @@ vk::Format AdjustColorBufferFormat(vk::Format base_format,
|
||||
}
|
||||
|
||||
vk::Format DepthFormat(DepthBuffer::ZFormat z_format, DepthBuffer::StencilFormat stencil_format) {
|
||||
if (z_format == DepthBuffer::ZFormat::Z32Float &&
|
||||
stencil_format == DepthBuffer::StencilFormat::Stencil8) {
|
||||
using ZFormat = DepthBuffer::ZFormat;
|
||||
using StencilFormat = DepthBuffer::StencilFormat;
|
||||
|
||||
if (z_format == ZFormat::Z32Float && stencil_format == StencilFormat::Stencil8) {
|
||||
return vk::Format::eD32SfloatS8Uint;
|
||||
}
|
||||
if (z_format == DepthBuffer::ZFormat::Z32Float &&
|
||||
stencil_format == DepthBuffer::StencilFormat::Invalid) {
|
||||
if (z_format == ZFormat::Z32Float && stencil_format == StencilFormat::Invalid) {
|
||||
return vk::Format::eD32Sfloat;
|
||||
}
|
||||
if (z_format == DepthBuffer::ZFormat::Z16 &&
|
||||
stencil_format == DepthBuffer::StencilFormat::Invalid) {
|
||||
if (z_format == ZFormat::Z16 && stencil_format == StencilFormat::Invalid) {
|
||||
return vk::Format::eD16Unorm;
|
||||
}
|
||||
if (z_format == DepthBuffer::ZFormat::Z16 &&
|
||||
stencil_format == DepthBuffer::StencilFormat::Stencil8) {
|
||||
if (z_format == ZFormat::Z16 && stencil_format == StencilFormat::Stencil8) {
|
||||
return vk::Format::eD16UnormS8Uint;
|
||||
}
|
||||
if (z_format == DepthBuffer::ZFormat::Invalid &&
|
||||
stencil_format == DepthBuffer::StencilFormat::Invalid) {
|
||||
if (z_format == ZFormat::Invalid && stencil_format == StencilFormat::Stencil8) {
|
||||
return vk::Format::eD32SfloatS8Uint;
|
||||
}
|
||||
if (z_format == ZFormat::Invalid && stencil_format == StencilFormat::Invalid) {
|
||||
return vk::Format::eUndefined;
|
||||
}
|
||||
UNREACHABLE();
|
||||
UNREACHABLE_MSG("Unsupported depth/stencil format. depth = {} stencil = {}",
|
||||
magic_enum::enum_name(z_format), magic_enum::enum_name(stencil_format));
|
||||
}
|
||||
|
||||
void EmitQuadToTriangleListIndices(u8* out_ptr, u32 num_vertices) {
|
||||
|
@ -214,8 +214,7 @@ GraphicsPipeline::GraphicsPipeline(const Instance& instance_, Scheduler& schedul
|
||||
.colorAttachmentCount = num_color_formats,
|
||||
.pColorAttachmentFormats = key.color_formats.data(),
|
||||
.depthAttachmentFormat = key.depth_format,
|
||||
.stencilAttachmentFormat =
|
||||
key.depth.stencil_enable ? key.depth_format : vk::Format::eUndefined,
|
||||
.stencilAttachmentFormat = key.stencil_format,
|
||||
};
|
||||
|
||||
std::array<vk::PipelineColorBlendAttachmentState, Liverpool::NumColorBuffers> attachments;
|
||||
|
@ -26,6 +26,7 @@ struct GraphicsPipelineKey {
|
||||
std::array<size_t, MaxShaderStages> stage_hashes;
|
||||
std::array<vk::Format, Liverpool::NumColorBuffers> color_formats;
|
||||
vk::Format depth_format;
|
||||
vk::Format stencil_format;
|
||||
|
||||
Liverpool::DepthControl depth;
|
||||
float depth_bounds_min;
|
||||
|
@ -180,11 +180,26 @@ void PipelineCache::RefreshGraphicsKey() {
|
||||
key.num_samples = regs.aa_config.NumSamples();
|
||||
|
||||
const auto& db = regs.depth_buffer;
|
||||
key.depth_format = LiverpoolToVK::DepthFormat(db.z_info.format, db.stencil_info.format);
|
||||
const auto ds_format = LiverpoolToVK::DepthFormat(db.z_info.format, db.stencil_info.format);
|
||||
|
||||
if (db.z_info.format != AmdGpu::Liverpool::DepthBuffer::ZFormat::Invalid) {
|
||||
key.depth_format = ds_format;
|
||||
} else {
|
||||
key.depth_format = vk::Format::eUndefined;
|
||||
}
|
||||
if (key.depth.depth_enable) {
|
||||
key.depth.depth_enable.Assign(key.depth_format != vk::Format::eUndefined);
|
||||
}
|
||||
|
||||
if (db.stencil_info.format != AmdGpu::Liverpool::DepthBuffer::StencilFormat::Invalid) {
|
||||
key.stencil_format = key.depth_format;
|
||||
} else {
|
||||
key.stencil_format = vk::Format::eUndefined;
|
||||
}
|
||||
if (key.depth.stencil_enable) {
|
||||
key.depth.stencil_enable.Assign(key.stencil_format != vk::Format::eUndefined);
|
||||
}
|
||||
|
||||
const auto skip_cb_binding =
|
||||
regs.color_control.mode == AmdGpu::Liverpool::ColorControl::OperationMode::Disable;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "video_core/renderer_vulkan/vk_scheduler.h"
|
||||
#include "video_core/texture_cache/image_view.h"
|
||||
#include "video_core/texture_cache/texture_cache.h"
|
||||
#include "vk_rasterizer.h"
|
||||
|
||||
namespace Vulkan {
|
||||
|
||||
@ -129,8 +130,12 @@ void Rasterizer::BeginRendering() {
|
||||
texture_cache.TouchMeta(col_buf.CmaskAddress(), false);
|
||||
}
|
||||
|
||||
if (regs.depth_buffer.z_info.format != Liverpool::DepthBuffer::ZFormat::Invalid &&
|
||||
regs.depth_buffer.Address() != 0) {
|
||||
using ZFormat = AmdGpu::Liverpool::DepthBuffer::ZFormat;
|
||||
using StencilFormat = AmdGpu::Liverpool::DepthBuffer::StencilFormat;
|
||||
if (regs.depth_buffer.Address() != 0 &&
|
||||
((regs.depth_control.depth_enable && regs.depth_buffer.z_info.format != ZFormat::Invalid) ||
|
||||
regs.depth_control.stencil_enable &&
|
||||
regs.depth_buffer.stencil_info.format != StencilFormat::Invalid)) {
|
||||
const auto htile_address = regs.depth_htile_data_base.GetAddress();
|
||||
const bool is_clear = regs.depth_render_control.depth_clear_enable ||
|
||||
texture_cache.IsMetaCleared(htile_address);
|
||||
@ -152,8 +157,10 @@ void Rasterizer::BeginRendering() {
|
||||
.stencil = regs.stencil_clear}},
|
||||
};
|
||||
texture_cache.TouchMeta(htile_address, false);
|
||||
state.has_depth = true;
|
||||
state.has_stencil = regs.depth_control.stencil_enable;
|
||||
state.has_depth =
|
||||
regs.depth_buffer.z_info.format != AmdGpu::Liverpool::DepthBuffer::ZFormat::Invalid;
|
||||
state.has_stencil = regs.depth_buffer.stencil_info.format !=
|
||||
AmdGpu::Liverpool::DepthBuffer::StencilFormat::Invalid;
|
||||
}
|
||||
scheduler.BeginRendering(state);
|
||||
}
|
||||
|
@ -29,15 +29,22 @@ void Scheduler::BeginRendering(const RenderState& new_state) {
|
||||
is_rendering = true;
|
||||
render_state = new_state;
|
||||
|
||||
const auto witdh =
|
||||
render_state.width != std::numeric_limits<u32>::max() ? render_state.width : 1;
|
||||
const auto height =
|
||||
render_state.height != std::numeric_limits<u32>::max() ? render_state.height : 1;
|
||||
|
||||
const vk::RenderingInfo rendering_info = {
|
||||
.renderArea =
|
||||
{
|
||||
.offset = {0, 0},
|
||||
.extent = {render_state.width, render_state.height},
|
||||
.extent = {witdh, height},
|
||||
},
|
||||
.layerCount = 1,
|
||||
.colorAttachmentCount = render_state.num_color_attachments,
|
||||
.pColorAttachments = render_state.color_attachments.data(),
|
||||
.pColorAttachments = render_state.num_color_attachments > 0
|
||||
? render_state.color_attachments.data()
|
||||
: nullptr,
|
||||
.pDepthAttachment = render_state.has_depth ? &render_state.depth_attachment : nullptr,
|
||||
.pStencilAttachment = render_state.has_stencil ? &render_state.depth_attachment : nullptr,
|
||||
};
|
||||
@ -72,7 +79,7 @@ void Scheduler::EndRendering() {
|
||||
},
|
||||
});
|
||||
}
|
||||
if (render_state.has_depth) {
|
||||
if (render_state.has_depth || render_state.has_stencil) {
|
||||
barriers.push_back(vk::ImageMemoryBarrier{
|
||||
.srcAccessMask = vk::AccessFlagBits::eDepthStencilAttachmentWrite,
|
||||
.dstAccessMask = vk::AccessFlagBits::eShaderRead | vk::AccessFlagBits::eShaderWrite,
|
||||
|
@ -131,11 +131,19 @@ Image::Image(const Vulkan::Instance& instance_, Vulkan::Scheduler& scheduler_,
|
||||
|
||||
usage = ImageUsageFlags(info);
|
||||
|
||||
if (info.pixel_format == vk::Format::eD32Sfloat) {
|
||||
switch (info.pixel_format) {
|
||||
case vk::Format::eD16Unorm:
|
||||
case vk::Format::eD32Sfloat:
|
||||
case vk::Format::eX8D24UnormPack32:
|
||||
aspect_mask = vk::ImageAspectFlagBits::eDepth;
|
||||
}
|
||||
if (info.pixel_format == vk::Format::eD32SfloatS8Uint) {
|
||||
break;
|
||||
case vk::Format::eD16UnormS8Uint:
|
||||
case vk::Format::eD24UnormS8Uint:
|
||||
case vk::Format::eD32SfloatS8Uint:
|
||||
aspect_mask = vk::ImageAspectFlagBits::eDepth | vk::ImageAspectFlagBits::eStencil;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const vk::ImageCreateInfo image_ci = {
|
||||
|
Loading…
Reference in New Issue
Block a user