Sfoglia il codice sorgente

Vulkan skeleton files

Panagiotis Christopoulos Charitos 9 anni fa
parent
commit
d55d6641dd

+ 2 - 0
CMakeLists.txt

@@ -89,6 +89,8 @@ set(ANKI_EXTRA_LIB_DIRS CACHE STRING "Some extra lib paths (Needed for some weir
 # Valgrind
 option(ANKI_VALGRIND_HAPPY "Make valgrind happy" OFF)
 
+set(ANKI_GR_BACKEND "GL" CACHE STRING "The graphics API (GL or VULKAN)")
+
 ################################################################################
 # Compiler & linker flags                                                      #
 ################################################################################

+ 5 - 0
include/anki/Config.h.cmake

@@ -105,6 +105,11 @@
 #	define ANKI_GL_STR "ANKI_GL_ES"
 #endif
 
+// Graphics backend
+#define ANKI_GR_BACKEND_GL 1
+#define ANKI_GR_BACKEND_VULKAN 2
+#define ANKI_GR_BACKEND ANKI_GR_BACKEND_${ANKI_GR_BACKEND}
+
 // Enable performance counters
 #define ANKI_ENABLE_TRACE ${_ANKI_ENABLE_TRACE}
 

+ 29 - 0
include/anki/gr/vulkan/BufferImpl.h

@@ -0,0 +1,29 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/vulkan/VulkanObject.h>
+
+namespace anki
+{
+
+/// @addtogroup vulkan
+/// @{
+
+/// Buffer implementation
+class BufferImpl : public VulkanObject
+{
+public:
+	BufferImpl(GrManager* manager)
+		: VulkanObject(manager)
+	{
+	}
+
+	~BufferImpl();
+};
+/// @}
+
+} // end namespace anki

+ 31 - 0
include/anki/gr/vulkan/CommandBufferImpl.h

@@ -0,0 +1,31 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/vulkan/VulkanObject.h>
+
+namespace anki
+{
+
+/// @addtogroup vulkan
+/// @{
+
+/// Command buffer implementation.
+class CommandBufferImpl : public VulkanObject
+{
+public:
+	/// Default constructor
+	CommandBufferImpl(GrManager* manager)
+		: VulkanObject(manager)
+	{
+	}
+
+	~CommandBufferImpl();
+};
+/// @}
+
+} // end namespace anki
+

+ 9 - 0
include/anki/gr/vulkan/Common.h

@@ -0,0 +1,9 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/Common.h>
+

+ 30 - 0
include/anki/gr/vulkan/FramebufferImpl.h

@@ -0,0 +1,30 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/vulkan/VulkanObject.h>
+
+namespace anki
+{
+
+/// @addtogroup vulkan
+/// @{
+
+/// Framebuffer implementation.
+class FramebufferImpl : public VulkanObject
+{
+public:
+	FramebufferImpl(GrManager* manager)
+		: VulkanObject(manager)
+	{
+	}
+
+	~FramebufferImpl();
+};
+/// @}
+
+} // end namespace anki
+

+ 30 - 0
include/anki/gr/vulkan/GrManagerImpl.h

@@ -0,0 +1,30 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/vulkan/Common.h>
+
+namespace anki 
+{
+
+/// @addtogroup vulkan
+/// @{
+
+/// Vulkan implementation of GrManager.
+class GrManagerImpl
+{
+public:
+	GrManagerImpl(GrManager* manager)
+		: m_manager(manager)
+	{
+		ANKI_ASSERT(manager);
+	}
+
+	~GrManagerImpl();
+};
+/// @}
+
+} // end namespace anki

+ 29 - 0
include/anki/gr/vulkan/OcclusionQueryImpl.h

@@ -0,0 +1,29 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/vulkan/VulkanObject.h>
+
+namespace anki
+{
+
+/// @addtogroup vulkan
+/// @{
+
+/// Occlusion query.
+class OcclusionQueryImpl : public VulkanObject
+{
+public:
+	OcclusionQueryImpl(GrManager* manager)
+		: VulkanObject(manager)
+	{
+	}
+
+	~OcclusionQueryImpl();
+};
+/// @}
+
+} // end namespace anki

+ 29 - 0
include/anki/gr/vulkan/PipelineImpl.h

@@ -0,0 +1,29 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/vulkan/VulkanObject.h>
+
+namespace anki
+{
+
+/// @addtogroup vulkan
+/// @{
+
+/// Program pipeline
+class PipelineImpl : public VulkanObject
+{
+public:
+	PipelineImpl(GrManager* manager)
+		: VulkanObject(manager)
+	{
+	}
+
+	~PipelineImpl();
+};
+/// @}
+
+} // end namespace anki

+ 29 - 0
include/anki/gr/vulkan/ResourceGroupImpl.h

@@ -0,0 +1,29 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/vulkan/VulkanObject.h>
+
+namespace anki
+{
+
+/// @addtogroup vulkan
+/// @{
+
+/// Resource group implementation.
+class ResourceGroupImpl : public VulkanObject
+{
+public:
+	ResourceGroupImpl(GrManager* manager)
+		: VulkanObject(manager)
+	{
+	}
+
+	~ResourceGroupImpl();
+};
+/// @}
+
+} // end namespace anki

+ 30 - 0
include/anki/gr/vulkan/SamplerImpl.h

@@ -0,0 +1,30 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/vulkan/VulkanObject.h>
+
+namespace anki {
+
+/// @addtogroup vulkan
+/// @{
+
+/// Vulkan implementation of Sampler.
+class SamplerImpl : public VulkanObject
+{
+public:
+	SamplerImpl(GrManager* manager)
+		: VulkanObject(manager)
+	{
+	}
+
+	~SamplerImpl();
+
+	void init(const SamplerInitInfo& init);
+};
+/// @}
+
+} // end namespace anki

+ 28 - 0
include/anki/gr/vulkan/ShaderImpl.h

@@ -0,0 +1,28 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/vulkan/VulkanObject.h>
+
+namespace anki
+{
+
+/// @addtogroup vulkan
+/// @{
+
+class ShaderImpl : public VulkanObject
+{
+public:
+	ShaderImpl(GrManager* manager)
+		: VulkanObject(manager)
+	{
+	}
+
+	~ShaderImpl();
+};
+/// @}
+
+} // end namespace anki

+ 29 - 0
include/anki/gr/vulkan/TextureImpl.h

@@ -0,0 +1,29 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/vulkan/VulkanObject.h>
+
+namespace anki
+{
+
+/// @addtogroup vulkan
+/// @{
+
+/// Texture container.
+class TextureImpl : public VulkanObject
+{
+public:
+	TextureImpl(GrManager* manager)
+		: VulkanObject(manager)
+	{
+	}
+
+	~TextureImpl();
+};
+/// @}
+
+} // end namespace anki

+ 34 - 0
include/anki/gr/vulkan/VulkanObject.h

@@ -0,0 +1,34 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/gr/vulkan/Common.h>
+
+namespace anki {
+
+/// @addtogroup vulkan
+/// @{
+
+/// The base class for all Vulkan object implementations.
+class VulkanObject
+{
+public:
+	VulkanObject(GrManager* manager)
+		: m_manager(manager)
+	{
+		ANKI_ASSERT(manager);
+	}
+
+	virtual ~VulkanObject()
+	{}
+
+private:
+	GrManager* m_manager = nullptr;
+};
+/// @}
+
+} // end namespace anki
+

+ 8 - 3
src/gr/CMakeLists.txt

@@ -1,5 +1,10 @@
-file(GLOB_RECURSE ANKI_GR_SOURCES *.cpp)
-file(GLOB_RECURSE ANKI_GR_HEADERS *.h)
+file(GLOB ANKI_GR_SOURCES *.cpp)
 
-add_library(ankigr ${ANKI_GR_SOURCES} ${ANKI_GR_HEADERS})
+if(${ANKI_GR_BACKEND} STREQUAL "GL")
+	file(GLOB ANKI_GR_BACKEND_SOURCES gl/*.cpp)
+else()
+	file(GLOB ANKI_GR_BACKEND_SOURCES vulkan/*.cpp)
+endif()
+
+add_library(ankigr ${ANKI_GR_SOURCES} ${ANKI_GR_BACKEND_SOURCES})
 target_link_libraries(ankigr ankiutil)

+ 6 - 0
src/gr/vulkan/Buffer.cpp

@@ -0,0 +1,6 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/Buffer.h>

+ 7 - 0
src/gr/vulkan/BufferImpl.cpp

@@ -0,0 +1,7 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/vulkan/BufferImpl.h>
+

+ 6 - 0
src/gr/vulkan/CommandBuffer.cpp

@@ -0,0 +1,6 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/CommandBuffer.h>

+ 6 - 0
src/gr/vulkan/CommandBufferImpl.cpp

@@ -0,0 +1,6 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/vulkan/CommandBufferImpl.h>

+ 7 - 0
src/gr/vulkan/Framebuffer.cpp

@@ -0,0 +1,7 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/Framebuffer.h>
+

+ 6 - 0
src/gr/vulkan/FramebufferImpl.cpp

@@ -0,0 +1,6 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/vulkan/FramebufferImpl.h>

+ 7 - 0
src/gr/vulkan/GrManager.cpp

@@ -0,0 +1,7 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/GrManager.h>
+

+ 6 - 0
src/gr/vulkan/OcclusionQuery.cpp

@@ -0,0 +1,6 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/OcclusionQuery.h>

+ 7 - 0
src/gr/vulkan/OcclusionQueryImpl.cpp

@@ -0,0 +1,7 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/vulkan/OcclusionQueryImpl.h>
+

+ 7 - 0
src/gr/vulkan/Pipeline.cpp

@@ -0,0 +1,7 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/Pipeline.h>
+

+ 7 - 0
src/gr/vulkan/PipelineImpl.cpp

@@ -0,0 +1,7 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/vulkan/PipelineImpl.h>
+

+ 6 - 0
src/gr/vulkan/ResourceGroup.cpp

@@ -0,0 +1,6 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/ResourceGroup.h>

+ 7 - 0
src/gr/vulkan/ResourceGroupImpl.cpp

@@ -0,0 +1,7 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/vulkan/ResourceGroupImpl.h>
+

+ 8 - 0
src/gr/vulkan/Sampler.cpp

@@ -0,0 +1,8 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/Sampler.h>
+
+

+ 16 - 0
src/gr/vulkan/SamplerImpl.cpp

@@ -0,0 +1,16 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/vulkan/SamplerImpl.h>
+
+namespace anki {
+
+//==============================================================================
+void SamplerImpl::init(const SamplerInitInfo& init)
+{
+}
+
+} // end namespace anki
+

+ 7 - 0
src/gr/vulkan/ShaderImpl.cpp

@@ -0,0 +1,7 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/vulkan/ShaderImpl.h>
+

+ 6 - 0
src/gr/vulkan/Texture.cpp

@@ -0,0 +1,6 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/Texture.h>

+ 7 - 0
src/gr/vulkan/TextureImpl.cpp

@@ -0,0 +1,7 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/vulkan/TextureImpl.h>
+