VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_gentextures.c@ 55998

Last change on this file since 55998 was 31808, checked in by vboxsync, 14 years ago

crOpenGL: resource sharing between contexts

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include "cr_spu.h"
8#include "chromium.h"
9#include "cr_mem.h"
10#include "cr_net.h"
11#include "server_dispatch.h"
12#include "server.h"
13
14void SERVER_DISPATCH_APIENTRY crServerDispatchGenTextures( GLsizei n, GLuint *textures )
15{
16 GLuint *local_textures = (GLuint *) crAlloc(n*sizeof(*local_textures));
17 (void) textures;
18
19 crStateGenTextures(n, local_textures);
20
21 crServerReturnValue(local_textures, n*sizeof(*local_textures));
22 crFree( local_textures );
23}
24
25void SERVER_DISPATCH_APIENTRY crServerDispatchGenProgramsNV( GLsizei n, GLuint * ids )
26{
27 GLuint *local_progs = (GLuint *) crAlloc( n*sizeof( *local_progs) );
28 (void) ids;
29 cr_server.head_spu->dispatch_table.GenProgramsNV( n, local_progs );
30 crServerReturnValue( local_progs, n*sizeof( *local_progs ) );
31 crFree( local_progs );
32}
33
34
35void SERVER_DISPATCH_APIENTRY crServerDispatchGenFencesNV( GLsizei n, GLuint * ids )
36{
37 GLuint *local_fences = (GLuint *) crAlloc( n*sizeof( *local_fences) );
38 (void) ids;
39 cr_server.head_spu->dispatch_table.GenFencesNV( n, local_fences );
40 crServerReturnValue( local_fences, n*sizeof( *local_fences ) );
41 crFree( local_fences );
42}
43
44void SERVER_DISPATCH_APIENTRY crServerDispatchGenProgramsARB( GLsizei n, GLuint * ids )
45{
46 GLuint *local_progs = (GLuint *) crAlloc( n*sizeof( *local_progs) );
47 GLsizei i;
48 (void) ids;
49 cr_server.head_spu->dispatch_table.GenProgramsARB( n, local_progs );
50
51 /* see comments in crServerDispatchGenTextures */
52 for (i=0; i<n; ++i)
53 {
54 GLuint tID = crServerTranslateProgramID(local_progs[i]);
55 while (crStateIsProgramARB(tID))
56 {
57 cr_server.head_spu->dispatch_table.GenProgramsARB(1, &tID);
58 local_progs[i] = tID;
59 tID = crServerTranslateProgramID(tID);
60 }
61 }
62
63 crServerReturnValue( local_progs, n*sizeof( *local_progs ) );
64 crFree( local_progs );
65}
66
67void SERVER_DISPATCH_APIENTRY
68crServerDispatchCopyTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
69{
70 GLsizei tw, th;
71
72 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &tw);
73 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &th);
74
75 /* Workaround for a wine or ati bug. Host drivers crash unless we first provide texture bounds. */
76 if (((tw!=width) || (th!=height)) && (internalFormat==GL_DEPTH_COMPONENT24))
77 {
78 crServerDispatchTexImage2D(target, level, internalFormat, width, height, border, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
79 }
80
81 crStateCopyTexImage2D(target, level, internalFormat, x, y, width, height, border);
82 cr_server.head_spu->dispatch_table.CopyTexImage2D(target, level, internalFormat, x, y, width, height, border);
83}
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