From b2ece42822225fd67a1286a2ef51f7b76c634255 Mon Sep 17 00:00:00 2001 From: quou Date: Thu, 26 Dec 2024 16:11:33 +1100 Subject: seperate descriptor sets from pipelines to allow swapping out shader resources without recreating pipelines --- c2.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'c2.cpp') diff --git a/c2.cpp b/c2.cpp index 37e4876..3b46920 100644 --- a/c2.cpp +++ b/c2.cpp @@ -65,10 +65,12 @@ int main() { Device* dev; Shader* shader; Texture* texture; + Texture* texture2; Buffer_Id vbo; Sampler_Id clamped_linear; C2* app = App::create("c2"); void* per_frame; + int frame = 0; app->running = 1; init_arena( &video_arena, @@ -85,6 +87,7 @@ int main() { app->dev = dev; shader = (Shader*)assets.load("triangle.csh"); texture = (Texture*)assets.load("22.tex"); + texture2 = (Texture*)assets.load("kita.tex"); per_frame = heap_alloc( dev->heap, per_frame_memory_size @@ -110,7 +113,7 @@ int main() { pb.vertex_format(shader->vf); pb.texture( shader->descriptor_index("colour_texture"), - texture->id, + frame % 2? texture->id: texture2->id, clamped_linear ); Pipeline& pip = pb.build(); @@ -127,9 +130,9 @@ int main() { draw.instance_count = 1; dev->get_ctx().submit(draw, pip, pass); - /* dev->get_ctx().submit(*dev, pass);*/ r += 10; + frame++; dev->present(); app->end(); } -- cgit v1.2.3-54-g00ecf