Problem binding Shader Parameter to VertexFactory

So i was playing around with VertexFactory and SceneProxy to simply draw a Quad or Triangle.
It works.
Now i wanted to set an Array of Integers or Floats that is present for each vertex so i can pick the number i need from the Array.
But i can’t bind the Array to the Shader.

FPlanetShaderParameters* FPlanetVertexFactory::ConstructShaderParameters(EShaderFrequency ShaderFrequency)
{
	if (ShaderFrequency == SF_Vertex)
	{
		return new FPlanetShaderParameters();
	}

	return nullptr;
}

void FPlanetShaderParameters::Bind(const class FShaderParameterMap& ParameterMap)
{
	testValues.Bind(ParameterMap, TEXT("testValue"), SPF_Mandatory);
}

void FPlanetShaderParameters::Serialize(FArchive& Ar)
{
	Ar << testValues;
}

void FPlanetShaderParameters::SetMesh(FRHICommandList & RHICmdList, FShader * Shader, const FVertexFactory * VertexFactory, const FSceneView & View, const FMeshBatchElement & BatchElement, uint32 DataFlags) const
{
	FShaderParameterMap testMap;
	FRHIVertexShader* VS = Shader->GetVertexShader();
	TArray<float> testFloat;
	testFloat.Add(1.f);
	testFloat.Add(2.f);
	testFloat.Add(3.f);
	testFloat.Add(4.f);

	SetShaderValue(RHICmdList, VS, testValues, testFloat, 4);
}

Somehow Bind(…) never gets called. But SetMesh(…) does…
I checked Implementations in the Engine Code and couldn’t find a Solution

Please close this Question

Let’s discuss :

Yes, in the landscape module , FLandscapeVertexFactoryVertexShaderParameters::Bind is nerver called, you can ue_log to check that .but GetElementShaderBindings is called every frame and in that member method, you can see it’s member parameters are actually bound.

I wonder why, maybe bind will be called only once and after being Serialized it will never be called?

Okay I guess the serialized archive will act as a key and unless the key has changed the shaderparamters won’s be re bound, is it the mechanism ?

Shader parameters are bound when you start the editor. i can’t remember if this was the issue