Commit c0f92f23 by Alexis Hetu Committed by Alexis Hétu

VkPipeline simple implementation

Added a few class members and adjusted the VkPipeline constructor to extract basic parameters which will be used for rendering, like: - Basic sw::Context parameters - Scissor - Viewport - BlendConstants Note: sw::Context should eventually be replaced by VkPipeline and be used directly by sw::Renderer once all existing OpenGL ES 3.0 has been converted from VkPipeline. (Chris: rebase + build system fixes for CMake path) Change-Id: I7e7a9ff3c768da8e8c1e9461e140af4986429602 Reviewed-on: https://swiftshader-review.googlesource.com/c/22613Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@google.com>
parent c730c384
......@@ -1977,10 +1977,30 @@ file(GLOB_RECURSE VULKAN_LIST
${VULKAN_DIR}/*.cpp
${VULKAN_DIR}/*.h
${VULKAN_DIR}/*.hpp
${SOURCE_DIR}/System/Memory.cpp
${SOURCE_DIR}/System/Memory.hpp
${SOURCE_DIR}/System/CPUID.cpp
${SOURCE_DIR}/System/CPUID.hpp
${SOURCE_DIR}/System/Configurator.cpp
${SOURCE_DIR}/System/Configurator.hpp
${SOURCE_DIR}/System/Debug.cpp
${SOURCE_DIR}/System/Debug.hpp
${SOURCE_DIR}/System/Half.cpp
${SOURCE_DIR}/System/Half.hpp
${SOURCE_DIR}/System/Math.cpp
${SOURCE_DIR}/System/Math.hpp
${SOURCE_DIR}/System/Memory.cpp
${SOURCE_DIR}/System/Memory.hpp
${SOURCE_DIR}/System/Resource.cpp
${SOURCE_DIR}/System/Resource.hpp
${SOURCE_DIR}/System/Socket.cpp
${SOURCE_DIR}/System/Socket.hpp
${SOURCE_DIR}/System/Thread.cpp
${SOURCE_DIR}/System/Thread.hpp
${SOURCE_DIR}/System/Timer.cpp
${SOURCE_DIR}/System/Timer.hpp
${SOURCE_DIR}/Device/*.cpp
${SOURCE_DIR}/Device/*.hpp
${SOURCE_DIR}/Pipeline/*.cpp
${SOURCE_DIR}/Pipeline/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/vulkan/*.h}
)
......@@ -2153,7 +2173,7 @@ if(BUILD_VULKAN)
PREFIX ""
)
set_shared_library_export_map(libvk_swiftshader ${SOURCE_DIR}/Vulkan)
target_link_libraries(libvk_swiftshader ${OS_LIBS})
target_link_libraries(libvk_swiftshader ${Reactor} ${OS_LIBS})
add_custom_command(
TARGET libvk_swiftshader
POST_BUILD
......
......@@ -16,6 +16,7 @@
#define VK_PIPELINE_HPP_
#include "VkObject.hpp"
#include "Device/Renderer.hpp"
namespace vk
{
......@@ -44,6 +45,21 @@ public:
#endif
static size_t ComputeRequiredAllocationSize(const VkGraphicsPipelineCreateInfo* pCreateInfo);
void compileShaders(const VkAllocationCallbacks* pAllocator, const VkGraphicsPipelineCreateInfo* pCreateInfo);
const sw::Context& getContext() const;
const sw::Rect& getScissor() const;
const VkViewport& getViewport() const;
const sw::Color<float>& getBlendConstants() const;
private:
rr::Routine* vertexRoutine;
rr::Routine* fragmentRoutine;
sw::Context context;
sw::Rect scissor;
VkViewport viewport;
sw::Color<float> blendConstants;
};
class ComputePipeline : public Pipeline, public Object<ComputePipeline, VkPipeline>
......
......@@ -34,4 +34,10 @@ size_t ShaderModule::ComputeRequiredAllocationSize(const VkShaderModuleCreateInf
return pCreateInfo->codeSize;
}
rr::Routine* ShaderModule::compile(const VkAllocationCallbacks* pAllocator)
{
// FIXME: Compile the code here
return nullptr;
}
} // namespace vk
......@@ -17,6 +17,11 @@
#include "VkObject.hpp"
namespace rr
{
class Routine;
}
namespace vk
{
......@@ -27,6 +32,8 @@ public:
~ShaderModule() = delete;
void destroy(const VkAllocationCallbacks* pAllocator);
rr::Routine* compile(const VkAllocationCallbacks* pAllocator);
static size_t ComputeRequiredAllocationSize(const VkShaderModuleCreateInfo* pCreateInfo);
private:
......
......@@ -896,6 +896,10 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipe
pPipelines[i] = VK_NULL_HANDLE;
errorResult = result;
}
else
{
static_cast<vk::GraphicsPipeline*>(vk::Cast(pPipelines[i]))->compileShaders(pAllocator, &pCreateInfos[i]);
}
}
return errorResult;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment