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 CurrentMuralChanged : 1;
|
---|
47 | uint32_t LastWasFBODraw : 1;
|
---|
48 | uint32_t ForceDrawBlit : 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, const 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 | typedef struct CR_BLITTER_SPUITEM
|
---|
60 | {
|
---|
61 | int id;
|
---|
62 | GLint visualBits;
|
---|
63 | } CR_BLITTER_SPUITEM, *PCR_BLITTER_SPUITEM;
|
---|
64 |
|
---|
65 | typedef struct CR_BLITTER_CONTEXT
|
---|
66 | {
|
---|
67 | CR_BLITTER_SPUITEM Base;
|
---|
68 | } CR_BLITTER_CONTEXT, *PCR_BLITTER_CONTEXT;
|
---|
69 |
|
---|
70 | typedef struct CR_BLITTER_WINDOW
|
---|
71 | {
|
---|
72 | CR_BLITTER_SPUITEM Base;
|
---|
73 | GLuint width, height;
|
---|
74 | } CR_BLITTER_WINDOW, *PCR_BLITTER_WINDOW;
|
---|
75 |
|
---|
76 | typedef struct CR_BLITTER_IMG
|
---|
77 | {
|
---|
78 | void *pvData;
|
---|
79 | GLuint cbData;
|
---|
80 | GLenum enmFormat;
|
---|
81 | GLuint width, height;
|
---|
82 | GLuint bpp;
|
---|
83 | GLuint pitch;
|
---|
84 | } CR_BLITTER_IMG, *PCR_BLITTER_IMG;
|
---|
85 |
|
---|
86 | typedef struct CR_BLITTER
|
---|
87 | {
|
---|
88 | GLuint idFBO;
|
---|
89 | CR_BLITTER_FLAGS Flags;
|
---|
90 | PFNCRBLT_BLITTER pfnBlt;
|
---|
91 | CR_BLITTER_BUFFER Verticies;
|
---|
92 | CR_BLITTER_BUFFER Indicies;
|
---|
93 | RTRECTSIZE CurrentSetSize;
|
---|
94 | CR_BLITTER_WINDOW CurrentMural;
|
---|
95 | CR_BLITTER_CONTEXT CtxInfo;
|
---|
96 | const CR_BLITTER_CONTEXT *pRestoreCtxInfo;
|
---|
97 | const CR_BLITTER_WINDOW *pRestoreMural;
|
---|
98 | int32_t i32MakeCurrentUserData;
|
---|
99 | SPUDispatchTable *pDispatch;
|
---|
100 | } CR_BLITTER, *PCR_BLITTER;
|
---|
101 |
|
---|
102 | DECLINLINE(GLboolean) CrBltIsInitialized(PCR_BLITTER pBlitter)
|
---|
103 | {
|
---|
104 | return !!pBlitter->pDispatch;
|
---|
105 | }
|
---|
106 |
|
---|
107 | VBOXBLITTERDECL(int) CrBltInit(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pCtxBase, bool fCreateNewCtx, bool fForceDrawBlt, SPUDispatchTable *pDispatch);
|
---|
108 |
|
---|
109 | VBOXBLITTERDECL(void) CrBltTerm(PCR_BLITTER pBlitter);
|
---|
110 |
|
---|
111 | DECLINLINE(GLboolean) CrBltSupportsTexTex(PCR_BLITTER pBlitter)
|
---|
112 | {
|
---|
113 | return pBlitter->Flags.SupportsFBO;
|
---|
114 | }
|
---|
115 |
|
---|
116 | DECLINLINE(GLboolean) CrBltIsEntered(PCR_BLITTER pBlitter)
|
---|
117 | {
|
---|
118 | return !!pBlitter->pRestoreCtxInfo;
|
---|
119 | }
|
---|
120 |
|
---|
121 | DECLINLINE(GLint) CrBltGetVisBits(PCR_BLITTER pBlitter)
|
---|
122 | {
|
---|
123 | return pBlitter->CtxInfo.Base.visualBits;
|
---|
124 | }
|
---|
125 |
|
---|
126 |
|
---|
127 | DECLINLINE(GLboolean) CrBltIsEverEntered(PCR_BLITTER pBlitter)
|
---|
128 | {
|
---|
129 | return !!pBlitter->Flags.Initialized;
|
---|
130 | }
|
---|
131 |
|
---|
132 | DECLINLINE(void) CrBltSetMakeCurrentUserData(PCR_BLITTER pBlitter, int32_t i32MakeCurrentUserData)
|
---|
133 | {
|
---|
134 | pBlitter->i32MakeCurrentUserData = i32MakeCurrentUserData;
|
---|
135 | }
|
---|
136 |
|
---|
137 | VBOXBLITTERDECL(int) CrBltMuralSetCurrent(PCR_BLITTER pBlitter, const CR_BLITTER_WINDOW *pMural);
|
---|
138 | DECLINLINE(const CR_BLITTER_WINDOW *) CrBltMuralGetCurrentInfo(PCR_BLITTER pBlitter)
|
---|
139 | {
|
---|
140 | return &pBlitter->CurrentMural;
|
---|
141 | }
|
---|
142 |
|
---|
143 | VBOXBLITTERDECL(void) CrBltCheckUpdateViewport(PCR_BLITTER pBlitter);
|
---|
144 |
|
---|
145 | VBOXBLITTERDECL(void) CrBltLeave(PCR_BLITTER pBlitter);
|
---|
146 | VBOXBLITTERDECL(int) CrBltEnter(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pRestoreCtxInfo, const CR_BLITTER_WINDOW *pRestoreMural);
|
---|
147 | VBOXBLITTERDECL(void) CrBltBlitTexMural(PCR_BLITTER pBlitter, bool fBb, const VBOXVR_TEXTURE *pSrc, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags);
|
---|
148 | VBOXBLITTERDECL(void) CrBltBlitTexTex(PCR_BLITTER pBlitter, const VBOXVR_TEXTURE *pSrc, const RTRECT *pSrcRect, const VBOXVR_TEXTURE *pDst, const RTRECT *pDstRect, uint32_t cRects, uint32_t fFlags);
|
---|
149 | VBOXBLITTERDECL(int) CrBltImgGetTex(PCR_BLITTER pBlitter, const VBOXVR_TEXTURE *pSrc, GLenum enmFormat, CR_BLITTER_IMG *pDst);
|
---|
150 |
|
---|
151 | VBOXBLITTERDECL(int) CrBltImgGetMural(PCR_BLITTER pBlitter, bool fBb, CR_BLITTER_IMG *pDst);
|
---|
152 | VBOXBLITTERDECL(void) CrBltImgFree(PCR_BLITTER pBlitter, CR_BLITTER_IMG *pDst);
|
---|
153 | VBOXBLITTERDECL(void) CrBltPresent(PCR_BLITTER pBlitter);
|
---|
154 | /* */
|
---|
155 |
|
---|
156 | RT_C_DECLS_END
|
---|
157 |
|
---|
158 | #endif /* #ifndef ___cr_blitter_h__ */
|
---|