#Texture2DArray in custom function hlsl
1 messages · Page 1 of 1 (latest)
Should be something like SAMPLE_TEXTURE2D_ARRAY(texName, texName.samplerstate, uv, index)
Sorry I didn't see the notification !
Well on the macro path, texName.samplerstate doesn't exist, I tried to use s_linear... or a UnitySamplerState without sucess here.
I'll had a code sample just in case :
void Test_float(
Texture2DArray textureArray,
float2 uv,
out float4 result)
{
result = SAMPLE_TEXTURE2D_ARRAY(textureArray, sampler_tex, uv, 0);
}
Try UnityTexture2DArray as the param type
The intention being that while Texture2DArray is the usual hlsl-type, Unity added a bunch of UnityX texture structs so that the texture and SamplerState object associated with it can be passed around in shadergraph together
Ohoh, I tried and looks like texName.samplerState does exist with the no Bar Texture 2D Array.
Thanks !
I'll do a few more test later to be sure.
Yeah, should be that
"Bare Texture 2D Array" = Texture2DArray
"Texture 2D Array" = UnityTexture2DArray which stores .tex & .samplerstate
In older versions you had to always pass a SamplerState as a separate parameter and could only use the Sampler State node in graph (what we'd call an "inline sampler state" in code)