• Random
  • Archive
  • RSS
  • Ask me anything
  • Submit

u2 Bleank's blog

Rendering API abstraction in Harmony

Hi,

I’m currently working on the abstraction layer of Bleank’s Framework called Harmony.

This framework is used in all Bleank’s project and is based on DirectX9 only from the beginning.
With the emergence if new technology like MultiCores CPU and new rendering API like DirectX10 / 11 and the need to anticipate futures changes ( DirectX12 .. openGL etc.. )
We need to develope an abstarction layer between the low level rendering API and the other part of the Framework.
So I started to develop this layer from the DirectX11 specifications because it’s the most recent API interface and the most powerfull.

Ok

One of the main goal is to enable the creation of Low lovel Command asynchronously ( called displaylist or commands list )
For example One thread will compute RenderState for the 3D scene and another for the UI.
This was not possible in the previous framework.
The other amelioration is the decouple the resprrsentation of the display scene between different Graph.
The previous version was defined by a global SceneGraph who encapsulate States modification, spatial relation etc.. It’s was not really elegant and a pain to build for rapid prototyping.
In the new version we’ll add several Graph who can respresent the scene efficently in different context.

For example an object can be represented by a

- RenderGraph who contain state change on the GPU.

- A Spatial Graph who store information about the spatrial position of element of the object

- A Relation Graph who handle datas computation dependency ( like Parent->Child transformation )

- etc…

- SceneGraph who contain all datas information about the scene

But I diverge from the subject of the article ;)

We doesn’t have finished the entire Layer because it’s a lot of work to accomplish but for the moment we are quiet happy with our results.
We can switch between D3D9 and D3D10 at runtime with a common client code.

For example the following code :

g_RenderCtx = rgContext::New( device )    ;

    g_Root = rgNode::New()    ;

        g_Root->AddChild1<rgClear>( cVector4(0.272f,0.272f,0.3f,0.f) )    ;

        rgNodeListRef list = rgNodeList::New()                                                                        ;
        g_Root->AddChild( list )                                                                                    ;
            list->Add2<rgIASetVertexBuffer>( CreateSpiral( device, NB_LINES, 2, 0.1f, 0.8f ), sizeof(cVector2) )    ;
            list->Add1<rgIASetInputLayout>( VLayout )                                                                ;
            list->Add1<rgIASetPrimitiveTopology>( PRIMITIVE_TOPOLOGY_LINESTRIP )                                    ;
            list->Add1<rgRSSetState>( RasterState )                                                                    ;
            list->Add1<rgOMSetBlendState>( BlendState )                                                                ;
            list->Add1<rgOMSetDepthStencilState>( DepthState )                                                        ;
            list->Add1<rgVSSetShader>( VShader )                                                                    ;
            list->Add1<rgGSSetShader>( NULL )                                                                        ;
            list->Add1<rgPSSetShader>( PShader )                                                                    ;

                list->AddChild1<rgDraw>( NB_LINES+1 )    ;

produce this wonderfull Naruto like spiral :

( for sure it’s not the picture of the year but the way to do it is more important here ).

    • #bleank
    • #Direct3D
    • #Harmony
    • #Framework
    • #code
  • 2 years ago
  • Permalink
  • Share
    Tweet
← Previous • Next →

Logo

u2 Bleank's blog

About

CEO and co-founder of Bleank.
Demoscener as coder in PoPsY TeAm. Passionate by real time graphic programmig, graphic design, much more...
Bleank Website

Me, Elsewhere

  • u2bleank on Behance
  • @u2bleank on Twitter
  • user2227554 on Vimeo
  • Google

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Submit
  • Mobile

www.bleank.com. Effector Theme by Carlo Franco.

Powered by Tumblr