Files
UShaderLab/Shaders/Private/UEFunctions/_EngineStubs.ush
2026-07-02 15:14:13 +08:00

75 lines
3.9 KiB
Plaintext

// Copyright UShaderLab. All Rights Reserved.
//
// Editor-only (SHADERLAB_IDE) stubs for the engine material HLSL symbols that the generated transform
// libraries (Transform.ush / TransformPosition.ush) call. shader-validator can't see the engine's
// material environment, so without these the generated forwarders show "undeclared" errors. The real
// shader compiler never defines SHADERLAB_IDE, so it uses the true engine symbols instead.
// Include guard (not #pragma once): this file is included by several sibling UEFunctions/*.ush, and
// a plain #pragma once is not always deduped across that diamond by the IDE parser.
#ifndef SHADERLAB_ENGINE_STUBS_USH
#define SHADERLAB_ENGINE_STUBS_USH
#ifdef SHADERLAB_IDE
// --- LWC / world-space matrix + vector types (real defs in WorldSpaceMath.ush) ---
struct FWSMatrix { float _sl; };
struct FWSInverseMatrix { float _sl; };
struct FShaderLabLWCData_Stub
{
FWSMatrix LocalToWorld;
FWSInverseMatrix WorldToLocal;
FWSMatrix InstanceToWorld;
FWSInverseMatrix WorldToInstance;
};
// --- Material parameter structs (only the members our transforms touch) ---
struct FMaterialPixelParameters { float3x3 TangentToWorld; FShaderLabLWCData_Stub LWCData; };
struct FMaterialVertexParameters { float3x3 TangentToWorld; FShaderLabLWCData_Stub LWCData; };
// --- ResolvedView (subset of the view uniform used by transforms) ---
struct FShaderLabView_Stub
{
float4x4 ViewToTranslatedWorld;
float4x4 TranslatedWorldToView;
float4x4 CameraViewToTranslatedWorld;
float4x4 TranslatedWorldToCameraView;
};
static FShaderLabView_Stub ResolvedView;
// --- Vector transform helpers (Common.ush / MaterialTemplate.ush) ---
float3 TransformTangentVectorToWorld(float3x3 TangentToWorld, float3 V) { return (float3)0; }
float3 TransformWorldVectorToTangent(float3x3 TangentToWorld, float3 V) { return (float3)0; }
float3 TransformLocalVectorToWorld(FMaterialPixelParameters Parameters, float3 V) { return (float3)0; }
float3 TransformLocalVectorToWorld(FMaterialVertexParameters Parameters, float3 V) { return (float3)0; }
FWSInverseMatrix GetWorldToLocal(FMaterialPixelParameters Parameters) { FWSInverseMatrix M; return M; }
FWSInverseMatrix GetWorldToLocal(FMaterialVertexParameters Parameters) { FWSInverseMatrix M; return M; }
FWSMatrix GetInstanceToWorld(FMaterialPixelParameters Parameters) { FWSMatrix M; return M; }
FWSMatrix GetInstanceToWorld(FMaterialVertexParameters Parameters) { FWSMatrix M; return M; }
FWSInverseMatrix GetWorldToInstance(FMaterialPixelParameters Parameters) { FWSInverseMatrix M; return M; }
FWSInverseMatrix GetWorldToInstance(FMaterialVertexParameters Parameters) { FWSInverseMatrix M; return M; }
float3 WSMultiplyVector(float3 V, FWSMatrix M) { return (float3)0; }
float3 WSMultiplyVector(float3 V, FWSInverseMatrix M) { return (float3)0; }
// --- Misc transform helpers ---
float3 RotateAboutAxis(float4 NormalizedRotationAxisAndAngle, float3 PositionOnAxis, float3 Position) { return (float3)0; }
// --- Position / LWC (absolute-world hub is FWSVector3) ---
struct FWSVector3 { float3 _sl; };
FWSVector3 WSPromote(float3 V) { FWSVector3 R; return R; }
FWSVector3 WSSubtract(FWSVector3 A, FWSVector3 B) { FWSVector3 R; return R; }
float3 WSAddDemote(FWSVector3 A, FWSVector3 B) { return (float3)0; }
FWSVector3 WSMultiply(float3 P, FWSMatrix M) { FWSVector3 R; return R; }
float3 WSMultiplyDemote(FWSVector3 P, FWSInverseMatrix M) { return (float3)0; }
FWSVector3 TransformLocalPositionToWorld(FMaterialPixelParameters Parameters, float3 P) { FWSVector3 R; return R; }
FWSVector3 TransformLocalPositionToWorld(FMaterialVertexParameters Parameters, float3 P) { FWSVector3 R; return R; }
FWSVector3 GetPreViewTranslation(FMaterialPixelParameters Parameters) { FWSVector3 R; return R; }
FWSVector3 GetPreViewTranslation(FMaterialVertexParameters Parameters) { FWSVector3 R; return R; }
#endif // SHADERLAB_IDE
#endif // SHADERLAB_ENGINE_STUBS_USH