Refactor enum flags with __underlying_type and new EnumHasAnyFlags/EnumHasAllFlags

Fixes #832
Closes #886
This commit is contained in:
Wojtek Figat
2023-01-15 12:44:39 +01:00
parent 810f7fb803
commit f127bbebe1
101 changed files with 424 additions and 414 deletions

View File

@@ -51,7 +51,7 @@ void ForwardMaterialShader::Bind(BindParameters& params)
int32 srv = 2;
// Setup features
if (_info.FeaturesFlags & MaterialFeaturesFlags::GlobalIllumination)
if ((_info.FeaturesFlags & MaterialFeaturesFlags::GlobalIllumination) != MaterialFeaturesFlags::None)
GlobalIlluminationFeature::Bind(params, cb, srv);
ForwardShadingFeature::Bind(params, cb, srv);
@@ -92,7 +92,7 @@ void ForwardMaterialShader::Bind(BindParameters& params)
}
// Select pipeline state based on current pass and render mode
const bool wireframe = (_info.FeaturesFlags & MaterialFeaturesFlags::Wireframe) != 0 || view.Mode == ViewMode::Wireframe;
const bool wireframe = (_info.FeaturesFlags & MaterialFeaturesFlags::Wireframe) != MaterialFeaturesFlags::None || view.Mode == ViewMode::Wireframe;
CullMode cullMode = view.Pass == DrawPass::Depth ? CullMode::TwoSided : _info.CullMode;
#if USE_EDITOR
if (IsRunningRadiancePass)
@@ -130,8 +130,8 @@ bool ForwardMaterialShader::Load()
_drawModes = DrawPass::Depth | DrawPass::Forward | DrawPass::QuadOverdraw;
auto psDesc = GPUPipelineState::Description::Default;
psDesc.DepthTestEnable = (_info.FeaturesFlags & MaterialFeaturesFlags::DisableDepthTest) == 0;
psDesc.DepthWriteEnable = (_info.FeaturesFlags & MaterialFeaturesFlags::DisableDepthWrite) == 0;
psDesc.DepthTestEnable = (_info.FeaturesFlags & MaterialFeaturesFlags::DisableDepthTest) == MaterialFeaturesFlags::None;
psDesc.DepthWriteEnable = (_info.FeaturesFlags & MaterialFeaturesFlags::DisableDepthWrite) == MaterialFeaturesFlags::None;
// Check if use tessellation (both material and runtime supports it)
const bool useTess = _info.TessellationMode != TessellationMethod::None && GPUDevice::Instance->Limits.HasTessellation;