VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getteximage.cpp@ 78190

最後變更 在這個檔案從78190是 78190,由 vboxsync 提交於 6 年 前

Merge first stage of the Chromium cleanup from the branch:

  • r129818 (Remove VBOX_WITH_CR_DISPLAY_LISTS and accompanying code as it was disabled since r108676 and was never brought back (see ​bugref:3456 and ​bugref:8485))
  • r129819 (HostServices/SharedOpenGL: Remove unused main entry point from upstream server process based implementation)
  • r129820 (HostServices/SharedOpenGL: Started eliminating all backends other than HGCM. They are not used and probably wouldn't work anymore anyway)
  • r129821 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crTimer* API as it is not used anywhere)
  • r129822 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill most from cr_process.h apart from two used methods)
  • r129823 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crList* API as it is unused)
  • r129824 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crHullInteriorBox API as it is unused)
  • r129825 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crWarpPoint API as it is unused)
  • r129826 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill CrSa* API as it is unused and not even compiled in)
  • r129827 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill cr_bbox.h as it is unused)
  • r129828 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove a few crParseUrl() two uses)
  • r129829 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove last crParseURL() use)
  • r129830 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove crParseURL())
  • r129831 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove VBOX_WITH_COCOA_QT and related code when not set as it is the default for years now and we don't support anything else anymore)
  • r129832 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_logo.h)
  • r129833 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused crut_api.h and crut_clientapi.h)
  • r129834 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_dmx.h)
  • r129835 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_perf.h)
  • r129836 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove cr_rand.h and friends as it is not actively used anywhere)
  • r129837 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of all the swapped versions in the packer SPU, we never change endianess from guest to host and don't need it)
  • r129838 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129839 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129840 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused pack_pica.c)
  • r129841 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129842 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_endianess.h and friends)
  • r129843 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused lowercase.py)
  • r129844 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_calllists.h and friends)
  • r129845 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of completely unused idpool.c, not even compiled in)
  • r129846 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_debugopcodes.h and friends)
  • r129847 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the cr_mem.h API inline and get rid of the implementation in the util library)
  • r129848 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of SPUOptions and related code as it is of no use for us)
  • r129849 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_environment.h and friends and convert usage to RTEnv* APIs)
  • r129850 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused renderspu_agl.c)
  • r129851 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused code in cr_htable.h)
  • r129853 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Introduce a state paremeter for the unpacker workers instead of reyling on global variables, work in progress)
  • r129854 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Let the caller of crUnpack set up the initial state. This allows to get rid of the global return_ptr and writeback_ptr as they get supplied in the unpacker state by the server)
  • r129855 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the cr_lastDispatch and cr_unpackDispatch as they are of no use now)
  • r129856 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the global cr_unpackData and cr_unpackDataEnd symbols by indtroducing another hack to make it possible for certail server dispatch callbacks to access the data buffer)
  • r129857 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: build fix for release builds)
  • r129858 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the pointer to the unpacker state non const (is required for the access verification))
  • r129859 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: First iteration of the buffer size validation to prevent out of bound read access + added todos for places where additional checks are needed)
  • r129860 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129861 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129871 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129872 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Stop as soon as the unpacker encountered an error)
  • r129876 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129880 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129882 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Fixed some offsets in unpack_texture.c, 3DMark03 renders correctly again)
  • r130013 (HostServices/SharedOpenGL: Convert files to C++ so we can use C99 featuers on Windows with cl.exe)
  • r130014 (HostServices/SharedOpenGL,GuestHost/OpenGL: WIndows build fixes)
  • r130015 (HostServices/SharedOpenGL,GuestHost/OpenGL: More Windows build fixes)
  • r130036 (Config.kmk: Fix linker error on Windows by temporarily disabling the use of VBoxGuestR3DllMinW2K)
  • r130094 (src/VBox/GuestHost/OpenGL: Revert inlining the allocation/free functions in R3 completely as it doesn't work on Windows if memory is allocated and freed across different DLLs which don't share a common CRT, causes crashes in RtlValidtaeHeap())
  • r130095 (src/VBox/GuestHost/OpenGL,src/VBox/Additions/common/crOpenGL/pack: Don't use floating point specifiers in packspu_GetString() to avoid R6002 errors (couldn't fully understand why they occur suddenly after the rework but this gets rid of it))
  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id Revision
檔案大小: 4.8 KB
 
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 "chromium.h"
8#include "cr_error.h"
9#include "cr_mem.h"
10#include "cr_pixeldata.h"
11#include "server_dispatch.h"
12#include "server.h"
13
14void SERVER_DISPATCH_APIENTRY
15crServerDispatchGetTexImage(GLenum target, GLint level, GLenum format,
16 GLenum type, GLvoid * pixels)
17{
18 GLsizei width, height, depth, size;
19 GLvoid *buffer = NULL;
20
21
22#ifdef CR_ARB_pixel_buffer_object
23 if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
24 {
25 GLvoid *pbo_offset;
26
27 /*pixels are actually a pointer to location of 8byte network pointer in hgcm buffer
28 regardless of guest/host bitness we're using only 4lower bytes as there're no
29 pbo>4gb (yet?)
30 */
31 pbo_offset = (GLvoid*) ((uintptr_t) *((GLint*)pixels));
32
33 cr_server.head_spu->dispatch_table.GetTexImage(target, level, format, type, pbo_offset);
34
35 return;
36 }
37#endif
38
39 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
40 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height);
41 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth);
42
43 size = crTextureSize(format, type, width, height, depth);
44
45#if 0
46 {
47 CRContext *ctx = crStateGetCurrent();
48 CRTextureObj *tobj;
49 CRTextureLevel *tl;
50 GLint id;
51
52 crDebug("GetTexImage: %d, %i, %d, %d", target, level, format, type);
53 crDebug("===StateTracker===");
54 crDebug("Current TU: %i", ctx->texture.curTextureUnit);
55
56 if (target==GL_TEXTURE_2D)
57 {
58 tobj = ctx->texture.unit[ctx->texture.curTextureUnit].currentTexture2D;
59 CRASSERT(tobj);
60 tl = &tobj->level[0][level];
61 crDebug("Texture %i(hw %i), w=%i, h=%i", tobj->id, tobj->hwid, tl->width, tl->height, tl->depth);
62 }
63 else
64 {
65 crDebug("Not 2D tex");
66 }
67
68 crDebug("===GPU===");
69 cr_server.head_spu->dispatch_table.GetIntegerv(GL_ACTIVE_TEXTURE, &id);
70 crDebug("Current TU: %i", id);
71 if (target==GL_TEXTURE_2D)
72 {
73 cr_server.head_spu->dispatch_table.GetIntegerv(GL_TEXTURE_BINDING_2D, &id);
74 crDebug("Texture: %i, w=%i, h=%i, d=%i", id, width, height, depth);
75 }
76 }
77#endif
78
79 if (size && (buffer = crCalloc(size))) {
80 /* Note, the other pixel PACK parameters (default values) should
81 * be OK at this point.
82 */
83 cr_server.head_spu->dispatch_table.PixelStorei(GL_PACK_ALIGNMENT, 1);
84 cr_server.head_spu->dispatch_table.GetTexImage(target, level, format, type, buffer);
85 crServerReturnValue( buffer, size );
86 crFree(buffer);
87 }
88 else {
89 /* need to return _something_ to avoid blowing up */
90 GLuint dummy = 0;
91 crServerReturnValue( (GLvoid *) &dummy, sizeof(dummy) );
92 }
93}
94
95
96#if CR_ARB_texture_compression
97
98void SERVER_DISPATCH_APIENTRY
99crServerDispatchGetCompressedTexImageARB(GLenum target, GLint level,
100 GLvoid *img)
101{
102 GLint size;
103 GLvoid *buffer=NULL;
104
105#ifdef CR_ARB_pixel_buffer_object
106 if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
107 {
108 GLvoid *pbo_offset;
109
110 pbo_offset = (GLvoid*) ((uintptr_t) *((GLint*)img));
111
112 cr_server.head_spu->dispatch_table.GetCompressedTexImageARB(target, level, pbo_offset);
113
114 return;
115 }
116#endif
117
118 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &size);
119
120 if (size && (buffer = crCalloc(size))) {
121 /* XXX the pixel PACK parameter should be OK at this point */
122 cr_server.head_spu->dispatch_table.GetCompressedTexImageARB(target, level, buffer);
123 crServerReturnValue( buffer, size );
124 crFree(buffer);
125 }
126 else {
127 /* need to return _something_ to avoid blowing up */
128 GLuint dummy = 0;
129 crServerReturnValue( (GLvoid *) &dummy, sizeof(dummy) );
130 }
131}
132
133#endif /* CR_ARB_texture_compression */
134
135void SERVER_DISPATCH_APIENTRY crServerDispatchGetPolygonStipple( GLubyte * mask )
136{
137#ifdef CR_ARB_pixel_buffer_object
138 if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
139 {
140 GLvoid *pbo_offset;
141
142 pbo_offset = (GLubyte*) ((uintptr_t) *((GLint*)mask));
143
144 cr_server.head_spu->dispatch_table.GetPolygonStipple((GLubyte *)pbo_offset);
145 }
146 else
147#endif
148 {
149 GLubyte local_mask[128];
150
151 memset(local_mask, 0, sizeof(local_mask));
152
153 cr_server.head_spu->dispatch_table.GetPolygonStipple( local_mask );
154 crServerReturnValue( &(local_mask[0]), 128*sizeof(GLubyte) );
155 }
156}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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