mirror of
https://github.com/love2d/love.git
synced 2026-08-18 11:44:15 +02:00
vulkan: move descriptor set logic into Shader
Using the extension VK_KHR_push_descriptor makes the code a lot easier. Using it makes us able to set set descriptor sets dynamically.
This commit is contained in:
@@ -21,9 +21,11 @@ namespace love {
|
||||
bool loadVolatile() override;
|
||||
void unloadVolatile() override;
|
||||
|
||||
const std::vector<VkPipelineShaderStageCreateInfo>& getShaderStages() const {
|
||||
return shaderStages;
|
||||
}
|
||||
const std::vector<VkPipelineShaderStageCreateInfo>& getShaderStages() const;
|
||||
|
||||
const VkPipelineLayout getGraphicsPipelineLayout() const;
|
||||
|
||||
void cmdPushDescriptorSets(VkCommandBuffer, uint32_t currentImage);
|
||||
|
||||
void attach() override;
|
||||
|
||||
@@ -43,11 +45,29 @@ namespace love {
|
||||
|
||||
bool hasUniform(const std::string& name) const override { return false; }
|
||||
|
||||
void setVideoTextures(graphics::Texture* ytexture, graphics::Texture* cbtexture, graphics::Texture* crtexture) override {}
|
||||
void setVideoTextures(graphics::Texture* ytexture, graphics::Texture* cbtexture, graphics::Texture* crtexture) override;
|
||||
|
||||
// fixme: use normal methods for this in the future.
|
||||
void setUniformData(BuiltinUniformData& data);
|
||||
void setMainTex(graphics::Texture* texture);
|
||||
|
||||
private:
|
||||
void compileShaders();
|
||||
void createDescriptorSetLayout();
|
||||
void createPipelineLayout();
|
||||
void createStreamBuffers();
|
||||
|
||||
PFN_vkCmdPushDescriptorSetKHR vkCmdPushDescriptorSet;
|
||||
|
||||
VkDescriptorSetLayout descriptorSetLayout;
|
||||
VkPipelineLayout pipelineLayout;
|
||||
|
||||
std::vector<StreamBuffer*> streamBuffers;
|
||||
|
||||
std::vector<VkPipelineShaderStageCreateInfo> shaderStages;
|
||||
std::vector<VkShaderModule> shaderModules;
|
||||
Graphics* gfx;
|
||||
VkDevice device;
|
||||
|
||||
std::map<std::string, int> vertexAttributeIndices = {
|
||||
{ "VertexPosition", 0 },
|
||||
@@ -63,7 +83,14 @@ namespace love {
|
||||
{ "MainTex", 4 }
|
||||
};
|
||||
|
||||
std::map<std::string, UniformInfo> uniforms;
|
||||
BuiltinUniformData uniformData;
|
||||
graphics::Texture* mainTex;
|
||||
graphics::Texture* ytexture;
|
||||
graphics::Texture* cbtexture;
|
||||
graphics::Texture* crtexture;
|
||||
|
||||
uint32_t currentImage;
|
||||
uint32_t count;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user