mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-04-06 06:55:02 +00:00
vk: Add support for basic SDF rendering
- Does not support scaled coordinates yet
This commit is contained in:
parent
a0c91bf96a
commit
45bae0046a
2 changed files with 21 additions and 2 deletions
|
|
@ -510,7 +510,7 @@ namespace vk
|
|||
glsl::input_type_push_constant,
|
||||
0,
|
||||
0,
|
||||
glsl::push_constant_ref {.offset = 68, .size = 12 }
|
||||
glsl::push_constant_ref {.offset = 68, .size = 60 }
|
||||
)
|
||||
);
|
||||
return result;
|
||||
|
|
@ -527,6 +527,10 @@ namespace vk
|
|||
// 68: uint fragment_config;
|
||||
// 72: float timestamp;
|
||||
// 76: float blur_intensity;
|
||||
// 80: vec4 sdf_params;
|
||||
// 96: vec2 sdf_origin;
|
||||
// 104: vec2 reserved;
|
||||
// 112: vec4 sdf_border_color;
|
||||
|
||||
f32 push_buf[32];
|
||||
// 1. Vertex config (00 - 63)
|
||||
|
|
@ -557,13 +561,24 @@ namespace vk
|
|||
.texture_mode(m_texture_type)
|
||||
.clip_fragments(m_clip_enabled)
|
||||
.pulse_glow(m_pulse_glow)
|
||||
.set_sdf(m_sdf_config.func)
|
||||
.get();
|
||||
|
||||
push_buf[0] = std::bit_cast<f32>(frag_config);
|
||||
push_buf[1] = m_time;
|
||||
push_buf[2] = m_blur_strength;
|
||||
push_buf[3] = m_sdf_config.hx;
|
||||
push_buf[4] = m_sdf_config.hy;
|
||||
push_buf[5] = m_sdf_config.br;
|
||||
push_buf[6] = m_sdf_config.bw;
|
||||
push_buf[7] = m_sdf_config.cx;
|
||||
push_buf[8] = m_sdf_config.cy;
|
||||
push_buf[9] = 0.f;
|
||||
push_buf[10] = 0.f;
|
||||
|
||||
vkCmdPushConstants(cmd, program->layout(), VK_SHADER_STAGE_FRAGMENT_BIT, 68, 12, push_buf);
|
||||
std::memcpy(push_buf + 11, m_sdf_config.border_color.rgba, 16);
|
||||
|
||||
vkCmdPushConstants(cmd, program->layout(), VK_SHADER_STAGE_FRAGMENT_BIT, 68, 60, push_buf);
|
||||
}
|
||||
|
||||
void ui_overlay_renderer::set_primitive_type(rsx::overlays::primitive_type type)
|
||||
|
|
@ -644,6 +659,8 @@ namespace vk
|
|||
m_clip_region = command.config.clip_rect;
|
||||
m_disable_vertex_snap = command.config.disable_vertex_snap;
|
||||
|
||||
m_sdf_config = command.config.sdf_config;
|
||||
|
||||
vk::image_view* src = nullptr;
|
||||
switch (command.config.texture_ref)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -132,6 +132,8 @@ namespace vk
|
|||
areaf m_clip_region;
|
||||
coordf m_viewport;
|
||||
|
||||
rsx::overlays::compiled_resource::sdf_config_t m_sdf_config{};
|
||||
|
||||
std::vector<std::unique_ptr<vk::image>> resources;
|
||||
std::unordered_map<u64, std::unique_ptr<vk::image>> font_cache;
|
||||
std::unordered_map<u64, std::unique_ptr<vk::image_view>> view_cache;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue