[Mono-dev] Managed DirectX

Jon Chambers joncham at gmail.com
Wed Oct 25 12:43:54 EDT 2006

I am working on COM Interop support in mono. Alot of functionality is
currently available for calling unmanaged COM objects from managed code
(Runtime Callable Wrappers) in mono. I am working on COM Callable Wrappers
right now and should have something in svn in the near future. Some details
may need to be worked out (for example, I am using the cdecl calling
convention on Linux right now instead of stdcall to be compatible with
XPCOM). There is also a bug filed on the c# compiler (the issue is actually
by design) which prevents mono from building the interop assemblies. If you
want to try anything out on mono, you will need to build you interop
assemblies with .Net (either by hand or via tlbimp). If you need any other
help let me know.


On 10/25/06, Brian Crowell <mono-devel at fluggo.com> wrote:
> Stefan Dösinger wrote:
> > I am one of the programmers of the Wine Direct3D implementation, and I
> > wondered if there are any plans to implement Managed DirectX in Mono,
> and if
> > it is possible to share efforts between wine and mono?
> Hello.
> I started on an open implementation of the XNA libraries. Mostly because I
> was cheesed at the lack of good error messages. I know that isn't Managed
> DirectX, but Microsoft never really seemed interested in supporting that.
> The good news is that they're not terribly different from each other.
> The only catch is that it's implemented in C++/CLI, which at present is
> really the best way to do it. I wouldn't attempt it in C#, unless you could
> figure out a better way to do all the calli instructions. I thought at one
> point about doing a simple wrapper around the COM implementation and doing
> the rest in C#, but even that's not all that great, and you still have the
> C++/CLI dependency.
> Here, I'll give you a good example:
> ----------
> _device->CreateTexture( width, height, levels, (DWORD) usage, (D3DFORMAT)
> format, (D3DPOOL) pool, &tex, NULL )
> ----------
> ...becomes:
> ----------
>   IL_0006:  ldarg.0
>   IL_0007:  ldfld      valuetype IDirect3DDevice9*
> Fluggo.Graphics.Direct3D.GraphicsDevice::_device
>   IL_000c:  ldarg.1
>   IL_000d:  ldarg.2
>   IL_000e:  ldarg.3
>   IL_000f:  ldarg.s    usage
>   IL_0011:  ldarg.s    format
>   IL_0013:  ldarg.s    pool
>   IL_0015:  ldloca.s   tex
>   IL_0017:  ldc.i4.0
>   IL_0018:  ldarg.0
>   IL_0019:  ldfld      valuetype IDirect3DDevice9*
> Fluggo.Graphics.Direct3D.GraphicsDevice::_device
>   IL_001e:  ldind.i4
>   IL_001f:  ldc.i4.s   92
>   IL_0021:  add
>   IL_0022:  ldind.i4
>   IL_0023:  calli      unmanaged stdcall int32
> modopt([mscorlib]System.Runtime.CompilerServices.IsLong)
> modopt([mscorlib]System.Runtime.CompilerServices.CallConvStdcall)(native
> int,uint32,uint32,uint32,uint32
> modopt([mscorlib]System.Runtime.CompilerServices.IsLong),valuetype
> _D3DFORMAT,valuetype _D3DPOOL,valuetype IDirect3DTexture9**,void**)
> ----------
> Here, you can see C++ calculating the address of the pointer to the
> function, loading it, then issuing a calli. I don't know of a way to do that
> in C#, at least, not one that will give you any kind of good performance.
> --Brian
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061025/103acb6b/attachment.html 

More information about the Mono-devel-list mailing list