mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-12 22:08:59 +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()
|
||||
: nullptr
|
||||
] (DxvkContext* ctx) mutable {
|
||||
VkShaderStageFlagBits stage = GetShaderStage(ShaderStage);
|
||||
constexpr VkShaderStageFlagBits stage = GetShaderStage(ShaderStage);
|
||||
|
||||
uint32_t slotId = computeConstantBufferBinding(ShaderStage,
|
||||
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 features = 0;
|
||||
|
||||
|
@ -31,9 +31,6 @@ namespace dxvk {
|
||||
VkConservativeRasterizationModeEXT DecodeConservativeRasterizationMode(
|
||||
D3D11_CONSERVATIVE_RASTERIZATION_MODE Mode);
|
||||
|
||||
VkShaderStageFlagBits GetShaderStage(
|
||||
DxbcProgramType ProgramType);
|
||||
|
||||
VkFormatFeatureFlags GetBufferFormatFeatures(
|
||||
UINT BindFlags);
|
||||
|
||||
@ -43,4 +40,22 @@ namespace dxvk {
|
||||
VkFormat GetPackedDepthStencilFormat(
|
||||
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([
|
||||
cShader = pShaderModule->GetShader(Permutation)
|
||||
] (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;
|
||||
}
|
||||
|
||||
inline VkShaderStageFlagBits GetShaderStage(DxsoProgramType ProgramType) {
|
||||
constexpr VkShaderStageFlagBits GetShaderStage(DxsoProgramType ProgramType) {
|
||||
switch (ProgramType) {
|
||||
case DxsoProgramTypes::VertexShader: return VK_SHADER_STAGE_VERTEX_BIT;
|
||||
case DxsoProgramTypes::PixelShader: return VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
|
Loading…
Reference in New Issue
Block a user