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 |
|
---|
9 | void *wined3d_rb_alloc(size_t size)
|
---|
10 | {
|
---|
11 | return RTMemAlloc(size);
|
---|
12 | }
|
---|
13 |
|
---|
14 | void *wined3d_rb_realloc(void *ptr, size_t size)
|
---|
15 | {
|
---|
16 | return RTMemRealloc(ptr, size);
|
---|
17 | }
|
---|
18 |
|
---|
19 | void 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 */
|
---|
25 | unsigned 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 |
|
---|
35 | UINT 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. */
|
---|
63 | void 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 |
|
---|
69 | const 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 |
|
---|
86 | void dump_color_fixup_desc(struct color_fixup_desc fixup)
|
---|
87 | {
|
---|
88 | }
|
---|
89 |
|
---|
90 | void context_release(struct wined3d_context *context)
|
---|
91 | {
|
---|
92 | }
|
---|
93 |
|
---|
94 | static void CDECL wined3d_do_nothing(void)
|
---|
95 | {
|
---|
96 | }
|
---|
97 |
|
---|
98 | void (* CDECL wine_tsx11_lock_ptr)(void) = wined3d_do_nothing;
|
---|
99 | void (* CDECL wine_tsx11_unlock_ptr)(void) = wined3d_do_nothing;
|
---|
100 |
|
---|
101 | HANDLE WINAPI VBoxGetProcessHeap(void)
|
---|
102 | {
|
---|
103 | return 0;
|
---|
104 | }
|
---|
105 |
|
---|
106 | LPVOID WINAPI VBoxHeapAlloc(HANDLE hHeap, DWORD heaptype,SIZE_T size)
|
---|
107 | {
|
---|
108 | return RTMemAllocZ(size);
|
---|
109 | }
|
---|
110 |
|
---|
111 | BOOL WINAPI VBoxHeapFree(HANDLE hHeap, DWORD heaptype,LPVOID ptr)
|
---|
112 | {
|
---|
113 | RTMemFree(ptr);
|
---|
114 | return TRUE;
|
---|
115 | }
|
---|
116 |
|
---|
117 | LPVOID WINAPI VBoxHeapReAlloc(HANDLE hHeap,DWORD heaptype,LPVOID ptr ,SIZE_T size)
|
---|
118 | {
|
---|
119 | return RTMemRealloc(ptr, size);
|
---|
120 | }
|
---|
121 |
|
---|
122 | void VBoxDebugBreak()
|
---|
123 | {
|
---|
124 | AssertFailed();
|
---|
125 | }
|
---|
126 |
|
---|