Faro Engine 0.0.0.b519570 (main)
Loading...
Searching...
No Matches
GraphicsBufferDesc.hpp
Go to the documentation of this file.
1#pragma once
2#include <Primitives.hpp>
3#include <Math/Vector2.hpp>
4
5namespace Faro
6{
7 class GraphicsSwapchain;
8
9 /// @brief Describes the resource type of a graphics buffer.
11 {
12 RT_Texture, //< The data should be treated as a texture.
13 RT_ConstantBuffer, //< The data should be treated as a a constant buffer.
14 RT_VertexBuffer, //< The data should be treated as mesh vertices.
15 RT_IndexBuffer //< The data should be treated as mesh indices.
16 };
17
18 /// @brief Description of a graphics buffer
20 {
24
26 {
27 Int2D resolution = { 0, 0 };
28 bool renderTarget = false;
29 bool updatable = false;
30 bool shaderResource = false;
32
38
42
46
47 static GraphicsBufferDesc Texture2D(Int2D resolution, bool shaderResource = false, bool updatable = false)
48 {
51 desc.dataSize = resolution.x * resolution.y * 4;
52 desc.stride = resolution.x * 4;
53 desc.texture.resolution = resolution;
54 desc.texture.shaderResource = shaderResource;
55 desc.texture.updatable = updatable;
56 return desc;
57 }
58
59 static GraphicsBufferDesc RenderTarget(Int2D resolution, bool shaderResource = false)
60 {
63 desc.dataSize = resolution.x * resolution.y * 4;
64 desc.stride = resolution.x * 4;
65 desc.texture.resolution = resolution;
66 desc.texture.shaderResource = shaderResource;
67 desc.texture.renderTarget = true;
68 return desc;
69 }
70
72 {
75 desc.texture.renderTarget = true;
76 desc.renderTarget.swapchain = swapchain;
77 desc.renderTarget.swapchainImageIndex = imageIndex;
78 return desc;
79 }
80 };
81
82 /// @brief Determines the type of a graphics buffer
84 {
85 BT_Upload, ///< Uploads data from the CPU to the graphics adapter.
86 BT_Remote ///< Stores memory on the graphics adapter.
87 };
88
94}
Definition GraphicsSwapchain.hpp:16
Definition Array.hpp:8
GraphicsBufferType
Determines the type of a graphics buffer.
Definition GraphicsBufferDesc.hpp:84
@ BT_Remote
Stores memory on the graphics adapter.
Definition GraphicsBufferDesc.hpp:86
@ BT_Upload
Uploads data from the CPU to the graphics adapter.
Definition GraphicsBufferDesc.hpp:85
GraphicsResourceType
Describes the resource type of a graphics buffer.
Definition GraphicsBufferDesc.hpp:11
@ RT_IndexBuffer
Definition GraphicsBufferDesc.hpp:15
@ RT_ConstantBuffer
Definition GraphicsBufferDesc.hpp:13
@ RT_VertexBuffer
Definition GraphicsBufferDesc.hpp:14
@ RT_Texture
Definition GraphicsBufferDesc.hpp:12
uint32_t uint32
Definition Primitives.hpp:12
uint8_t uint8
Definition Primitives.hpp:6
Definition GraphicsBufferDesc.hpp:90
GraphicsBufferDesc bufferDesc
Definition GraphicsBufferDesc.hpp:92
GraphicsBufferType bufferType
Definition GraphicsBufferDesc.hpp:91
Definition GraphicsBufferDesc.hpp:40
Definition GraphicsBufferDesc.hpp:44
Definition GraphicsBufferDesc.hpp:34
GraphicsSwapchain * swapchain
Definition GraphicsBufferDesc.hpp:35
uint8 swapchainImageIndex
Definition GraphicsBufferDesc.hpp:36
Definition GraphicsBufferDesc.hpp:26
bool updatable
Definition GraphicsBufferDesc.hpp:29
bool shaderResource
Definition GraphicsBufferDesc.hpp:30
bool renderTarget
Definition GraphicsBufferDesc.hpp:28
Int2D resolution
Definition GraphicsBufferDesc.hpp:27
Description of a graphics buffer.
Definition GraphicsBufferDesc.hpp:20
struct Faro::GraphicsBufferDesc::ConstantBufferDesc constantBuffer
GraphicsResourceType resourceType
Definition GraphicsBufferDesc.hpp:21
struct Faro::GraphicsBufferDesc::RenderTargetDesc renderTarget
uint32 stride
Definition GraphicsBufferDesc.hpp:23
static GraphicsBufferDesc Texture2D(Int2D resolution, bool shaderResource=false, bool updatable=false)
Definition GraphicsBufferDesc.hpp:47
static GraphicsBufferDesc SwapchainImage(GraphicsSwapchain *swapchain, uint8 imageIndex)
Definition GraphicsBufferDesc.hpp:71
static GraphicsBufferDesc RenderTarget(Int2D resolution, bool shaderResource=false)
Definition GraphicsBufferDesc.hpp:59
struct Faro::GraphicsBufferDesc::TextureDesc texture
uint32 dataSize
Definition GraphicsBufferDesc.hpp:22
struct Faro::GraphicsBufferDesc::GeometryBufferDesc geometryBuffer
T x
Definition Vector2.hpp:14
T y
Definition Vector2.hpp:14