View Full Version : Can I port D3D implement from 3.0 to 2.3.7?

08-21-2013, 06:26 PM
Can I port D3D implement from 3.0 to 2.3.7?

08-21-2013, 09:25 PM
Mostly you can, although there are few important differences that could cause trouble.

The biggest issue will be that ClanLib 3.0 uses state classes (BlendState, DepthStencilState, etc) while 2.3 has individual setter functions (set_blend_func, etc) on GraphicContext for similar functionality. This change in 3.0 was made mostly because Direct3D itself only operates with immutable state classes, and I figured it was easier to support that for the OpenGL target than the other way around. So this means a 2.3 port would require adding some code that can create state objects for each of the state setups the app actually ends up using.

The second issue is that ClanLib 3.0's Texture class adds support for a bunch of texture types that 2.3 does not support that well (1DArray, 2DArray, 3D, etc). This issue is easier to deal with since you can probably get away with just disabling the parts of the D3D target which would be used for those variants. There are also some new GPU object types (compute shaders, storage buffers, texture views) that 2.3 doesn't have. Once again, you could probably solve this by remarking/removing code supporting this.

Last, there's the huge PITA of having to add CL_ in front of everything.