mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 22:20:05 +00:00
gl_shader_decompiler: Normalize cbuf bindings
Stage and compute shaders were using a different binding counter. Normalize these.
This commit is contained in:
parent
f936b86c7c
commit
36d9b409fc
@ -857,13 +857,13 @@ bool RasterizerOpenGL::AccelerateDisplay(const Tegra::FramebufferConfig& config,
|
|||||||
|
|
||||||
void RasterizerOpenGL::SetupDrawConstBuffers(std::size_t stage_index, const Shader& shader) {
|
void RasterizerOpenGL::SetupDrawConstBuffers(std::size_t stage_index, const Shader& shader) {
|
||||||
MICROPROFILE_SCOPE(OpenGL_UBO);
|
MICROPROFILE_SCOPE(OpenGL_UBO);
|
||||||
const u32 base_binding = device.GetBaseBindings(stage_index).uniform_buffer;
|
|
||||||
const auto& stages = system.GPU().Maxwell3D().state.shader_stages;
|
const auto& stages = system.GPU().Maxwell3D().state.shader_stages;
|
||||||
const auto& shader_stage = stages[stage_index];
|
const auto& shader_stage = stages[stage_index];
|
||||||
|
|
||||||
|
u32 binding = device.GetBaseBindings(stage_index).uniform_buffer;
|
||||||
for (const auto& entry : shader->GetShaderEntries().const_buffers) {
|
for (const auto& entry : shader->GetShaderEntries().const_buffers) {
|
||||||
const auto& buffer = shader_stage.const_buffers[entry.GetIndex()];
|
const auto& buffer = shader_stage.const_buffers[entry.GetIndex()];
|
||||||
SetupConstBuffer(base_binding + entry.GetIndex(), buffer, entry);
|
SetupConstBuffer(binding++, buffer, entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,10 +619,9 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeclareConstantBuffers() {
|
void DeclareConstantBuffers() {
|
||||||
for (const auto& entry : ir.GetConstantBuffers()) {
|
u32 binding = device.GetBaseBindings(stage).uniform_buffer;
|
||||||
const auto [index, size] = entry;
|
for (const auto& [index, cbuf] : ir.GetConstantBuffers()) {
|
||||||
const u32 binding = device.GetBaseBindings(stage).uniform_buffer + index;
|
code.AddLine("layout (std140, binding = {}) uniform {} {{", binding++,
|
||||||
code.AddLine("layout (std140, binding = {}) uniform {} {{", binding,
|
|
||||||
GetConstBufferBlock(index));
|
GetConstBufferBlock(index));
|
||||||
code.AddLine(" uvec4 {}[{}];", GetConstBuffer(index), MAX_CONSTBUFFER_ELEMENTS);
|
code.AddLine(" uvec4 {}[{}];", GetConstBuffer(index), MAX_CONSTBUFFER_ELEMENTS);
|
||||||
code.AddLine("}};");
|
code.AddLine("}};");
|
||||||
@ -632,10 +631,7 @@ private:
|
|||||||
|
|
||||||
void DeclareGlobalMemory() {
|
void DeclareGlobalMemory() {
|
||||||
u32 binding = device.GetBaseBindings(stage).shader_storage_buffer;
|
u32 binding = device.GetBaseBindings(stage).shader_storage_buffer;
|
||||||
|
for (const auto& [base, usage] : ir.GetGlobalMemory()) {
|
||||||
for (const auto& gmem : ir.GetGlobalMemory()) {
|
|
||||||
const auto& [base, usage] = gmem;
|
|
||||||
|
|
||||||
// Since we don't know how the shader will use the shader, hint the driver to disable as
|
// Since we don't know how the shader will use the shader, hint the driver to disable as
|
||||||
// much optimizations as possible
|
// much optimizations as possible
|
||||||
std::string qualifier = "coherent volatile";
|
std::string qualifier = "coherent volatile";
|
||||||
|
Loading…
Reference in New Issue
Block a user