|
|
@@ -14,46 +14,46 @@
|
|
|
|
|
|
ANKI_BEGIN_NAMESPACE
|
|
|
|
|
|
-/// Some far distance that will make objects not visible. Don't use kMaxF32 because this value will be used in math ops and it might overflow.
|
|
|
+// Some far distance that will make objects not visible. Don't use kMaxF32 because this value will be used in math ops and it might overflow
|
|
|
constexpr F32 kSomeFarDistance = 100000.0f;
|
|
|
|
|
|
-/// @note All offsets in bytes
|
|
|
+// Note: All offsets in bytes
|
|
|
struct GpuSceneRenderable
|
|
|
{
|
|
|
- U32 m_worldTransformsIndex; ///< First index points to the crnt transform and the 2nd to the previous.
|
|
|
+ U32 m_worldTransformsIndex; // First index points to the crnt transform and the 2nd to the previous.
|
|
|
U32 m_constantsOffset;
|
|
|
- U32 m_meshLodsIndex; ///< Points to the array of GpuSceneMeshLod. kMaxLodCount are reserved for each renderable.
|
|
|
- U32 m_boneTransformsOffset; ///< Array of Mat3x4 or 0 if its not a skin.
|
|
|
- U32 m_particleEmitterIndex; ///< Index to the GpuSceneParticleEmitter array or kMaxU32 if it's not an emitter.
|
|
|
- U32 m_rtShadowsShaderHandleIndex; ///< The index of the shader handle in the array of library's handles.
|
|
|
- U32 m_rtMaterialFetchShaderHandleIndex; ///< The index of the shader handle in the array of library's handles.
|
|
|
+ U32 m_meshLodsIndex; // Points to the array of GpuSceneMeshLod. kMaxLodCount are reserved for each renderable.
|
|
|
+ U32 m_boneTransformsOffset; // Array of Mat3x4 or 0 if its not a skin.
|
|
|
+ U32 m_particleEmitterIndex; // Index to the GpuSceneParticleEmitter array or kMaxU32 if it's not an emitter.
|
|
|
+ U32 m_rtShadowsShaderHandleIndex; // The index of the shader handle in the array of library's handles.
|
|
|
+ U32 m_rtMaterialFetchShaderHandleIndex; // The index of the shader handle in the array of library's handles.
|
|
|
U32 m_uuid;
|
|
|
|
|
|
- U32 m_diffuseColor : 24; ///< The average diffuse color of the renderable. Z is in low bits.
|
|
|
+ U32 m_diffuseColor : 24; // The average diffuse color of the renderable. Blue is in low bits.
|
|
|
U32 m_padding : 8;
|
|
|
};
|
|
|
|
|
|
-/// Almost similar to GpuSceneRenderable but with only what the material shaders need. Needs to fit in a UVec4 vertex attribute.
|
|
|
+// Almost similar to GpuSceneRenderable but with only what the material shaders need. Needs to fit in a UVec4 vertex attribute.
|
|
|
struct GpuSceneRenderableInstance
|
|
|
{
|
|
|
U32 m_worldTransformsIndex;
|
|
|
U32 m_constantsOffset;
|
|
|
- U32 m_meshLodIndex; ///< Points to a single GpuSceneMeshLod in the mesh lods.
|
|
|
+ U32 m_meshLodIndex; // Points to a single GpuSceneMeshLod in the mesh lods.
|
|
|
U32 m_boneTransformsOffsetOrParticleEmitterIndex;
|
|
|
};
|
|
|
static_assert(sizeof(GpuSceneRenderableInstance) == sizeof(UVec4));
|
|
|
|
|
|
-/// Minimal data passed to the vertex shaders in the case of meshlet rendering.
|
|
|
+// Minimal data passed to the vertex shaders in the case of meshlet rendering.
|
|
|
struct GpuSceneMeshletInstance
|
|
|
{
|
|
|
U32 m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit;
|
|
|
U32 m_constantsOffset;
|
|
|
- U32 m_meshletGeometryDescriptorIndex; ///< Index in the UGB.
|
|
|
+ U32 m_meshletGeometryDescriptorIndex; // Index in the UGB.
|
|
|
U32 m_boneTransformsOffsetOrParticleEmitterIndex;
|
|
|
};
|
|
|
static_assert(kMaxPrimitivesPerMeshlet < ((1u << 7u) - 1));
|
|
|
|
|
|
-/// Used in visibility testing.
|
|
|
+// Used in visibility testing.
|
|
|
struct GpuSceneRenderableBoundingVolume
|
|
|
{
|
|
|
Vec3 m_aabbMin ANKI_CPP_CODE(= Vec3(kSomeFarDistance));
|
|
|
@@ -64,24 +64,24 @@ struct GpuSceneRenderableBoundingVolume
|
|
|
};
|
|
|
static_assert(sizeof(GpuSceneRenderableBoundingVolume) == sizeof(Vec4) * 2);
|
|
|
|
|
|
-/// Represents the geometry data of a single LOD of an indexed mesh.
|
|
|
+// Represents the geometry data of a single LOD of an indexed mesh.
|
|
|
struct GpuSceneMeshLod
|
|
|
{
|
|
|
U32 m_vertexOffsets[(U32)VertexStreamId::kMeshRelatedCount];
|
|
|
U32 m_indexCount;
|
|
|
- U32 m_firstIndex; ///< In sizeof(indexType)
|
|
|
+ U32 m_firstIndex; // In sizeof(indexType)
|
|
|
U32 m_lod;
|
|
|
|
|
|
- U32 m_firstMeshletBoundingVolume; ///< In sizeof(MeshletBoundingVolume)
|
|
|
- U32 m_firstMeshletGeometryDescriptor; ///< In sizeof(MeshletGeometryDescriptor)
|
|
|
- U32 m_meshletCount; ///< Can be zero if the mesh doesn't support mesh shading (or mesh shading is off)
|
|
|
+ U32 m_firstMeshletBoundingVolume; // In sizeof(MeshletBoundingVolume)
|
|
|
+ U32 m_firstMeshletGeometryDescriptor; // In sizeof(MeshletGeometryDescriptor)
|
|
|
+ U32 m_meshletCount; // Can be zero if the mesh doesn't support mesh shading (or mesh shading is off)
|
|
|
U32 m_padding1;
|
|
|
|
|
|
Vec3 m_positionTranslation;
|
|
|
F32 m_positionScale;
|
|
|
|
|
|
UVec2 m_blasAddress;
|
|
|
- U32 m_tlasInstanceMask; ///< Mask that goes to AccelerationStructureInstance::m_mask
|
|
|
+ U32 m_tlasInstanceMask; // Mask that goes to AccelerationStructureInstance::m_mask
|
|
|
U32 m_padding3;
|
|
|
};
|
|
|
static_assert(sizeof(GpuSceneMeshLod) == sizeof(Vec4) * 5);
|
|
|
@@ -93,7 +93,7 @@ struct GpuSceneParticleEmitter
|
|
|
};
|
|
|
static_assert(sizeof(GpuSceneParticleEmitter) == sizeof(Vec4) * 2);
|
|
|
|
|
|
-/// Contains common properties for all particle emitters.
|
|
|
+// Contains common properties for all particle emitters
|
|
|
struct GpuSceneParticleEmitter2
|
|
|
{
|
|
|
U32 m_particleStateSteamOffsets[(U32)ParticleProperty::kCount]; // Points to arrays of data
|
|
|
@@ -111,9 +111,6 @@ struct GpuSceneParticleEmitter2
|
|
|
|
|
|
Vec3 m_particleAabbMax;
|
|
|
U32 m_worldTransformsIndex;
|
|
|
-
|
|
|
- U32 m_boundingVolumeOffset; // Points to its GpuSceneRenderableBoundingVolume. It's an offset because there are many arrays with bvolumes.
|
|
|
- U32 m_padding[3];
|
|
|
};
|
|
|
static_assert(sizeof(GpuSceneParticleEmitter2) % sizeof(Vec4) == 0);
|
|
|
|
|
|
@@ -126,68 +123,69 @@ enum class GpuSceneLightFlag : U32
|
|
|
};
|
|
|
ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(GpuSceneLightFlag)
|
|
|
|
|
|
-/// A hash of all visible renderables. If it matches between vis tests then skip the drawcalls. Touched only by the GPU.
|
|
|
+// A hash of all visible renderables. If it matches between vis tests then skip the drawcalls. Touched only by the GPU.
|
|
|
struct GpuSceneLightVisibleRenderablesHash
|
|
|
{
|
|
|
U32 m_hash;
|
|
|
};
|
|
|
|
|
|
-/// Point or spot light.
|
|
|
+// Point or spot light.
|
|
|
struct GpuSceneLight
|
|
|
{
|
|
|
- Vec3 m_position ANKI_CPP_CODE(= Vec3(kSomeFarDistance)); ///< Position in world space.
|
|
|
- F32 m_radius ANKI_CPP_CODE(= 0.0f); ///< Radius.
|
|
|
+ Vec3 m_position ANKI_CPP_CODE(= Vec3(kSomeFarDistance)); // Position in world space.
|
|
|
+ F32 m_radius ANKI_CPP_CODE(= 0.0f); // Radius.
|
|
|
|
|
|
Vec3 m_diffuseColor;
|
|
|
- U32 m_visibleRenderablesHashIndex; ///< Points to a GpuSceneLightVisibleRenderablesHash
|
|
|
+ U32 m_visibleRenderablesHashIndex; // Points to a GpuSceneLightVisibleRenderablesHash
|
|
|
|
|
|
GpuSceneLightFlag m_flags;
|
|
|
- U32 m_componentArrayIndex; ///< Array index of the LightComponent in the CPU scene.
|
|
|
- U32 m_uuid; ///< The UUID of that light. If it's zero the GPU will not inform the CPU about it.
|
|
|
- F32 m_innerCos; ///< Only for spot light.
|
|
|
+ U32 m_componentArrayIndex; // Array index of the LightComponent in the CPU scene.
|
|
|
+ U32 m_uuid; // The UUID of that light. If it's zero the GPU will not inform the CPU about it.
|
|
|
+ F32 m_innerCos; // Only for spot light.
|
|
|
|
|
|
- Vec3 m_direction; ///< Only for spot light. Light direction.
|
|
|
- F32 m_outerCos; ///< Only for spot light.
|
|
|
+ Vec3 m_direction; // Only for spot light. Light direction.
|
|
|
+ F32 m_outerCos; // Only for spot light.
|
|
|
|
|
|
- Vec4 m_edgePoints[4u]; ///< Edge points in world space. Only for spot light.
|
|
|
+ Vec4 m_edgePoints[4u]; // Edge points in world space. Only for spot light.
|
|
|
|
|
|
- /// If it's a spot light the 4 first rows are the texture matrix. If it's point light it's the UV viewports in the shadow atlas.
|
|
|
+ // If it's a spot light the 4 first rows are the texture matrix. If it's point light it's the UV viewports in the
|
|
|
+ // shadow atlas.
|
|
|
Vec4 m_spotLightMatrixOrPointLightUvViewports[6u];
|
|
|
};
|
|
|
|
|
|
-/// Representation of a reflection probe.
|
|
|
+// Representation of a reflection probe.
|
|
|
struct GpuSceneReflectionProbe
|
|
|
{
|
|
|
- Vec3 m_position; ///< Position of the probe in world space.
|
|
|
- U32 m_cubeTexture; ///< Bindless index of the reflection texture.
|
|
|
+ Vec3 m_position; // Position of the probe in world space.
|
|
|
+ U32 m_cubeTexture; // Bindless index of the reflection texture.
|
|
|
|
|
|
Vec3 m_aabbMin ANKI_CPP_CODE(= Vec3(kSomeFarDistance));
|
|
|
- U32 m_uuid; ///< The UUID of that probe. If it's zero the GPU will not inform the CPU about it.
|
|
|
+ U32 m_uuid; // The UUID of that probe. If it's zero the GPU will not inform the CPU about it.
|
|
|
|
|
|
Vec3 m_aabbMax ANKI_CPP_CODE(= Vec3(kSomeFarDistance));
|
|
|
- U32 m_componentArrayIndex; ///< Array in the CPU scene.
|
|
|
+ U32 m_componentArrayIndex; // Array in the CPU scene.
|
|
|
};
|
|
|
constexpr U32 kSizeof_GpuSceneReflectionProbe = 3u * sizeof(Vec4);
|
|
|
static_assert(sizeof(GpuSceneReflectionProbe) == kSizeof_GpuSceneReflectionProbe);
|
|
|
|
|
|
-/// Global illumination probe
|
|
|
+// Global illumination probe
|
|
|
struct GpuSceneGlobalIlluminationProbe
|
|
|
{
|
|
|
Vec3 m_aabbMin ANKI_CPP_CODE(= Vec3(kSomeFarDistance));
|
|
|
- U32 m_uuid; ///< The UUID of that probe. If it's zero the GPU will not inform the CPU about it.
|
|
|
+ U32 m_uuid; // The UUID of that probe. If it's zero the GPU will not inform the CPU about it.
|
|
|
|
|
|
Vec3 m_aabbMax ANKI_CPP_CODE(= Vec3(kSomeFarDistance));
|
|
|
- U32 m_componentArrayIndex; ///< Array in the CPU scene.
|
|
|
+ U32 m_componentArrayIndex; // Array in the CPU scene.
|
|
|
|
|
|
- U32 m_volumeTexture; ///< Bindless index of the irradiance volume texture.
|
|
|
- F32 m_halfTexelSizeU; ///< (1.0 / textureSize(texArr[textureIndex]).x) / 2.0
|
|
|
- F32 m_fadeDistance; ///< Used to calculate a factor that is zero when fragPos is close to AABB bounds and 1.0 at fadeDistance and less.
|
|
|
+ U32 m_volumeTexture; // Bindless index of the irradiance volume texture.
|
|
|
+ F32 m_halfTexelSizeU; // (1.0 / textureSize(texArr[textureIndex]).x) / 2.0
|
|
|
+ F32 m_fadeDistance; // Used to calculate a factor that is zero when fragPos is close to AABB bounds and 1.0 at fadeDistance and less
|
|
|
F32 m_padding2;
|
|
|
};
|
|
|
constexpr U32 kSizeof_GpuSceneGlobalIlluminationProbe = 3u * sizeof(Vec4);
|
|
|
static_assert(sizeof(GpuSceneGlobalIlluminationProbe) == kSizeof_GpuSceneGlobalIlluminationProbe);
|
|
|
|
|
|
-/// Decal.
|
|
|
+// Decal
|
|
|
struct GpuSceneDecal
|
|
|
{
|
|
|
U32 m_diffuseTexture;
|
|
|
@@ -203,7 +201,7 @@ struct GpuSceneDecal
|
|
|
constexpr U32 kSizeof_GpuSceneDecal = 2u * sizeof(Vec4) + 1u * sizeof(Mat4);
|
|
|
static_assert(sizeof(GpuSceneDecal) == kSizeof_GpuSceneDecal);
|
|
|
|
|
|
-/// Fog density volume.
|
|
|
+// Fog density volume
|
|
|
struct GpuSceneFogDensityVolume
|
|
|
{
|
|
|
Vec3 m_aabbMinOrSphereCenter ANKI_CPP_CODE(= Vec3(kSomeFarDistance));
|
|
|
@@ -247,7 +245,7 @@ enum class GpuSceneNonRenderableObjectTypeBit : U32
|
|
|
};
|
|
|
ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(GpuSceneNonRenderableObjectTypeBit)
|
|
|
|
|
|
-/// Non-renderable types that require GPU to CPU feedback.
|
|
|
+// Non-renderable types that require GPU to CPU feedback
|
|
|
enum class GpuSceneNonRenderableObjectTypeWithFeedback : U32
|
|
|
{
|
|
|
kLight,
|