Browse Source

vulkan: style fixes, remove pre-C++11 macros

rdb 7 years ago
parent
commit
2aa579c6dc

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

@@ -21,7 +21,7 @@ TypeHandle VulkanGraphicsBuffer::_type_handle;
  */
 VulkanGraphicsBuffer::
 VulkanGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe,
-                     const string &name,
+                     const std::string &name,
                      const FrameBufferProperties &fb_prop,
                      const WindowProperties &win_prop,
                      int flags,

+ 1 - 1
panda/src/vulkandisplay/vulkanGraphicsBuffer.h

@@ -23,7 +23,7 @@
 class EXPCL_VULKANDISPLAY VulkanGraphicsBuffer : public GraphicsBuffer {
 public:
   VulkanGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe,
-                       const string &name,
+                       const std::string &name,
                        const FrameBufferProperties &fb_prop,
                        const WindowProperties &win_prop,
                        int flags,

+ 2 - 2
panda/src/vulkandisplay/vulkanGraphicsPipe.cxx

@@ -624,7 +624,7 @@ get_vendor_name() const {
  * choose between several possible GraphicsPipes available on a particular
  * platform, so the name should be meaningful and unique for a given platform.
  */
-string VulkanGraphicsPipe::
+std::string VulkanGraphicsPipe::
 get_interface_name() const {
   return "Vulkan";
 }
@@ -643,7 +643,7 @@ pipe_constructor() {
  * only called from GraphicsEngine::make_output.
  */
 PT(GraphicsOutput) VulkanGraphicsPipe::
-make_output(const string &name,
+make_output(const std::string &name,
             const FrameBufferProperties &fb_prop,
             const WindowProperties &win_prop,
             int flags,

+ 2 - 2
panda/src/vulkandisplay/vulkanGraphicsPipe.h

@@ -47,11 +47,11 @@ public:
 
   const char *get_vendor_name() const;
 
-  virtual string get_interface_name() const;
+  virtual std::string get_interface_name() const;
   static PT(GraphicsPipe) pipe_constructor();
 
 protected:
-  virtual PT(GraphicsOutput) make_output(const string &name,
+  virtual PT(GraphicsOutput) make_output(const std::string &name,
                                          const FrameBufferProperties &fb_prop,
                                          const WindowProperties &win_prop,
                                          int flags,

+ 28 - 32
panda/src/vulkandisplay/vulkanGraphicsStateGuardian.I

@@ -21,6 +21,17 @@ PipelineKey(const PipelineKey &copy) :
   _topology(copy._topology) {
 }
 
+/**
+ * Move constructor for PipelineKey, defined for efficiency (so that we don't
+ * have to increase and decrease the reference count when moving this object).
+ */
+INLINE VulkanGraphicsStateGuardian::PipelineKey::
+PipelineKey(PipelineKey &&from) noexcept :
+  _state(std::move(from._state)),
+  _format(std::move(from._format)),
+  _topology(from._topology) {
+}
+
 /**
  * Copy assignment operator for PipelineKey.
  */
@@ -31,28 +42,15 @@ operator = (const PipelineKey &copy) {
   _topology = copy._topology;
 }
 
-#ifdef USE_MOVE_SEMANTICS
-/**
- * Move constructor for PipelineKey, defined for efficiency (so that we don't
- * have to increase and decrease the reference count when moving this object).
- */
-INLINE VulkanGraphicsStateGuardian::PipelineKey::
-PipelineKey(PipelineKey &&from) NOEXCEPT :
-  _state(move(from._state)),
-  _format(move(from._format)),
-  _topology(from._topology) {
-}
-
 /**
  * Move assignment operator for PipelineKey.
  */
 INLINE void VulkanGraphicsStateGuardian::PipelineKey::
-operator = (PipelineKey &&from) NOEXCEPT {
-  _state = move(from._state);
-  _format = move(from._format);
+operator = (PipelineKey &&from) noexcept {
+  _state = std::move(from._state);
+  _format = std::move(from._format);
   _topology = from._topology;
 }
-#endif  // USE_MOVE_SEMANTICS
 
 /**
  * Returns true if these two PipelineKey objects are identical.
@@ -87,6 +85,17 @@ DescriptorSetKey(const DescriptorSetKey &copy) :
   _shader_attrib(copy._shader_attrib) {
 }
 
+/**
+ * Move constructor for DescriptorSetKey, defined for efficiency (so that we
+ * don't have to increase and decrease the reference count when moving this
+ * object).
+ */
+INLINE VulkanGraphicsStateGuardian::DescriptorSetKey::
+DescriptorSetKey(DescriptorSetKey &&from) noexcept :
+  _tex_attrib(std::move(from._tex_attrib)),
+  _shader_attrib(std::move(from._shader_attrib)) {
+}
+
 /**
  * Copy assignment operator for DescriptorSetKey.
  */
@@ -96,27 +105,14 @@ operator = (const DescriptorSetKey &copy) {
   _shader_attrib = copy._shader_attrib;
 }
 
-#ifdef USE_MOVE_SEMANTICS
-/**
- * Move constructor for DescriptorSetKey, defined for efficiency (so that we
- * don't have to increase and decrease the reference count when moving this
- * object).
- */
-INLINE VulkanGraphicsStateGuardian::DescriptorSetKey::
-DescriptorSetKey(DescriptorSetKey &&from) NOEXCEPT :
-  _tex_attrib(move(from._tex_attrib)),
-  _shader_attrib(move(from._shader_attrib)) {
-}
-
 /**
  * Move assignment operator for DescriptorSetKey.
  */
 INLINE void VulkanGraphicsStateGuardian::DescriptorSetKey::
-operator = (DescriptorSetKey &&from) NOEXCEPT {
-  _tex_attrib = move(from._tex_attrib);
-  _shader_attrib = move(from._shader_attrib);
+operator = (DescriptorSetKey &&from) noexcept {
+  _tex_attrib = std::move(from._tex_attrib);
+  _shader_attrib = std::move(from._shader_attrib);
 }
-#endif  // USE_MOVE_SEMANTICS
 
 /**
  * Returns true if these two DescriptorSetKey objects are identical.

+ 10 - 10
panda/src/vulkandisplay/vulkanGraphicsStateGuardian.cxx

@@ -310,29 +310,29 @@ VulkanGraphicsStateGuardian::
 /**
  * Returns the vendor of the video card driver
  */
-string VulkanGraphicsStateGuardian::
+std::string VulkanGraphicsStateGuardian::
 get_driver_vendor() {
   VulkanGraphicsPipe *vkpipe;
   DCAST_INTO_R(vkpipe, get_pipe(), nullptr);
 
   const char *vendor = vkpipe->get_vendor_name();
   if (vendor != nullptr) {
-    return string(vendor);
+    return std::string(vendor);
   } else {
     char vendor[24];
     sprintf(vendor, "Unknown vendor 0x%04X", vkpipe->_gpu_properties.vendorID);
-    return string(vendor);
+    return std::string(vendor);
   }
 }
 
 /**
  * Returns GL_Renderer
  */
-string VulkanGraphicsStateGuardian::
+std::string VulkanGraphicsStateGuardian::
 get_driver_renderer() {
   VulkanGraphicsPipe *vkpipe;
   DCAST_INTO_R(vkpipe, get_pipe(), nullptr);
-  return string(vkpipe->_gpu_properties.deviceName);
+  return std::string(vkpipe->_gpu_properties.deviceName);
 }
 
 /**
@@ -340,9 +340,9 @@ get_driver_renderer() {
  * be "" if the particular graphics implementation does not provide a way to
  * query this information.
  */
-string VulkanGraphicsStateGuardian::
+std::string VulkanGraphicsStateGuardian::
 get_driver_version() {
-  return string();
+  return std::string();
 }
 
 /**
@@ -1093,7 +1093,7 @@ prepare_shader(Shader *shader) {
   VulkanShaderContext *sc = new VulkanShaderContext(shader);
 
   for (int i = 0; i < 2; ++i) {
-    string code = shader->get_text(shader_types[i]);
+    std::string code = shader->get_text(shader_types[i]);
 
     VkShaderModuleCreateInfo module_info;
     module_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
@@ -2190,7 +2190,7 @@ get_pipeline(const RenderState *state, const GeomVertexFormat *format,
   it = _pipeline_map.find(key);
   if (it == _pipeline_map.end()) {
     VkPipeline pipeline = make_pipeline(state, format, topology);
-    _pipeline_map[MOVE(key)] = pipeline;
+    _pipeline_map[std::move(key)] = pipeline;
     return pipeline;
   } else {
     return it->second;
@@ -2650,7 +2650,7 @@ get_descriptor_set(const RenderState *state) {
   it = _descriptor_set_map.find(key);
   if (it == _descriptor_set_map.end()) {
     VkDescriptorSet ds = make_descriptor_set(state);
-    _descriptor_set_map[MOVE(key)] = ds;
+    _descriptor_set_map[std::move(key)] = ds;
     return ds;
   } else {
     return it->second;

+ 9 - 13
panda/src/vulkandisplay/vulkanGraphicsStateGuardian.h

@@ -32,9 +32,9 @@ public:
                               uint32_t queue_family_index);
   virtual ~VulkanGraphicsStateGuardian();
 
-  virtual string get_driver_vendor();
-  virtual string get_driver_renderer();
-  virtual string get_driver_version();
+  virtual std::string get_driver_vendor();
+  virtual std::string get_driver_renderer();
+  virtual std::string get_driver_version();
 
   virtual TextureContext *prepare_texture(Texture *tex, int view);
   bool upload_texture(VulkanTextureContext *vtc);
@@ -132,12 +132,10 @@ private:
   struct PipelineKey {
     INLINE PipelineKey() = default;
     INLINE PipelineKey(const PipelineKey &copy);
-    INLINE void operator = (const PipelineKey &copy);
+    INLINE PipelineKey(PipelineKey &&from) noexcept;
 
-#ifdef USE_MOVE_SEMANTICS
-    INLINE PipelineKey(PipelineKey &&from) NOEXCEPT;
-    INLINE void operator = (PipelineKey &&from) NOEXCEPT;
-#endif
+    INLINE void operator = (const PipelineKey &copy);
+    INLINE void operator = (PipelineKey &&from) noexcept;
 
     INLINE bool operator ==(const PipelineKey &other) const;
     INLINE bool operator < (const PipelineKey &other) const;
@@ -161,12 +159,10 @@ private:
   struct DescriptorSetKey {
     INLINE DescriptorSetKey() = default;
     INLINE DescriptorSetKey(const DescriptorSetKey &copy);
-    INLINE void operator = (const DescriptorSetKey &copy);
+    INLINE DescriptorSetKey(DescriptorSetKey &&from) noexcept;
 
-#ifdef USE_MOVE_SEMANTICS
-    INLINE DescriptorSetKey(DescriptorSetKey &&from) NOEXCEPT;
-    INLINE void operator = (DescriptorSetKey &&from) NOEXCEPT;
-#endif
+    INLINE void operator = (const DescriptorSetKey &copy);
+    INLINE void operator = (DescriptorSetKey &&from) noexcept;
 
     INLINE bool operator ==(const DescriptorSetKey &other) const;
     INLINE bool operator < (const DescriptorSetKey &other) const;

+ 6 - 6
panda/src/vulkandisplay/vulkanGraphicsWindow.cxx

@@ -21,12 +21,12 @@ TypeHandle VulkanGraphicsWindow::_type_handle;
  */
 VulkanGraphicsWindow::
 VulkanGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
-                  const string &name,
-                  const FrameBufferProperties &fb_prop,
-                  const WindowProperties &win_prop,
-                  int flags,
-                  GraphicsStateGuardian *gsg,
-                  GraphicsOutput *host) :
+                     const std::string &name,
+                     const FrameBufferProperties &fb_prop,
+                     const WindowProperties &win_prop,
+                     int flags,
+                     GraphicsStateGuardian *gsg,
+                     GraphicsOutput *host) :
   BaseGraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host),
   _surface(VK_NULL_HANDLE),
   _swapchain(VK_NULL_HANDLE),

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

@@ -35,7 +35,7 @@ typedef GraphicsWindow BaseGraphicsWindow;
 class EXPCL_VULKANDISPLAY VulkanGraphicsWindow : public BaseGraphicsWindow {
 public:
   VulkanGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
-                       const string &name,
+                       const std::string &name,
                        const FrameBufferProperties &fb_prop,
                        const WindowProperties &win_prop,
                        int flags,