some minor improvements

This commit is contained in:
InoriRus
2022-01-31 17:25:13 +10:00
parent 8651c18423
commit 9a912716f8
27 changed files with 1792 additions and 199 deletions
+156 -2
View File
@@ -69,6 +69,31 @@ int KYTY_SYSV_ABI GraphicsSetVsShader(uint32_t* cmd, uint64_t size, const VsStag
return OK;
}
int KYTY_SYSV_ABI GraphicsUpdateVsShader(uint32_t* cmd, uint64_t size, const VsStageRegisters* vs_regs, uint32_t shader_modifier)
{
PRINT_NAME();
EXIT_NOT_IMPLEMENTED(size < sizeof(VsStageRegisters) / 4 + 2);
printf("\t cmd_buffer = %016" PRIx64 "\n", reinterpret_cast<uint64_t>(cmd));
printf("\t size = %" PRIu64 "\n", size);
printf("\t shader_modifier = %" PRIu32 "\n", shader_modifier);
printf("\t vs_regs.m_spiShaderPgmLoVs = %08" PRIx32 "\n", vs_regs->m_spiShaderPgmLoVs);
printf("\t vs_regs.m_spiShaderPgmHiVs = %08" PRIx32 "\n", vs_regs->m_spiShaderPgmHiVs);
printf("\t vs_regs.m_spiShaderPgmRsrc1Vs = %08" PRIx32 "\n", vs_regs->m_spiShaderPgmRsrc1Vs);
printf("\t vs_regs.m_spiShaderPgmRsrc2Vs = %08" PRIx32 "\n", vs_regs->m_spiShaderPgmRsrc2Vs);
printf("\t vs_regs.m_spiVsOutConfig = %08" PRIx32 "\n", vs_regs->m_spiVsOutConfig);
printf("\t vs_regs.m_spiShaderPosFormat = %08" PRIx32 "\n", vs_regs->m_spiShaderPosFormat);
printf("\t vs_regs.m_paClVsOutCntl = %08" PRIx32 "\n", vs_regs->m_paClVsOutCntl);
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_VS_UPDATE);
cmd[1] = shader_modifier;
memcpy(&cmd[2], vs_regs, sizeof(VsStageRegisters));
return OK;
}
int KYTY_SYSV_ABI GraphicsSetEmbeddedVsShader(uint32_t* cmd, uint64_t size, uint32_t id, uint32_t shader_modifier)
{
PRINT_NAME();
@@ -87,12 +112,94 @@ int KYTY_SYSV_ABI GraphicsSetEmbeddedVsShader(uint32_t* cmd, uint64_t size, uint
return OK;
}
int KYTY_SYSV_ABI GraphicsSetPsShader(uint32_t* cmd, uint64_t size, const uint32_t* ps_regs)
{
PRINT_NAME();
if (ps_regs == nullptr)
{
EXIT_NOT_IMPLEMENTED(size < 1 + 1);
printf("\t cmd_buffer = %016" PRIx64 "\n", reinterpret_cast<uint64_t>(cmd));
printf("\t size = %" PRIu64 "\n", size);
printf("\t embedded_id = %d\n", 0);
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_PS_EMBEDDED);
cmd[1] = 0;
} else
{
EXIT_NOT_IMPLEMENTED(size < 12 + 1);
printf("\t cmd_buffer = %016" PRIx64 "\n", reinterpret_cast<uint64_t>(cmd));
printf("\t size = %" PRIu64 "\n", size);
printf("\t ps_regs.m_spiShaderPgmLoPs = %08" PRIx32 "\n", ps_regs[0]);
printf("\t ps_regs.m_spiShaderPgmHiPs = %08" PRIx32 "\n", ps_regs[1]);
printf("\t ps_regs.m_spiShaderPgmRsrc1Ps = %08" PRIx32 "\n", ps_regs[2]);
printf("\t ps_regs.m_spiShaderPgmRsrc2Ps = %08" PRIx32 "\n", ps_regs[3]);
printf("\t ps_regs.m_spiShaderZFormat = %08" PRIx32 "\n", ps_regs[4]);
printf("\t ps_regs.m_spiShaderColFormat = %08" PRIx32 "\n", ps_regs[5]);
printf("\t ps_regs.m_spiPsInputEna = %08" PRIx32 "\n", ps_regs[6]);
printf("\t ps_regs.m_spiPsInputAddr = %08" PRIx32 "\n", ps_regs[7]);
printf("\t ps_regs.m_spiPsInControl = %08" PRIx32 "\n", ps_regs[8]);
printf("\t ps_regs.m_spiBarycCntl = %08" PRIx32 "\n", ps_regs[9]);
printf("\t ps_regs.m_dbShaderControl = %08" PRIx32 "\n", ps_regs[10]);
printf("\t ps_regs.m_cbShaderMask = %08" PRIx32 "\n", ps_regs[11]);
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_PS);
memcpy(&cmd[1], ps_regs, 12 * 4);
}
return OK;
}
int KYTY_SYSV_ABI GraphicsSetPsShader350(uint32_t* cmd, uint64_t size, const uint32_t* ps_regs)
{
PRINT_NAME();
if (ps_regs == nullptr)
{
EXIT_NOT_IMPLEMENTED(size < 1 + 1);
printf("\t cmd_buffer = %016" PRIx64 "\n", reinterpret_cast<uint64_t>(cmd));
printf("\t size = %" PRIu64 "\n", size);
printf("\t embedded_id = %d\n", 0);
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_PS_EMBEDDED);
cmd[1] = 0;
} else
{
EXIT_NOT_IMPLEMENTED(size < 12 + 1);
printf("\t cmd_buffer = %016" PRIx64 "\n", reinterpret_cast<uint64_t>(cmd));
printf("\t size = %" PRIu64 "\n", size);
printf("\t ps_regs.m_spiShaderPgmLoPs = %08" PRIx32 "\n", ps_regs[0]);
printf("\t ps_regs.m_spiShaderPgmHiPs = %08" PRIx32 "\n", ps_regs[1]);
printf("\t ps_regs.m_spiShaderPgmRsrc1Ps = %08" PRIx32 "\n", ps_regs[2]);
printf("\t ps_regs.m_spiShaderPgmRsrc2Ps = %08" PRIx32 "\n", ps_regs[3]);
printf("\t ps_regs.m_spiShaderZFormat = %08" PRIx32 "\n", ps_regs[4]);
printf("\t ps_regs.m_spiShaderColFormat = %08" PRIx32 "\n", ps_regs[5]);
printf("\t ps_regs.m_spiPsInputEna = %08" PRIx32 "\n", ps_regs[6]);
printf("\t ps_regs.m_spiPsInputAddr = %08" PRIx32 "\n", ps_regs[7]);
printf("\t ps_regs.m_spiPsInControl = %08" PRIx32 "\n", ps_regs[8]);
printf("\t ps_regs.m_spiBarycCntl = %08" PRIx32 "\n", ps_regs[9]);
printf("\t ps_regs.m_dbShaderControl = %08" PRIx32 "\n", ps_regs[10]);
printf("\t ps_regs.m_cbShaderMask = %08" PRIx32 "\n", ps_regs[11]);
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_PS);
memcpy(&cmd[1], ps_regs, 12 * 4);
}
return OK;
}
int KYTY_SYSV_ABI GraphicsUpdatePsShader(uint32_t* cmd, uint64_t size, const uint32_t* ps_regs)
{
PRINT_NAME();
EXIT_NOT_IMPLEMENTED(ps_regs == nullptr);
EXIT_NOT_IMPLEMENTED(size < sizeof(PsStageRegisters) / 12 + 1);
EXIT_NOT_IMPLEMENTED(size < 12 + 1);
printf("\t cmd_buffer = %016" PRIx64 "\n", reinterpret_cast<uint64_t>(cmd));
printf("\t size = %" PRIu64 "\n", size);
@@ -110,7 +217,7 @@ int KYTY_SYSV_ABI GraphicsSetPsShader350(uint32_t* cmd, uint64_t size, const uin
printf("\t ps_regs.m_dbShaderControl = %08" PRIx32 "\n", ps_regs[10]);
printf("\t ps_regs.m_cbShaderMask = %08" PRIx32 "\n", ps_regs[11]);
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_PS);
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_PS_UPDATE);
memcpy(&cmd[1], ps_regs, 12 * 4);
return OK;
@@ -224,6 +331,48 @@ int KYTY_SYSV_ABI GraphicsDispatchDirect(uint32_t* cmd, uint64_t size, uint32_t
return OK;
}
uint32_t KYTY_SYSV_ABI GraphicsDrawInitDefaultHardwareState(uint32_t* cmd, uint64_t size)
{
PRINT_NAME();
EXIT_NOT_IMPLEMENTED(size < 2);
printf("\t cmd_buffer = %016" PRIx64 "\n", reinterpret_cast<uint64_t>(cmd));
printf("\t size = %" PRIu64 "\n", size);
cmd[0] = KYTY_PM4(2, Pm4::IT_NOP, Pm4::R_DRAW_RESET);
return 2;
}
uint32_t KYTY_SYSV_ABI GraphicsDrawInitDefaultHardwareState175(uint32_t* cmd, uint64_t size)
{
PRINT_NAME();
EXIT_NOT_IMPLEMENTED(size < 2);
printf("\t cmd_buffer = %016" PRIx64 "\n", reinterpret_cast<uint64_t>(cmd));
printf("\t size = %" PRIu64 "\n", size);
cmd[0] = KYTY_PM4(2, Pm4::IT_NOP, Pm4::R_DRAW_RESET);
return 2;
}
uint32_t KYTY_SYSV_ABI GraphicsDrawInitDefaultHardwareState200(uint32_t* cmd, uint64_t size)
{
PRINT_NAME();
EXIT_NOT_IMPLEMENTED(size < 2);
printf("\t cmd_buffer = %016" PRIx64 "\n", reinterpret_cast<uint64_t>(cmd));
printf("\t size = %" PRIu64 "\n", size);
cmd[0] = KYTY_PM4(2, Pm4::IT_NOP, Pm4::R_DRAW_RESET);
return 2;
}
uint32_t KYTY_SYSV_ABI GraphicsDrawInitDefaultHardwareState350(uint32_t* cmd, uint64_t size)
{
PRINT_NAME();
@@ -464,6 +613,11 @@ uint64_t KYTY_SYSV_ABI GraphicsGetGpuCoreClockFrequency()
return LibKernel::KernelGetTscFrequency();
}
int KYTY_SYSV_ABI GraphicsIsUserPaEnabled()
{
return 0;
}
int KYTY_SYSV_ABI GraphicsRegisterOwner(uint32_t* owner_handle, const char* name)
{
PRINT_NAME();
+122 -60
View File
@@ -70,6 +70,10 @@ struct PipelineParameters
uint8_t alpha_destblend = 0;
bool separate_alpha_blend = false;
bool blend_enable = false;
float blend_color_red = 0.0f;
float blend_color_green = 0.0f;
float blend_color_blue = 0.0f;
float blend_color_alpha = 0.0f;
bool operator==(const PipelineParameters& other) const;
};
@@ -99,7 +103,8 @@ public:
VulkanPipeline* CreatePipeline(VulkanFramebuffer* framebuffer, RenderColorInfo* color, RenderDepthInfo* depth,
const ShaderVertexInputInfo* vs_input_info, const VertexShaderInfo* vs_regs,
const ShaderPixelInputInfo* ps_input_info, const PixelShaderInfo* ps_regs, VkPrimitiveTopology topology,
uint32_t color_mask, const ModeControl& mc, const BlendControl& bc, const ScreenViewport& vp);
uint32_t color_mask, const ModeControl& mc, const BlendControl& bc, const BlendColor& bclr,
const ScreenViewport& vp);
VulkanPipeline* CreatePipeline(const ShaderComputeInputInfo* input_info, const ComputeShaderInfo* cs_regs);
void DeletePipeline(VulkanPipeline* pipeline);
void DeletePipelines(VulkanFramebuffer* framebuffer);
@@ -446,6 +451,7 @@ static void rt_check(const RenderTarget& rt)
{
if (rt.base_addr != 0)
{
bool render_to_texture = (rt.tile_mode == 0x0d);
// EXIT_NOT_IMPLEMENTED(rt.base_addr == 0);
// EXIT_NOT_IMPLEMENTED(rt.pitch_div8_minus1 != 0x000000ef);
// EXIT_NOT_IMPLEMENTED(rt.fmask_pitch_div8_minus1 != 0x000000ef);
@@ -456,7 +462,7 @@ static void rt_check(const RenderTarget& rt)
EXIT_NOT_IMPLEMENTED(rt.fmask_compression_mode != 0x00000000);
EXIT_NOT_IMPLEMENTED(rt.cmask_fast_clear_enable != false);
EXIT_NOT_IMPLEMENTED(rt.dcc_compression_enable != false);
EXIT_NOT_IMPLEMENTED(rt.neo_mode != Config::IsNeo());
EXIT_NOT_IMPLEMENTED(!render_to_texture && rt.neo_mode != Config::IsNeo());
EXIT_NOT_IMPLEMENTED(rt.cmask_tile_mode != 0x00000000);
EXIT_NOT_IMPLEMENTED(rt.cmask_tile_mode_neo != 0x00000000);
// EXIT_NOT_IMPLEMENTED(rt.format != 0x0000000a);
@@ -686,7 +692,7 @@ static void mc_check(const ModeControl& c)
EXIT_NOT_IMPLEMENTED(c.persp_corr_dis != false);
}
static void bc_print(const char* func, const BlendControl& c)
static void bc_print(const char* func, const BlendControl& c, const BlendColor& color)
{
printf("%s\n", func);
@@ -698,9 +704,13 @@ static void bc_print(const char* func, const BlendControl& c)
printf("\t alpha_destblend = %" PRIu8 "\n", c.alpha_destblend);
printf("\t separate_alpha_blend = %s\n", c.separate_alpha_blend ? "true" : "false");
printf("\t enable = %s\n", c.enable ? "true" : "false");
printf("\t red = %f\n", color.red);
printf("\t green = %f\n", color.green);
printf("\t blue = %f\n", color.blue);
printf("\t alpha = %f\n", color.alpha);
}
static void bc_check(const BlendControl& c)
static void bc_check(const BlendControl& c, const BlendColor& color)
{
// EXIT_NOT_IMPLEMENTED(c.color_srcblend != 0);
EXIT_NOT_IMPLEMENTED(c.color_comb_fcn != 0);
@@ -710,6 +720,10 @@ static void bc_check(const BlendControl& c)
EXIT_NOT_IMPLEMENTED(c.alpha_destblend != 0);
EXIT_NOT_IMPLEMENTED(c.separate_alpha_blend != false);
// EXIT_NOT_IMPLEMENTED(c.enable != false);
EXIT_NOT_IMPLEMENTED(color.red != 0.0f);
EXIT_NOT_IMPLEMENTED(color.green != 0.0f);
EXIT_NOT_IMPLEMENTED(color.blue != 0.0f);
EXIT_NOT_IMPLEMENTED(color.alpha != 0.0f);
}
static void d_print(const char* func, const DepthControl& c)
@@ -738,6 +752,32 @@ static void d_check(const DepthControl& c)
EXIT_NOT_IMPLEMENTED(c.stencilfunc_bf != 0);
}
static void eqaa_print(const char* func, const EqaaControl& c)
{
printf("%s\n", func);
printf("\t max_anchor_samples = %" PRIu8 "\n", c.max_anchor_samples);
printf("\t ps_iter_samples = %" PRIu8 "\n", c.ps_iter_samples);
printf("\t mask_export_num_samples = %" PRIu8 "\n", c.mask_export_num_samples);
printf("\t alpha_to_mask_num_samples = %" PRIu8 "\n", c.alpha_to_mask_num_samples);
printf("\t high_quality_intersections = %s\n", c.high_quality_intersections ? "true" : "false");
printf("\t incoherent_eqaa_reads = %s\n", c.incoherent_eqaa_reads ? "true" : "false");
printf("\t interpolate_comp_z = %s\n", c.interpolate_comp_z ? "true" : "false");
printf("\t static_anchor_associations = %s\n", c.static_anchor_associations ? "true" : "false");
}
static void eqaa_check(const EqaaControl& c)
{
EXIT_NOT_IMPLEMENTED(c.max_anchor_samples != 0);
EXIT_NOT_IMPLEMENTED(c.ps_iter_samples != 0);
EXIT_NOT_IMPLEMENTED(c.mask_export_num_samples != 0);
EXIT_NOT_IMPLEMENTED(c.alpha_to_mask_num_samples != 0);
EXIT_NOT_IMPLEMENTED(c.high_quality_intersections != false);
EXIT_NOT_IMPLEMENTED(c.incoherent_eqaa_reads != false);
EXIT_NOT_IMPLEMENTED(c.interpolate_comp_z != false);
EXIT_NOT_IMPLEMENTED(c.static_anchor_associations != false);
}
static void vp_print(const char* func, const ScreenViewport& vp)
{
printf("%s\n", func);
@@ -788,14 +828,16 @@ static void vp_check(const ScreenViewport& vp)
static void hw_check(const HardwareContext& hw)
{
const auto& rt = hw.GetRenderTargets(0);
const auto& bc = hw.GetBlendControl(0);
const auto& vp = hw.GetScreenViewport();
const auto& z = hw.GetDepthRenderTarget();
const auto& c = hw.GetClipControl();
const auto& rc = hw.GetRenderControl();
const auto& d = hw.GetDepthControl();
const auto& mc = hw.GetModeControl();
const auto& rt = hw.GetRenderTargets(0);
const auto& bc = hw.GetBlendControl(0);
const auto& bclr = hw.GetBlendColor();
const auto& vp = hw.GetScreenViewport();
const auto& z = hw.GetDepthRenderTarget();
const auto& c = hw.GetClipControl();
const auto& rc = hw.GetRenderControl();
const auto& d = hw.GetDepthControl();
const auto& mc = hw.GetModeControl();
const auto& eqaa = hw.GetEqaaControl();
rt_check(rt);
vp_check(vp);
@@ -804,7 +846,8 @@ static void hw_check(const HardwareContext& hw)
rc_check(rc);
d_check(d);
mc_check(mc);
bc_check(bc);
bc_check(bc, bclr);
eqaa_check(eqaa);
EXIT_NOT_IMPLEMENTED(hw.GetRenderTargetMask() != 0xF && hw.GetRenderTargetMask() != 0x0);
EXIT_NOT_IMPLEMENTED(hw.GetDepthClearValue() != 0.0f && hw.GetDepthClearValue() != 1.0f);
@@ -812,14 +855,16 @@ static void hw_check(const HardwareContext& hw)
static void hw_print(const HardwareContext& hw)
{
const auto& rt = hw.GetRenderTargets(0);
const auto& bc = hw.GetBlendControl(0);
const auto& vp = hw.GetScreenViewport();
const auto& z = hw.GetDepthRenderTarget();
const auto& c = hw.GetClipControl();
const auto& rc = hw.GetRenderControl();
const auto& d = hw.GetDepthControl();
const auto& mc = hw.GetModeControl();
const auto& rt = hw.GetRenderTargets(0);
const auto& bc = hw.GetBlendControl(0);
const auto& bclr = hw.GetBlendColor();
const auto& vp = hw.GetScreenViewport();
const auto& z = hw.GetDepthRenderTarget();
const auto& c = hw.GetClipControl();
const auto& rc = hw.GetRenderControl();
const auto& d = hw.GetDepthControl();
const auto& mc = hw.GetModeControl();
const auto& eqaa = hw.GetEqaaControl();
printf("HardwareContext\n");
printf("\t GetRenderTargetMask() = 0x%08" PRIx32 "\n", hw.GetRenderTargetMask());
@@ -832,7 +877,8 @@ static void hw_print(const HardwareContext& hw)
rc_print("RenderControl:", rc);
d_print("DepthControl:", d);
mc_print("ModeControl:", mc);
bc_print("BlendControl:", bc);
bc_print("BlendControl:", bc, bclr);
eqaa_print("EqaaControl:", eqaa);
}
void GraphicsRenderInit()
@@ -1749,10 +1795,10 @@ static VulkanPipeline* CreatePipelineInternal(VkRenderPass render_pass, const Sh
color_blending.logicOp = VK_LOGIC_OP_COPY;
color_blending.attachmentCount = 1;
color_blending.pAttachments = &color_blend_attachment;
color_blending.blendConstants[0] = 0.0f;
color_blending.blendConstants[1] = 0.0f;
color_blending.blendConstants[2] = 0.0f;
color_blending.blendConstants[3] = 0.0f;
color_blending.blendConstants[0] = params->blend_color_red;
color_blending.blendConstants[1] = params->blend_color_green;
color_blending.blendConstants[2] = params->blend_color_blue;
color_blending.blendConstants[3] = params->blend_color_alpha;
VkDescriptorSetLayout set_layouts[2] = {};
uint32_t set_layouts_num = 0;
@@ -1957,7 +2003,7 @@ VulkanPipeline* PipelineCache::CreatePipeline(VulkanFramebuffer* framebuffer, Re
const ShaderVertexInputInfo* vs_input_info, const VertexShaderInfo* vs_regs,
const ShaderPixelInputInfo* ps_input_info, const PixelShaderInfo* ps_regs,
VkPrimitiveTopology topology, uint32_t color_mask, const ModeControl& mc,
const BlendControl& bc, const ScreenViewport& vp)
const BlendControl& bc, const BlendColor& bclr, const ScreenViewport& vp)
{
KYTY_PROFILER_BLOCK("PipelineCache::CreatePipeline(Gfx)", profiler::colors::DeepOrangeA200);
@@ -2012,6 +2058,10 @@ VulkanPipeline* PipelineCache::CreatePipeline(VulkanFramebuffer* framebuffer, Re
p.params->alpha_destblend = bc.alpha_destblend;
p.params->separate_alpha_blend = bc.separate_alpha_blend;
p.params->blend_enable = bc.enable;
p.params->blend_color_red = bclr.red;
p.params->blend_color_green = bclr.green;
p.params->blend_color_blue = bclr.blue;
p.params->blend_color_alpha = bclr.alpha;
auto* found = Find(p);
@@ -2869,12 +2919,13 @@ static void FindRenderColorInfo(const HardwareContext& hw, RenderColorInfo* r)
if (rt.base_addr != 0)
{
auto width = rt.width;
auto height = rt.height;
auto pitch = (rt.pitch_div8_minus1 + 1) * 8;
auto size = (rt.slice_div64_minus1 + 1) * 64 * 4;
bool tile = false;
uint32_t format = 0;
auto width = rt.width;
auto height = rt.height;
auto pitch = (rt.pitch_div8_minus1 + 1) * 8;
auto size = (rt.slice_div64_minus1 + 1) * 64 * 4;
bool tile = false;
uint32_t format = 0;
bool render_to_texture = false;
if (rt.tile_mode == 0x8)
{
@@ -2882,38 +2933,48 @@ static void FindRenderColorInfo(const HardwareContext& hw, RenderColorInfo* r)
} else if (rt.tile_mode == 0xa)
{
tile = true;
} else if (rt.tile_mode == 0xd)
{
tile = true;
render_to_texture = true;
} else
{
EXIT("unknown tile mode: %u\n", rt.tile_mode);
}
if (rt.format == 0xa && rt.channel_type == 0x6 && rt.channel_order == 0x1)
if (render_to_texture)
{
format = 0x80000000;
EXIT("not implemented");
} else
{
EXIT("unknown format");
}
if (rt.format == 0xa && rt.channel_type == 0x6 && rt.channel_order == 0x1)
{
format = 0x80000000;
} else
{
EXIT("unknown format");
}
auto video_image = VideoOut::VideoOutGetImage(rt.base_addr);
if (video_image.image == nullptr)
{
// Offscreen buffer
VideoOutBufferObject vulkan_buffer_info(format, width, height, tile, Config::IsNeo(), pitch);
auto* buffer_vulkan = static_cast<Graphics::VideoOutVulkanImage*>(
Graphics::GpuMemoryGetObject(g_render_ctx->GetGraphicCtx(), rt.base_addr, size, vulkan_buffer_info));
EXIT_NOT_IMPLEMENTED(buffer_vulkan == nullptr);
r->base_addr = rt.base_addr;
r->vulkan_buffer = buffer_vulkan;
r->buffer_size = size;
} else
{
// Display buffer
EXIT_NOT_IMPLEMENTED(video_image.buffer_size != size);
EXIT_NOT_IMPLEMENTED(video_image.buffer_pitch != pitch);
r->base_addr = rt.base_addr;
r->vulkan_buffer = video_image.image;
r->buffer_size = video_image.buffer_size;
auto video_image = VideoOut::VideoOutGetImage(rt.base_addr);
if (video_image.image == nullptr)
{
// Offscreen buffer
VideoOutBufferObject vulkan_buffer_info(format, width, height, tile, Config::IsNeo(), pitch);
auto* buffer_vulkan = static_cast<Graphics::VideoOutVulkanImage*>(
Graphics::GpuMemoryGetObject(g_render_ctx->GetGraphicCtx(), rt.base_addr, size, vulkan_buffer_info));
EXIT_NOT_IMPLEMENTED(buffer_vulkan == nullptr);
r->base_addr = rt.base_addr;
r->vulkan_buffer = buffer_vulkan;
r->buffer_size = size;
} else
{
// Display buffer
EXIT_NOT_IMPLEMENTED(video_image.buffer_size != size);
EXIT_NOT_IMPLEMENTED(video_image.buffer_pitch != pitch);
r->base_addr = rt.base_addr;
r->vulkan_buffer = video_image.image;
r->buffer_size = video_image.buffer_size;
}
}
} else
{
@@ -3269,9 +3330,10 @@ void GraphicsRenderDrawIndex(CommandBuffer* buffer, HardwareContext* ctx, UserCo
EXIT_NOT_IMPLEMENTED(vs_input_info.buffers_num > 1);
auto* pipeline = g_render_ctx->GetPipelineCache()->CreatePipeline(
framebuffer, &color_info, &depth_info, &vs_input_info, &ctx->GetVs(), &ps_input_info, &ctx->GetPs(),
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, ctx->GetRenderTargetMask(), ctx->GetModeControl(), bc, ctx->GetScreenViewport());
auto* pipeline = g_render_ctx->GetPipelineCache()->CreatePipeline(framebuffer, &color_info, &depth_info, &vs_input_info, &ctx->GetVs(),
&ps_input_info, &ctx->GetPs(), VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
ctx->GetRenderTargetMask(), ctx->GetModeControl(), bc,
ctx->GetBlendColor(), ctx->GetScreenViewport());
vkCmdBindPipeline(vk_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline->pipeline);
@@ -3376,7 +3438,7 @@ void GraphicsRenderDrawIndexAuto(CommandBuffer* buffer, HardwareContext* ctx, Us
auto* pipeline = g_render_ctx->GetPipelineCache()->CreatePipeline(
framebuffer, &color_info, &depth_info, &vs_input_info, &vertex_shader_info, &ps_input_info, &pixel_shader_info, topology,
ctx->GetRenderTargetMask(), ctx->GetModeControl(), bc, ctx->GetScreenViewport());
ctx->GetRenderTargetMask(), ctx->GetModeControl(), bc, ctx->GetBlendColor(), ctx->GetScreenViewport());
vkCmdBindPipeline(vk_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline->pipeline);
@@ -1455,6 +1455,27 @@ KYTY_HW_CTX_PARSER(hw_ctx_set_depth_control)
return 1;
}
KYTY_HW_CTX_PARSER(hw_ctx_set_eqaa_control)
{
EXIT_NOT_IMPLEMENTED(cmd_id != 0xC0016900);
EXIT_NOT_IMPLEMENTED(cmd_offset != Pm4::DB_EQAA);
EqaaControl r;
r.max_anchor_samples = KYTY_PM4_GET(buffer[0], DB_EQAA, MAX_ANCHOR_SAMPLES);
r.ps_iter_samples = KYTY_PM4_GET(buffer[0], DB_EQAA, PS_ITER_SAMPLES);
r.mask_export_num_samples = KYTY_PM4_GET(buffer[0], DB_EQAA, MASK_EXPORT_NUM_SAMPLES);
r.alpha_to_mask_num_samples = KYTY_PM4_GET(buffer[0], DB_EQAA, ALPHA_TO_MASK_NUM_SAMPLES);
r.high_quality_intersections = KYTY_PM4_GET(buffer[0], DB_EQAA, HIGH_QUALITY_INTERSECTIONS) != 0;
r.incoherent_eqaa_reads = KYTY_PM4_GET(buffer[0], DB_EQAA, INCOHERENT_EQAA_READS) != 0;
r.interpolate_comp_z = KYTY_PM4_GET(buffer[0], DB_EQAA, INTERPOLATE_COMP_Z) != 0;
r.static_anchor_associations = KYTY_PM4_GET(buffer[0], DB_EQAA, STATIC_ANCHOR_ASSOCIATIONS) != 0;
cp->GetCtx()->SetEqaaControl(r);
return 1;
}
KYTY_HW_CTX_PARSER(hw_ctx_set_depth_clear)
{
EXIT_NOT_IMPLEMENTED(cmd_id != 0xC0016900);
@@ -1671,6 +1692,23 @@ KYTY_HW_CTX_PARSER(hw_ctx_set_guard_bands)
return 4;
}
KYTY_HW_CTX_PARSER(hw_ctx_set_blend_color)
{
EXIT_NOT_IMPLEMENTED(cmd_id != 0xc0046900);
EXIT_NOT_IMPLEMENTED(cmd_offset != Pm4::CB_BLEND_RED);
BlendColor r;
r.red = *reinterpret_cast<const float*>(&buffer[0]);
r.green = *reinterpret_cast<const float*>(&buffer[1]);
r.blue = *reinterpret_cast<const float*>(&buffer[2]);
r.alpha = *reinterpret_cast<const float*>(&buffer[3]);
cp->GetCtx()->SetBlendColor(r);
return 4;
}
KYTY_HW_CTX_PARSER(hw_ctx_set_vs_shader)
{
EXIT_NOT_IMPLEMENTED(cmd_id != 0xC01B1004);
@@ -2350,8 +2388,10 @@ static void graphics_init_jmp_tables()
g_hw_ctx_func[Pm4::DB_STENCIL_INFO] = hw_ctx_set_stencil_info;
g_hw_ctx_func[0x08d] = hw_ctx_hardware_screen_offset;
g_hw_ctx_func[0x08e] = hw_ctx_set_render_target_mask;
g_hw_ctx_func[Pm4::CB_BLEND_RED] = hw_ctx_set_blend_color;
g_hw_ctx_func[Pm4::SPI_PS_INPUT_CNTL_0] = hw_ctx_set_ps_input;
g_hw_ctx_func[Pm4::DB_DEPTH_CONTROL] = hw_ctx_set_depth_control;
g_hw_ctx_func[Pm4::DB_EQAA] = hw_ctx_set_eqaa_control;
g_hw_ctx_func[0x204] = hw_ctx_set_clip_control;
g_hw_ctx_func[Pm4::PA_SU_SC_MODE_CNTL] = hw_ctx_set_mode_control;
g_hw_ctx_func[0x206] = hw_ctx_set_viewport_transform_control;
+3
View File
@@ -39,6 +39,9 @@ static void init_names()
g_r_names[R_PUSH_MARKER] = "R_PUSH_MARKER";
g_r_names[R_POP_MARKER] = "R_POP_MARKER";
g_r_names[R_VS_EMBEDDED] = "R_VS_EMBEDDED";
g_r_names[R_PS_EMBEDDED] = "R_PS_EMBEDDED";
g_r_names[R_VS_UPDATE] = "R_VS_UPDATE";
g_r_names[R_PS_UPDATE] = "R_PS_UPDATE";
g_names[IT_NOP] = "IT_NOP";
g_names[IT_SET_BASE] = "IT_SET_BASE";
+20 -6
View File
@@ -2205,7 +2205,7 @@ static void ShaderGetTextureBuffer(ShaderTextureResources* info, int start_index
EXIT_IF(info == nullptr);
EXIT_NOT_IMPLEMENTED(info->textures_num < 0 || info->textures_num >= ShaderTextureResources::RES_MAX);
EXIT_NOT_IMPLEMENTED(info->textures_num != slot);
// EXIT_NOT_IMPLEMENTED(info->textures_num != slot);
int index = info->textures_num;
bool extended = (extended_buffer != nullptr);
@@ -2215,6 +2215,7 @@ static void ShaderGetTextureBuffer(ShaderTextureResources* info, int start_index
info->start_register[index] = start_index;
info->extended[index] = extended;
info->slots[index] = slot;
if (!extended)
{
@@ -2243,7 +2244,7 @@ static void ShaderGetSampler(ShaderSamplerResources* info, int start_index, int
EXIT_IF(info == nullptr);
EXIT_NOT_IMPLEMENTED(info->samplers_num < 0 || info->samplers_num >= ShaderSamplerResources::RES_MAX);
EXIT_NOT_IMPLEMENTED(info->samplers_num != slot);
// EXIT_NOT_IMPLEMENTED(info->samplers_num != slot);
int index = info->samplers_num;
bool extended = (extended_buffer != nullptr);
@@ -2253,6 +2254,7 @@ static void ShaderGetSampler(ShaderSamplerResources* info, int start_index, int
info->start_register[index] = start_index;
info->extended[index] = extended;
info->slots[index] = slot;
if (!extended)
{
@@ -2277,7 +2279,7 @@ static void ShaderGetGdsPointer(ShaderGdsResources* info, int start_index, int s
EXIT_IF(info == nullptr);
EXIT_NOT_IMPLEMENTED(info->pointers_num < 0 || info->pointers_num >= ShaderGdsResources::POINTERS_MAX);
EXIT_NOT_IMPLEMENTED(info->pointers_num != slot);
// EXIT_NOT_IMPLEMENTED(info->pointers_num != slot);
int index = info->pointers_num;
bool extended = (extended_buffer != nullptr);
@@ -2287,6 +2289,7 @@ static void ShaderGetGdsPointer(ShaderGdsResources* info, int start_index, int s
info->start_register[index] = start_index;
info->extended[index] = extended;
info->slots[index] = slot;
if (!extended)
{
@@ -2514,9 +2517,16 @@ void ShaderGetInputInfoCS(const ComputeShaderInfo* regs, ShaderComputeInputInfo*
switch (usage.type)
{
case 0x00:
EXIT_NOT_IMPLEMENTED(usage.flags != 0);
ShaderGetStorageBuffer(&info->bind.storage_buffers, usage.start_register, usage.slot, ShaderStorageUsage::ReadOnly,
regs->cs_user_sgpr, extended_buffer);
EXIT_NOT_IMPLEMENTED(usage.flags != 0 && usage.flags != 3);
if (usage.flags == 0)
{
ShaderGetStorageBuffer(&info->bind.storage_buffers, usage.start_register, usage.slot, ShaderStorageUsage::ReadOnly,
regs->cs_user_sgpr, extended_buffer);
} else if (usage.flags == 3)
{
ShaderGetTextureBuffer(&info->bind.textures2D, usage.start_register, usage.slot, regs->cs_user_sgpr, extended_buffer);
EXIT_NOT_IMPLEMENTED(info->bind.textures2D.textures[info->bind.textures2D.textures_num - 1].Type() != 9);
}
break;
case 0x02:
EXIT_NOT_IMPLEMENTED(usage.flags != 0);
@@ -2627,6 +2637,7 @@ static void ShaderDbgDumpResources(const ShaderBindResources& bind)
printf("\t\t MinLodWarn() = %" PRIu16 "\n", r.MinLodWarn());
printf("\t\t CounterBankId() = %" PRIu8 "\n", r.CounterBankId());
printf("\t\t LodHdwCntEn() = %s\n", r.LodHdwCntEn() ? "true" : "false");
printf("\t\t slot = %d\n", bind.textures2D.slots[i]);
printf("\t\t start_register = %d\n", bind.textures2D.start_register[i]);
printf("\t\t extended = %s\n", (bind.textures2D.extended[i] ? "true" : "false"));
}
@@ -2664,6 +2675,7 @@ static void ShaderDbgDumpResources(const ShaderBindResources& bind)
printf("\t\t MipFilter() = %" PRIu8 "\n", r.MipFilter());
printf("\t\t BorderColorPtr() = %" PRIu16 "\n", r.BorderColorPtr());
printf("\t\t BorderColorType() = %" PRIu8 "\n", r.BorderColorType());
printf("\t\t slot = %d\n", bind.samplers.slots[i]);
printf("\t\t start_register = %d\n", bind.samplers.start_register[i]);
printf("\t\t extended = %s\n", (bind.samplers.extended[i] ? "true" : "false"));
}
@@ -3208,6 +3220,7 @@ static void ShaderGetBindIds(ShaderId* ret, const ShaderBindResources& bind)
ret->ids.Add(r.MinLodWarn());
ret->ids.Add(r.CounterBankId());
ret->ids.Add(static_cast<uint32_t>(r.LodHdwCntEn()));
ret->ids.Add(bind.textures2D.slots[i]);
ret->ids.Add(bind.textures2D.start_register[i]);
ret->ids.Add(static_cast<uint32_t>(bind.textures2D.extended[i]));
}
@@ -3243,6 +3256,7 @@ static void ShaderGetBindIds(ShaderId* ret, const ShaderBindResources& bind)
ret->ids.Add(r.MipFilter());
ret->ids.Add(r.BorderColorPtr());
ret->ids.Add(r.BorderColorType());
ret->ids.Add(bind.samplers.slots[i]);
ret->ids.Add(bind.samplers.start_register[i]);
ret->ids.Add(static_cast<uint32_t>(bind.samplers.extended[i]));
}