LibVirtGPU: Remove hardcoded size from append_viewport()

This commit is contained in:
Stephan Unverwerth 2022-12-21 15:52:45 +01:00 committed by Andreas Kling
parent 7a2b9ad164
commit 4a4aa23aed
Notes: sideshowbarker 2024-07-17 03:03:15 +09:00
2 changed files with 9 additions and 8 deletions

View file

@ -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()

View file

@ -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);