Renderpass first iteration

This commit is contained in:
2025-02-17 22:08:53 -05:00
parent 7e8aaaa891
commit ee194b2d69
28 changed files with 561 additions and 99 deletions

View File

@@ -0,0 +1,16 @@
#pragma once
namespace Juliet
{
template <typename Type>
struct ColorType
{
Type R;
Type G;
Type B;
Type A;
};
using FColor = ColorType<float>;
using Color = ColorType<uint8>;
} // namespace Juliet

View File

@@ -1,14 +1,16 @@
#pragma once
#include <core/Common/NonNullPtr.h>
#include <Core/HAL/Display/Display.h>
#include <Graphics/GraphicsConfig.h>
#include <Graphics/Texture.h>
#include <Graphics/RenderPass.h>
#include <Juliet.h>
// Graphics Interface
namespace Juliet
{
struct Window;
// Opaque types
struct CommandList;
struct GraphicsDevice;
// Parameters of an indirect draw command
@@ -65,9 +67,6 @@ namespace Juliet
Immediate
};
// Opaque types
struct CommandList;
extern JULIET_API GraphicsDevice* CreateGraphicsDevice(GraphicsConfig config);
extern JULIET_API void DestroyGraphicsDevice(NonNullPtr<GraphicsDevice> device);
@@ -82,4 +81,9 @@ namespace Juliet
// Command List
extern JULIET_API CommandList* AcquireCommandList(NonNullPtr<GraphicsDevice> device, QueueType queueType = QueueType::Graphics);
extern JULIET_API void SubmitCommandLists(NonNullPtr<GraphicsDevice> device);
// RenderPass
extern JULIET_API RenderPass* BeginRenderPass(NonNullPtr<CommandList> commandList, ColorTargetInfo& colorTargetInfo);
extern JULIET_API RenderPass* BeginRenderPass(NonNullPtr<CommandList> commandList,
NonNullPtr<const ColorTargetInfo> colorTargetInfos, uint32 colorTargetInfoCount);
} // namespace Juliet

View File

@@ -0,0 +1,40 @@
#pragma once
#include <Graphics/Colors.h>
#include <Graphics/Texture.h>
namespace Juliet
{
enum struct LoadOperation : uint8
{
Load, // Load the texture from memory (preserve)
Clear, // Clear the texture
Ignore // Ignore the content of the texture (undefined)
};
enum struct StoreOperation : uint8
{
Store, // Store the result of the render pass into memory
Ignore, // Whatever is generated is ignored (undefined)
Resolve, // Resolve MipMaps into non mip map texture. Discard MipMap content
ResolveAndStore // Same but store the MipMap content to memory
};
struct ColorTargetInfo
{
Texture* Texture;
uint32 MipLevel;
union
{
uint32 DepthPlane;
uint32 LayerCount;
};
FColor ClearColor;
LoadOperation LoadOperation;
StoreOperation StoreOperation;
bool Cycle; // Whether the texture should be cycled if already bound (and load operation != LOAD)
};
// Opaque Type
struct RenderPass;
} // namespace Juliet

View File

@@ -161,9 +161,9 @@ namespace Juliet
// Create Information structs
struct TextureCreateInfo
{
TextureType Type;
TextureFormat Format;
TextureUsageFlag Flags;
TextureType Type;
TextureFormat Format;
TextureUsageFlag Flags;
TextureSampleCount SampleCount;
uint32 Width;
@@ -171,10 +171,11 @@ namespace Juliet
union
{
uint32 LayerCount;
uint32 Depth;
uint32 DepthPlane;
}; // LayerCount is used in 2d array textures and Depth for 3d textures
uint32 MipLevelCount;
};
// Opaque Type
struct Texture;
} // namespace Juliet