Skip to content

Design  #2

Open
Open
@recp

Description

@recp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions