Temporary commit to investigate build error
This commit is contained in:
Vendored
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"program": "${workspaceRoot}/bin/Debug/SeeleEngine.exe",
|
"program": "${workspaceRoot}/bin/Debug/SeeleEngine.exe",
|
||||||
"args": [],
|
"args": [],
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${workspaceFolder}/bin/Debug",
|
"cwd": "${workspaceRoot}/bin/Debug",
|
||||||
"environment": [],
|
"environment": [],
|
||||||
"externalConsole": false,
|
"externalConsole": false,
|
||||||
"symbolSearchPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.25.28610\\lib\\x64",
|
"symbolSearchPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.25.28610\\lib\\x64",
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ else()
|
|||||||
project (Seele)
|
project (Seele)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/Debug)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
|
||||||
#Workaround for vs, because it places artifacts into an additional subfolder
|
#Workaround for vs, because it places artifacts into an additional subfolder
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin/Debug)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin/Debug)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin/Release)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin/Release)
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ if (WIN32)
|
|||||||
${GLFW_ROOT}/include
|
${GLFW_ROOT}/include
|
||||||
DOC "The directory where GLFW/glfw.h resides")
|
DOC "The directory where GLFW/glfw.h resides")
|
||||||
|
|
||||||
# Use glfw3.lib for static library
|
# Use glfw3(d).lib for static library
|
||||||
if (GLFW_USE_STATIC_LIBS)
|
if (GLFW_USE_STATIC_LIBS)
|
||||||
set(GLFW_LIBRARY_NAME glfw3)
|
set(GLFW_LIBRARY_NAME glfw3${CMAKE_DEBUG_POSTFIX})
|
||||||
else()
|
else()
|
||||||
set(GLFW_LIBRARY_NAME glfw3ddll)
|
set(GLFW_LIBRARY_NAME glfw3${CMAKE_DEBUG_POSTFIX}dll)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Find library files
|
# Find library files
|
||||||
@@ -50,7 +50,7 @@ if (WIN32)
|
|||||||
|
|
||||||
find_file(
|
find_file(
|
||||||
GLFW_BINARY
|
GLFW_BINARY
|
||||||
NAMES glfw3.dll
|
NAMES glfw3${CMAKE_DEBUG_POSTFIX}.dll
|
||||||
PATHS
|
PATHS
|
||||||
$ENV{PROGRAMFILES}/bin
|
$ENV{PROGRAMFILES}/bin
|
||||||
${GLFW_ROOT}/src
|
${GLFW_ROOT}/src
|
||||||
@@ -102,7 +102,7 @@ find_package_handle_standard_args(GLFW DEFAULT_MSG GLFW_INCLUDE_DIR GLFW_LIBRARY
|
|||||||
|
|
||||||
# Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS
|
# Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS
|
||||||
if (GLFW_FOUND)
|
if (GLFW_FOUND)
|
||||||
set(GLFW_LIBRARIES ${OPENGL_LIBRARIES} ${GLFW_LIBRARY})
|
set(GLFW_LIBRARIES ${GLFW_LIBRARY})
|
||||||
set(GLFW_INCLUDE_DIRS ${GLFW_INCLUDE_DIR})
|
set(GLFW_INCLUDE_DIRS ${GLFW_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ include (ExternalProject)
|
|||||||
|
|
||||||
set(DEPENDENCIES)
|
set(DEPENDENCIES)
|
||||||
set(EXTRA_CMAKE_ARGS)
|
set(EXTRA_CMAKE_ARGS)
|
||||||
execute_process(COMMAND git submodule update --init --recursive -- ${CMAKE_SOURCE_DIR})
|
|
||||||
|
|
||||||
#------------ASSIMP---------------
|
#------------ASSIMP---------------
|
||||||
list(APPEND DEPENDENCIES assimp)
|
list(APPEND DEPENDENCIES assimp)
|
||||||
set(ASSIMP_BUILD_TESTS OFF CACHE INTERNAL "")
|
set(ASSIMP_BUILD_TESTS OFF CACHE INTERNAL "")
|
||||||
@@ -72,7 +70,7 @@ if(WIN32)
|
|||||||
ExternalProject_Add(slang
|
ExternalProject_Add(slang
|
||||||
SOURCE_DIR ${SLANG_ROOT}
|
SOURCE_DIR ${SLANG_ROOT}
|
||||||
BINARY_DIR ${CMAKE_BINARY_DIR}/lib
|
BINARY_DIR ${CMAKE_BINARY_DIR}/lib
|
||||||
CONFIGURE_COMMAND ""#devenv /upgrade ${SLANG_ROOT}/source/slang/slang.vcxproj
|
CONFIGURE_COMMAND devenv /upgrade ${SLANG_ROOT}/source/slang/slang.vcxproj
|
||||||
BUILD_COMMAND msbuild -p:Configuration=Release -p:WarningLevel=0 -p:Platform=${CMAKE_PLATFORM} -p:WindowsTargetPlatformVersion=10.0 ${SLANG_ROOT}/source/slang/slang.vcxproj
|
BUILD_COMMAND msbuild -p:Configuration=Release -p:WarningLevel=0 -p:Platform=${CMAKE_PLATFORM} -p:WindowsTargetPlatformVersion=10.0 ${SLANG_ROOT}/source/slang/slang.vcxproj
|
||||||
INSTALL_COMMAND "")
|
INSTALL_COMMAND "")
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
Submodule external/json updated: 634fa87e5a...e110667d21
Vendored
+1
-1
Submodule external/slang updated: 7a1b6deff0...dd980b492a
Vendored
+1
-1
Submodule external/stb updated: f54acd4e13...b42009b3b9
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "MinimalEngine.h"
|
#include "MinimalEngine.h"
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ using namespace Seele;
|
|||||||
TextureLoader::TextureLoader(Gfx::PGraphics graphics)
|
TextureLoader::TextureLoader(Gfx::PGraphics graphics)
|
||||||
: graphics(graphics)
|
: graphics(graphics)
|
||||||
{
|
{
|
||||||
import("./textures/placeholder.png");
|
import("textures/placeholder.png");
|
||||||
placeholderTexture = AssetRegistry::findTexture("./textures/placeholder.png");
|
placeholderTexture = AssetRegistry::findTexture("textures/placeholder.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureLoader::~TextureLoader()
|
TextureLoader::~TextureLoader()
|
||||||
@@ -27,11 +27,11 @@ void TextureLoader::importAsset(const std::filesystem::path& filePath)
|
|||||||
|
|
||||||
void TextureLoader::import(const std::filesystem::path& path)
|
void TextureLoader::import(const std::filesystem::path& path)
|
||||||
{
|
{
|
||||||
std::filesystem::path assetPath = path.stem().append(".asset");
|
auto assetFileName = path;
|
||||||
|
std::filesystem::path assetPath = AssetRegistry::get().rootFolder.append(assetFileName.replace_extension("asset").filename().string());
|
||||||
PTextureAsset asset = new TextureAsset(assetPath);
|
PTextureAsset asset = new TextureAsset(assetPath);
|
||||||
asset->setStatus(Asset::Status::Loading);
|
asset->setStatus(Asset::Status::Loading);
|
||||||
int x, y, n;
|
int x, y, n;
|
||||||
const std::string fullPath = std::string(asset->getFullPath());
|
|
||||||
unsigned char* data = stbi_load(path.string().c_str(), &x, &y, &n, 4);
|
unsigned char* data = stbi_load(path.string().c_str(), &x, &y, &n, 4);
|
||||||
TextureCreateInfo createInfo;
|
TextureCreateInfo createInfo;
|
||||||
createInfo.format = Gfx::SE_FORMAT_R8G8B8A8_UINT;
|
createInfo.format = Gfx::SE_FORMAT_R8G8B8A8_UINT;
|
||||||
@@ -45,5 +45,5 @@ void TextureLoader::import(const std::filesystem::path& path)
|
|||||||
texture->transferOwnership(Gfx::QueueType::GRAPHICS);
|
texture->transferOwnership(Gfx::QueueType::GRAPHICS);
|
||||||
asset->setTexture(texture);
|
asset->setTexture(texture);
|
||||||
asset->setStatus(Asset::Status::Ready);
|
asset->setStatus(Asset::Status::Ready);
|
||||||
AssetRegistry::get().textures[assetPath.string()] = asset;
|
AssetRegistry::get().textures[path.string()] = asset;
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,7 @@ struct WindowCreateInfo
|
|||||||
int32 height;
|
int32 height;
|
||||||
const char *title;
|
const char *title;
|
||||||
bool bFullscreen;
|
bool bFullscreen;
|
||||||
|
Gfx::SeSampleCountFlags numSamples;
|
||||||
Gfx::SeFormat pixelFormat;
|
Gfx::SeFormat pixelFormat;
|
||||||
void *windowHandle;
|
void *windowHandle;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> inputAttac
|
|||||||
}
|
}
|
||||||
|
|
||||||
Window::Window(const WindowCreateInfo &createInfo)
|
Window::Window(const WindowCreateInfo &createInfo)
|
||||||
: sizeX(createInfo.width), sizeY(createInfo.height), bFullscreen(createInfo.bFullscreen), title(createInfo.title), pixelFormat(createInfo.pixelFormat)
|
: sizeX(createInfo.width), sizeY(createInfo.height), bFullscreen(createInfo.bFullscreen), title(createInfo.title), pixelFormat(createInfo.pixelFormat), samples(createInfo.numSamples)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -409,6 +409,11 @@ class Texture : public QueueOwnedResource
|
|||||||
public:
|
public:
|
||||||
Texture(PGraphics graphics, QueueType startQueueType);
|
Texture(PGraphics graphics, QueueType startQueueType);
|
||||||
virtual ~Texture();
|
virtual ~Texture();
|
||||||
|
|
||||||
|
virtual SeFormat getFormat() const = 0;
|
||||||
|
virtual uint32 getSizeX() const = 0;
|
||||||
|
virtual uint32 getSizeY() const = 0;
|
||||||
|
virtual SeSampleCountFlags getNumSamples() const = 0;
|
||||||
protected:
|
protected:
|
||||||
// Inherited via QueueOwnedResource
|
// Inherited via QueueOwnedResource
|
||||||
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
|
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
|
||||||
@@ -419,6 +424,11 @@ class Texture2D : public Texture
|
|||||||
public:
|
public:
|
||||||
Texture2D(PGraphics graphics, QueueType startQueueType);
|
Texture2D(PGraphics graphics, QueueType startQueueType);
|
||||||
virtual ~Texture2D();
|
virtual ~Texture2D();
|
||||||
|
|
||||||
|
virtual SeFormat getFormat() const = 0;
|
||||||
|
virtual uint32 getSizeX() const = 0;
|
||||||
|
virtual uint32 getSizeY() const = 0;
|
||||||
|
virtual SeSampleCountFlags getNumSamples() const = 0;
|
||||||
protected:
|
protected:
|
||||||
//Inherited via QueueOwnedResource
|
//Inherited via QueueOwnedResource
|
||||||
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
|
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
|
||||||
@@ -447,6 +457,14 @@ public:
|
|||||||
virtual void endFrame() = 0;
|
virtual void endFrame() = 0;
|
||||||
virtual void onWindowCloseEvent() = 0;
|
virtual void onWindowCloseEvent() = 0;
|
||||||
virtual PTexture2D getBackBuffer() = 0;
|
virtual PTexture2D getBackBuffer() = 0;
|
||||||
|
SeFormat getSwapchainFormat() const
|
||||||
|
{
|
||||||
|
return pixelFormat;
|
||||||
|
}
|
||||||
|
SeSampleCountFlags getNumSamples() const
|
||||||
|
{
|
||||||
|
return samples;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint32 sizeX;
|
uint32 sizeX;
|
||||||
@@ -454,6 +472,7 @@ protected:
|
|||||||
bool bFullscreen;
|
bool bFullscreen;
|
||||||
const char *title;
|
const char *title;
|
||||||
SeFormat pixelFormat;
|
SeFormat pixelFormat;
|
||||||
|
uint32 samples;
|
||||||
};
|
};
|
||||||
DEFINE_REF(Window);
|
DEFINE_REF(Window);
|
||||||
|
|
||||||
@@ -496,6 +515,14 @@ public:
|
|||||||
{
|
{
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
virtual SeFormat getFormat() const
|
||||||
|
{
|
||||||
|
return texture->getFormat();
|
||||||
|
}
|
||||||
|
virtual SeSampleCountFlags getNumSamples() const
|
||||||
|
{
|
||||||
|
return texture->getNumSamples();
|
||||||
|
}
|
||||||
inline SeAttachmentLoadOp getLoadOp() const { return loadOp; }
|
inline SeAttachmentLoadOp getLoadOp() const { return loadOp; }
|
||||||
inline SeAttachmentStoreOp getStoreOp() const { return storeOp; }
|
inline SeAttachmentStoreOp getStoreOp() const { return storeOp; }
|
||||||
inline SeAttachmentLoadOp getStencilLoadOp() const { return stencilLoadOp; }
|
inline SeAttachmentLoadOp getStencilLoadOp() const { return stencilLoadOp; }
|
||||||
@@ -518,13 +545,21 @@ public:
|
|||||||
SeAttachmentStoreOp storeOp = SE_ATTACHMENT_STORE_OP_STORE,
|
SeAttachmentStoreOp storeOp = SE_ATTACHMENT_STORE_OP_STORE,
|
||||||
SeAttachmentLoadOp stencilLoadOp = SE_ATTACHMENT_LOAD_OP_DONT_CARE,
|
SeAttachmentLoadOp stencilLoadOp = SE_ATTACHMENT_LOAD_OP_DONT_CARE,
|
||||||
SeAttachmentStoreOp stencilStoreOp = SE_ATTACHMENT_STORE_OP_DONT_CARE)
|
SeAttachmentStoreOp stencilStoreOp = SE_ATTACHMENT_STORE_OP_DONT_CARE)
|
||||||
: RenderTargetAttachment(owner->getBackBuffer(), loadOp, storeOp, stencilLoadOp, stencilStoreOp), owner(owner)
|
: RenderTargetAttachment(nullptr, loadOp, storeOp, stencilLoadOp, stencilStoreOp), owner(owner)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual PTexture2D getTexture() override
|
virtual PTexture2D getTexture() override
|
||||||
{
|
{
|
||||||
return owner->getBackBuffer();
|
return owner->getBackBuffer();
|
||||||
}
|
}
|
||||||
|
virtual SeFormat getFormat() const override
|
||||||
|
{
|
||||||
|
return owner->getSwapchainFormat();
|
||||||
|
}
|
||||||
|
virtual SeSampleCountFlags getNumSamples() const override
|
||||||
|
{
|
||||||
|
return owner->getNumSamples();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PWindow owner;
|
PWindow owner;
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ void Seele::RenderCore::init()
|
|||||||
mainWindowInfo.width = 1280;
|
mainWindowInfo.width = 1280;
|
||||||
mainWindowInfo.height = 720;
|
mainWindowInfo.height = 720;
|
||||||
mainWindowInfo.bFullscreen = false;
|
mainWindowInfo.bFullscreen = false;
|
||||||
|
mainWindowInfo.numSamples = 1;
|
||||||
|
mainWindowInfo.pixelFormat = Gfx::SE_FORMAT_R8G8B8_UNORM;
|
||||||
auto window = windowManager->addWindow(mainWindowInfo);
|
auto window = windowManager->addWindow(mainWindowInfo);
|
||||||
ViewportCreateInfo sceneViewInfo;
|
ViewportCreateInfo sceneViewInfo;
|
||||||
sceneViewInfo.sizeX = 1280;
|
sceneViewInfo.sizeX = 1280;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ void BasePassMeshProcessor::addMeshBatch(
|
|||||||
const Gfx::PRenderPass renderPass,
|
const Gfx::PRenderPass renderPass,
|
||||||
int32 staticMeshId)
|
int32 staticMeshId)
|
||||||
{
|
{
|
||||||
const PMaterialAsset material = batch.material;
|
const PMaterial material = batch.material;
|
||||||
const Gfx::MaterialShadingModel shadingModel = material->getShadingModel();
|
const Gfx::MaterialShadingModel shadingModel = material->getShadingModel();
|
||||||
|
|
||||||
const PVertexShaderInput vertexInput = batch.vertexInput;
|
const PVertexShaderInput vertexInput = batch.vertexInput;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
#include "VulkanDescriptorSets.h"
|
||||||
#include "VulkanGraphicsResources.h"
|
#include "VulkanGraphicsResources.h"
|
||||||
#include "VulkanGraphicsEnums.h"
|
#include "VulkanGraphicsEnums.h"
|
||||||
#include "VulkanGraphics.h"
|
#include "VulkanGraphics.h"
|
||||||
#include "VulkanInitializer.h"
|
#include "VulkanInitializer.h"
|
||||||
#include "VulkanDescriptorSets.h"
|
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
using namespace Seele::Vulkan;
|
using namespace Seele::Vulkan;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
#include "VulkanGraphicsResources.h"
|
#include "VulkanGraphicsResources.h"
|
||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
|
|||||||
@@ -200,6 +200,10 @@ public:
|
|||||||
{
|
{
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
inline Gfx::SeSampleCountFlags getNumSamples() const
|
||||||
|
{
|
||||||
|
return samples;
|
||||||
|
}
|
||||||
inline bool isDepthStencil() const
|
inline bool isDepthStencil() const
|
||||||
{
|
{
|
||||||
return aspect & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT);
|
return aspect & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT);
|
||||||
@@ -249,18 +253,22 @@ class Texture2D : public TextureBase, public Gfx::Texture2D
|
|||||||
public:
|
public:
|
||||||
Texture2D(PGraphics graphics, const TextureCreateInfo& createInfo, VkImage existingImage = VK_NULL_HANDLE);
|
Texture2D(PGraphics graphics, const TextureCreateInfo& createInfo, VkImage existingImage = VK_NULL_HANDLE);
|
||||||
virtual ~Texture2D();
|
virtual ~Texture2D();
|
||||||
inline uint32 getSizeX() const
|
virtual uint32 getSizeX() const override
|
||||||
{
|
{
|
||||||
return textureHandle->sizeX;
|
return textureHandle->sizeX;
|
||||||
}
|
}
|
||||||
inline uint32 getSizeY() const
|
virtual uint32 getSizeY() const override
|
||||||
{
|
{
|
||||||
return textureHandle->sizeY;
|
return textureHandle->sizeY;
|
||||||
}
|
}
|
||||||
inline Gfx::SeFormat getFormat() const
|
virtual Gfx::SeFormat getFormat() const override
|
||||||
{
|
{
|
||||||
return textureHandle->format;
|
return textureHandle->format;
|
||||||
}
|
}
|
||||||
|
virtual Gfx::SeSampleCountFlags getNumSamples() const override
|
||||||
|
{
|
||||||
|
return textureHandle->getNumSamples();
|
||||||
|
}
|
||||||
inline VkImage getHandle() const
|
inline VkImage getHandle() const
|
||||||
{
|
{
|
||||||
return textureHandle->image;
|
return textureHandle->image;
|
||||||
@@ -312,6 +320,7 @@ protected:
|
|||||||
|
|
||||||
PGraphics graphics;
|
PGraphics graphics;
|
||||||
VkFormat pixelFormat;
|
VkFormat pixelFormat;
|
||||||
|
VkSampleCountFlags numSamples;
|
||||||
VkPresentModeKHR presentMode;
|
VkPresentModeKHR presentMode;
|
||||||
VkSwapchainKHR swapchain;
|
VkSwapchainKHR swapchain;
|
||||||
VkSurfaceKHR surface;
|
VkSurfaceKHR surface;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ RenderPass::RenderPass(PGraphics graphics, Gfx::PRenderTargetLayout layout)
|
|||||||
for (auto inputAttachment : layout->inputAttachments)
|
for (auto inputAttachment : layout->inputAttachments)
|
||||||
{
|
{
|
||||||
PTexture2D image = inputAttachment->getTexture().cast<Texture2D>();
|
PTexture2D image = inputAttachment->getTexture().cast<Texture2D>();
|
||||||
VkAttachmentDescription desc = attachments.add();
|
VkAttachmentDescription& desc = attachments.add();
|
||||||
desc.flags = 0;
|
desc.flags = 0;
|
||||||
desc.format = cast(image->getFormat());
|
desc.format = cast(image->getFormat());
|
||||||
desc.storeOp = cast(inputAttachment->getStoreOp());
|
desc.storeOp = cast(inputAttachment->getStoreOp());
|
||||||
@@ -36,10 +36,10 @@ RenderPass::RenderPass(PGraphics graphics, Gfx::PRenderTargetLayout layout)
|
|||||||
}
|
}
|
||||||
for (auto colorAttachment : layout->colorAttachments)
|
for (auto colorAttachment : layout->colorAttachments)
|
||||||
{
|
{
|
||||||
PTexture2D image = colorAttachment->getTexture().cast<Texture2D>();
|
VkAttachmentDescription& desc = attachments.add();
|
||||||
VkAttachmentDescription desc = attachments.add();
|
|
||||||
desc.flags = 0;
|
desc.flags = 0;
|
||||||
desc.format = cast(image->getFormat());
|
desc.samples = (VkSampleCountFlagBits)colorAttachment->getNumSamples();
|
||||||
|
desc.format = cast(colorAttachment->getFormat());
|
||||||
desc.storeOp = cast(colorAttachment->getStoreOp());
|
desc.storeOp = cast(colorAttachment->getStoreOp());
|
||||||
desc.loadOp = cast(colorAttachment->getLoadOp());
|
desc.loadOp = cast(colorAttachment->getLoadOp());
|
||||||
desc.stencilStoreOp = cast(colorAttachment->getStencilStoreOp());
|
desc.stencilStoreOp = cast(colorAttachment->getStencilStoreOp());
|
||||||
@@ -55,8 +55,9 @@ RenderPass::RenderPass(PGraphics graphics, Gfx::PRenderTargetLayout layout)
|
|||||||
if (layout->depthAttachment != nullptr)
|
if (layout->depthAttachment != nullptr)
|
||||||
{
|
{
|
||||||
PTexture2D image = layout->depthAttachment->getTexture().cast<Texture2D>();
|
PTexture2D image = layout->depthAttachment->getTexture().cast<Texture2D>();
|
||||||
VkAttachmentDescription desc = attachments.add();
|
VkAttachmentDescription& desc = attachments.add();
|
||||||
desc.flags = 0;
|
desc.flags = 0;
|
||||||
|
desc.samples = (VkSampleCountFlagBits)image->getNumSamples();
|
||||||
desc.format = cast(image->getFormat());
|
desc.format = cast(image->getFormat());
|
||||||
desc.storeOp = cast(layout->depthAttachment->getStoreOp());
|
desc.storeOp = cast(layout->depthAttachment->getStoreOp());
|
||||||
desc.loadOp = cast(layout->depthAttachment->getLoadOp());
|
desc.loadOp = cast(layout->depthAttachment->getLoadOp());
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
#include "VulkanGraphicsResources.h"
|
#include "VulkanGraphicsResources.h"
|
||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using namespace Seele;
|
|||||||
using namespace Seele::Vulkan;
|
using namespace Seele::Vulkan;
|
||||||
|
|
||||||
Window::Window(PGraphics graphics, const WindowCreateInfo &createInfo)
|
Window::Window(PGraphics graphics, const WindowCreateInfo &createInfo)
|
||||||
: Gfx::Window(createInfo), graphics(graphics), instance(graphics->getInstance()), swapchain(VK_NULL_HANDLE)
|
: Gfx::Window(createInfo), graphics(graphics), instance(graphics->getInstance()), swapchain(VK_NULL_HANDLE), numSamples(createInfo.numSamples), pixelFormat(cast(createInfo.pixelFormat))
|
||||||
{
|
{
|
||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||||
GLFWwindow *handle = glfwCreateWindow(createInfo.width, createInfo.height, createInfo.title, createInfo.bFullscreen ? glfwGetPrimaryMonitor() : nullptr, nullptr);
|
GLFWwindow *handle = glfwCreateWindow(createInfo.width, createInfo.height, createInfo.title, createInfo.bFullscreen ? glfwGetPrimaryMonitor() : nullptr, nullptr);
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
#include "Material.h"
|
#include "Material.h"
|
||||||
#include "Asset/AssetRegistry.h"
|
#include "Asset/AssetRegistry.h"
|
||||||
|
#include "Graphics/VertexShaderInput.h"
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
Gfx::ShaderMap Material::shaderMap;
|
||||||
|
std::mutex Material::shaderMapLock;
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
@@ -103,3 +107,19 @@ void Material::compile()
|
|||||||
codeStream << "}};" << std::endl;
|
codeStream << "}};" << std::endl;
|
||||||
materialCode = codeStream.str();
|
materialCode = codeStream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Gfx::ShaderCollection* Material::getShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput) const
|
||||||
|
{
|
||||||
|
Gfx::ShaderPermutation permutation;
|
||||||
|
std::string materialName = getMaterialName();
|
||||||
|
std::string vertexInputName = vertexInput->getName();
|
||||||
|
std::memcpy(permutation.materialName, materialName.c_str(), sizeof(permutation.materialName));
|
||||||
|
std::memcpy(permutation.materialName, vertexInputName.c_str(), sizeof(permutation.materialName));
|
||||||
|
return shaderMap.findShaders(Gfx::PermutationId(permutation));
|
||||||
|
}
|
||||||
|
|
||||||
|
Gfx::ShaderCollection& Material::createShaders(Gfx::PGraphics graphics, Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput)
|
||||||
|
{
|
||||||
|
std::lock_guard lock(shaderMapLock);
|
||||||
|
return shaderMap.createShaders(graphics, renderPass, this, vertexInput, false);
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,7 +16,13 @@ public:
|
|||||||
virtual void load() override;
|
virtual void load() override;
|
||||||
virtual std::string getMaterialName() const { return materialName; }
|
virtual std::string getMaterialName() const { return materialName; }
|
||||||
inline std::string getCode() const { return materialCode; }
|
inline std::string getCode() const { return materialCode; }
|
||||||
|
|
||||||
|
const Gfx::ShaderCollection* getShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput) const;
|
||||||
|
Gfx::ShaderCollection& createShaders(Gfx::PGraphics graphics, Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput);
|
||||||
private:
|
private:
|
||||||
|
static Gfx::ShaderMap shaderMap;
|
||||||
|
static std::mutex shaderMapLock;
|
||||||
|
|
||||||
void compile();
|
void compile();
|
||||||
std::string materialName;
|
std::string materialName;
|
||||||
std::string materialCode;
|
std::string materialCode;
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
#include "MaterialAsset.h"
|
#include "MaterialAsset.h"
|
||||||
#include "Graphics/VertexShaderInput.h"
|
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
|
|
||||||
Gfx::ShaderMap MaterialAsset::shaderMap;
|
|
||||||
|
|
||||||
MaterialAsset::MaterialAsset()
|
MaterialAsset::MaterialAsset()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -22,18 +19,3 @@ MaterialAsset::MaterialAsset(const std::filesystem::path& fullPath)
|
|||||||
MaterialAsset::~MaterialAsset()
|
MaterialAsset::~MaterialAsset()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Gfx::ShaderCollection* MaterialAsset::getShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput) const
|
|
||||||
{
|
|
||||||
Gfx::ShaderPermutation permutation;
|
|
||||||
std::string materialName = getMaterialName();
|
|
||||||
std::string vertexInputName = vertexInput->getName();
|
|
||||||
std::memcpy(permutation.materialName, materialName.c_str(), sizeof(permutation.materialName));
|
|
||||||
std::memcpy(permutation.materialName, vertexInputName.c_str(), sizeof(permutation.materialName));
|
|
||||||
return shaderMap.findShaders(Gfx::PermutationId(permutation));
|
|
||||||
}
|
|
||||||
|
|
||||||
Gfx::ShaderCollection& MaterialAsset::createShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput)
|
|
||||||
{
|
|
||||||
return Gfx::ShaderCollection();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -19,13 +19,9 @@ public:
|
|||||||
Gfx::SeBlendOp getBlendMode() const {return Gfx::SE_BLEND_OP_END_RANGE;}
|
Gfx::SeBlendOp getBlendMode() const {return Gfx::SE_BLEND_OP_END_RANGE;}
|
||||||
Gfx::MaterialShadingModel getShadingModel() const {return Gfx::MaterialShadingModel::DefaultLit;}
|
Gfx::MaterialShadingModel getShadingModel() const {return Gfx::MaterialShadingModel::DefaultLit;}
|
||||||
|
|
||||||
const Gfx::ShaderCollection* getShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput) const;
|
|
||||||
Gfx::ShaderCollection& createShaders(Gfx::RenderPassType renderPass, PVertexShaderInput vertexInput);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//For now its simply the collection of parameters, since there is no point for expressions
|
//For now its simply the collection of parameters, since there is no point for expressions
|
||||||
Array<PShaderParameter> parameters;
|
Array<PShaderParameter> parameters;
|
||||||
static Gfx::ShaderMap shaderMap;
|
|
||||||
};
|
};
|
||||||
DEFINE_REF(MaterialAsset);
|
DEFINE_REF(MaterialAsset);
|
||||||
} // namespace Seele
|
} // namespace Seele
|
||||||
|
|||||||
Reference in New Issue
Block a user