diff options
Diffstat (limited to 'stockton-render/src/draw/ui/render.rs')
-rw-r--r-- | stockton-render/src/draw/ui/render.rs | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/stockton-render/src/draw/ui/render.rs b/stockton-render/src/draw/ui/render.rs index 02135e5..77231b0 100644 --- a/stockton-render/src/draw/ui/render.rs +++ b/stockton-render/src/draw/ui/render.rs @@ -15,24 +15,24 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -use crate::draw::texture::TextureStore; +use crate::draw::texture::TextureRepo; use arrayvec::ArrayVec; use hal::prelude::*; use hal::pso::ShaderStageFlags; -use super::UIPoint; +use super::UiPoint; use crate::draw::draw_buffers::DrawBuffers; use crate::types::*; -use crate::UIState; +use crate::UiState; use std::convert::TryInto; use stockton_types::Vector2; pub fn do_render( cmd_buffer: &mut CommandBuffer, pipeline_layout: &PipelineLayout, - draw_buffers: &mut DrawBuffers<UIPoint>, - texture_store: &mut TextureStore, - ui: &mut UIState, + draw_buffers: &mut DrawBuffers<UiPoint>, + tex_repo: &mut TextureRepo, + ui: &mut UiState, ) { // TODO: Actual UI Rendering let (_out, paint) = ui.end_frame(); @@ -57,7 +57,7 @@ pub fn do_render( ); } for (i, vertex) in tris.vertices.iter().enumerate() { - draw_buffers.vertex_buffer[i] = UIPoint( + draw_buffers.vertex_buffer[i] = UiPoint( Vector2::new(vertex.pos.x, vertex.pos.y), Vector2::new(vertex.uv.x, vertex.uv.y), vertex.color, @@ -65,13 +65,17 @@ pub fn do_render( } // TODO: *Properly* deal with textures - let mut descriptor_sets: ArrayVec<[_; 1]> = ArrayVec::new(); - descriptor_sets.push(texture_store.get_chunk_descriptor_set(0)); + if let Some(ds) = tex_repo.attempt_get_descriptor_set(0) { + let mut descriptor_sets: ArrayVec<[_; 1]> = ArrayVec::new(); + descriptor_sets.push(ds); - unsafe { - cmd_buffer.bind_graphics_descriptor_sets(pipeline_layout, 0, descriptor_sets, &[]); - // Call draw - cmd_buffer.draw_indexed(0..tris.indices.len() as u32, 0, 0..1); + unsafe { + cmd_buffer.bind_graphics_descriptor_sets(pipeline_layout, 0, descriptor_sets, &[]); + // Call draw + cmd_buffer.draw_indexed(0..tris.indices.len() as u32, 0, 0..1); + } + } else { + // tex_repo.queue_load(0); } } } |