mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
VideoCommon: add constant value to set the allowed maximum number of pixel samplers
This commit is contained in:
@ -33,8 +33,7 @@ Gfx::Gfx(std::unique_ptr<SwapChain> swap_chain, float backbuffer_scale)
|
||||
{
|
||||
m_state.root_signature = g_dx_context->GetGXRootSignature();
|
||||
|
||||
// Textures must be populated with null descriptors, since we copy directly from this array.
|
||||
for (u32 i = 0; i < MAX_TEXTURES; i++)
|
||||
for (u32 i = 0; i < VideoCommon::MAX_PIXEL_SHADER_SAMPLERS; i++)
|
||||
{
|
||||
m_state.textures[i].ptr = g_dx_context->GetNullSRVDescriptor().cpu_handle.ptr;
|
||||
m_state.samplers.states[i] = RenderState::GetPointSamplerState();
|
||||
@ -301,7 +300,7 @@ void Gfx::UnbindTexture(const AbstractTexture* texture)
|
||||
{
|
||||
const auto srv_shadow_descriptor =
|
||||
static_cast<const DXTexture*>(texture)->GetSRVDescriptor().cpu_handle;
|
||||
for (u32 i = 0; i < MAX_TEXTURES; i++)
|
||||
for (u32 i = 0; i < VideoCommon::MAX_PIXEL_SHADER_SAMPLERS; i++)
|
||||
{
|
||||
if (m_state.textures[i].ptr == srv_shadow_descriptor.ptr)
|
||||
{
|
||||
@ -666,15 +665,17 @@ void Gfx::UpdateDescriptorTables()
|
||||
|
||||
bool Gfx::UpdateSRVDescriptorTable()
|
||||
{
|
||||
static constexpr std::array<UINT, MAX_TEXTURES> src_sizes = {1, 1, 1, 1, 1, 1, 1, 1};
|
||||
static constexpr std::array<UINT, VideoCommon::MAX_PIXEL_SHADER_SAMPLERS> src_sizes = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1};
|
||||
DescriptorHandle dst_base_handle;
|
||||
const UINT dst_handle_sizes = 8;
|
||||
if (!g_dx_context->GetDescriptorAllocator()->Allocate(MAX_TEXTURES, &dst_base_handle))
|
||||
if (!g_dx_context->GetDescriptorAllocator()->Allocate(VideoCommon::MAX_PIXEL_SHADER_SAMPLERS,
|
||||
&dst_base_handle))
|
||||
return false;
|
||||
|
||||
g_dx_context->GetDevice()->CopyDescriptors(
|
||||
1, &dst_base_handle.cpu_handle, &dst_handle_sizes, MAX_TEXTURES, m_state.textures.data(),
|
||||
src_sizes.data(), D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
|
||||
1, &dst_base_handle.cpu_handle, &dst_handle_sizes, VideoCommon::MAX_PIXEL_SHADER_SAMPLERS,
|
||||
m_state.textures.data(), src_sizes.data(), D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
|
||||
m_state.srv_descriptor_base = dst_base_handle.gpu_handle;
|
||||
m_dirty_bits = (m_dirty_bits & ~DirtyState_Textures) | DirtyState_SRV_Descriptor;
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user