VirtualBox

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

Last change on this file since 71880 was 71469, checked in by vboxsync, 7 years ago

HostServices/SharedOpenGL: Check number of lines in shaders code, fix for Linux.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.7 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;
25extern DECLEXPORT(const unsigned char *) cr_unpackDataEnd;
26
27DECLEXPORT(void) crUnpackSetReturnPointer( CRNetworkPointer *ptr );
28DECLEXPORT(void) crUnpackSetWritebackPointer( CRNetworkPointer *ptr );
29DECLEXPORT(void) crUnpack( const void *data, const void *data_end, const void *opcodes, unsigned int num_opcodes, SPUDispatchTable *table );
30DECLEXPORT(void) crUnpackPush(void);
31DECLEXPORT(void) crUnpackPop(void);
32
33typedef enum
34{
35 CR_UNPACK_BUFFER_TYPE_GENERIC = 0,
36 CR_UNPACK_BUFFER_TYPE_CMDBLOCK_BEGIN,
37 CR_UNPACK_BUFFER_TYPE_CMDBLOCK_FLUSH,
38 CR_UNPACK_BUFFER_TYPE_CMDBLOCK_END
39} CR_UNPACK_BUFFER_TYPE;
40
41DECLEXPORT(CR_UNPACK_BUFFER_TYPE) crUnpackGetBufferType(const void *opcodes, unsigned int num_opcodes);
42
43extern CRNetworkPointer * return_ptr;
44extern CRNetworkPointer * writeback_ptr;
45
46#if defined(LINUX) || defined(WINDOWS)
47#define CR_UNALIGNED_ACCESS_OKAY
48#else
49#undef CR_UNALIGNED_ACCESS_OKAY
50#endif
51DECLEXPORT(double) crReadUnalignedDouble( const void *buffer );
52
53#define READ_DATA( offset, type ) \
54 *( (const type *) (cr_unpackData + (offset)))
55
56#ifdef CR_UNALIGNED_ACCESS_OKAY
57#define READ_DOUBLE( offset ) \
58 READ_DATA( offset, GLdouble )
59#else
60#define READ_DOUBLE( offset ) \
61 crReadUnalignedDouble( cr_unpackData + (offset) )
62#endif
63
64#define READ_NETWORK_POINTER( offset ) \
65 ( cr_unpackData + (offset) )
66
67/* XXX make this const */
68#define DATA_POINTER( offset, type ) \
69 ( (type *) (cr_unpackData + (offset)) )
70
71#define DATA_POINTER_CHECK( offset ) \
72 ( (cr_unpackDataEnd ? cr_unpackData + (offset) < cr_unpackDataEnd : true) )
73
74#define INCR_DATA_PTR( delta ) \
75 cr_unpackData += (delta)
76
77#define INCR_DATA_PTR_NO_ARGS() \
78 INCR_DATA_PTR( 4 )
79
80#define INCR_VAR_PTR() \
81 INCR_DATA_PTR( *((int *) cr_unpackData ) )
82
83#define SET_RETURN_PTR( offset ) do { \
84 CRDBGPTR_CHECKZ(return_ptr); \
85 crMemcpy( return_ptr, cr_unpackData + (offset), sizeof( *return_ptr ) ); \
86 } while (0);
87
88
89#define SET_WRITEBACK_PTR( offset ) do { \
90 CRDBGPTR_CHECKZ(writeback_ptr); \
91 crMemcpy( writeback_ptr, cr_unpackData + (offset), sizeof( *writeback_ptr ) ); \
92 } while (0);
93
94#ifdef __cplusplus
95}
96#endif
97
98#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