VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/cr_unpack.h@ 63909

Last change on this file since 63909 was 52451, checked in by vboxsync, 10 years ago

crOpenGL: command blocks flushing

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved.
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#ifndef CR_UNPACK_H
8#define CR_UNPACK_H
9
10#include "cr_compiler.h"
11#include "cr_spu.h"
12#include "cr_protocol.h"
13#include "cr_mem.h"
14#include "cr_opcodes.h"
15
16#include <iprt/types.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22extern SPUDispatchTable cr_unpackDispatch;
23/*extern DLLDATA(const unsigned char *) cr_unpackData;*/
24extern DECLEXPORT(const unsigned char *) cr_unpackData;
25
26DECLEXPORT(void) crUnpackSetReturnPointer( CRNetworkPointer *ptr );
27DECLEXPORT(void) crUnpackSetWritebackPointer( CRNetworkPointer *ptr );
28DECLEXPORT(void) crUnpack( const void *data, const void *opcodes, unsigned int num_opcodes, SPUDispatchTable *table );
29DECLEXPORT(void) crUnpackPush(void);
30DECLEXPORT(void) crUnpackPop(void);
31
32typedef enum
33{
34 CR_UNPACK_BUFFER_TYPE_GENERIC = 0,
35 CR_UNPACK_BUFFER_TYPE_CMDBLOCK_BEGIN,
36 CR_UNPACK_BUFFER_TYPE_CMDBLOCK_FLUSH,
37 CR_UNPACK_BUFFER_TYPE_CMDBLOCK_END
38} CR_UNPACK_BUFFER_TYPE;
39
40DECLEXPORT(CR_UNPACK_BUFFER_TYPE) crUnpackGetBufferType(const void *opcodes, unsigned int num_opcodes);
41
42extern CRNetworkPointer * return_ptr;
43extern CRNetworkPointer * writeback_ptr;
44
45#if defined(LINUX) || defined(WINDOWS)
46#define CR_UNALIGNED_ACCESS_OKAY
47#else
48#undef CR_UNALIGNED_ACCESS_OKAY
49#endif
50DECLEXPORT(double) crReadUnalignedDouble( const void *buffer );
51
52#define READ_DATA( offset, type ) \
53 *( (const type *) (cr_unpackData + (offset)))
54
55#ifdef CR_UNALIGNED_ACCESS_OKAY
56#define READ_DOUBLE( offset ) \
57 READ_DATA( offset, GLdouble )
58#else
59#define READ_DOUBLE( offset ) \
60 crReadUnalignedDouble( cr_unpackData + (offset) )
61#endif
62
63#define READ_NETWORK_POINTER( offset ) \
64 ( cr_unpackData + (offset) )
65
66/* XXX make this const */
67#define DATA_POINTER( offset, type ) \
68 ( (type *) (cr_unpackData + (offset)) )
69
70#define INCR_DATA_PTR( delta ) \
71 cr_unpackData += (delta)
72
73#define INCR_DATA_PTR_NO_ARGS() \
74 INCR_DATA_PTR( 4 )
75
76#define INCR_VAR_PTR() \
77 INCR_DATA_PTR( *((int *) cr_unpackData ) )
78
79#define SET_RETURN_PTR( offset ) do { \
80 CRDBGPTR_CHECKZ(return_ptr); \
81 crMemcpy( return_ptr, cr_unpackData + (offset), sizeof( *return_ptr ) ); \
82 } while (0);
83
84
85#define SET_WRITEBACK_PTR( offset ) do { \
86 CRDBGPTR_CHECKZ(writeback_ptr); \
87 crMemcpy( writeback_ptr, cr_unpackData + (offset), sizeof( *writeback_ptr ) ); \
88 } while (0);
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif /* CR_UNPACK_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette