1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-01 17:52:13 +01:00
dxvk/src/dxso/dxso_util.h
Joshua Ashton c0c1565cba [d3d9, dxso] Alias color and depth samplers and improve tracking
Takes me from 340 -> 460fps in A Hat in Time's main menu when CPU bound.
2021-08-10 23:46:03 +00:00

47 lines
1.1 KiB
C++

#pragma once
#include <cstdint>
#include "dxso_common.h"
#include "dxso_decoder.h"
namespace dxvk {
enum class DxsoBindingType : uint32_t {
ConstantBuffer,
Image,
};
enum DxsoConstantBuffers : uint32_t {
VSConstantBuffer = 0,
VSClipPlanes = 1,
VSFixedFunction = 2,
VSVertexBlendData = 3,
VSCount,
PSConstantBuffer = 0,
PSFixedFunction = 1,
PSShared = 2,
PSCount
};
constexpr uint32_t computeResourceSlotId(
DxsoProgramType shaderStage,
DxsoBindingType bindingType,
uint32_t bindingIndex) {
const uint32_t stageOffset = 8 * uint32_t(shaderStage);
if (bindingType == DxsoBindingType::ConstantBuffer)
return bindingIndex + stageOffset;
else // if (bindingType == DxsoBindingType::Image)
return bindingIndex + stageOffset + (shaderStage == DxsoProgramType::PixelShader ? PSCount : VSCount);
}
// TODO: Intergrate into compute resource slot ID/refactor all of this?
constexpr uint32_t getSWVPBufferSlot() {
return 27; // From last pixel shader slot, above.
}
uint32_t RegisterLinkerSlot(DxsoSemantic semantic);
}