1 | /* $Id: server_framebuffer.c 28800 2010-04-27 08:22:32Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox OpenGL: EXT_framebuffer_object
|
---|
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 | #include "cr_spu.h"
|
---|
20 | #include "chromium.h"
|
---|
21 | #include "cr_mem.h"
|
---|
22 | #include "cr_net.h"
|
---|
23 | #include "server_dispatch.h"
|
---|
24 | #include "server.h"
|
---|
25 |
|
---|
26 | void SERVER_DISPATCH_APIENTRY
|
---|
27 | crServerDispatchGenFramebuffersEXT(GLsizei n, GLuint *framebuffers)
|
---|
28 | {
|
---|
29 | GLuint *local_buffers = (GLuint *) crAlloc(n * sizeof(*local_buffers));
|
---|
30 | (void) framebuffers;
|
---|
31 | cr_server.head_spu->dispatch_table.GenFramebuffersEXT(n, local_buffers);
|
---|
32 | crServerReturnValue(local_buffers, n * sizeof(*local_buffers));
|
---|
33 | crFree(local_buffers);
|
---|
34 | }
|
---|
35 |
|
---|
36 | void SERVER_DISPATCH_APIENTRY
|
---|
37 | crServerDispatchGenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers)
|
---|
38 | {
|
---|
39 | GLuint *local_buffers = (GLuint *) crAlloc(n * sizeof(*local_buffers));
|
---|
40 | (void) renderbuffers;
|
---|
41 | cr_server.head_spu->dispatch_table.GenFramebuffersEXT(n, local_buffers);
|
---|
42 | crServerReturnValue(local_buffers, n * sizeof(*local_buffers));
|
---|
43 | crFree(local_buffers);
|
---|
44 | }
|
---|
45 |
|
---|
46 | void SERVER_DISPATCH_APIENTRY crServerDispatchFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
|
---|
47 | {
|
---|
48 | if (texture)
|
---|
49 | {
|
---|
50 | texture = crServerTranslateTextureID(texture);
|
---|
51 | }
|
---|
52 |
|
---|
53 | crStateFramebufferTexture1DEXT(target, attachment, textarget, texture, level);
|
---|
54 | cr_server.head_spu->dispatch_table.FramebufferTexture1DEXT(target, attachment, textarget, texture, level);
|
---|
55 | }
|
---|
56 |
|
---|
57 | void SERVER_DISPATCH_APIENTRY crServerDispatchFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
|
---|
58 | {
|
---|
59 | if (texture)
|
---|
60 | {
|
---|
61 | texture = crServerTranslateTextureID(texture);
|
---|
62 | }
|
---|
63 |
|
---|
64 | crStateFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
|
---|
65 | cr_server.head_spu->dispatch_table.FramebufferTexture2DEXT(target, attachment, textarget, texture, level);
|
---|
66 | }
|
---|
67 |
|
---|
68 | void SERVER_DISPATCH_APIENTRY crServerDispatchFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
|
---|
69 | {
|
---|
70 | if (texture)
|
---|
71 | {
|
---|
72 | texture = crServerTranslateTextureID(texture);
|
---|
73 | }
|
---|
74 |
|
---|
75 | crStateFramebufferTexture3DEXT(target, attachment, textarget, texture, level, zoffset);
|
---|
76 | cr_server.head_spu->dispatch_table.FramebufferTexture3DEXT(target, attachment, textarget, texture, level, zoffset);
|
---|
77 | }
|
---|
78 |
|
---|
79 | void SERVER_DISPATCH_APIENTRY crServerDispatchBindFramebufferEXT(GLenum target, GLuint framebuffer)
|
---|
80 | {
|
---|
81 | crStateBindFramebufferEXT(target, framebuffer);
|
---|
82 |
|
---|
83 | if (0==framebuffer && crServerIsRedirectedToFBO())
|
---|
84 | {
|
---|
85 | cr_server.head_spu->dispatch_table.BindFramebufferEXT(target, cr_server.curClient->currentMural->idFBO);
|
---|
86 | }
|
---|
87 | else
|
---|
88 | {
|
---|
89 | cr_server.head_spu->dispatch_table.BindFramebufferEXT(target, crStateGetFramebufferHWID(framebuffer));
|
---|
90 | }
|
---|
91 | }
|
---|
92 |
|
---|
93 | void SERVER_DISPATCH_APIENTRY crServerDispatchBindRenderbufferEXT(GLenum target, GLuint renderbuffer)
|
---|
94 | {
|
---|
95 | crStateBindRenderbufferEXT(target, renderbuffer);
|
---|
96 | cr_server.head_spu->dispatch_table.BindRenderbufferEXT(target, crStateGetRenderbufferHWID(renderbuffer));
|
---|
97 | }
|
---|
98 |
|
---|
99 | void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers)
|
---|
100 | {
|
---|
101 | crStateDeleteFramebuffersEXT(n, framebuffers);
|
---|
102 | }
|
---|
103 |
|
---|
104 | void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers)
|
---|
105 | {
|
---|
106 | crStateDeleteRenderbuffersEXT(n, renderbuffers);
|
---|
107 | }
|
---|
108 |
|
---|
109 | void SERVER_DISPATCH_APIENTRY
|
---|
110 | crServerDispatchFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
|
---|
111 | {
|
---|
112 | crStateFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);
|
---|
113 | cr_server.head_spu->dispatch_table.FramebufferRenderbufferEXT(target, attachment, renderbuffertarget, crStateGetRenderbufferHWID(renderbuffer));
|
---|
114 | }
|
---|
115 |
|
---|
116 | void SERVER_DISPATCH_APIENTRY
|
---|
117 | crServerDispatchGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint * params)
|
---|
118 | {
|
---|
119 | GLint local_params[1];
|
---|
120 | (void) params;
|
---|
121 | crStateGetFramebufferAttachmentParameterivEXT(target, attachment, pname, local_params);
|
---|
122 |
|
---|
123 | if (GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT==pname)
|
---|
124 | {
|
---|
125 | GLint type;
|
---|
126 | crStateGetFramebufferAttachmentParameterivEXT(target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT, &type);
|
---|
127 | if (GL_TEXTURE==type)
|
---|
128 | {
|
---|
129 | /*todo, add reverse of crServerTranslateTextureID*/
|
---|
130 | if (!cr_server.sharedTextureObjects && local_params[0])
|
---|
131 | {
|
---|
132 | int client = cr_server.curClient->number;
|
---|
133 | local_params[0] = local_params[0] - client * 100000;
|
---|
134 | }
|
---|
135 | }
|
---|
136 | }
|
---|
137 |
|
---|
138 | crServerReturnValue(&(local_params[0]), 1*sizeof(GLint));
|
---|
139 | }
|
---|