simtouch / slimdx

Automatically exported from code.google.com/p/slimdx
0 stars 0 forks source link

Dynamic Shader Linkage late binding #846

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, i'm trying to use Dynamic shader linkage (porting dx sample in a bit 
more simplified way).

I created 1 interface:
interface iBaseMaterial
{
   float3 GetColor(); 
};

then several different classes like:
class cRed : cColor
{
   float3 GetColor() { return float3(1,0,0); } 
};

Now i have variables like this:
iBaseMaterial material;
cGreen green;
cRed red;
cBlue blue;

Pixel Shader code is pretty minimal:
return float4(material.GetColor(),1);

now when i try to assign ClassInstance via code I have no error but screen 
stays black.

this.FShader.DefaultEffect.GetVariableByName("material").AsInterface().ClassInst
ance = this.FShader.DefaultEffect.GetVariableByName("green").AsClassInstance();

Looking at the sample in DirectX SDK it seems i'm following the same steps.

Please find attached the full shader file, if you need a better repro sample 
let me know :)

Original issue reported on code.google.com by herrvux on 6 Nov 2011 at 3:16

Attachments:

GoogleCodeExporter commented 9 years ago
Apologies seems all working nicely, just for some reason one shader was cached 
in my engine.

Please discard.

Original comment by herrvux on 6 Nov 2011 at 4:29

GoogleCodeExporter commented 9 years ago
Closing.

Original comment by Mike.Popoloski on 6 Nov 2011 at 4:42