1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[hud] Use combined image s1ampler for the font texture

This commit is contained in:
Philip Rebohle 2019-04-03 17:27:53 +02:00
parent ddde5ee6c2
commit 257c19ed0a
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 5 additions and 7 deletions

View File

@ -50,7 +50,7 @@ namespace dxvk::hud {
sizeof(HudVertex));
context->bindResourceSampler(1, m_fontSampler);
context->bindResourceView (2, m_fontView, nullptr);
context->bindResourceView (1, m_fontView, nullptr);
m_mode = Mode::RenderNone;
m_vertexIndex = 0;
@ -203,9 +203,8 @@ namespace dxvk::hud {
const SpirvCodeBuffer codeBuffer(hud_text);
// Two shader resources: Font texture and sampler
const std::array<DxvkResourceSlot, 2> resourceSlots = {{
{ 1, VK_DESCRIPTOR_TYPE_SAMPLER, VK_IMAGE_VIEW_TYPE_MAX_ENUM },
{ 2, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_IMAGE_VIEW_TYPE_2D },
const std::array<DxvkResourceSlot, 1> resourceSlots = {{
{ 1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_IMAGE_VIEW_TYPE_2D },
}};
return device->createShader(

View File

@ -1,7 +1,6 @@
#version 450
layout(set = 0, binding = 1) uniform sampler s_font;
layout(set = 0, binding = 2) uniform texture2D t_font;
layout(set = 0, binding = 1) uniform sampler2D s_font;
layout(location = 0) in vec2 v_texcoord;
layout(location = 1) in vec4 v_color;
@ -9,7 +8,7 @@ layout(location = 1) in vec4 v_color;
layout(location = 0) out vec4 o_color;
float sampleAlpha(float alpha_bias, float dist_range) {
float value = texture(sampler2D(t_font, s_font), v_texcoord).r + alpha_bias - 0.5f;
float value = texture(s_font, v_texcoord).r + alpha_bias - 0.5f;
float dist = value * dot(vec2(dist_range, dist_range), 1.0f / fwidth(v_texcoord.xy));
return clamp(dist + 0.5f, 0.0f, 1.0f);
}