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