1 | /* $Id: cr_framebuffer.h 31808 2010-08-20 09:40:40Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox crOpenGL: FBO related state info
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2009 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 |
|
---|
20 | #ifndef CR_STATE_FRAMEBUFFEROBJECT_H
|
---|
21 | #define CR_STATE_FRAMEBUFFEROBJECT_H
|
---|
22 |
|
---|
23 | #include "cr_hash.h"
|
---|
24 | #include "state/cr_statetypes.h"
|
---|
25 | #include "state/cr_statefuncs.h"
|
---|
26 |
|
---|
27 | #ifdef __cplusplus
|
---|
28 | extern "C" {
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | #define CR_MAX_COLOR_ATTACHMENTS 16
|
---|
32 |
|
---|
33 | typedef struct {
|
---|
34 | GLenum type; /*one of GL_NONE GL_TEXTURE GL_RENDERBUFFER_EXT*/
|
---|
35 | GLuint name;
|
---|
36 | GLint level;
|
---|
37 | GLint face;
|
---|
38 | GLint zoffset;
|
---|
39 | } CRFBOAttachmentPoint;
|
---|
40 |
|
---|
41 | typedef struct {
|
---|
42 | GLuint id, hwid;
|
---|
43 | CRFBOAttachmentPoint color[CR_MAX_COLOR_ATTACHMENTS];
|
---|
44 | CRFBOAttachmentPoint depth;
|
---|
45 | CRFBOAttachmentPoint stencil;
|
---|
46 | GLenum readbuffer;
|
---|
47 | /*@todo: we don't support drawbufferS yet, so it's a stub*/
|
---|
48 | GLenum drawbuffer[1];
|
---|
49 | #ifdef IN_GUEST
|
---|
50 | GLenum status;
|
---|
51 | #endif
|
---|
52 | } CRFramebufferObject;
|
---|
53 |
|
---|
54 | typedef struct {
|
---|
55 | GLuint id, hwid;
|
---|
56 | GLsizei width, height;
|
---|
57 | GLenum internalformat;
|
---|
58 | GLuint redBits, greenBits, blueBits, alphaBits, depthBits, stencilBits;
|
---|
59 | } CRRenderbufferObject;
|
---|
60 |
|
---|
61 | typedef struct {
|
---|
62 | CRFramebufferObject *readFB, *drawFB;
|
---|
63 | CRRenderbufferObject *renderbuffer;
|
---|
64 |
|
---|
65 | /* Indicates that we have to resend FBO data to GPU on first glMakeCurrent call with owning context */
|
---|
66 | GLboolean bResyncNeeded;
|
---|
67 | } CRFramebufferObjectState;
|
---|
68 |
|
---|
69 | DECLEXPORT(void) STATE_APIENTRY crStateFramebufferObjectInit(CRContext *ctx);
|
---|
70 | DECLEXPORT(void) STATE_APIENTRY crStateFramebufferObjectDestroy(CRContext *ctx);
|
---|
71 | DECLEXPORT(void) STATE_APIENTRY crStateFramebufferObjectSwitch(CRContext *from, CRContext *to);
|
---|
72 | DECLEXPORT(GLuint) STATE_APIENTRY crStateGetFramebufferHWID(GLuint id);
|
---|
73 | DECLEXPORT(GLuint) STATE_APIENTRY crStateGetRenderbufferHWID(GLuint id);
|
---|
74 |
|
---|
75 | DECLEXPORT(void) STATE_APIENTRY crStateBindRenderbufferEXT(GLenum target, GLuint renderbuffer);
|
---|
76 | DECLEXPORT(void) STATE_APIENTRY crStateDeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers);
|
---|
77 | DECLEXPORT(void) STATE_APIENTRY crStateRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
---|
78 | DECLEXPORT(void) STATE_APIENTRY crStateGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params);
|
---|
79 | DECLEXPORT(void) STATE_APIENTRY crStateBindFramebufferEXT(GLenum target, GLuint framebuffer);
|
---|
80 | DECLEXPORT(void) STATE_APIENTRY crStateDeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers);
|
---|
81 | DECLEXPORT(void) STATE_APIENTRY crStateFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
---|
82 | DECLEXPORT(void) STATE_APIENTRY crStateFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
---|
83 | DECLEXPORT(void) STATE_APIENTRY crStateFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
---|
84 | DECLEXPORT(void) STATE_APIENTRY crStateFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
---|
85 | DECLEXPORT(void) STATE_APIENTRY crStateGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
---|
86 | DECLEXPORT(void) STATE_APIENTRY crStateGenerateMipmapEXT(GLenum target);
|
---|
87 |
|
---|
88 | DECLEXPORT(GLuint) STATE_APIENTRY crStateFBOHWIDtoID(GLuint hwid);
|
---|
89 | DECLEXPORT(GLuint) STATE_APIENTRY crStateRBOHWIDtoID(GLuint hwid);
|
---|
90 |
|
---|
91 | #ifdef IN_GUEST
|
---|
92 | DECLEXPORT(GLenum) STATE_APIENTRY crStateCheckFramebufferStatusEXT(GLenum target);
|
---|
93 | DECLEXPORT(GLenum) STATE_APIENTRY crStateSetFramebufferStatus(GLenum target, GLenum status);
|
---|
94 | #endif
|
---|
95 |
|
---|
96 | #ifdef __cplusplus
|
---|
97 | }
|
---|
98 | #endif
|
---|
99 |
|
---|
100 | #endif /* CR_STATE_FRAMEBUFFEROBJECT_H */
|
---|