# HG changeset patch # User Sam # Date 1693763280 -25200 # Node ID 2533f524bdb62c3a3b391563178692217c679632 # Parent 27aaf43e18b4735dba2595ac1128d08bd943a9b8 fix: remaining tests and an issue with updating uniforms diff -r 27aaf43e18b4 -r 2533f524bdb6 src/semicongine/renderer.nim --- a/src/semicongine/renderer.nim Mon Sep 04 00:31:17 2023 +0700 +++ b/src/semicongine/renderer.nim Mon Sep 04 00:48:00 2023 +0700 @@ -387,11 +387,11 @@ debug &" update uniform {uniform.name} with value: {value}" let (pdata, size) = value.getRawData() if dirty.contains(uniform.name) or forceAll: # only update if necessary - if forceAll: # need to update all in-flight frames, when forced to do all - for buffer in renderer.scenedata[scene].uniformBuffers[pipeline.vk]: - buffer.setData(pdata, size, offset) - else: - renderer.scenedata[scene].uniformBuffers[pipeline.vk][renderer.swapchain.currentInFlight].setData(pdata, size, offset) + # TODO: technically we would only need to update the uniform buffer of the current + # frameInFlight, but we don't track for which frame the shaderglobals are no longer dirty + # therefore we have to update the uniform values in all buffers, of all inFlightframes (usually 2) + for buffer in renderer.scenedata[scene].uniformBuffers[pipeline.vk]: + buffer.setData(pdata, size, offset) offset += size scene.clearDirtyShaderGlobals() diff -r 27aaf43e18b4 -r 2533f524bdb6 tests/test_materials.nim --- a/tests/test_materials.nim Mon Sep 04 00:31:17 2023 +0700 +++ b/tests/test_materials.nim Mon Sep 04 00:48:00 2023 +0700 @@ -38,8 +38,8 @@ ], uniforms=[attr[float32]("test2", arrayCount=2)], samplers = @[ - attr[Sampler2DType]("tex1", arrayCount=2), - attr[Sampler2DType]("tex2", arrayCount=2), + attr[Texture]("tex1", arrayCount=2), + attr[Texture]("tex2", arrayCount=2), ], outputs=[attr[Vec4f]("color")], vertexCode=""" diff -r 27aaf43e18b4 -r 2533f524bdb6 tests/test_vulkan_wrapper.nim --- a/tests/test_vulkan_wrapper.nim Mon Sep 04 00:31:17 2023 +0700 +++ b/tests/test_vulkan_wrapper.nim Mon Sep 04 00:48:00 2023 +0700 @@ -169,7 +169,7 @@ ], outputs=[attr[Vec4f]("color")], samplers=[ - attr[Sampler2DType]("my_little_texture") + attr[Texture]("my_little_texture") ], vertexCode="""gl_Position = vec4(position, 1.0) * transform; outcolor = color;""", fragmentCode="color = texture(my_little_texture, outcolor.xy) * 0.5 + outcolor * 0.5;",