|
@@ -517,11 +517,15 @@ Framework::DX12ShaderHitGroup::~DX12ShaderHitGroup()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void Framework::DX12ShaderHitGroup::setClosestHitShaderFunction(
|
|
void Framework::DX12ShaderHitGroup::setClosestHitShaderFunction(
|
|
|
- DX12ShaderFunction* closestHitShaderFunction)
|
|
|
|
|
|
|
+ DX12ShaderFunction* zClosestHitShaderFunction)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (this->closestHitShaderFunction == zClosestHitShaderFunction)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (anyHitShaderFunction
|
|
if (anyHitShaderFunction
|
|
|
&& anyHitShaderFunction->zSignature()
|
|
&& anyHitShaderFunction->zSignature()
|
|
|
- != closestHitShaderFunction->zSignature())
|
|
|
|
|
|
|
+ != zClosestHitShaderFunction->zSignature())
|
|
|
{
|
|
{
|
|
|
Logging::error()
|
|
Logging::error()
|
|
|
<< "Any-hit shader function and closest-hit shader "
|
|
<< "Any-hit shader function and closest-hit shader "
|
|
@@ -530,12 +534,12 @@ void Framework::DX12ShaderHitGroup::setClosestHitShaderFunction(
|
|
|
<< name << "' Any Hit Shader Function: '"
|
|
<< name << "' Any Hit Shader Function: '"
|
|
|
<< anyHitShaderFunction->getFunctionName().getText()
|
|
<< anyHitShaderFunction->getFunctionName().getText()
|
|
|
<< "' Closest Hit Shader Function: '"
|
|
<< "' Closest Hit Shader Function: '"
|
|
|
- << closestHitShaderFunction->getFunctionName().getText() << "'";
|
|
|
|
|
|
|
+ << zClosestHitShaderFunction->getFunctionName().getText() << "'";
|
|
|
throw std::runtime_error("Incompatible root signatures in hit group");
|
|
throw std::runtime_error("Incompatible root signatures in hit group");
|
|
|
}
|
|
}
|
|
|
if (intersectionShaderFunction
|
|
if (intersectionShaderFunction
|
|
|
&& intersectionShaderFunction->zSignature()
|
|
&& intersectionShaderFunction->zSignature()
|
|
|
- != closestHitShaderFunction->zSignature())
|
|
|
|
|
|
|
+ != zClosestHitShaderFunction->zSignature())
|
|
|
{
|
|
{
|
|
|
Logging::error()
|
|
Logging::error()
|
|
|
<< "Intersection shader function and closest-hit shader "
|
|
<< "Intersection shader function and closest-hit shader "
|
|
@@ -544,43 +548,48 @@ void Framework::DX12ShaderHitGroup::setClosestHitShaderFunction(
|
|
|
<< name << "' Intersection Shader Function: '"
|
|
<< name << "' Intersection Shader Function: '"
|
|
|
<< intersectionShaderFunction->getFunctionName().getText()
|
|
<< intersectionShaderFunction->getFunctionName().getText()
|
|
|
<< "' Closest Hit Shader Function: '"
|
|
<< "' Closest Hit Shader Function: '"
|
|
|
- << closestHitShaderFunction->getFunctionName().getText() << "'";
|
|
|
|
|
|
|
+ << zClosestHitShaderFunction->getFunctionName().getText() << "'";
|
|
|
throw std::runtime_error("Incompatible root signatures in hit group");
|
|
throw std::runtime_error("Incompatible root signatures in hit group");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (this->closestHitShaderFunction)
|
|
|
|
|
|
|
+ if (closestHitShaderFunction)
|
|
|
{
|
|
{
|
|
|
- this->closestHitShaderFunction->release();
|
|
|
|
|
|
|
+ closestHitShaderFunction->release();
|
|
|
}
|
|
}
|
|
|
- this->closestHitShaderFunction = closestHitShaderFunction;
|
|
|
|
|
|
|
+ closestHitShaderFunction = zClosestHitShaderFunction;
|
|
|
hitGroupDesc->ClosestHitShaderImport = 0;
|
|
hitGroupDesc->ClosestHitShaderImport = 0;
|
|
|
if (closestHitShaderFunction)
|
|
if (closestHitShaderFunction)
|
|
|
{
|
|
{
|
|
|
hitGroupDesc->ClosestHitShaderImport
|
|
hitGroupDesc->ClosestHitShaderImport
|
|
|
= closestHitShaderFunction->zExportDesc()->Name;
|
|
= closestHitShaderFunction->zExportDesc()->Name;
|
|
|
|
|
+ closestHitShaderFunction->getThis();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void Framework::DX12ShaderHitGroup::setAnyHitShaderFunction(
|
|
void Framework::DX12ShaderHitGroup::setAnyHitShaderFunction(
|
|
|
- DX12ShaderFunction* anyHitShaderFunction)
|
|
|
|
|
|
|
+ DX12ShaderFunction* zAnyHitShaderFunction)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (this->anyHitShaderFunction == zAnyHitShaderFunction)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (closestHitShaderFunction
|
|
if (closestHitShaderFunction
|
|
|
&& closestHitShaderFunction->zSignature()
|
|
&& closestHitShaderFunction->zSignature()
|
|
|
- != anyHitShaderFunction->zSignature())
|
|
|
|
|
|
|
+ != zAnyHitShaderFunction->zSignature())
|
|
|
{
|
|
{
|
|
|
Logging::error()
|
|
Logging::error()
|
|
|
<< "Any-hit shader function and closest-hit shader "
|
|
<< "Any-hit shader function and closest-hit shader "
|
|
|
"function must have the same root signature when they are "
|
|
"function must have the same root signature when they are "
|
|
|
"combined in the same hit group. HitGroup Name: '"
|
|
"combined in the same hit group. HitGroup Name: '"
|
|
|
<< name << "' Any Hit Shader Function: '"
|
|
<< name << "' Any Hit Shader Function: '"
|
|
|
- << anyHitShaderFunction->getFunctionName().getText()
|
|
|
|
|
|
|
+ << zAnyHitShaderFunction->getFunctionName().getText()
|
|
|
<< "' Closest Hit Shader Function: '"
|
|
<< "' Closest Hit Shader Function: '"
|
|
|
<< closestHitShaderFunction->getFunctionName().getText() << "'";
|
|
<< closestHitShaderFunction->getFunctionName().getText() << "'";
|
|
|
throw std::runtime_error("Incompatible root signatures in hit group");
|
|
throw std::runtime_error("Incompatible root signatures in hit group");
|
|
|
}
|
|
}
|
|
|
if (intersectionShaderFunction
|
|
if (intersectionShaderFunction
|
|
|
&& intersectionShaderFunction->zSignature()
|
|
&& intersectionShaderFunction->zSignature()
|
|
|
- != anyHitShaderFunction->zSignature())
|
|
|
|
|
|
|
+ != zAnyHitShaderFunction->zSignature())
|
|
|
{
|
|
{
|
|
|
Logging::error()
|
|
Logging::error()
|
|
|
<< "Intersection shader function and any-hit shader "
|
|
<< "Intersection shader function and any-hit shader "
|
|
@@ -589,26 +598,31 @@ void Framework::DX12ShaderHitGroup::setAnyHitShaderFunction(
|
|
|
<< name << "' Intersection Shader Function: '"
|
|
<< name << "' Intersection Shader Function: '"
|
|
|
<< intersectionShaderFunction->getFunctionName().getText()
|
|
<< intersectionShaderFunction->getFunctionName().getText()
|
|
|
<< "' Any Hit Shader Function: '"
|
|
<< "' Any Hit Shader Function: '"
|
|
|
- << anyHitShaderFunction->getFunctionName().getText() << "'";
|
|
|
|
|
|
|
+ << zAnyHitShaderFunction->getFunctionName().getText() << "'";
|
|
|
throw std::runtime_error("Incompatible root signatures in hit group");
|
|
throw std::runtime_error("Incompatible root signatures in hit group");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (this->anyHitShaderFunction)
|
|
|
|
|
|
|
+ if (anyHitShaderFunction)
|
|
|
{
|
|
{
|
|
|
- this->anyHitShaderFunction->release();
|
|
|
|
|
|
|
+ anyHitShaderFunction->release();
|
|
|
}
|
|
}
|
|
|
- this->anyHitShaderFunction = anyHitShaderFunction;
|
|
|
|
|
|
|
+ anyHitShaderFunction = zAnyHitShaderFunction;
|
|
|
hitGroupDesc->AnyHitShaderImport = 0;
|
|
hitGroupDesc->AnyHitShaderImport = 0;
|
|
|
if (anyHitShaderFunction)
|
|
if (anyHitShaderFunction)
|
|
|
{
|
|
{
|
|
|
hitGroupDesc->AnyHitShaderImport
|
|
hitGroupDesc->AnyHitShaderImport
|
|
|
= anyHitShaderFunction->zExportDesc()->Name;
|
|
= anyHitShaderFunction->zExportDesc()->Name;
|
|
|
|
|
+ anyHitShaderFunction->getThis();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void Framework::DX12ShaderHitGroup::setIntersectionShaderFunction(
|
|
void Framework::DX12ShaderHitGroup::setIntersectionShaderFunction(
|
|
|
DX12ShaderFunction* zIntersectionShaderFunction)
|
|
DX12ShaderFunction* zIntersectionShaderFunction)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (intersectionShaderFunction == zIntersectionShaderFunction)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (closestHitShaderFunction
|
|
if (closestHitShaderFunction
|
|
|
&& closestHitShaderFunction->zSignature()
|
|
&& closestHitShaderFunction->zSignature()
|
|
|
!= zIntersectionShaderFunction->zSignature())
|
|
!= zIntersectionShaderFunction->zSignature())
|
|
@@ -642,13 +656,13 @@ void Framework::DX12ShaderHitGroup::setIntersectionShaderFunction(
|
|
|
{
|
|
{
|
|
|
intersectionShaderFunction->release();
|
|
intersectionShaderFunction->release();
|
|
|
}
|
|
}
|
|
|
- intersectionShaderFunction = dynamic_cast<DX12ShaderFunction*>(
|
|
|
|
|
- zIntersectionShaderFunction->getThis());
|
|
|
|
|
|
|
+ intersectionShaderFunction = zIntersectionShaderFunction;
|
|
|
hitGroupDesc->IntersectionShaderImport = 0;
|
|
hitGroupDesc->IntersectionShaderImport = 0;
|
|
|
if (intersectionShaderFunction)
|
|
if (intersectionShaderFunction)
|
|
|
{
|
|
{
|
|
|
hitGroupDesc->IntersectionShaderImport
|
|
hitGroupDesc->IntersectionShaderImport
|
|
|
= intersectionShaderFunction->zExportDesc()->Name;
|
|
= intersectionShaderFunction->zExportDesc()->Name;
|
|
|
|
|
+ intersectionShaderFunction->getThis();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|