8.9 KiB
Juliet\include\Graphics\Graphics
Source Files
- Header:
Juliet\include\Graphics\Graphics.h - Source:
Juliet\src\Graphics\Graphics.cpp
AI Description
The provided code snippet is a C++ implementation of a graphics rendering engine using the Juliet library. It includes functions for managing render passes, shaders, and graphics buffers. The RenderPass class represents a set of commands that can be executed together to draw graphics. The CommandList class manages a list of commands that are executed on a GPU.
Here's a brief overview of the key functionalities:
-
Rendering Pass Management:
BeginRenderPass: Begins a new render pass with specified color and depth/stencil targets.EndRenderPass: Ends the current render pass.SetGraphicsViewPort,SetScissorRect,SetBlendConstants,SetStencilReference: Set various rendering state parameters.
-
Shader Management:
CreateShader: Loads a shader from a file and creates a shader object.DestroyShader: Destroys a previously created shader object.
-
Graphics Pipeline Management:
CreateGraphicsPipeline: Creates a graphics pipeline with specified create information.DestroyGraphicsPipeline: Destroys a previously created graphics pipeline object.
-
Buffer Management:
CreateGraphicsBuffer,CreateGraphicsTransferBuffer: Create buffers for storing graphics data.MapGraphicsBuffer,UnmapGraphicsBuffer,MapGraphicsTransferBuffer,UnmapGraphicsTransferBuffer: Map and unmap memory from the GPU.CopyBuffer,CopyBufferToTexture,TransitionBufferToReadable: Copy data between buffers or transfer data to/from textures.
-
Descriptor Management:
GetDescriptorIndex: Retrieve the descriptor index for a buffer or texture.
-
Resource Destruction:
DestroyGraphicsBuffer,DestroyGraphicsTransferBuffer: Destroy previously created graphics buffer and transfer buffer objects.
This code snippet provides a comprehensive set of tools for managing graphics resources in a C++ application using the Juliet library, allowing developers to create complex 3D scenes efficiently.
Symbols
Namespace Juliet
Classes, Structs & Unions
struct IndirectDrawCommandstruct IndexedIndirectDrawCommandstruct IndirectDispatchCommandstruct GraphicsViewPort
Enums
enum class QueueTypeenum class IndexFormatenum structenum struct
Functions & Methods
-
extern JULIET_API GraphicsDevice* CreateGraphicsDevice(GraphicsConfig config) -
extern JULIET_API void DestroyGraphicsDevice(NonNullPtr<GraphicsDevice> device) -
// Attach To Window extern JULIET_API bool AttachToWindow(NonNullPtr<GraphicsDevice> device, NonNullPtr<Window> window) -
extern JULIET_API void DetachFromWindow(NonNullPtr<GraphicsDevice> device, NonNullPtr<Window> window) -
// SwapChain extern JULIET_API bool AcquireSwapChainTexture(NonNullPtr<CommandList> commandList, NonNullPtr<Window> window, Texture** swapChainTexture) -
extern JULIET_API bool WaitAndAcquireSwapChainTexture(NonNullPtr<CommandList> commandList, NonNullPtr<Window> window, Texture** swapChainTexture) -
extern JULIET_API bool WaitForSwapchain(NonNullPtr<GraphicsDevice> device, NonNullPtr<Window> window) -
extern JULIET_API TextureFormat GetSwapChainTextureFormat(NonNullPtr<GraphicsDevice> device, NonNullPtr<Window> window) -
// Textures extern JULIET_API Texture* CreateTexture(NonNullPtr<GraphicsDevice> device, const TextureCreateInfo& createInfo) -
extern JULIET_API void DestroyTexture(NonNullPtr<GraphicsDevice> device, NonNullPtr<Texture> texture) -
// Command List extern JULIET_API CommandList* AcquireCommandList(NonNullPtr<GraphicsDevice> device, QueueType queueType = QueueType::Graphics) -
extern JULIET_API void SubmitCommandLists(NonNullPtr<CommandList> commandList) -
// RenderPass extern JULIET_API RenderPass* BeginRenderPass(NonNullPtr<CommandList> commandList, ColorTargetInfo& colorTargetInfo, DepthStencilTargetInfo* depthStencilTargetInfo = nullptr) -
extern JULIET_API RenderPass* BeginRenderPass(NonNullPtr<CommandList> commandList, NonNullPtr<const ColorTargetInfo> colorTargetInfos, uint32 colorTargetInfoCount, DepthStencilTargetInfo* depthStencilTargetInfo = nullptr) -
extern JULIET_API void EndRenderPass(NonNullPtr<RenderPass> renderPass) -
extern JULIET_API void SetGraphicsViewPort(NonNullPtr<RenderPass> renderPass, const GraphicsViewPort& viewPort) -
extern JULIET_API void SetScissorRect(NonNullPtr<RenderPass> renderPass, const Rectangle& rectangle) -
extern JULIET_API void SetBlendConstants(NonNullPtr<RenderPass> renderPass, FColor blendConstants) -
extern JULIET_API void SetStencilReference(NonNullPtr<RenderPass> renderPass, uint8 reference) -
extern JULIET_API void BindGraphicsPipeline(NonNullPtr<RenderPass> renderPass, NonNullPtr<GraphicsPipeline> graphicsPipeline) -
extern JULIET_API void DrawPrimitives(NonNullPtr<RenderPass> renderPass, uint32 numVertices, uint32 numInstances, uint32 firstVertex, uint32 firstInstance) -
extern JULIET_API void DrawIndexedPrimitives(NonNullPtr<RenderPass> renderPass, uint32 numIndices, uint32 numInstances, uint32 firstIndex, uint32 vertexOffset, uint32 firstInstance) -
extern JULIET_API void SetIndexBuffer(NonNullPtr<CommandList> commandList, NonNullPtr<GraphicsBuffer> buffer, IndexFormat format, size_t indexCount, index_t offset) -
extern JULIET_API void SetPushConstants(NonNullPtr<CommandList> commandList, ShaderStage stage, uint32 rootParameterIndex, uint32 numConstants, const void* constants) -
// Fences extern JULIET_API bool WaitUntilGPUIsIdle(NonNullPtr<GraphicsDevice> device) -
// Shaders extern JULIET_API Shader* CreateShader(NonNullPtr<GraphicsDevice> device, String filename, ShaderCreateInfo& shaderCreateInfo) -
extern JULIET_API void DestroyShader(NonNullPtr<GraphicsDevice> device, NonNullPtr<Shader> shader) -
// Pipelines extern JULIET_API GraphicsPipeline* CreateGraphicsPipeline(NonNullPtr<GraphicsDevice> device, const GraphicsPipelineCreateInfo& createInfo) -
extern JULIET_API void DestroyGraphicsPipeline(NonNullPtr<GraphicsDevice> device, NonNullPtr<GraphicsPipeline> graphicsPipeline) -
#if ALLOW_SHADER_HOT_RELOAD // Allows updating the graphics pipeline shaders. Can update either one or both shaders. extern JULIET_API bool UpdateGraphicsPipelineShaders(NonNullPtr<GraphicsDevice> device, NonNullPtr<GraphicsPipeline> graphicsPipeline, Shader* optional_vertexShader, Shader* optional_fragmentShader) -
`#endif
// Buffers extern JULIET_API GraphicsBuffer* CreateGraphicsBuffer(NonNullPtr device, const BufferCreateInfo& createInfo)`
-
extern JULIET_API GraphicsTransferBuffer* CreateGraphicsTransferBuffer(NonNullPtr<GraphicsDevice> device, const TransferBufferCreateInfo& createInfo) -
extern JULIET_API void* MapGraphicsBuffer(NonNullPtr<GraphicsDevice> device, NonNullPtr<GraphicsBuffer> buffer) -
extern JULIET_API void UnmapGraphicsBuffer(NonNullPtr<GraphicsDevice> device, NonNullPtr<GraphicsBuffer> buffer) -
extern JULIET_API void* MapGraphicsTransferBuffer(NonNullPtr<GraphicsDevice> device, NonNullPtr<GraphicsTransferBuffer> buffer) -
extern JULIET_API void UnmapGraphicsTransferBuffer(NonNullPtr<GraphicsDevice> device, NonNullPtr<GraphicsTransferBuffer> buffer) -
extern JULIET_API void CopyBuffer(NonNullPtr<CommandList> commandList, NonNullPtr<GraphicsBuffer> dst, NonNullPtr<GraphicsTransferBuffer> src, size_t size, size_t dstOffset = 0, size_t srcOffset = 0) -
extern JULIET_API void CopyBufferToTexture(NonNullPtr<CommandList> commandList, NonNullPtr<Texture> dst, NonNullPtr<GraphicsTransferBuffer> src) -
extern JULIET_API void TransitionBufferToReadable(NonNullPtr<CommandList> commandList, NonNullPtr<GraphicsBuffer> buffer) -
extern JULIET_API uint32 GetDescriptorIndex(NonNullPtr<GraphicsDevice> device, NonNullPtr<GraphicsBuffer> buffer) -
extern JULIET_API uint32 GetDescriptorIndex(NonNullPtr<GraphicsDevice> device, NonNullPtr<Texture> texture) -
extern JULIET_API void DestroyGraphicsBuffer(NonNullPtr<GraphicsDevice> device, NonNullPtr<GraphicsBuffer> buffer) -
extern JULIET_API void DestroyGraphicsTransferBuffer(NonNullPtr<GraphicsDevice> device, NonNullPtr<GraphicsTransferBuffer> buffer)