diff options
author | quou <quou@disroot.org> | 2025-03-14 21:23:41 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2025-03-14 21:23:41 +1100 |
commit | 750b192a0229ecf401fbe4dd727725a6ef5350d9 (patch) | |
tree | 7b08bc8d891ea1b6c6c097d4f55b089adbd58ca6 /c2.cpp | |
parent | dae6866161ca59a6b23b41ae7008411116127f76 (diff) |
implementing shader variants
Diffstat (limited to 'c2.cpp')
-rw-r--r-- | c2.cpp | 32 |
1 files changed, 1 insertions, 31 deletions
@@ -60,33 +60,6 @@ static Buffer_Id upload_verts(Device* dev) { return vbo; } -Texture_Id make_default_texture(Device* dev) { - unsigned* mem; - Texture_Id tex; - Buffer_Id buf = dev->create_buffer( - "default texture stage", - 4, - Buffer_Flags::copy_src | - Buffer_Flags::cpu_readwrite - ); - mem = (unsigned*)dev->map_buffer(buf, 0, 4); - mem[0] = 0xffffffff; - dev->unmap_buffer(buf); - tex = dev->create_texture( - "default PBR texture", - texture_format_rgba8i, - Texture_Flags::sampleable | Texture_Flags::copy_dst, - 1, - 1, - 1, - 1, - 1, - buf - ); - dev->destroy_bufferi(buf); - return tex; -} - static Sampler_Id create_clamped_linear(Device* dev) { Sampler_State s{}; s.min = Filter_Mode::linear; @@ -642,7 +615,6 @@ struct C2 : public App { Collider* box_col, * floor_col; Texture* texture; Texture* texture2; - Texture_Id default_texture; Entity_Id monkey, monkey2, box, floor; Model_Scene scene; Renderer renderer; @@ -694,11 +666,10 @@ struct C2 : public App { ); assets.init(&asset_arena, "pack", 128); dev = Device::create(&video_arena, this); - default_texture = make_default_texture(dev); make_hdr_target(); make_ui_texture(); model_loader.init(dev, &assets); - mat_loader.init(&assets, default_texture); + mat_loader.init(&assets); register_asset_loader("MODL", &model_loader); register_asset_loader("MTRL", &mat_loader); shader = (Shader*)assets.load("triangle.csh"); @@ -1035,7 +1006,6 @@ struct C2 : public App { ui->destroy(); deinit_editor(); assets.destroy(); - dev->destroy_texture(default_texture); dev->destroy_texture(hdr_target); dev->destroy_texture(hdr_resolved); dev->destroy_texture(ms_depth); |