Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design #2

Open
recp opened this issue Sep 14, 2023 · 0 comments
Open

Design #2

recp opened this issue Sep 14, 2023 · 0 comments
Labels

Comments

@recp
Copy link
Owner

recp commented Sep 14, 2023

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

@recp recp added the todo label Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant