mirror of https://github.com/AxioDL/boo.git
IGraphicsDataToken rename
This commit is contained in:
parent
11cc456b4e
commit
aa787eb427
|
@ -58,7 +58,7 @@ public:
|
|||
size_t texCount, ITexture** texs);
|
||||
|
||||
void reset();
|
||||
IGraphicsDataToken commit();
|
||||
GraphicsDataToken commit();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ struct IShaderDataBinding {};
|
|||
|
||||
/** Opaque object for maintaining ownership of factory-created resources */
|
||||
struct IGraphicsData {};
|
||||
class IGraphicsDataToken;
|
||||
class GraphicsDataToken;
|
||||
|
||||
/** Used by platform shader pipeline constructors */
|
||||
enum class BlendFactor
|
||||
|
@ -218,18 +218,18 @@ struct IGraphicsDataFactory
|
|||
size_t texCount, ITexture** texs)=0;
|
||||
|
||||
virtual void reset()=0;
|
||||
virtual IGraphicsDataToken commit()=0;
|
||||
virtual GraphicsDataToken commit()=0;
|
||||
|
||||
private:
|
||||
friend class IGraphicsDataToken;
|
||||
friend class GraphicsDataToken;
|
||||
virtual void destroyData(IGraphicsData*)=0;
|
||||
virtual void destroyAllData()=0;
|
||||
};
|
||||
|
||||
/** Opaque token for maintaining ownership of factory-created resources
|
||||
/** Ownership token for maintaining lifetime of factory-created resources
|
||||
* deletion of this token triggers mass-deallocation of the factory's
|
||||
* IGraphicsData. */
|
||||
class IGraphicsDataToken
|
||||
* IGraphicsData (please don't delete and draw contained resources in the same frame). */
|
||||
class GraphicsDataToken
|
||||
{
|
||||
friend class GLDataFactory;
|
||||
friend class D3D12DataFactory;
|
||||
|
@ -237,7 +237,7 @@ class IGraphicsDataToken
|
|||
friend class MetalDataFactory;
|
||||
IGraphicsDataFactory* m_factory = nullptr;
|
||||
IGraphicsData* m_data = nullptr;
|
||||
IGraphicsDataToken(IGraphicsDataFactory* factory, IGraphicsData* data)
|
||||
GraphicsDataToken(IGraphicsDataFactory* factory, IGraphicsData* data)
|
||||
: m_factory(factory), m_data(data) {}
|
||||
void doDestroy()
|
||||
{
|
||||
|
@ -245,17 +245,17 @@ class IGraphicsDataToken
|
|||
m_factory->destroyData(m_data);
|
||||
}
|
||||
public:
|
||||
IGraphicsDataToken() = default;
|
||||
IGraphicsDataToken(const IGraphicsDataToken& other) = delete;
|
||||
IGraphicsDataToken(IGraphicsDataToken&& other)
|
||||
GraphicsDataToken() = default;
|
||||
GraphicsDataToken(const GraphicsDataToken& other) = delete;
|
||||
GraphicsDataToken(GraphicsDataToken&& other)
|
||||
{
|
||||
m_factory = other.m_factory;
|
||||
other.m_factory = nullptr;
|
||||
m_data = other.m_data;
|
||||
other.m_data = nullptr;
|
||||
}
|
||||
IGraphicsDataToken& operator=(const IGraphicsDataToken& other) = delete;
|
||||
IGraphicsDataToken& operator=(IGraphicsDataToken&& other)
|
||||
GraphicsDataToken& operator=(const GraphicsDataToken& other) = delete;
|
||||
GraphicsDataToken& operator=(GraphicsDataToken&& other)
|
||||
{
|
||||
doDestroy();
|
||||
m_factory = other.m_factory;
|
||||
|
@ -264,7 +264,7 @@ public:
|
|||
other.m_data = nullptr;
|
||||
return *this;
|
||||
}
|
||||
~IGraphicsDataToken() {doDestroy();}
|
||||
~GraphicsDataToken() {doDestroy();}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -584,10 +584,10 @@ void GLDataFactory::reset()
|
|||
m_deferredData = nullptr;
|
||||
}
|
||||
|
||||
IGraphicsDataToken GLDataFactory::commit()
|
||||
GraphicsDataToken GLDataFactory::commit()
|
||||
{
|
||||
if (!m_deferredData)
|
||||
return IGraphicsDataToken(this, nullptr);
|
||||
return GraphicsDataToken(this, nullptr);
|
||||
std::unique_lock<std::mutex> lk(m_committedMutex);
|
||||
GLData* retval = m_deferredData;
|
||||
#ifndef NDEBUG
|
||||
|
@ -600,7 +600,7 @@ IGraphicsDataToken GLDataFactory::commit()
|
|||
While this isn't strictly required, some drivers might behave
|
||||
differently */
|
||||
glFlush();
|
||||
return IGraphicsDataToken(this, retval);
|
||||
return GraphicsDataToken(this, retval);
|
||||
}
|
||||
|
||||
void GLDataFactory::destroyData(IGraphicsData* d)
|
||||
|
|
|
@ -377,7 +377,7 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
factory->newShaderDataBinding(pipeline, vfmt, vbo, nullptr, nullptr, 0, nullptr, 1, &texture);
|
||||
|
||||
/* Commit objects */
|
||||
IGraphicsDataToken data = factory->commit();
|
||||
GraphicsDataToken data = factory->commit();
|
||||
|
||||
/* Return control to client */
|
||||
lk.unlock();
|
||||
|
|
Loading…
Reference in New Issue