1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-04 16:24:29 +01:00

[hud] Bind data buffers as views

This commit is contained in:
Philip Rebohle 2023-01-12 18:26:17 +01:00 committed by Philip Rebohle
parent c347bd4d8b
commit 82f500250f
2 changed files with 15 additions and 2 deletions

View File

@ -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<VK_SHADER_STAGE_VERTEX_BIT>(Rc<DxvkShader>(m_textShaders.vert));
m_context->bindShader<VK_SHADER_STAGE_FRAGMENT_BIT>(Rc<DxvkShader>(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<DxvkBufferView>(m_fontBufferView));
m_context->bindResourceBufferView(VK_SHADER_STAGE_VERTEX_BIT, 1, Rc<DxvkBufferView>(m_dataView));
m_context->bindResourceSampler(VK_SHADER_STAGE_FRAGMENT_BIT, 2, Rc<DxvkSampler>(m_fontSampler));
m_context->bindResourceImageView(VK_SHADER_STAGE_FRAGMENT_BIT, 2, Rc<DxvkImageView>(m_fontView));
@ -129,7 +130,7 @@ namespace dxvk::hud {
m_context->bindShader<VK_SHADER_STAGE_VERTEX_BIT>(Rc<DxvkShader>(m_graphShaders.vert));
m_context->bindShader<VK_SHADER_STAGE_FRAGMENT_BIT>(Rc<DxvkShader>(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<DxvkBufferView>(m_dataView));
static const DxvkInputAssemblyState iaState = {
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
@ -257,6 +258,16 @@ namespace dxvk::hud {
}
Rc<DxvkBufferView> 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<DxvkImage> HudRenderer::createFontImage() {
DxvkImageCreateInfo info;
info.type = VK_IMAGE_TYPE_2D;

View File

@ -156,6 +156,7 @@ namespace dxvk::hud {
VkDeviceSize m_dataOffset;
Rc<DxvkBuffer> m_fontBuffer;
Rc<DxvkBufferView> m_fontBufferView;
Rc<DxvkImage> m_fontImage;
Rc<DxvkImageView> m_fontView;
Rc<DxvkSampler> m_fontSampler;
@ -175,6 +176,7 @@ namespace dxvk::hud {
Rc<DxvkBufferView> createDataView();
Rc<DxvkBuffer> createFontBuffer();
Rc<DxvkBufferView> createFontBufferView();
Rc<DxvkImage> createFontImage();
Rc<DxvkImageView> createFontView();
Rc<DxvkSampler> createFontSampler();