Skip to content

Commit dc8ef33

Browse files
committed
[Tests] Fix tests for AMD
1 parent cb7af3c commit dc8ef33

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/Tests/Aardvark.Rendering.Tests/Tests/Buffer/Attributes.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ module AttributeBuffer =
324324
perInstance singleValue interleaved true runtime
325325

326326
let attributeC3bToC4us (perInstance : bool) (singleValue : bool) (interleaved : bool) (runtime : IRuntime) =
327+
runtime |> requireVertexFormat Vulkan.VkFormat.B8g8r8Uint
327328
runtime |> requireExtensionGL [NVGpuShader5]
328329

329330
renderAttribute
@@ -333,6 +334,7 @@ module AttributeBuffer =
333334
perInstance singleValue interleaved false runtime
334335

335336
let attributeC3bToC4ui (perInstance : bool) (singleValue : bool) (interleaved : bool) (runtime : IRuntime) =
337+
runtime |> requireVertexFormat Vulkan.VkFormat.B8g8r8Uint
336338
runtime |> requireExtensionGL [NVGpuShader5]
337339

338340
renderAttribute
@@ -342,6 +344,7 @@ module AttributeBuffer =
342344
perInstance singleValue interleaved false runtime
343345

344346
let attributeC3bToC4f (perInstance : bool) (singleValue : bool) (interleaved : bool) (runtime : IRuntime) =
347+
runtime |> requireVertexFormat Vulkan.VkFormat.B8g8r8Uint
345348
runtime |> requireExtensionGL [NVGpuShader5]
346349

347350
renderAttribute

src/Tests/Aardvark.Rendering.Tests/Tests/Rendering/Tasks.fs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,13 @@ module RenderTasks =
100100
try
101101
let _ = output.GetValue(AdaptiveToken.Top, { RenderToken.Empty with Queries = [query] })
102102
let samples = query.GetResult()
103+
let expectedSamples = uint64 (size.X * size.Y)
104+
105+
// For Vulkan, AMD seems to count the clear task as well
106+
let valid = samples = expectedSamples || samples = expectedSamples * 2UL
103107

104108
Expect.isGreaterThan samples 0UL "Non-positive sample count"
105-
Expect.equal samples (uint64 (size.X * size.Y)) "Unexpected sample count"
109+
Expect.isTrue valid $"Expected sample count {expectedSamples} but got {samples}"
106110
finally
107111
output.Release()
108112

src/Tests/Aardvark.Rendering.Tests/Tests/Utilities.fs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,14 @@ module ``Test Utilities`` =
622622
| :? Vulkan.Runtime as runtime when not <| check runtime.Device.EnabledFeatures -> skiptest message
623623
| _ -> ()
624624

625+
let requireVertexFormat (format: Vulkan.VkFormat) (runtime: IRuntime) =
626+
match runtime with
627+
| :? Vulkan.Runtime as runtime ->
628+
let formatFeatures = runtime.Device.PhysicalDevice.GetBufferFormatFeatures format
629+
if not <| formatFeatures.HasFlag Vulkan.VkFormatFeatureFlags.VertexBufferBit then
630+
skiptest $"Device does not support {format} vertex attributes"
631+
| _ -> ()
632+
625633
let requireGL (check: GL.Context -> bool) (message: string) (runtime: IRuntime) =
626634
match runtime with
627635
| :? GL.Runtime as runtime ->

0 commit comments

Comments
 (0)