3#include "resources/Mesh.hpp"
4#include "resources/Texture.hpp"
5#include "resources/Buffer.hpp"
6#include "graphics/GPUTypes.hpp"
7#include "graphics/Program.hpp"
64 static bool setup(
const std::string & appName);
80 static void createGraphicsProgram(
Program & program,
const std::string & vertexContent,
const std::string & fragmentContent,
const std::string & tessControlContent,
const std::string & tessEvalContent,
const std::string & debugInfos);
210 static GPUAsyncTask
downloadTextureAsync(
const Texture& texture,
const glm::uvec2& offset,
const glm::uvec2& size, uint layerCount, std::function<
void(
const Texture&)> callback);
245 static void uploadBuffer(
const Buffer & buffer,
size_t size, uchar * data,
size_t offset = 0);
304 static void dispatch(uint width, uint height, uint depth);
320 static void deviceInfos(std::string & vendor, std::string & renderer, std::string & version, std::string & shaderVersion);
333 static void setViewport(
int x,
int y,
int w,
int h);
404 static void setColorState(
bool writeRed,
bool writeGreen,
bool writeBlue,
bool writeAlpha);
446 static void blit(
const Texture & src,
const Texture & dst,
size_t lSrc,
size_t lDst,
size_t mipSrc,
size_t mipDst,
Filter filter);
General purpose GPU buffer, with different use types determining its memory type, visibility and acce...
Definition: Buffer.hpp:10
Store data in a GPU buffer.
Definition: GPUObjects.hpp:86
Provide utility functions to communicate with the driver and GPU.
Definition: GPU.hpp:20
static void createGraphicsProgram(Program &program, const std::string &vertexContent, const std::string &fragmentContent, const std::string &tessControlContent, const std::string &tessEvalContent, const std::string &debugInfos)
Definition: GPU.cpp:330
static void setStencilState(bool test, bool write)
Definition: GPU.cpp:1558
static void setViewport(int x, int y, int w, int h)
Definition: GPU.cpp:1527
static void setPolygonState(PolygonMode mode)
Definition: GPU.cpp:1593
static Metrics _metricsPrevious
Internal metrics for the last completed frame.
Definition: GPU.hpp:518
static void downloadTextureSync(Texture &texture)
Definition: GPU.cpp:940
static void setupBuffer(Buffer &buffer)
Definition: GPU.cpp:1080
static void saveTexture(Texture &texture, const std::string &path, Image::Save options)
Definition: GPU.cpp:551
static void nextFrame()
Definition: GPU.cpp:1457
static void bindAttachments(uint layer, uint mip, const Load &colorOp, const Load &depthOp, const Load &stencilOp, const Texture *depthStencil, const Texture *color0, const Texture *color1, const Texture *color2, const Texture *color3)
Definition: GPU.cpp:423
static void deviceInfos(std::string &vendor, std::string &renderer, std::string &version, std::string &shaderVersion)
Definition: GPU.cpp:1469
static bool setupWindow(Window *window)
Definition: GPU.cpp:178
static void bindGraphicsPipelineIfNeeded()
Definition: GPU.cpp:1305
static Mesh _quad
Screen-covering triangle.
Definition: GPU.hpp:519
static void generateMipMaps(const Texture &texture)
Definition: GPU.cpp:944
static void clean(GPUTexture &tex)
Definition: GPU.cpp:1721
static void createComputeProgram(Program &program, const std::string &computeContent, const std::string &debugInfos)
Definition: GPU.cpp:370
static void flush()
Definition: GPU.cpp:1443
static void beginRender(const Load &depthOp, const Load &stencilOp, const Texture *depthStencil, const Load &colorOp, const Texture *color0=nullptr, const Texture *color1=nullptr, const Texture *color2=nullptr, const Texture *color3=nullptr)
Definition: GPU.cpp:394
static void dispatch(uint width, uint height, uint depth)
Definition: GPU.cpp:1389
static void beginFrameCommandBuffers()
Definition: GPU.cpp:1413
static GPUAsyncTask downloadTextureAsync(const Texture &texture, const glm::uvec2 &offset, const glm::uvec2 &size, uint layerCount, std::function< void(const Texture &)> callback)
Definition: GPU.cpp:906
static void getState(GPUState &state)
Definition: GPU.cpp:1683
static void submitFrameCommandBuffers()
Definition: GPU.cpp:1423
static void drawMesh(const Mesh &mesh)
Definition: GPU.cpp:1356
static Metrics _metrics
Internal metrics (draw count, state changes,...).
Definition: GPU.hpp:517
static const Metrics & getMetrics()
Definition: GPU.cpp:1688
static void cancelAsyncOperation(const GPUAsyncTask &id)
Definition: GPU.cpp:931
static void setupMesh(Mesh &mesh)
Definition: GPU.cpp:1218
static void endRender()
Definition: GPU.cpp:1657
static bool setup(const std::string &appName)
Definition: GPU.cpp:44
static GPUContext * getInternal()
Definition: GPU.cpp:40
static void setCullState(bool cull)
Definition: GPU.cpp:1584
static void endRenderingIfNeeded()
Definition: GPU.cpp:1647
static void clearDepth(const Texture &texture, float depth)
Definition: GPU.cpp:1054
static void processDestructionRequests()
Definition: GPU.cpp:1786
static void clearTexture(const Texture &texture, const glm::vec4 &color)
Definition: GPU.cpp:1027
static std::vector< std::string > supportedExtensions()
Definition: GPU.cpp:1493
static void uploadTexture(const Texture &texture)
Definition: GPU.cpp:718
static void setupTexture(Texture &texture)
Definition: GPU.cpp:575
static void cleanup()
Definition: GPU.cpp:1692
static void setColorState(bool writeRed, bool writeGreen, bool writeBlue, bool writeAlpha)
Definition: GPU.cpp:1597
static void setDepthState(bool test)
Definition: GPU.cpp:1548
static void downloadBufferSync(const Buffer &buffer, size_t size, uchar *data, size_t offset=0)
Definition: GPU.cpp:1173
static GPUState _state
Current GPU state.
Definition: GPU.hpp:515
static void bindComputePipelineIfNeeded()
Definition: GPU.cpp:1331
static void blitDepth(const Texture &src, const Texture &dst)
Definition: GPU.cpp:1604
static void bindProgram(const Program &program)
Definition: GPU.cpp:386
static void processAsyncTasks(bool forceAll=false)
Definition: GPU.cpp:1815
static void drawTesselatedMesh(const Mesh &mesh, uint patchSize)
Definition: GPU.cpp:1370
static void uploadBuffer(const Buffer &buffer, size_t size, uchar *data, size_t offset=0)
Definition: GPU.cpp:1135
static GPUState _lastState
Previous draw call GPU state for caching.
Definition: GPU.hpp:516
static void flushBuffer(const Buffer &buffer, size_t size, size_t offset)
Definition: GPU.cpp:1210
static void blit(const Texture &src, const Texture &dst, Filter filter)
Definition: GPU.cpp:1608
static void setBlendState(bool test)
Definition: GPU.cpp:1573
static void drawQuad()
Definition: GPU.cpp:1376
Store vertices and triangles data on the GPU, linked by an array object.
Definition: GPUObjects.hpp:125
Internal GPU state ; not all API options are exposed, only these that can be toggled in Rendu.
Definition: GPUTypes.hpp:324
Store a texture data on the GPU.
Definition: GPUObjects.hpp:18
Save
Options for saving an image to disk.
Definition: Image.hpp:13
Represents a geometric mesh composed of vertices, other attributes and triangles.
Definition: Mesh.hpp:15
Create and reuse GPU pipelines based on a given state. This supports both graphics and compute pipeli...
Definition: PipelineCache.hpp:18
Represents a group of shaders used for rendering.
Definition: Program.hpp:31
A swapchain handles the creation and presentation of the backbuffer, along with GPU work submission a...
Definition: Swapchain.hpp:16
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12
Represent an OS window and its associated rendering context.
Definition: Window.hpp:14
BlendFunction
How the source and destination values to blend are obtained from the pixel data by scaling.
Definition: GPUTypes.hpp:110
BlendEquation
Blending mix equation for each component. Below we use src and dst to denote the (modulated by the bl...
Definition: GPUTypes.hpp:95
Filter
The filtering mode of a texture: we deduce the magnification filter from the minification filter for ...
Definition: GPUTypes.hpp:198
StencilOp
Stencil operation to perform.
Definition: GPUTypes.hpp:76
PolygonMode
How polygons should be rasterized.
Definition: GPUTypes.hpp:141
TestFunction
Depth or stencil test function.
Definition: GPUTypes.hpp:59
Faces
Used to select a subset of faces. Front faces are defined counter-clockwise.
Definition: GPUTypes.hpp:129
unsigned long long downloads
Data download from the GPU.
Definition: GPU.hpp:35
unsigned long long buffers
Buffers created.
Definition: GPU.hpp:37
void resetPerFrameMetrics()
Reset metrics that are measured over one frame.
Definition: GPU.hpp:50
unsigned long long textures
Textures created.
Definition: GPU.hpp:36
unsigned long long blitCount
Texture blitting operations.
Definition: GPU.hpp:47
unsigned long long programs
Programs created.
Definition: GPU.hpp:38
unsigned long long quadCalls
Full screen quad.
Definition: GPU.hpp:43
unsigned long long meshBindings
Number of mesh bindings.
Definition: GPU.hpp:46
unsigned long long renderPasses
Number of render passes.
Definition: GPU.hpp:45
unsigned long long pipelineBindings
Number of pipeline set operations.
Definition: GPU.hpp:44
unsigned long long pipelines
Pipelines created.
Definition: GPU.hpp:39
unsigned long long uploads
Data upload to the GPU.
Definition: GPU.hpp:34
unsigned long long drawCalls
Mesh draw call.
Definition: GPU.hpp:42
Global GPU context, storing all structures used for resource allocation and tracking,...
Definition: GPUInternal.hpp:72
Detailed operation to perform when binding a texture (starting a renderpass).
Definition: GPUTypes.hpp:278
@ DONTCARE
Anything can be done, usually because we will overwrite data everywhere.