diff options
author | quou <quou@disroot.org> | 2024-12-26 16:11:33 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-12-26 16:12:02 +1100 |
commit | b2ece42822225fd67a1286a2ef51f7b76c634255 (patch) | |
tree | 6256a55abb9dbda2b6a2e8da973033a3aab4c321 /c2.cpp | |
parent | 32e3b7e01a6a0a9c433966f5fe77066e389fade6 (diff) |
seperate descriptor sets from pipelines to allow swapping out shader resources without recreating pipelines
Diffstat (limited to 'c2.cpp')
-rw-r--r-- | c2.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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>("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(); } |