Skip to content
Open
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
8 changes: 8 additions & 0 deletions docs/DXIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2426,6 +2426,14 @@ ID Name Description
309 VectorReduceAnd Bitwise AND reduction of the vector returning a scalar
310 VectorReduceOr Bitwise OR reduction of the vector returning a scalar
311 FDot computes the n-dimensional vector dot-product
312 ClusterID Returns the user-defined ClusterID of the intersected CLAS
313 RayQuery_CandidateClusterID returns candidate hit cluster ID
314 RayQuery_CommittedClusterID returns committed hit cluster ID
315 HitObject_ClusterID Returns the cluster ID of this committed hit
316 TriangleObjectPosition Returns triangle vertices in object space as <9 x float>
317 RayQuery_CandidateTriangleObjectPosition Returns candidate triangle vertices in object space as <9 x float>
318 RayQuery_CommittedTriangleObjectPosition Returns committed triangle vertices in object space as <9 x float>
319 HitObject_TriangleObjectPosition Returns triangle vertices in object space as <9 x float>
=== ===================================================== =======================================================================================================================================================================================================================


Expand Down
27 changes: 24 additions & 3 deletions include/dxc/DXIL/DxilConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ enum class OpCode : unsigned {
AllocateRayQuery = 178, // allocates space for RayQuery and return handle
AllocateRayQuery2 = 258, // allocates space for RayQuery and return handle
RayQuery_Abort = 181, // aborts a ray query
RayQuery_CandidateClusterID = 313, // returns candidate hit cluster ID
RayQuery_CandidateGeometryIndex = 203, // returns candidate hit geometry index
RayQuery_CandidateInstanceContributionToHitGroupIndex =
214, // returns candidate hit InstanceContributionToHitGroupIndex
Expand All @@ -696,6 +697,8 @@ enum class OpCode : unsigned {
193, // returns candidate triangle hit barycentrics
RayQuery_CandidateTriangleFrontFace =
191, // returns if current candidate triangle is front facing
RayQuery_CandidateTriangleObjectPosition =
317, // Returns candidate triangle vertices in object space as <9 x float>
RayQuery_CandidateTriangleRayT =
199, // returns float representing the parametric point on the ray for the
// current candidate triangle hit.
Expand All @@ -709,6 +712,7 @@ enum class OpCode : unsigned {
182, // commits a non opaque triangle hit
RayQuery_CommitProceduralPrimitiveHit =
183, // commits a procedural primitive hit
RayQuery_CommittedClusterID = 314, // returns committed hit cluster ID
RayQuery_CommittedGeometryIndex = 209, // returns committed hit geometry index
RayQuery_CommittedInstanceContributionToHitGroupIndex =
215, // returns committed hit InstanceContributionToHitGroupIndex
Expand All @@ -732,6 +736,8 @@ enum class OpCode : unsigned {
194, // returns committed triangle hit barycentrics
RayQuery_CommittedTriangleFrontFace =
192, // returns if current committed triangle is front facing
RayQuery_CommittedTriangleObjectPosition =
318, // Returns committed triangle vertices in object space as <9 x float>
RayQuery_CommittedWorldToObject3x4 =
189, // returns matrix for transforming from world-space to object-space
// for a Committed hit.
Expand Down Expand Up @@ -832,6 +838,10 @@ enum class OpCode : unsigned {
RayTMin =
153, // float representing the parametric starting point for the ray.

// Raytracing System Values
TriangleObjectPosition =
316, // Returns triangle vertices in object space as <9 x float>

// Raytracing hit uint System Values
HitKind = 143, // Returns the value passed as HitKind in ReportIntersection().
// If intersection was reported by fixed-function triangle
Expand All @@ -851,7 +861,8 @@ enum class OpCode : unsigned {
PrimitiveIndex = 161, // PrimitiveIndex for raytracing shaders

// Raytracing uint System Values
RayFlags = 144, // uint containing the current ray flags.
ClusterID = 312, // Returns the user-defined ClusterID of the intersected CLAS
RayFlags = 144, // uint containing the current ray flags.

// Resources - gather
TextureGather = 73, // gathers the four texels that would be used in a
Expand Down Expand Up @@ -914,6 +925,7 @@ enum class OpCode : unsigned {

// Shader Execution Reordering
HitObject_Attributes = 289, // Returns the attributes set for this HitObject
HitObject_ClusterID = 315, // Returns the cluster ID of this committed hit
HitObject_FromRayQuery = 263, // Creates a new HitObject representing a
// committed hit from a RayQuery
HitObject_FromRayQueryWithAttrs =
Expand Down Expand Up @@ -949,6 +961,8 @@ enum class OpCode : unsigned {
286, // Returns the shader table index set for this HitObject
HitObject_TraceRay = 262, // Analogous to TraceRay but without invoking CH/MS
// and returns the intermediate state as a HitObject
HitObject_TriangleObjectPosition =
319, // Returns triangle vertices in object space as <9 x float>
HitObject_WorldRayDirection = 276, // Returns the ray direction in world space
HitObject_WorldRayOrigin = 275, // Returns the ray origin in world space
HitObject_WorldToObject3x4 = 280, // Returns the world to object space
Expand Down Expand Up @@ -1089,7 +1103,7 @@ enum class OpCode : unsigned {
NumOpCodes_Dxil_1_8 = 258,
NumOpCodes_Dxil_1_9 = 312,

NumOpCodes = 312 // exclusive last value of enumeration
NumOpCodes = 320 // exclusive last value of enumeration
};
// OPCODE-ENUM:END

Expand Down Expand Up @@ -1213,8 +1227,10 @@ enum class OpCodeClass : unsigned {
AllocateRayQuery,
AllocateRayQuery2,
RayQuery_Abort,
RayQuery_CandidateTriangleObjectPosition,
RayQuery_CommitNonOpaqueTriangleHit,
RayQuery_CommitProceduralPrimitiveHit,
RayQuery_CommittedTriangleObjectPosition,
RayQuery_Proceed,
RayQuery_StateMatrix,
RayQuery_StateScalar,
Expand Down Expand Up @@ -1288,6 +1304,9 @@ enum class OpCodeClass : unsigned {
RayTCurrent,
RayTMin,

// Raytracing System Values
TriangleObjectPosition,

// Raytracing hit uint System Values
HitKind,

Expand All @@ -1300,6 +1319,7 @@ enum class OpCodeClass : unsigned {
PrimitiveIndex,

// Raytracing uint System Values
ClusterID,
RayFlags,

// Resources - gather
Expand Down Expand Up @@ -1355,6 +1375,7 @@ enum class OpCodeClass : unsigned {
HitObject_StateScalar,
HitObject_StateVector,
HitObject_TraceRay,
HitObject_TriangleObjectPosition,
MaybeReorderThread,

// Synchronization
Expand Down Expand Up @@ -1425,7 +1446,7 @@ enum class OpCodeClass : unsigned {
NumOpClasses_Dxil_1_8 = 174,
NumOpClasses_Dxil_1_9 = 196,

NumOpClasses = 196 // exclusive last value of enumeration
NumOpClasses = 201 // exclusive last value of enumeration
};
// OPCODECLASS-ENUM:END

Expand Down
208 changes: 208 additions & 0 deletions include/dxc/DXIL/DxilInstructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -10231,5 +10231,213 @@ struct DxilInst_FDot {
llvm::Value *get_b() const { return Instr->getOperand(2); }
void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
};

/// This instruction Returns the user-defined ClusterID of the intersected CLAS
struct DxilInst_ClusterID {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_ClusterID(llvm::Instruction *pInstr) : Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::ClusterID);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
};

/// This instruction returns candidate hit cluster ID
struct DxilInst_RayQuery_CandidateClusterID {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_RayQuery_CandidateClusterID(llvm::Instruction *pInstr)
: Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(
Instr, hlsl::OP::OpCode::RayQuery_CandidateClusterID);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_rayQueryHandle = 1,
};
// Accessors
llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
};

/// This instruction returns committed hit cluster ID
struct DxilInst_RayQuery_CommittedClusterID {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_RayQuery_CommittedClusterID(llvm::Instruction *pInstr)
: Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(
Instr, hlsl::OP::OpCode::RayQuery_CommittedClusterID);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_rayQueryHandle = 1,
};
// Accessors
llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
};

/// This instruction Returns the cluster ID of this committed hit
struct DxilInst_HitObject_ClusterID {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_HitObject_ClusterID(llvm::Instruction *pInstr) : Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(
Instr, hlsl::OP::OpCode::HitObject_ClusterID);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_hitObject = 1,
};
// Accessors
llvm::Value *get_hitObject() const { return Instr->getOperand(1); }
void set_hitObject(llvm::Value *val) { Instr->setOperand(1, val); }
};

/// This instruction Returns triangle vertices in object space as <9 x float>
struct DxilInst_TriangleObjectPosition {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_TriangleObjectPosition(llvm::Instruction *pInstr) : Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(
Instr, hlsl::OP::OpCode::TriangleObjectPosition);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
};

/// This instruction Returns candidate triangle vertices in object space as <9 x
/// float>
struct DxilInst_RayQuery_CandidateTriangleObjectPosition {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_RayQuery_CandidateTriangleObjectPosition(llvm::Instruction *pInstr)
: Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(
Instr, hlsl::OP::OpCode::RayQuery_CandidateTriangleObjectPosition);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_rayQueryHandle = 1,
};
// Accessors
llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
};

/// This instruction Returns committed triangle vertices in object space as <9 x
/// float>
struct DxilInst_RayQuery_CommittedTriangleObjectPosition {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_RayQuery_CommittedTriangleObjectPosition(llvm::Instruction *pInstr)
: Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(
Instr, hlsl::OP::OpCode::RayQuery_CommittedTriangleObjectPosition);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_rayQueryHandle = 1,
};
// Accessors
llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
};

/// This instruction Returns triangle vertices in object space as <9 x float>
struct DxilInst_HitObject_TriangleObjectPosition {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_HitObject_TriangleObjectPosition(llvm::Instruction *pInstr)
: Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(
Instr, hlsl::OP::OpCode::HitObject_TriangleObjectPosition);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_hitObject = 1,
};
// Accessors
llvm::Value *get_hitObject() const { return Instr->getOperand(1); }
void set_hitObject(llvm::Value *val) { Instr->setOperand(1, val); }
};
// INSTR-HELPER:END
} // namespace hlsl
Loading