Add depth bias config to shader
This commit is contained in:
@@ -84,6 +84,13 @@ namespace OpenVulkano::Vulkan
|
||||
vk::PipelineInputAssemblyStateCreateInfo inputAssembly = { {}, static_cast<vk::PrimitiveTopology>(shader->topology), 0 };
|
||||
vk::PipelineRasterizationStateCreateInfo rasterizer = {};
|
||||
rasterizer.cullMode = static_cast<vk::CullModeFlagBits>(shader->cullMode);
|
||||
if (shader->depthBias)
|
||||
{
|
||||
rasterizer.depthBiasEnable = VK_TRUE;
|
||||
rasterizer.depthBiasClamp = shader->depthBiasClamp;
|
||||
rasterizer.depthBiasConstantFactor = shader->depthBiasConstant;
|
||||
rasterizer.depthBiasSlopeFactor = shader->depthBiasSlope;
|
||||
}
|
||||
vk::PipelineMultisampleStateCreateInfo msaa = {};
|
||||
vk::PipelineDepthStencilStateCreateInfo depth = { {}, shader->depthTest, shader->depthWrite, static_cast<vk::CompareOp>(shader->depthCompareOp) };
|
||||
depth.maxDepthBounds = 1;
|
||||
|
||||
@@ -11,39 +11,36 @@
|
||||
#include <vulkan/vulkan.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace OpenVulkano
|
||||
namespace OpenVulkano::Vulkan
|
||||
{
|
||||
namespace Vulkan
|
||||
{
|
||||
class Context;
|
||||
class IShaderOwner;
|
||||
class Context;
|
||||
class IShaderOwner;
|
||||
|
||||
class VulkanShader final : public IRenderResource<Scene::Shader>, public IRecordable
|
||||
{
|
||||
public:
|
||||
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
|
||||
std::vector<vk::DescriptorSetLayout> descriptorSetLayouts;
|
||||
vk::PipelineLayout pipelineLayout;
|
||||
IShaderOwner* owner = nullptr;
|
||||
Context* context = nullptr;
|
||||
{
|
||||
public:
|
||||
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
|
||||
std::vector<vk::DescriptorSetLayout> descriptorSetLayouts;
|
||||
vk::PipelineLayout pipelineLayout;
|
||||
IShaderOwner* owner = nullptr;
|
||||
Context* context = nullptr;
|
||||
|
||||
VulkanShader(Context* context, Scene::Shader* shader, IShaderOwner* owner);
|
||||
VulkanShader(Context* context, Scene::Shader* shader, IShaderOwner* owner);
|
||||
|
||||
~VulkanShader() override;
|
||||
~VulkanShader() override;
|
||||
|
||||
void Resize();
|
||||
void Resize();
|
||||
|
||||
void Record(VulkanDrawContext* context) override;
|
||||
void Record(VulkanDrawContext* context) override;
|
||||
|
||||
void Release() override;
|
||||
void Release() override;
|
||||
|
||||
private:
|
||||
void BuildPipeline();
|
||||
private:
|
||||
void BuildPipeline();
|
||||
|
||||
void CreatePipelineLayout();
|
||||
};
|
||||
}
|
||||
void CreatePipelineLayout();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user