summaryrefslogtreecommitdiffstats
path: root/src/VBox/GuestHost/OpenGL/packer/pack_bounds.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:01:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:01:46 +0000
commitf8fe689a81f906d1b91bb3220acde2a4ecb14c5b (patch)
tree26484e9d7e2c67806c2d1760196ff01aaa858e8c /src/VBox/GuestHost/OpenGL/packer/pack_bounds.c
parentInitial commit. (diff)
downloadvirtualbox-f8fe689a81f906d1b91bb3220acde2a4ecb14c5b.tar.xz
virtualbox-f8fe689a81f906d1b91bb3220acde2a4ecb14c5b.zip
Adding upstream version 6.0.4-dfsg.upstream/6.0.4-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/GuestHost/OpenGL/packer/pack_bounds.c')
-rw-r--r--src/VBox/GuestHost/OpenGL/packer/pack_bounds.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/VBox/GuestHost/OpenGL/packer/pack_bounds.c b/src/VBox/GuestHost/OpenGL/packer/pack_bounds.c
new file mode 100644
index 00000000..191383bd
--- /dev/null
+++ b/src/VBox/GuestHost/OpenGL/packer/pack_bounds.c
@@ -0,0 +1,50 @@
+/* Copyright (c) 2001, Stanford University
+ * All rights reserved
+ *
+ * See the file LICENSE.txt for information on redistributing this software.
+ */
+
+#include "packer.h"
+#include "cr_opcodes.h"
+#include "cr_mem.h"
+
+void PACK_APIENTRY crPackBoundsInfoCR( CR_PACKER_CONTEXT_ARGDECL const CRrecti *bounds, const GLbyte *payload, GLint len, GLint num_opcodes )
+{
+ CR_GET_PACKER_CONTEXT(pc);
+ /* Don't get the buffered_ptr here because we've already
+ * verified that there's enough space for everything. */
+
+ unsigned char *data_ptr;
+ int len_aligned, total_len;
+
+ CR_LOCK_PACKER_CONTEXT(pc);
+
+ data_ptr = pc->buffer.data_current;
+ len_aligned = ( len + 0x3 ) & ~0x3;
+ total_len = 24 + len_aligned;
+
+ WRITE_DATA( 0, int, total_len );
+ WRITE_DATA( 4, int, bounds->x1 );
+ WRITE_DATA( 8, int, bounds->y1 );
+ WRITE_DATA( 12, int, bounds->x2 );
+ WRITE_DATA( 16, int, bounds->y2 );
+ WRITE_DATA( 20, int, num_opcodes );
+
+ /* skip the BOUNDSINFO */
+ data_ptr += 24;
+
+ /* put in padding opcodes (deliberately bogus) */
+ switch ( len_aligned - len )
+ {
+ case 3: *data_ptr++ = 0xff; RT_FALL_THRU();
+ case 2: *data_ptr++ = 0xff; RT_FALL_THRU();
+ case 1: *data_ptr++ = 0xff; RT_FALL_THRU();
+ default: break;
+ }
+
+ crMemcpy( data_ptr, payload, len );
+
+ WRITE_OPCODE( pc, CR_BOUNDSINFOCR_OPCODE );
+ pc->buffer.data_current += 24 + len_aligned;
+ CR_UNLOCK_PACKER_CONTEXT(pc);
+}