From 05f00088919467b312888f15d8f38f66b1b0e7f5 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 22 Jan 2018 01:20:07 +0100 Subject: [PATCH] [hud] Changed vertex buffer format Should fix the HUD on Nvidia cards, which do not support SRGB conversion for vertex input data. --- src/dxvk/hud/dxvk_hud_devinfo.cpp | 6 +++--- src/dxvk/hud/dxvk_hud_fps.cpp | 2 +- src/dxvk/hud/dxvk_hud_text.cpp | 14 +++++++------- src/dxvk/hud/dxvk_hud_text.h | 12 ++++++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/dxvk/hud/dxvk_hud_devinfo.cpp b/src/dxvk/hud/dxvk_hud_devinfo.cpp index 4cc4b281..c58eae48 100644 --- a/src/dxvk/hud/dxvk_hud_devinfo.cpp +++ b/src/dxvk/hud/dxvk_hud_devinfo.cpp @@ -27,17 +27,17 @@ namespace dxvk::hud { HudPos position) { renderer.drawText(context, 16.0f, { position.x, position.y }, - { 0xFF, 0xFF, 0xFF, 0xFF }, + { 1.0f, 1.0f, 1.0f, 1.0f }, m_deviceName); renderer.drawText(context, 16.0f, { position.x, position.y + 24 }, - { 0xFF, 0xFF, 0xFF, 0xFF }, + { 1.0f, 1.0f, 1.0f, 1.0f }, m_driverVer); renderer.drawText(context, 16.0f, { position.x, position.y + 44 }, - { 0xFF, 0xFF, 0xFF, 0xFF }, + { 1.0f, 1.0f, 1.0f, 1.0f }, m_vulkanVer); return HudPos { position.x, position.y + 68 }; diff --git a/src/dxvk/hud/dxvk_hud_fps.cpp b/src/dxvk/hud/dxvk_hud_fps.cpp index d14dc388..ca840a78 100644 --- a/src/dxvk/hud/dxvk_hud_fps.cpp +++ b/src/dxvk/hud/dxvk_hud_fps.cpp @@ -38,7 +38,7 @@ namespace dxvk::hud { HudPos position) { renderer.drawText(context, 16.0f, { position.x, position.y }, - { 0xFF, 0xFF, 0xFF, 0xFF }, + { 1.0f, 1.0f, 1.0f, 1.0f }, m_fpsString); return HudPos { position.x, position.y + 20 }; diff --git a/src/dxvk/hud/dxvk_hud_text.cpp b/src/dxvk/hud/dxvk_hud_text.cpp index c120f53f..44b8e0ab 100644 --- a/src/dxvk/hud/dxvk_hud_text.cpp +++ b/src/dxvk/hud/dxvk_hud_text.cpp @@ -34,9 +34,9 @@ namespace dxvk::hud { context->setInputAssemblyState(iaState); const std::array ilAttributes = {{ - { 0, 0, VK_FORMAT_R32G32_SFLOAT, offsetof(HudTextVertex, position) }, - { 1, 0, VK_FORMAT_R16G16_UINT, offsetof(HudTextVertex, texcoord) }, - { 2, 0, VK_FORMAT_R8G8B8A8_SRGB, offsetof(HudTextVertex, color) }, + { 0, 0, VK_FORMAT_R32G32_SFLOAT, offsetof(HudTextVertex, position) }, + { 1, 0, VK_FORMAT_R32G32_UINT, offsetof(HudTextVertex, texcoord) }, + { 2, 0, VK_FORMAT_R32G32B32A32_SFLOAT, offsetof(HudTextVertex, color) }, }}; const std::array ilBindings = {{ @@ -89,12 +89,12 @@ namespace dxvk::hud { const HudPos posBr = { origin.x + size.x, origin.y + size.y }; const HudTexCoord texTl = { - static_cast(glyph.x), - static_cast(glyph.y), }; + static_cast(glyph.x), + static_cast(glyph.y), }; const HudTexCoord texBr = { - static_cast(glyph.x + glyph.w), - static_cast(glyph.y + glyph.h) }; + static_cast(glyph.x + glyph.w), + static_cast(glyph.y + glyph.h) }; vertexData[6 * i + 0].position = { posTl.x, posTl.y }; vertexData[6 * i + 0].texcoord = { texTl.u, texTl.v }; diff --git a/src/dxvk/hud/dxvk_hud_text.h b/src/dxvk/hud/dxvk_hud_text.h index cf7520e7..1f25c358 100644 --- a/src/dxvk/hud/dxvk_hud_text.h +++ b/src/dxvk/hud/dxvk_hud_text.h @@ -24,8 +24,8 @@ namespace dxvk::hud { * to pick letters in the font texture. */ struct HudTexCoord { - uint16_t u; - uint16_t v; + uint32_t u; + uint32_t v; }; /** @@ -35,10 +35,10 @@ namespace dxvk::hud { * will use this color for the most part. */ struct HudColor { - uint8_t x; - uint8_t y; - uint8_t z; - uint8_t w; + float x; + float y; + float z; + float w; }; /**