ngfx::Graphics

Inherited by ngfx::D3DGraphics, ngfx::MTLGraphics, ngfx::VKGraphics

Public Functions

Name
Graphics * create(GraphicsContext * ctx)
virtual ~Graphics()
virtual void beginComputePass(CommandBuffer * commandBuffer) =0
virtual void endComputePass(CommandBuffer * commandBuffer) =0
virtual void beginRenderPass(CommandBuffer * commandBuffer, RenderPass * renderPass, Framebuffer * framebuffer, glm::vec4 clearColor =glm::vec4(0.0f), float clearDepth =1.0f, uint32_t clearStencil =0) =0
virtual void endRenderPass(CommandBuffer * commandBuffer) =0
virtual void bindVertexBuffer(CommandBuffer * commandBuffer, Buffer * buffer, uint32_t location, uint32_t stride) =0
virtual void bindIndexBuffer(CommandBuffer * commandBuffer, Buffer * buffer, IndexFormat indexFormat =INDEXFORMAT_UINT32) =0
virtual void bindUniformBuffer(CommandBuffer * commandBuffer, Buffer * buffer, uint32_t binding, ShaderStageFlags shaderStageFlags) =0
virtual void bindStorageBuffer(CommandBuffer * commandBuffer, Buffer * buffer, uint32_t binding, ShaderStageFlags shaderStageFlags) =0
virtual void bindComputePipeline(CommandBuffer * cmdBuffer, ComputePipeline * computePipeline) =0
virtual void bindGraphicsPipeline(CommandBuffer * cmdBuffer, GraphicsPipeline * graphicsPipeline) =0
virtual void bindTexture(CommandBuffer * commandBuffer, Texture * texture, uint32_t set) =0
virtual void draw(CommandBuffer * cmdBuffer, uint32_t vertexCount, uint32_t instanceCount =1, uint32_t firstVertex =0, uint32_t firstInstance =0) =0
virtual void drawIndexed(CommandBuffer * cmdBuffer, uint32_t indexCount, uint32_t instanceCount =1, uint32_t firstIndex =0, int32_t vertexOffset =0, uint32_t firstInstance =0) =0
virtual void dispatch(CommandBuffer * cmdBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ, uint32_t threadsPerGroupX, uint32_t threadsPerGroupY, uint32_t threadsPerGroupZ) =0
virtual void setViewport(CommandBuffer * cmdBuffer, Rect2D rect) =0
virtual void setScissor(CommandBuffer * cmdBuffer, Rect2D rect) =0
virtual void waitIdle(CommandBuffer * cmdBuffer) =0

Public Attributes

Name
Rect2D scissorRect
Rect2D viewport
Pipeline * currentPipeline
RenderPass * currentRenderPass
Framebuffer * currentFramebuffer

Protected Attributes

Name
GraphicsContext * ctx

Public Functions Documentation

function create

static Graphics * create(
    GraphicsContext * ctx
)

function ~Graphics

inline virtual ~Graphics()

function beginComputePass

virtual void beginComputePass(
    CommandBuffer * commandBuffer
) =0

Reimplemented by: ngfx::VKGraphics::beginComputePass, ngfx::D3DGraphics::beginComputePass, ngfx::MTLGraphics::beginComputePass

function endComputePass

virtual void endComputePass(
    CommandBuffer * commandBuffer
) =0

Reimplemented by: ngfx::VKGraphics::endComputePass, ngfx::D3DGraphics::endComputePass, ngfx::MTLGraphics::endComputePass

function beginRenderPass

virtual void beginRenderPass(
    CommandBuffer * commandBuffer,
    RenderPass * renderPass,
    Framebuffer * framebuffer,
    glm::vec4 clearColor =glm::vec4(0.0f),
    float clearDepth =1.0f,
    uint32_t clearStencil =0
) =0

Reimplemented by: ngfx::VKGraphics::beginRenderPass, ngfx::D3DGraphics::beginRenderPass, ngfx::MTLGraphics::beginRenderPass

function endRenderPass

virtual void endRenderPass(
    CommandBuffer * commandBuffer
) =0

Reimplemented by: ngfx::VKGraphics::endRenderPass, ngfx::D3DGraphics::endRenderPass, ngfx::MTLGraphics::endRenderPass

function bindVertexBuffer

virtual void bindVertexBuffer(
    CommandBuffer * commandBuffer,
    Buffer * buffer,
    uint32_t location,
    uint32_t stride
) =0

Reimplemented by: ngfx::VKGraphics::bindVertexBuffer, ngfx::D3DGraphics::bindVertexBuffer, ngfx::MTLGraphics::bindVertexBuffer

function bindIndexBuffer

virtual void bindIndexBuffer(
    CommandBuffer * commandBuffer,
    Buffer * buffer,
    IndexFormat indexFormat =INDEXFORMAT_UINT32
) =0

Reimplemented by: ngfx::VKGraphics::bindIndexBuffer, ngfx::D3DGraphics::bindIndexBuffer, ngfx::MTLGraphics::bindIndexBuffer

function bindUniformBuffer

virtual void bindUniformBuffer(
    CommandBuffer * commandBuffer,
    Buffer * buffer,
    uint32_t binding,
    ShaderStageFlags shaderStageFlags
) =0

Reimplemented by: ngfx::VKGraphics::bindUniformBuffer, ngfx::D3DGraphics::bindUniformBuffer, ngfx::MTLGraphics::bindUniformBuffer

function bindStorageBuffer

virtual void bindStorageBuffer(
    CommandBuffer * commandBuffer,
    Buffer * buffer,
    uint32_t binding,
    ShaderStageFlags shaderStageFlags
) =0

Reimplemented by: ngfx::VKGraphics::bindStorageBuffer, ngfx::D3DGraphics::bindStorageBuffer, ngfx::MTLGraphics::bindStorageBuffer

function bindComputePipeline

virtual void bindComputePipeline(
    CommandBuffer * cmdBuffer,
    ComputePipeline * computePipeline
) =0

Reimplemented by: ngfx::VKGraphics::bindComputePipeline, ngfx::D3DGraphics::bindComputePipeline, ngfx::MTLGraphics::bindComputePipeline

function bindGraphicsPipeline

virtual void bindGraphicsPipeline(
    CommandBuffer * cmdBuffer,
    GraphicsPipeline * graphicsPipeline
) =0

Reimplemented by: ngfx::VKGraphics::bindGraphicsPipeline, ngfx::D3DGraphics::bindGraphicsPipeline, ngfx::MTLGraphics::bindGraphicsPipeline

function bindTexture

virtual void bindTexture(
    CommandBuffer * commandBuffer,
    Texture * texture,
    uint32_t set
) =0

Reimplemented by: ngfx::VKGraphics::bindTexture, ngfx::D3DGraphics::bindTexture, ngfx::MTLGraphics::bindTexture

function draw

virtual void draw(
    CommandBuffer * cmdBuffer,
    uint32_t vertexCount,
    uint32_t instanceCount =1,
    uint32_t firstVertex =0,
    uint32_t firstInstance =0
) =0

Reimplemented by: ngfx::VKGraphics::draw, ngfx::D3DGraphics::draw, ngfx::MTLGraphics::draw

function drawIndexed

virtual void drawIndexed(
    CommandBuffer * cmdBuffer,
    uint32_t indexCount,
    uint32_t instanceCount =1,
    uint32_t firstIndex =0,
    int32_t vertexOffset =0,
    uint32_t firstInstance =0
) =0

Reimplemented by: ngfx::VKGraphics::drawIndexed, ngfx::D3DGraphics::drawIndexed, ngfx::MTLGraphics::drawIndexed

function dispatch

virtual void dispatch(
    CommandBuffer * cmdBuffer,
    uint32_t groupCountX,
    uint32_t groupCountY,
    uint32_t groupCountZ,
    uint32_t threadsPerGroupX,
    uint32_t threadsPerGroupY,
    uint32_t threadsPerGroupZ
) =0

Reimplemented by: ngfx::VKGraphics::dispatch, ngfx::MTLGraphics::dispatch, ngfx::D3DGraphics::dispatch

function setViewport

virtual void setViewport(
    CommandBuffer * cmdBuffer,
    Rect2D rect
) =0

Reimplemented by: ngfx::VKGraphics::setViewport, ngfx::MTLGraphics::setViewport, ngfx::D3DGraphics::setViewport

function setScissor

virtual void setScissor(
    CommandBuffer * cmdBuffer,
    Rect2D rect
) =0

Reimplemented by: ngfx::VKGraphics::setScissor, ngfx::MTLGraphics::setScissor, ngfx::D3DGraphics::setScissor

function waitIdle

virtual void waitIdle(
    CommandBuffer * cmdBuffer
) =0

Reimplemented by: ngfx::VKGraphics::waitIdle, ngfx::MTLGraphics::waitIdle, ngfx::D3DGraphics::waitIdle

Public Attributes Documentation

variable scissorRect

Rect2D scissorRect;

variable viewport

Rect2D viewport;

variable currentPipeline

Pipeline * currentPipeline = nullptr;

variable currentRenderPass

RenderPass * currentRenderPass = nullptr;

variable currentFramebuffer

Framebuffer * currentFramebuffer = nullptr;

Protected Attributes Documentation

variable ctx

GraphicsContext * ctx;

Updated on 3 April 2021 at 20:21:51 PDT