mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-13 16:08:50 +01:00
[d3d9,d3d11] Make GetShaderStage functions constexpr
This commit is contained in:
parent
12c2d24d5c
commit
29a2cb9a5e
@ -3120,7 +3120,7 @@ namespace dxvk {
|
|||||||
? pShaderModule->GetShader()
|
? pShaderModule->GetShader()
|
||||||
: nullptr
|
: nullptr
|
||||||
] (DxvkContext* ctx) mutable {
|
] (DxvkContext* ctx) mutable {
|
||||||
VkShaderStageFlagBits stage = GetShaderStage(ShaderStage);
|
constexpr VkShaderStageFlagBits stage = GetShaderStage(ShaderStage);
|
||||||
|
|
||||||
uint32_t slotId = computeConstantBufferBinding(ShaderStage,
|
uint32_t slotId = computeConstantBufferBinding(ShaderStage,
|
||||||
D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
|
D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
|
||||||
|
@ -78,19 +78,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VkShaderStageFlagBits GetShaderStage(DxbcProgramType ProgramType) {
|
|
||||||
switch (ProgramType) {
|
|
||||||
case DxbcProgramType::VertexShader: return VK_SHADER_STAGE_VERTEX_BIT;
|
|
||||||
case DxbcProgramType::HullShader: return VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
|
|
||||||
case DxbcProgramType::DomainShader: return VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT;
|
|
||||||
case DxbcProgramType::GeometryShader: return VK_SHADER_STAGE_GEOMETRY_BIT;
|
|
||||||
case DxbcProgramType::PixelShader: return VK_SHADER_STAGE_FRAGMENT_BIT;
|
|
||||||
case DxbcProgramType::ComputeShader: return VK_SHADER_STAGE_COMPUTE_BIT;
|
|
||||||
default: return VkShaderStageFlagBits(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
VkFormatFeatureFlags GetBufferFormatFeatures(UINT BindFlags) {
|
VkFormatFeatureFlags GetBufferFormatFeatures(UINT BindFlags) {
|
||||||
VkFormatFeatureFlags features = 0;
|
VkFormatFeatureFlags features = 0;
|
||||||
|
|
||||||
|
@ -31,9 +31,6 @@ namespace dxvk {
|
|||||||
VkConservativeRasterizationModeEXT DecodeConservativeRasterizationMode(
|
VkConservativeRasterizationModeEXT DecodeConservativeRasterizationMode(
|
||||||
D3D11_CONSERVATIVE_RASTERIZATION_MODE Mode);
|
D3D11_CONSERVATIVE_RASTERIZATION_MODE Mode);
|
||||||
|
|
||||||
VkShaderStageFlagBits GetShaderStage(
|
|
||||||
DxbcProgramType ProgramType);
|
|
||||||
|
|
||||||
VkFormatFeatureFlags GetBufferFormatFeatures(
|
VkFormatFeatureFlags GetBufferFormatFeatures(
|
||||||
UINT BindFlags);
|
UINT BindFlags);
|
||||||
|
|
||||||
@ -43,4 +40,22 @@ namespace dxvk {
|
|||||||
VkFormat GetPackedDepthStencilFormat(
|
VkFormat GetPackedDepthStencilFormat(
|
||||||
DXGI_FORMAT Format);
|
DXGI_FORMAT Format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Translates D3D11 shader stage to corresponding Vulkan stage
|
||||||
|
*
|
||||||
|
* \param [in] ProgramType DXBC program type
|
||||||
|
* \returns Corresponding Vulkan shader stage
|
||||||
|
*/
|
||||||
|
constexpr VkShaderStageFlagBits GetShaderStage(DxbcProgramType ProgramType) {
|
||||||
|
switch (ProgramType) {
|
||||||
|
case DxbcProgramType::VertexShader: return VK_SHADER_STAGE_VERTEX_BIT;
|
||||||
|
case DxbcProgramType::HullShader: return VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
|
||||||
|
case DxbcProgramType::DomainShader: return VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT;
|
||||||
|
case DxbcProgramType::GeometryShader: return VK_SHADER_STAGE_GEOMETRY_BIT;
|
||||||
|
case DxbcProgramType::PixelShader: return VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||||
|
case DxbcProgramType::ComputeShader: return VK_SHADER_STAGE_COMPUTE_BIT;
|
||||||
|
default: return VkShaderStageFlagBits(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -6130,7 +6130,8 @@ namespace dxvk {
|
|||||||
EmitCs([
|
EmitCs([
|
||||||
cShader = pShaderModule->GetShader(Permutation)
|
cShader = pShaderModule->GetShader(Permutation)
|
||||||
] (DxvkContext* ctx) mutable {
|
] (DxvkContext* ctx) mutable {
|
||||||
ctx->bindShader(GetShaderStage(ShaderStage), std::move(cShader));
|
constexpr VkShaderStageFlagBits stage = GetShaderStage(ShaderStage);
|
||||||
|
ctx->bindShader(stage, std::move(cShader));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ namespace dxvk {
|
|||||||
return srgb ? srgbFormat : format;
|
return srgb ? srgbFormat : format;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline VkShaderStageFlagBits GetShaderStage(DxsoProgramType ProgramType) {
|
constexpr VkShaderStageFlagBits GetShaderStage(DxsoProgramType ProgramType) {
|
||||||
switch (ProgramType) {
|
switch (ProgramType) {
|
||||||
case DxsoProgramTypes::VertexShader: return VK_SHADER_STAGE_VERTEX_BIT;
|
case DxsoProgramTypes::VertexShader: return VK_SHADER_STAGE_VERTEX_BIT;
|
||||||
case DxsoProgramTypes::PixelShader: return VK_SHADER_STAGE_FRAGMENT_BIT;
|
case DxsoProgramTypes::PixelShader: return VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||||
|
Loading…
Reference in New Issue
Block a user