From 4a4aa23aed92d2e757517b172b3a22c886b324e0 Mon Sep 17 00:00:00 2001 From: Stephan Unverwerth Date: Wed, 21 Dec 2022 15:52:45 +0100 Subject: [PATCH] LibVirtGPU: Remove hardcoded size from append_viewport() --- .../Libraries/LibVirtGPU/CommandBufferBuilder.cpp | 14 +++++++------- .../Libraries/LibVirtGPU/CommandBufferBuilder.h | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp index b44d520bb32..3353955db4d 100644 --- a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp +++ b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp @@ -224,16 +224,16 @@ void CommandBufferBuilder::append_set_framebuffer_state(Protocol::ObjectHandle d builder.appendu32(drawtarget.value()); // surf_handle } -void CommandBufferBuilder::append_viewport() +void CommandBufferBuilder::append_viewport(Gfx::IntSize size) { CommandBuilder builder(m_buffer, Protocol::VirGLCommand::SET_VIEWPORT_STATE, Protocol::ObjectType::NONE); builder.appendu32(0); - builder.appendf32(DRAWTARGET_WIDTH / 2); // scale_x - builder.appendf32((DRAWTARGET_HEIGHT / 2)); // scale_y (flipped, due to VirGL being different from our coordinate space) - builder.appendf32(0.5f); // scale_z - builder.appendf32(DRAWTARGET_WIDTH / 2); // translate_x - builder.appendf32(DRAWTARGET_HEIGHT / 2); // translate_y - builder.appendf32(0.5f); // translate_z + builder.appendf32(size.width() / 2); // scale_x + builder.appendf32(size.height() / 2); // scale_y (flipped, due to VirGL being different from our coordinate space) + builder.appendf32(0.5f); // scale_z + builder.appendf32(size.width() / 2); // translate_x + builder.appendf32(size.height() / 2); // translate_y + builder.appendf32(0.5f); // translate_z } void CommandBufferBuilder::append_set_framebuffer_state_no_attach() diff --git a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h index 3a245772a89..4d7607b443b 100644 --- a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h +++ b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -29,7 +30,7 @@ public: void append_set_framebuffer_state(Protocol::ObjectHandle drawtarget, Protocol::ObjectHandle depthbuffer = 0); void append_create_vertex_elements(Protocol::ObjectHandle handle); void append_bind_vertex_elements(Protocol::ObjectHandle handle); - void append_viewport(); + void append_viewport(Gfx::IntSize); void append_set_framebuffer_state_no_attach(); void append_set_constant_buffer(Vector const& constant_buffer); void append_create_shader(Protocol::ObjectHandle handle, Gallium::ShaderType shader_type, StringView shader_data);