Change shader handling

This commit is contained in:
2023-08-04 20:20:20 +02:00
parent 4dac821abb
commit 836e9dce42
13 changed files with 71 additions and 23 deletions

View File

@@ -15,6 +15,7 @@ namespace openVulkanoCpp::Vulkan
{
void EncodeSimpleDrawable(Drawable* instance, Vulkan::VulkanDrawContext* drawContext)
{
drawContext->EncodeShader(instance->GetShader());
Geometry* mesh = dynamic_cast<SimpleDrawable*>(instance)->GetMesh();
VulkanGeometry* renderGeo = dynamic_cast<VulkanGeometry*>(mesh->renderGeo);
if (!mesh->renderGeo) renderGeo = drawContext->renderer->GetResourceManager().PrepareGeometry(mesh);

View File

@@ -23,15 +23,15 @@ namespace openVulkanoCpp
class Context;
class IShaderOwner;
struct VulkanShader final : virtual public ICloseable, virtual public IRecordable
struct VulkanShader final : public ICloseable, public IRecordable
{
Scene::Shader* shader = nullptr;
vk::Device device;
std::vector<vk::ShaderModule> shaderModules; // TODO manage live time somewhere else to allow sharing of shader programs
std::vector<vk::PipelineShaderStageCreateInfo> shaderStageCreateInfo;
vk::Pipeline pipeline; // TODO pipeline and shader config should be split
IShaderOwner* owner;
Context* context;
IShaderOwner* owner = nullptr;
Context* context = nullptr;
VulkanShader() = default;