1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[dxvk] Increase UAV slot count to 64 for the graphics pipeline

D3D11 raised this limit from 8 UAVs in the fragment shader to
64 UAVs in all graphics stages combined.
This commit is contained in:
Philip Rebohle 2018-03-21 04:56:33 +01:00
parent bd71f256e5
commit 17e981f360
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 13 additions and 16 deletions

View File

@ -2682,8 +2682,8 @@ namespace dxvk {
RestoreShaderResources(DxbcProgramType::PixelShader, m_state.ps.shaderResources); RestoreShaderResources(DxbcProgramType::PixelShader, m_state.ps.shaderResources);
RestoreShaderResources(DxbcProgramType::ComputeShader, m_state.cs.shaderResources); RestoreShaderResources(DxbcProgramType::ComputeShader, m_state.cs.shaderResources);
RestoreUnorderedAccessViews(DxbcProgramType::PixelShader, m_state.ps.unorderedAccessViews, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT); RestoreUnorderedAccessViews(DxbcProgramType::PixelShader, m_state.ps.unorderedAccessViews);
RestoreUnorderedAccessViews(DxbcProgramType::ComputeShader, m_state.cs.unorderedAccessViews, D3D11_1_UAV_SLOT_COUNT); RestoreUnorderedAccessViews(DxbcProgramType::ComputeShader, m_state.cs.unorderedAccessViews);
} }
@ -2722,15 +2722,14 @@ namespace dxvk {
void D3D11DeviceContext::RestoreUnorderedAccessViews( void D3D11DeviceContext::RestoreUnorderedAccessViews(
DxbcProgramType Stage, DxbcProgramType Stage,
D3D11UnorderedAccessBindings& Bindings, D3D11UnorderedAccessBindings& Bindings) {
UINT SlotCount) {
const uint32_t uavSlotId = computeResourceSlotId( const uint32_t uavSlotId = computeResourceSlotId(
Stage, DxbcBindingType::UnorderedAccessView, 0); Stage, DxbcBindingType::UnorderedAccessView, 0);
const uint32_t ctrSlotId = computeResourceSlotId( const uint32_t ctrSlotId = computeResourceSlotId(
Stage, DxbcBindingType::UavCounter, 0); Stage, DxbcBindingType::UavCounter, 0);
for (uint32_t i = 0; i < SlotCount; i++) { for (uint32_t i = 0; i < Bindings.size(); i++) {
BindUnorderedAccessView( BindUnorderedAccessView(
uavSlotId + i, ctrSlotId + i, uavSlotId + i, ctrSlotId + i,
Bindings[i].ptr()); Bindings[i].ptr());

View File

@ -767,8 +767,7 @@ namespace dxvk {
void RestoreUnorderedAccessViews( void RestoreUnorderedAccessViews(
DxbcProgramType Stage, DxbcProgramType Stage,
D3D11UnorderedAccessBindings& Bindings, D3D11UnorderedAccessBindings& Bindings);
UINT SlotCount);
DxvkDataSlice AllocUpdateBufferSlice(size_t Size); DxvkDataSlice AllocUpdateBufferSlice(size_t Size);

View File

@ -6,13 +6,14 @@ namespace dxvk {
DxbcProgramType shaderStage, DxbcProgramType shaderStage,
DxbcBindingType bindingType, DxbcBindingType bindingType,
uint32_t bindingIndex) { uint32_t bindingIndex) {
// First resource slot index for per-stage resources
const uint32_t stageOffset = 132 + 158 * static_cast<uint32_t>(shaderStage);
if (shaderStage == DxbcProgramType::ComputeShader) { if (shaderStage == DxbcProgramType::ComputeShader) {
// 0 - 13: Constant buffers // 0 - 13: Constant buffers
// 14 - 29: Samplers // 14 - 29: Samplers
// 30 - 157: Shader resources // 30 - 157: Shader resources
// 158 - 221: Uniform access views // 158 - 221: Unordered access views
const uint32_t stageOffset = 20 + 158 * 5;
switch (bindingType) { switch (bindingType) {
case DxbcBindingType::ConstantBuffer: return bindingIndex + stageOffset + 0; case DxbcBindingType::ConstantBuffer: return bindingIndex + stageOffset + 0;
case DxbcBindingType::ImageSampler: return bindingIndex + stageOffset + 14; case DxbcBindingType::ImageSampler: return bindingIndex + stageOffset + 14;
@ -23,15 +24,13 @@ namespace dxvk {
} }
} else { } else {
// Global resource slots // Global resource slots
// 0 - 7: Unordered access views // 0 - 3: Stream output buffers
// 8 - 15: UAV counter buffers // 4 - 67: Unordered access views
// 16 - 19: Stream output buffers // 68 - 131: UAV counter buffers
// Per-stage resource slots: // Per-stage resource slots:
// 0 - 13: Constant buffers // 0 - 13: Constant buffers
// 14 - 29: Samplers // 14 - 29: Samplers
// 30 - 157: Shader resources // 30 - 157: Shader resources
const uint32_t stageOffset = 20 + 158 * static_cast<uint32_t>(shaderStage);
switch (bindingType) { switch (bindingType) {
case DxbcBindingType::UnorderedAccessView:return bindingIndex + 0; case DxbcBindingType::UnorderedAccessView:return bindingIndex + 0;
case DxbcBindingType::UavCounter: return bindingIndex + 8; case DxbcBindingType::UavCounter: return bindingIndex + 8;

View File

@ -10,7 +10,7 @@ namespace dxvk {
MaxNumVertexBindings = 32, MaxNumVertexBindings = 32,
MaxNumOutputStreams = 4, MaxNumOutputStreams = 4,
MaxNumViewports = 16, MaxNumViewports = 16,
MaxNumResourceSlots = 1096, MaxNumResourceSlots = 1208,
MaxNumActiveBindings = 128, MaxNumActiveBindings = 128,
MaxNumQueuedCommandBuffers = 8, MaxNumQueuedCommandBuffers = 8,
MaxNumQueryCountPerPool = 128, MaxNumQueryCountPerPool = 128,