Compare commits

..

2 Commits

Author SHA1 Message Date
0d3a03a93e Enable culling while rendering wayland windows
I don't even know why I disabled culling even lmao

Signed-off-by: Slendi <slendi@socopon.com>
2026-02-01 20:48:57 +02:00
864a0fd2fe Make wayland required
Signed-off-by: Slendi <slendi@socopon.com>
2026-02-01 20:18:20 +02:00
2 changed files with 40 additions and 38 deletions

View File

@@ -719,7 +719,8 @@ auto Application::run() -> void
float fps { 0.0f }; float fps { 0.0f };
while (m_running) { while (m_running) {
GZoneScopedN("Frame"); GZoneScopedN("Frame");
if (m_wayland) { {
assert(m_wayland);
m_wayland->dispatch(); m_wayland->dispatch();
m_wayland->flush(); m_wayland->flush();
} }
@@ -1082,7 +1083,8 @@ auto Application::run() -> void
render_hands(gl, view_projection); render_hands(gl, view_projection);
} }
if (m_wayland) { assert(m_wayland);
auto const wayland_draw_extent { m_renderer->draw_extent() }; auto const wayland_draw_extent { m_renderer->draw_extent() };
auto const draw_width { static_cast<float>( auto const draw_width { static_cast<float>(
wayland_draw_extent.width) }; wayland_draw_extent.width) };
@@ -1090,7 +1092,7 @@ auto Application::run() -> void
wayland_draw_extent.height) }; wayland_draw_extent.height) };
if (draw_width > 0.0f && draw_height > 0.0f) { if (draw_width > 0.0f && draw_height > 0.0f) {
gl.set_transform(smath::Mat4::identity()); gl.set_transform(smath::Mat4::identity());
gl.set_culling(false); gl.set_culling(true);
gl.use_pipeline(m_renderer->wayland_pipeline()); gl.use_pipeline(m_renderer->wayland_pipeline());
for (auto *surface : m_wayland->surfaces()) { for (auto *surface : m_wayland->surfaces()) {
auto buffer { surface->current_buffer() }; auto buffer { surface->current_buffer() };
@@ -1102,14 +1104,12 @@ auto Application::run() -> void
continue; continue;
} }
auto const width { static_cast<float>(buffer->width) }; auto const width { static_cast<float>(buffer->width) };
auto const height { static_cast<float>( auto const height { static_cast<float>(buffer->height) };
buffer->height) };
auto const size { smath::Vec2 { auto const size { smath::Vec2 {
(width / draw_width) * 2.0f, (width / draw_width) * 2.0f,
(height / draw_height) * 2.0f, (height / draw_height) * 2.0f,
} }; } };
auto const pos { smath::Vec2 { auto const pos { smath::Vec2 { -1.0f, 1.0f - size.y() } };
-1.0f, 1.0f - size.y() } };
auto image { m_renderer->create_image( auto image { m_renderer->create_image(
*texture, vk::ImageUsageFlagBits::eSampled) }; *texture, vk::ImageUsageFlagBits::eSampled) };
gl.set_texture(&image); gl.set_texture(&image);
@@ -1121,7 +1121,6 @@ auto Application::run() -> void
gl.use_pipeline(m_renderer->mesh_pipeline()); gl.use_pipeline(m_renderer->mesh_pipeline());
gl.set_culling(true); gl.set_culling(true);
} }
}
} }; } };
if (xr_active) { if (xr_active) {

View File

@@ -84,6 +84,9 @@ struct VulkanRenderer {
auto draw_sphere(smath::Vec3 center, float radius, int rings = 16, auto draw_sphere(smath::Vec3 center, float radius, int rings = 16,
int segments = 32, std::optional<smath::Vec4> sphere_color = {}) int segments = 32, std::optional<smath::Vec4> sphere_color = {})
-> void; -> void;
auto draw_texture_cyl(AllocatedImage const *texture,
smath::Vec3 sphere_center, PolarCoordinate coord, float rad,
float scale, bool y_flip) -> void;
auto end() -> void; auto end() -> void;
auto flush() -> void; auto flush() -> void;