diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-11-22 08:34:14 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-11-23 01:28:49 +0100 |
commit | e35b9597ef4ecf9d500462ef19510a36a564fd9d (patch) | |
tree | 096fb619e28bf705f5721e2b3296bc4bc1a06e2f /src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |
parent | gl_shader_decompiler: Normalize cbuf bindings (diff) | |
download | yuzu-e35b9597ef4ecf9d500462ef19510a36a564fd9d.tar yuzu-e35b9597ef4ecf9d500462ef19510a36a564fd9d.tar.gz yuzu-e35b9597ef4ecf9d500462ef19510a36a564fd9d.tar.bz2 yuzu-e35b9597ef4ecf9d500462ef19510a36a564fd9d.tar.lz yuzu-e35b9597ef4ecf9d500462ef19510a36a564fd9d.tar.xz yuzu-e35b9597ef4ecf9d500462ef19510a36a564fd9d.tar.zst yuzu-e35b9597ef4ecf9d500462ef19510a36a564fd9d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 040370c83..b17c4e703 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -650,12 +650,10 @@ private: } void DeclareSamplers() { - const auto& samplers = ir.GetSamplers(); - for (const auto& sampler : samplers) { + u32 binding = device.GetBaseBindings(stage).sampler; + for (const auto& sampler : ir.GetSamplers()) { const std::string name = GetSampler(sampler); - - const u32 binding = device.GetBaseBindings(stage).sampler + sampler.GetIndex(); - const std::string description = fmt::format("layout (binding = {}) uniform", binding); + const std::string description = fmt::format("layout (binding = {}) uniform", binding++); std::string sampler_type = [&]() { if (sampler.IsBuffer()) { @@ -684,7 +682,7 @@ private: code.AddLine("{} {} {};", description, sampler_type, name); } - if (!samplers.empty()) { + if (!ir.GetSamplers().empty()) { code.AddNewLine(); } } @@ -724,8 +722,8 @@ private: } void DeclareImages() { - const auto& images{ir.GetImages()}; - for (const auto& image : images) { + u32 binding = device.GetBaseBindings(stage).image; + for (const auto& image : ir.GetImages()) { std::string qualifier = "coherent volatile"; if (image.IsRead() && !image.IsWritten()) { qualifier += " readonly"; @@ -733,14 +731,12 @@ private: qualifier += " writeonly"; } - const u32 binding = device.GetBaseBindings(stage).image + image.GetIndex(); - const char* format = image.IsAtomic() ? "r32ui, " : ""; const char* type_declaration = GetImageTypeDeclaration(image.GetType()); - code.AddLine("layout ({}binding = {}) {} uniform uimage{} {};", format, binding, + code.AddLine("layout ({}binding = {}) {} uniform uimage{} {};", format, binding++, qualifier, type_declaration, GetImage(image)); } - if (!images.empty()) { + if (!ir.GetImages().empty()) { code.AddNewLine(); } } |