mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
GPU: Delete copy operations on classes that own resources
These own GPU objects, memory or refcounts in their destructors (or assert there that they were torn down), so a copy would double-free. Nothing copies them today; this keeps it that way. The manager base classes cover every backend's subclass. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
39049a67fd
commit
93f57a4f38
23 files changed
+70
No files matched your search
@@ -30,6 +30,8 @@ static inline int operator &(const GLBufferStrategy &lhs, const GLBufferStrategy
|
||||
|
||||
class GLRBuffer {
|
||||
public:
|
||||
GLRBuffer(const GLRBuffer &) = delete;
|
||||
GLRBuffer &operator=(const GLRBuffer &) = delete;
|
||||
GLRBuffer(GLuint target, size_t size) : target_(target), size_((int)size) {}
|
||||
~GLRBuffer() {
|
||||
if (buffer_) {
|
||||
|
||||
@@ -30,6 +30,8 @@ constexpr int MAX_GL_TEXTURE_SLOTS = 8;
|
||||
|
||||
class GLRTexture {
|
||||
public:
|
||||
GLRTexture(const GLRTexture &) = delete;
|
||||
GLRTexture &operator=(const GLRTexture &) = delete;
|
||||
GLRTexture(const Draw::DeviceCaps &caps, int width, int height, int depth, int numMips);
|
||||
~GLRTexture();
|
||||
|
||||
@@ -53,6 +55,8 @@ public:
|
||||
|
||||
class GLRFramebuffer {
|
||||
public:
|
||||
GLRFramebuffer(const GLRFramebuffer &) = delete;
|
||||
GLRFramebuffer &operator=(const GLRFramebuffer &) = delete;
|
||||
GLRFramebuffer(const Draw::DeviceCaps &caps, int _width, int _height, bool z_stencil, const char *tag)
|
||||
: color_texture(caps, _width, _height, 1, 1), z_stencil_texture(caps, _width, _height, 1, 1),
|
||||
width(_width), height(_height), z_stencil_(z_stencil) {
|
||||
@@ -83,6 +87,8 @@ private:
|
||||
|
||||
class GLRShader {
|
||||
public:
|
||||
GLRShader(const GLRShader &) = delete;
|
||||
GLRShader &operator=(const GLRShader &) = delete;
|
||||
explicit GLRShader(std::string_view _desc) : desc(_desc) {}
|
||||
~GLRShader() {
|
||||
if (shader) {
|
||||
@@ -116,6 +122,9 @@ public:
|
||||
|
||||
class GLRProgram {
|
||||
public:
|
||||
GLRProgram() = default;
|
||||
GLRProgram(const GLRProgram &) = delete;
|
||||
GLRProgram &operator=(const GLRProgram &) = delete;
|
||||
~GLRProgram() {
|
||||
if (deleteCallback_) {
|
||||
deleteCallback_(deleteParam_);
|
||||
|
||||
@@ -12,6 +12,8 @@ struct VKRImage;
|
||||
|
||||
class VulkanBarrierBatch {
|
||||
public:
|
||||
VulkanBarrierBatch(const VulkanBarrierBatch &) = delete;
|
||||
VulkanBarrierBatch &operator=(const VulkanBarrierBatch &) = delete;
|
||||
VulkanBarrierBatch() : imageBarriers_(4) {}
|
||||
~VulkanBarrierBatch();
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ enum class BindingType {
|
||||
// Only appropriate for use in a per-frame pool.
|
||||
class VulkanDescSetPool {
|
||||
public:
|
||||
VulkanDescSetPool(const VulkanDescSetPool &) = delete;
|
||||
VulkanDescSetPool &operator=(const VulkanDescSetPool &) = delete;
|
||||
VulkanDescSetPool(const char *tag, bool grow = true) : tag_(tag), grow_(grow) {}
|
||||
~VulkanDescSetPool();
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@ struct VKRImage {
|
||||
|
||||
class VKRFramebuffer {
|
||||
public:
|
||||
VKRFramebuffer(const VKRFramebuffer &) = delete;
|
||||
VKRFramebuffer &operator=(const VKRFramebuffer &) = delete;
|
||||
VKRFramebuffer(VulkanContext *vk, VulkanBarrierBatch *barriers, int _width, int _height, int _numLayers, int _multiSampleLevel, bool createDepthStencilBuffer, const char *tag);
|
||||
~VKRFramebuffer();
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ struct TextureCopyBatch {
|
||||
// ALWAYS use an allocator when calling CreateDirect.
|
||||
class VulkanTexture {
|
||||
public:
|
||||
VulkanTexture(const VulkanTexture &) = delete;
|
||||
VulkanTexture &operator=(const VulkanTexture &) = delete;
|
||||
VulkanTexture(VulkanContext *vulkan, const char *tag);
|
||||
~VulkanTexture() {
|
||||
Destroy();
|
||||
|
||||
@@ -115,6 +115,8 @@ public:
|
||||
|
||||
// Wrapped pipeline. Does own desc!
|
||||
struct VKRGraphicsPipeline {
|
||||
VKRGraphicsPipeline(const VKRGraphicsPipeline &) = delete;
|
||||
VKRGraphicsPipeline &operator=(const VKRGraphicsPipeline &) = delete;
|
||||
VKRGraphicsPipeline(PipelineFlags flags, const char *tag) : flags_(flags), tag_(tag) {}
|
||||
~VKRGraphicsPipeline();
|
||||
|
||||
@@ -195,6 +197,9 @@ static_assert(sizeof(PackedDescriptor::buffer) == 16, "PackedDescriptor should b
|
||||
// Note that we only support a single descriptor set due to compatibility with some ancient devices.
|
||||
// We should probably eventually give that up eventually.
|
||||
struct VKRPipelineLayout {
|
||||
VKRPipelineLayout() = default;
|
||||
VKRPipelineLayout(const VKRPipelineLayout &) = delete;
|
||||
VKRPipelineLayout &operator=(const VKRPipelineLayout &) = delete;
|
||||
~VKRPipelineLayout();
|
||||
|
||||
enum { MAX_DESC_SET_BINDINGS = 5 };
|
||||
|
||||
@@ -51,6 +51,8 @@ class TextDrawer;
|
||||
|
||||
class DrawBuffer {
|
||||
public:
|
||||
DrawBuffer(const DrawBuffer &) = delete;
|
||||
DrawBuffer &operator=(const DrawBuffer &) = delete;
|
||||
DrawBuffer();
|
||||
~DrawBuffer();
|
||||
|
||||
|
||||
@@ -96,6 +96,9 @@ struct AtlasFontHeader {
|
||||
};
|
||||
|
||||
struct AtlasFont {
|
||||
AtlasFont() = default;
|
||||
AtlasFont(const AtlasFont &) = delete;
|
||||
AtlasFont &operator=(const AtlasFont &) = delete;
|
||||
~AtlasFont();
|
||||
|
||||
float padding;
|
||||
@@ -126,6 +129,9 @@ struct AtlasHeader {
|
||||
};
|
||||
|
||||
struct Atlas {
|
||||
Atlas() = default;
|
||||
Atlas(const Atlas &) = delete;
|
||||
Atlas &operator=(const Atlas &) = delete;
|
||||
~Atlas();
|
||||
bool LoadMeta(const uint8_t *data, size_t data_size);
|
||||
bool IsMetadataLoaded() const {
|
||||
|
||||
Reference in new issue
Block a user