Multiple features and misc fixes for final raytracing non experimental version.

This commit is contained in:
Ashwin Lele
2018-10-22 16:41:44 -07:00
parent b2b3d81e9b
commit ff1783db87
48 changed files with 5168 additions and 4850 deletions

View File

@@ -276,12 +276,12 @@ spv::ExecutionModel TranslateExecutionModel(EShLanguage stage)
case EShLangFragment: return spv::ExecutionModelFragment;
case EShLangCompute: return spv::ExecutionModelGLCompute;
#ifdef NV_EXTENSIONS
case EShLangRayGenNV: return spv::ExecutionModelRayGenerationNVX;
case EShLangIntersectNV: return spv::ExecutionModelIntersectionNVX;
case EShLangAnyHitNV: return spv::ExecutionModelAnyHitNVX;
case EShLangClosestHitNV: return spv::ExecutionModelClosestHitNVX;
case EShLangMissNV: return spv::ExecutionModelMissNVX;
case EShLangCallableNV: return spv::ExecutionModelCallableNVX;
case EShLangRayGenNV: return spv::ExecutionModelRayGenerationNV;
case EShLangIntersectNV: return spv::ExecutionModelIntersectionNV;
case EShLangAnyHitNV: return spv::ExecutionModelAnyHitNV;
case EShLangClosestHitNV: return spv::ExecutionModelClosestHitNV;
case EShLangMissNV: return spv::ExecutionModelMissNV;
case EShLangCallableNV: return spv::ExecutionModelCallableNV;
case EShLangTaskNV: return spv::ExecutionModelTaskNV;
case EShLangMeshNV: return spv::ExecutionModelMeshNV;
#endif
@@ -338,6 +338,8 @@ spv::Decoration TranslateBlockDecoration(const glslang::TType& type, bool useSto
case glslang::EvqPayloadNV: return spv::DecorationBlock;
case glslang::EvqPayloadInNV: return spv::DecorationBlock;
case glslang::EvqHitAttrNV: return spv::DecorationBlock;
case glslang::EvqCallableDataNV: return spv::DecorationBlock;
case glslang::EvqCallableDataInNV: return spv::DecorationBlock;
#endif
default:
assert(0);
@@ -411,6 +413,8 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T
case glslang::EvqPayloadNV:
case glslang::EvqPayloadInNV:
case glslang::EvqHitAttrNV:
case glslang::EvqCallableDataNV:
case glslang::EvqCallableDataInNV:
return spv::DecorationMax;
#endif
default:
@@ -875,31 +879,33 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
// raytracing
case glslang::EbvLaunchIdNV:
return spv::BuiltInLaunchIdNVX;
return spv::BuiltInLaunchIdNV;
case glslang::EbvLaunchSizeNV:
return spv::BuiltInLaunchSizeNVX;
return spv::BuiltInLaunchSizeNV;
case glslang::EbvWorldRayOriginNV:
return spv::BuiltInWorldRayOriginNVX;
return spv::BuiltInWorldRayOriginNV;
case glslang::EbvWorldRayDirectionNV:
return spv::BuiltInWorldRayDirectionNVX;
return spv::BuiltInWorldRayDirectionNV;
case glslang::EbvObjectRayOriginNV:
return spv::BuiltInObjectRayOriginNVX;
return spv::BuiltInObjectRayOriginNV;
case glslang::EbvObjectRayDirectionNV:
return spv::BuiltInObjectRayDirectionNVX;
return spv::BuiltInObjectRayDirectionNV;
case glslang::EbvRayTminNV:
return spv::BuiltInRayTminNVX;
return spv::BuiltInRayTminNV;
case glslang::EbvRayTmaxNV:
return spv::BuiltInRayTmaxNVX;
return spv::BuiltInRayTmaxNV;
case glslang::EbvInstanceCustomIndexNV:
return spv::BuiltInInstanceCustomIndexNVX;
return spv::BuiltInInstanceCustomIndexNV;
case glslang::EbvHitTNV:
return spv::BuiltInHitTNVX;
return spv::BuiltInHitTNV;
case glslang::EbvHitKindNV:
return spv::BuiltInHitKindNVX;
return spv::BuiltInHitKindNV;
case glslang::EbvObjectToWorldNV:
return spv::BuiltInObjectToWorldNVX;
return spv::BuiltInObjectToWorldNV;
case glslang::EbvWorldToObjectNV:
return spv::BuiltInWorldToObjectNVX;
return spv::BuiltInWorldToObjectNV;
case glslang::EbvIncomingRayFlagsNV:
return spv::BuiltInIncomingRayFlagsNV;
case glslang::EbvBaryCoordNV:
builder.addExtension(spv::E_SPV_NV_fragment_shader_barycentric);
builder.addCapability(spv::CapabilityFragmentBarycentricNV);
@@ -1082,7 +1088,7 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
return spv::StorageClassPushConstant;
#ifdef NV_EXTENSIONS
if (type.getQualifier().layoutShaderRecordNV)
return spv::StorageClassShaderRecordBufferNVX;
return spv::StorageClassShaderRecordBufferNV;
#endif
if (type.getBasicType() == glslang::EbtBlock)
return spv::StorageClassUniform;
@@ -1095,9 +1101,11 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
case glslang::EvqConstReadOnly: return spv::StorageClassFunction;
case glslang::EvqTemporary: return spv::StorageClassFunction;
#ifdef NV_EXTENSIONS
case glslang::EvqPayloadNV: return spv::StorageClassRayPayloadNVX;
case glslang::EvqPayloadInNV: return spv::StorageClassIncomingRayPayloadNVX;
case glslang::EvqHitAttrNV: return spv::StorageClassHitAttributeNVX;
case glslang::EvqPayloadNV: return spv::StorageClassRayPayloadNV;
case glslang::EvqPayloadInNV: return spv::StorageClassIncomingRayPayloadNV;
case glslang::EvqHitAttrNV: return spv::StorageClassHitAttributeNV;
case glslang::EvqCallableDataNV: return spv::StorageClassCallableDataNV;
case glslang::EvqCallableDataInNV: return spv::StorageClassIncomingCallableDataNV;
#endif
default:
assert(0);
@@ -1430,8 +1438,8 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl
case EShLangClosestHitNV:
case EShLangMissNV:
case EShLangCallableNV:
builder.addCapability(spv::CapabilityRaytracingNVX);
builder.addExtension("SPV_NVX_raytracing");
builder.addCapability(spv::CapabilityRayTracingNV);
builder.addExtension("SPV_NV_ray_tracing");
break;
case EShLangTaskNV:
case EShLangMeshNV:
@@ -2267,6 +2275,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
case glslang::EOpIgnoreIntersectionNV:
case glslang::EOpTerminateRayNV:
case glslang::EOpTraceNV:
case glslang::EOpExecuteCallableNV:
case glslang::EOpWritePackedPrimitiveIndices4x8NV:
noReturnValue = true;
break;
@@ -6871,12 +6880,18 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
case glslang::EOpReportIntersectionNV:
{
typeId = builder.makeBoolType();
opCode = spv::OpReportIntersectionNVX;
opCode = spv::OpReportIntersectionNV;
}
break;
case glslang::EOpTraceNV:
{
builder.createNoResultOp(spv::OpTraceNVX, operands);
builder.createNoResultOp(spv::OpTraceNV, operands);
return 0;
}
break;
case glslang::EOpExecuteCallableNV:
{
builder.createNoResultOp(spv::OpExecuteCallableNV, operands);
return 0;
}
break;
@@ -7060,10 +7075,10 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
#endif
#ifdef NV_EXTENSIONS
case glslang::EOpIgnoreIntersectionNV:
builder.createNoResultOp(spv::OpIgnoreIntersectionNVX);
builder.createNoResultOp(spv::OpIgnoreIntersectionNV);
return 0;
case glslang::EOpTerminateRayNV:
builder.createNoResultOp(spv::OpTerminateRayNVX);
builder.createNoResultOp(spv::OpTerminateRayNV);
return 0;
#endif
default: