summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVirtGPU
diff options
context:
space:
mode:
authorStephan Unverwerth <s.unverwerth@serenityos.org>2022-12-21 15:52:45 +0100
committerAndreas Kling <kling@serenityos.org>2022-12-26 09:39:20 +0100
commit4a4aa23aed92d2e757517b172b3a22c886b324e0 (patch)
tree8d643d1deea29c64e4067495d4662571bd358868 /Userland/Libraries/LibVirtGPU
parent7a2b9ad164e9dd6ae1ba4d6b2922082ab897d2c8 (diff)
downloadserenity-4a4aa23aed92d2e757517b172b3a22c886b324e0.zip
LibVirtGPU: Remove hardcoded size from append_viewport()
Diffstat (limited to 'Userland/Libraries/LibVirtGPU')
-rw-r--r--Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp14
-rw-r--r--Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h3
2 files changed, 9 insertions, 8 deletions
diff --git a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp
index b44d520bb3..3353955db4 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 3a245772a8..4d7607b443 100644
--- a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h
+++ b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h
@@ -10,6 +10,7 @@
#include <AK/StringView.h>
#include <AK/Vector.h>
+#include <LibGfx/Size.h>
#include <LibVirtGPU/VirGLProtocol.h>
#include <sys/ioctl_numbers.h>
@@ -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<float> const& constant_buffer);
void append_create_shader(Protocol::ObjectHandle handle, Gallium::ShaderType shader_type, StringView shader_data);