From 82f500250f54f17da99c840dc647dab54a159b90 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 12 Jan 2023 18:26:17 +0100 Subject: [PATCH] [hud] Bind data buffers as views --- src/dxvk/hud/dxvk_hud_renderer.cpp | 15 +++++++++++++-- src/dxvk/hud/dxvk_hud_renderer.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/dxvk/hud/dxvk_hud_renderer.cpp b/src/dxvk/hud/dxvk_hud_renderer.cpp index b797d68e..f7a7bcd1 100644 --- a/src/dxvk/hud/dxvk_hud_renderer.cpp +++ b/src/dxvk/hud/dxvk_hud_renderer.cpp @@ -19,6 +19,7 @@ namespace dxvk::hud { m_dataView (createDataView()), m_dataOffset (0ull), m_fontBuffer (createFontBuffer()), + m_fontBufferView(createFontBufferView()), m_fontImage (createFontImage()), m_fontView (createFontView()), m_fontSampler (createFontSampler()) { @@ -107,7 +108,7 @@ namespace dxvk::hud { m_context->bindShader(Rc(m_textShaders.vert)); m_context->bindShader(Rc(m_textShaders.frag)); - m_context->bindResourceBuffer(VK_SHADER_STAGE_VERTEX_BIT, 0, DxvkBufferSlice(m_fontBuffer)); + m_context->bindResourceBufferView(VK_SHADER_STAGE_VERTEX_BIT, 0, Rc(m_fontBufferView)); m_context->bindResourceBufferView(VK_SHADER_STAGE_VERTEX_BIT, 1, Rc(m_dataView)); m_context->bindResourceSampler(VK_SHADER_STAGE_FRAGMENT_BIT, 2, Rc(m_fontSampler)); m_context->bindResourceImageView(VK_SHADER_STAGE_FRAGMENT_BIT, 2, Rc(m_fontView)); @@ -129,7 +130,7 @@ namespace dxvk::hud { m_context->bindShader(Rc(m_graphShaders.vert)); m_context->bindShader(Rc(m_graphShaders.frag)); - m_context->bindResourceBuffer(VK_SHADER_STAGE_FRAGMENT_BIT, 0, DxvkBufferSlice(m_dataBuffer)); + m_context->bindResourceBufferView(VK_SHADER_STAGE_FRAGMENT_BIT, 0, Rc(m_dataView)); static const DxvkInputAssemblyState iaState = { VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, @@ -257,6 +258,16 @@ namespace dxvk::hud { } + Rc HudRenderer::createFontBufferView() { + DxvkBufferViewCreateInfo info; + info.format = VK_FORMAT_UNDEFINED; + info.rangeOffset = 0; + info.rangeLength = m_fontBuffer->info().size; + + return m_device->createBufferView(m_fontBuffer, info); + } + + Rc HudRenderer::createFontImage() { DxvkImageCreateInfo info; info.type = VK_IMAGE_TYPE_2D; diff --git a/src/dxvk/hud/dxvk_hud_renderer.h b/src/dxvk/hud/dxvk_hud_renderer.h index 3986fba8..dcea3197 100644 --- a/src/dxvk/hud/dxvk_hud_renderer.h +++ b/src/dxvk/hud/dxvk_hud_renderer.h @@ -156,6 +156,7 @@ namespace dxvk::hud { VkDeviceSize m_dataOffset; Rc m_fontBuffer; + Rc m_fontBufferView; Rc m_fontImage; Rc m_fontView; Rc m_fontSampler; @@ -175,6 +176,7 @@ namespace dxvk::hud { Rc createDataView(); Rc createFontBuffer(); + Rc createFontBufferView(); Rc createFontImage(); Rc createFontView(); Rc createFontSampler();