gl_shader_decompiler: Stub local memory size

This commit is contained in:
ReinUsesLisp 2019-07-15 17:28:27 -03:00
parent 56bca83bde
commit 6b0d017675

View file

@ -344,15 +344,17 @@ private:
} }
void DeclareLocalMemory() { void DeclareLocalMemory() {
if (stage == ProgramType::Compute) { // TODO(Rodrigo): Unstub kernel local memory size and pass it from a register at
// specialization time.
const u64 local_memory_size =
stage == ProgramType::Compute ? 0x400 : header.GetLocalMemorySize();
if (local_memory_size == 0) {
return; return;
} }
if (const u64 local_memory_size = header.GetLocalMemorySize(); local_memory_size > 0) {
const auto element_count = Common::AlignUp(local_memory_size, 4) / 4; const auto element_count = Common::AlignUp(local_memory_size, 4) / 4;
code.AddLine("float {}[{}];", GetLocalMemory(), element_count); code.AddLine("float {}[{}];", GetLocalMemory(), element_count);
code.AddNewLine(); code.AddNewLine();
} }
}
void DeclareInternalFlags() { void DeclareInternalFlags() {
for (u32 flag = 0; flag < static_cast<u32>(InternalFlag::Amount); flag++) { for (u32 flag = 0; flag < static_cast<u32>(InternalFlag::Amount); flag++) {
@ -703,7 +705,9 @@ private:
} }
if (const auto lmem = std::get_if<LmemNode>(&*node)) { if (const auto lmem = std::get_if<LmemNode>(&*node)) {
UNIMPLEMENTED_IF(stage == ProgramType::Compute); if (stage == ProgramType::Compute) {
LOG_WARNING(Render_OpenGL, "Local memory is stubbed on compute shaders");
}
return fmt::format("{}[ftou({}) / 4]", GetLocalMemory(), Visit(lmem->GetAddress())); return fmt::format("{}[ftou({}) / 4]", GetLocalMemory(), Visit(lmem->GetAddress()));
} }
@ -1080,7 +1084,9 @@ private:
target = result->first; target = result->first;
is_integer = result->second; is_integer = result->second;
} else if (const auto lmem = std::get_if<LmemNode>(&*dest)) { } else if (const auto lmem = std::get_if<LmemNode>(&*dest)) {
UNIMPLEMENTED_IF(stage == ProgramType::Compute); if (stage == ProgramType::Compute) {
LOG_WARNING(Render_OpenGL, "Local memory is stubbed on compute shaders");
}
target = fmt::format("{}[ftou({}) / 4]", GetLocalMemory(), Visit(lmem->GetAddress())); target = fmt::format("{}[ftou({}) / 4]", GetLocalMemory(), Visit(lmem->GetAddress()));
} else if (const auto gmem = std::get_if<GmemNode>(&*dest)) { } else if (const auto gmem = std::get_if<GmemNode>(&*dest)) {
const std::string real = Visit(gmem->GetRealAddress()); const std::string real = Visit(gmem->GetRealAddress());