1 | /* $Id: packspu_framebuffer.c 78375 2019-05-03 21:51:02Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox OpenGL FBO related functions
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2009-2019 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(&pack_spu.StateTracker, 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(&pack_spu.StateTracker, 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(&pack_spu.StateTracker, 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(&pack_spu.StateTracker, target, framebuffer);
|
---|
49 | crPackBindFramebufferEXT(target, framebuffer);
|
---|
50 | }
|
---|
51 |
|
---|
52 | void PACKSPU_APIENTRY
|
---|
53 | packspu_DeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers)
|
---|
54 | {
|
---|
55 | crStateDeleteFramebuffersEXT(&pack_spu.StateTracker, n, framebuffers);
|
---|
56 | crPackDeleteFramebuffersEXT(n, framebuffers);
|
---|
57 | }
|
---|
58 |
|
---|
59 | void PACKSPU_APIENTRY
|
---|
60 | packspu_DeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers)
|
---|
61 | {
|
---|
62 | crStateDeleteRenderbuffersEXT(&pack_spu.StateTracker, 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(&pack_spu.StateTracker, 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(&pack_spu.StateTracker, 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(&pack_spu.StateTracker, 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(&pack_spu.StateTracker, 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 |
|
---|
110 | crPackGenFramebuffersEXT( n, framebuffers, &writeback );
|
---|
111 | packspuFlush( (void *) thread );
|
---|
112 | CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
|
---|
113 |
|
---|
114 | crStateRegFramebuffers(&pack_spu.StateTracker, n, framebuffers);
|
---|
115 | }
|
---|
116 |
|
---|
117 | void PACKSPU_APIENTRY packspu_GenRenderbuffersEXT( GLsizei n, GLuint * renderbuffers )
|
---|
118 | {
|
---|
119 | GET_THREAD(thread);
|
---|
120 | int writeback = 1;
|
---|
121 | if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
|
---|
122 | {
|
---|
123 | crError( "packspu_GenRenderbuffersEXT doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
|
---|
124 | }
|
---|
125 |
|
---|
126 | crPackGenRenderbuffersEXT( n, renderbuffers, &writeback );
|
---|
127 | packspuFlush( (void *) thread );
|
---|
128 | CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
|
---|
129 |
|
---|
130 | crStateRegRenderbuffers(&pack_spu.StateTracker, n, renderbuffers);
|
---|
131 | }
|
---|