1 | /* $Id$ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * Blitter API
|
---|
5 | */
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 | #ifndef ___cr_blitter_h__
|
---|
18 | #define ___cr_blitter_h__
|
---|
19 |
|
---|
20 | #include <iprt/cdefs.h>
|
---|
21 | #include "cr_spu.h"
|
---|
22 | #include "cr_vreg.h"
|
---|
23 |
|
---|
24 | #ifndef IN_RING0
|
---|
25 | # define VBOXBLITTERDECL(_type) DECLEXPORT(_type)
|
---|
26 | #else
|
---|
27 | # define VBOXBLITTERDECL(_type) RTDECL(_type)
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | RT_C_DECLS_BEGIN
|
---|
31 |
|
---|
32 | /* BLITTER */
|
---|
33 | typedef struct CR_BLITTER_BUFFER
|
---|
34 | {
|
---|
35 | GLuint cbBuffer;
|
---|
36 | GLvoid * pvBuffer;
|
---|
37 | } CR_BLITTER_BUFFER, *PCR_BLITTER_BUFFER;
|
---|
38 |
|
---|
39 | typedef union CR_BLITTER_FLAGS
|
---|
40 | {
|
---|
41 | struct
|
---|
42 | {
|
---|
43 | uint32_t Initialized : 1;
|
---|
44 | uint32_t CtxCreated : 1;
|
---|
45 | uint32_t SupportsFBO : 1;
|
---|
46 | uint32_t SupportsFBOBlit : 1;
|
---|
47 | uint32_t CurrentMuralChanged : 1;
|
---|
48 | uint32_t LastWasFBODraw : 1;
|
---|
49 | uint32_t Reserved : 26;
|
---|
50 | };
|
---|
51 | uint32_t Value;
|
---|
52 | } CR_BLITTER_FLAGS, *PCR_BLITTER_FLAGS;
|
---|
53 |
|
---|
54 | struct CR_BLITTER;
|
---|
55 |
|
---|
56 | typedef DECLCALLBACK(int) FNCRBLT_BLITTER(struct CR_BLITTER *pBlitter, VBOXVR_TEXTURE *pSrc, const RTRECT *paSrcRect, const RTRECTSIZE *pDstSize, const RTRECT *paDstRect, uint32_t cRects, uint32_t fFlags);
|
---|
57 | typedef FNCRBLT_BLITTER *PFNCRBLT_BLITTER;
|
---|
58 |
|
---|
59 | #define CRBLT_F_LINEAR 0x00000001
|
---|
60 | #define CRBLT_F_OFFSCREEN 0x00000002
|
---|
61 |
|
---|
62 | typedef struct CR_BLITTER_SPUITEM
|
---|
63 | {
|
---|
64 | int id;
|
---|
65 | GLint visualBits;
|
---|
66 | } CR_BLITTER_SPUITEM, *PCR_BLITTER_SPUITEM;
|
---|
67 |
|
---|
68 | typedef struct CR_BLITTER_CONTEXT
|
---|
69 | {
|
---|
70 | CR_BLITTER_SPUITEM Base;
|
---|
71 | } CR_BLITTER_CONTEXT, *PCR_BLITTER_CONTEXT;
|
---|
72 |
|
---|
73 | typedef struct CR_BLITTER_WINDOW
|
---|
74 | {
|
---|
75 | CR_BLITTER_SPUITEM Base;
|
---|
76 | GLuint width, height;
|
---|
77 | } CR_BLITTER_WINDOW, *PCR_BLITTER_WINDOW;
|
---|
78 |
|
---|
79 | typedef struct CR_BLITTER
|
---|
80 | {
|
---|
81 | GLuint idFBO;
|
---|
82 | CR_BLITTER_FLAGS Flags;
|
---|
83 | PFNCRBLT_BLITTER pfnBlt;
|
---|
84 | CR_BLITTER_BUFFER Verticies;
|
---|
85 | CR_BLITTER_BUFFER Indicies;
|
---|
86 | RTRECTSIZE CurrentSetSize;
|
---|
87 | CR_BLITTER_WINDOW *pCurrentMural;
|
---|
88 | CR_BLITTER_CONTEXT CtxInfo;
|
---|
89 | CR_BLITTER_CONTEXT *pRestoreCtxInfo;
|
---|
90 | CR_BLITTER_WINDOW *pRestoreMural;
|
---|
91 | int32_t i32MakeCurrentUserData;
|
---|
92 | SPUDispatchTable *pDispatch;
|
---|
93 | } CR_BLITTER, *PCR_BLITTER;
|
---|
94 |
|
---|
95 | VBOXBLITTERDECL(int) CrBltInit(PCR_BLITTER pBlitter, CR_BLITTER_CONTEXT *pCtxBase, bool fCreateNewCtx, SPUDispatchTable *pDispatch);
|
---|
96 | VBOXBLITTERDECL(void) CrBltTerm(PCR_BLITTER pBlitter);
|
---|
97 |
|
---|
98 | DECLINLINE(GLboolean) CrBltSupportsTexTex(PCR_BLITTER pBlitter)
|
---|
99 | {
|
---|
100 | return pBlitter->Flags.SupportsFBO;
|
---|
101 | }
|
---|
102 |
|
---|
103 | DECLINLINE(GLboolean) CrBltIsEntered(PCR_BLITTER pBlitter)
|
---|
104 | {
|
---|
105 | return !!pBlitter->pRestoreCtxInfo;
|
---|
106 | }
|
---|
107 |
|
---|
108 | DECLINLINE(GLboolean) CrBltIsEverEntered(PCR_BLITTER pBlitter)
|
---|
109 | {
|
---|
110 | return !!pBlitter->Flags.Initialized;
|
---|
111 | }
|
---|
112 |
|
---|
113 | DECLINLINE(void) CrBltSetMakeCurrentUserData(PCR_BLITTER pBlitter, int32_t i32MakeCurrentUserData)
|
---|
114 | {
|
---|
115 | pBlitter->i32MakeCurrentUserData = i32MakeCurrentUserData;
|
---|
116 | }
|
---|
117 |
|
---|
118 | VBOXBLITTERDECL(void) CrBltMuralSetCurrent(PCR_BLITTER pBlitter, CR_BLITTER_WINDOW *pMural);
|
---|
119 | DECLINLINE(CR_BLITTER_WINDOW *) CrBltMuralGetCurrent(PCR_BLITTER pBlitter)
|
---|
120 | {
|
---|
121 | return pBlitter->pCurrentMural;
|
---|
122 | }
|
---|
123 |
|
---|
124 | VBOXBLITTERDECL(void) CrBltLeave(PCR_BLITTER pBlitter);
|
---|
125 | VBOXBLITTERDECL(int) CrBltEnter(PCR_BLITTER pBlitter, CR_BLITTER_CONTEXT *pRestoreCtxInfo, CR_BLITTER_WINDOW *pRestoreMural);
|
---|
126 | VBOXBLITTERDECL(void) CrBltBlitTexMural(PCR_BLITTER pBlitter, VBOXVR_TEXTURE *pSrc, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags);
|
---|
127 | VBOXBLITTERDECL(void) CrBltBlitTexTex(PCR_BLITTER pBlitter, VBOXVR_TEXTURE *pSrc, const RTRECT *pSrcRect, VBOXVR_TEXTURE *pDst, const RTRECT *pDstRect, uint32_t cRects, uint32_t fFlags);
|
---|
128 | VBOXBLITTERDECL(void) CrBltPresent(PCR_BLITTER pBlitter);
|
---|
129 | /* */
|
---|
130 |
|
---|
131 | RT_C_DECLS_END
|
---|
132 |
|
---|
133 | #endif /* #ifndef ___cr_blitter_h__ */
|
---|