mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-21 12:04:45 +00:00
Misc fixes
This commit is contained in:
parent
132ca9c5a8
commit
cd75c4f1a2
12 changed files with 112 additions and 29 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -406,7 +406,8 @@ spv::ImageFormat GetFormat(const AmdGpu::Image& image) {
|
|||
return spv::ImageFormat::Rg16f;
|
||||
}
|
||||
if (image.GetDataFmt() == AmdGpu::DataFormat::Format8_8 &&
|
||||
image.GetNumberFmt() == AmdGpu::NumberFormat::Unorm) {
|
||||
(image.GetNumberFmt() == AmdGpu::NumberFormat::Unorm ||
|
||||
image.GetNumberFmt() == AmdGpu::NumberFormat::Srgb)) {
|
||||
return spv::ImageFormat::Rg8;
|
||||
}
|
||||
if (image.GetDataFmt() == AmdGpu::DataFormat::Format16_16_16_16 &&
|
||||
|
@ -414,15 +415,18 @@ spv::ImageFormat GetFormat(const AmdGpu::Image& image) {
|
|||
return spv::ImageFormat::Rgba16f;
|
||||
}
|
||||
if (image.GetDataFmt() == AmdGpu::DataFormat::Format16_16_16_16 &&
|
||||
image.GetNumberFmt() == AmdGpu::NumberFormat::Unorm) {
|
||||
(image.GetNumberFmt() == AmdGpu::NumberFormat::Unorm ||
|
||||
image.GetNumberFmt() == AmdGpu::NumberFormat::Srgb)) {
|
||||
return spv::ImageFormat::Rgba16;
|
||||
}
|
||||
if (image.GetDataFmt() == AmdGpu::DataFormat::Format8 &&
|
||||
image.GetNumberFmt() == AmdGpu::NumberFormat::Unorm) {
|
||||
(image.GetNumberFmt() == AmdGpu::NumberFormat::Unorm ||
|
||||
image.GetNumberFmt() == AmdGpu::NumberFormat::Srgb)) {
|
||||
return spv::ImageFormat::R8;
|
||||
}
|
||||
if (image.GetDataFmt() == AmdGpu::DataFormat::Format8_8_8_8 &&
|
||||
image.GetNumberFmt() == AmdGpu::NumberFormat::Unorm) {
|
||||
(image.GetNumberFmt() == AmdGpu::NumberFormat::Unorm ||
|
||||
image.GetNumberFmt() == AmdGpu::NumberFormat::Srgb)) {
|
||||
return spv::ImageFormat::Rgba8;
|
||||
}
|
||||
if (image.GetDataFmt() == AmdGpu::DataFormat::Format8_8_8_8 &&
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
@ -31,6 +32,10 @@ Rasterizer::~Rasterizer() = default;
|
|||
void Rasterizer::Draw(bool is_indexed, u32 index_offset) {
|
||||
RENDERER_TRACE;
|
||||
|
||||
if (!HasRenderTargets()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto cmdbuf = scheduler.CommandBuffer();
|
||||
const auto& regs = liverpool->regs;
|
||||
const GraphicsPipeline* pipeline = pipeline_cache.GetGraphicsPipeline();
|
||||
|
@ -129,8 +134,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 +161,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);
|
||||
}
|
||||
|
@ -231,6 +242,25 @@ void Rasterizer::UpdateDepthStencilState() {
|
|||
cmdbuf.setDepthBoundsTestEnable(depth.depth_bounds_enable);
|
||||
}
|
||||
|
||||
bool Rasterizer::HasRenderTargets() {
|
||||
const auto& regs = liverpool->regs;
|
||||
using ZFormat = AmdGpu::Liverpool::DepthBuffer::ZFormat;
|
||||
using StencilFormat = AmdGpu::Liverpool::DepthBuffer::StencilFormat;
|
||||
for (auto col_buf_id = 0u; col_buf_id < Liverpool::NumColorBuffers; ++col_buf_id) {
|
||||
const auto& col_buf = regs.color_buffers[col_buf_id];
|
||||
if (col_buf && regs.color_target_mask.GetMask(col_buf_id)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
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)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Rasterizer::ScopeMarkerBegin(const std::string_view& str) {
|
||||
if (!Config::isMarkersEnabled()) {
|
||||
return;
|
||||
|
|
|
@ -52,6 +52,7 @@ private:
|
|||
void UpdateDynamicState(const GraphicsPipeline& pipeline);
|
||||
void UpdateViewportScissorState();
|
||||
void UpdateDepthStencilState();
|
||||
bool HasRenderTargets();
|
||||
|
||||
private:
|
||||
const Instance& instance;
|
||||
|
|
|
@ -72,7 +72,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…
Add table
Reference in a new issue