Not sure if we can determine sampler precision in UE, just like
layout(set = xx, binding = xx) uniform mediump sampler s_xxx;
in glsl we can use mediump as precision qualifier, but I did not find similar ones for sampler in hlsl.
I tried to replace the precision below with EShaderPrecisionModifier::Half like below #define SHADER_PARAMETER_SAMPLER(ShaderType,MemberName)
INTERNAL_SHADER_PARAMETER_EXPLICIT(UBMT_SAMPLER, TShaderResourceParameterTypeInfo<FRHISamplerState*>, FRHISamplerState*,MemberName, = nullptr,EShaderPrecisionModifier::Float,TEXT(#ShaderType),false)
But looks like no difference
There is no equivalent to GLSL’s precision qualifier for sampler types in HLSL. This is because the precision of a sampler state is determined by the hardware and is not controllable by the shader code.
The EShaderPrecisionModifier enumeration you mentioned is used to control the precision of floating-point scalar and vector types in the shader code. It does not affect the precision of sampler types.
The default precision of a sampler state in HLSL is implementation-defined and may vary across different hardware and drivers. Therefore, you should not rely on a specific precision when working with sampler states in UE.
If you need to ensure consistent behavior across different hardware and drivers, you can use a custom shader code that defines a specific sampler precision by setting the precision in the underlying API, such as Direct3D or Vulkan. However, this is an advanced technique and requires detailed knowledge of the underlying API and shader language.
Got it and thanks a lot for your reply.
For the mentioned “setting the precision in the underlying API”, does that mean modifying precision in API related files in UE(maybe something like RHI), or just defining some macros in shaders to control the behavior of different APIs(D3D, VK), or the need to modify something underneath like VK SDK?