+++ /dev/null
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <dali/graphics/graphics-controller.h>
-
-namespace Dali
-{
-namespace Graphics
-{
-
-API::Accessor< API::Shader > Controller::CreateShader(
- const API::BaseFactory< API::Shader >& factory)
-{
- auto handle = mShaders.CreateObject(factory);
- return API::Accessor< API::Shader >{mShaders, handle};
-}
-
-API::Accessor< API::Texture > Controller::CreateTexture(
- const API::BaseFactory< API::Texture >& factory)
-{
- auto handle = mTextures.CreateObject(factory);
- return API::Accessor< API::Texture >{mTextures, handle};
-}
-
-API::Accessor< API::TextureSet > Controller::CreateTextureSet(
- const API::BaseFactory< API::TextureSet >& factory)
-{
- auto handle = mTextureSets.CreateObject(factory);
- return API::Accessor< API::TextureSet >{mTextureSets, handle};
-}
-
-API::Accessor< API::DynamicBuffer > Controller::CreateDynamicBuffer(
- const API::BaseFactory< API::DynamicBuffer >& factory)
-{
- auto handle = mDynamicBuffers.CreateObject(factory);
- return API::Accessor< API::DynamicBuffer >{mDynamicBuffers, handle};
-}
-
-API::Accessor< API::StaticBuffer > Controller::CreateStaticBuffer(
- const API::BaseFactory< API::StaticBuffer >& factory)
-{
- auto handle = mStaticBuffers.CreateObject(factory);
- return API::Accessor< API::StaticBuffer >{mStaticBuffers, handle};
-}
-
-API::Accessor< API::Sampler > Controller::CreateSampler(
- const API::BaseFactory< API::Sampler >& factory)
-{
- auto handle = mSamplers.CreateObject(factory);
- return API::Accessor< API::Sampler >{mSamplers, handle};
-}
-
-API::Accessor< API::Framebuffer > Controller::CreateFramebuffer(
- const API::BaseFactory< API::Framebuffer >& factory)
-{
- auto handle = mFramebuffers.CreateObject(factory);
- return API::Accessor< API::Framebuffer >{mFramebuffers, handle};
-}
-
-void Controller::GetRenderItemList()
-{
-}
-
-Controller::Controller() = default;
-Controller::Controller(Controller&&) = default;
-Controller::~Controller() = default;
-
-} // namespace Graphics
-} // namespace Dali
-#include "generated/spv-shaders-gen.h"
-
-#include <glm/glm.hpp>
-#include <glm/gtc/matrix_transform.hpp>
-#include <glm/matrix.hpp>
-#include <glm/vector_relational.hpp>
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
#include <dali/graphics/vulkan/gpu-memory/vulkan-gpu-memory-allocator.h>
#include <dali/graphics/vulkan/gpu-memory/vulkan-gpu-memory-handle.h>
#include <dali/graphics/vulkan/vulkan-command-buffer.h>
#include <dali/graphics/vulkan/vulkan-command-pool.h>
#include <dali/graphics/vulkan/vulkan-descriptor-set.h>
-#include <dali/graphics/vulkan/vulkan-graphics-controller.h>
+#include <dali/graphics/vulkan/api/vulkan-api-controller.h>
#include <dali/graphics/vulkan/vulkan-graphics.h>
#include <dali/graphics/vulkan/vulkan-pipeline.h>
#include <dali/graphics/vulkan/vulkan-pipeline-cache.h>
#include <iostream>
#include <dali/graphics-api/utility/utility-memory-pool.h>
-using namespace glm;
-
namespace Dali
{
namespace Graphics
{
-namespace Vulkan
+namespace VulkanAPI
{
-static const mat4 CLIP_MATRIX(
- 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, -1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.5f, 0.0f,
- 0.0f, 0.0f, 0.5f, 1.0f );
struct Controller::Impl
{
// TODO: @todo this function initialises basic buffers, shaders and pipeline
// for the prototype ONLY
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wframe-larger-than="
bool Initialise()
{
// Create factories
return true;
}
-#pragma GCC diagnostic pop
void BeginFrame()
{
auto surface = mGraphics.GetSurface( 0u );
auto swapchain = mGraphics.GetSwapchainForFBID( 0u );
- swapchain->AcquireNextFramebuffer();
+
+ auto framebuffer = swapchain->AcquireNextFramebuffer();
+
+ swapchain->BeginPrimaryRenderPass( {
+ { 1.0f, 1.0f, 1.0f, 1.0f }
+ } );
+
}
void EndFrame()
mBufferTransferRequests.clear();
}
- std::vector<CommandBufferRef> cmdBufRefs{};
+ std::vector<Vulkan::CommandBufferRef> cmdBufRefs{};
// Prepare pipelines
for( auto&& command : commands )
}
// resources
- std::vector<TextureRef> mTextures;
- std::vector<ShaderRef> mShaders;
- std::vector<BufferRef> mBuffers;
+ std::vector<Vulkan::TextureRef> mTextures;
+ std::vector<Vulkan::ShaderRef> mShaders;
+ std::vector<Vulkan::BufferRef> mBuffers;
// owner objects
ObjectOwner<API::Texture> mTexturesOwner;
ObjectOwner<API::Shader> mShadersOwner;
ObjectOwner<API::Buffer> mBuffersOwner;
- Graphics& mGraphics;
- Controller& mOwner;
- GpuMemoryAllocator& mDefaultAllocator;
+ Vulkan::Graphics& mGraphics;
+ Controller& mOwner;
+ Vulkan::GpuMemoryAllocator& mDefaultAllocator;
std::unique_ptr<VulkanAPI::TextureFactory> mTextureFactory;
std::unique_ptr<VulkanAPI::ShaderFactory> mShaderFactory;
std::unique_ptr<VulkanAPI::BufferFactory> mBufferFactory;
// todo: should be per thread
- CommandPoolRef mCommandPool;
+ Vulkan::CommandPoolRef mCommandPool;
std::vector<std::unique_ptr<VulkanAPI::BufferMemoryTransfer>> mBufferTransferRequests;
- std::unique_ptr<PipelineCache> mPipelineCache;
+ std::unique_ptr<Vulkan::PipelineCache> mPipelineCache;
std::unique_ptr<VulkanAPI::UboManager> mUboManager;
};
// TODO: @todo temporarily ignore missing return type, will be fixed later
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wreturn-type"
+
API::Accessor<API::Shader> Controller::CreateShader( const API::BaseFactory<API::Shader>& factory )
{
auto handle = mImpl->mShadersOwner.CreateObject( factory );
API::Accessor<API::TextureSet> Controller::CreateTextureSet( const API::BaseFactory<API::TextureSet>& factory )
{
-
+ return { nullptr };
}
API::Accessor<API::DynamicBuffer> Controller::CreateDynamicBuffer( const API::BaseFactory<API::DynamicBuffer>& factory )
{
+ return { nullptr };
}
API::Accessor<API::Buffer> Controller::CreateBuffer( const API::BaseFactory<API::Buffer>& factory )
API::Accessor<API::StaticBuffer> Controller::CreateStaticBuffer( const API::BaseFactory<API::StaticBuffer>& factory )
{
+ return { nullptr };
}
API::Accessor<API::Sampler> Controller::CreateSampler( const API::BaseFactory<API::Sampler>& factory )
{
+ return { nullptr };
}
API::Accessor<API::Framebuffer> Controller::CreateFramebuffer( const API::BaseFactory<API::Framebuffer>& factory )
{
+ return { nullptr };
}
std::unique_ptr<char> Controller::CreateBuffer( size_t numberOfElements, size_t elementSize )
return std::unique_ptr<char>( new char[numberOfElements * elementSize] );
}
-#pragma GCC diagnostic pop
-
-std::unique_ptr<Controller> Controller::New( Graphics& vulkanGraphics )
+std::unique_ptr<Controller> Controller::New( Vulkan::Graphics& vulkanGraphics )
{
return std::make_unique<Controller>( vulkanGraphics );
}
-Controller::Controller( Graphics& vulkanGraphics ) : mImpl( std::make_unique<Impl>( *this, vulkanGraphics ) )
+Controller::Controller( Vulkan::Graphics& vulkanGraphics ) : mImpl( std::make_unique<Impl>( *this, vulkanGraphics ) )
{
mImpl->Initialise();
}
Controller::~Controller() = default;
Controller::Controller() = default;
-Controller& Controller::operator=( Controller&& ) = default;
+Controller& Controller::operator=( Controller&& ) noexcept = default;
void Controller::GetRenderItemList()
{
}
-void Controller::SubmitCommand( Dali::Graphics::API::RenderCommand&& command )
-{
- // not in use
-}
-
void Controller::BeginFrame()
{
mImpl->BeginFrame();
}
-} // namespace Vulkan
+} // namespace VulkanAPI
} // namespace Graphics
} // namespace Dali
-#ifndef DALI_GRAPHICS_VULAKN_GRAPHICS_CONTROLLER_H
-#define DALI_GRAPHICS_VULAKN_GRAPHICS_CONTROLLER_H
+#ifndef DALI_GRAPHICS_VULKAN_API_CONTROLLER_H
+#define DALI_GRAPHICS_VULKAN_API_CONTROLLER_H
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd.
*/
// INTERNAL INCLUDES
-#include <dali/graphics/graphics-controller.h>
+#include <dali/graphics-api/graphics-api-controller.h>
namespace Dali
{
namespace Graphics
{
+
+namespace Vulkan
+{
+class Graphics;
+}
+
namespace VulkanAPI
{
+
class UboManager;
+
/**
* Structure describes deferred memory transfer
* Source memory is owned by the buffer and will be discarded
uint32_t dstOffset { 0u };
};
-}
-
-namespace Vulkan
-{
-class Graphics;
/**
* @brief Interface class for Manager types in the graphics API.
*/
-class Controller : public Dali::Graphics::Controller
+class Controller : public Dali::Graphics::API::Controller
{
public:
API::Accessor<API::Texture> CreateTexture( const API::BaseFactory<API::Texture>& factory ) override;
/**
- * @brief Create a new object
- */
- API::Accessor<API::TextureSet> CreateTextureSet( const API::BaseFactory<API::TextureSet>& factory ) override;
-
- /**
- * @brief Create a new object
- */
- API::Accessor<API::DynamicBuffer> CreateDynamicBuffer( const API::BaseFactory<API::DynamicBuffer>& factory ) override;
-
- /**
* @brief Create a new object
*/
API::Accessor<API::Buffer> CreateBuffer( const API::BaseFactory<API::Buffer>& factory ) override;
/**
* @brief Create a new object
*/
- API::Accessor<API::StaticBuffer> CreateStaticBuffer( const API::BaseFactory<API::StaticBuffer>& factory ) override;
-
- /**
- * @brief Create a new object
- */
API::Accessor<API::Sampler> CreateSampler( const API::BaseFactory<API::Sampler>& factory ) override;
/**
*/
void GetRenderItemList() override;
- void SubmitCommand( API::RenderCommand&& command ) override;
-
void BeginFrame() override;
void EndFrame() override;
protected:
// derived types should not be moved direcly to prevent slicing
- Controller( Controller&& );
- Controller& operator=( Controller&& );
+ Controller( Controller&& ) noexcept = default;
+ Controller& operator=( Controller&& ) noexcept;
/**
* Objects of this type should not directly.
std::unique_ptr<Impl> mImpl;
};
-} // namespace Vulkan
+} // namespace VulkanAPI
} // namespace Graphics
} // namespace Dali
-#endif // DALI_GRAPHICS_VULAKN_GRAPHICS_CONTROLLER_H
+#endif // DALI_GRAPHICS_VULKAN_API_CONTROLLER_H