VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_framebuffer.c@ 27948

Last change on this file since 27948 was 27889, checked in by vboxsync, 15 years ago

crOpenGL: more code for multiscreen support

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1/* $Id: server_framebuffer.c 27889 2010-03-31 12:57:09Z 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
30void SERVER_DISPATCH_APIENTRY
31crServerDispatchGenFramebuffersEXT(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
40void SERVER_DISPATCH_APIENTRY
41crServerDispatchGenRenderbuffersEXT(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
50void 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
61void 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
72void 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
83void SERVER_DISPATCH_APIENTRY crServerDispatchBindFramebufferEXT(GLenum target, GLuint framebuffer)
84{
85 crStateBindFramebufferEXT(target, framebuffer);
86
87 if (0==framebuffer && crServerIsRedirectedToFBO())
88 {
89 cr_server.head_spu->dispatch_table.BindFramebufferEXT(target, cr_server.curClient->currentMural->idFBO);
90 }
91 else
92 {
93 cr_server.head_spu->dispatch_table.BindFramebufferEXT(target, crStateGetFramebufferHWID(framebuffer));
94 }
95}
96
97void SERVER_DISPATCH_APIENTRY crServerDispatchBindRenderbufferEXT(GLenum target, GLuint renderbuffer)
98{
99 crStateBindRenderbufferEXT(target, renderbuffer);
100 cr_server.head_spu->dispatch_table.BindRenderbufferEXT(target, crStateGetRenderbufferHWID(renderbuffer));
101}
102
103void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers)
104{
105 crStateDeleteFramebuffersEXT(n, framebuffers);
106}
107
108void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers)
109{
110 crStateDeleteRenderbuffersEXT(n, renderbuffers);
111}
112
113void SERVER_DISPATCH_APIENTRY
114crServerDispatchFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
115{
116 crStateFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);
117 cr_server.head_spu->dispatch_table.FramebufferRenderbufferEXT(target, attachment, renderbuffertarget, crStateGetRenderbufferHWID(renderbuffer));
118}
119
120void SERVER_DISPATCH_APIENTRY
121crServerDispatchGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint * params)
122{
123 GLint local_params[1];
124 (void) params;
125 crStateGetFramebufferAttachmentParameterivEXT(target, attachment, pname, local_params);
126
127 if (GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT==pname)
128 {
129 GLint type;
130 crStateGetFramebufferAttachmentParameterivEXT(target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT, &type);
131 if (GL_TEXTURE==type)
132 {
133 /*todo, add reverse of crServerTranslateTextureID*/
134 if (!cr_server.sharedTextureObjects && local_params[0])
135 {
136 int client = cr_server.curClient->number;
137 local_params[0] = local_params[0] - client * 100000;
138 }
139 }
140 }
141
142 crServerReturnValue(&(local_params[0]), 1*sizeof(GLint));
143}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette