Renderer: Add pipeline and texture sampler info validation
This commit is contained in:
@@ -31,4 +31,25 @@ namespace Nz
|
||||
|
||||
return InstantiateShaderModule(shaderStages, lang, source.data(), source.size(), states);
|
||||
}
|
||||
|
||||
void RenderDevice::ValidateFeatures(const RenderDeviceFeatures& supportedFeatures, RenderDeviceFeatures& enabledFeatures)
|
||||
{
|
||||
if (enabledFeatures.anisotropicFiltering && !supportedFeatures.anisotropicFiltering)
|
||||
{
|
||||
NazaraWarning("anistropic filtering was enabled but device doesn't support it, disabling...");
|
||||
enabledFeatures.anisotropicFiltering = false;
|
||||
}
|
||||
|
||||
if (enabledFeatures.depthClamping && !supportedFeatures.depthClamping)
|
||||
{
|
||||
NazaraWarning("depth clamping was enabled but device doesn't support it, disabling...");
|
||||
enabledFeatures.depthClamping = false;
|
||||
}
|
||||
|
||||
if (enabledFeatures.nonSolidFaceFilling && !supportedFeatures.nonSolidFaceFilling)
|
||||
{
|
||||
NazaraWarning("non-solid face filling was enabled but device doesn't support it, disabling...");
|
||||
enabledFeatures.nonSolidFaceFilling = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,26 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/RenderPipeline.hpp>
|
||||
#include <Nazara/Renderer/RenderDevice.hpp>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
RenderPipeline::~RenderPipeline() = default;
|
||||
|
||||
void RenderPipeline::ValidatePipelineInfo(const RenderDevice& device, RenderPipelineInfo& pipelineInfo)
|
||||
{
|
||||
const RenderDeviceFeatures& deviceFeatures = device.GetEnabledFeatures();
|
||||
if (pipelineInfo.faceFilling != FaceFilling::Fill && !deviceFeatures.nonSolidFaceFilling)
|
||||
{
|
||||
NazaraWarning("pipeline has face filling set to non-solid but non-solid face filling is not enabled on the device, disabling...");
|
||||
pipelineInfo.faceFilling = FaceFilling::Fill;
|
||||
}
|
||||
|
||||
if (pipelineInfo.depthClamp && !deviceFeatures.depthClamping)
|
||||
{
|
||||
NazaraWarning("pipeline has depth clamp enabled but depth clamping is not enabled on the device, disabling...");
|
||||
pipelineInfo.depthClamp = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,20 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/TextureSampler.hpp>
|
||||
#include <Nazara/Renderer/RenderDevice.hpp>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
TextureSampler::~TextureSampler() = default;
|
||||
|
||||
void TextureSampler::ValidateSamplerInfo(const RenderDevice& device, TextureSamplerInfo& samplerInfo)
|
||||
{
|
||||
const RenderDeviceFeatures& deviceFeatures = device.GetEnabledFeatures();
|
||||
if (samplerInfo.anisotropyLevel > 1.f && !deviceFeatures.anisotropicFiltering)
|
||||
{
|
||||
NazaraWarning("texture sampler has anistropy level > 1.0 but anistropic filtering is not enabled on the device, disabling...");
|
||||
samplerInfo.anisotropyLevel = 0.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user