Add Sampling.ush for IDE hint

This commit is contained in:
Eragon
2026-07-04 00:29:46 +08:00
parent 9d901f30bf
commit ef1e22d6af
3 changed files with 80 additions and 3 deletions

View File

@@ -1,11 +1,12 @@
// Copyright UShaderLab. All Rights Reserved.
//
// Aggregator for the ShaderLab `UE_` HLSL library functions. This header only includes the per-category
// implementation files under UEFunctions/. It is auto-included into every generated Custom node (so the
// forwarders compile) and pulled in by the ShaderLab.ush authoring umbrella (so they complete in the IDE).
// Aggregator for ShaderLab's UE-facing HLSL helpers. It is auto-included into every generated Custom node
// (so real helper forwarders compile) and pulled in by the ShaderLab.ush authoring umbrella (so they
// complete in the IDE). Some entries are IDE-only stubs for engine helpers already supplied by UE.
#pragma once
#include "/Plugin/ShaderLab/Private/UEFunctions/Sampling.ush" // IDE-only Unreal Texture*Sample/Gather stubs.
#include "/Plugin/ShaderLab/Private/UEFunctions/Noise.ush"
#include "/Plugin/ShaderLab/Private/UEFunctions/Rotation.ush"
#include "/Plugin/ShaderLab/Private/UEFunctions/SceneTexture.ush"

View File

@@ -0,0 +1,72 @@
// Copyright UShaderLab. All Rights Reserved.
//
// IDE-only stubs for Unreal's material texture sampling helpers from Common.ush.
// The real material template already provides these functions; this file only lets
// standalone HLSL tooling resolve calls inside .usl authoring files.
#pragma once
#ifdef SHADERLAB_IDE
struct FloatDeriv2
{
float2 Value;
float2 Ddx;
float2 Ddy;
};
float4 Texture2DSample(Texture2D Tex, SamplerState Sampler, float2 UV) { return (float4)0; }
float4 Texture2DSample(Texture2D Tex, SamplerState Sampler, FloatDeriv2 UV) { return (float4)0; }
float Texture2DSample_A8(Texture2D Tex, SamplerState Sampler, float2 UV) { return 0; }
float4 Texture2DSampleLevel(Texture2D Tex, SamplerState Sampler, float2 UV, float Mip) { return (float4)0; }
float4 Texture2DSampleBias(Texture2D Tex, SamplerState Sampler, float2 UV, float MipBias) { return (float4)0; }
float4 Texture2DSampleGrad(Texture2D Tex, SamplerState Sampler, float2 UV, float2 DDX, float2 DDY) { return (float4)0; }
float4 Texture3DSample(Texture3D Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 Texture3DSampleLevel(Texture3D Tex, SamplerState Sampler, float3 UV, float Mip) { return (float4)0; }
float4 Texture3DSampleBias(Texture3D Tex, SamplerState Sampler, float3 UV, float MipBias) { return (float4)0; }
float4 Texture3DSampleGrad(Texture3D Tex, SamplerState Sampler, float3 UV, float3 DDX, float3 DDY) { return (float4)0; }
float4 TextureCubeSample(TextureCube Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 TextureCubeSampleLevel(TextureCube Tex, SamplerState Sampler, float3 UV, float Mip) { return (float4)0; }
float TextureCubeSampleDepthLevel(TextureCube TexDepth, SamplerState Sampler, float3 UV, float Mip) { return 0; }
float4 TextureCubeSampleBias(TextureCube Tex, SamplerState Sampler, float3 UV, float MipBias) { return (float4)0; }
float4 TextureCubeSampleGrad(TextureCube Tex, SamplerState Sampler, float3 UV, float3 DDX, float3 DDY) { return (float4)0; }
float4 Texture2DArraySample(Texture2DArray Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 Texture2DArraySampleLevel(Texture2DArray Tex, SamplerState Sampler, float3 UV, float Mip) { return (float4)0; }
float4 Texture2DArraySampleBias(Texture2DArray Tex, SamplerState Sampler, float3 UV, float MipBias) { return (float4)0; }
float4 Texture2DArraySampleGrad(Texture2DArray Tex, SamplerState Sampler, float3 UV, float2 DDX, float2 DDY) { return (float4)0; }
float4 Texture2DGatherRed(Texture2D Tex, SamplerState Sampler, float2 UV) { return (float4)0; }
float4 Texture2DGatherGreen(Texture2D Tex, SamplerState Sampler, float2 UV) { return (float4)0; }
float4 Texture2DGatherBlue(Texture2D Tex, SamplerState Sampler, float2 UV) { return (float4)0; }
float4 Texture2DGatherAlpha(Texture2D Tex, SamplerState Sampler, float2 UV) { return (float4)0; }
float4 TextureCubeGatherRed(TextureCube Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 TextureCubeGatherGreen(TextureCube Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 TextureCubeGatherBlue(TextureCube Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 TextureCubeGatherAlpha(TextureCube Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 Texture2DArrayGatherRed(Texture2DArray Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 Texture2DArrayGatherGreen(Texture2DArray Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 Texture2DArrayGatherBlue(Texture2DArray Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 Texture2DArrayGatherAlpha(Texture2DArray Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 Texture2DSample_Decal(Texture2D Tex, SamplerState Sampler, float2 UV) { return (float4)0; }
float4 Texture3DSample_Decal(Texture3D Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 Texture2DArraySample_Decal(Texture2DArray Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 TextureCubeSample_Decal(TextureCube Tex, SamplerState Sampler, float3 UV) { return (float4)0; }
float4 TextureCubeArraySample(TextureCubeArray Tex, SamplerState Sampler, float4 UV) { return (float4)0; }
float4 TextureCubeArraySampleLevel(TextureCubeArray Tex, SamplerState Sampler, float4 UV, float Mip) { return (float4)0; }
float4 TextureCubeArraySampleBias(TextureCubeArray Tex, SamplerState Sampler, float4 UV, float MipBias) { return (float4)0; }
float4 TextureCubeArraySampleGrad(TextureCubeArray Tex, SamplerState Sampler, float4 UV, float3 DDX, float3 DDY) { return (float4)0; }
float4 TextureCubeArraySampleLevel(TextureCubeArray Tex, SamplerState Sampler, float3 UV, float ArrayIndex, float Mip) { return (float4)0; }
float4 TextureCubeArrayGatherRed(TextureCubeArray Tex, SamplerState Sampler, float4 UV) { return (float4)0; }
float4 TextureCubeArrayGatherGreen(TextureCubeArray Tex, SamplerState Sampler, float4 UV) { return (float4)0; }
float4 TextureCubeArrayGatherBlue(TextureCubeArray Tex, SamplerState Sampler, float4 UV) { return (float4)0; }
float4 TextureCubeArrayGatherAlpha(TextureCubeArray Tex, SamplerState Sampler, float4 UV) { return (float4)0; }
#endif // SHADERLAB_IDE

View File

@@ -48,6 +48,8 @@ namespace
case EShaderLabDomain::PostProcess: return TEXT("PostProcess");
case EShaderLabDomain::UI: return TEXT("UI");
case EShaderLabDomain::Decal: return TEXT("Decal");
case EShaderLabDomain::Volume: return TEXT("Volume");
case EShaderLabDomain::LightFunction: return TEXT("LightFunction");
}
checkNoEntry();
return FString();
@@ -62,6 +64,8 @@ namespace
case EShaderLabBlendMode::Translucent: return TEXT("Translucent");
case EShaderLabBlendMode::Additive: return TEXT("Additive");
case EShaderLabBlendMode::Modulate: return TEXT("Modulate");
case EShaderLabBlendMode::AlphaComposite: return TEXT("AlphaComposite");
case EShaderLabBlendMode::AlphaHoldout: return TEXT("AlphaHoldout");
}
checkNoEntry();
return FString();