]> O.S.I.I.S - jp/vke.net.git/commitdiff
fill even odd first ok
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 28 Mar 2023 14:01:01 +0000 (16:01 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 28 Mar 2023 14:01:01 +0000 (16:01 +0200)
samples/FillTests/main.cs
samples/FillTests/shaders/contour.frag
samples/FillTests/shaders/test.comp

index 4d68f9ead7304847bf65175ec4d1d66d831dde9d..8605c614a25ec7875c72ee93840f520bc7bd7e9e 100644 (file)
@@ -15,7 +15,7 @@ namespace FillTests {
                static void Main (string[] args) {
 #if DEBUG
                        //Instance.VALIDATION = true;
-                       //Instance.RENDER_DOC_CAPTURE = true;
+                       Instance.RENDER_DOC_CAPTURE = true;
 #endif
                        using (Program vke = new Program ()) {
                                vke.Run ();
@@ -64,7 +64,7 @@ namespace FillTests {
                DescriptorSet dsComp, dsFSQ;//descriptor set for the mvp matrice.
                vke.Image imgContour, imgColor;
 
-               VkFormat rastFormat = VkFormat.B8g8r8a8Uint;
+               VkFormat rastFormat = VkFormat.R32g32Sfloat;
                const VkSampleCountFlags contourSamplesCount = VkSampleCountFlags.SampleCount1;
 
                void createIbo() {
@@ -95,12 +95,10 @@ namespace FillTests {
                                        }
                                        Console.WriteLine("");
                                }
-
-                               
                        } 
 
 
-                       UpdateFrequency = 20;
+                       UpdateFrequency = 1;
 
                        vbo = new HostBuffer<Vertex> (dev, VkBufferUsageFlags.VertexBuffer, vertices.ToArray());
                        vbo.SetName("vbo");
@@ -167,11 +165,6 @@ namespace FillTests {
                        cmds = cmdPool.AllocateCommandBuffer (swapChain.ImageCount);
                }
 
-               //view update override, see base method for more informations.
-               public override void UpdateView () {
-
-                       base.UpdateView ();
-               }
                Vector2 curMousePos;
                const float pointSizeSquared = 50;
                
index 8f31963ccc23d2a8046c8b5f497466874b362225..cf9d54184fb696ae5e36db23c9b07e742d6ee116 100644 (file)
@@ -4,9 +4,10 @@
 #extension GL_ARB_shading_language_420pack : enable
 
 layout (location = 0) in flat uint inContourID;
-layout (location = 0) out uvec4 outFragColor;
+layout (location = 0) out vec2 outFragColor;
 
 void main() 
 {
-  outFragColor = uvec4(1u << gl_PrimitiveID, inContourID, 0, 255);
+  uint tmp = 1u << gl_PrimitiveID;
+  outFragColor = vec2(float(tmp), inContourID);
 }
\ No newline at end of file
index c68fc0dafd85902e9699318b3f0635e3cd163e1e..6553b779cd95caeac5dd55faee8535c2833a63f3 100644 (file)
@@ -3,7 +3,7 @@
 #extension GL_ARB_separate_shader_objects : enable
 #extension GL_ARB_shading_language_420pack : enable
 
-layout (set = 0, binding = 0, rgba8ui) readonly uniform uimage2D inputImage;
+layout (set = 0, binding = 0, rg32f) readonly uniform image2D inputImage;
 layout (set = 0, binding = 1, rgba8) writeonly uniform image2D outputImage;
 
 layout(push_constant) uniform PushConsts {
@@ -26,9 +26,9 @@ void main()
     int start = -1;
     for(int i=0; i<is.x; i++) {
         ivec2 uv = ivec2(i, gl_GlobalInvocationID.x);
-        uvec4 ct = imageLoad(inputImage, uv);
-        uint contourID = ct.g;
-        uint primID = ct.r;
+        vec2 ct = imageLoad(inputImage, uv).rg;
+        uint contourID = uint(ct.g);
+        uint primID =  uint(ct.r);
 
         if (primID > 0) {
             imageStore(outputImage, uv, vec4(1.f,0.f,0.f,1.f));
@@ -41,7 +41,7 @@ void main()
                 if ((bc % 2) != 0) {
                     if (start >= 0) {
                         for(int j=start; j<i; j++) {
-                            imageStore(outputImage, ivec2(j, gl_GlobalInvocationID.x), vec4(0.f,1.f,0.f,1.f));
+                            imageStore(outputImage, ivec2(j, gl_GlobalInvocationID.x), vec4(0.f,0.f,1.f,1.f));
                         }
                     }
                     start = i + 1;