Add compute demo (WIP) + fixes creation of compute pipelines
This commit is contained in:
committed by
Jérôme Leclercq
parent
9578ba3ef5
commit
4605eed0da
@@ -19,7 +19,7 @@ namespace Nz
|
||||
OpenGLComputePipeline::OpenGLComputePipeline(OpenGLDevice& device, ComputePipelineInfo pipelineInfo) :
|
||||
m_pipelineInfo(std::move(pipelineInfo))
|
||||
{
|
||||
if (device.GetEnabledFeatures().computeShaders)
|
||||
if (!device.GetEnabledFeatures().computeShaders)
|
||||
throw std::runtime_error("compute shaders are not enabled on the device");
|
||||
|
||||
OpenGLRenderPipelineLayout& pipelineLayout = static_cast<OpenGLRenderPipelineLayout&>(*m_pipelineInfo.pipelineLayout);
|
||||
@@ -27,9 +27,9 @@ namespace Nz
|
||||
if (!m_program.Create(device))
|
||||
throw std::runtime_error("failed to create program");
|
||||
|
||||
NazaraAssert(pipelineInfo.shaderModule, "invalid shader module");
|
||||
NazaraAssert(m_pipelineInfo.shaderModule, "invalid shader module");
|
||||
|
||||
OpenGLShaderModule& shaderModule = static_cast<OpenGLShaderModule&>(*pipelineInfo.shaderModule);
|
||||
OpenGLShaderModule& shaderModule = static_cast<OpenGLShaderModule&>(*m_pipelineInfo.shaderModule);
|
||||
|
||||
std::vector<OpenGLShaderModule::ExplicitBinding> explicitBindings;
|
||||
nzsl::ShaderStageTypeFlags stageFlags = shaderModule.Attach(m_program, pipelineLayout.GetBindingMapping(), &explicitBindings);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Nz
|
||||
VulkanComputePipeline::VulkanComputePipeline(VulkanDevice& device, ComputePipelineInfo pipelineInfo) :
|
||||
m_pipelineInfo(std::move(pipelineInfo))
|
||||
{
|
||||
if (device.GetEnabledFeatures().computeShaders)
|
||||
if (!device.GetEnabledFeatures().computeShaders)
|
||||
throw std::runtime_error("compute shaders are not enabled on the device");
|
||||
|
||||
VulkanShaderModule& vulkanModule = static_cast<VulkanShaderModule&>(*m_pipelineInfo.shaderModule);
|
||||
|
||||
@@ -104,14 +104,9 @@ namespace Nz
|
||||
nzsl::ShaderStageType stageType;
|
||||
switch (entryPoint.executionModel)
|
||||
{
|
||||
case nzsl::SpirvExecutionModel::Fragment:
|
||||
stageType = nzsl::ShaderStageType::Fragment;
|
||||
break;
|
||||
|
||||
case nzsl::SpirvExecutionModel::Vertex:
|
||||
stageType = nzsl::ShaderStageType::Vertex;
|
||||
break;
|
||||
|
||||
case nzsl::SpirvExecutionModel::GLCompute: stageType = nzsl::ShaderStageType::Compute; break;
|
||||
case nzsl::SpirvExecutionModel::Fragment: stageType = nzsl::ShaderStageType::Fragment; break;
|
||||
case nzsl::SpirvExecutionModel::Vertex: stageType = nzsl::ShaderStageType::Vertex; break;
|
||||
default:
|
||||
continue; //< Ignore
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user