Foundation
Loading...
Searching...
No Matches
CSDebugText.hpp
Go to the documentation of this file.
1#pragma once
2#include <Core/Paths.hpp>
5{
6 using namespace RenderCore;
7#pragma pack(push,1)
9 {
10 int x = 0u, y = 0u, scale = 2u, col32 = -1;
11 char szText[28 * 4]; // Zero terminated
12
14 {
15 size_t len = std::min(str.size(), sizeof(szText) - 1);
16 std::memcpy(szText, str.data(), len);
17 szText[len] = '\0';
18 }
19 int SetColor(int r, int g, int b, int a = 255)
20 {
21 return col32 = a << 24 | b << 16 | g << 8 | r;
22 }
23 };
24#pragma pack(pop)
30 {
31 return r->CreatePass(
32 name, RHIDeviceQueueType::Graphics, 0u,
34 {
35 r->BindBackbufferUAV(self, 0u);
36 r->BindShader(self, RHIShaderStageBits::Compute, "debugText", Foundation::Core::PathsResolve("Data/Shaders/CSDebugText.spv"));
37 r->BindPushConstant(self, RHIShaderStageBits::Compute, 0, sizeof(CSDebugTextData));
38 },
40 {
41 r->CmdSetPipeline(self, cmd);
42 for (auto const& line : lines)
43 {
44 if (size_t len = strlen(line.szText))
45 {
46 r->CmdSetPushConstant(self, cmd, RHIShaderStageBits::Compute, 0, line);
47 cmd->Dispatch(len,1,1);
48 }
49 }
50 });
51 }
52} // namespace Foundation::RenderUtils
Definition Command.hpp:42
Renderer implementing a Frame Graph system with automatic resource tracking and synchronization.
Definition Renderer.hpp:89
std::basic_string_view< char > StringView
Alias for std::basic_string_view<char>
Definition Container.hpp:55
T * Construct(Allocator *resource, Args &&...args)
Convenience placement new with object of type T using a Foundation::Core::Allocator.
Definition Allocator.hpp:153
std::span< T > Span
Alias for std::span
Definition Container.hpp:60
String PathsResolve(StringView relPath)
Definition Paths.cpp:18
Handle PassHandle
Definition RenderPass.hpp:10
Definition CSClearBuffer.hpp:6
PassHandle createCSDebugTextPassBackBuffer(Renderer *r, StringView name, Span< const CSDebugTextData > lines)
Definition CSDebugText.hpp:29
Definition CSDebugText.hpp:9
int scale
Definition CSDebugText.hpp:10
int SetColor(int r, int g, int b, int a=255)
Definition CSDebugText.hpp:19
int x
Definition CSDebugText.hpp:10
void SetText(StringView str)
Definition CSDebugText.hpp:13
int y
Definition CSDebugText.hpp:10
int col32
Definition CSDebugText.hpp:10
char szText[28 *4]
Definition CSDebugText.hpp:11