summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends
diff options
context:
space:
mode:
authorMai <mai.iam2048@gmail.com>2023-12-17 14:50:23 -0500
committerGitHub <noreply@github.com>2023-12-17 14:50:23 -0500
commitbcd74a81a96aa234d790c8f23ea8d610b2a148db (patch)
tree1e2f4d66cc8d56354c4925d139f115534aab2ebe /Source/Core/VideoBackends
parent559ea0593cb157f99e0ff5dc223acf6d2736d17d (diff)
parentac862b04ab8445ad83b04b642c3922ddfc675e29 (diff)
Merge pull request #12370 from iwubcode/more_samplers
VideoBackends / VideoCommon: update max pixel shader samplers from 8 to 16
Diffstat (limited to 'Source/Core/VideoBackends')
-rw-r--r--Source/Core/VideoBackends/D3D12/D3D12Gfx.cpp2
-rw-r--r--Source/Core/VideoBackends/D3D12/DescriptorAllocator.cpp2
-rw-r--r--Source/Core/VideoBackends/Metal/MTLStateTracker.h2
-rw-r--r--Source/Core/VideoBackends/Vulkan/ObjectCache.cpp22
4 files changed, 21 insertions, 7 deletions
diff --git a/Source/Core/VideoBackends/D3D12/D3D12Gfx.cpp b/Source/Core/VideoBackends/D3D12/D3D12Gfx.cpp
index 08d273859f..51441457e0 100644
--- a/Source/Core/VideoBackends/D3D12/D3D12Gfx.cpp
+++ b/Source/Core/VideoBackends/D3D12/D3D12Gfx.cpp
@@ -659,7 +659,7 @@ void Gfx::UpdateDescriptorTables()
bool Gfx::UpdateSRVDescriptorTable()
{
static constexpr std::array<UINT, VideoCommon::MAX_PIXEL_SHADER_SAMPLERS> src_sizes = {
- 1, 1, 1, 1, 1, 1, 1, 1};
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
DescriptorHandle dst_base_handle;
const UINT dst_handle_sizes = VideoCommon::MAX_PIXEL_SHADER_SAMPLERS;
if (!g_dx_context->GetDescriptorAllocator()->Allocate(VideoCommon::MAX_PIXEL_SHADER_SAMPLERS,
diff --git a/Source/Core/VideoBackends/D3D12/DescriptorAllocator.cpp b/Source/Core/VideoBackends/D3D12/DescriptorAllocator.cpp
index d77d7f454d..bb7043ed27 100644
--- a/Source/Core/VideoBackends/D3D12/DescriptorAllocator.cpp
+++ b/Source/Core/VideoBackends/D3D12/DescriptorAllocator.cpp
@@ -99,7 +99,7 @@ bool SamplerAllocator::GetGroupHandle(const SamplerStateSet& sss,
// Copy samplers from the sampler heap.
static constexpr std::array<UINT, VideoCommon::MAX_PIXEL_SHADER_SAMPLERS> source_sizes = {
- {1, 1, 1, 1, 1, 1, 1, 1}};
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
g_dx_context->GetDevice()->CopyDescriptors(
1, &allocation.cpu_handle, &VideoCommon::MAX_PIXEL_SHADER_SAMPLERS,
VideoCommon::MAX_PIXEL_SHADER_SAMPLERS, source_handles.data(), source_sizes.data(),
diff --git a/Source/Core/VideoBackends/Metal/MTLStateTracker.h b/Source/Core/VideoBackends/Metal/MTLStateTracker.h
index 7f0c7d2bef..75bd34352b 100644
--- a/Source/Core/VideoBackends/Metal/MTLStateTracker.h
+++ b/Source/Core/VideoBackends/Metal/MTLStateTracker.h
@@ -199,7 +199,7 @@ private:
// MARK: State
u16 m_dirty_textures;
- u8 m_dirty_samplers;
+ u16 m_dirty_samplers;
static_assert(sizeof(m_dirty_textures) * 8 >= MAX_TEXTURES, "Make this bigger");
static_assert(sizeof(m_dirty_samplers) * 8 >= MAX_SAMPLERS, "Make this bigger");
union Flags
diff --git a/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp b/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp
index 3a226b7177..c32365f3fc 100644
--- a/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp
+++ b/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp
@@ -121,10 +121,24 @@ bool ObjectCache::CreateDescriptorSetLayouts()
VK_SHADER_STAGE_GEOMETRY_BIT},
}};
- static const std::array<VkDescriptorSetLayoutBinding, 1> standard_sampler_bindings{{
- {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
- static_cast<u32>(VideoCommon::MAX_PIXEL_SHADER_SAMPLERS), VK_SHADER_STAGE_FRAGMENT_BIT},
- }};
+ constexpr u32 MAX_PIXEL_SAMPLER_ARRAY_SIZE = 8;
+ constexpr u32 TOTAL_PIXEL_SAMPLER_BINDINGS =
+ 1 + (VideoCommon::MAX_PIXEL_SHADER_SAMPLERS - MAX_PIXEL_SAMPLER_ARRAY_SIZE);
+ static_assert(VideoCommon::MAX_PIXEL_SHADER_SAMPLERS == 16, "Update descriptor sampler bindings");
+
+ static const std::array<VkDescriptorSetLayoutBinding, TOTAL_PIXEL_SAMPLER_BINDINGS>
+ standard_sampler_bindings{{
+ {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, MAX_PIXEL_SAMPLER_ARRAY_SIZE,
+ VK_SHADER_STAGE_FRAGMENT_BIT},
+ {8, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT},
+ {9, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT},
+ {10, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT},
+ {11, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT},
+ {12, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT},
+ {13, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT},
+ {14, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT},
+ {15, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT},
+ }};
// The dynamic veretex loader's vertex buffer must be last here, for similar reasons
static const std::array<VkDescriptorSetLayoutBinding, 2> standard_ssbo_bindings{{