Add statically disabled tessellation on macOS/iOS

This commit is contained in:
Wojtek Figat
2024-03-30 18:46:37 +01:00
parent ce07edd1ec
commit 369c19bd5d
14 changed files with 51 additions and 20 deletions

View File

@@ -40,13 +40,23 @@
// True if allow graphics profile events and markers
#define GPU_ALLOW_PROFILE_EVENTS (!BUILD_RELEASE)
// True if allow hardware tessellation shaders (Hull and Domain shaders)
#ifndef GPU_ALLOW_TESSELLATION_SHADERS
#define GPU_ALLOW_TESSELLATION_SHADERS 1
#endif
// Enable/disable creating GPU resources on separate threads (otherwise only the main thread can be used)
#define GPU_ENABLE_ASYNC_RESOURCES_CREATION 1
// Enable/disable force shaders recompilation
#define GPU_FORCE_RECOMPILE_SHADERS 0
// Default back buffer pixel format
// Define default back buffer(s) format
#ifndef GPU_BACK_BUFFER_PIXEL_FORMAT
#define GPU_BACK_BUFFER_PIXEL_FORMAT PixelFormat::B8G8R8A8_UNorm
#endif
// Default depth buffer pixel format
#ifndef GPU_DEPTH_BUFFER_PIXEL_FORMAT
#define GPU_DEPTH_BUFFER_PIXEL_FORMAT PixelFormat::D32_Float
#endif
@@ -62,11 +72,6 @@
#define GPU_MAX_TEXTURE_MIP_LEVELS 15
#define GPU_MAX_TEXTURE_ARRAY_SIZE 1024
// Define default back buffer(s) format
#ifndef GPU_BACK_BUFFER_PIXEL_FORMAT
#define GPU_BACK_BUFFER_PIXEL_FORMAT PixelFormat::B8G8R8A8_UNorm
#endif
// Validate configuration
#if !ENABLE_ASSERTION
#undef GPU_ENABLE_ASSERTION

View File

@@ -146,6 +146,7 @@ bool DeferredMaterialShader::Load()
psDesc.DepthEnable = false;
}
#if GPU_ALLOW_TESSELLATION_SHADERS
// Check if use tessellation (both material and runtime supports it)
const bool useTess = _info.TessellationMode != TessellationMethod::None && GPUDevice::Instance->Limits.HasTessellation;
if (useTess)
@@ -153,6 +154,7 @@ bool DeferredMaterialShader::Load()
psDesc.HS = _shader->GetHS("HS");
psDesc.DS = _shader->GetDS("DS");
}
#endif
// GBuffer Pass
psDesc.VS = _shader->GetVS("VS");

View File

@@ -115,6 +115,7 @@ bool DeformableMaterialShader::Load()
psDesc.DepthEnable = (_info.FeaturesFlags & MaterialFeaturesFlags::DisableDepthTest) == MaterialFeaturesFlags::None;
psDesc.DepthWriteEnable = (_info.FeaturesFlags & MaterialFeaturesFlags::DisableDepthWrite) == MaterialFeaturesFlags::None;
#if GPU_ALLOW_TESSELLATION_SHADERS
// Check if use tessellation (both material and runtime supports it)
const bool useTess = _info.TessellationMode != TessellationMethod::None && GPUDevice::Instance->Limits.HasTessellation;
if (useTess)
@@ -122,6 +123,7 @@ bool DeformableMaterialShader::Load()
psDesc.HS = _shader->GetHS("HS");
psDesc.DS = _shader->GetDS("DS");
}
#endif
#if USE_EDITOR
if (_shader->HasShader("PS_QuadOverdraw"))

View File

@@ -133,6 +133,7 @@ bool ForwardMaterialShader::Load()
psDesc.DepthEnable = (_info.FeaturesFlags & MaterialFeaturesFlags::DisableDepthTest) == MaterialFeaturesFlags::None;
psDesc.DepthWriteEnable = (_info.FeaturesFlags & MaterialFeaturesFlags::DisableDepthWrite) == MaterialFeaturesFlags::None;
#if GPU_ALLOW_TESSELLATION_SHADERS
// Check if use tessellation (both material and runtime supports it)
const bool useTess = _info.TessellationMode != TessellationMethod::None && GPUDevice::Instance->Limits.HasTessellation;
if (useTess)
@@ -140,6 +141,7 @@ bool ForwardMaterialShader::Load()
psDesc.HS = _shader->GetHS("HS");
psDesc.DS = _shader->GetDS("DS");
}
#endif
#if USE_EDITOR
if (_shader->HasShader("PS_QuadOverdraw"))

View File

@@ -136,6 +136,7 @@ bool TerrainMaterialShader::Load()
psDesc.DepthEnable = (_info.FeaturesFlags & MaterialFeaturesFlags::DisableDepthTest) == MaterialFeaturesFlags::None;
psDesc.DepthWriteEnable = (_info.FeaturesFlags & MaterialFeaturesFlags::DisableDepthWrite) == MaterialFeaturesFlags::None;
#if GPU_ALLOW_TESSELLATION_SHADERS
// Check if use tessellation (both material and runtime supports it)
const bool useTess = _info.TessellationMode != TessellationMethod::None && GPUDevice::Instance->Limits.HasTessellation;
if (useTess)
@@ -143,6 +144,7 @@ bool TerrainMaterialShader::Load()
psDesc.HS = _shader->GetHS("HS");
psDesc.DS = _shader->GetDS("DS");
}
#endif
// Support blending but then use only emissive channel
switch (_info.BlendMode)

View File

@@ -126,6 +126,10 @@ bool GPUShader::Create(MemoryReadStream& stream)
LOG(Warning, "Failed to create {} Shader program '{}' ({}).", ::ToString(type), String(initializer.Name), name);
continue;
}
#if !GPU_ALLOW_TESSELLATION_SHADERS
if (type == ShaderStage::Hull || type == ShaderStage::Domain)
continue;
#endif
GPUShaderProgram* shader = CreateGPUShaderProgram(type, initializer, cache, cacheSize, stream);
if (shader == nullptr)
{