2019-12-16 03:28:01 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
#include "dxso_common.h"
|
|
|
|
#include "dxso_decoder.h"
|
|
|
|
|
2021-11-14 14:09:28 +01:00
|
|
|
#include "../d3d9/d3d9_caps.h"
|
|
|
|
|
2019-12-16 03:28:01 +00:00
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
enum class DxsoBindingType : uint32_t {
|
|
|
|
ConstantBuffer,
|
2021-08-08 04:52:36 +01:00
|
|
|
Image,
|
2019-12-16 03:28:01 +00:00
|
|
|
};
|
|
|
|
|
2021-09-08 23:33:23 +02:00
|
|
|
enum class DxsoConstantBufferType : uint32_t {
|
|
|
|
Float,
|
|
|
|
Int,
|
|
|
|
Bool
|
|
|
|
};
|
|
|
|
|
2019-12-16 03:28:01 +00:00
|
|
|
enum DxsoConstantBuffers : uint32_t {
|
|
|
|
VSConstantBuffer = 0,
|
2021-09-08 23:33:23 +02:00
|
|
|
VSFloatConstantBuffer = 0,
|
|
|
|
VSIntConstantBuffer = 1,
|
|
|
|
VSBoolConstantBuffer = 2,
|
|
|
|
VSClipPlanes = 3,
|
|
|
|
VSFixedFunction = 4,
|
|
|
|
VSVertexBlendData = 5,
|
2019-12-16 03:28:01 +00:00
|
|
|
VSCount,
|
|
|
|
|
|
|
|
PSConstantBuffer = 0,
|
|
|
|
PSFixedFunction = 1,
|
|
|
|
PSShared = 2,
|
|
|
|
PSCount
|
|
|
|
};
|
|
|
|
|
2021-08-08 04:52:36 +01:00
|
|
|
constexpr uint32_t computeResourceSlotId(
|
|
|
|
DxsoProgramType shaderStage,
|
|
|
|
DxsoBindingType bindingType,
|
|
|
|
uint32_t bindingIndex) {
|
2021-11-14 14:09:28 +01:00
|
|
|
const uint32_t stageOffset = (DxsoConstantBuffers::VSCount + caps::MaxTexturesVS) * uint32_t(shaderStage);
|
2021-08-08 04:52:36 +01:00
|
|
|
|
|
|
|
if (bindingType == DxsoBindingType::ConstantBuffer)
|
|
|
|
return bindingIndex + stageOffset;
|
|
|
|
else // if (bindingType == DxsoBindingType::Image)
|
2021-11-14 14:09:28 +01:00
|
|
|
return bindingIndex + stageOffset + (shaderStage == DxsoProgramType::PixelShader ? DxsoConstantBuffers::PSCount : DxsoConstantBuffers::VSCount);
|
2021-08-08 04:52:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Intergrate into compute resource slot ID/refactor all of this?
|
|
|
|
constexpr uint32_t getSWVPBufferSlot() {
|
2021-11-14 14:09:28 +01:00
|
|
|
return DxsoConstantBuffers::VSCount + caps::MaxTexturesVS + DxsoConstantBuffers::PSCount + caps::MaxTexturesPS + 1; // From last pixel shader slot, above.
|
2021-08-08 04:52:36 +01:00
|
|
|
}
|
2019-12-16 03:28:01 +00:00
|
|
|
|
|
|
|
uint32_t RegisterLinkerSlot(DxsoSemantic semantic);
|
|
|
|
|
|
|
|
}
|