Skip to content

Commit

Permalink
Remove getBaseObject
Browse files Browse the repository at this point in the history
Nothing used it, and you should always be able to `static_cast<MVKBaseObject*>` for any object without a crazy inheritance tree
  • Loading branch information
etang-cw committed Sep 27, 2023
1 parent 5a216ab commit aeae18d
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 17 deletions.
1 change: 0 additions & 1 deletion MoltenVK/MoltenVK/Commands/MVKCommandBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ class MVKCommandBuffer : public MVKDispatchableVulkanAPIObject,
friend class MVKCommandEncoder;
friend class MVKCommandPool;

MVKBaseObject* getBaseObject() override { return this; };
void propagateDebugName() override {}
void init(const VkCommandBufferAllocateInfo* pAllocateInfo);
bool canExecute();
Expand Down
1 change: 0 additions & 1 deletion MoltenVK/MoltenVK/Commands/MVKMTLBufferAllocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class MVKMTLBufferAllocationPool : public MVKObjectPool<MVKMTLBufferAllocation>,
protected:
friend class MVKMTLBufferAllocation;

MVKBaseObject* getBaseObject() override { return this; };
MVKMTLBufferAllocation* newObject() override;
void returnAllocationUnlocked(MVKMTLBufferAllocation* ba);
void returnAllocation(MVKMTLBufferAllocation* ba);
Expand Down
14 changes: 1 addition & 13 deletions MoltenVK/MoltenVK/GPUObjects/MVKDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -959,13 +959,9 @@ class MVKDeviceTrackingMixin {
bool isUsingPipelineStageMetalArgumentBuffers() { return isUsingMetalArgumentBuffers() && !_device->_pMetalFeatures->descriptorSetArgumentBuffers; };

/** Constructs an instance for the specified device. */
MVKDeviceTrackingMixin(MVKDevice* device) : _device(device) { assert(_device); }

virtual ~MVKDeviceTrackingMixin() {}
MVKDeviceTrackingMixin(MVKDevice* device) : _device(device) { assert(_device); }

protected:
virtual MVKBaseObject* getBaseObject() = 0;

MVKDevice* _device;
};

Expand All @@ -980,9 +976,6 @@ class MVKBaseDeviceObject : public MVKBaseObject, public MVKDeviceTrackingMixin

/** Constructs an instance for the specified device. */
MVKBaseDeviceObject(MVKDevice* device) : MVKDeviceTrackingMixin(device) {}

protected:
MVKBaseObject* getBaseObject() override { return this; };
};


Expand All @@ -999,10 +992,6 @@ class MVKVulkanAPIDeviceObject : public MVKVulkanAPIObject, public MVKDeviceTrac

/** Constructs an instance for the specified device. */
MVKVulkanAPIDeviceObject(MVKDevice* device) : MVKDeviceTrackingMixin(device) {}

protected:
MVKBaseObject* getBaseObject() override { return this; };

};


Expand Down Expand Up @@ -1055,7 +1044,6 @@ class MVKDeviceObjectPool : public MVKObjectPool<T>, public MVKDeviceTrackingMix

protected:
T* newObject() override { return new T(_device); }
MVKBaseObject* getBaseObject() override { return this; };

};

Expand Down
1 change: 0 additions & 1 deletion MoltenVK/MoltenVK/GPUObjects/MVKQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ class MVKQueue : public MVKDispatchableVulkanAPIObject, public MVKDeviceTracking
friend class MVKQueueCommandBufferSubmission;
friend class MVKQueuePresentSurfaceSubmission;

MVKBaseObject* getBaseObject() override { return this; };
void propagateDebugName() override;
void initName();
void initExecQueue();
Expand Down
2 changes: 1 addition & 1 deletion MoltenVK/MoltenVK/Utility/MVKBaseObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class MVKBaseObject {
/** Destroys this object. Default behaviour simply deletes it. Subclasses may override to delay deletion. */
virtual void destroy() { delete this; }

virtual ~MVKBaseObject() {}
virtual ~MVKBaseObject() {}

protected:
static VkResult reportResult(MVKBaseObject* mvkObj, VkResult vkRslt, MVKConfigLogLevel logLevel, const char* format, va_list args) __printflike(4, 0);
Expand Down

0 comments on commit aeae18d

Please sign in to comment.