Bläddra i källkod

vulkan: Fix compiler warnings

rdb 2 år sedan
förälder
incheckning
6498c9eecb

+ 3 - 3
panda/src/vulkandisplay/vulkanGraphicsBuffer.cxx

@@ -554,7 +554,7 @@ destroy_framebuffer() {
       if (vkgsg->_last_frame_data != nullptr) {
       if (vkgsg->_last_frame_data != nullptr) {
         vkgsg->_last_frame_data->_pending_destroy_image_views.push_back(attach._tc->_image_view);
         vkgsg->_last_frame_data->_pending_destroy_image_views.push_back(attach._tc->_image_view);
       } else {
       } else {
-        vkDestroyImageView(vkgsg->_device, attach._tc->_image_view, nullptr);
+        vkDestroyImageView(device, attach._tc->_image_view, nullptr);
       }
       }
       attach._tc->_image_view = VK_NULL_HANDLE;
       attach._tc->_image_view = VK_NULL_HANDLE;
     }
     }
@@ -563,7 +563,7 @@ destroy_framebuffer() {
       if (vkgsg->_last_frame_data != nullptr) {
       if (vkgsg->_last_frame_data != nullptr) {
         vkgsg->_last_frame_data->_pending_destroy_images.push_back(attach._tc->_image);
         vkgsg->_last_frame_data->_pending_destroy_images.push_back(attach._tc->_image);
       } else {
       } else {
-        vkDestroyImage(vkgsg->_device, attach._tc->_image, nullptr);
+        vkDestroyImage(device, attach._tc->_image, nullptr);
       }
       }
       attach._tc->_image = VK_NULL_HANDLE;
       attach._tc->_image = VK_NULL_HANDLE;
     }
     }
@@ -577,7 +577,7 @@ destroy_framebuffer() {
     if (vkgsg->_last_frame_data != nullptr) {
     if (vkgsg->_last_frame_data != nullptr) {
       vkgsg->_last_frame_data->_pending_destroy_framebuffers.push_back(_framebuffer);
       vkgsg->_last_frame_data->_pending_destroy_framebuffers.push_back(_framebuffer);
     } else {
     } else {
-      vkDestroyFramebuffer(vkgsg->_device, _framebuffer, nullptr);
+      vkDestroyFramebuffer(device, _framebuffer, nullptr);
     }
     }
     _framebuffer = VK_NULL_HANDLE;
     _framebuffer = VK_NULL_HANDLE;
   }
   }

+ 3 - 13
panda/src/vulkandisplay/vulkanGraphicsStateGuardian.cxx

@@ -70,17 +70,7 @@ VulkanGraphicsStateGuardian(GraphicsEngine *engine, VulkanGraphicsPipe *pipe,
                             VulkanGraphicsStateGuardian *share_with,
                             VulkanGraphicsStateGuardian *share_with,
                             uint32_t queue_family_index) :
                             uint32_t queue_family_index) :
   GraphicsStateGuardian(CS_default, engine, pipe),
   GraphicsStateGuardian(CS_default, engine, pipe),
-  _device(VK_NULL_HANDLE),
-  _queue(VK_NULL_HANDLE),
-  _dma_queue(VK_NULL_HANDLE),
-  _graphics_queue_family_index(queue_family_index),
-  _cmd_pool(VK_NULL_HANDLE),
-  _render_pass(VK_NULL_HANDLE),
-  _wait_semaphore(VK_NULL_HANDLE),
-  _signal_semaphore(VK_NULL_HANDLE),
-  _pipeline_cache(VK_NULL_HANDLE),
-  _default_sc(nullptr),
-  _total_allocated(0)
+  _graphics_queue_family_index(queue_family_index)
 {
 {
   const VkPhysicalDeviceLimits &limits = pipe->_gpu_properties.limits;
   const VkPhysicalDeviceLimits &limits = pipe->_gpu_properties.limits;
   const VkPhysicalDeviceFeatures &features = pipe->_gpu_features;
   const VkPhysicalDeviceFeatures &features = pipe->_gpu_features;
@@ -2879,8 +2869,8 @@ framebuffer_copy_to_texture(Texture *tex, int view, int z,
   DCAST_INTO_R(tc, tex->prepare_now(view, pgo, this), false);
   DCAST_INTO_R(tc, tex->prepare_now(view, pgo, this), false);
 
 
   // Temporary, prepare_now should really deal with the resizing
   // Temporary, prepare_now should really deal with the resizing
-  if (tc->_extent.width != tex->get_x_size() ||
-      tc->_extent.height != tex->get_y_size()) {
+  if (tc->_extent.width != (uint32_t)tex->get_x_size() ||
+      tc->_extent.height != (uint32_t)tex->get_y_size()) {
     pgo->release_texture(tc);
     pgo->release_texture(tc);
     DCAST_INTO_R(tc, tex->prepare_now(view, pgo, this), false);
     DCAST_INTO_R(tc, tex->prepare_now(view, pgo, this), false);
   }
   }

+ 15 - 15
panda/src/vulkandisplay/vulkanGraphicsStateGuardian.h

@@ -189,25 +189,25 @@ public:
                                   Texture::ComponentType &type);
                                   Texture::ComponentType &type);
 
 
 public:
 public:
-  VkDevice _device;
+  VkDevice _device = VK_NULL_HANDLE;
   uint32_t _graphics_queue_family_index;
   uint32_t _graphics_queue_family_index;
   PT(Texture) _white_texture;
   PT(Texture) _white_texture;
 
 
 private:
 private:
-  VkQueue _queue;
-  VkQueue _dma_queue;
-  VkCommandPool _cmd_pool;
+  VkQueue _queue = VK_NULL_HANDLE;
+  VkQueue _dma_queue = VK_NULL_HANDLE;
+  VkCommandPool _cmd_pool = VK_NULL_HANDLE;
   pvector<VkRect2D> _viewports;
   pvector<VkRect2D> _viewports;
-  VkPipelineCache _pipeline_cache;
-  VkDescriptorPool _descriptor_pool;
-  VulkanShaderContext *_default_sc;
-  VulkanShaderContext *_current_shader;
+  VkPipelineCache _pipeline_cache = VK_NULL_HANDLE;
+  VkDescriptorPool _descriptor_pool = VK_NULL_HANDLE;
+  VulkanShaderContext *_default_sc = nullptr;
+  VulkanShaderContext *_current_shader = nullptr;
   const ShaderType::Struct *_push_constant_block_type = nullptr;
   const ShaderType::Struct *_push_constant_block_type = nullptr;
   CPT(GeomVertexFormat) _format;
   CPT(GeomVertexFormat) _format;
   uint32_t _instance_count = 0;
   uint32_t _instance_count = 0;
 
 
   // Single large uniform buffer used for everything in a frame.
   // Single large uniform buffer used for everything in a frame.
-  VkBuffer _uniform_buffer;
+  VkBuffer _uniform_buffer = VK_NULL_HANDLE;
   VulkanMemoryBlock _uniform_buffer_memory;
   VulkanMemoryBlock _uniform_buffer_memory;
   CircularAllocator _uniform_buffer_allocator;
   CircularAllocator _uniform_buffer_allocator;
   void *_uniform_buffer_ptr = nullptr;
   void *_uniform_buffer_ptr = nullptr;
@@ -221,12 +221,12 @@ private:
   void *_staging_buffer_ptr = nullptr;
   void *_staging_buffer_ptr = nullptr;
 
 
   // Stores current framebuffer info.
   // Stores current framebuffer info.
-  VkRenderPass _render_pass;
-  VulkanTextureContext *_fb_color_tc;
-  VulkanTextureContext *_fb_depth_tc;
+  VkRenderPass _render_pass = VK_NULL_HANDLE;
+  VulkanTextureContext *_fb_color_tc = nullptr;
+  VulkanTextureContext *_fb_depth_tc = nullptr;
   VkSampleCountFlagBits _fb_ms_count = VK_SAMPLE_COUNT_1_BIT;
   VkSampleCountFlagBits _fb_ms_count = VK_SAMPLE_COUNT_1_BIT;
-  VkSemaphore _wait_semaphore;
-  VkSemaphore _signal_semaphore;
+  VkSemaphore _wait_semaphore = VK_NULL_HANDLE;
+  VkSemaphore _signal_semaphore = VK_NULL_HANDLE;
 
 
   // Remembers semaphores created on this device.
   // Remembers semaphores created on this device.
   pvector<VkSemaphore> _semaphores;
   pvector<VkSemaphore> _semaphores;
@@ -261,7 +261,7 @@ private:
   // Keep track of all the individual allocations.
   // Keep track of all the individual allocations.
   Mutex _allocator_lock;
   Mutex _allocator_lock;
   pdeque<VulkanMemoryPage> _memory_pages;
   pdeque<VulkanMemoryPage> _memory_pages;
-  VkDeviceSize _total_allocated;
+  VkDeviceSize _total_allocated = 0u;
 
 
   // Queued buffer-to-RAM transfer.
   // Queued buffer-to-RAM transfer.
   struct QueuedDownload {
   struct QueuedDownload {

+ 1 - 10
panda/src/vulkandisplay/vulkanGraphicsWindow.cxx

@@ -32,16 +32,7 @@ VulkanGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
                      int flags,
                      int flags,
                      GraphicsStateGuardian *gsg,
                      GraphicsStateGuardian *gsg,
                      GraphicsOutput *host) :
                      GraphicsOutput *host) :
-  BaseGraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host),
-  _surface(VK_NULL_HANDLE),
-  _swapchain(VK_NULL_HANDLE),
-  _render_pass(VK_NULL_HANDLE),
-  _image_available(VK_NULL_HANDLE),
-  _render_complete(VK_NULL_HANDLE),
-  _current_clear_mask(-1),
-  _ms_color_tc(nullptr),
-  _depth_stencil_tc(nullptr),
-  _image_index(0)
+  BaseGraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
 {
 {
 }
 }
 
 

+ 8 - 8
panda/src/vulkandisplay/vulkanGraphicsWindow.h

@@ -65,14 +65,14 @@ protected:
   bool create_swapchain();
   bool create_swapchain();
 
 
 private:
 private:
-  VkSurfaceKHR _surface;
-  VkSwapchainKHR _swapchain;
-  VkRenderPass _render_pass;
-  int _current_clear_mask;
+  VkSurfaceKHR _surface = VK_NULL_HANDLE;
+  VkSwapchainKHR _swapchain = VK_NULL_HANDLE;
+  VkRenderPass _render_pass = VK_NULL_HANDLE;
+  int _current_clear_mask = -1;
 
 
   // We'll need these to synchronize the rendering with the presentation.
   // We'll need these to synchronize the rendering with the presentation.
-  VkSemaphore _render_complete;
-  VkSemaphore _image_available;
+  VkSemaphore _render_complete = VK_NULL_HANDLE;
+  VkSemaphore _image_available = VK_NULL_HANDLE;
 
 
   LVecBase2i _swapchain_size;
   LVecBase2i _swapchain_size;
   VkSurfaceFormatKHR _surface_format;
   VkSurfaceFormatKHR _surface_format;
@@ -83,13 +83,13 @@ private:
   };
   };
   typedef pvector<SwapBuffer> SwapBuffers;
   typedef pvector<SwapBuffer> SwapBuffers;
   SwapBuffers _swap_buffers;
   SwapBuffers _swap_buffers;
-  uint32_t _image_index;
+  uint32_t _image_index = 0;
   VkImageLayout _final_layout;
   VkImageLayout _final_layout;
 
 
   VulkanTextureContext *_ms_color_tc = nullptr;
   VulkanTextureContext *_ms_color_tc = nullptr;
   VkSampleCountFlagBits _ms_count = VK_SAMPLE_COUNT_1_BIT;
   VkSampleCountFlagBits _ms_count = VK_SAMPLE_COUNT_1_BIT;
 
 
-  VulkanTextureContext *_depth_stencil_tc;
+  VulkanTextureContext *_depth_stencil_tc = nullptr;
   VkFormat _depth_stencil_format;
   VkFormat _depth_stencil_format;
   VkImageAspectFlags _depth_stencil_aspect_mask;
   VkImageAspectFlags _depth_stencil_aspect_mask;