mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:47:46 +00:00
Demos: Create demo for VirGL gpu device
This is a simple demo for VirGL, that does the bare minimum required to create and render a spinning cube (with one color per face).
This commit is contained in:
parent
2939f65753
commit
fd5eaf6494
8 changed files with 957 additions and 0 deletions
41
Userland/Demos/VirGLDemo/CommandBufferBuilder.h
Normal file
41
Userland/Demos/VirGLDemo/CommandBufferBuilder.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Sahan Fernando <sahan.h.fernando@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Vector.h>
|
||||
#include <sys/ioctl_numbers.h>
|
||||
|
||||
#include "VirGLProtocol.h"
|
||||
|
||||
class CommandBufferBuilder {
|
||||
public:
|
||||
void append_set_tweaks(u32 id, u32 value);
|
||||
void append_transfer3d(ResourceID resource, size_t width, size_t height = 1, size_t depth = 1, size_t direction = VIRGL_DATA_DIR_GUEST_TO_HOST);
|
||||
void append_end_transfers_3d();
|
||||
void append_draw_vbo(u32 count);
|
||||
void append_gl_clear(float r, float g, float b);
|
||||
void append_set_vertex_buffers(u32 stride, u32 offset, ResourceID resource);
|
||||
void append_create_blend(ObjectHandle handle);
|
||||
void append_bind_blend(ObjectHandle handle);
|
||||
void append_create_surface(ResourceID drawtarget_resource, ObjectHandle drawtarget_handle, Protocol::TextureFormat format);
|
||||
void append_set_framebuffer_state(ObjectHandle drawtarget, ObjectHandle depthbuffer = 0);
|
||||
void append_create_vertex_elements(ObjectHandle handle);
|
||||
void append_bind_vertex_elements(ObjectHandle handle);
|
||||
void append_gl_viewport();
|
||||
void append_set_framebuffer_state_no_attach();
|
||||
void append_set_constant_buffer(Vector<float> const& constant_buffer);
|
||||
void append_create_shader(ObjectHandle handle, Gallium::ShaderType shader_type, const char* shader_data);
|
||||
void append_bind_shader(ObjectHandle handle, Gallium::ShaderType shader_type);
|
||||
void append_create_rasterizer(ObjectHandle handle);
|
||||
void append_bind_rasterizer(ObjectHandle handle);
|
||||
void append_create_dsa(ObjectHandle handle);
|
||||
void append_bind_dsa(ObjectHandle handle);
|
||||
Vector<u32> const& build() { return m_buffer; }
|
||||
|
||||
private:
|
||||
Vector<u32> m_buffer;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue