shader: size per-thread LDS emulation by the guest LDS allocation

This commit is contained in:
0xcrstn
2026-10-20 02:49:58 +02:00
parent 742fe17173
commit fa8216c4d9
3 changed files with 29 additions and 4 deletions
+7 -2
View File
@@ -315,6 +315,7 @@ static void ShaderGetStaticInputInfoPS(
ps_info = {};
ps_info.scratch_size_dwords = data.scratch_size_dwords;
ps_info.lds_size_dwords = static_cast<uint32_t>(regs.ps_regs.rsrc2.extra_lds_size) * 128u;
// SPI_PS_IN_CONTROL: NUM_INTERP occupies bits 5:0 and PS_W32_EN is bit 15.
ps_info.input_num = sh.ps_in_control & 0x3fu;
@@ -411,6 +412,7 @@ void BuildStageStaticKey(const ShaderVertexInputInfo& info, std::vector<uint32_t
key.push_back(info.resources_num);
key.push_back(info.wave_size);
key.push_back(info.scratch_size_dwords);
key.push_back(info.lds_size_dwords);
key.push_back(info.pa_cl_vs_out_cntl);
key.push_back(static_cast<uint32_t>(info.clip_space.enabled));
if (info.clip_space.enabled) {
@@ -454,6 +456,7 @@ void BuildStageStaticKey(const ShaderPixelInputInfo& info, std::vector<uint32_t>
EXIT_IF(info.input_num > std::size(info.interpolator_settings));
key.clear();
key.push_back(info.scratch_size_dwords);
key.push_back(info.lds_size_dwords);
key.push_back(info.input_num);
key.push_back(info.wave_size);
key.push_back(info.ps_system_input_base);
@@ -528,6 +531,7 @@ ShaderParams PrepareProgram(const HW::VertexShaderInfo& regs, const HW::Context&
EXIT("failed to prepare vertex shader program\n");
}
info.wave_size = (context.GetShaderStages() & 0x00400000u) != 0 ? 32u : 64u;
info.lds_size_dwords = static_cast<uint32_t>(regs.gs_regs.rsrc2.lds_size) * 128u;
return params;
}
// NGG user SGPRs start at s8; a separately compiled GS back half also receives
@@ -746,7 +750,8 @@ void ShaderDbgDumpInputInfo(const ShaderPixelInputInfo& info) {
"\t ps_no_perspective = %s\n"
"\t ps_pixel_kill_enable = %s\n"
"\t ps_early_z = %s\n"
"\t ps_execute_on_noop = %s\n",
"\t ps_execute_on_noop = %s\n"
"\t lds_size_dwords = %u\n",
info.input_num, info.ps_system_input_base, info.custom_interpolation_mask,
info.ps_perspective_center_vgpr, info.ps_perspective_sample_vgpr,
info.ps_perspective_centroid_vgpr, info.ps_pos_x ? "true" : "false",
@@ -755,7 +760,7 @@ void ShaderDbgDumpInputInfo(const ShaderPixelInputInfo& info) {
info.ps_front_face_all_bits ? "true" : "false", info.ps_ancillary ? "true" : "false",
info.ps_sample_shading ? "true" : "false", info.ps_no_perspective ? "true" : "false",
info.ps_pixel_kill_enable ? "true" : "false", info.ps_early_z ? "true" : "false",
info.ps_execute_on_noop ? "true" : "false");
info.ps_execute_on_noop ? "true" : "false", info.lds_size_dwords);
for (uint32_t i = 0; i < info.input_num; i++) {
LOGF("\t interpolator_settings[%u] = %u\n", i, info.interpolator_settings[i]);