Jump to content

  • Log In with Google      Sign In   
  • Create Account


pulo

Member Since 23 Jun 2012
Offline Last Active Jul 13 2014 06:29 AM
-----

#5162112 Dynamic Shader Linkage and ShaderReflection

Posted by pulo on 22 June 2014 - 09:22 AM

Well i found something which might help. If i use the GetInterfaceByIndex on the Shader Reflection type i get the expected class "D3D_SVC_INTERFACE_CLASS" which i suspect would be different or non-existent on a normal struct.

 

EDIT: The only thing now left for me is to find out if it is possible to get the name from here through shader reflection. Any Ideas?:

iBaseLight     g_abstractAmbientLighting;
               ^^^^^^^^^^^^^^^^^^^^^^^^

struct PixelInput
{
float4 position : SV_POSITION;
float3 normals : NORMAL;
float2 tex: TEXCOORD0;
};



#5162105 Dynamic Shader Linkage and ShaderReflection

Posted by pulo on 22 June 2014 - 08:47 AM

Yes the constant buffer stays the same, regardless of which class implementation i am using at runtime. (Was this what you were asking?)

The abstract interface is used like this:

iBaseLight     g_abstractAmbientLighting;


struct PixelInput
{
float4 position : SV_POSITION;
float3 normals : NORMAL;
float2 tex: TEXCOORD0;
};


float4 main(PixelInput input) : SV_TARGET
{
float3 Ambient = (float3)0.0f;
Ambient = g_txDiffuse.Sample(g_samplerLin, input.tex) * g_abstractAmbientLighting.IlluminateAmbient(input.normals);


return float4(saturate(Ambient), 1.0f);
}

The reason i would like to reliably differentiate between a normal struct and a class used for dynamic shader linkage is that i would later use the variable name to automatically get the class instances like this: 

 g_pPSClassLinkage->GetClassInstance( varDesc.Name, 0, &g_pAmbientLightClass );



#5161031 Texure mapping goes wrong. Why?

Posted by pulo on 17 June 2014 - 06:39 AM

Alright. I found the problem:

 

I had to invert the "v" coordinate of the texture coordinates (v = 1-v).

Is there a way to detect if my texture coordinate need inversion or do need to specify this before conversion (or alternatively export my mesh for a left handed coordinate system)?

 

Thanks for any suggestion!




PARTNERS