diff options
author | Rodrigo Locatti <reinuseslisp@airmail.cc> | 2019-10-26 21:56:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-26 21:56:13 +0200 |
commit | 26f3e18c5cb882d48af702aa33519f4a2c74fa75 (patch) | |
tree | f17b70de1e1bca10e67a4f1076691a580f717f56 /src/video_core/engines/kepler_compute.cpp | |
parent | Merge pull request #3027 from lioncash/lookup (diff) | |
parent | Shader_IR: Address Feedback. (diff) | |
download | yuzu-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/kepler_compute.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp index 63d449135..91adef360 100644 --- a/src/video_core/engines/kepler_compute.cpp +++ b/src/video_core/engines/kepler_compute.cpp @@ -70,13 +70,31 @@ Texture::FullTextureInfo KeplerCompute::GetTextureInfo(const Texture::TextureHan GetTSCEntry(tex_handle.tsc_id)}; } -u32 KeplerCompute::AccessConstBuffer32(u64 const_buffer, u64 offset) const { +u32 KeplerCompute::AccessConstBuffer32(ShaderType stage, u64 const_buffer, u64 offset) const { + ASSERT(stage == ShaderType::Compute); const auto& buffer = launch_description.const_buffer_config[const_buffer]; u32 result; std::memcpy(&result, memory_manager.GetPointer(buffer.Address() + offset), sizeof(u32)); return result; } +SamplerDescriptor KeplerCompute::AccessBoundSampler(ShaderType stage, u64 offset) const { + return AccessBindlessSampler(stage, regs.tex_cb_index, offset * sizeof(Texture::TextureHandle)); +} + +SamplerDescriptor KeplerCompute::AccessBindlessSampler(ShaderType stage, u64 const_buffer, + u64 offset) const { + ASSERT(stage == ShaderType::Compute); + const auto& tex_info_buffer = launch_description.const_buffer_config[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; +} + void KeplerCompute::ProcessLaunch() { const GPUVAddr launch_desc_loc = regs.launch_desc_loc.Address(); memory_manager.ReadBlockUnsafe(launch_desc_loc, &launch_description, |