summaryrefslogtreecommitdiff
path: root/tools/gfx/render.h
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2021-01-26 13:32:03 -0800
committerGitHub <noreply@github.com>2021-01-26 13:32:03 -0800
commita90c850735664e2928e4cc961442a126c6859b97 (patch)
tree8b5e12113319ae87c57f5e616408eb955fe85a2c /tools/gfx/render.h
parent50676c741e10ffe6f710c5de86387eaacd274a9a (diff)
Integrate reflection more deeply into gfx layer (#1677)
Diffstat (limited to 'tools/gfx/render.h')
-rw-r--r--tools/gfx/render.h35
1 files changed, 17 insertions, 18 deletions
diff --git a/tools/gfx/render.h b/tools/gfx/render.h
index eeef00a8f..4c3b71645 100644
--- a/tools/gfx/render.h
+++ b/tools/gfx/render.h
@@ -71,6 +71,8 @@ enum class StageType
ClosestHit,
Miss,
Callable,
+ Amplification,
+ Mesh,
CountOf,
};
@@ -124,9 +126,13 @@ public:
struct Desc
{
PipelineType pipelineType;
+
KernelDesc const* kernels;
Int kernelCount;
+ /// Use instead of `kernels`/`kernelCount` if loading a Slang program.
+ slang::IComponentType* slangProgram;
+
/// Find and return the kernel for `stage`, if present.
KernelDesc const* findKernel(StageType stage) const
{
@@ -1026,14 +1032,15 @@ struct BlendDesc
struct GraphicsPipelineStateDesc
{
IShaderProgram* program;
- // Application should set either pipelineLayout or rootShaderObjectLayout, but not both.
+
+ // If `pipelineLayout` is null, then layout information will be extracted
+ // from `program`, which must have been created with Slang reflection info.
IPipelineLayout* pipelineLayout = nullptr;
- // Application should set either pipelineLayout or rootShaderObjectLayout, but not both.
- IShaderObjectLayout* rootShaderObjectLayout = nullptr;
+
IInputLayout* inputLayout;
UInt framebufferWidth;
UInt framebufferHeight;
- UInt renderTargetCount = 0; // Not used if rootShaderObjectLayout is set.
+ UInt renderTargetCount = 0; // Only used if `pipelineLayout` is non-null
DepthStencilDesc depthStencil;
RasterizerDesc rasterizer;
BlendDesc blend;
@@ -1042,8 +1049,10 @@ struct GraphicsPipelineStateDesc
struct ComputePipelineStateDesc
{
IShaderProgram* program;
+
+ // If `pipelineLayout` is null, then layout information will be extracted
+ // from `program`, which must have been created with Slang reflection info.
IPipelineLayout* pipelineLayout = nullptr;
- IShaderObjectLayout* rootShaderObjectLayout = nullptr;
};
class IPipelineState : public ISlangUnknown
@@ -1197,16 +1206,6 @@ public:
return layout;
}
- virtual SLANG_NO_THROW Result SLANG_MCALL createRootShaderObjectLayout(
- slang::ProgramLayout* layout, IShaderObjectLayout** outLayout) = 0;
-
- inline ComPtr<IShaderObjectLayout> createRootShaderObjectLayout(slang::ProgramLayout* layout)
- {
- ComPtr<IShaderObjectLayout> result;
- SLANG_RETURN_NULL_ON_FAIL(createRootShaderObjectLayout(layout, result.writeRef()));
- return result;
- }
-
virtual SLANG_NO_THROW Result SLANG_MCALL createShaderObject(IShaderObjectLayout* layout, IShaderObject** outObject) = 0;
inline ComPtr<IShaderObject> createShaderObject(IShaderObjectLayout* layout)
@@ -1216,12 +1215,12 @@ public:
return object;
}
- virtual SLANG_NO_THROW Result SLANG_MCALL createRootShaderObject(IShaderObjectLayout* layout, IShaderObject** outObject) = 0;
+ virtual SLANG_NO_THROW Result SLANG_MCALL createRootShaderObject(IShaderProgram* program, IShaderObject** outObject) = 0;
- inline ComPtr<IShaderObject> createRootShaderObject(IShaderObjectLayout* layout)
+ inline ComPtr<IShaderObject> createRootShaderObject(IShaderProgram* program)
{
ComPtr<IShaderObject> object;
- SLANG_RETURN_NULL_ON_FAIL(createRootShaderObject(layout, object.writeRef()));
+ SLANG_RETURN_NULL_ON_FAIL(createRootShaderObject(program, object.writeRef()));
return object;
}