Browse Source

Refactoring

Panagiotis Christopoulos Charitos 9 years ago
parent
commit
c4b7a959f9
41 changed files with 54 additions and 57 deletions
  1. 1 1
      include/anki/gr/Buffer.h
  2. 2 2
      include/anki/gr/CommandBuffer.h
  3. 1 1
      include/anki/gr/Framebuffer.h
  4. 2 2
      include/anki/gr/GrManager.h
  5. 1 1
      include/anki/gr/OcclusionQuery.h
  6. 1 1
      include/anki/gr/Pipeline.h
  7. 1 1
      include/anki/gr/ResourceGroup.h
  8. 2 2
      include/anki/gr/Sampler.h
  9. 1 1
      include/anki/gr/Shader.h
  10. 1 1
      include/anki/gr/Texture.h
  11. 1 1
      include/anki/gr/gl/BufferImpl.h
  12. 1 1
      include/anki/gr/gl/CommandBufferImpl.h
  13. 1 1
      include/anki/gr/gl/FramebufferImpl.h
  14. 1 1
      include/anki/gr/gl/GrManagerImpl.h
  15. 1 1
      include/anki/gr/gl/OcclusionQueryImpl.h
  16. 1 1
      include/anki/gr/gl/PipelineImpl.h
  17. 1 1
      include/anki/gr/gl/ResourceGroupImpl.h
  18. 1 4
      include/anki/gr/gl/SamplerImpl.h
  19. 1 1
      include/anki/gr/gl/ShaderImpl.h
  20. 1 1
      include/anki/gr/gl/TextureImpl.h
  21. 1 1
      src/core/App.cpp
  22. 2 2
      src/gr/gl/Buffer.cpp
  23. 1 1
      src/gr/gl/BufferImpl.cpp
  24. 2 2
      src/gr/gl/CommandBuffer.cpp
  25. 1 1
      src/gr/gl/CommandBufferImpl.cpp
  26. 2 2
      src/gr/gl/Framebuffer.cpp
  27. 1 1
      src/gr/gl/FramebufferImpl.cpp
  28. 2 2
      src/gr/gl/GrManager.cpp
  29. 1 1
      src/gr/gl/GrManagerImpl.cpp
  30. 2 2
      src/gr/gl/OcclusionQuery.cpp
  31. 1 1
      src/gr/gl/OcclusionQueryImpl.cpp
  32. 2 2
      src/gr/gl/Pipeline.cpp
  33. 1 1
      src/gr/gl/PipelineImpl.cpp
  34. 2 2
      src/gr/gl/ResourceGroup.cpp
  35. 1 1
      src/gr/gl/ResourceGroupImpl.cpp
  36. 2 2
      src/gr/gl/Sampler.cpp
  37. 1 1
      src/gr/gl/SamplerImpl.cpp
  38. 2 2
      src/gr/gl/Shader.cpp
  39. 1 1
      src/gr/gl/ShaderImpl.cpp
  40. 2 2
      src/gr/gl/Texture.cpp
  41. 1 1
      src/gr/gl/TextureImpl.cpp

+ 1 - 1
include/anki/gr/Buffer.h

@@ -30,7 +30,7 @@ public:
 	}
 
 	/// Allocate the buffer.
-	void create(PtrSize size, BufferUsageBit usage, BufferAccessBit access);
+	void init(PtrSize size, BufferUsageBit usage, BufferAccessBit access);
 
 	/// Map the buffer.
 	void* map(PtrSize offset, PtrSize range, BufferAccessBit access);

+ 2 - 2
include/anki/gr/CommandBuffer.h

@@ -103,8 +103,8 @@ public:
 		return *m_impl;
 	}
 
-	/// Create command buffer.
-	void create(CommandBufferInitInfo& inf);
+	/// Init the command buffer.
+	void init(CommandBufferInitInfo& inf);
 
 	/// Compute initialization hints.
 	CommandBufferInitHints computeInitHints() const;

+ 1 - 1
include/anki/gr/Framebuffer.h

@@ -110,7 +110,7 @@ public:
 	}
 
 	/// Create.
-	void create(const FramebufferInitInfo& init);
+	void init(const FramebufferInitInfo& init);
 
 private:
 	UniquePtr<FramebufferImpl> m_impl;

+ 2 - 2
include/anki/gr/GrManager.h

@@ -61,7 +61,7 @@ public:
 	~GrManager();
 
 	/// Create.
-	ANKI_USE_RESULT Error create(GrManagerInitInfo& init);
+	ANKI_USE_RESULT Error init(GrManagerInitInfo& init);
 
 	/// Swap buffers
 	void swapBuffers();
@@ -115,7 +115,7 @@ template<typename T, typename... Args>
 IntrusivePtr<T> GrManager::newInstance(Args&&... args)
 {
 	IntrusivePtr<T> ptr(m_alloc.newInstance<T>(this));
-	ptr->create(args...);
+	ptr->init(args...);
 	return ptr;
 }
 /// @}

+ 1 - 1
include/anki/gr/OcclusionQuery.h

@@ -30,7 +30,7 @@ public:
 	}
 
 	/// Create a query.
-	void create(OcclusionQueryResultBit condRenderingBit);
+	void init(OcclusionQueryResultBit condRenderingBit);
 
 private:
 	UniquePtr<OcclusionQueryImpl> m_impl;

+ 1 - 1
include/anki/gr/Pipeline.h

@@ -157,7 +157,7 @@ public:
 	}
 
 	/// Create.
-	void create(const PipelineInitInfo& init);
+	void init(const PipelineInitInfo& init);
 
 private:
 	UniquePtr<PipelineImpl> m_impl;

+ 1 - 1
include/anki/gr/ResourceGroup.h

@@ -73,7 +73,7 @@ public:
 	}
 
 	/// Create.
-	void create(const ResourceGroupInitInfo& init);
+	void init(const ResourceGroupInitInfo& init);
 
 private:
 	UniquePtr<ResourceGroupImpl> m_impl;

+ 2 - 2
include/anki/gr/Sampler.h

@@ -30,8 +30,8 @@ public:
 		return *m_impl;
 	}
 
-	/// Create it.
-	void create(const SamplerInitInfo& init);
+	/// Initialize it.
+	void init(const SamplerInitInfo& init);
 
 private:
 	UniquePtr<SamplerImpl> m_impl;

+ 1 - 1
include/anki/gr/Shader.h

@@ -76,7 +76,7 @@ public:
 	}
 
 	/// Create shader.
-	void create(ShaderType shaderType, const void* source, PtrSize sourceSize);
+	void init(ShaderType shaderType, const void* source, PtrSize sourceSize);
 
 private:
 	UniquePtr<ShaderImpl> m_impl;

+ 1 - 1
include/anki/gr/Texture.h

@@ -58,7 +58,7 @@ public:
 	}
 
 	/// Create it.
-	void create(const TextureInitInfo& init);
+	void init(const TextureInitInfo& init);
 
 private:
 	UniquePtr<TextureImpl> m_impl;

+ 1 - 1
include/anki/gr/gl/BufferImpl.h

@@ -36,7 +36,7 @@ public:
 		destroyDeferred(glDeleteBuffers);
 	}
 
-	void create(PtrSize size, BufferUsageBit usage, BufferAccessBit access);
+	void init(PtrSize size, BufferUsageBit usage, BufferAccessBit access);
 
 	void bind(GLenum target, U32 binding, PtrSize offset, PtrSize size) const
 	{

+ 1 - 1
include/anki/gr/gl/CommandBufferImpl.h

@@ -67,7 +67,7 @@ public:
 	/// Default constructor
 	/// @param server The command buffers server
 	/// @param hints Hints to optimize the command's allocator
-	void create(const InitHints& hints);
+	void init(const InitHints& hints);
 
 	/// Get the internal allocator.
 	CommandBufferAllocator<U8> getInternalAllocator() const

+ 1 - 1
include/anki/gr/gl/FramebufferImpl.h

@@ -30,7 +30,7 @@ public:
 
 	/// Set all the attachments. It will overwrite the previous state. If the
 	/// initalizer list is empty the it will bind the default framebuffer
-	ANKI_USE_RESULT Error create(const FramebufferInitInfo& init);
+	ANKI_USE_RESULT Error init(const FramebufferInitInfo& init);
 
 	/// Bind it to the state. Call it in rendering thread
 	void bind(const GlState& state);

+ 1 - 1
include/anki/gr/gl/GrManagerImpl.h

@@ -28,7 +28,7 @@ public:
 
 	~GrManagerImpl();
 
-	void create(GrManagerInitInfo& init);
+	void init(GrManagerInitInfo& init);
 
 	const RenderingThread& getRenderingThread() const
 	{

+ 1 - 1
include/anki/gr/gl/OcclusionQueryImpl.h

@@ -31,7 +31,7 @@ public:
 	/// @param condRenderingBit If the query is used in conditional rendering
 	///        the result will be checked against this mask. If the result
 	///        contains any of the bits then the dracall will not be skipped.
-	void create(OcclusionQueryResultBit condRenderingBit);
+	void init(OcclusionQueryResultBit condRenderingBit);
 
 	/// Begin query.
 	void begin();

+ 1 - 1
include/anki/gr/gl/PipelineImpl.h

@@ -25,7 +25,7 @@ public:
 
 	~PipelineImpl();
 
-	ANKI_USE_RESULT Error create(const PipelineInitInfo& init);
+	ANKI_USE_RESULT Error init(const PipelineInitInfo& init);
 
 	/// Bind the pipeline to the state
 	void bind(GlState& state);

+ 1 - 1
include/anki/gr/gl/ResourceGroupImpl.h

@@ -29,7 +29,7 @@ public:
 		m_refs.destroy(getAllocator());
 	}
 
-	void create(const ResourceGroupInitInfo& init);
+	void init(const ResourceGroupInitInfo& init);
 
 	/// Set state.
 	void bind(U slot, const DynamicBufferInfo& dynInfo, GlState& state);

+ 1 - 4
include/anki/gr/gl/SamplerImpl.h

@@ -27,10 +27,7 @@ public:
 		destroyDeferred(glDeleteSamplers);
 	}
 
-	void create(const SamplerInitInfo& sinit);
-
-private:
-	void createInternal(const SamplerInitInfo& sinit);
+	void init(const SamplerInitInfo& sinit);
 };
 /// @}
 

+ 1 - 1
include/anki/gr/gl/ShaderImpl.h

@@ -36,7 +36,7 @@ public:
 	/// Create the shader.
 	/// @param shaderType The type of the shader in the program
 	/// @param source The shader's source
-	ANKI_USE_RESULT Error create(ShaderType shaderType, const CString& source);
+	ANKI_USE_RESULT Error init(ShaderType shaderType, const CString& source);
 
 private:
 	void handleError(String& src);

+ 1 - 1
include/anki/gr/gl/TextureImpl.h

@@ -38,7 +38,7 @@ public:
 	~TextureImpl();
 
 	/// Create the texture storage.
-	void create(const TextureInitInfo& init);
+	void init(const TextureInitInfo& init);
 
 	/// Write texture data.
 	void write(U32 mipmap, U32 slice, void* data, PtrSize dataSize);

+ 1 - 1
src/core/App.cpp

@@ -239,7 +239,7 @@ Error App::createInternal(const ConfigSet& config_,
 	grInit.m_registerDebugMessages = nwinit.m_debugContext;
 	grInit.m_config = &config;
 
-	ANKI_CHECK(m_gr->create(grInit));
+	ANKI_CHECK(m_gr->init(grInit));
 
 	//
 	// Physics

+ 2 - 2
src/gr/gl/Buffer.cpp

@@ -45,7 +45,7 @@ public:
 	{
 		BufferImpl& impl = m_buff->getImplementation();
 
-		impl.create(m_size, m_usage, m_access);
+		impl.init(m_size, m_usage, m_access);
 
 		GlObject::State oldState =
 			impl.setStateAtomically(GlObject::State::CREATED);
@@ -57,7 +57,7 @@ public:
 	}
 };
 
-void Buffer::create(PtrSize size, BufferUsageBit usage, BufferAccessBit access)
+void Buffer::init(PtrSize size, BufferUsageBit usage, BufferAccessBit access)
 {
 	m_impl.reset(getAllocator().newInstance<BufferImpl>(&getManager()));
 

+ 1 - 1
src/gr/gl/BufferImpl.cpp

@@ -11,7 +11,7 @@ namespace anki
 {
 
 //==============================================================================
-void BufferImpl::create(
+void BufferImpl::init(
 	PtrSize size, BufferUsageBit usage, BufferAccessBit access)
 {
 	ANKI_ASSERT(!isCreated());

+ 2 - 2
src/gr/gl/CommandBuffer.cpp

@@ -37,10 +37,10 @@ CommandBuffer::~CommandBuffer()
 }
 
 //==============================================================================
-void CommandBuffer::create(CommandBufferInitInfo& inf)
+void CommandBuffer::init(CommandBufferInitInfo& inf)
 {
 	m_impl.reset(getAllocator().newInstance<CommandBufferImpl>(&getManager()));
-	m_impl->create(inf.m_hints);
+	m_impl->init(inf.m_hints);
 
 #if ANKI_ASSERTS_ENABLED
 	if(inf.m_secondLevel)

+ 1 - 1
src/gr/gl/CommandBufferImpl.cpp

@@ -15,7 +15,7 @@ namespace anki
 {
 
 //==============================================================================
-void CommandBufferImpl::create(const InitHints& hints)
+void CommandBufferImpl::init(const InitHints& hints)
 {
 	auto& pool = m_manager->getAllocator().getMemoryPool();
 

+ 2 - 2
src/gr/gl/Framebuffer.cpp

@@ -38,7 +38,7 @@ public:
 	Error operator()(GlState&)
 	{
 		FramebufferImpl& impl = m_fb->getImplementation();
-		Error err = impl.create(m_init);
+		Error err = impl.init(m_init);
 
 		GlObject::State oldState = impl.setStateAtomically(
 			(err) ? GlObject::State::ERROR : GlObject::State::CREATED);
@@ -49,7 +49,7 @@ public:
 	}
 };
 
-void Framebuffer::create(const FramebufferInitInfo& init)
+void Framebuffer::init(const FramebufferInitInfo& init)
 {
 	m_impl.reset(getAllocator().newInstance<FramebufferImpl>(&getManager()));
 

+ 1 - 1
src/gr/gl/FramebufferImpl.cpp

@@ -16,7 +16,7 @@ namespace anki
 {
 
 //==============================================================================
-Error FramebufferImpl::create(const FramebufferInitInfo& init)
+Error FramebufferImpl::init(const FramebufferInitInfo& init)
 {
 	ANKI_ASSERT(!isCreated());
 	m_in = init;

+ 2 - 2
src/gr/gl/GrManager.cpp

@@ -24,14 +24,14 @@ GrManager::~GrManager()
 }
 
 //==============================================================================
-Error GrManager::create(GrManagerInitInfo& init)
+Error GrManager::init(GrManagerInitInfo& init)
 {
 	m_alloc =
 		HeapAllocator<U8>(init.m_allocCallback, init.m_allocCallbackUserData);
 
 	m_cacheDir.create(m_alloc, init.m_cacheDirectory);
 	m_impl.reset(m_alloc.newInstance<GrManagerImpl>(this));
-	m_impl->create(init);
+	m_impl->init(init);
 
 	return ErrorCode::NONE;
 }

+ 1 - 1
src/gr/gl/GrManagerImpl.cpp

@@ -30,7 +30,7 @@ GrAllocator<U8> GrManagerImpl::getAllocator() const
 }
 
 //==============================================================================
-void GrManagerImpl::create(GrManagerInitInfo& init)
+void GrManagerImpl::init(GrManagerInitInfo& init)
 {
 	// Create thread
 	m_thread =

+ 2 - 2
src/gr/gl/OcclusionQuery.cpp

@@ -38,7 +38,7 @@ public:
 	{
 		OcclusionQueryImpl& impl = m_q->getImplementation();
 
-		impl.create(m_condRenderingBit);
+		impl.init(m_condRenderingBit);
 
 		GlObject::State oldState =
 			impl.setStateAtomically(GlObject::State::CREATED);
@@ -50,7 +50,7 @@ public:
 	}
 };
 
-void OcclusionQuery::create(OcclusionQueryResultBit condRenderingBit)
+void OcclusionQuery::init(OcclusionQueryResultBit condRenderingBit)
 {
 	m_impl.reset(getAllocator().newInstance<OcclusionQueryImpl>(&getManager()));
 

+ 1 - 1
src/gr/gl/OcclusionQueryImpl.cpp

@@ -9,7 +9,7 @@ namespace anki
 {
 
 //==============================================================================
-void OcclusionQueryImpl::create(OcclusionQueryResultBit condRenderingBit)
+void OcclusionQueryImpl::init(OcclusionQueryResultBit condRenderingBit)
 {
 	glGenQueries(1, &m_glName);
 	ANKI_ASSERT(m_glName != 0);

+ 2 - 2
src/gr/gl/Pipeline.cpp

@@ -38,7 +38,7 @@ public:
 	{
 		PipelineImpl& impl = m_ppline->getImplementation();
 
-		Error err = impl.create(m_init);
+		Error err = impl.init(m_init);
 
 		GlObject::State oldState = impl.setStateAtomically(
 			err ? GlObject::State::ERROR : GlObject::State::CREATED);
@@ -49,7 +49,7 @@ public:
 	}
 };
 
-void Pipeline::create(const PipelineInitInfo& init)
+void Pipeline::init(const PipelineInitInfo& init)
 {
 	m_impl.reset(getAllocator().newInstance<PipelineImpl>(&getManager()));
 

+ 1 - 1
src/gr/gl/PipelineImpl.cpp

@@ -109,7 +109,7 @@ PipelineImpl::~PipelineImpl()
 }
 
 //==============================================================================
-Error PipelineImpl::create(const PipelineInitInfo& init)
+Error PipelineImpl::init(const PipelineInitInfo& init)
 {
 	m_in = init;
 

+ 2 - 2
src/gr/gl/ResourceGroup.cpp

@@ -41,7 +41,7 @@ public:
 	{
 		ResourceGroupImpl& impl = m_ptr->getImplementation();
 
-		impl.create(m_init);
+		impl.init(m_init);
 
 		GlObject::State oldState =
 			impl.setStateAtomically(GlObject::State::CREATED);
@@ -53,7 +53,7 @@ public:
 	}
 };
 
-void ResourceGroup::create(const ResourceGroupInitInfo& init)
+void ResourceGroup::init(const ResourceGroupInitInfo& init)
 {
 	// NOTE: Create asynchronously because the initialization touches GL names
 	m_impl.reset(getAllocator().newInstance<ResourceGroupImpl>(&getManager()));

+ 1 - 1
src/gr/gl/ResourceGroupImpl.cpp

@@ -63,7 +63,7 @@ void ResourceGroupImpl::initBuffers(const InBindings& in,
 }
 
 //==============================================================================
-void ResourceGroupImpl::create(const ResourceGroupInitInfo& init)
+void ResourceGroupImpl::init(const ResourceGroupInitInfo& init)
 {
 	U resourcesCount = 0;
 	U dynCount = 0;

+ 2 - 2
src/gr/gl/Sampler.cpp

@@ -38,7 +38,7 @@ public:
 	{
 		SamplerImpl& impl = m_sampler->getImplementation();
 
-		impl.create(m_init);
+		impl.init(m_init);
 
 		GlObject::State oldState =
 			impl.setStateAtomically(GlObject::State::CREATED);
@@ -50,7 +50,7 @@ public:
 	}
 };
 
-void Sampler::create(const SamplerInitInfo& init)
+void Sampler::init(const SamplerInitInfo& init)
 {
 	m_impl.reset(getAllocator().newInstance<SamplerImpl>(&getManager()));
 

+ 1 - 1
src/gr/gl/SamplerImpl.cpp

@@ -10,7 +10,7 @@ namespace anki
 {
 
 //==============================================================================
-void SamplerImpl::create(const SamplerInitInfo& sinit)
+void SamplerImpl::init(const SamplerInitInfo& sinit)
 {
 	glGenSamplers(1, &m_glName);
 	ANKI_ASSERT(m_glName);

+ 2 - 2
src/gr/gl/Shader.cpp

@@ -45,7 +45,7 @@ public:
 	{
 		ShaderImpl& impl = m_shader->getImplementation();
 
-		Error err = impl.create(m_type, m_source);
+		Error err = impl.init(m_type, m_source);
 
 		GlObject::State oldState = impl.setStateAtomically(
 			(err) ? GlObject::State::ERROR : GlObject::State::CREATED);
@@ -59,7 +59,7 @@ public:
 	}
 };
 
-void Shader::create(
+void Shader::init(
 	ShaderType shaderType, const void* source, PtrSize sourceSize)
 {
 	ANKI_ASSERT(source);

+ 1 - 1
src/gr/gl/ShaderImpl.cpp

@@ -41,7 +41,7 @@ ShaderImpl::~ShaderImpl()
 }
 
 //==============================================================================
-Error ShaderImpl::create(ShaderType type, const CString& source)
+Error ShaderImpl::init(ShaderType type, const CString& source)
 {
 	ANKI_ASSERT(source);
 	ANKI_ASSERT(!isCreated());

+ 2 - 2
src/gr/gl/Texture.cpp

@@ -38,7 +38,7 @@ public:
 	{
 		TextureImpl& impl = m_tex->getImplementation();
 
-		impl.create(m_init);
+		impl.init(m_init);
 
 		GlObject::State oldState =
 			impl.setStateAtomically(GlObject::State::CREATED);
@@ -49,7 +49,7 @@ public:
 	}
 };
 
-void Texture::create(const TextureInitInfo& init)
+void Texture::init(const TextureInitInfo& init)
 {
 	m_impl.reset(getAllocator().newInstance<TextureImpl>(&getManager()));
 

+ 1 - 1
src/gr/gl/TextureImpl.cpp

@@ -269,7 +269,7 @@ void TextureImpl::bind()
 }
 
 //==============================================================================
-void TextureImpl::create(const TextureInitInfo& init)
+void TextureImpl::init(const TextureInitInfo& init)
 {
 	GrAllocator<U8> alloc = getAllocator();
 	const SamplerInitInfo& sinit = init.m_sampling;