diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-06-24 06:56:38 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-06-24 06:56:38 +0200 |
commit | b8b05a484a16372b481e1820601cc823543fc58a (patch) | |
tree | 9c70b2118fa1e229532d1af51adc177db0ce6667 /src | |
parent | shader_bytecode: Include missing <array> (diff) | |
download | yuzu-b8b05a484a16372b481e1820601cc823543fc58a.tar yuzu-b8b05a484a16372b481e1820601cc823543fc58a.tar.gz yuzu-b8b05a484a16372b481e1820601cc823543fc58a.tar.bz2 yuzu-b8b05a484a16372b481e1820601cc823543fc58a.tar.lz yuzu-b8b05a484a16372b481e1820601cc823543fc58a.tar.xz yuzu-b8b05a484a16372b481e1820601cc823543fc58a.tar.zst yuzu-b8b05a484a16372b481e1820601cc823543fc58a.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index ca04d8618..5f2f1510c 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -459,7 +459,7 @@ private: for (const auto& sampler : samplers) { const std::string name{GetSampler(sampler)}; const std::string description{"layout (binding = SAMPLER_BINDING_" + - std::to_string(sampler.GetIndex()) + ") uniform "}; + std::to_string(sampler.GetIndex()) + ") uniform"}; std::string sampler_type = [&]() { switch (sampler.GetType()) { case Tegra::Shader::TextureType::Texture1D: @@ -488,13 +488,13 @@ private: // preprocessor flag and use one or the other from the GPU state. This has to be // done because shaders don't have enough information to determine the texture type. EmitIfdefIsBuffer(sampler); - code.AddLine(description + "samplerBuffer " + name + ';'); + code.AddLine("{} samplerBuffer {};", description, name); code.AddLine("#else"); - code.AddLine(description + sampler_type + ' ' + name + ';'); + code.AddLine("{} {} {};", description, sampler_type, name); code.AddLine("#endif"); } else { // The other texture types (2D, 3D and cubes) don't have this issue. - code.AddLine(description + sampler_type + ' ' + name + ';'); + code.AddLine("{} {} {};", description, sampler_type, name); } } if (!samplers.empty()) { @@ -557,12 +557,13 @@ private: return "image1D"; } }(); - code.AddLine("layout (binding = IMAGE_BINDING_" + std::to_string(image.GetIndex()) + - ") coherent volatile writeonly uniform " + image_type + ' ' + - GetImage(image) + ';'); + code.AddLine("layout (binding = IMAGE_BINDING_{}) coherent volatile writeonly uniform " + "{} {};", + image.GetIndex(), image_type, GetImage(image)); } - if (!images.empty()) + if (!images.empty()) { code.AddNewLine(); + } } void VisitBlock(const NodeBlock& bb) { @@ -1504,9 +1505,9 @@ private: const std::string tmp{code.GenerateTemporary()}; EmitIfdefIsBuffer(meta->sampler); - code.AddLine("float " + tmp + " = " + expr_buffer + ';'); + code.AddLine("float {} = {};", tmp, expr_buffer); code.AddLine("#else"); - code.AddLine("float " + tmp + " = " + expr + ';'); + code.AddLine("float {} = {};", tmp, expr); code.AddLine("#endif"); return tmp; @@ -1860,7 +1861,7 @@ private: } void EmitIfdefIsBuffer(const Sampler& sampler) { - code.AddLine(fmt::format("#ifdef SAMPLER_{}_IS_BUFFER", sampler.GetIndex())); + code.AddLine("#ifdef SAMPLER_{}_IS_BUFFER", sampler.GetIndex()); } std::string GetDeclarationWithSuffix(u32 index, const std::string& name) const { |