Przeglądaj źródła

More work on vulkan backend

Panagiotis Christopoulos Charitos 9 lat temu
rodzic
commit
65485579fb

+ 5 - 1
include/anki/gr/vulkan/PipelineImpl.h

@@ -13,16 +13,20 @@ namespace anki
 /// @addtogroup vulkan
 /// @{
 
-/// Program pipeline
+/// Program pipeline.
 class PipelineImpl : public VulkanObject
 {
 public:
+	VkPipeline m_ppline = VK_NULL_HANDLE;
+
 	PipelineImpl(GrManager* manager)
 		: VulkanObject(manager)
 	{
 	}
 
 	~PipelineImpl();
+
+	ANKI_USE_RESULT Error init(const PipelineInitInfo& init);
 };
 /// @}
 

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

@@ -19,6 +19,8 @@ namespace anki
 class ShaderImpl : public VulkanObject
 {
 public:
+	VkShaderModule m_shaderModule = VK_NULL_HANDLE;
+
 	ShaderImpl(GrManager* manager)
 		: VulkanObject(manager)
 	{
@@ -29,6 +31,7 @@ public:
 	ANKI_USE_RESULT Error init(ShaderType shaderType, const CString& source);
 
 private:
+	/// Generate SPIRV from GLSL.
 	ANKI_USE_RESULT Error genSpirv(ShaderType shaderType,
 		const CString& source,
 		std::vector<unsigned int>& spirv);

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

@@ -4,3 +4,14 @@
 // http://www.anki3d.org/LICENSE
 
 #include <anki/gr/vulkan/PipelineImpl.h>
+
+namespace anki
+{
+
+//==============================================================================
+Error PipelineImpl::init(const PipelineInitInfo& init)
+{
+	return ErrorCode::NONE;
+}
+
+} // end namespace anki

+ 11 - 1
src/gr/vulkan/ShaderImpl.cpp

@@ -191,7 +191,7 @@ Error ShaderImpl::genSpirv(ShaderType shaderType,
 Error ShaderImpl::init(ShaderType shaderType, const CString& source)
 {
 	ANKI_ASSERT(source);
-	ANKI_ASSERT(!isCreated());
+	ANKI_ASSERT(m_shaderModule);
 
 	// Setup the shader
 	auto alloc = getAllocator();
@@ -212,6 +212,16 @@ Error ShaderImpl::init(ShaderType shaderType, const CString& source)
 	ANKI_CHECK(genSpirv(shaderType, fullSrc.toCString(), spirv));
 	ANKI_ASSERT(!spirv.empty());
 
+	VkShaderModuleCreateInfo ci = {
+		VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
+		nullptr,
+		0,
+		spirv.size() * sizeof(unsigned int),
+		&spirv[0]};
+
+	ANKI_VK_CHECK(
+		vkCreateShaderModule(getDevice(), &ci, nullptr, &m_shaderModule));
+
 	return ErrorCode::NONE;
 }