summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-04-06 07:56:15 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:26 +0200
commit1f3eb601acdcdfa4c119cffbf36b5792147b893f (patch)
tree1a8dcc5e4ce11e9090dd6d7a8b4e8aaa130ff67b /src/video_core/renderer_vulkan
parentshader: Address feedback (diff)
downloadyuzu-1f3eb601acdcdfa4c119cffbf36b5792147b893f.tar
yuzu-1f3eb601acdcdfa4c119cffbf36b5792147b893f.tar.gz
yuzu-1f3eb601acdcdfa4c119cffbf36b5792147b893f.tar.bz2
yuzu-1f3eb601acdcdfa4c119cffbf36b5792147b893f.tar.lz
yuzu-1f3eb601acdcdfa4c119cffbf36b5792147b893f.tar.xz
yuzu-1f3eb601acdcdfa4c119cffbf36b5792147b893f.tar.zst
yuzu-1f3eb601acdcdfa4c119cffbf36b5792147b893f.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/pipeline_helper.h10
-rw-r--r--src/video_core/renderer_vulkan/vk_compute_pipeline.cpp15
-rw-r--r--src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp14
-rw-r--r--src/video_core/renderer_vulkan/vk_pipeline_cache.cpp2
4 files changed, 29 insertions, 12 deletions
diff --git a/src/video_core/renderer_vulkan/pipeline_helper.h b/src/video_core/renderer_vulkan/pipeline_helper.h
index eebe5d569..decf0d32c 100644
--- a/src/video_core/renderer_vulkan/pipeline_helper.h
+++ b/src/video_core/renderer_vulkan/pipeline_helper.h
@@ -93,6 +93,9 @@ public:
for ([[maybe_unused]] const auto& desc : info.texture_descriptors) {
Add(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, stage);
}
+ for (const auto& desc : info.texture_buffer_descriptors) {
+ Add(VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, stage);
+ }
}
private:
@@ -146,6 +149,8 @@ inline VideoCommon::ImageViewType CastType(Shader::TextureType type) {
case Shader::TextureType::ColorArrayCube:
case Shader::TextureType::ShadowArrayCube:
return VideoCommon::ImageViewType::CubeArray;
+ case Shader::TextureType::Buffer:
+ break;
}
UNREACHABLE_MSG("Invalid texture type {}", type);
return {};
@@ -161,6 +166,11 @@ inline void PushImageDescriptors(const Shader::Info& info, const VkSampler* samp
update_descriptor_queue.AddSampledImage(vk_image_view, sampler);
++index;
}
+ for (const auto& desc : info.texture_buffer_descriptors) {
+ ImageView& image_view{texture_cache.GetImageView(image_view_ids[index])};
+ update_descriptor_queue.AddTexelBuffer(image_view.BufferView());
+ ++index;
+ }
}
} // namespace Vulkan
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp
index 0bb5b852d..9922cbd0f 100644
--- a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp
+++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp
@@ -93,20 +93,23 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute,
const auto& launch_desc{kepler_compute.launch_description};
const auto& cbufs{launch_desc.const_buffer_config};
const bool via_header_index{launch_desc.linked_tsc};
- for (const auto& desc : info.texture_descriptors) {
- const u32 cbuf_index{desc.cbuf_index};
- const u32 cbuf_offset{desc.cbuf_offset};
+ const auto read_handle{[&](u32 cbuf_index, u32 cbuf_offset) {
ASSERT(((launch_desc.const_buffer_enable_mask >> cbuf_index) & 1) != 0);
-
const GPUVAddr addr{cbufs[cbuf_index].Address() + cbuf_offset};
const u32 raw_handle{gpu_memory.Read<u32>(addr)};
-
- const TextureHandle handle(raw_handle, via_header_index);
+ return TextureHandle(raw_handle, via_header_index);
+ }};
+ for (const auto& desc : info.texture_descriptors) {
+ const TextureHandle handle{read_handle(desc.cbuf_index, desc.cbuf_offset)};
image_view_indices.push_back(handle.image);
Sampler* const sampler = texture_cache.GetComputeSampler(handle.sampler);
samplers.push_back(sampler->Handle());
}
+ for (const auto& desc : info.texture_buffer_descriptors) {
+ const TextureHandle handle{read_handle(desc.cbuf_index, desc.cbuf_offset)};
+ image_view_indices.push_back(handle.image);
+ }
const std::span indices_span(image_view_indices.data(), image_view_indices.size());
texture_cache.FillComputeImageViews(indices_span, image_view_ids);
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
index a0ef0e98b..afdd8b371 100644
--- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
+++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
@@ -169,19 +169,23 @@ void GraphicsPipeline::Configure(bool is_indexed) {
++index;
}
const auto& cbufs{maxwell3d.state.shader_stages[stage].const_buffers};
- for (const auto& desc : info.texture_descriptors) {
- const u32 cbuf_index{desc.cbuf_index};
- const u32 cbuf_offset{desc.cbuf_offset};
+ const auto read_handle{[&](u32 cbuf_index, u32 cbuf_offset) {
ASSERT(cbufs[cbuf_index].enabled);
const GPUVAddr addr{cbufs[cbuf_index].address + cbuf_offset};
const u32 raw_handle{gpu_memory.Read<u32>(addr)};
-
- const TextureHandle handle(raw_handle, via_header_index);
+ return TextureHandle(raw_handle, via_header_index);
+ }};
+ for (const auto& desc : info.texture_descriptors) {
+ const TextureHandle handle{read_handle(desc.cbuf_index, desc.cbuf_offset)};
image_view_indices.push_back(handle.image);
Sampler* const sampler{texture_cache.GetGraphicsSampler(handle.sampler)};
samplers.push_back(sampler->Handle());
}
+ for (const auto& desc : info.texture_buffer_descriptors) {
+ const TextureHandle handle{read_handle(desc.cbuf_index, desc.cbuf_offset)};
+ image_view_indices.push_back(handle.image);
+ }
}
const std::span indices_span(image_view_indices.data(), image_view_indices.size());
buffer_cache.UpdateGraphicsBuffers(is_indexed);
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
index 25f592b8a..23bf84a92 100644
--- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
@@ -212,7 +212,7 @@ protected:
case Tegra::Texture::TextureType::Texture2DArray:
return Shader::TextureType::ColorArray2D;
case Tegra::Texture::TextureType::Texture1DBuffer:
- throw Shader::NotImplementedException("Texture buffer");
+ return Shader::TextureType::Buffer;
case Tegra::Texture::TextureType::TextureCubeArray:
return Shader::TextureType::ColorArrayCube;
default: