Design
Currently APIs are individual call
Maybe we can also provide structs to reduce func calls
for instance
GPUSetFrontFace(rce, GPUWindingCounterClockwise);
GPUSetCullMode(rce, GPUCullModeBack);
GPUSetRenderState(rce, renderState);
GPUSetDepthStencil(rce, depthStencilState);
GPUSetVertexBuffer(rce, dynamicUniformBuffer, uniformBufferOffset, BufferIndexUniforms);
GPUSetFragmentBuffer(rce, dynamicUniformBuffer, uniformBufferOffset, BufferIndexUniforms);
GPUSetFragmentTexture(rce, _colorMap, TextureIndexColor);
like
GPUNewRenderCommandEncoder(cmdb, pass, (Type){
.frontFace = GPUWindingCounterClockwise,
.cullMode = GPUCullModeBack,
.renderState = renderState,
.depthStencil = depthStencilState,
.vertexBuffer = {
.buf = dynamicUniformBuffer,
.off = uniformBufferOffset,
.idx = BufferIndexUniforms,
},
.fragmentBuffer = {
.buf = dynamicUniformBuffer,
.off = uniformBufferOffset,
.idx = BufferIndexUniforms,
}
});
or with small structs...
GPUNewRenderCommandEncoder(cmdb, pass, (Type){
.frontFace = GPUWindingCounterClockwise,
.cullMode = GPUCullModeBack,
.renderState = renderState,
.depthStencil = depthStencilState,
});
both can co-exist, this is just an example
Second example is what SDL3's GPU API, wgpu-native and sokol-gfx are doing, it's almost standard now. First one might be helpful for those migrating from OpenGL.
@MatheusKS95 many thanks for the review and suggestions,
I didn’t know about the SDL3 GPU api which looks similar to this GPU library, will take a look thanks
Its been a while bu I couldnt have enough free time :/ Ive been working on UniversalShading occasionally in my free time, it’ll be used by the GPU library, hoping to get the initial features ready soon 🔜