@@ -110,7 +110,10 @@ impl BufferBuilder {
110110
111111 // TODO(vmarcella): Add the ability for the user to specify the memory
112112 // properties (I.E. SparseFlags::SPARSE_MEMORY).
113- println ! ( "[DEBUG] Creating buffer of length: {}" , self . buffer_length) ;
113+ logging:: debug!(
114+ "[DEBUG] Creating buffer of length: {}" ,
115+ self . buffer_length
116+ ) ;
114117 let buffer_result = unsafe {
115118 logical_device. create_buffer (
116119 self . buffer_length as u64 ,
@@ -120,6 +123,7 @@ impl BufferBuilder {
120123 } ;
121124
122125 if buffer_result. is_err ( ) {
126+ logging:: error!( "Failed to create buffer for allocating memory." ) ;
123127 return Err ( "Failed to create buffer for allocating memory." ) ;
124128 }
125129
@@ -129,7 +133,7 @@ impl BufferBuilder {
129133 unsafe { logical_device. get_buffer_requirements ( & buffer) } ;
130134 let memory_types = physical_device. memory_properties ( ) . memory_types ;
131135
132- println ! ( "[DEBUG] Buffer requirements: {:?}" , requirements) ;
136+ logging :: debug !( "Buffer requirements: {:?}" , requirements) ;
133137 // Find a memory type that supports the requirements of the buffer.
134138 let memory_type = memory_types
135139 . iter ( )
@@ -141,12 +145,13 @@ impl BufferBuilder {
141145 . map ( |( id, _) | MemoryTypeId ( id) )
142146 . unwrap ( ) ;
143147
144- println ! ( "Allocating memory for buffer." ) ;
148+ logging :: debug !( "Allocating memory for buffer." ) ;
145149 // Allocates the memory on the GPU for the buffer.
146150 let buffer_memory_allocation =
147151 unsafe { logical_device. allocate_memory ( memory_type, requirements. size ) } ;
148152
149153 if buffer_memory_allocation. is_err ( ) {
154+ logging:: error!( "Failed to allocate memory for buffer." ) ;
150155 return Err ( "Failed to allocate memory for buffer." ) ;
151156 }
152157
@@ -160,6 +165,7 @@ impl BufferBuilder {
160165 // Destroy the buffer if we failed to bind it to memory.
161166 if buffer_binding. is_err ( ) {
162167 unsafe { logical_device. destroy_buffer ( buffer) } ;
168+ logging:: error!( "Failed to bind buffer memory." ) ;
163169 return Err ( "Failed to bind buffer memory." ) ;
164170 }
165171
@@ -169,6 +175,7 @@ impl BufferBuilder {
169175
170176 if get_mapping_to_memory. is_err ( ) {
171177 unsafe { logical_device. destroy_buffer ( buffer) } ;
178+ logging:: error!( "Failed to map memory." ) ;
172179 return Err ( "Failed to map memory." ) ;
173180 }
174181 let mapped_memory = get_mapping_to_memory. unwrap ( ) ;
@@ -194,6 +201,7 @@ impl BufferBuilder {
194201
195202 if memory_flush. is_err ( ) {
196203 unsafe { logical_device. destroy_buffer ( buffer) } ;
204+ logging:: error!( "Failed to flush memory." ) ;
197205 return Err ( "No memory available on the GPU." ) ;
198206 }
199207
0 commit comments