|
|
|
@ -8,15 +8,6 @@
|
|
|
|
|
#include "ft2build.h"
|
|
|
|
|
#include FT_FREETYPE_H
|
|
|
|
|
|
|
|
|
|
ColoredRect colored_rect(float width, float height, float r, float g, float b, float a, float x, float y, float z) {
|
|
|
|
|
ColoredRect rect = {
|
|
|
|
|
.size = {width, height},
|
|
|
|
|
.pos = {x, y, z},
|
|
|
|
|
.color = {r, g, b, a},
|
|
|
|
|
};
|
|
|
|
|
return rect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VkResult render_thread(GLFWwindow* window, RenderContext* render_context) {
|
|
|
|
|
VkResult result;
|
|
|
|
|
UIContext ui_context;
|
|
|
|
@ -42,7 +33,7 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render_context) {
|
|
|
|
|
|
|
|
|
|
VkBufferCreateInfo colored_rect_buffer_info = {
|
|
|
|
|
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
|
|
|
|
.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
|
|
|
|
|
.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
|
|
|
|
|
.size = 3*sizeof(ColoredRect),
|
|
|
|
|
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
|
|
|
|
|
};
|
|
|
|
@ -63,9 +54,36 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render_context) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
colored_rects[0] = colored_rect(100.0, 100.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.5);
|
|
|
|
|
colored_rects[1] = colored_rect(100.0, 100.0, 0.0, 1.0, 0.0, 1.0, 0.0, 100.0, 0.5);
|
|
|
|
|
colored_rects[2] = colored_rect(100.0, 100.0, 0.0, 0.0, 1.0, 1.0, 100.0, 0.0, 0.5);
|
|
|
|
|
colored_rects[0].pos[0] = 0.0;
|
|
|
|
|
colored_rects[0].pos[1] = 0.0;
|
|
|
|
|
colored_rects[0].pos[2] = 0.5;
|
|
|
|
|
colored_rects[0].size[0] = 100.0;
|
|
|
|
|
colored_rects[0].size[1] = 100.0;
|
|
|
|
|
colored_rects[0].color[0] = 1.0;
|
|
|
|
|
colored_rects[0].color[1] = 0.0;
|
|
|
|
|
colored_rects[0].color[2] = 0.0;
|
|
|
|
|
colored_rects[0].color[3] = 1.0;
|
|
|
|
|
|
|
|
|
|
colored_rects[1].pos[0] = 0.0;
|
|
|
|
|
colored_rects[1].pos[1] = 100.0;
|
|
|
|
|
colored_rects[1].pos[2] = 0.5;
|
|
|
|
|
colored_rects[1].size[0] = 100.0;
|
|
|
|
|
colored_rects[1].size[1] = 100.0;
|
|
|
|
|
colored_rects[1].color[0] = 0.0;
|
|
|
|
|
colored_rects[1].color[1] = 0.0;
|
|
|
|
|
colored_rects[1].color[2] = 1.0;
|
|
|
|
|
colored_rects[1].color[3] = 1.0;
|
|
|
|
|
|
|
|
|
|
colored_rects[2].pos[0] = 100.0;
|
|
|
|
|
colored_rects[2].pos[1] = 0.0;
|
|
|
|
|
colored_rects[2].pos[2] = 0.5;
|
|
|
|
|
colored_rects[2].size[0] = 100.0;
|
|
|
|
|
colored_rects[2].size[1] = 100.0;
|
|
|
|
|
colored_rects[2].color[0] = 0.0;
|
|
|
|
|
colored_rects[2].color[1] = 1.0;
|
|
|
|
|
colored_rects[2].color[2] = 0.0;
|
|
|
|
|
colored_rects[2].color[3] = 1.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vmaUnmapMemory(render_context->allocator, colored_rect_memory);
|
|
|
|
|
|
|
|
|
@ -132,8 +150,14 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render_context) {
|
|
|
|
|
vmaUnmapMemory(render_context->allocator, temp_memory);
|
|
|
|
|
vmaDestroyBuffer(render_context->allocator, temp_buffer, temp_memory);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VkBufferDeviceAddressInfo colored_rect_address_info = {
|
|
|
|
|
.sType = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO,
|
|
|
|
|
.buffer = colored_rect_buffer,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
UILayer test_layer = {
|
|
|
|
|
.colored_rects = colored_rect_buffer,
|
|
|
|
|
.colored_rects = vkGetBufferDeviceAddress(render_context->device, &colored_rect_address_info),
|
|
|
|
|
.colored_rect_count = 3,
|
|
|
|
|
|
|
|
|
|
.font = test_font,
|
|
|
|
|