|
|
@@ -44,8 +44,8 @@ namespace Framework
|
|
|
int shaderBindingTableParamCount;
|
|
|
|
|
|
public:
|
|
|
- DX12ShaderSignature();
|
|
|
- ~DX12ShaderSignature();
|
|
|
+ DLLEXPORT DX12ShaderSignature();
|
|
|
+ DLLEXPORT ~DX12ShaderSignature();
|
|
|
/**
|
|
|
* for each datastructure with : register(...) in the shader code,
|
|
|
* either this function or addRegisterUsageLinkedToDescriptorHeap must
|
|
|
@@ -62,7 +62,7 @@ namespace Framework
|
|
|
* call to createSignature() and should be used to fill the shader
|
|
|
* binding table with the correct GPU addresses of the resources.
|
|
|
*/
|
|
|
- int* addRegisterUsageLinkedToShaderBindingTable(
|
|
|
+ DLLEXPORT int* addRegisterUsageLinkedToShaderBindingTable(
|
|
|
DX12ShaderRegister registerType,
|
|
|
int registerIndex,
|
|
|
int spaceIndex = 0);
|
|
|
@@ -84,19 +84,20 @@ namespace Framework
|
|
|
* \param spaceIndex the optional space index e.g. 3 for : register(b1,
|
|
|
* space3)
|
|
|
*/
|
|
|
- void addRegisterUsageLinkedToDescriptorHeap(int descriptorHeapIndex,
|
|
|
+ DLLEXPORT void addRegisterUsageLinkedToDescriptorHeap(
|
|
|
+ int descriptorHeapIndex,
|
|
|
DX12ShaderRegister registerType,
|
|
|
int registerIndex,
|
|
|
int spaceIndex = 0);
|
|
|
/**
|
|
|
* Creates the root signature.
|
|
|
*/
|
|
|
- void createSignature(ID3D12Device5* zDevice,
|
|
|
+ DLLEXPORT void createSignature(ID3D12Device5* zDevice,
|
|
|
PFN_D3D12_SERIALIZE_ROOT_SIGNATURE pfnD3D12SerializeRootSignature);
|
|
|
- ID3D12RootSignature* zSignature() const;
|
|
|
- const Array<DX12ShaderRegisterUsage*>&
|
|
|
+ DLLEXPORT ID3D12RootSignature* zSignature() const;
|
|
|
+ DLLEXPORT const Array<DX12ShaderRegisterUsage*>&
|
|
|
getDescriptorHeapBindings() const;
|
|
|
- int gerShaderBindingTableParamCount() const;
|
|
|
+ DLLEXPORT int gerShaderBindingTableParamCount() const;
|
|
|
};
|
|
|
|
|
|
enum DX12ShaderFunctionType
|
|
|
@@ -118,14 +119,14 @@ namespace Framework
|
|
|
DX12ShaderFunctionType functionType;
|
|
|
|
|
|
public:
|
|
|
- DX12ShaderFunction(const Text& functionName,
|
|
|
+ DLLEXPORT DX12ShaderFunction(const Text& functionName,
|
|
|
DX12ShaderSignature* signature,
|
|
|
DX12ShaderFunctionType functionType);
|
|
|
- ~DX12ShaderFunction();
|
|
|
- const Text& getFunctionName() const;
|
|
|
- DX12ShaderSignature* zSignature() const;
|
|
|
- D3D12_EXPORT_DESC* zExportDesc() const;
|
|
|
- DX12ShaderFunctionType getFunctionType() const;
|
|
|
+ DLLEXPORT ~DX12ShaderFunction();
|
|
|
+ DLLEXPORT const Text& getFunctionName() const;
|
|
|
+ DLLEXPORT DX12ShaderSignature* zSignature() const;
|
|
|
+ DLLEXPORT D3D12_EXPORT_DESC* zExportDesc() const;
|
|
|
+ DLLEXPORT DX12ShaderFunctionType getFunctionType() const;
|
|
|
};
|
|
|
|
|
|
class DX12Shader : public ReferenceCounter
|
|
|
@@ -137,13 +138,14 @@ namespace Framework
|
|
|
D3D12_DXIL_LIBRARY_DESC* libraryDesc;
|
|
|
|
|
|
public:
|
|
|
- DX12Shader(const unsigned char* shaderBytes, int shaderBytesSize);
|
|
|
- ~DX12Shader();
|
|
|
- void addFunction(DX12ShaderFunction* function);
|
|
|
- int getShaderBytesSize() const;
|
|
|
- const unsigned char* getShaderBytes() const;
|
|
|
- const RCArray<DX12ShaderFunction>& getFunctions() const;
|
|
|
- D3D12_DXIL_LIBRARY_DESC* zLibraryDesc() const;
|
|
|
+ DLLEXPORT DX12Shader(
|
|
|
+ const unsigned char* shaderBytes, int shaderBytesSize);
|
|
|
+ DLLEXPORT ~DX12Shader();
|
|
|
+ DLLEXPORT void addFunction(DX12ShaderFunction* function);
|
|
|
+ DLLEXPORT int getShaderBytesSize() const;
|
|
|
+ DLLEXPORT const unsigned char* getShaderBytes() const;
|
|
|
+ DLLEXPORT const RCArray<DX12ShaderFunction>& getFunctions() const;
|
|
|
+ DLLEXPORT D3D12_DXIL_LIBRARY_DESC* zLibraryDesc() const;
|
|
|
};
|
|
|
|
|
|
class DX12ShaderHitGroup : public ReferenceCounter
|
|
|
@@ -158,23 +160,24 @@ namespace Framework
|
|
|
D3D12_HIT_GROUP_DESC* hitGroupDesc;
|
|
|
|
|
|
public:
|
|
|
- DX12ShaderHitGroup(const Text name);
|
|
|
- ~DX12ShaderHitGroup();
|
|
|
- void setClosestHitShaderFunction(
|
|
|
+ DLLEXPORT DX12ShaderHitGroup(const Text name);
|
|
|
+ DLLEXPORT ~DX12ShaderHitGroup();
|
|
|
+ DLLEXPORT void setClosestHitShaderFunction(
|
|
|
DX12ShaderFunction* zClosestHitShaderFunction);
|
|
|
- void setAnyHitShaderFunction(DX12ShaderFunction* zAnyHitShaderFunction);
|
|
|
- void setIntersectionShaderFunction(
|
|
|
+ DLLEXPORT void setAnyHitShaderFunction(
|
|
|
+ DX12ShaderFunction* zAnyHitShaderFunction);
|
|
|
+ DLLEXPORT void setIntersectionShaderFunction(
|
|
|
DX12ShaderFunction* zIntersectionShaderFunction);
|
|
|
- void setPayloadSize(int payloadSize);
|
|
|
- void setAttributeSize(int attributeSize);
|
|
|
- const Text& getName() const;
|
|
|
- DX12ShaderFunction* zClosestHitShaderFunction() const;
|
|
|
- DX12ShaderFunction* zAnyHitShaderFunction() const;
|
|
|
- DX12ShaderFunction* zIntersectionShaderFunction() const;
|
|
|
- int getPayloadSize() const;
|
|
|
- int getAttributeSize() const;
|
|
|
- D3D12_HIT_GROUP_DESC* zHitGroupDesc() const;
|
|
|
- DX12ShaderSignature* zSignature() const;
|
|
|
+ DLLEXPORT void setPayloadSize(int payloadSize);
|
|
|
+ DLLEXPORT void setAttributeSize(int attributeSize);
|
|
|
+ DLLEXPORT const Text& getName() const;
|
|
|
+ DLLEXPORT DX12ShaderFunction* zClosestHitShaderFunction() const;
|
|
|
+ DLLEXPORT DX12ShaderFunction* zAnyHitShaderFunction() const;
|
|
|
+ DLLEXPORT DX12ShaderFunction* zIntersectionShaderFunction() const;
|
|
|
+ DLLEXPORT int getPayloadSize() const;
|
|
|
+ DLLEXPORT int getAttributeSize() const;
|
|
|
+ DLLEXPORT D3D12_HIT_GROUP_DESC* zHitGroupDesc() const;
|
|
|
+ DLLEXPORT DX12ShaderSignature* zSignature() const;
|
|
|
};
|
|
|
|
|
|
class DX12ShaderBindingTable;
|
|
|
@@ -192,20 +195,20 @@ namespace Framework
|
|
|
int maxRecursionDepth;
|
|
|
|
|
|
public:
|
|
|
- DX12Pipeline();
|
|
|
- ~DX12Pipeline();
|
|
|
- void addShader(DX12Shader* shader);
|
|
|
- void addHitGroup(DX12ShaderHitGroup* hitGroup);
|
|
|
- void setMaxRecursionDepth(int maxRecursionDepth);
|
|
|
- void createPipelineState(ID3D12Device5* zDevice,
|
|
|
+ DLLEXPORT DX12Pipeline();
|
|
|
+ DLLEXPORT ~DX12Pipeline();
|
|
|
+ DLLEXPORT void addShader(DX12Shader* shader);
|
|
|
+ DLLEXPORT void addHitGroup(DX12ShaderHitGroup* hitGroup);
|
|
|
+ DLLEXPORT void setMaxRecursionDepth(int maxRecursionDepth);
|
|
|
+ DLLEXPORT void createPipelineState(ID3D12Device5* zDevice,
|
|
|
PFN_D3D12_SERIALIZE_ROOT_SIGNATURE pfnD3D12SerializeRootSignature);
|
|
|
- ID3D12StateObject* zPipelineState() const;
|
|
|
- DX12ShaderBindingTable* createShaderBindingTable();
|
|
|
- DX12GlobalDescriptorHeap* createGlobalDescriptorHeap();
|
|
|
- const RCArray<DX12Shader>& getShaders() const;
|
|
|
- const Array<const DX12ShaderFunction*>&
|
|
|
+ DLLEXPORT ID3D12StateObject* zPipelineState() const;
|
|
|
+ DLLEXPORT DX12ShaderBindingTable* createShaderBindingTable();
|
|
|
+ DLLEXPORT DX12GlobalDescriptorHeap* createGlobalDescriptorHeap();
|
|
|
+ DLLEXPORT const RCArray<DX12Shader>& getShaders() const;
|
|
|
+ DLLEXPORT const Array<const DX12ShaderFunction*>&
|
|
|
getFunctionsWithoutHitGroups() const;
|
|
|
- const RCArray<DX12ShaderHitGroup>& getHitGroups() const;
|
|
|
+ DLLEXPORT const RCArray<DX12ShaderHitGroup>& getHitGroups() const;
|
|
|
}; // namespace Framework
|
|
|
|
|
|
struct DX12ShaderRegisterInput
|
|
|
@@ -228,15 +231,18 @@ namespace Framework
|
|
|
~DX12GlobalDescriptorHeap();
|
|
|
|
|
|
private:
|
|
|
- void addInput(DX12ShaderRegister type, ReferenceCounter* inputResource);
|
|
|
+ DLLEXPORT void addInput(
|
|
|
+ DX12ShaderRegister type, ReferenceCounter* inputResource);
|
|
|
|
|
|
public:
|
|
|
- void addTextureInput(DX12ShaderRegister type, Texture* zTexture);
|
|
|
- void addBufferInput(DX12ShaderRegister type, DXBuffer* zBuffer);
|
|
|
- void addTLASInput(DX12ShaderRegister type, DX12TLAS* zTLAS);
|
|
|
- void updateDescriptorHeap(ID3D12Device5* zDevice);
|
|
|
- DX12Pipeline* zPipeline() const;
|
|
|
- ID3D12DescriptorHeap* zDescriptorHeap() const;
|
|
|
+ DLLEXPORT void addTextureInput(
|
|
|
+ DX12ShaderRegister type, Texture* zTexture);
|
|
|
+ DLLEXPORT void addBufferInput(
|
|
|
+ DX12ShaderRegister type, DXBuffer* zBuffer);
|
|
|
+ DLLEXPORT void addTLASInput(DX12ShaderRegister type, DX12TLAS* zTLAS);
|
|
|
+ DLLEXPORT void updateDescriptorHeap(ID3D12Device5* zDevice);
|
|
|
+ DLLEXPORT DX12Pipeline* zPipeline() const;
|
|
|
+ DLLEXPORT ID3D12DescriptorHeap* zDescriptorHeap() const;
|
|
|
};
|
|
|
|
|
|
class DX12ShaderBindingTable : public ReferenceCounter
|
|
|
@@ -260,14 +266,14 @@ namespace Framework
|
|
|
ID3D12StateObjectProperties* stateObjectProperties;
|
|
|
|
|
|
public:
|
|
|
- DX12ShaderBindingTable(DX12Pipeline* pipeline);
|
|
|
- ~DX12ShaderBindingTable();
|
|
|
- void setGlobalDescriptorHeap(
|
|
|
+ DLLEXPORT DX12ShaderBindingTable(DX12Pipeline* pipeline);
|
|
|
+ DLLEXPORT ~DX12ShaderBindingTable();
|
|
|
+ DLLEXPORT void setGlobalDescriptorHeap(
|
|
|
DX12GlobalDescriptorHeap* zGlobalDescriptorHeap);
|
|
|
- void startUpdate();
|
|
|
+ DLLEXPORT void startUpdate();
|
|
|
|
|
|
private:
|
|
|
- void set(int index, void* data, int size);
|
|
|
+ DLLEXPORT void set(int index, void* data, int size);
|
|
|
|
|
|
public:
|
|
|
/**
|
|
|
@@ -284,7 +290,7 @@ namespace Framework
|
|
|
* table for this input. This is usually the GPU address of a buffer or
|
|
|
* texture.
|
|
|
*/
|
|
|
- void setShaderInput(DX12ShaderFunction* zFunction,
|
|
|
+ DLLEXPORT void setShaderInput(DX12ShaderFunction* zFunction,
|
|
|
int* offsetPointer,
|
|
|
__int64 gpuAddress);
|
|
|
/**
|
|
|
@@ -298,7 +304,7 @@ namespace Framework
|
|
|
* index can be used to set the inputs for this hit group by calling
|
|
|
* setHitGroupShaderInput.
|
|
|
*/
|
|
|
- int addHitGroup(DX12ShaderHitGroup* zHitGroup);
|
|
|
+ DLLEXPORT int addHitGroup(DX12ShaderHitGroup* zHitGroup);
|
|
|
/**
|
|
|
* sets a specific input for a previously added hitgroup.
|
|
|
*
|
|
|
@@ -312,10 +318,11 @@ namespace Framework
|
|
|
* table for this input. This is usually the GPU address of a buffer or
|
|
|
* texture.
|
|
|
*/
|
|
|
- void setHitGroupShaderInput(
|
|
|
+ DLLEXPORT void setHitGroupShaderInput(
|
|
|
int hitGroupOffset, int* offsetPointer, __int64 gpuAddress);
|
|
|
- void endUpdate(ID3D12Device5* zDevice);
|
|
|
- void fillDispatchRaysDesc(D3D12_DISPATCH_RAYS_DESC* dispatchRaysDesc);
|
|
|
- DX12Pipeline* zPipeline() const;
|
|
|
+ DLLEXPORT void endUpdate(ID3D12Device5* zDevice);
|
|
|
+ DLLEXPORT void fillDispatchRaysDesc(
|
|
|
+ D3D12_DISPATCH_RAYS_DESC* dispatchRaysDesc);
|
|
|
+ DLLEXPORT DX12Pipeline* zPipeline() const;
|
|
|
};
|
|
|
} // namespace Framework
|