Skip to content

Commit

Permalink
[hud] Changed vertex buffer format
Browse files Browse the repository at this point in the history
Should fix the HUD on Nvidia cards, which do not
support SRGB conversion for vertex input data.
  • Loading branch information
doitsujin committed Jan 22, 2018
1 parent 847d50d commit 05f0008
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/dxvk/hud/dxvk_hud_devinfo.cpp
Expand Up @@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/hud/dxvk_hud_fps.cpp
Expand Up @@ -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 };
Expand Down
14 changes: 7 additions & 7 deletions src/dxvk/hud/dxvk_hud_text.cpp
Expand Up @@ -34,9 +34,9 @@ namespace dxvk::hud {
context->setInputAssemblyState(iaState);

const std::array<DxvkVertexAttribute, 3> 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<DxvkVertexBinding, 1> ilBindings = {{
Expand Down Expand Up @@ -89,12 +89,12 @@ namespace dxvk::hud {
const HudPos posBr = { origin.x + size.x, origin.y + size.y };

const HudTexCoord texTl = {
static_cast<uint16_t>(glyph.x),
static_cast<uint16_t>(glyph.y), };
static_cast<uint32_t>(glyph.x),
static_cast<uint32_t>(glyph.y), };

const HudTexCoord texBr = {
static_cast<uint16_t>(glyph.x + glyph.w),
static_cast<uint16_t>(glyph.y + glyph.h) };
static_cast<uint32_t>(glyph.x + glyph.w),
static_cast<uint32_t>(glyph.y + glyph.h) };

vertexData[6 * i + 0].position = { posTl.x, posTl.y };
vertexData[6 * i + 0].texcoord = { texTl.u, texTl.v };
Expand Down
12 changes: 6 additions & 6 deletions src/dxvk/hud/dxvk_hud_text.h
Expand Up @@ -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;
};

/**
Expand All @@ -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;
};

/**
Expand Down

0 comments on commit 05f0008

Please sign in to comment.