Skip to content

Commit

Permalink
Merge branch 'master' into vulkan13
Browse files Browse the repository at this point in the history
  • Loading branch information
hyazinthh committed Apr 24, 2024
2 parents 6b10ce2 + ea7f522 commit 5217787
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/Aardvark.Rendering.Vulkan/Core/Platform.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ module Instance =
let ShaderSubgroupVote = EXTShaderSubgroupVote.Name
let ShaderSubgroupBallot = EXTShaderSubgroupBallot.Name

let ConservativeRasterization = EXTConservativeRasterization.Name

let Debug = [
EXTDebugReport.Name
EXTDebugUtils.Name
Expand Down
26 changes: 16 additions & 10 deletions src/Aardvark.Rendering.Vulkan/Management/ResourceManager.fs
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,8 @@ module Resources =
inherit AbstractPointerResourceWithEquality<VkPipelineRasterizationStateCreateInfo>(owner, key)

override x.Free(info : VkPipelineRasterizationStateCreateInfo) =
Marshal.FreeHGlobal info.pNext
if info.pNext <> 0n then
Marshal.FreeHGlobal info.pNext

override x.Compute(user, token, renderToken) =
let depthClamp = depthClamp.GetValue(user, token, renderToken)
Expand All @@ -977,18 +978,23 @@ module Resources =
let conservativeRaster = conservativeRaster.GetValue(user, token, renderToken)
let state = RasterizerState.create conservativeRaster depthClamp bias cull front fill

let conservativeRaster =
VkPipelineRasterizationConservativeStateCreateInfoEXT(
VkPipelineRasterizationConservativeStateCreateFlagsEXT.None,
(if conservativeRaster then VkConservativeRasterizationModeEXT.Overestimate else VkConservativeRasterizationModeEXT.Disabled),
0.0f
)
let pConservativeRaster =
if conservativeRaster then
let info =
VkPipelineRasterizationConservativeStateCreateInfoEXT(
VkPipelineRasterizationConservativeStateCreateFlagsEXT.None,
VkConservativeRasterizationModeEXT.Overestimate,
0.0f
)

let pConservativeRaster = NativePtr.alloc<VkPipelineRasterizationConservativeStateCreateInfoEXT> 1
conservativeRaster |> NativePtr.write pConservativeRaster
let ptr = NativePtr.alloc<VkPipelineRasterizationConservativeStateCreateInfoEXT> 1
info |> NativePtr.write ptr
NativePtr.toNativeInt ptr
else
0n

VkPipelineRasterizationStateCreateInfo(
NativePtr.toNativeInt pConservativeRaster,
pConservativeRaster,
VkPipelineRasterizationStateCreateFlags.None,
(if state.depthClampEnable then 1u else 0u),
(if state.rasterizerDiscardEnable then 1u else 0u),
Expand Down
1 change: 1 addition & 0 deletions src/Aardvark.Rendering.Vulkan/Runtime/Headless.fs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type HeadlessVulkanApplication(debug : IDebugConfig, instanceExtensions : list<s
yield Instance.Extensions.ShaderSubgroupVote
yield Instance.Extensions.ShaderSubgroupBallot
yield Instance.Extensions.GetPhysicalDeviceProperties2
yield Instance.Extensions.ConservativeRasterization

yield! Instance.Extensions.Raytracing
yield! Instance.Extensions.Sharing
Expand Down
8 changes: 4 additions & 4 deletions src/Aardvark.SceneGraph/Pools/ManagedTracePool.fs
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ and ManagedTracePool(runtime : IRuntime, signature : TraceObjectSignature,
member x.GetVertexAttribute(semantic : Symbol) =
match x.TryGetVertexAttribute semantic with
| Some attr -> attr
| None _ -> failf "could not find vertex attribute '%A'" semantic
| None -> failf "could not find vertex attribute '%A'" semantic

member x.TryGetFaceAttribute(semantic : Symbol) =
faceAttributeBuffers |> Map.tryFind semantic
Expand All @@ -781,7 +781,7 @@ and ManagedTracePool(runtime : IRuntime, signature : TraceObjectSignature,
member x.GetFaceAttribute(semantic : Symbol) =
match x.TryGetFaceAttribute semantic with
| Some attr -> attr
| None _ -> failf "could not find face attribute '%A'" semantic
| None -> failf "could not find face attribute '%A'" semantic

member x.TryGetGeometryAttribute(semantic : Symbol) =
geometryAttributeBuffers |> Map.tryFind semantic
Expand All @@ -790,7 +790,7 @@ and ManagedTracePool(runtime : IRuntime, signature : TraceObjectSignature,
member x.GetGeometryAttribute(semantic : Symbol) =
match x.TryGetGeometryAttribute semantic with
| Some attr -> attr
| None _ -> failf "could not find geometry attribute '%A'" semantic
| None -> failf "could not find geometry attribute '%A'" semantic

member x.TryGetInstanceAttribute(semantic : Symbol) =
instanceAttributeBuffers |> Map.tryFind semantic
Expand All @@ -799,7 +799,7 @@ and ManagedTracePool(runtime : IRuntime, signature : TraceObjectSignature,
member x.GetInstanceAttribute(semantic : Symbol) =
match x.TryGetInstanceAttribute semantic with
| Some attr -> attr
| None _ -> failf "could not find instance attribute '%A'" semantic
| None -> failf "could not find instance attribute '%A'" semantic

member x.Dispose() =
lock x (fun _ ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ type VulkanApplication(debug : IDebugConfig, chooseDevice : list<PhysicalDevice>
yield Instance.Extensions.ShaderSubgroupVote
yield Instance.Extensions.ShaderSubgroupBallot
yield Instance.Extensions.GetPhysicalDeviceProperties2
yield Instance.Extensions.ConservativeRasterization

yield! Instance.Extensions.Raytracing
yield! Instance.Extensions.Sharing
Expand Down
3 changes: 2 additions & 1 deletion src/Tests/Aardvark.Rendering.Tests/Tests/Application.fs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ module TestApplication =
let create (backend : TestBackend) =
let config : IDebugConfig =
if backend = TestBackend.Vulkan then
// Disable GPU-AV (producing sporadic false positives with Vulkan SDK 1.3.280)
{ Vulkan.DebugConfig.Normal with
ValidationLayer = Some Vulkan.ValidationLayerConfig.Full }
ValidationLayer = Some { Vulkan.ValidationLayerConfig.Full with ShaderBasedValidation = Vulkan.ShaderValidation.Disabled } }
else
{ GL.DebugConfig.Normal with
DebugRenderTasks = true
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Aardvark.Rendering.Tests/Tests/Texture/Upload.fs
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,8 @@ module TextureUpload =
do! diffuseTexture
}

use randomTexture = runtime.CreateTexture2D(V2i(8, 8), TextureFormat.Rgba8ui)
randomTexture.Upload(PixImage.random8ui <| V2i(8, 8))
use randomTexture = runtime.CreateTexture2D(V2i(8, 8), TextureFormat.Rgba8i)
randomTexture.Upload(PixImage.random8i <| V2i(8, 8))

runtime |> renderQuadWithNullTexture shader randomTexture

Expand Down

0 comments on commit 5217787

Please sign in to comment.