Im busy creating a directX11 renderer for my game. I did the neccesary refactoring to seperate the graphics calls from the rest of the engine by creating an interface and moving all the opengl code into an implementation of the interface. Then i created a directx implementation of the interface and started implementing it bit by bit. Now I pretty much have most of it down except for constant buffers.
The interface very much caters towards opengl since thats the first implementation i wrote (and before now I didnt know any directX). As a result the directX implementation looks more like opengl emulation than a proper directx implementation. But thats fine for now. Once i get the game fully rendered in directX il start looking at ways to improve that.
So now my implementation has a method named. sendUniform1i (string uniformName, int value) wich would in the opengl implemenation of course set the int uniform named 'uniformName' to the value in 'value' for the current shaders. Im strugling to figure out how i would implement (emulate?) this in directx. Remember this is just my intermediate step i dont care how dirty it is for now. I was thinking along the lines of giving each constant variable in directx its own constant buffer but as far as i can tel the only way to reference this buffer in code would be by its 'buffer slot number' (: register(b0) etc). Whereas i need a way to get a handle on it by its name. The constant buffer as declared in a shader does have a name but i cant seem to find any example of how you can use that name. I might just be mssing it.
thnx in Advance