summaryrefslogtreecommitdiffstats
path: root/src/video_core/engines/maxwell_3d.cpp
diff options
context:
space:
mode:
authorRodrigo Locatti <reinuseslisp@airmail.cc>2019-10-26 21:56:13 +0200
committerGitHub <noreply@github.com>2019-10-26 21:56:13 +0200
commit26f3e18c5cb882d48af702aa33519f4a2c74fa75 (patch)
treef17b70de1e1bca10e67a4f1076691a580f717f56 /src/video_core/engines/maxwell_3d.cpp
parentMerge pull request #3027 from lioncash/lookup (diff)
parentShader_IR: Address Feedback. (diff)
downloadyuzu-26f3e18c5cb882d48af702aa33519f4a2c74fa75.tar
yuzu-26f3e18c5cb882d48af702aa33519f4a2c74fa75.tar.gz
yuzu-26f3e18c5cb882d48af702aa33519f4a2c74fa75.tar.bz2
yuzu-26f3e18c5cb882d48af702aa33519f4a2c74fa75.tar.lz
yuzu-26f3e18c5cb882d48af702aa33519f4a2c74fa75.tar.xz
yuzu-26f3e18c5cb882d48af702aa33519f4a2c74fa75.tar.zst
yuzu-26f3e18c5cb882d48af702aa33519f4a2c74fa75.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 59976943a..558955451 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -847,7 +847,8 @@ void Maxwell3D::ProcessClearBuffers() {
rasterizer.Clear();
}
-u32 Maxwell3D::AccessConstBuffer32(Regs::ShaderStage stage, u64 const_buffer, u64 offset) const {
+u32 Maxwell3D::AccessConstBuffer32(ShaderType stage, u64 const_buffer, u64 offset) const {
+ ASSERT(stage != ShaderType::Compute);
const auto& shader_stage = state.shader_stages[static_cast<std::size_t>(stage)];
const auto& buffer = shader_stage.const_buffers[const_buffer];
u32 result;
@@ -855,4 +856,22 @@ u32 Maxwell3D::AccessConstBuffer32(Regs::ShaderStage stage, u64 const_buffer, u6
return result;
}
+SamplerDescriptor Maxwell3D::AccessBoundSampler(ShaderType stage, u64 offset) const {
+ return AccessBindlessSampler(stage, regs.tex_cb_index, offset * sizeof(Texture::TextureHandle));
+}
+
+SamplerDescriptor Maxwell3D::AccessBindlessSampler(ShaderType stage, u64 const_buffer,
+ u64 offset) const {
+ ASSERT(stage != ShaderType::Compute);
+ const auto& shader = state.shader_stages[static_cast<std::size_t>(stage)];
+ const auto& tex_info_buffer = shader.const_buffers[const_buffer];
+ const GPUVAddr tex_info_address = tex_info_buffer.address + offset;
+
+ const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)};
+ const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle, offset);
+ SamplerDescriptor result = SamplerDescriptor::FromTicTexture(tex_info.tic.texture_type.Value());
+ result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value());
+ return result;
+}
+
} // namespace Tegra::Engines