VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/cr_blitter.h@ 46343

Last change on this file since 46343 was 46343, checked in by vboxsync, 12 years ago

crOpenGL: bugfixes, debugging, dumping draw commands to html

  • Property svn:executable set to *
File size: 5.3 KB
Line 
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
30RT_C_DECLS_BEGIN
31
32/* BLITTER */
33typedef struct CR_BLITTER_BUFFER
34{
35 GLuint cbBuffer;
36 GLvoid * pvBuffer;
37} CR_BLITTER_BUFFER, *PCR_BLITTER_BUFFER;
38
39typedef 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
54struct CR_BLITTER;
55
56typedef 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);
57typedef FNCRBLT_BLITTER *PFNCRBLT_BLITTER;
58
59#define CRBLT_F_LINEAR 0x00000001
60#define CRBLT_F_INVERT_SRC_YCOORDS 0x00000002
61#define CRBLT_F_INVERT_DST_YCOORDS 0x00000004
62#define CRBLT_F_INVERT_YCOORDS (CRBLT_F_INVERT_SRC_YCOORDS | CRBLT_F_INVERT_DST_YCOORDS)
63
64#define CRBLT_FLAGS_FROM_FILTER(_f) ( ((_f) & GL_LINEAR) ? CRBLT_F_LINEAR : 0)
65#define CRBLT_FILTER_FROM_FLAGS(_f) (((_f) & CRBLT_F_LINEAR) ? GL_LINEAR : GL_NEAREST)
66
67typedef struct CR_BLITTER_SPUITEM
68{
69 int id;
70 GLint visualBits;
71} CR_BLITTER_SPUITEM, *PCR_BLITTER_SPUITEM;
72
73typedef struct CR_BLITTER_CONTEXT
74{
75 CR_BLITTER_SPUITEM Base;
76} CR_BLITTER_CONTEXT, *PCR_BLITTER_CONTEXT;
77
78typedef struct CR_BLITTER_WINDOW
79{
80 CR_BLITTER_SPUITEM Base;
81 GLuint width, height;
82} CR_BLITTER_WINDOW, *PCR_BLITTER_WINDOW;
83
84typedef struct CR_BLITTER_IMG
85{
86 void *pvData;
87 GLuint cbData;
88 GLenum enmFormat;
89 GLuint width, height;
90 GLuint bpp;
91 GLuint pitch;
92} CR_BLITTER_IMG, *PCR_BLITTER_IMG;
93
94typedef struct CR_BLITTER
95{
96 GLuint idFBO;
97 CR_BLITTER_FLAGS Flags;
98 PFNCRBLT_BLITTER pfnBlt;
99 CR_BLITTER_BUFFER Verticies;
100 CR_BLITTER_BUFFER Indicies;
101 RTRECTSIZE CurrentSetSize;
102 CR_BLITTER_WINDOW CurrentMural;
103 CR_BLITTER_CONTEXT CtxInfo;
104 const CR_BLITTER_CONTEXT *pRestoreCtxInfo;
105 const CR_BLITTER_WINDOW *pRestoreMural;
106 int32_t i32MakeCurrentUserData;
107 SPUDispatchTable *pDispatch;
108} CR_BLITTER, *PCR_BLITTER;
109
110DECLINLINE(GLboolean) CrBltIsInitialized(PCR_BLITTER pBlitter)
111{
112 return !!pBlitter->pDispatch;
113}
114
115VBOXBLITTERDECL(int) CrBltInit(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pCtxBase, bool fCreateNewCtx, bool fForceDrawBlt, SPUDispatchTable *pDispatch);
116
117VBOXBLITTERDECL(void) CrBltTerm(PCR_BLITTER pBlitter);
118
119DECLINLINE(GLboolean) CrBltSupportsTexTex(PCR_BLITTER pBlitter)
120{
121 return pBlitter->Flags.SupportsFBO;
122}
123
124DECLINLINE(GLboolean) CrBltIsEntered(PCR_BLITTER pBlitter)
125{
126 return !!pBlitter->pRestoreCtxInfo;
127}
128
129DECLINLINE(GLint) CrBltGetVisBits(PCR_BLITTER pBlitter)
130{
131 return pBlitter->CtxInfo.Base.visualBits;
132}
133
134
135DECLINLINE(GLboolean) CrBltIsEverEntered(PCR_BLITTER pBlitter)
136{
137 return !!pBlitter->Flags.Initialized;
138}
139
140DECLINLINE(void) CrBltSetMakeCurrentUserData(PCR_BLITTER pBlitter, int32_t i32MakeCurrentUserData)
141{
142 pBlitter->i32MakeCurrentUserData = i32MakeCurrentUserData;
143}
144
145VBOXBLITTERDECL(int) CrBltMuralSetCurrent(PCR_BLITTER pBlitter, const CR_BLITTER_WINDOW *pMural);
146DECLINLINE(const CR_BLITTER_WINDOW *) CrBltMuralGetCurrentInfo(PCR_BLITTER pBlitter)
147{
148 return &pBlitter->CurrentMural;
149}
150
151VBOXBLITTERDECL(void) CrBltCheckUpdateViewport(PCR_BLITTER pBlitter);
152
153VBOXBLITTERDECL(void) CrBltLeave(PCR_BLITTER pBlitter);
154VBOXBLITTERDECL(int) CrBltEnter(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pRestoreCtxInfo, const CR_BLITTER_WINDOW *pRestoreMural);
155VBOXBLITTERDECL(void) CrBltBlitTexMural(PCR_BLITTER pBlitter, bool fBb, const VBOXVR_TEXTURE *pSrc, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags);
156VBOXBLITTERDECL(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);
157VBOXBLITTERDECL(int) CrBltImgGetTex(PCR_BLITTER pBlitter, const VBOXVR_TEXTURE *pSrc, GLenum enmFormat, CR_BLITTER_IMG *pDst);
158
159VBOXBLITTERDECL(int) CrBltImgGetMural(PCR_BLITTER pBlitter, bool fBb, CR_BLITTER_IMG *pDst);
160VBOXBLITTERDECL(void) CrBltImgFree(PCR_BLITTER pBlitter, CR_BLITTER_IMG *pDst);
161VBOXBLITTERDECL(void) CrBltPresent(PCR_BLITTER pBlitter);
162/* */
163
164RT_C_DECLS_END
165
166#endif /* #ifndef ___cr_blitter_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