summaryrefslogtreecommitdiff
path: root/src/video_core/engines
diff options
context:
space:
mode:
authorGravatar Rodrigo Locatti2019-10-29 23:46:33 +0000
committerGravatar GitHub2019-10-29 23:46:33 +0000
commit2ec5b55ee3c74063bc9af22e734e4cbd85682fde (patch)
tree5cc6f5d9c8a1173b0a1e36987c62d134a57d6bfc /src/video_core/engines
parentMerge pull request #3023 from lioncash/opus (diff)
parentmaxwell_3d/kepler_compute: Remove unused arguments in GetTexture (diff)
downloadyuzu-2ec5b55ee3c74063bc9af22e734e4cbd85682fde.tar.gz
yuzu-2ec5b55ee3c74063bc9af22e734e4cbd85682fde.tar.xz
yuzu-2ec5b55ee3c74063bc9af22e734e4cbd85682fde.zip
Merge pull request #3004 from ReinUsesLisp/maxwell3d-cleanup
maxwell_3d: Remove unused entries
Diffstat (limited to 'src/video_core/engines')
-rw-r--r--src/video_core/engines/kepler_compute.cpp12
-rw-r--r--src/video_core/engines/kepler_compute.h7
-rw-r--r--src/video_core/engines/maxwell_3d.cpp61
-rw-r--r--src/video_core/engines/maxwell_3d.h8
4 files changed, 14 insertions, 74 deletions
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp
index 91adef360..3a39aeabe 100644
--- a/src/video_core/engines/kepler_compute.cpp
+++ b/src/video_core/engines/kepler_compute.cpp
@@ -50,7 +50,7 @@ void KeplerCompute::CallMethod(const GPU::MethodCall& method_call) {
50 } 50 }
51} 51}
52 52
53Tegra::Texture::FullTextureInfo KeplerCompute::GetTexture(std::size_t offset) const { 53Texture::FullTextureInfo KeplerCompute::GetTexture(std::size_t offset) const {
54 const std::bitset<8> cbuf_mask = launch_description.const_buffer_enable_mask.Value(); 54 const std::bitset<8> cbuf_mask = launch_description.const_buffer_enable_mask.Value();
55 ASSERT(cbuf_mask[regs.tex_cb_index]); 55 ASSERT(cbuf_mask[regs.tex_cb_index]);
56 56
@@ -61,13 +61,11 @@ Tegra::Texture::FullTextureInfo KeplerCompute::GetTexture(std::size_t offset) co
61 ASSERT(address < texinfo.Address() + texinfo.size); 61 ASSERT(address < texinfo.Address() + texinfo.size);
62 62
63 const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(address)}; 63 const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(address)};
64 return GetTextureInfo(tex_handle, offset); 64 return GetTextureInfo(tex_handle);
65} 65}
66 66
67Texture::FullTextureInfo KeplerCompute::GetTextureInfo(const Texture::TextureHandle tex_handle, 67Texture::FullTextureInfo KeplerCompute::GetTextureInfo(Texture::TextureHandle tex_handle) const {
68 std::size_t offset) const { 68 return Texture::FullTextureInfo{GetTICEntry(tex_handle.tic_id), GetTSCEntry(tex_handle.tsc_id)};
69 return Texture::FullTextureInfo{static_cast<u32>(offset), GetTICEntry(tex_handle.tic_id),
70 GetTSCEntry(tex_handle.tsc_id)};
71} 69}
72 70
73u32 KeplerCompute::AccessConstBuffer32(ShaderType stage, u64 const_buffer, u64 offset) const { 71u32 KeplerCompute::AccessConstBuffer32(ShaderType stage, u64 const_buffer, u64 offset) const {
@@ -89,7 +87,7 @@ SamplerDescriptor KeplerCompute::AccessBindlessSampler(ShaderType stage, u64 con
89 const GPUVAddr tex_info_address = tex_info_buffer.Address() + offset; 87 const GPUVAddr tex_info_address = tex_info_buffer.Address() + offset;
90 88
91 const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)}; 89 const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)};
92 const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle, offset); 90 const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle);
93 SamplerDescriptor result = SamplerDescriptor::FromTicTexture(tex_info.tic.texture_type.Value()); 91 SamplerDescriptor result = SamplerDescriptor::FromTicTexture(tex_info.tic.texture_type.Value());
94 result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value()); 92 result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value());
95 return result; 93 return result;
diff --git a/src/video_core/engines/kepler_compute.h b/src/video_core/engines/kepler_compute.h
index 8e7182727..b185c98c7 100644
--- a/src/video_core/engines/kepler_compute.h
+++ b/src/video_core/engines/kepler_compute.h
@@ -196,11 +196,10 @@ public:
196 /// Write the value to the register identified by method. 196 /// Write the value to the register identified by method.
197 void CallMethod(const GPU::MethodCall& method_call); 197 void CallMethod(const GPU::MethodCall& method_call);
198 198
199 Tegra::Texture::FullTextureInfo GetTexture(std::size_t offset) const; 199 Texture::FullTextureInfo GetTexture(std::size_t offset) const;
200 200
201 /// Given a Texture Handle, returns the TSC and TIC entries. 201 /// Given a texture handle, returns the TSC and TIC entries.
202 Texture::FullTextureInfo GetTextureInfo(const Texture::TextureHandle tex_handle, 202 Texture::FullTextureInfo GetTextureInfo(Texture::TextureHandle tex_handle) const;
203 std::size_t offset) const;
204 203
205 u32 AccessConstBuffer32(ShaderType stage, u64 const_buffer, u64 offset) const override; 204 u32 AccessConstBuffer32(ShaderType stage, u64 const_buffer, u64 offset) const override;
206 205
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 514ed93fa..2bed6cb38 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -760,61 +760,8 @@ Texture::TSCEntry Maxwell3D::GetTSCEntry(u32 tsc_index) const {
760 return tsc_entry; 760 return tsc_entry;
761} 761}
762 762
763std::vector<Texture::FullTextureInfo> Maxwell3D::GetStageTextures(Regs::ShaderStage stage) const { 763Texture::FullTextureInfo Maxwell3D::GetTextureInfo(Texture::TextureHandle tex_handle) const {
764 std::vector<Texture::FullTextureInfo> textures; 764 return Texture::FullTextureInfo{GetTICEntry(tex_handle.tic_id), GetTSCEntry(tex_handle.tsc_id)};
765
766 auto& fragment_shader = state.shader_stages[static_cast<std::size_t>(stage)];
767 auto& tex_info_buffer = fragment_shader.const_buffers[regs.tex_cb_index];
768 ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0);
769
770 GPUVAddr tex_info_buffer_end = tex_info_buffer.address + tex_info_buffer.size;
771
772 // Offset into the texture constbuffer where the texture info begins.
773 static constexpr std::size_t TextureInfoOffset = 0x20;
774
775 for (GPUVAddr current_texture = tex_info_buffer.address + TextureInfoOffset;
776 current_texture < tex_info_buffer_end; current_texture += sizeof(Texture::TextureHandle)) {
777
778 const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(current_texture)};
779
780 Texture::FullTextureInfo tex_info{};
781 // TODO(Subv): Use the shader to determine which textures are actually accessed.
782 tex_info.index =
783 static_cast<u32>(current_texture - tex_info_buffer.address - TextureInfoOffset) /
784 sizeof(Texture::TextureHandle);
785
786 // Load the TIC data.
787 auto tic_entry = GetTICEntry(tex_handle.tic_id);
788 // TODO(Subv): Workaround for BitField's move constructor being deleted.
789 std::memcpy(&tex_info.tic, &tic_entry, sizeof(tic_entry));
790
791 // Load the TSC data
792 auto tsc_entry = GetTSCEntry(tex_handle.tsc_id);
793 // TODO(Subv): Workaround for BitField's move constructor being deleted.
794 std::memcpy(&tex_info.tsc, &tsc_entry, sizeof(tsc_entry));
795
796 textures.push_back(tex_info);
797 }
798
799 return textures;
800}
801
802Texture::FullTextureInfo Maxwell3D::GetTextureInfo(const Texture::TextureHandle tex_handle,
803 std::size_t offset) const {
804 Texture::FullTextureInfo tex_info{};
805 tex_info.index = static_cast<u32>(offset);
806
807 // Load the TIC data.
808 auto tic_entry = GetTICEntry(tex_handle.tic_id);
809 // TODO(Subv): Workaround for BitField's move constructor being deleted.
810 std::memcpy(&tex_info.tic, &tic_entry, sizeof(tic_entry));
811
812 // Load the TSC data
813 auto tsc_entry = GetTSCEntry(tex_handle.tsc_id);
814 // TODO(Subv): Workaround for BitField's move constructor being deleted.
815 std::memcpy(&tex_info.tsc, &tsc_entry, sizeof(tsc_entry));
816
817 return tex_info;
818} 765}
819 766
820Texture::FullTextureInfo Maxwell3D::GetStageTexture(Regs::ShaderStage stage, 767Texture::FullTextureInfo Maxwell3D::GetStageTexture(Regs::ShaderStage stage,
@@ -830,7 +777,7 @@ Texture::FullTextureInfo Maxwell3D::GetStageTexture(Regs::ShaderStage stage,
830 777
831 const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)}; 778 const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)};
832 779
833 return GetTextureInfo(tex_handle, offset); 780 return GetTextureInfo(tex_handle);
834} 781}
835 782
836u32 Maxwell3D::GetRegisterValue(u32 method) const { 783u32 Maxwell3D::GetRegisterValue(u32 method) const {
@@ -867,7 +814,7 @@ SamplerDescriptor Maxwell3D::AccessBindlessSampler(ShaderType stage, u64 const_b
867 const GPUVAddr tex_info_address = tex_info_buffer.address + offset; 814 const GPUVAddr tex_info_address = tex_info_buffer.address + offset;
868 815
869 const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)}; 816 const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)};
870 const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle, offset); 817 const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle);
871 SamplerDescriptor result = SamplerDescriptor::FromTicTexture(tex_info.tic.texture_type.Value()); 818 SamplerDescriptor result = SamplerDescriptor::FromTicTexture(tex_info.tic.texture_type.Value());
872 result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value()); 819 result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value());
873 return result; 820 return result;
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 987ad77b2..8cc842684 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -1250,12 +1250,8 @@ public:
1250 1250
1251 void FlushMMEInlineDraw(); 1251 void FlushMMEInlineDraw();
1252 1252
1253 /// Given a Texture Handle, returns the TSC and TIC entries. 1253 /// Given a texture handle, returns the TSC and TIC entries.
1254 Texture::FullTextureInfo GetTextureInfo(const Texture::TextureHandle tex_handle, 1254 Texture::FullTextureInfo GetTextureInfo(Texture::TextureHandle tex_handle) const;
1255 std::size_t offset) const;
1256
1257 /// Returns a list of enabled textures for the specified shader stage.
1258 std::vector<Texture::FullTextureInfo> GetStageTextures(Regs::ShaderStage stage) const;
1259 1255
1260 /// Returns the texture information for a specific texture in a specific shader stage. 1256 /// Returns the texture information for a specific texture in a specific shader stage.
1261 Texture::FullTextureInfo GetStageTexture(Regs::ShaderStage stage, std::size_t offset) const; 1257 Texture::FullTextureInfo GetStageTexture(Regs::ShaderStage stage, std::size_t offset) const;