Add HasDepthClip to GPU Device limits
This commit is contained in:
@@ -259,6 +259,11 @@ API_STRUCT() struct GPULimits
|
||||
/// </summary>
|
||||
API_FIELD() bool HasDepthAsSRV;
|
||||
|
||||
/// <summary>
|
||||
/// True if device supports depth buffer clipping (see GPUPipelineState::Description::DepthClipEnable).
|
||||
/// </summary>
|
||||
API_FIELD() bool HasDepthClip;
|
||||
|
||||
/// <summary>
|
||||
/// True if device supports depth buffer texture as a readonly depth buffer (can be sampled in the shader while performing depth-test).
|
||||
/// </summary>
|
||||
|
||||
@@ -359,6 +359,7 @@ bool GPUDeviceDX11::Init()
|
||||
limits.HasAppendConsumeBuffers = true;
|
||||
limits.HasSeparateRenderTargetBlendState = true;
|
||||
limits.HasDepthAsSRV = true;
|
||||
limits.HasDepthClip = true;
|
||||
limits.HasReadOnlyDepth = true;
|
||||
limits.HasMultisampleDepthAsSRV = true;
|
||||
limits.HasTypedUAVLoad = featureDataD3D11Options2.TypedUAVLoadAdditionalFormats != 0;
|
||||
@@ -382,6 +383,7 @@ bool GPUDeviceDX11::Init()
|
||||
limits.HasAppendConsumeBuffers = false;
|
||||
limits.HasSeparateRenderTargetBlendState = false;
|
||||
limits.HasDepthAsSRV = false;
|
||||
limits.HasDepthClip = true;
|
||||
limits.HasReadOnlyDepth = createdFeatureLevel == D3D_FEATURE_LEVEL_10_1;
|
||||
limits.HasMultisampleDepthAsSRV = false;
|
||||
limits.HasTypedUAVLoad = false;
|
||||
|
||||
@@ -381,6 +381,7 @@ bool GPUDeviceDX12::Init()
|
||||
limits.HasAppendConsumeBuffers = true;
|
||||
limits.HasSeparateRenderTargetBlendState = true;
|
||||
limits.HasDepthAsSRV = true;
|
||||
limits.HasDepthClip = true;
|
||||
limits.HasReadOnlyDepth = true;
|
||||
limits.HasMultisampleDepthAsSRV = true;
|
||||
limits.HasTypedUAVLoad = options.TypedUAVLoadAdditionalFormats != 0;
|
||||
|
||||
@@ -50,18 +50,7 @@ bool GPUDeviceNull::Init()
|
||||
// Init device limits
|
||||
{
|
||||
auto& limits = Limits;
|
||||
limits.HasCompute = false;
|
||||
limits.HasTessellation = false;
|
||||
limits.HasGeometryShaders = false;
|
||||
limits.HasInstancing = false;
|
||||
limits.HasVolumeTextureRendering = false;
|
||||
limits.HasDrawIndirect = false;
|
||||
limits.HasAppendConsumeBuffers = false;
|
||||
limits.HasSeparateRenderTargetBlendState = false;
|
||||
limits.HasDepthAsSRV = false;
|
||||
limits.HasReadOnlyDepth = false;
|
||||
limits.HasMultisampleDepthAsSRV = false;
|
||||
limits.HasTypedUAVLoad = false;
|
||||
Platform::MemoryClear(&limits, sizeof(limits));
|
||||
limits.MaximumMipLevelsCount = 14;
|
||||
limits.MaximumTexture1DSize = 8192;
|
||||
limits.MaximumTexture1DArraySize = 512;
|
||||
@@ -70,11 +59,8 @@ bool GPUDeviceNull::Init()
|
||||
limits.MaximumTexture3DSize = 2048;
|
||||
limits.MaximumTextureCubeSize = 16384;
|
||||
limits.MaximumSamplerAnisotropy = 1;
|
||||
|
||||
for (int32 i = 0; i < static_cast<int32>(PixelFormat::MAX); i++)
|
||||
{
|
||||
FeaturesPerFormat[i] = FormatFeatures(static_cast<PixelFormat>(i), MSAALevel::None, FormatSupport::None);
|
||||
}
|
||||
}
|
||||
|
||||
// Create main context
|
||||
|
||||
@@ -1704,6 +1704,7 @@ bool GPUDeviceVulkan::Init()
|
||||
limits.HasDrawIndirect = PhysicalDeviceLimits.maxDrawIndirectCount >= 1;
|
||||
limits.HasAppendConsumeBuffers = false; // TODO: add Append Consume buffers support for Vulkan
|
||||
limits.HasSeparateRenderTargetBlendState = true;
|
||||
limits.HasDepthClip = PhysicalDeviceFeatures.depthClamp;
|
||||
limits.HasDepthAsSRV = true;
|
||||
limits.HasReadOnlyDepth = true;
|
||||
limits.HasMultisampleDepthAsSRV = !!PhysicalDeviceFeatures.sampleRateShading;
|
||||
|
||||
@@ -340,7 +340,7 @@ bool GPUPipelineStateVulkan::Init(const Description& desc)
|
||||
break;
|
||||
}
|
||||
_descRasterization.frontFace = VK_FRONT_FACE_CLOCKWISE;
|
||||
_descRasterization.depthClampEnable = !desc.DepthClipEnable;
|
||||
_descRasterization.depthClampEnable = !desc.DepthClipEnable && _device->Limits.HasDepthClip;
|
||||
_descRasterization.lineWidth = 1.0f;
|
||||
_desc.pRasterizationState = &_descRasterization;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user