From f457f1034b8e4eeee597483b8bfda5dcff7db4e7 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Sat, 4 May 2024 23:17:12 +0200 Subject: [PATCH] create buffers --- Cargo.lock | 146 +++++++++++++----------------------- Cargo.toml | 3 - kubi-server/Cargo.toml | 2 +- kubi/Cargo.toml | 7 +- kubi/src/lib.rs | 4 +- kubi/src/rendering.rs | 5 +- kubi/src/rendering/world.rs | 18 ++++- kubi/src/world/loading.rs | 74 +++++++++++++----- 8 files changed, 134 insertions(+), 125 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 91cadc2..2194bb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,27 +52,6 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" -[[package]] -name = "android-activity" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289" -dependencies = [ - "android-properties", - "bitflags 2.5.0", - "cc", - "cesu8", - "jni", - "jni-sys", - "libc", - "log", - "ndk 0.8.0", - "ndk-context", - "ndk-sys 0.5.0+25.2.9519653", - "num_enum", - "thiserror", -] - [[package]] name = "android-activity" version = "0.6.0" @@ -87,7 +66,7 @@ dependencies = [ "jni-sys", "libc", "log", - "ndk 0.9.0", + "ndk", "ndk-context", "ndk-sys 0.6.0+11769913", "num_enum", @@ -192,15 +171,15 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "base64" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bincode" @@ -270,9 +249,9 @@ dependencies = [ [[package]] name = "bytemuck_derive" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" +checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ "proc-macro2", "quote", @@ -319,9 +298,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.95" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" +checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" dependencies = [ "jobserver", "libc", @@ -424,9 +403,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" dependencies = [ "crossbeam-utils", ] @@ -701,9 +680,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", @@ -733,7 +712,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9099a2f86b8e674b75d03ff154b3fe4c5208ed249ced8d69cc313a9fa40bb488" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", "ttf-parser", ] @@ -801,9 +780,9 @@ dependencies = [ [[package]] name = "gilrs" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "499067aa54af19f88732dc418f61f23d5912de1518665bb0eca034ca0d07574c" +checksum = "b54e5e39844ab5cddaf3bbbdfdc2923a6cb34e36818b95618da4e3f26302c24c" dependencies = [ "fnv", "gilrs-core", @@ -915,7 +894,7 @@ checksum = "9c08c1f623a8d0b722b8b99f821eb0ba672a1618f0d3b16ddbee1cedd2dd8557" dependencies = [ "bitflags 2.5.0", "gpu-descriptor-types", - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] @@ -944,9 +923,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -1016,7 +995,7 @@ dependencies = [ "document-features", "fontdue", "glam", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "hui-derive", "image", "log", @@ -1111,7 +1090,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "serde", ] @@ -1223,13 +1202,14 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" name = "kubi" version = "0.0.0" dependencies = [ - "android-activity 0.5.2", + "android-activity", "anyhow", "atomic", + "bytemuck", "flume", "gilrs", "glam", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "hui", "hui-winit", "image", @@ -1237,7 +1217,7 @@ dependencies = [ "kubi-shared", "log", "lz4_flex", - "ndk 0.8.0", + "ndk", "nohash-hasher", "pollster", "postcard", @@ -1271,7 +1251,7 @@ dependencies = [ "anyhow", "flume", "glam", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "kubi-logging", "kubi-shared", "log", @@ -1296,7 +1276,7 @@ dependencies = [ "bytemuck", "fastnoise-lite", "glam", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "nohash-hasher", "num_enum", "nz", @@ -1318,9 +1298,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libloading" @@ -1383,9 +1363,9 @@ checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -1491,21 +1471,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "ndk" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" -dependencies = [ - "bitflags 2.5.0", - "jni-sys", - "log", - "ndk-sys 0.5.0+25.2.9519653", - "num_enum", - "raw-window-handle", - "thiserror", -] - [[package]] name = "ndk" version = "0.9.0" @@ -1571,9 +1536,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -1601,9 +1566,9 @@ dependencies = [ [[package]] name = "nz" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb749eec2b3be2f169dd4facfec40a28cc40f2b02ad3c4d2c51ce578c3f635b0" +checksum = "d1e9655df3f51323812726b25a00d787562c5fa64177d286603429787b4386a9" [[package]] name = "objc" @@ -2101,18 +2066,18 @@ checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.198" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" dependencies = [ "proc-macro2", "quote", @@ -2141,9 +2106,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c85f8e96d1d6857f13768fcbd895fcb06225510022a2774ed8b5150581847b0" +checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" dependencies = [ "base64", "chrono", @@ -2159,9 +2124,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8b3a576c4eb2924262d5951a3b737ccaf16c931e39a2810c36f9a7e25575557" +checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" dependencies = [ "darling", "proc-macro2", @@ -2174,7 +2139,7 @@ name = "shipyard" version = "0.6.0" source = "git+https://github.com/leudz/shipyard?rev=aacf3b1df5#aacf3b1df540c7d9d384830d7431ba618eee75c9" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", "lock_api", "rayon", "serde", @@ -2484,7 +2449,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.6", + "winnow 0.6.7", ] [[package]] @@ -3139,7 +3104,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea9e6d5d66cbf702e0dd820302144f51b69a95acdc495dd98ca280ff206562b1" dependencies = [ "ahash", - "android-activity 0.6.0", + "android-activity", "atomic-waker", "bitflags 2.5.0", "bytemuck", @@ -3153,7 +3118,7 @@ dependencies = [ "js-sys", "libc", "memmap2", - "ndk 0.9.0", + "ndk", "objc2", "objc2-app-kit", "objc2-foundation", @@ -3193,9 +3158,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352" +checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578" dependencies = [ "memchr", ] @@ -3213,9 +3178,9 @@ dependencies = [ [[package]] name = "x11rb" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a" +checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12" dependencies = [ "as-raw-xcb-connection", "gethostname", @@ -3228,9 +3193,9 @@ dependencies = [ [[package]] name = "x11rb-protocol" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34" +checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" [[package]] name = "xcursor" @@ -3282,8 +3247,3 @@ dependencies = [ "quote", "syn 2.0.60", ] - -[[patch.unused]] -name = "glium" -version = "0.34.0" -source = "git+https://github.com/glium/glium?rev=a352c667#a352c667c145e2dda1f5fe1fc2482cbe99de23be" diff --git a/Cargo.toml b/Cargo.toml index 1a981bf..ae8076d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,6 +40,3 @@ opt-level = 3 #enabling debug assertions here causes the game to abort [profile.dev.package.android-activity] debug-assertions = false - -[patch.crates-io] -glium = { git = "https://github.com/glium/glium", rev = "a352c667" } diff --git a/kubi-server/Cargo.toml b/kubi-server/Cargo.toml index 075eced..51a4f43 100644 --- a/kubi-server/Cargo.toml +++ b/kubi-server/Cargo.toml @@ -15,7 +15,7 @@ glam = { version = "0.27", features = ["debug-glam-assert", "fast-math"] } hashbrown = "0.14" nohash-hasher = "0.2" anyhow = "1.0" -rayon = "1.7" +rayon = "1.10" flume = "0.11" rand = "0.8" uflow = "0.7" diff --git a/kubi/Cargo.toml b/kubi/Cargo.toml index 27e7864..6542e1d 100644 --- a/kubi/Cargo.toml +++ b/kubi/Cargo.toml @@ -16,6 +16,7 @@ hui-winit = { git = "https://github.com/griffi-gh/hui", rev = "3a50d2d0dde", fea log = "0.4" wgpu = { version = "0.20", features = ["webgl"] } pollster = "0.3" +bytemuck = { version = "1.15", features = ["derive"] } winit = { version = "0.30", features = ["android-native-activity"] } raw-window-handle = "0.6" glam = { version = "0.27", features = ["debug-glam-assert", "fast-math"] } @@ -23,7 +24,7 @@ image = { version = "0.25", default_features = false, features = ["png"] } strum = { version = "0.26", features = ["derive"] } hashbrown = "0.14" nohash-hasher = "0.2" -rayon = "1.7" +rayon = "1.10" shipyard = { git = "https://github.com/leudz/shipyard", rev = "aacf3b1df5", default-features = false, features = ["std", "proc", "thread_local"] } anyhow = "1.0" flume = "0.11" @@ -39,8 +40,8 @@ atomic = "0.6" [target.'cfg(target_os = "android")'.dependencies] -android-activity = "^0.5.2" -ndk = "0.8" +android-activity = "0.6" +ndk = "0.9" [target.'cfg(target_os = "windows")'.dependencies] winapi = { version = "0.3", features = ["wincon"] } diff --git a/kubi/src/lib.rs b/kubi/src/lib.rs index 90b3559..b40872d 100644 --- a/kubi/src/lib.rs +++ b/kubi/src/lib.rs @@ -79,7 +79,7 @@ use player_controller::{debug_switch_ctl_type, update_player_controllers}; // clear_background, entities::render_entities, init_window_size, primitives::init_primitives, resize_renderer, selection_box::render_selection_box, sumberge::render_submerged_view, update_window_size, world::{draw_current_chunk_border, draw_world, draw_world_trans, init_trans_chunk_queue}, BackgroundColor, RenderTarget, Renderer // }; use rendering::{ - init_window_size, resize_renderer, update_window_size, + render_master, init_window_size, resize_renderer, update_window_size, BackgroundColor, Renderer }; use block_placement::update_block_placement; @@ -320,6 +320,8 @@ pub fn kubi_main( //Run update workflows world.run_workload(update).unwrap(); + world.run(render_master); + //Start rendering (maybe use custom views for this?) // let target = { // let renderer = world.borrow::>>().unwrap(); diff --git a/kubi/src/rendering.rs b/kubi/src/rendering.rs index 409fbf0..fdafbed 100644 --- a/kubi/src/rendering.rs +++ b/kubi/src/rendering.rs @@ -100,7 +100,7 @@ impl Renderer { let size = window.inner_size(); let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { - backends: wgpu::Backends::all(), + backends: wgpu::Backends::BROWSER_WEBGPU | wgpu::Backends::VULKAN | wgpu::Backends::GL, ..Default::default() }); @@ -216,7 +216,8 @@ pub fn render_master(storages: AllStoragesViewMut) { // render_pass.draw_indexed(0..renderer.num_indices, 0, 0..1); } - renderer.queue().submit(Some(encoder.finish())); + renderer.queue().submit(std::iter::once(encoder.finish())); + surface_texture.present(); } // pub fn clear_background( diff --git a/kubi/src/rendering/world.rs b/kubi/src/rendering/world.rs index 9f3dffc..9c66c34 100644 --- a/kubi/src/rendering/world.rs +++ b/kubi/src/rendering/world.rs @@ -23,9 +23,10 @@ // }, settings::GameSettings, // }; // use super::{RenderTarget, primitives::cube::CubePrimitive}; +use bytemuck::{Pod, Zeroable}; -#[derive(Clone, Copy)] -#[repr(C)] +#[derive(Clone, Copy, Pod, Zeroable)] +#[repr(C, packed)] pub struct ChunkVertex { pub position: [f32; 3], pub normal: [f32; 3], @@ -33,6 +34,19 @@ pub struct ChunkVertex { pub tex_index: u8, } +impl ChunkVertex { + pub const LAYOUT: wgpu::VertexBufferLayout<'static> = wgpu::VertexBufferLayout { + array_stride: std::mem::size_of::() as wgpu::BufferAddress, + step_mode: wgpu::VertexStepMode::Vertex, + attributes: &wgpu::vertex_attr_array![ + 0 => Float32x3, + 1 => Float32x3, + 2 => Float32x2, + 3 => Uint32, + ], + }; +} + // #[derive(Unique)] // pub struct TransChunkQueue(pub Vec); diff --git a/kubi/src/world/loading.rs b/kubi/src/world/loading.rs index c0b2f85..3defe94 100644 --- a/kubi/src/world/loading.rs +++ b/kubi/src/world/loading.rs @@ -4,13 +4,14 @@ use glam::{IVec3, ivec3}; use kubi_shared::{networking::{channels::Channel, messages::ClientToServerMessage}, worldgen::AbortState}; use shipyard::{View, UniqueView, UniqueViewMut, IntoIter, Workload, IntoWorkload, NonSendSync, track}; use uflow::SendMode; +use wgpu::util::DeviceExt; use crate::{ - player::MainPlayer, - transform::Transform, - settings::GameSettings, - rendering::Renderer, - state::GameState, networking::UdpClient, + player::MainPlayer, + rendering::{world::ChunkVertex, BufferPair, Renderer}, + settings::GameSettings, + state::GameState, + transform::Transform, }; use super::{ ChunkStorage, ChunkMeshStorage, @@ -326,23 +327,56 @@ fn process_completed_tasks( //apply the mesh //TODO: Skip if mesh is empty? (i.e. set to None) - unimplemented!(); + //TODO - // let mesh = ChunkMesh { - // vertex_buffer: VertexBuffer::immutable(&renderer.display, &vertices).unwrap(), - // index_buffer: IndexBuffer::immutable(&renderer.display, PrimitiveType::TrianglesList, &indices).unwrap(), - // trans_vertex_buffer: VertexBuffer::immutable(&renderer.display, &trans_vertices).unwrap(), - // trans_index_buffer: IndexBuffer::immutable(&renderer.display, PrimitiveType::TrianglesList, &trans_indices).unwrap(), - // }; - // if let Some(index) = chunk.mesh_index { - // meshes.update(index, mesh).expect("Mesh update failed"); - // } else { - // let mesh_index = meshes.insert(mesh); - // chunk.mesh_index = Some(mesh_index); - // } + let vtx_buffer = renderer.device().create_buffer_init(&wgpu::util::BufferInitDescriptor { + label: Some("chunk_vertex_buffer"), + contents: bytemuck::cast_slice(&vertices), + usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::VERTEX, + }); - // //update chunk state - // chunk.current_state = CurrentChunkState::Rendered; + let idx_buffer = renderer.device().create_buffer_init(&wgpu::util::BufferInitDescriptor { + label: Some("chunk_vertex_buffer"), + contents: bytemuck::cast_slice(&indices), + usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::INDEX, + }); + + let vtx_buffer_trans = renderer.device().create_buffer_init(&wgpu::util::BufferInitDescriptor { + label: Some("chunk_trans_vertex_buffer"), + contents: todo!(), + usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::VERTEX, + }); + + let idx_buffer_trans = renderer.device().create_buffer_init(&wgpu::util::BufferInitDescriptor { + label: Some("chunk_trans_index_buffer"), + contents: todo!(), + usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::INDEX, + }); + + let main_buffer_pair = BufferPair { + vertex: vtx_buffer, + index: idx_buffer, + }; + + let trans_buffer_pair = BufferPair { + vertex: vtx_buffer_trans, + index: idx_buffer_trans, + }; + + let mesh = ChunkMesh { + main: main_buffer_pair, + trans: trans_buffer_pair, + }; + + if let Some(index) = chunk.mesh_index { + meshes.update(index, mesh).expect("Mesh update failed"); + } else { + let mesh_index = meshes.insert(mesh); + chunk.mesh_index = Some(mesh_index); + } + + //update chunk state + chunk.current_state = CurrentChunkState::Rendered; //increase ops counter ops += 1;