VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/shaderlib/utils.c@ 53206

最後變更 在這個檔案從53206是 53201,由 vboxsync 提交於 10 年 前

Devices/Main: vmsvga updates

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.2 KB
 
1#include <iprt/err.h>
2#include <iprt/mem.h>
3#include <iprt/assert.h>
4#include <windows.h>
5#include "wined3d_private.h"
6
7
8
9void *wined3d_rb_alloc(size_t size)
10{
11 return RTMemAlloc(size);
12}
13
14void *wined3d_rb_realloc(void *ptr, size_t size)
15{
16 return RTMemRealloc(ptr, size);
17}
18
19void wined3d_rb_free(void *ptr)
20{
21 RTMemFree(ptr);
22}
23
24/* This small helper function is used to convert a bitmask into the number of masked bits */
25unsigned int count_bits(unsigned int mask)
26{
27 unsigned int count;
28 for (count = 0; mask; ++count)
29 {
30 mask &= mask - 1;
31 }
32 return count;
33}
34
35UINT wined3d_log2i(UINT32 x)
36{
37 static const UINT l[] =
38 {
39 ~0U, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
40 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
41 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
42 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
43 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
44 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
45 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
46 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
47 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
48 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
49 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
50 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
51 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
52 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
53 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
54 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
55 };
56 UINT32 i;
57
58 return (i = x >> 16) ? (x = i >> 8) ? l[x] + 24 : l[i] + 16 : (i = x >> 8) ? l[i] + 8 : l[x];
59}
60
61/* Set the shader type for this device, depending on the given capabilities
62 * and the user preferences in wined3d_settings. */
63void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected, int *vs_selected)
64{
65 *vs_selected = SHADER_GLSL;
66 *ps_selected = SHADER_GLSL;
67}
68
69const char *debug_glerror(GLenum error) {
70 switch(error) {
71#define GLERROR_TO_STR(u) case u: return #u
72 GLERROR_TO_STR(GL_NO_ERROR);
73 GLERROR_TO_STR(GL_INVALID_ENUM);
74 GLERROR_TO_STR(GL_INVALID_VALUE);
75 GLERROR_TO_STR(GL_INVALID_OPERATION);
76 GLERROR_TO_STR(GL_STACK_OVERFLOW);
77 GLERROR_TO_STR(GL_STACK_UNDERFLOW);
78 GLERROR_TO_STR(GL_OUT_OF_MEMORY);
79 GLERROR_TO_STR(GL_INVALID_FRAMEBUFFER_OPERATION);
80#undef GLERROR_TO_STR
81 default:
82 return "unrecognized";
83 }
84}
85
86void dump_color_fixup_desc(struct color_fixup_desc fixup)
87{
88}
89
90void context_release(struct wined3d_context *context)
91{
92}
93
94static void CDECL wined3d_do_nothing(void)
95{
96}
97
98void (* CDECL wine_tsx11_lock_ptr)(void) = wined3d_do_nothing;
99void (* CDECL wine_tsx11_unlock_ptr)(void) = wined3d_do_nothing;
100
101HANDLE WINAPI VBoxGetProcessHeap(void)
102{
103 return 0;
104}
105
106LPVOID WINAPI VBoxHeapAlloc(HANDLE hHeap, DWORD heaptype,SIZE_T size)
107{
108 return RTMemAllocZ(size);
109}
110
111BOOL WINAPI VBoxHeapFree(HANDLE hHeap, DWORD heaptype,LPVOID ptr)
112{
113 RTMemFree(ptr);
114 return TRUE;
115}
116
117LPVOID WINAPI VBoxHeapReAlloc(HANDLE hHeap,DWORD heaptype,LPVOID ptr ,SIZE_T size)
118{
119 return RTMemRealloc(ptr, size);
120}
121
122void VBoxDebugBreak()
123{
124 AssertFailed();
125}
126
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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