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