Made the basic geometry rendering of simple debug gizmos and such, to run on many render contexts, each context has a buffer with the produced vertices and it puts the render commands on their queues (like drawSphere, drawLine, drawWireBox etc.).
The text rendering is also queued. When you call RenderContext::drawText, what it will do is putting the drawtext command on the context’s command queue with the text to be written, after that, when all contexts commands are merged and sorted, the renderer will take the text, the current text attributes and generate letter quads in a special vertex buffer only for text rendering. So, basically, text rendering is not physically happening when you call drawText(), but its deferred to the main thread render command queue processing, like all the other render context functions, making this scheme pretty nice for multi-render-context-multithreaded rendering…of things..
Amazing (!) multithreaded (!) rendering of basic debug geometry
:

Aside that, I have changed the shader system a little bit:
- I dont use CgFX anymore, just plain Cg with
- There are no techniques and passes in the shader, only render methods. I think technique passes are sort of obsolete and since I was usually having one pass in the shaders, was kind of useless, plus going towards a deferred rendering approach, did influence this decision.
- Material is holding the render layers (which can be thought of as passes), but in a deferred renderer they will be used slightly differently.
A shader example:
File: shaders/basic.shader (JSON)
This file is the source file, it is compiled by the asset compiler into basic.nshader (bin)
{
"description":"Basic unlit, textured/untextured shader,
used for UI and debug rendering",
"renderMethods":
[
{
"name": "textured",
"program": "../engine_src/programs/basic.cg",
"vertexMain": "mainTexVS",
"pixelMain": "mainTexPS",
"constants":
[
{
"type": "worldViewProjection",
"name": "mtxWorldViewProjection"
},
{
"type": "texture",
"name": "diffuseSampler"
},
{
"type": "float4",
"name": "diffuseColor"
},
{
"type": "float2",
"name": "uvDiffuseRepeat",
"value": "1;1"
},
{
"type": "float2",
"name": "uvDiffuseOffset",
"value": "0;0"
}
]
},
{
"name": "solid",
"isDefault": "true",
"program": "../engine_src/programs/basic.cg",
"vertexMain": "mainVS",
"pixelMain": "mainPS",
"constants":
[
{
"type": "worldViewProjection",
"name": "mtxWorldViewProjection"
},
{
"type": "float4",
"name": "diffuseColor"
}
]
}
]
}