From 078b97e48b5ad5fcf3f5a16bb081ea0efb1f931b Mon Sep 17 00:00:00 2001 From: quou Date: Mon, 23 Dec 2024 21:30:13 +1100 Subject: send textures to shaders --- pipeline.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'pipeline.cpp') diff --git a/pipeline.cpp b/pipeline.cpp index ce95672..1715930 100644 --- a/pipeline.cpp +++ b/pipeline.cpp @@ -32,12 +32,30 @@ void Pipeline_Builder::begin() { pip = (Pipeline*)arena_alloc(arena, sizeof *pip); pip->vertex_format = 0; pip->shader = 0; + pip->descriptors = 0; } void Pipeline_Builder::shader(Shader_Id s) { pip->shader = s; } +void Pipeline_Builder::texture( + int binding, + Texture_Id t, + Sampler_Id s +) { + Texture_Descriptor* d = (Texture_Descriptor*)arena_alloc( + arena, + sizeof *d + ); + d->slot = binding; + d->type = Descriptor::Type::texture; + d->sampler = s; + d->texture = t; + d->next = pip->descriptors; + pip->descriptors = d; +} + void Pipeline_Builder::vertex_format(Vertex_Format_Id vf) { pip->vertex_format = vf; } -- cgit v1.2.3-54-g00ecf