View Single Post
Old 2nd October 2013, 17:53   #20196  |  Link
StephaneM
Registered User
 
Join Date: Jun 2006
Posts: 15
Hi,

I need some help regarding external pixel shaders, no matter what I try I fail to apply a shader.

What I have done so far : created the playback graph and all is fine. Then upon user interaction I try to add a shader.

Here is my interface definition for C# Interop :

Code:
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("B6A6D5D4-9637-4C7D-AAAE-BC0B36F5E433"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IMadVRExternalPixelShaders
{
    [PreserveSig]
    int ClearPixelShaders(bool postScale);

    [PreserveSig]
    int AddPixelShader([MarshalAs(UnmanagedType.LPStr), In] string sourceCode,
                       [MarshalAs(UnmanagedType.LPStr), In] string compileProfile,
                       int stage, IntPtr reserved);
};
And this is how I'm using it :

Code:
IMadVRExternalPixelShaders madvrShaders = playbackGraph["VideoRenderer"].GetInterface<IMadVRExternalPixelShaders>();
if (madvrShaders != null)
{
    int result = madvrShaders.AddPixelShader(shaderCode, targetProfile,
                                             (int)madVRProperties.ShaderStage.PreScaling, IntPtr.Zero);
}
Marshal.ReleaseComObject(madvrShaders);
No matter what I do I get 0x80004005 as result...

Regarding the arguments I'm passing here they are :

targetProfile = "ps_2_0"
shaderCode = "sampler s0 : register(s0);\nfloat4 p0 : register(c0);\n\n#define width (p0[0])\n....."

Am I missing something ?

Thanks,
--
Stéphane.
StephaneM is offline   Reply With Quote