1 | /* $Id: packspu_framebuffer.c 45008 2013-03-12 17:13:13Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox OpenGL FBO related functions
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2009-2012 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 | #include "packspu.h"
|
---|
20 | #include "cr_packfunctions.h"
|
---|
21 | #include "cr_net.h"
|
---|
22 | #include "packspu_proto.h"
|
---|
23 |
|
---|
24 | void PACKSPU_APIENTRY
|
---|
25 | packspu_FramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
|
---|
26 | {
|
---|
27 | crStateFramebufferTexture1DEXT(target, attachment, textarget, texture, level);
|
---|
28 | crPackFramebufferTexture1DEXT(target, attachment, textarget, texture, level);
|
---|
29 | }
|
---|
30 |
|
---|
31 | void PACKSPU_APIENTRY
|
---|
32 | packspu_FramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
|
---|
33 | {
|
---|
34 | crStateFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
|
---|
35 | crPackFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
|
---|
36 | }
|
---|
37 |
|
---|
38 | void PACKSPU_APIENTRY
|
---|
39 | packspu_FramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
|
---|
40 | {
|
---|
41 | crStateFramebufferTexture3DEXT(target, attachment, textarget, texture, level, zoffset);
|
---|
42 | crPackFramebufferTexture3DEXT(target, attachment, textarget, texture, level, zoffset);
|
---|
43 | }
|
---|
44 |
|
---|
45 | void PACKSPU_APIENTRY
|
---|
46 | packspu_BindFramebufferEXT(GLenum target, GLuint framebuffer)
|
---|
47 | {
|
---|
48 | crStateBindFramebufferEXT(target, framebuffer);
|
---|
49 | crPackBindFramebufferEXT(target, framebuffer);
|
---|
50 | }
|
---|
51 |
|
---|
52 | void PACKSPU_APIENTRY
|
---|
53 | packspu_DeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers)
|
---|
54 | {
|
---|
55 | crStateDeleteFramebuffersEXT(n, framebuffers);
|
---|
56 | crPackDeleteFramebuffersEXT(n, framebuffers);
|
---|
57 | }
|
---|
58 |
|
---|
59 | void PACKSPU_APIENTRY
|
---|
60 | packspu_DeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers)
|
---|
61 | {
|
---|
62 | crStateDeleteRenderbuffersEXT(n, renderbuffers);
|
---|
63 | crPackDeleteRenderbuffersEXT(n, renderbuffers);
|
---|
64 | }
|
---|
65 |
|
---|
66 | void PACKSPU_APIENTRY
|
---|
67 | packspu_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
|
---|
68 | {
|
---|
69 | crStateFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);
|
---|
70 | crPackFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);
|
---|
71 | }
|
---|
72 |
|
---|
73 | void PACKSPU_APIENTRY
|
---|
74 | packspu_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
|
---|
75 | {
|
---|
76 | crStateBindRenderbufferEXT(target, renderbuffer);
|
---|
77 | crPackBindRenderbufferEXT(target, renderbuffer);
|
---|
78 | }
|
---|
79 |
|
---|
80 | GLenum PACKSPU_APIENTRY
|
---|
81 | packspu_CheckFramebufferStatusEXT(GLenum target)
|
---|
82 | {
|
---|
83 | GET_THREAD(thread);
|
---|
84 | int writeback = 1;
|
---|
85 | GLenum status = crStateCheckFramebufferStatusEXT(target);
|
---|
86 |
|
---|
87 | if (status!=GL_FRAMEBUFFER_UNDEFINED)
|
---|
88 | {
|
---|
89 | return status;
|
---|
90 | }
|
---|
91 |
|
---|
92 | crPackCheckFramebufferStatusEXT(target, &status, &writeback);
|
---|
93 |
|
---|
94 | packspuFlush((void *) thread);
|
---|
95 | CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
|
---|
96 |
|
---|
97 | crStateSetFramebufferStatus(target, status);
|
---|
98 | return status;
|
---|
99 | }
|
---|
100 |
|
---|
101 | void PACKSPU_APIENTRY packspu_GenFramebuffersEXT( GLsizei n, GLuint * framebuffers )
|
---|
102 | {
|
---|
103 | GET_THREAD(thread);
|
---|
104 | int writeback = 1;
|
---|
105 | if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
|
---|
106 | {
|
---|
107 | crError( "packspu_GenFramebuffersEXT doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
|
---|
108 | }
|
---|
109 | if (pack_spu.swap)
|
---|
110 | {
|
---|
111 | crPackGenFramebuffersEXTSWAP( n, framebuffers, &writeback );
|
---|
112 | }
|
---|
113 | else
|
---|
114 | {
|
---|
115 | crPackGenFramebuffersEXT( n, framebuffers, &writeback );
|
---|
116 | }
|
---|
117 | packspuFlush( (void *) thread );
|
---|
118 | CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
|
---|
119 |
|
---|
120 | crStateRegFramebuffers(n, framebuffers);
|
---|
121 | }
|
---|
122 |
|
---|
123 | void PACKSPU_APIENTRY packspu_GenRenderbuffersEXT( GLsizei n, GLuint * renderbuffers )
|
---|
124 | {
|
---|
125 | GET_THREAD(thread);
|
---|
126 | int writeback = 1;
|
---|
127 | if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
|
---|
128 | {
|
---|
129 | crError( "packspu_GenRenderbuffersEXT doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
|
---|
130 | }
|
---|
131 | if (pack_spu.swap)
|
---|
132 | {
|
---|
133 | crPackGenRenderbuffersEXTSWAP( n, renderbuffers, &writeback );
|
---|
134 | }
|
---|
135 | else
|
---|
136 | {
|
---|
137 | crPackGenRenderbuffersEXT( n, renderbuffers, &writeback );
|
---|
138 | }
|
---|
139 | packspuFlush( (void *) thread );
|
---|
140 | CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
|
---|
141 |
|
---|
142 | crStateRegRenderbuffers(n, renderbuffers);
|
---|
143 | }
|
---|