Browse Source

Prevent glitches in gpu demo caused by FP precision (#18900)

Nikita Tsukanov 5 months ago
parent
commit
d1ec52dd94
1 changed files with 2 additions and 6 deletions
  1. 2 6
      samples/GpuInterop/VulkanDemo/VulkanContent.cs

+ 2 - 6
samples/GpuInterop/VulkanDemo/VulkanContent.cs

@@ -141,18 +141,14 @@ unsafe class VulkanContent : IDisposable
 
         
         var model = Matrix4x4.CreateFromYawPitchRoll((float)yaw, (float)pitch, (float)roll);
-        var view = Matrix4x4.CreateLookAt(new Vector3(25, 25, 25), new Vector3(), new Vector3(0, -1, 0));
-        var projection =
-            Matrix4x4.CreatePerspectiveFieldOfView((float)(Math.PI / 4), (float)((float)image.Size.Width / image.Size.Height),
-                0.01f, 1000);
-        
+
         var vertexConstant = new VertextPushConstant()
         {
             Disco = (float)disco,
             MinY = _minY,
             MaxY = _maxY,
             Model = model,
-            Time = (float)St.Elapsed.TotalSeconds
+            Time = (float)(St.Elapsed.Ticks % (TimeSpan.TicksPerSecond * 40) / (double)TimeSpan.TicksPerSecond)
         };
 
         var commandBuffer = _context.Pool.CreateCommandBuffer();