VirtualBox

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

Last change on this file since 29359 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
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
26void SERVER_DISPATCH_APIENTRY
27crServerDispatchGenFramebuffersEXT(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
36void SERVER_DISPATCH_APIENTRY
37crServerDispatchGenRenderbuffersEXT(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
46void 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
57void 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
68void 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
79void 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
93void 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
99void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers)
100{
101 crStateDeleteFramebuffersEXT(n, framebuffers);
102}
103
104void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers)
105{
106 crStateDeleteRenderbuffersEXT(n, renderbuffers);
107}
108
109void SERVER_DISPATCH_APIENTRY
110crServerDispatchFramebufferRenderbufferEXT(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
116void SERVER_DISPATCH_APIENTRY
117crServerDispatchGetFramebufferAttachmentParameterivEXT(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}
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