summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp26
-rw-r--r--src/video_core/shader/node.h2
2 files changed, 8 insertions, 20 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index e1965fb21..3fcd319fd 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -36,6 +36,7 @@ namespace OpenGL {
36 36
37using Maxwell = Tegra::Engines::Maxwell3D::Regs; 37using Maxwell = Tegra::Engines::Maxwell3D::Regs;
38 38
39using Tegra::Engines::ShaderType;
39using VideoCore::Surface::PixelFormat; 40using VideoCore::Surface::PixelFormat;
40using VideoCore::Surface::SurfaceTarget; 41using VideoCore::Surface::SurfaceTarget;
41using VideoCore::Surface::SurfaceType; 42using VideoCore::Surface::SurfaceType;
@@ -56,8 +57,7 @@ namespace {
56 57
57template <typename Engine, typename Entry> 58template <typename Engine, typename Entry>
58Tegra::Texture::FullTextureInfo GetTextureInfo(const Engine& engine, const Entry& entry, 59Tegra::Texture::FullTextureInfo GetTextureInfo(const Engine& engine, const Entry& entry,
59 Tegra::Engines::ShaderType shader_type, 60 ShaderType shader_type, std::size_t index = 0) {
60 std::size_t index = 0) {
61 if (entry.IsBindless()) { 61 if (entry.IsBindless()) {
62 const Tegra::Texture::TextureHandle tex_handle = 62 const Tegra::Texture::TextureHandle tex_handle =
63 engine.AccessConstBuffer32(shader_type, entry.GetBuffer(), entry.GetOffset()); 63 engine.AccessConstBuffer32(shader_type, entry.GetBuffer(), entry.GetOffset());
@@ -910,15 +910,10 @@ void RasterizerOpenGL::SetupDrawTextures(std::size_t stage_index, const Shader&
910 const auto& maxwell3d = system.GPU().Maxwell3D(); 910 const auto& maxwell3d = system.GPU().Maxwell3D();
911 u32 binding = device.GetBaseBindings(stage_index).sampler; 911 u32 binding = device.GetBaseBindings(stage_index).sampler;
912 for (const auto& entry : shader->GetShaderEntries().samplers) { 912 for (const auto& entry : shader->GetShaderEntries().samplers) {
913 const auto shader_type = static_cast<Tegra::Engines::ShaderType>(stage_index); 913 const auto shader_type = static_cast<ShaderType>(stage_index);
914 if (!entry.IsIndexed()) { 914 for (std::size_t i = 0; i < entry.Size(); ++i) {
915 const auto texture = GetTextureInfo(maxwell3d, entry, shader_type); 915 const auto texture = GetTextureInfo(maxwell3d, entry, shader_type, i);
916 SetupTexture(binding++, texture, entry); 916 SetupTexture(binding++, texture, entry);
917 } else {
918 for (std::size_t i = 0; i < entry.Size(); ++i) {
919 const auto texture = GetTextureInfo(maxwell3d, entry, shader_type, i);
920 SetupTexture(binding++, texture, entry);
921 }
922 } 917 }
923 } 918 }
924} 919}
@@ -928,16 +923,9 @@ void RasterizerOpenGL::SetupComputeTextures(const Shader& kernel) {
928 const auto& compute = system.GPU().KeplerCompute(); 923 const auto& compute = system.GPU().KeplerCompute();
929 u32 binding = 0; 924 u32 binding = 0;
930 for (const auto& entry : kernel->GetShaderEntries().samplers) { 925 for (const auto& entry : kernel->GetShaderEntries().samplers) {
931 if (!entry.IsIndexed()) { 926 for (std::size_t i = 0; i < entry.Size(); ++i) {
932 const auto texture = 927 const auto texture = GetTextureInfo(compute, entry, ShaderType::Compute, i);
933 GetTextureInfo(compute, entry, Tegra::Engines::ShaderType::Compute);
934 SetupTexture(binding++, texture, entry); 928 SetupTexture(binding++, texture, entry);
935 } else {
936 for (std::size_t i = 0; i < entry.Size(); ++i) {
937 const auto texture =
938 GetTextureInfo(compute, entry, Tegra::Engines::ShaderType::Compute, i);
939 SetupTexture(binding++, texture, entry);
940 }
941 } 929 }
942 } 930 }
943} 931}
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h
index a0a7b9111..a1828546e 100644
--- a/src/video_core/shader/node.h
+++ b/src/video_core/shader/node.h
@@ -299,7 +299,7 @@ private:
299 u32 index{}; ///< Emulated index given for the this sampler. 299 u32 index{}; ///< Emulated index given for the this sampler.
300 u32 offset{}; ///< Offset in the const buffer from where the sampler is being read. 300 u32 offset{}; ///< Offset in the const buffer from where the sampler is being read.
301 u32 buffer{}; ///< Buffer where the bindless sampler is being read (unused on bound samplers). 301 u32 buffer{}; ///< Buffer where the bindless sampler is being read (unused on bound samplers).
302 u32 size{}; ///< Size of the sampler if indexed. 302 u32 size{1}; ///< Size of the sampler.
303 303
304 Tegra::Shader::TextureType type{}; ///< The type used to sample this texture (Texture2D, etc) 304 Tegra::Shader::TextureType type{}; ///< The type used to sample this texture (Texture2D, etc)
305 bool is_array{}; ///< Whether the texture is being sampled as an array texture or not. 305 bool is_array{}; ///< Whether the texture is being sampled as an array texture or not.