8using namespace RenderCore;
11 RHIResourceFormat::R8G8B8A8Unorm, RHIResourceFormat::B8G8R8A8Unrom, RHIResourceFormat::R8G8B8A8Srgb,
12 RHIResourceFormat::B8G8R8A8Srgb};
15 RHISwapchainPresentMode::Mailbox, RHISwapchainPresentMode::Tearing, RHISwapchainPresentMode::Fifo};
23 SDL_GetWindowSizeInPixels(window, &w, &h);
24 LOG(RenderApplication,
LogDebug,
"Creating swapchain ({}x{})", w, h);
32 CHECK_MSG(format.has_value(),
"No supported swapchain format found!");
33 LOG(RenderApplication,
LogDebug,
"Selected swapchain format: {}", format.value());
34 CHECK_MSG(present.has_value(),
"No supported presentation mode found!");
35 LOG(RenderApplication,
LogDebug,
"Selected swapchain present mode: {}", present.value());
40 .presentMode = present.value(),
49 auto device =
app->CreateDevice({},
window);
53 return std::make_tuple(
renderer,
app, std::move(device), std::move(
swap));
121 static constexpr char kControlsText[] =
"Mouse Left: Rotate | Mouse Right: Pan | Mouse Wheel: Zoom";
134 pitch -=
event.motion.xrel * 1e-2f;
135 yaw -=
event.motion.yrel * 1e-2f;
#define GLOBAL_ALLOC
Definition Allocator.hpp:221
constexpr int Examples_SDLWindowFlagsVulkan
Definition Examples.hpp:45
constexpr RHISwapchainPresentMode kPresentModePreferenceList[]
Definition Examples.hpp:14
bool Examples_ShouldClose(SDL_Window *window, Renderer *renderer, RHIDeviceScopedHandle< RHISwapchain > &swap, SDL_Event *outEvent=nullptr)
Definition Examples.hpp:56
constexpr RHIResourceFormat kFormatPreferenceList[]
Definition Examples.hpp:10
float Examples_GetTime()
Definition Examples.hpp:92
void Examples_NewFrame(Renderer *renderer)
Definition Examples.hpp:75
auto Examples_InitVulkan(SDL_Window *window, RendererDesc const &desc={})
Definition Examples.hpp:46
auto Examples_DestroyVulkan(SDL_Window *window, Renderer *renderer, VulkanApplication *app, RHIApplicationScopedHandle< RHIDevice > &device, RHIDeviceScopedHandle< RHISwapchain > &swapchain)
Definition Examples.hpp:81
#define LOG(TAG, LEVEL, FORMAT,...)
Definition Logging.hpp:43
#define CHECK_MSG(expr, format_str,...)
Definition Logging.hpp:50
@ LogDebug
Definition Logging.hpp:10
Definition Device.hpp:162
virtual Span< RHISwapchainPresentMode const > GetSwapchainSupportedPresentModes() const =0
virtual Span< RHIResourceFormat const > GetSwapchainSupportedFormats() const =0
virtual void WaitIdle() const =0
virtual RHIDeviceScopedHandle< RHISwapchain > CreateSwapchain(RHISwapchain::SwapchainDesc const &desc)=0
Scoped move-only RAII handle wrapper for RHI Objects.
Definition Details.hpp:86
void Reset()
Destructs the underlying RHIObject, and invalidates the scoped handle.
Definition Details.hpp:127
Definition Application.hpp:16
Renderer implementing a Frame Graph system with automatic resource tracking and synchronization.
Definition Renderer.hpp:78
constexpr Optional< range_value_t< T > > FirstOf(T &&range)
Returns the first element of a range, or an empty Optional if the range is empty.
Definition Container.hpp:231
void Destruct(Allocator *resource, T *obj)
Convenience destructor for objects allocated with Construct or ConstructBase.
Definition Allocator.hpp:156
T * Construct(Allocator *resource, Args &&...args)
Convenience placement new with object of type T using a Foundation::Core::Allocator.
Definition Allocator.hpp:149
vec3 float3
Definition Math.hpp:26
mat4 infinitePerspectiveRHReverseZ(float fovY, float a, float zNear)
Definition ModelViewProjection.hpp:7
mat4 viewMatrixRHReverseZ(vec3 pos, quat rot)
Definition ModelViewProjection.hpp:26
RHISwapchainPresentMode
Definition Swapchain.hpp:11
glm::vec< 3, uint32_t > RHIExtent3D
Definition Common.hpp:11
RHIResourceFormat
Definition Common.hpp:20
Definition Allocator.hpp:5
Definition Examples.hpp:18
void CreateSwapchain(SDL_Window *window, RHIDevice *device, RHIDeviceScopedHandle< RHISwapchain > &outSwap)
Definition Examples.hpp:19
Definition Examples.hpp:99
size_t lastTick
Definition Examples.hpp:100
float fps
Definition Examples.hpp:102
float Update()
Definition Examples.hpp:103
size_t frames
Definition Examples.hpp:101
Definition Examples.hpp:120
float3 center
Definition Examples.hpp:123
float radius
Definition Examples.hpp:124
float yaw
Definition Examples.hpp:125
float zNear
Definition Examples.hpp:126
static constexpr char kControlsText[]
Definition Examples.hpp:121
float fovY
Definition Examples.hpp:126
float pitch
Definition Examples.hpp:125
mat4 view
Definition Examples.hpp:127
mat4 Update(SDL_Event const &event)
Definition Examples.hpp:128
mat4 proj
Definition Examples.hpp:127
float aspect
Definition Examples.hpp:126
Range predicate that checks if a value is contained within a given range.
Definition Container.hpp:219
Definition Swapchain.hpp:23
RHIResourceFormat format
Definition Swapchain.hpp:25
Parameters for Renderer creation.
Definition Renderer.hpp:16