Skip to content

Commit

Permalink
Define API for rendering to a texture
Browse files Browse the repository at this point in the history
  • Loading branch information
SirBob01 committed Nov 2, 2024
1 parent c15bb90 commit 15e3643
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Graphics/Renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <Graphics/Vulkan/Swapchain.hpp>
#include <Graphics/Vulkan/TextureRegistry.hpp>
#include <Graphics/Vulkan/UniformRegistry.hpp>
#include <Math/Box2.hpp>
#include <Math/Color.hpp>

namespace Dynamo::Graphics {
Expand Down Expand Up @@ -55,6 +56,7 @@ namespace Dynamo::Graphics {
// TODO - Fixes:
// * Pre-defined render pass ---- Define a default render pass to handle the no-draw case
// * Memory defragmentation stategy
// * Memory pool buffer suballocation

// TODO - Features:
// * Live update texture? --- Support non-shader-optimal image layouts
Expand Down Expand Up @@ -193,5 +195,15 @@ namespace Dynamo::Graphics {
*
*/
void render();

/**
* @brief Render to a texture.
*
* The texture must have been created with "RenderTarget" usage on.
*
* @param texture
* @param extent
*/
void render(Texture texture, const Box2 &extent);
};
} // namespace Dynamo::Graphics
16 changes: 16 additions & 0 deletions src/Graphics/Texture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ namespace Dynamo::Graphics {
ClampBorder,
};

/**
* @brief Texture usage, determines how the texture will be stored in GPU memory.
*
*/
enum class TextureUsage {
Static,
Dynamic,
RenderTarget,
};

/**
* @brief Texture descriptor.
*
Expand Down Expand Up @@ -71,6 +81,12 @@ namespace Dynamo::Graphics {
*/
TextureFormat format = TextureFormat::U8_RGBA_Norm;

/**
* @brief Texture usage.
*
*/
TextureUsage usage = TextureUsage::Static;

/**
* @brief Minification filter.
*
Expand Down

0 comments on commit 15e3643

Please sign in to comment.