Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MeshShadingNV dependencies (and land Ray tracing updates) #4028

Merged
merged 2 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ vars = {
'effcee_revision': '2ec8f8738118cc483b67c04a759fee53496c5659',
'googletest_revision': '3af06fe1664d30f98de1e78c53a7087e842a2547',
're2_revision': 'ca11026a032ce2a3de4b3c389ee53d2bdc8794d6',
'spirv_headers_revision': '05836bdba63e7debce9fa9feaed42f20cd43af9d',
'spirv_headers_revision': '4de110ce1c78fda37932c735ef7f747e6f6cbee8',
}

deps = {
Expand Down
2 changes: 1 addition & 1 deletion source/opcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ int32_t spvOpcodeGeneratesType(SpvOp op) {
case SpvOpTypeCooperativeMatrixNV:
// case SpvOpTypeAccelerationStructureKHR: covered by
// SpvOpTypeAccelerationStructureNV
case SpvOpTypeRayQueryProvisionalKHR:
case SpvOpTypeRayQueryKHR:
return true;
default:
// In particular, OpTypeForwardPointer does not generate a type,
Expand Down
2 changes: 1 addition & 1 deletion source/opt/ir_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ void IRContext::AddCombinatorsForCapability(uint32_t capability) {
SpvOpTypeSampledImage,
SpvOpTypeAccelerationStructureNV,
SpvOpTypeAccelerationStructureKHR,
SpvOpTypeRayQueryProvisionalKHR,
SpvOpTypeRayQueryKHR,
SpvOpTypeArray,
SpvOpTypeRuntimeArray,
SpvOpTypeStruct,
Expand Down
2 changes: 1 addition & 1 deletion source/opt/reflect.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ inline bool IsTypeInst(SpvOp opcode) {
opcode == SpvOpTypePipeStorage || opcode == SpvOpTypeNamedBarrier ||
opcode == SpvOpTypeAccelerationStructureNV ||
opcode == SpvOpTypeAccelerationStructureKHR ||
opcode == SpvOpTypeRayQueryProvisionalKHR ||
opcode == SpvOpTypeRayQueryKHR ||
opcode == SpvOpTypeCooperativeMatrixNV;
}
inline bool IsConstantInst(SpvOp opcode) {
Expand Down
4 changes: 2 additions & 2 deletions source/opt/type_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,8 @@ Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) {
inst.GetSingleWordInOperand(2),
inst.GetSingleWordInOperand(3));
break;
case SpvOpTypeRayQueryProvisionalKHR:
type = new RayQueryProvisionalKHR();
case SpvOpTypeRayQueryKHR:
type = new RayQueryKHR();
break;
default:
SPIRV_UNIMPLEMENTED(consumer_, "unhandled type");
Expand Down
6 changes: 3 additions & 3 deletions source/opt/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ std::unique_ptr<Type> Type::Clone() const {
DeclareKindCase(NamedBarrier);
DeclareKindCase(AccelerationStructureNV);
DeclareKindCase(CooperativeMatrixNV);
DeclareKindCase(RayQueryProvisionalKHR);
DeclareKindCase(RayQueryKHR);
#undef DeclareKindCase
default:
assert(false && "Unhandled type");
Expand Down Expand Up @@ -174,7 +174,7 @@ bool Type::operator==(const Type& other) const {
DeclareKindCase(NamedBarrier);
DeclareKindCase(AccelerationStructureNV);
DeclareKindCase(CooperativeMatrixNV);
DeclareKindCase(RayQueryProvisionalKHR);
DeclareKindCase(RayQueryKHR);
#undef DeclareKindCase
default:
assert(false && "Unhandled type");
Expand Down Expand Up @@ -225,7 +225,7 @@ void Type::GetHashWords(std::vector<uint32_t>* words,
DeclareKindCase(NamedBarrier);
DeclareKindCase(AccelerationStructureNV);
DeclareKindCase(CooperativeMatrixNV);
DeclareKindCase(RayQueryProvisionalKHR);
DeclareKindCase(RayQueryKHR);
#undef DeclareKindCase
default:
assert(false && "Unhandled type");
Expand Down
8 changes: 4 additions & 4 deletions source/opt/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class PipeStorage;
class NamedBarrier;
class AccelerationStructureNV;
class CooperativeMatrixNV;
class RayQueryProvisionalKHR;
class RayQueryKHR;

// Abstract class for a SPIR-V type. It has a bunch of As<sublcass>() methods,
// which is used as a way to probe the actual <subclass>.
Expand Down Expand Up @@ -96,7 +96,7 @@ class Type {
kNamedBarrier,
kAccelerationStructureNV,
kCooperativeMatrixNV,
kRayQueryProvisionalKHR
kRayQueryKHR
};

Type(Kind k) : kind_(k) {}
Expand Down Expand Up @@ -201,7 +201,7 @@ class Type {
DeclareCastMethod(NamedBarrier)
DeclareCastMethod(AccelerationStructureNV)
DeclareCastMethod(CooperativeMatrixNV)
DeclareCastMethod(RayQueryProvisionalKHR)
DeclareCastMethod(RayQueryKHR)
#undef DeclareCastMethod

protected:
Expand Down Expand Up @@ -662,7 +662,7 @@ DefineParameterlessType(Queue, queue);
DefineParameterlessType(PipeStorage, pipe_storage);
DefineParameterlessType(NamedBarrier, named_barrier);
DefineParameterlessType(AccelerationStructureNV, accelerationStructureNV);
DefineParameterlessType(RayQueryProvisionalKHR, rayQueryProvisionalKHR);
DefineParameterlessType(RayQueryKHR, rayQueryKHR);
#undef DefineParameterlessType

} // namespace analysis
Expand Down
7 changes: 3 additions & 4 deletions source/val/validate_builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2375,10 +2375,9 @@ spv_result_t BuiltInsValidator::ValidateVertexIndexAtDefinition(
spv_result_t BuiltInsValidator::ValidateVertexIdOrInstanceIdAtDefinition(
const Decoration& decoration, const Instruction& inst) {
const SpvBuiltIn label = SpvBuiltIn(decoration.params()[0]);
bool allow_instance_id =
(_.HasCapability(SpvCapabilityRayTracingNV) ||
_.HasCapability(SpvCapabilityRayTracingProvisionalKHR)) &&
label == SpvBuiltInInstanceId;
bool allow_instance_id = (_.HasCapability(SpvCapabilityRayTracingNV) ||
_.HasCapability(SpvCapabilityRayTracingKHR)) &&
label == SpvBuiltInInstanceId;

if (spvIsVulkanEnv(_.context()->target_env) && !allow_instance_id) {
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
Expand Down
13 changes: 13 additions & 0 deletions source/val/validate_cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,8 @@ spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst) {
case SpvOpReturnValue:
case SpvOpUnreachable:
case SpvOpTerminateInvocation:
case SpvOpIgnoreIntersectionKHR:
case SpvOpTerminateRayKHR:
_.current_function().RegisterBlockEnd(std::vector<uint32_t>());
if (opcode == SpvOpKill) {
_.current_function().RegisterExecutionModelLimitation(
Expand All @@ -1121,6 +1123,17 @@ spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst) {
SpvExecutionModelFragment,
"OpTerminateInvocation requires Fragment execution model");
}
if (opcode == SpvOpIgnoreIntersectionKHR) {
_.current_function().RegisterExecutionModelLimitation(
SpvExecutionModelAnyHitKHR,
"OpIgnoreIntersectionKHR requires AnyHit execution model");
}
if (opcode == SpvOpTerminateRayKHR) {
_.current_function().RegisterExecutionModelLimitation(
SpvExecutionModelAnyHitKHR,
"OpTerminateRayKHR requires AnyHit execution model");
}

break;
default:
break;
Expand Down
5 changes: 2 additions & 3 deletions source/val/validate_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) {
_, pointee,
{SpvOpTypeImage, SpvOpTypeSampler, SpvOpTypeSampledImage,
SpvOpTypeAccelerationStructureNV,
SpvOpTypeAccelerationStructureKHR,
SpvOpTypeRayQueryProvisionalKHR})) {
SpvOpTypeAccelerationStructureKHR, SpvOpTypeRayQueryKHR})) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "UniformConstant OpVariable <id> '" << _.getIdName(inst->id())
<< "' has illegal type.\n"
Expand All @@ -547,7 +546,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) {
<< "variables must be typed as OpTypeImage, OpTypeSampler, "
<< "OpTypeSampledImage, OpTypeAccelerationStructureNV, "
"OpTypeAccelerationStructureKHR, "
"OpTypeRayQueryProvisionalKHR, "
"OpTypeRayQueryKHR, "
<< "or an array of one of these types.";
}
}
Expand Down
17 changes: 9 additions & 8 deletions test/operand_capabilities_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,11 @@ INSTANTIATE_TEST_SUITE_P(
CASE1(BUILT_IN, BuiltInCullDistance, CullDistance), // Bug 1407, 15234
CASE1(BUILT_IN, BuiltInVertexId, Shader),
CASE1(BUILT_IN, BuiltInInstanceId, Shader),
CASE4(BUILT_IN, BuiltInPrimitiveId, Geometry, Tessellation,
RayTracingNV, RayTracingProvisionalKHR),
CASE5(BUILT_IN, BuiltInPrimitiveId, Geometry, Tessellation,
RayTracingNV, RayTracingKHR, MeshShadingNV),
CASE2(BUILT_IN, BuiltInInvocationId, Geometry, Tessellation),
CASE2(BUILT_IN, BuiltInLayer, Geometry, ShaderViewportIndexLayerEXT),
CASE2(BUILT_IN, BuiltInViewportIndex, MultiViewport, ShaderViewportIndexLayerEXT), // Bug 15234
CASE3(BUILT_IN, BuiltInLayer, Geometry, ShaderViewportIndexLayerEXT, MeshShadingNV),
CASE3(BUILT_IN, BuiltInViewportIndex, MultiViewport, ShaderViewportIndexLayerEXT, MeshShadingNV), // Bug 15234
CASE1(BUILT_IN, BuiltInTessLevelOuter, Tessellation),
CASE1(BUILT_IN, BuiltInTessLevelInner, Tessellation),
CASE1(BUILT_IN, BuiltInTessCoord, Tessellation),
Expand Down Expand Up @@ -545,10 +545,11 @@ INSTANTIATE_TEST_SUITE_P(
Values(SPV_ENV_UNIVERSAL_1_5),
ValuesIn(std::vector<EnumCapabilityCase>{
// SPIR-V 1.5 adds new capabilities to enable these two builtins.
CASE3(BUILT_IN, BuiltInLayer, Geometry, ShaderLayer,
ShaderViewportIndexLayerEXT),
CASE3(BUILT_IN, BuiltInViewportIndex, MultiViewport,
ShaderViewportIndex, ShaderViewportIndexLayerEXT),
CASE4(BUILT_IN, BuiltInLayer, Geometry, ShaderLayer,
ShaderViewportIndexLayerEXT, MeshShadingNV),
CASE4(BUILT_IN, BuiltInViewportIndex, MultiViewport,
ShaderViewportIndex, ShaderViewportIndexLayerEXT,
MeshShadingNV),
})));

// See SPIR-V Section 3.22 Selection Control
Expand Down
4 changes: 2 additions & 2 deletions test/val/val_barriers_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,7 @@ TEST_F(ValidateBarriers, OpMemoryBarrierShaderCallRayGenSuccess) {
// capabilities_and_extensions
R"(
OpCapability VulkanMemoryModelKHR
OpCapability RayTracingProvisionalKHR
OpCapability RayTracingKHR
OpExtension "SPV_KHR_vulkan_memory_model"
OpExtension "SPV_KHR_ray_tracing"
)",
Expand Down Expand Up @@ -1642,7 +1642,7 @@ TEST_F(ValidateBarriers, OpControlBarrierShaderCallRayGenFailure) {
// capabilities_and_extensions
R"(
OpCapability VulkanMemoryModelKHR
OpCapability RayTracingProvisionalKHR
OpCapability RayTracingKHR
OpExtension "SPV_KHR_vulkan_memory_model"
OpExtension "SPV_KHR_ray_tracing"
)",
Expand Down
4 changes: 2 additions & 2 deletions test/val/val_memory_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ OpFunctionEnd
"are used only as handles to refer to opaque resources. Such "
"variables must be typed as OpTypeImage, OpTypeSampler, "
"OpTypeSampledImage, OpTypeAccelerationStructureNV, "
"OpTypeAccelerationStructureKHR, OpTypeRayQueryProvisionalKHR, "
"OpTypeAccelerationStructureKHR, OpTypeRayQueryKHR, "
"or an array of one of these types."));
}

Expand Down Expand Up @@ -112,7 +112,7 @@ OpFunctionEnd
"are used only as handles to refer to opaque resources. Such "
"variables must be typed as OpTypeImage, OpTypeSampler, "
"OpTypeSampledImage, OpTypeAccelerationStructureNV, "
"OpTypeAccelerationStructureKHR, OpTypeRayQueryProvisionalKHR, "
"OpTypeAccelerationStructureKHR, OpTypeRayQueryKHR, "
"or an array of one of these types."));
}

Expand Down
Loading