blah/src/internal/graphics_backend.h

60 lines
1.6 KiB
C
Raw Normal View History

2020-12-24 08:16:09 +08:00
#pragma once
#include <blah/core/app.h>
2020-12-27 06:44:48 +08:00
#include <blah/graphics/renderpass.h>
#include <blah/graphics/texture.h>
#include <blah/graphics/framebuffer.h>
#include <blah/graphics/shader.h>
#include <blah/graphics/mesh.h>
#include <blah/graphics/material.h>
#include <blah/math/color.h>
2020-12-24 08:16:09 +08:00
namespace Blah
{
2020-12-24 08:57:49 +08:00
// Graphics backend API used for rendering.
// All rendering ends up going through here.
2020-12-24 08:16:09 +08:00
namespace GraphicsBackend
{
2020-12-24 08:57:49 +08:00
// Initializes the graphics backend
2020-12-24 08:16:09 +08:00
bool init();
2020-12-24 08:57:49 +08:00
// Shuts down the graphics backend
2020-12-24 08:16:09 +08:00
void shutdown();
2020-12-24 08:57:49 +08:00
// Returns info about the renderer
2020-12-27 06:44:48 +08:00
const RendererFeatures& features();
2020-12-24 08:57:49 +08:00
// Returns the renderer type
2020-12-27 06:44:48 +08:00
Renderer renderer();
2020-12-24 08:57:49 +08:00
// Called once per frame
2020-12-24 08:16:09 +08:00
void frame();
2020-12-24 08:57:49 +08:00
// Called before rendering begins
2020-12-24 08:16:09 +08:00
void before_render();
2020-12-24 08:57:49 +08:00
// Called after renderings ends
2020-12-24 08:16:09 +08:00
void after_render();
2020-12-24 08:57:49 +08:00
// Performs a draw call
2020-12-27 06:44:48 +08:00
void render(const RenderPass& pass);
2020-12-24 08:57:49 +08:00
2020-12-27 06:44:48 +08:00
// Clears the backbuffer
void clear_backbuffer(Color color, float depth, uint8_t stencil, ClearMask mask);
2020-12-24 08:16:09 +08:00
2020-12-24 08:57:49 +08:00
// Creates a new Texture.
// if the Texture is invalid, this should return an empty reference.
TextureRef create_texture(int width, int height, TextureFormat format);
2020-12-24 08:57:49 +08:00
// Creates a new FrameBuffer.
// if the FrameBuffer is invalid, this should return an empty reference.
FrameBufferRef create_framebuffer(int width, int height, const TextureFormat* attachments, int attachment_count);
2020-12-24 08:57:49 +08:00
// Creates a new Shader.
// if the Shader is invalid, this should return an empty reference.
2020-12-24 08:16:09 +08:00
ShaderRef create_shader(const ShaderData* data);
2020-12-24 08:57:49 +08:00
// Creates a new Mesh.
// if the Mesh is invalid, this should return an empty reference.
2020-12-24 08:16:09 +08:00
MeshRef create_mesh();
}
}