Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 1 | /* |
| 2 | * state block implementation |
| 3 | * |
| 4 | * Copyright 2002 Raphael Junqueira |
Oliver Stieber | 16e8689 | 2005-03-02 13:44:58 +0000 | [diff] [blame] | 5 | * Copyright 2004 Jason Edmeades |
| 6 | * Copyright 2005 Oliver Stieber |
Alexandre Julliard | 6cfef95 | 2008-10-18 19:21:20 +0200 | [diff] [blame] | 7 | * Copyright 2007 Stefan Dösinger for CodeWeavers |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 8 | * |
| 9 | * This library is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Lesser General Public |
| 11 | * License as published by the Free Software Foundation; either |
| 12 | * version 2.1 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This library is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * Lesser General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Lesser General Public |
| 20 | * License along with this library; if not, write to the Free Software |
Jonathan Ernst | 360a3f9 | 2006-05-18 14:49:52 +0200 | [diff] [blame] | 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 22 | */ |
| 23 | |
| 24 | #include "config.h" |
| 25 | #include "wined3d_private.h" |
| 26 | |
| 27 | WINE_DEFAULT_DEBUG_CHANNEL(d3d); |
Stefan Dösinger | a460a2d | 2007-06-09 14:27:41 +0200 | [diff] [blame] | 28 | #define GLINFO_LOCATION This->wineD3DDevice->adapter->gl_info |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 29 | |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 30 | /*************************************** |
| 31 | * Stateblock helper functions follow |
| 32 | **************************************/ |
| 33 | |
| 34 | /** Allocates the correct amount of space for pixel and vertex shader constants, |
| 35 | * along with their set/changed flags on the given stateblock object |
| 36 | */ |
| 37 | HRESULT allocate_shader_constants(IWineD3DStateBlockImpl* object) { |
| 38 | |
| 39 | IWineD3DStateBlockImpl *This = object; |
| 40 | |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 41 | /* Allocate space for floating point constants */ |
| 42 | object->pixelShaderConstantF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(float) * GL_LIMITS(pshader_constantsF) * 4); |
Henri Verbeet | 3e035dd | 2008-12-12 09:33:52 +0100 | [diff] [blame] | 43 | if (!object->pixelShaderConstantF) goto fail; |
| 44 | |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 45 | object->changed.pixelShaderConstantsF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BOOL) * GL_LIMITS(pshader_constantsF)); |
Henri Verbeet | 3e035dd | 2008-12-12 09:33:52 +0100 | [diff] [blame] | 46 | if (!object->changed.pixelShaderConstantsF) goto fail; |
| 47 | |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 48 | object->vertexShaderConstantF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(float) * GL_LIMITS(vshader_constantsF) * 4); |
Henri Verbeet | 3e035dd | 2008-12-12 09:33:52 +0100 | [diff] [blame] | 49 | if (!object->vertexShaderConstantF) goto fail; |
| 50 | |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 51 | object->changed.vertexShaderConstantsF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BOOL) * GL_LIMITS(vshader_constantsF)); |
Henri Verbeet | 3e035dd | 2008-12-12 09:33:52 +0100 | [diff] [blame] | 52 | if (!object->changed.vertexShaderConstantsF) goto fail; |
| 53 | |
Stefan Dösinger | b21c785 | 2007-08-03 20:26:29 +0200 | [diff] [blame] | 54 | object->contained_vs_consts_f = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * GL_LIMITS(vshader_constantsF)); |
Henri Verbeet | 3e035dd | 2008-12-12 09:33:52 +0100 | [diff] [blame] | 55 | if (!object->contained_vs_consts_f) goto fail; |
| 56 | |
Stefan Dösinger | b21c785 | 2007-08-03 20:26:29 +0200 | [diff] [blame] | 57 | object->contained_ps_consts_f = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * GL_LIMITS(pshader_constantsF)); |
Henri Verbeet | 3e035dd | 2008-12-12 09:33:52 +0100 | [diff] [blame] | 58 | if (!object->contained_ps_consts_f) goto fail; |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 59 | |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 60 | return WINED3D_OK; |
Henri Verbeet | 3e035dd | 2008-12-12 09:33:52 +0100 | [diff] [blame] | 61 | |
| 62 | fail: |
| 63 | ERR("Failed to allocate memory\n"); |
| 64 | HeapFree(GetProcessHeap(), 0, object->pixelShaderConstantF); |
| 65 | HeapFree(GetProcessHeap(), 0, object->changed.pixelShaderConstantsF); |
| 66 | HeapFree(GetProcessHeap(), 0, object->vertexShaderConstantF); |
| 67 | HeapFree(GetProcessHeap(), 0, object->changed.vertexShaderConstantsF); |
| 68 | HeapFree(GetProcessHeap(), 0, object->contained_vs_consts_f); |
| 69 | HeapFree(GetProcessHeap(), 0, object->contained_ps_consts_f); |
| 70 | return E_OUTOFMEMORY; |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 71 | } |
| 72 | |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 73 | /** Copy all members of one stateblock to another */ |
Henri Verbeet | 0ae6076 | 2008-12-02 18:41:33 +0100 | [diff] [blame] | 74 | static void stateblock_savedstates_copy(IWineD3DStateBlock* iface, SAVEDSTATES *dest, const SAVEDSTATES *source) |
Henri Verbeet | 5532c99 | 2008-12-01 15:32:15 +0100 | [diff] [blame] | 75 | { |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 76 | IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; |
| 77 | unsigned bsize = sizeof(BOOL); |
| 78 | |
| 79 | /* Single values */ |
Henri Verbeet | 702eeb6 | 2009-03-05 12:30:43 +0100 | [diff] [blame] | 80 | dest->primitive_type = source->primitive_type; |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 81 | dest->indices = source->indices; |
| 82 | dest->material = source->material; |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 83 | dest->viewport = source->viewport; |
| 84 | dest->vertexDecl = source->vertexDecl; |
| 85 | dest->pixelShader = source->pixelShader; |
| 86 | dest->vertexShader = source->vertexShader; |
Stefan Dösinger | d4b63bb | 2007-01-10 11:28:42 +0100 | [diff] [blame] | 87 | dest->scissorRect = dest->scissorRect; |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 88 | |
| 89 | /* Fixed size arrays */ |
Henri Verbeet | 52a900d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 90 | dest->streamSource = source->streamSource; |
| 91 | dest->streamFreq = source->streamFreq; |
Henri Verbeet | 9a889f6 | 2009-01-02 16:19:12 +0100 | [diff] [blame] | 92 | dest->textures = source->textures; |
Henri Verbeet | fc39831 | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 93 | memcpy(dest->transform, source->transform, sizeof(source->transform)); |
Henri Verbeet | c33b381 | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 94 | memcpy(dest->renderState, source->renderState, sizeof(source->renderState)); |
Henri Verbeet | bddf5e7 | 2009-01-06 11:43:45 +0100 | [diff] [blame] | 95 | memcpy(dest->textureState, source->textureState, sizeof(source->textureState)); |
Henri Verbeet | fd33f0f | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 96 | memcpy(dest->samplerState, source->samplerState, sizeof(source->samplerState)); |
Henri Verbeet | 3b5c75d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 97 | dest->clipplane = source->clipplane; |
Henri Verbeet | 70968e6 | 2008-12-02 18:41:33 +0100 | [diff] [blame] | 98 | dest->pixelShaderConstantsB = source->pixelShaderConstantsB; |
| 99 | dest->pixelShaderConstantsI = source->pixelShaderConstantsI; |
| 100 | dest->vertexShaderConstantsB = source->vertexShaderConstantsB; |
| 101 | dest->vertexShaderConstantsI = source->vertexShaderConstantsI; |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 102 | |
| 103 | /* Dynamically sized arrays */ |
| 104 | memcpy(dest->pixelShaderConstantsF, source->pixelShaderConstantsF, bsize * GL_LIMITS(pshader_constantsF)); |
| 105 | memcpy(dest->vertexShaderConstantsF, source->vertexShaderConstantsF, bsize * GL_LIMITS(vshader_constantsF)); |
| 106 | } |
| 107 | |
Henri Verbeet | fc39831 | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 108 | static inline void stateblock_set_bits(DWORD *map, UINT map_size) |
| 109 | { |
| 110 | DWORD mask = (1 << (map_size & 0x1f)) - 1; |
| 111 | memset(map, 0xff, (map_size >> 5) * sizeof(*map)); |
| 112 | if (mask) map[map_size >> 5] = mask; |
| 113 | } |
| 114 | |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 115 | /** Set all members of a stateblock savedstate to the given value */ |
| 116 | void stateblock_savedstates_set( |
| 117 | IWineD3DStateBlock* iface, |
| 118 | SAVEDSTATES* states, |
| 119 | BOOL value) { |
| 120 | |
| 121 | IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; |
| 122 | unsigned bsize = sizeof(BOOL); |
| 123 | |
| 124 | /* Single values */ |
Henri Verbeet | 702eeb6 | 2009-03-05 12:30:43 +0100 | [diff] [blame] | 125 | states->primitive_type = value; |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 126 | states->indices = value; |
| 127 | states->material = value; |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 128 | states->viewport = value; |
| 129 | states->vertexDecl = value; |
| 130 | states->pixelShader = value; |
| 131 | states->vertexShader = value; |
Stefan Dösinger | d4b63bb | 2007-01-10 11:28:42 +0100 | [diff] [blame] | 132 | states->scissorRect = value; |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 133 | |
| 134 | /* Fixed size arrays */ |
Henri Verbeet | c33b381 | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 135 | if (value) |
| 136 | { |
Henri Verbeet | fd33f0f | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 137 | int i; |
Henri Verbeet | c33b381 | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 138 | states->streamSource = 0xffff; |
| 139 | states->streamFreq = 0xffff; |
| 140 | states->textures = 0xfffff; |
| 141 | stateblock_set_bits(states->transform, HIGHEST_TRANSFORMSTATE + 1); |
| 142 | stateblock_set_bits(states->renderState, WINEHIGHEST_RENDER_STATE + 1); |
Henri Verbeet | bddf5e7 | 2009-01-06 11:43:45 +0100 | [diff] [blame] | 143 | for (i = 0; i < MAX_TEXTURES; ++i) states->textureState[i] = 0x3ffff; |
Henri Verbeet | fd33f0f | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 144 | for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = 0x3fff; |
Henri Verbeet | c33b381 | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 145 | states->clipplane = 0xffffffff; |
| 146 | states->pixelShaderConstantsB = 0xffff; |
| 147 | states->pixelShaderConstantsI = 0xffff; |
| 148 | states->vertexShaderConstantsB = 0xffff; |
| 149 | states->vertexShaderConstantsI = 0xffff; |
| 150 | } |
| 151 | else |
| 152 | { |
| 153 | states->streamSource = 0; |
| 154 | states->streamFreq = 0; |
| 155 | states->textures = 0; |
| 156 | memset(states->transform, 0, sizeof(states->transform)); |
| 157 | memset(states->renderState, 0, sizeof(states->renderState)); |
Henri Verbeet | bddf5e7 | 2009-01-06 11:43:45 +0100 | [diff] [blame] | 158 | memset(states->textureState, 0, sizeof(states->textureState)); |
Henri Verbeet | fd33f0f | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 159 | memset(states->samplerState, 0, sizeof(states->samplerState)); |
Henri Verbeet | c33b381 | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 160 | states->clipplane = 0; |
| 161 | states->pixelShaderConstantsB = 0; |
| 162 | states->pixelShaderConstantsI = 0; |
| 163 | states->vertexShaderConstantsB = 0; |
| 164 | states->vertexShaderConstantsI = 0; |
| 165 | } |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 166 | |
| 167 | /* Dynamically sized arrays */ |
| 168 | memset(states->pixelShaderConstantsF, value, bsize * GL_LIMITS(pshader_constantsF)); |
| 169 | memset(states->vertexShaderConstantsF, value, bsize * GL_LIMITS(vshader_constantsF)); |
| 170 | } |
| 171 | |
| 172 | void stateblock_copy( |
| 173 | IWineD3DStateBlock* destination, |
| 174 | IWineD3DStateBlock* source) { |
Stefan Dösinger | acadf3f | 2007-02-14 17:46:54 +0100 | [diff] [blame] | 175 | int l; |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 176 | |
| 177 | IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)source; |
| 178 | IWineD3DStateBlockImpl *Dest = (IWineD3DStateBlockImpl *)destination; |
| 179 | |
| 180 | /* IUnknown fields */ |
| 181 | Dest->lpVtbl = This->lpVtbl; |
| 182 | Dest->ref = This->ref; |
| 183 | |
| 184 | /* IWineD3DStateBlock information */ |
| 185 | Dest->parent = This->parent; |
| 186 | Dest->wineD3DDevice = This->wineD3DDevice; |
| 187 | Dest->blockType = This->blockType; |
| 188 | |
| 189 | /* Saved states */ |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 190 | stateblock_savedstates_copy(source, &Dest->changed, &This->changed); |
| 191 | |
| 192 | /* Single items */ |
Henri Verbeet | 702eeb6 | 2009-03-05 12:30:43 +0100 | [diff] [blame] | 193 | Dest->gl_primitive_type = This->gl_primitive_type; |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 194 | Dest->vertexDecl = This->vertexDecl; |
| 195 | Dest->vertexShader = This->vertexShader; |
| 196 | Dest->streamIsUP = This->streamIsUP; |
| 197 | Dest->pIndexData = This->pIndexData; |
Stefan Dösinger | cb1c9dc | 2009-04-09 10:50:31 +0200 | [diff] [blame] | 198 | Dest->IndexFmt = This->IndexFmt; |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 199 | Dest->baseVertexIndex = This->baseVertexIndex; |
Stefan Dösinger | acadf3f | 2007-02-14 17:46:54 +0100 | [diff] [blame] | 200 | /* Dest->lights = This->lights; */ |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 201 | Dest->clip_status = This->clip_status; |
| 202 | Dest->viewport = This->viewport; |
| 203 | Dest->material = This->material; |
| 204 | Dest->pixelShader = This->pixelShader; |
Andrew Talbot | 19c105c | 2008-03-20 22:25:13 +0000 | [diff] [blame] | 205 | Dest->scissorRect = This->scissorRect; |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 206 | |
Stefan Dösinger | acadf3f | 2007-02-14 17:46:54 +0100 | [diff] [blame] | 207 | /* Lights */ |
| 208 | memset(This->activeLights, 0, sizeof(This->activeLights)); |
| 209 | for(l = 0; l < LIGHTMAP_SIZE; l++) { |
| 210 | struct list *e1, *e2; |
| 211 | LIST_FOR_EACH_SAFE(e1, e2, &Dest->lightMap[l]) { |
| 212 | PLIGHTINFOEL *light = LIST_ENTRY(e1, PLIGHTINFOEL, entry); |
| 213 | list_remove(&light->entry); |
| 214 | HeapFree(GetProcessHeap(), 0, light); |
| 215 | } |
| 216 | |
| 217 | LIST_FOR_EACH(e1, &This->lightMap[l]) { |
| 218 | PLIGHTINFOEL *light = LIST_ENTRY(e1, PLIGHTINFOEL, entry), *light2; |
| 219 | light2 = HeapAlloc(GetProcessHeap(), 0, sizeof(*light)); |
Andrew Talbot | 19c105c | 2008-03-20 22:25:13 +0000 | [diff] [blame] | 220 | *light2 = *light; |
Stefan Dösinger | f753072 | 2007-08-16 13:30:42 +0200 | [diff] [blame] | 221 | list_add_tail(&Dest->lightMap[l], &light2->entry); |
| 222 | if(light2->glIndex != -1) Dest->activeLights[light2->glIndex] = light2; |
Stefan Dösinger | acadf3f | 2007-02-14 17:46:54 +0100 | [diff] [blame] | 223 | } |
| 224 | } |
| 225 | |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 226 | /* Fixed size arrays */ |
| 227 | memcpy(Dest->vertexShaderConstantB, This->vertexShaderConstantB, sizeof(BOOL) * MAX_CONST_B); |
| 228 | memcpy(Dest->vertexShaderConstantI, This->vertexShaderConstantI, sizeof(INT) * MAX_CONST_I * 4); |
| 229 | memcpy(Dest->pixelShaderConstantB, This->pixelShaderConstantB, sizeof(BOOL) * MAX_CONST_B); |
| 230 | memcpy(Dest->pixelShaderConstantI, This->pixelShaderConstantI, sizeof(INT) * MAX_CONST_I * 4); |
| 231 | |
| 232 | memcpy(Dest->streamStride, This->streamStride, sizeof(UINT) * MAX_STREAMS); |
| 233 | memcpy(Dest->streamOffset, This->streamOffset, sizeof(UINT) * MAX_STREAMS); |
Henri Verbeet | aa3027a | 2009-03-06 14:56:23 +0100 | [diff] [blame] | 234 | memcpy(Dest->streamSource, This->streamSource, sizeof(IWineD3DBuffer *) * MAX_STREAMS); |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 235 | memcpy(Dest->streamFreq, This->streamFreq, sizeof(UINT) * MAX_STREAMS); |
| 236 | memcpy(Dest->streamFlags, This->streamFlags, sizeof(UINT) * MAX_STREAMS); |
Ivan Gyurdiev | ac37163 | 2006-10-12 02:21:39 -0400 | [diff] [blame] | 237 | memcpy(Dest->transforms, This->transforms, sizeof(WINED3DMATRIX) * (HIGHEST_TRANSFORMSTATE + 1)); |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 238 | memcpy(Dest->clipplane, This->clipplane, sizeof(double) * MAX_CLIPPLANES * 4); |
| 239 | memcpy(Dest->renderState, This->renderState, sizeof(DWORD) * (WINEHIGHEST_RENDER_STATE + 1)); |
H. Verbeet | 5b7758f | 2007-06-25 22:45:40 +0200 | [diff] [blame] | 240 | memcpy(Dest->textures, This->textures, sizeof(IWineD3DBaseTexture*) * MAX_COMBINED_SAMPLERS); |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 241 | memcpy(Dest->textureState, This->textureState, sizeof(DWORD) * MAX_TEXTURES * (WINED3D_HIGHEST_TEXTURE_STATE + 1)); |
H. Verbeet | 5b7758f | 2007-06-25 22:45:40 +0200 | [diff] [blame] | 242 | memcpy(Dest->samplerState, This->samplerState, sizeof(DWORD) * MAX_COMBINED_SAMPLERS * (WINED3D_HIGHEST_SAMPLER_STATE + 1)); |
Jason Green | 75950b5 | 2006-07-23 15:08:27 -0400 | [diff] [blame] | 243 | |
| 244 | /* Dynamically sized arrays */ |
| 245 | memcpy(Dest->vertexShaderConstantF, This->vertexShaderConstantF, sizeof(float) * GL_LIMITS(vshader_constantsF) * 4); |
| 246 | memcpy(Dest->pixelShaderConstantF, This->pixelShaderConstantF, sizeof(float) * GL_LIMITS(pshader_constantsF) * 4); |
| 247 | } |
| 248 | |
Oliver Stieber | 16e8689 | 2005-03-02 13:44:58 +0000 | [diff] [blame] | 249 | /********************************************************** |
| 250 | * IWineD3DStateBlockImpl IUnknown parts follows |
| 251 | **********************************************************/ |
Alexandre Julliard | e9cbc66 | 2006-06-10 13:15:32 +0200 | [diff] [blame] | 252 | static HRESULT WINAPI IWineD3DStateBlockImpl_QueryInterface(IWineD3DStateBlock *iface,REFIID riid,LPVOID *ppobj) |
Oliver Stieber | 16e8689 | 2005-03-02 13:44:58 +0000 | [diff] [blame] | 253 | { |
| 254 | IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; |
| 255 | TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj); |
| 256 | if (IsEqualGUID(riid, &IID_IUnknown) |
H. Verbeet | bd8db45 | 2006-02-06 11:32:41 +0100 | [diff] [blame] | 257 | || IsEqualGUID(riid, &IID_IWineD3DBase) |
Oliver Stieber | 16e8689 | 2005-03-02 13:44:58 +0000 | [diff] [blame] | 258 | || IsEqualGUID(riid, &IID_IWineD3DStateBlock)){ |
| 259 | IUnknown_AddRef(iface); |
| 260 | *ppobj = This; |
Ivan Gyurdiev | 07f4f70 | 2006-04-25 17:59:12 -0400 | [diff] [blame] | 261 | return S_OK; |
Oliver Stieber | 16e8689 | 2005-03-02 13:44:58 +0000 | [diff] [blame] | 262 | } |
Ivan Gyurdiev | 07f4f70 | 2006-04-25 17:59:12 -0400 | [diff] [blame] | 263 | *ppobj = NULL; |
Oliver Stieber | 16e8689 | 2005-03-02 13:44:58 +0000 | [diff] [blame] | 264 | return E_NOINTERFACE; |
| 265 | } |
| 266 | |
Alexandre Julliard | e9cbc66 | 2006-06-10 13:15:32 +0200 | [diff] [blame] | 267 | static ULONG WINAPI IWineD3DStateBlockImpl_AddRef(IWineD3DStateBlock *iface) { |
Oliver Stieber | 16e8689 | 2005-03-02 13:44:58 +0000 | [diff] [blame] | 268 | IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; |
| 269 | ULONG refCount = InterlockedIncrement(&This->ref); |
| 270 | |
Ivan Gyurdiev | 3dcd368 | 2006-09-30 23:20:10 -0400 | [diff] [blame] | 271 | TRACE("(%p) : AddRef increasing from %d\n", This, refCount - 1); |
Oliver Stieber | 16e8689 | 2005-03-02 13:44:58 +0000 | [diff] [blame] | 272 | return refCount; |
| 273 | } |
| 274 | |
Alexandre Julliard | e9cbc66 | 2006-06-10 13:15:32 +0200 | [diff] [blame] | 275 | static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) { |
Oliver Stieber | 16e8689 | 2005-03-02 13:44:58 +0000 | [diff] [blame] | 276 | IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; |
| 277 | ULONG refCount = InterlockedDecrement(&This->ref); |
| 278 | |
Ivan Gyurdiev | 3dcd368 | 2006-09-30 23:20:10 -0400 | [diff] [blame] | 279 | TRACE("(%p) : Releasing from %d\n", This, refCount + 1); |
Oliver Stieber | 16e8689 | 2005-03-02 13:44:58 +0000 | [diff] [blame] | 280 | |
| 281 | if (!refCount) { |
Stefan Dösinger | acadf3f | 2007-02-14 17:46:54 +0100 | [diff] [blame] | 282 | int counter; |
H. Verbeet | 09eb0c4 | 2006-08-19 17:24:02 +0200 | [diff] [blame] | 283 | |
Oliver Stieber | 7cb748f | 2005-07-26 18:49:30 +0000 | [diff] [blame] | 284 | /* type 0 represents the primary stateblock, so free all the resources */ |
| 285 | if (This->blockType == WINED3DSBT_INIT) { |
Francois Gouget | 9bfbfcb | 2006-06-23 18:18:02 +0200 | [diff] [blame] | 286 | /* NOTE: according to MSDN: The application is responsible for making sure the texture references are cleared down */ |
H. Verbeet | 5b7758f | 2007-06-25 22:45:40 +0200 | [diff] [blame] | 287 | for (counter = 0; counter < MAX_COMBINED_SAMPLERS; counter++) { |
Oliver Stieber | 7cb748f | 2005-07-26 18:49:30 +0000 | [diff] [blame] | 288 | if (This->textures[counter]) { |
Oliver Stieber | 7cb748f | 2005-07-26 18:49:30 +0000 | [diff] [blame] | 289 | /* release our 'internal' hold on the texture */ |
Oliver Stieber | e76969b | 2005-12-15 10:25:47 +0100 | [diff] [blame] | 290 | if(0 != IWineD3DBaseTexture_Release(This->textures[counter])) { |
Francois Gouget | 6526c37 | 2006-01-03 12:10:37 +0100 | [diff] [blame] | 291 | TRACE("Texture still referenced by stateblock, applications has leaked Stage = %u Texture = %p\n", counter, This->textures[counter]); |
Oliver Stieber | 7cb748f | 2005-07-26 18:49:30 +0000 | [diff] [blame] | 292 | } |
| 293 | } |
| 294 | } |
Stefan Dösinger | d170aab | 2007-08-19 20:40:44 +0200 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | for (counter = 0; counter < MAX_STREAMS; counter++) { |
| 298 | if(This->streamSource[counter]) { |
Henri Verbeet | aa3027a | 2009-03-06 14:56:23 +0100 | [diff] [blame] | 299 | if (IWineD3DBuffer_Release(This->streamSource[counter])) |
| 300 | { |
Stefan Dösinger | d170aab | 2007-08-19 20:40:44 +0200 | [diff] [blame] | 301 | TRACE("Vertex buffer still referenced by stateblock, applications has leaked Stream %u, buffer %p\n", counter, This->streamSource[counter]); |
Stefan Dösinger | 55b63fe | 2007-08-14 14:49:39 +0200 | [diff] [blame] | 302 | } |
| 303 | } |
Oliver Stieber | 7cb748f | 2005-07-26 18:49:30 +0000 | [diff] [blame] | 304 | } |
Stefan Dösinger | 513a493 | 2009-04-06 16:46:12 +0200 | [diff] [blame] | 305 | if(This->pIndexData) IWineD3DBuffer_Release(This->pIndexData); |
Stefan Dösinger | 36aef3d | 2007-08-20 18:56:10 +0200 | [diff] [blame] | 306 | if(This->vertexShader) IWineD3DVertexShader_Release(This->vertexShader); |
| 307 | if(This->pixelShader) IWineD3DPixelShader_Release(This->pixelShader); |
H. Verbeet | efa5f78 | 2006-08-19 17:23:02 +0200 | [diff] [blame] | 308 | |
Stefan Dösinger | acadf3f | 2007-02-14 17:46:54 +0100 | [diff] [blame] | 309 | for(counter = 0; counter < LIGHTMAP_SIZE; counter++) { |
| 310 | struct list *e1, *e2; |
| 311 | LIST_FOR_EACH_SAFE(e1, e2, &This->lightMap[counter]) { |
| 312 | PLIGHTINFOEL *light = LIST_ENTRY(e1, PLIGHTINFOEL, entry); |
| 313 | list_remove(&light->entry); |
| 314 | HeapFree(GetProcessHeap(), 0, light); |
| 315 | } |
| 316 | } |
| 317 | |
H. Verbeet | efa5f78 | 2006-08-19 17:23:02 +0200 | [diff] [blame] | 318 | HeapFree(GetProcessHeap(), 0, This->vertexShaderConstantF); |
H. Verbeet | efa5f78 | 2006-08-19 17:23:02 +0200 | [diff] [blame] | 319 | HeapFree(GetProcessHeap(), 0, This->changed.vertexShaderConstantsF); |
| 320 | HeapFree(GetProcessHeap(), 0, This->pixelShaderConstantF); |
H. Verbeet | efa5f78 | 2006-08-19 17:23:02 +0200 | [diff] [blame] | 321 | HeapFree(GetProcessHeap(), 0, This->changed.pixelShaderConstantsF); |
Stefan Dösinger | b21c785 | 2007-08-03 20:26:29 +0200 | [diff] [blame] | 322 | HeapFree(GetProcessHeap(), 0, This->contained_vs_consts_f); |
| 323 | HeapFree(GetProcessHeap(), 0, This->contained_ps_consts_f); |
Oliver Stieber | 16e8689 | 2005-03-02 13:44:58 +0000 | [diff] [blame] | 324 | HeapFree(GetProcessHeap(), 0, This); |
| 325 | } |
| 326 | return refCount; |
| 327 | } |
| 328 | |
| 329 | /********************************************************** |
| 330 | * IWineD3DStateBlockImpl parts follows |
| 331 | **********************************************************/ |
Alexandre Julliard | e9cbc66 | 2006-06-10 13:15:32 +0200 | [diff] [blame] | 332 | static HRESULT WINAPI IWineD3DStateBlockImpl_GetParent(IWineD3DStateBlock *iface, IUnknown **pParent) { |
Jason Edmeades | 289562e | 2004-11-23 13:52:46 +0000 | [diff] [blame] | 333 | IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; |
| 334 | IUnknown_AddRef(This->parent); |
| 335 | *pParent = This->parent; |
Stefan Dösinger | 9d67b42 | 2006-04-07 12:51:12 +0200 | [diff] [blame] | 336 | return WINED3D_OK; |
Jason Edmeades | 289562e | 2004-11-23 13:52:46 +0000 | [diff] [blame] | 337 | } |
| 338 | |
Alexandre Julliard | e9cbc66 | 2006-06-10 13:15:32 +0200 | [diff] [blame] | 339 | static HRESULT WINAPI IWineD3DStateBlockImpl_GetDevice(IWineD3DStateBlock *iface, IWineD3DDevice** ppDevice){ |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 340 | |
| 341 | IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; |
| 342 | |
| 343 | *ppDevice = (IWineD3DDevice*)This->wineD3DDevice; |
| 344 | IWineD3DDevice_AddRef(*ppDevice); |
Stefan Dösinger | 9d67b42 | 2006-04-07 12:51:12 +0200 | [diff] [blame] | 345 | return WINED3D_OK; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 346 | |
| 347 | } |
| 348 | |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 349 | static inline void record_lights(IWineD3DStateBlockImpl *This, IWineD3DStateBlockImpl *targetStateBlock) { |
| 350 | UINT i; |
| 351 | |
| 352 | /* Lights... For a recorded state block, we just had a chain of actions to perform, |
| 353 | * so we need to walk that chain and update any actions which differ |
| 354 | */ |
| 355 | for(i = 0; i < LIGHTMAP_SIZE; i++) { |
| 356 | struct list *e, *f; |
| 357 | LIST_FOR_EACH(e, &This->lightMap[i]) { |
| 358 | BOOL updated = FALSE; |
| 359 | PLIGHTINFOEL *src = LIST_ENTRY(e, PLIGHTINFOEL, entry), *realLight; |
| 360 | if(!src->changed || !src->enabledChanged) continue; |
| 361 | |
| 362 | /* Look up the light in the destination */ |
| 363 | LIST_FOR_EACH(f, &targetStateBlock->lightMap[i]) { |
| 364 | realLight = LIST_ENTRY(f, PLIGHTINFOEL, entry); |
| 365 | if(realLight->OriginalIndex == src->OriginalIndex) { |
| 366 | if(src->changed) { |
Andrew Talbot | 19c105c | 2008-03-20 22:25:13 +0000 | [diff] [blame] | 367 | src->OriginalParms = realLight->OriginalParms; |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 368 | } |
| 369 | if(src->enabledChanged) { |
| 370 | /* Need to double check because enabledChanged does not catch enabled -> disabled -> enabled |
| 371 | * or disabled -> enabled -> disabled changes |
| 372 | */ |
| 373 | if(realLight->glIndex == -1 && src->glIndex != -1) { |
| 374 | /* Light disabled */ |
| 375 | This->activeLights[src->glIndex] = NULL; |
| 376 | } else if(realLight->glIndex != -1 && src->glIndex == -1){ |
| 377 | /* Light enabled */ |
| 378 | This->activeLights[realLight->glIndex] = src; |
| 379 | } |
| 380 | src->glIndex = realLight->glIndex; |
| 381 | } |
| 382 | updated = TRUE; |
| 383 | break; |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | if(updated) { |
| 388 | /* Found a light, all done, proceed with next hash entry */ |
| 389 | continue; |
| 390 | } else if(src->changed) { |
| 391 | /* Otherwise assign defaul params */ |
Andrew Talbot | 19c105c | 2008-03-20 22:25:13 +0000 | [diff] [blame] | 392 | src->OriginalParms = WINED3D_default_light; |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 393 | } else { |
| 394 | /* Not enabled by default */ |
| 395 | src->glIndex = -1; |
| 396 | } |
| 397 | } |
| 398 | } |
| 399 | } |
| 400 | |
Alexandre Julliard | e9cbc66 | 2006-06-10 13:15:32 +0200 | [diff] [blame] | 401 | static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface){ |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 402 | |
| 403 | IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; |
| 404 | IWineD3DStateBlockImpl *targetStateBlock = This->wineD3DDevice->stateBlock; |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 405 | unsigned int i, j; |
Henri Verbeet | 3b5c75d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 406 | DWORD map; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 407 | |
Francois Gouget | 0edbaf7 | 2005-11-10 12:14:56 +0000 | [diff] [blame] | 408 | TRACE("(%p) : Updating state block %p ------------------v\n", targetStateBlock, This); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 409 | |
| 410 | /* If not recorded, then update can just recapture */ |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 411 | if (This->blockType == WINED3DSBT_RECORDED) { |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 412 | |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 413 | /* Recorded => Only update 'changed' values */ |
Stefan Dösinger | 36aef3d | 2007-08-20 18:56:10 +0200 | [diff] [blame] | 414 | if (This->changed.vertexShader && This->vertexShader != targetStateBlock->vertexShader) { |
H. Verbeet | c6515ab | 2006-02-06 11:32:13 +0100 | [diff] [blame] | 415 | TRACE("Updating vertex shader from %p to %p\n", This->vertexShader, targetStateBlock->vertexShader); |
| 416 | |
Stefan Dösinger | 36aef3d | 2007-08-20 18:56:10 +0200 | [diff] [blame] | 417 | if(targetStateBlock->vertexShader) IWineD3DVertexShader_AddRef(targetStateBlock->vertexShader); |
| 418 | if(This->vertexShader) IWineD3DVertexShader_Release(This->vertexShader); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 419 | This->vertexShader = targetStateBlock->vertexShader; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 420 | } |
| 421 | |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 422 | /* Vertex Shader Float Constants */ |
Stefan Dösinger | b21c785 | 2007-08-03 20:26:29 +0200 | [diff] [blame] | 423 | for (j = 0; j < This->num_contained_vs_consts_f; ++j) { |
| 424 | i = This->contained_vs_consts_f[j]; |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 425 | TRACE("Setting %p from %p %u to {%f, %f, %f, %f}\n", This, targetStateBlock, i, |
| 426 | targetStateBlock->vertexShaderConstantF[i * 4], |
| 427 | targetStateBlock->vertexShaderConstantF[i * 4 + 1], |
| 428 | targetStateBlock->vertexShaderConstantF[i * 4 + 2], |
| 429 | targetStateBlock->vertexShaderConstantF[i * 4 + 3]); |
Ivan Gyurdiev | 5f5969b | 2006-06-06 02:46:59 -0400 | [diff] [blame] | 430 | |
Stefan Dösinger | b21c785 | 2007-08-03 20:26:29 +0200 | [diff] [blame] | 431 | This->vertexShaderConstantF[i * 4] = targetStateBlock->vertexShaderConstantF[i * 4]; |
| 432 | This->vertexShaderConstantF[i * 4 + 1] = targetStateBlock->vertexShaderConstantF[i * 4 + 1]; |
| 433 | This->vertexShaderConstantF[i * 4 + 2] = targetStateBlock->vertexShaderConstantF[i * 4 + 2]; |
| 434 | This->vertexShaderConstantF[i * 4 + 3] = targetStateBlock->vertexShaderConstantF[i * 4 + 3]; |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 435 | } |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 436 | |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 437 | /* Vertex Shader Integer Constants */ |
Stefan Dösinger | 4673b1c | 2007-08-03 20:07:30 +0200 | [diff] [blame] | 438 | for (j = 0; j < This->num_contained_vs_consts_i; ++j) { |
| 439 | i = This->contained_vs_consts_i[j]; |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 440 | TRACE("Setting %p from %p %u to {%d, %d, %d, %d}\n", This, targetStateBlock, i, |
| 441 | targetStateBlock->vertexShaderConstantI[i * 4], |
| 442 | targetStateBlock->vertexShaderConstantI[i * 4 + 1], |
| 443 | targetStateBlock->vertexShaderConstantI[i * 4 + 2], |
| 444 | targetStateBlock->vertexShaderConstantI[i * 4 + 3]); |
Ivan Gyurdiev | 5f5969b | 2006-06-06 02:46:59 -0400 | [diff] [blame] | 445 | |
Stefan Dösinger | 4673b1c | 2007-08-03 20:07:30 +0200 | [diff] [blame] | 446 | This->vertexShaderConstantI[i * 4] = targetStateBlock->vertexShaderConstantI[i * 4]; |
| 447 | This->vertexShaderConstantI[i * 4 + 1] = targetStateBlock->vertexShaderConstantI[i * 4 + 1]; |
| 448 | This->vertexShaderConstantI[i * 4 + 2] = targetStateBlock->vertexShaderConstantI[i * 4 + 2]; |
| 449 | This->vertexShaderConstantI[i * 4 + 3] = targetStateBlock->vertexShaderConstantI[i * 4 + 3]; |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 450 | } |
Ivan Gyurdiev | 5f5969b | 2006-06-06 02:46:59 -0400 | [diff] [blame] | 451 | |
Stefan Dösinger | 4673b1c | 2007-08-03 20:07:30 +0200 | [diff] [blame] | 452 | /* Vertex Shader Boolean Constants */ |
| 453 | for (j = 0; j < This->num_contained_vs_consts_b; ++j) { |
| 454 | i = This->contained_vs_consts_b[j]; |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 455 | TRACE("Setting %p from %p %u to %s\n", This, targetStateBlock, i, |
| 456 | targetStateBlock->vertexShaderConstantB[i] ? "TRUE" : "FALSE"); |
Stefan Dösinger | 4673b1c | 2007-08-03 20:07:30 +0200 | [diff] [blame] | 457 | |
| 458 | This->vertexShaderConstantB[i] = targetStateBlock->vertexShaderConstantB[i]; |
Oliver Stieber | 0c2fcf2 | 2005-09-21 10:19:29 +0000 | [diff] [blame] | 459 | } |
Stefan Dösinger | acadf3f | 2007-02-14 17:46:54 +0100 | [diff] [blame] | 460 | |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 461 | /* Pixel Shader Float Constants */ |
Stefan Dösinger | b21c785 | 2007-08-03 20:26:29 +0200 | [diff] [blame] | 462 | for (j = 0; j < This->num_contained_ps_consts_f; ++j) { |
| 463 | i = This->contained_ps_consts_f[j]; |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 464 | TRACE("Setting %p from %p %u to {%f, %f, %f, %f}\n", This, targetStateBlock, i, |
| 465 | targetStateBlock->pixelShaderConstantF[i * 4], |
| 466 | targetStateBlock->pixelShaderConstantF[i * 4 + 1], |
| 467 | targetStateBlock->pixelShaderConstantF[i * 4 + 2], |
| 468 | targetStateBlock->pixelShaderConstantF[i * 4 + 3]); |
Ivan Gyurdiev | 5f5969b | 2006-06-06 02:46:59 -0400 | [diff] [blame] | 469 | |
Stefan Dösinger | b21c785 | 2007-08-03 20:26:29 +0200 | [diff] [blame] | 470 | This->pixelShaderConstantF[i * 4] = targetStateBlock->pixelShaderConstantF[i * 4]; |
| 471 | This->pixelShaderConstantF[i * 4 + 1] = targetStateBlock->pixelShaderConstantF[i * 4 + 1]; |
| 472 | This->pixelShaderConstantF[i * 4 + 2] = targetStateBlock->pixelShaderConstantF[i * 4 + 2]; |
| 473 | This->pixelShaderConstantF[i * 4 + 3] = targetStateBlock->pixelShaderConstantF[i * 4 + 3]; |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 474 | } |
Stefan Dösinger | 865b82a | 2007-08-03 20:12:54 +0200 | [diff] [blame] | 475 | |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 476 | /* Pixel Shader Integer Constants */ |
Stefan Dösinger | 865b82a | 2007-08-03 20:12:54 +0200 | [diff] [blame] | 477 | for (j = 0; j < This->num_contained_ps_consts_i; ++j) { |
| 478 | i = This->contained_ps_consts_i[j]; |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 479 | TRACE("Setting %p from %p %u to {%d, %d, %d, %d}\n", This, targetStateBlock, i, |
| 480 | targetStateBlock->pixelShaderConstantI[i * 4], |
| 481 | targetStateBlock->pixelShaderConstantI[i * 4 + 1], |
| 482 | targetStateBlock->pixelShaderConstantI[i * 4 + 2], |
| 483 | targetStateBlock->pixelShaderConstantI[i * 4 + 3]); |
Ivan Gyurdiev | 5f5969b | 2006-06-06 02:46:59 -0400 | [diff] [blame] | 484 | |
Stefan Dösinger | 865b82a | 2007-08-03 20:12:54 +0200 | [diff] [blame] | 485 | This->pixelShaderConstantI[i * 4] = targetStateBlock->pixelShaderConstantI[i * 4]; |
| 486 | This->pixelShaderConstantI[i * 4 + 1] = targetStateBlock->pixelShaderConstantI[i * 4 + 1]; |
| 487 | This->pixelShaderConstantI[i * 4 + 2] = targetStateBlock->pixelShaderConstantI[i * 4 + 2]; |
| 488 | This->pixelShaderConstantI[i * 4 + 3] = targetStateBlock->pixelShaderConstantI[i * 4 + 3]; |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 489 | } |
Ivan Gyurdiev | 5f5969b | 2006-06-06 02:46:59 -0400 | [diff] [blame] | 490 | |
Stefan Dösinger | 865b82a | 2007-08-03 20:12:54 +0200 | [diff] [blame] | 491 | /* Pixel Shader Boolean Constants */ |
| 492 | for (j = 0; j < This->num_contained_ps_consts_b; ++j) { |
| 493 | i = This->contained_ps_consts_b[j]; |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 494 | TRACE("Setting %p from %p %u to %s\n", This, targetStateBlock, i, |
| 495 | targetStateBlock->pixelShaderConstantB[i] ? "TRUE" : "FALSE"); |
Stefan Dösinger | 865b82a | 2007-08-03 20:12:54 +0200 | [diff] [blame] | 496 | |
| 497 | This->pixelShaderConstantB[i] = targetStateBlock->pixelShaderConstantB[i]; |
Oliver Stieber | b3563da | 2005-09-28 10:13:00 +0000 | [diff] [blame] | 498 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 499 | |
| 500 | /* Others + Render & Texture */ |
Stefan Dösinger | 92ce028 | 2007-07-31 15:44:13 +0200 | [diff] [blame] | 501 | for (i = 0; i < This->num_contained_transform_states; i++) { |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 502 | TRACE("Updating transform %u\n", i); |
Andrew Talbot | 19c105c | 2008-03-20 22:25:13 +0000 | [diff] [blame] | 503 | This->transforms[This->contained_transform_states[i]] = |
| 504 | targetStateBlock->transforms[This->contained_transform_states[i]]; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 505 | } |
| 506 | |
Henri Verbeet | 702eeb6 | 2009-03-05 12:30:43 +0100 | [diff] [blame] | 507 | if (This->changed.primitive_type) This->gl_primitive_type = targetStateBlock->gl_primitive_type; |
| 508 | |
Stefan Dösinger | e7cbb34 | 2007-07-30 19:28:33 +0200 | [diff] [blame] | 509 | if (This->changed.indices && ((This->pIndexData != targetStateBlock->pIndexData) |
Stefan Dösinger | cb1c9dc | 2009-04-09 10:50:31 +0200 | [diff] [blame] | 510 | || (This->baseVertexIndex != targetStateBlock->baseVertexIndex) |
| 511 | || (This->IndexFmt != targetStateBlock->IndexFmt))) { |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 512 | TRACE("Updating pIndexData to %p, baseVertexIndex to %d\n", |
| 513 | targetStateBlock->pIndexData, targetStateBlock->baseVertexIndex); |
Stefan Dösinger | 513a493 | 2009-04-06 16:46:12 +0200 | [diff] [blame] | 514 | if(targetStateBlock->pIndexData) IWineD3DBuffer_AddRef(targetStateBlock->pIndexData); |
| 515 | if(This->pIndexData) IWineD3DBuffer_Release(This->pIndexData); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 516 | This->pIndexData = targetStateBlock->pIndexData; |
| 517 | This->baseVertexIndex = targetStateBlock->baseVertexIndex; |
Stefan Dösinger | cb1c9dc | 2009-04-09 10:50:31 +0200 | [diff] [blame] | 518 | This->IndexFmt = targetStateBlock->IndexFmt; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 519 | } |
| 520 | |
Stefan Dösinger | e7cbb34 | 2007-07-30 19:28:33 +0200 | [diff] [blame] | 521 | if(This->changed.vertexDecl && This->vertexDecl != targetStateBlock->vertexDecl){ |
H. Verbeet | c6515ab | 2006-02-06 11:32:13 +0100 | [diff] [blame] | 522 | TRACE("Updating vertex declaration from %p to %p\n", This->vertexDecl, targetStateBlock->vertexDecl); |
| 523 | |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 524 | This->vertexDecl = targetStateBlock->vertexDecl; |
| 525 | } |
| 526 | |
Stefan Dösinger | e7cbb34 | 2007-07-30 19:28:33 +0200 | [diff] [blame] | 527 | if (This->changed.material && memcmp(&targetStateBlock->material, |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 528 | &This->material, |
Ivan Gyurdiev | 90f5be2 | 2006-10-10 21:56:41 -0400 | [diff] [blame] | 529 | sizeof(WINED3DMATERIAL)) != 0) { |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 530 | TRACE("Updating material\n"); |
Andrew Talbot | 19c105c | 2008-03-20 22:25:13 +0000 | [diff] [blame] | 531 | This->material = targetStateBlock->material; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 532 | } |
| 533 | |
Stefan Dösinger | e7cbb34 | 2007-07-30 19:28:33 +0200 | [diff] [blame] | 534 | if (This->changed.viewport && memcmp(&targetStateBlock->viewport, |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 535 | &This->viewport, |
Ivan Gyurdiev | 5f2987a | 2006-10-10 21:57:25 -0400 | [diff] [blame] | 536 | sizeof(WINED3DVIEWPORT)) != 0) { |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 537 | TRACE("Updating viewport\n"); |
Andrew Talbot | 19c105c | 2008-03-20 22:25:13 +0000 | [diff] [blame] | 538 | This->viewport = targetStateBlock->viewport; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 539 | } |
| 540 | |
Stefan Dösinger | e7cbb34 | 2007-07-30 19:28:33 +0200 | [diff] [blame] | 541 | if(This->changed.scissorRect && memcmp(&targetStateBlock->scissorRect, |
Stefan Dösinger | d4b63bb | 2007-01-10 11:28:42 +0100 | [diff] [blame] | 542 | &This->scissorRect, |
| 543 | sizeof(targetStateBlock->scissorRect))) |
| 544 | { |
| 545 | TRACE("Updating scissor rect\n"); |
Andrew Talbot | 19c105c | 2008-03-20 22:25:13 +0000 | [diff] [blame] | 546 | targetStateBlock->scissorRect = This->scissorRect; |
Stefan Dösinger | d4b63bb | 2007-01-10 11:28:42 +0100 | [diff] [blame] | 547 | } |
| 548 | |
Henri Verbeet | 52a900d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 549 | map = This->changed.streamSource; |
| 550 | for (i = 0; map; map >>= 1, ++i) |
| 551 | { |
| 552 | if (!(map & 1)) continue; |
| 553 | |
| 554 | if (This->streamStride[i] != targetStateBlock->streamStride[i] |
| 555 | || This->streamSource[i] != targetStateBlock->streamSource[i]) |
| 556 | { |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 557 | TRACE("Updating stream source %u to %p, stride to %u\n", |
| 558 | i, targetStateBlock->streamSource[i], targetStateBlock->streamStride[i]); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 559 | This->streamStride[i] = targetStateBlock->streamStride[i]; |
Henri Verbeet | aa3027a | 2009-03-06 14:56:23 +0100 | [diff] [blame] | 560 | if (targetStateBlock->streamSource[i]) IWineD3DBuffer_AddRef(targetStateBlock->streamSource[i]); |
| 561 | if (This->streamSource[i]) IWineD3DBuffer_Release(This->streamSource[i]); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 562 | This->streamSource[i] = targetStateBlock->streamSource[i]; |
| 563 | } |
Henri Verbeet | 52a900d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 564 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 565 | |
Henri Verbeet | 52a900d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 566 | map = This->changed.streamFreq; |
| 567 | for (i = 0; map; map >>= 1, ++i) |
| 568 | { |
| 569 | if (!(map & 1)) continue; |
| 570 | |
| 571 | if (This->streamFreq[i] != targetStateBlock->streamFreq[i] |
| 572 | || This->streamFlags[i] != targetStateBlock->streamFlags[i]) |
| 573 | { |
| 574 | TRACE("Updating stream frequency %u to %u flags to %#x\n", |
| 575 | i, targetStateBlock->streamFreq[i], targetStateBlock->streamFlags[i]); |
| 576 | This->streamFreq[i] = targetStateBlock->streamFreq[i]; |
| 577 | This->streamFlags[i] = targetStateBlock->streamFlags[i]; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 578 | } |
| 579 | } |
| 580 | |
Henri Verbeet | 3b5c75d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 581 | map = This->changed.clipplane; |
| 582 | for (i = 0; map; map >>= 1, ++i) |
| 583 | { |
| 584 | if (!(map & 1)) continue; |
| 585 | |
| 586 | if (memcmp(targetStateBlock->clipplane[i], This->clipplane[i], sizeof(*This->clipplane))) |
Henri Verbeet | bcf0b4b | 2008-12-10 10:04:40 +0100 | [diff] [blame] | 587 | { |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 588 | TRACE("Updating clipplane %u\n", i); |
Henri Verbeet | bcf0b4b | 2008-12-10 10:04:40 +0100 | [diff] [blame] | 589 | memcpy(This->clipplane[i], targetStateBlock->clipplane[i], sizeof(*This->clipplane)); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 590 | } |
| 591 | } |
| 592 | |
| 593 | /* Render */ |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 594 | for (i = 0; i < This->num_contained_render_states; i++) { |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 595 | TRACE("Updating renderState %u to %u\n", This->contained_render_states[i], |
| 596 | targetStateBlock->renderState[This->contained_render_states[i]]); |
Stefan Dösinger | 93155ea | 2007-07-31 15:04:56 +0200 | [diff] [blame] | 597 | This->renderState[This->contained_render_states[i]] = targetStateBlock->renderState[This->contained_render_states[i]]; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 598 | } |
| 599 | |
H. Verbeet | a54e36a | 2006-06-27 23:40:42 +0200 | [diff] [blame] | 600 | /* Texture states */ |
Stefan Dösinger | 03ffb73 | 2007-08-09 17:45:29 +0200 | [diff] [blame] | 601 | for (j = 0; j < This->num_contained_tss_states; j++) { |
| 602 | DWORD stage = This->contained_tss_states[j].stage; |
| 603 | DWORD state = This->contained_tss_states[j].state; |
| 604 | |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 605 | TRACE("Updating texturestage state %u, %u to %u (was %u)\n", stage, state, |
| 606 | targetStateBlock->textureState[stage][state], This->textureState[stage][state]); |
| 607 | This->textureState[stage][state] = targetStateBlock->textureState[stage][state]; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 608 | } |
| 609 | |
| 610 | /* Samplers */ |
Oliver Stieber | d344162 | 2005-08-01 10:58:31 +0000 | [diff] [blame] | 611 | /* TODO: move over to using memcpy */ |
Henri Verbeet | 9a889f6 | 2009-01-02 16:19:12 +0100 | [diff] [blame] | 612 | map = This->changed.textures; |
| 613 | for (i = 0; map; map >>= 1, ++i) |
| 614 | { |
| 615 | if (!(map & 1)) continue; |
| 616 | |
| 617 | TRACE("Updating texture %u to %p (was %p)\n", i, targetStateBlock->textures[i], This->textures[i]); |
| 618 | This->textures[i] = targetStateBlock->textures[i]; |
Stefan Dösinger | 59fb292 | 2007-08-03 20:23:52 +0200 | [diff] [blame] | 619 | } |
| 620 | |
| 621 | for (j = 0; j < This->num_contained_sampler_states; j++) { |
| 622 | DWORD stage = This->contained_sampler_states[j].stage; |
| 623 | DWORD state = This->contained_sampler_states[j].state; |
Henri Verbeet | 73e0424 | 2008-12-31 16:57:10 +0100 | [diff] [blame] | 624 | TRACE("Updating sampler state %u, %u to %u (was %u)\n", stage, state, |
| 625 | targetStateBlock->samplerState[stage][state], This->samplerState[stage][state]); |
Stefan Dösinger | 59fb292 | 2007-08-03 20:23:52 +0200 | [diff] [blame] | 626 | This->samplerState[stage][state] = targetStateBlock->samplerState[stage][state]; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 627 | } |
Stefan Dösinger | 36aef3d | 2007-08-20 18:56:10 +0200 | [diff] [blame] | 628 | if(This->changed.pixelShader && This->pixelShader != targetStateBlock->pixelShader) { |
| 629 | if(targetStateBlock->pixelShader) IWineD3DPixelShader_AddRef(targetStateBlock->pixelShader); |
| 630 | if(This->pixelShader) IWineD3DPixelShader_Release(This->pixelShader); |
| 631 | This->pixelShader = targetStateBlock->pixelShader; |
| 632 | } |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 633 | |
| 634 | record_lights(This, targetStateBlock); |
| 635 | } else if(This->blockType == WINED3DSBT_ALL) { |
| 636 | This->vertexDecl = targetStateBlock->vertexDecl; |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 637 | memcpy(This->vertexShaderConstantB, targetStateBlock->vertexShaderConstantB, sizeof(This->vertexShaderConstantI)); |
| 638 | memcpy(This->vertexShaderConstantI, targetStateBlock->vertexShaderConstantI, sizeof(This->vertexShaderConstantF)); |
| 639 | memcpy(This->vertexShaderConstantF, targetStateBlock->vertexShaderConstantF, sizeof(float) * GL_LIMITS(vshader_constantsF) * 4); |
Henri Verbeet | 702eeb6 | 2009-03-05 12:30:43 +0100 | [diff] [blame] | 640 | This->gl_primitive_type = targetStateBlock->gl_primitive_type; |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 641 | memcpy(This->streamStride, targetStateBlock->streamStride, sizeof(This->streamStride)); |
| 642 | memcpy(This->streamOffset, targetStateBlock->streamOffset, sizeof(This->streamOffset)); |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 643 | memcpy(This->streamFreq, targetStateBlock->streamFreq, sizeof(This->streamFreq)); |
| 644 | memcpy(This->streamFlags, targetStateBlock->streamFlags, sizeof(This->streamFlags)); |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 645 | This->baseVertexIndex = targetStateBlock->baseVertexIndex; |
| 646 | memcpy(This->transforms, targetStateBlock->transforms, sizeof(This->transforms)); |
| 647 | record_lights(This, targetStateBlock); |
| 648 | memcpy(This->clipplane, targetStateBlock->clipplane, sizeof(This->clipplane)); |
| 649 | This->clip_status = targetStateBlock->clip_status; |
| 650 | This->viewport = targetStateBlock->viewport; |
| 651 | This->material = targetStateBlock->material; |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 652 | memcpy(This->pixelShaderConstantB, targetStateBlock->pixelShaderConstantB, sizeof(This->pixelShaderConstantI)); |
| 653 | memcpy(This->pixelShaderConstantI, targetStateBlock->pixelShaderConstantI, sizeof(This->pixelShaderConstantF)); |
| 654 | memcpy(This->pixelShaderConstantF, targetStateBlock->pixelShaderConstantF, sizeof(float) * GL_LIMITS(pshader_constantsF) * 4); |
| 655 | memcpy(This->renderState, targetStateBlock->renderState, sizeof(This->renderState)); |
| 656 | memcpy(This->textures, targetStateBlock->textures, sizeof(This->textures)); |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 657 | memcpy(This->textureState, targetStateBlock->textureState, sizeof(This->textureState)); |
| 658 | memcpy(This->samplerState, targetStateBlock->samplerState, sizeof(This->samplerState)); |
| 659 | This->scissorRect = targetStateBlock->scissorRect; |
Stefan Dösinger | d170aab | 2007-08-19 20:40:44 +0200 | [diff] [blame] | 660 | |
Stefan Dösinger | cb1c9dc | 2009-04-09 10:50:31 +0200 | [diff] [blame] | 661 | if(targetStateBlock->pIndexData != This->pIndexData || |
| 662 | targetStateBlock->IndexFmt != This->IndexFmt) { |
Stefan Dösinger | 513a493 | 2009-04-06 16:46:12 +0200 | [diff] [blame] | 663 | if (targetStateBlock->pIndexData) IWineD3DBuffer_AddRef(targetStateBlock->pIndexData); |
| 664 | if (This->pIndexData) IWineD3DBuffer_Release(This->pIndexData); |
Stefan Dösinger | 9092f55 | 2007-08-19 20:42:29 +0200 | [diff] [blame] | 665 | This->pIndexData = targetStateBlock->pIndexData; |
Stefan Dösinger | cb1c9dc | 2009-04-09 10:50:31 +0200 | [diff] [blame] | 666 | This->IndexFmt = targetStateBlock->IndexFmt; |
Stefan Dösinger | 9092f55 | 2007-08-19 20:42:29 +0200 | [diff] [blame] | 667 | } |
Stefan Dösinger | d170aab | 2007-08-19 20:40:44 +0200 | [diff] [blame] | 668 | for(i = 0; i < MAX_STREAMS; i++) { |
| 669 | if(targetStateBlock->streamSource[i] != This->streamSource[i]) { |
Henri Verbeet | aa3027a | 2009-03-06 14:56:23 +0100 | [diff] [blame] | 670 | if(targetStateBlock->streamSource[i]) IWineD3DBuffer_AddRef(targetStateBlock->streamSource[i]); |
| 671 | if(This->streamSource[i]) IWineD3DBuffer_Release(This->streamSource[i]); |
Stefan Dösinger | d170aab | 2007-08-19 20:40:44 +0200 | [diff] [blame] | 672 | This->streamSource[i] = targetStateBlock->streamSource[i]; |
| 673 | } |
| 674 | } |
Stefan Dösinger | 36aef3d | 2007-08-20 18:56:10 +0200 | [diff] [blame] | 675 | if(This->vertexShader != targetStateBlock->vertexShader) { |
| 676 | if(targetStateBlock->vertexShader) IWineD3DVertexShader_AddRef(targetStateBlock->vertexShader); |
| 677 | if(This->vertexShader) IWineD3DVertexShader_Release(This->vertexShader); |
| 678 | This->vertexShader = targetStateBlock->vertexShader; |
| 679 | } |
| 680 | if(This->pixelShader != targetStateBlock->pixelShader) { |
| 681 | if(targetStateBlock->pixelShader) IWineD3DPixelShader_AddRef(targetStateBlock->pixelShader); |
| 682 | if(This->pixelShader) IWineD3DPixelShader_Release(This->pixelShader); |
| 683 | This->pixelShader = targetStateBlock->pixelShader; |
| 684 | } |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 685 | } else if(This->blockType == WINED3DSBT_VERTEXSTATE) { |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 686 | memcpy(This->vertexShaderConstantB, targetStateBlock->vertexShaderConstantB, sizeof(This->vertexShaderConstantI)); |
| 687 | memcpy(This->vertexShaderConstantI, targetStateBlock->vertexShaderConstantI, sizeof(This->vertexShaderConstantF)); |
| 688 | memcpy(This->vertexShaderConstantF, targetStateBlock->vertexShaderConstantF, sizeof(float) * GL_LIMITS(vshader_constantsF) * 4); |
| 689 | record_lights(This, targetStateBlock); |
| 690 | for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) { |
| 691 | This->renderState[SavedVertexStates_R[i]] = targetStateBlock->renderState[SavedVertexStates_R[i]]; |
| 692 | } |
| 693 | for (j = 0; j < MAX_COMBINED_SAMPLERS; j++) { |
| 694 | for (i = 0; i < NUM_SAVEDVERTEXSTATES_S; i++) { |
| 695 | This->samplerState[j][SavedVertexStates_S[i]] = targetStateBlock->samplerState[j][SavedVertexStates_S[i]]; |
| 696 | } |
| 697 | } |
| 698 | for (j = 0; j < MAX_TEXTURES; j++) { |
| 699 | for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) { |
| 700 | This->textureState[j][SavedVertexStates_R[i]] = targetStateBlock->textureState[j][SavedVertexStates_R[i]]; |
| 701 | } |
| 702 | } |
Stefan Dösinger | d170aab | 2007-08-19 20:40:44 +0200 | [diff] [blame] | 703 | for(i = 0; i < MAX_STREAMS; i++) { |
| 704 | if(targetStateBlock->streamSource[i] != This->streamSource[i]) { |
Henri Verbeet | aa3027a | 2009-03-06 14:56:23 +0100 | [diff] [blame] | 705 | if (targetStateBlock->streamSource[i]) IWineD3DBuffer_AddRef(targetStateBlock->streamSource[i]); |
| 706 | if (This->streamSource[i]) IWineD3DBuffer_Release(This->streamSource[i]); |
Stefan Dösinger | d170aab | 2007-08-19 20:40:44 +0200 | [diff] [blame] | 707 | This->streamSource[i] = targetStateBlock->streamSource[i]; |
| 708 | } |
| 709 | } |
Stefan Dösinger | 36aef3d | 2007-08-20 18:56:10 +0200 | [diff] [blame] | 710 | if(This->vertexShader != targetStateBlock->vertexShader) { |
| 711 | if(targetStateBlock->vertexShader) IWineD3DVertexShader_AddRef(targetStateBlock->vertexShader); |
| 712 | if(This->vertexShader) IWineD3DVertexShader_Release(This->vertexShader); |
| 713 | This->vertexShader = targetStateBlock->vertexShader; |
| 714 | } |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 715 | } else if(This->blockType == WINED3DSBT_PIXELSTATE) { |
Stefan Dösinger | 76195d9 | 2007-08-04 14:44:33 +0200 | [diff] [blame] | 716 | memcpy(This->pixelShaderConstantB, targetStateBlock->pixelShaderConstantB, sizeof(This->pixelShaderConstantI)); |
| 717 | memcpy(This->pixelShaderConstantI, targetStateBlock->pixelShaderConstantI, sizeof(This->pixelShaderConstantF)); |
| 718 | memcpy(This->pixelShaderConstantF, targetStateBlock->pixelShaderConstantF, sizeof(float) * GL_LIMITS(pshader_constantsF) * 4); |
| 719 | for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) { |
| 720 | This->renderState[SavedPixelStates_R[i]] = targetStateBlock->renderState[SavedPixelStates_R[i]]; |
| 721 | } |
| 722 | for (j = 0; j < MAX_COMBINED_SAMPLERS; j++) { |
| 723 | for (i = 0; i < NUM_SAVEDPIXELSTATES_S; i++) { |
| 724 | This->samplerState[j][SavedPixelStates_S[i]] = targetStateBlock->samplerState[j][SavedPixelStates_S[i]]; |
| 725 | } |
| 726 | } |
| 727 | for (j = 0; j < MAX_TEXTURES; j++) { |
| 728 | for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) { |
| 729 | This->textureState[j][SavedPixelStates_R[i]] = targetStateBlock->textureState[j][SavedPixelStates_R[i]]; |
| 730 | } |
| 731 | } |
Stefan Dösinger | 36aef3d | 2007-08-20 18:56:10 +0200 | [diff] [blame] | 732 | if(This->pixelShader != targetStateBlock->pixelShader) { |
| 733 | if(targetStateBlock->pixelShader) IWineD3DPixelShader_AddRef(targetStateBlock->pixelShader); |
| 734 | if(This->pixelShader) IWineD3DPixelShader_Release(This->pixelShader); |
| 735 | This->pixelShader = targetStateBlock->pixelShader; |
| 736 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | TRACE("(%p) : Updated state block %p ------------------^\n", targetStateBlock, This); |
| 740 | |
Stefan Dösinger | 9d67b42 | 2006-04-07 12:51:12 +0200 | [diff] [blame] | 741 | return WINED3D_OK; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 742 | } |
| 743 | |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 744 | static inline void apply_lights(IWineD3DDevice *pDevice, IWineD3DStateBlockImpl *This) { |
| 745 | UINT i; |
| 746 | for(i = 0; i < LIGHTMAP_SIZE; i++) { |
| 747 | struct list *e; |
| 748 | |
| 749 | LIST_FOR_EACH(e, &This->lightMap[i]) { |
Henri Verbeet | 5532c99 | 2008-12-01 15:32:15 +0100 | [diff] [blame] | 750 | const PLIGHTINFOEL *light = LIST_ENTRY(e, PLIGHTINFOEL, entry); |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 751 | |
| 752 | if(light->changed) { |
| 753 | IWineD3DDevice_SetLight(pDevice, light->OriginalIndex, &light->OriginalParms); |
| 754 | } |
| 755 | if(light->enabledChanged) { |
| 756 | IWineD3DDevice_SetLightEnable(pDevice, light->OriginalIndex, light->glIndex != -1); |
| 757 | } |
| 758 | } |
| 759 | } |
| 760 | } |
| 761 | |
Alexandre Julliard | e9cbc66 | 2006-06-10 13:15:32 +0200 | [diff] [blame] | 762 | static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface){ |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 763 | IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; |
| 764 | IWineD3DDevice* pDevice = (IWineD3DDevice*)This->wineD3DDevice; |
| 765 | |
| 766 | /*Copy thing over to updateBlock is isRecording otherwise StateBlock, |
| 767 | should really perform a delta so that only the changes get updated*/ |
| 768 | |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 769 | UINT i; |
| 770 | UINT j; |
Henri Verbeet | 3b5c75d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 771 | DWORD map; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 772 | |
| 773 | TRACE("(%p) : Applying state block %p ------------------v\n", This, pDevice); |
| 774 | |
Stefan Dösinger | 03ffb73 | 2007-08-09 17:45:29 +0200 | [diff] [blame] | 775 | TRACE("Blocktype: %d\n", This->blockType); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 776 | |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 777 | if(This->blockType == WINED3DSBT_RECORDED) { |
Stefan Dösinger | e7cbb34 | 2007-07-30 19:28:33 +0200 | [diff] [blame] | 778 | if (This->changed.vertexShader) { |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 779 | IWineD3DDevice_SetVertexShader(pDevice, This->vertexShader); |
Oliver Stieber | 0c2fcf2 | 2005-09-21 10:19:29 +0000 | [diff] [blame] | 780 | } |
Oliver Stieber | 0c2fcf2 | 2005-09-21 10:19:29 +0000 | [diff] [blame] | 781 | /* Vertex Shader Constants */ |
Stefan Dösinger | b21c785 | 2007-08-03 20:26:29 +0200 | [diff] [blame] | 782 | for (i = 0; i < This->num_contained_vs_consts_f; i++) { |
| 783 | IWineD3DDevice_SetVertexShaderConstantF(pDevice, This->contained_vs_consts_f[i], |
| 784 | This->vertexShaderConstantF + This->contained_vs_consts_f[i] * 4, 1); |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 785 | } |
Stefan Dösinger | 4673b1c | 2007-08-03 20:07:30 +0200 | [diff] [blame] | 786 | for (i = 0; i < This->num_contained_vs_consts_i; i++) { |
| 787 | IWineD3DDevice_SetVertexShaderConstantI(pDevice, This->contained_vs_consts_i[i], |
| 788 | This->vertexShaderConstantI + This->contained_vs_consts_i[i] * 4, 1); |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 789 | } |
Stefan Dösinger | 4673b1c | 2007-08-03 20:07:30 +0200 | [diff] [blame] | 790 | for (i = 0; i < This->num_contained_vs_consts_b; i++) { |
| 791 | IWineD3DDevice_SetVertexShaderConstantB(pDevice, This->contained_vs_consts_b[i], |
| 792 | This->vertexShaderConstantB + This->contained_vs_consts_b[i], 1); |
Ivan Gyurdiev | 5f5969b | 2006-06-06 02:46:59 -0400 | [diff] [blame] | 793 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 794 | |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 795 | apply_lights(pDevice, This); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 796 | |
Stefan Dösinger | e7cbb34 | 2007-07-30 19:28:33 +0200 | [diff] [blame] | 797 | if (This->changed.pixelShader) { |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 798 | IWineD3DDevice_SetPixelShader(pDevice, This->pixelShader); |
Oliver Stieber | b3563da | 2005-09-28 10:13:00 +0000 | [diff] [blame] | 799 | } |
Oliver Stieber | b3563da | 2005-09-28 10:13:00 +0000 | [diff] [blame] | 800 | /* Pixel Shader Constants */ |
Stefan Dösinger | b21c785 | 2007-08-03 20:26:29 +0200 | [diff] [blame] | 801 | for (i = 0; i < This->num_contained_ps_consts_f; i++) { |
| 802 | IWineD3DDevice_SetPixelShaderConstantF(pDevice, This->contained_ps_consts_f[i], |
| 803 | This->pixelShaderConstantF + This->contained_ps_consts_f[i] * 4, 1); |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 804 | } |
Stefan Dösinger | 865b82a | 2007-08-03 20:12:54 +0200 | [diff] [blame] | 805 | for (i = 0; i < This->num_contained_ps_consts_i; i++) { |
| 806 | IWineD3DDevice_SetPixelShaderConstantI(pDevice, This->contained_ps_consts_i[i], |
| 807 | This->pixelShaderConstantI + This->contained_ps_consts_i[i] * 4, 1); |
Jason Green | 718716b | 2006-07-19 00:06:07 -0400 | [diff] [blame] | 808 | } |
Stefan Dösinger | 865b82a | 2007-08-03 20:12:54 +0200 | [diff] [blame] | 809 | for (i = 0; i < This->num_contained_ps_consts_b; i++) { |
| 810 | IWineD3DDevice_SetPixelShaderConstantB(pDevice, This->contained_ps_consts_b[i], |
| 811 | This->pixelShaderConstantB + This->contained_ps_consts_b[i], 1); |
Oliver Stieber | b3563da | 2005-09-28 10:13:00 +0000 | [diff] [blame] | 812 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 813 | |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 814 | /* Render */ |
| 815 | for (i = 0; i <= This->num_contained_render_states; i++) { |
| 816 | IWineD3DDevice_SetRenderState(pDevice, This->contained_render_states[i], |
| 817 | This->renderState[This->contained_render_states[i]]); |
| 818 | } |
| 819 | /* Texture states */ |
| 820 | for (i = 0; i < This->num_contained_tss_states; i++) { |
| 821 | DWORD stage = This->contained_tss_states[i].stage; |
| 822 | DWORD state = This->contained_tss_states[i].state; |
| 823 | ((IWineD3DDeviceImpl *)pDevice)->stateBlock->textureState[stage][state] = This->textureState[stage][state]; |
Henri Verbeet | bddf5e7 | 2009-01-06 11:43:45 +0100 | [diff] [blame] | 824 | ((IWineD3DDeviceImpl *)pDevice)->stateBlock->changed.textureState[stage] |= 1 << state; |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 825 | /* TODO: Record a display list to apply all gl states. For now apply by brute force */ |
| 826 | IWineD3DDeviceImpl_MarkStateDirty((IWineD3DDeviceImpl *)pDevice, STATE_TEXTURESTAGE(stage, state)); |
| 827 | } |
| 828 | /* Sampler states */ |
| 829 | for (i = 0; i < This->num_contained_sampler_states; i++) { |
| 830 | DWORD stage = This->contained_sampler_states[i].stage; |
| 831 | DWORD state = This->contained_sampler_states[i].state; |
| 832 | ((IWineD3DDeviceImpl *)pDevice)->stateBlock->samplerState[stage][state] = This->samplerState[stage][state]; |
Henri Verbeet | fd33f0f | 2009-01-05 10:10:16 +0100 | [diff] [blame] | 833 | ((IWineD3DDeviceImpl *)pDevice)->stateBlock->changed.samplerState[stage] |= 1 << state; |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 834 | IWineD3DDeviceImpl_MarkStateDirty((IWineD3DDeviceImpl *)pDevice, STATE_SAMPLER(stage)); |
| 835 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 836 | |
Stefan Dösinger | 92ce028 | 2007-07-31 15:44:13 +0200 | [diff] [blame] | 837 | for (i = 0; i < This->num_contained_transform_states; i++) { |
| 838 | IWineD3DDevice_SetTransform(pDevice, This->contained_transform_states[i], |
| 839 | &This->transforms[This->contained_transform_states[i]]); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 840 | } |
| 841 | |
Henri Verbeet | 702eeb6 | 2009-03-05 12:30:43 +0100 | [diff] [blame] | 842 | if (This->changed.primitive_type) |
| 843 | { |
| 844 | This->wineD3DDevice->updateStateBlock->changed.primitive_type = TRUE; |
| 845 | This->wineD3DDevice->updateStateBlock->gl_primitive_type = This->gl_primitive_type; |
| 846 | } |
| 847 | |
Stefan Dösinger | e7cbb34 | 2007-07-30 19:28:33 +0200 | [diff] [blame] | 848 | if (This->changed.indices) { |
Stefan Dösinger | cb1c9dc | 2009-04-09 10:50:31 +0200 | [diff] [blame] | 849 | IWineD3DDevice_SetIndices(pDevice, This->pIndexData, This->IndexFmt); |
H. Verbeet | 7857712 | 2007-06-05 18:52:21 +0200 | [diff] [blame] | 850 | IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex); |
| 851 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 852 | |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 853 | if (This->changed.vertexDecl) { |
| 854 | IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl); |
| 855 | } |
| 856 | |
| 857 | if (This->changed.material ) { |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 858 | IWineD3DDevice_SetMaterial(pDevice, &This->material); |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 859 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 860 | |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 861 | if (This->changed.viewport) { |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 862 | IWineD3DDevice_SetViewport(pDevice, &This->viewport); |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 863 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 864 | |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 865 | if (This->changed.scissorRect) { |
Stefan Dösinger | d4b63bb | 2007-01-10 11:28:42 +0100 | [diff] [blame] | 866 | IWineD3DDevice_SetScissorRect(pDevice, &This->scissorRect); |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 867 | } |
Stefan Dösinger | d4b63bb | 2007-01-10 11:28:42 +0100 | [diff] [blame] | 868 | |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 869 | /* TODO: Proper implementation using SetStreamSource offset (set to 0 for the moment)\n") */ |
Henri Verbeet | 52a900d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 870 | map = This->changed.streamSource; |
| 871 | for (i = 0; map; map >>= 1, ++i) |
| 872 | { |
| 873 | if (map & 1) IWineD3DDevice_SetStreamSource(pDevice, i, This->streamSource[i], 0, This->streamStride[i]); |
| 874 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 875 | |
Henri Verbeet | 52a900d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 876 | map = This->changed.streamFreq; |
| 877 | for (i = 0; map; map >>= 1, ++i) |
| 878 | { |
| 879 | if (map & 1) IWineD3DDevice_SetStreamSourceFreq(pDevice, i, This->streamFreq[i] | This->streamFlags[i]); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 880 | } |
Henri Verbeet | 9a889f6 | 2009-01-02 16:19:12 +0100 | [diff] [blame] | 881 | |
| 882 | map = This->changed.textures; |
| 883 | for (i = 0; map; map >>= 1, ++i) |
| 884 | { |
| 885 | if (!(map & 1)) continue; |
| 886 | |
| 887 | if (i < MAX_FRAGMENT_SAMPLERS) IWineD3DDevice_SetTexture(pDevice, i, This->textures[i]); |
| 888 | else IWineD3DDevice_SetTexture(pDevice, WINED3DVERTEXTEXTURESAMPLER0 + i - MAX_FRAGMENT_SAMPLERS, |
| 889 | This->textures[i]); |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 890 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 891 | |
Henri Verbeet | 3b5c75d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 892 | map = This->changed.clipplane; |
| 893 | for (i = 0; map; map >>= 1, ++i) |
| 894 | { |
| 895 | float clip[4]; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 896 | |
Henri Verbeet | 3b5c75d | 2008-12-31 16:57:11 +0100 | [diff] [blame] | 897 | if (!(map & 1)) continue; |
| 898 | |
| 899 | clip[0] = This->clipplane[i][0]; |
| 900 | clip[1] = This->clipplane[i][1]; |
| 901 | clip[2] = This->clipplane[i][2]; |
| 902 | clip[3] = This->clipplane[i][3]; |
| 903 | IWineD3DDevice_SetClipPlane(pDevice, i, clip); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 904 | } |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 905 | } else if(This->blockType == WINED3DSBT_VERTEXSTATE) { |
| 906 | IWineD3DDevice_SetVertexShader(pDevice, This->vertexShader); |
| 907 | for (i = 0; i < GL_LIMITS(vshader_constantsF); i++) { |
| 908 | IWineD3DDevice_SetVertexShaderConstantF(pDevice, i, |
| 909 | This->vertexShaderConstantF + i * 4, 1); |
| 910 | } |
| 911 | for (i = 0; i < MAX_CONST_I; i++) { |
| 912 | IWineD3DDevice_SetVertexShaderConstantI(pDevice, i, |
| 913 | This->vertexShaderConstantI + i * 4, 1); |
| 914 | } |
| 915 | for (i = 0; i < MAX_CONST_B; i++) { |
| 916 | IWineD3DDevice_SetVertexShaderConstantB(pDevice, i, |
| 917 | This->vertexShaderConstantB + i, 1); |
| 918 | } |
| 919 | |
| 920 | apply_lights(pDevice, This); |
| 921 | |
| 922 | for(i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) { |
| 923 | IWineD3DDevice_SetRenderState(pDevice, SavedVertexStates_R[i], This->renderState[SavedVertexStates_R[i]]); |
| 924 | } |
| 925 | for(j = 0; j < MAX_TEXTURES; j++) { |
| 926 | for(i = 0; i < NUM_SAVEDVERTEXSTATES_T; i++) { |
| 927 | IWineD3DDevice_SetTextureStageState(pDevice, j, SavedVertexStates_T[i], |
| 928 | This->textureState[j][SavedVertexStates_T[i]]); |
H. Verbeet | a54e36a | 2006-06-27 23:40:42 +0200 | [diff] [blame] | 929 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 930 | } |
| 931 | |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 932 | for(j = 0; j < MAX_FRAGMENT_SAMPLERS; j++) { |
| 933 | for(i = 0; i < NUM_SAVEDVERTEXSTATES_S; i++) { |
| 934 | IWineD3DDevice_SetSamplerState(pDevice, j, SavedVertexStates_S[i], |
| 935 | This->samplerState[j][SavedVertexStates_S[i]]); |
| 936 | } |
| 937 | } |
| 938 | for(j = MAX_FRAGMENT_SAMPLERS; j < MAX_COMBINED_SAMPLERS; j++) { |
| 939 | for(i = 0; i < NUM_SAVEDVERTEXSTATES_S; i++) { |
| 940 | IWineD3DDevice_SetSamplerState(pDevice, |
| 941 | WINED3DVERTEXTEXTURESAMPLER0 + j - MAX_FRAGMENT_SAMPLERS, |
| 942 | SavedVertexStates_S[i], |
| 943 | This->samplerState[j][SavedVertexStates_S[i]]); |
| 944 | } |
| 945 | } |
| 946 | } else if(This->blockType == WINED3DSBT_PIXELSTATE) { |
| 947 | IWineD3DDevice_SetPixelShader(pDevice, This->pixelShader); |
| 948 | for (i = 0; i < GL_LIMITS(pshader_constantsF); i++) { |
| 949 | IWineD3DDevice_SetPixelShaderConstantF(pDevice, i, |
| 950 | This->pixelShaderConstantF + i * 4, 1); |
| 951 | } |
| 952 | for (i = 0; i < MAX_CONST_I; i++) { |
| 953 | IWineD3DDevice_SetPixelShaderConstantI(pDevice, i, |
| 954 | This->pixelShaderConstantI + i * 4, 1); |
| 955 | } |
| 956 | for (i = 0; i < MAX_CONST_B; i++) { |
| 957 | IWineD3DDevice_SetPixelShaderConstantB(pDevice, i, |
| 958 | This->pixelShaderConstantB + i, 1); |
| 959 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 960 | |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 961 | for(i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) { |
| 962 | IWineD3DDevice_SetRenderState(pDevice, SavedPixelStates_R[i], This->renderState[SavedPixelStates_R[i]]); |
| 963 | } |
| 964 | for(j = 0; j < MAX_TEXTURES; j++) { |
| 965 | for(i = 0; i < NUM_SAVEDPIXELSTATES_T; i++) { |
| 966 | IWineD3DDevice_SetTextureStageState(pDevice, j, SavedPixelStates_T[i], |
| 967 | This->textureState[j][SavedPixelStates_T[i]]); |
| 968 | } |
| 969 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 970 | |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 971 | for(j = 0; j < MAX_FRAGMENT_SAMPLERS; j++) { |
| 972 | for(i = 0; i < NUM_SAVEDPIXELSTATES_S; i++) { |
| 973 | IWineD3DDevice_SetSamplerState(pDevice, j, SavedPixelStates_S[i], |
| 974 | This->samplerState[j][SavedPixelStates_S[i]]); |
| 975 | } |
| 976 | } |
| 977 | for(j = MAX_FRAGMENT_SAMPLERS; j < MAX_COMBINED_SAMPLERS; j++) { |
| 978 | for(i = 0; i < NUM_SAVEDPIXELSTATES_S; i++) { |
| 979 | IWineD3DDevice_SetSamplerState(pDevice, |
| 980 | WINED3DVERTEXTEXTURESAMPLER0 + j - MAX_FRAGMENT_SAMPLERS, |
| 981 | SavedPixelStates_S[i], |
| 982 | This->samplerState[j][SavedPixelStates_S[i]]); |
| 983 | } |
| 984 | } |
| 985 | } else if(This->blockType == WINED3DSBT_ALL) { |
| 986 | IWineD3DDevice_SetVertexShader(pDevice, This->vertexShader); |
| 987 | for (i = 0; i < GL_LIMITS(vshader_constantsF); i++) { |
| 988 | IWineD3DDevice_SetVertexShaderConstantF(pDevice, i, |
| 989 | This->vertexShaderConstantF + i * 4, 1); |
| 990 | } |
| 991 | for (i = 0; i < MAX_CONST_I; i++) { |
| 992 | IWineD3DDevice_SetVertexShaderConstantI(pDevice, i, |
| 993 | This->vertexShaderConstantI + i * 4, 1); |
| 994 | } |
| 995 | for (i = 0; i < MAX_CONST_B; i++) { |
| 996 | IWineD3DDevice_SetVertexShaderConstantB(pDevice, i, |
| 997 | This->vertexShaderConstantB + i, 1); |
| 998 | } |
Stefan Dösinger | 93155ea | 2007-07-31 15:04:56 +0200 | [diff] [blame] | 999 | |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 1000 | IWineD3DDevice_SetPixelShader(pDevice, This->pixelShader); |
| 1001 | for (i = 0; i < GL_LIMITS(pshader_constantsF); i++) { |
| 1002 | IWineD3DDevice_SetPixelShaderConstantF(pDevice, i, |
| 1003 | This->pixelShaderConstantF + i * 4, 1); |
| 1004 | } |
| 1005 | for (i = 0; i < MAX_CONST_I; i++) { |
| 1006 | IWineD3DDevice_SetPixelShaderConstantI(pDevice, i, |
| 1007 | This->pixelShaderConstantI + i * 4, 1); |
| 1008 | } |
| 1009 | for (i = 0; i < MAX_CONST_B; i++) { |
| 1010 | IWineD3DDevice_SetPixelShaderConstantB(pDevice, i, |
| 1011 | This->pixelShaderConstantB + i, 1); |
| 1012 | } |
| 1013 | |
| 1014 | apply_lights(pDevice, This); |
| 1015 | |
| 1016 | for(i = 1; i <= WINEHIGHEST_RENDER_STATE; i++) { |
| 1017 | IWineD3DDevice_SetRenderState(pDevice, i, This->renderState[i]); |
| 1018 | } |
| 1019 | for(j = 0; j < MAX_TEXTURES; j++) { |
Henri Verbeet | a8697d9 | 2009-01-06 11:43:45 +0100 | [diff] [blame] | 1020 | for (i = 0; i <= WINED3D_HIGHEST_TEXTURE_STATE; ++i) |
| 1021 | { |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 1022 | IWineD3DDevice_SetTextureStageState(pDevice, j, i, This->textureState[j][i]); |
| 1023 | } |
| 1024 | } |
| 1025 | |
| 1026 | /* Skip unused values between TEXTURE8 and WORLD0 ? */ |
| 1027 | for(i = 1; i <= HIGHEST_TRANSFORMSTATE; i++) { |
| 1028 | IWineD3DDevice_SetTransform(pDevice, i, &This->transforms[i]); |
| 1029 | } |
Henri Verbeet | 702eeb6 | 2009-03-05 12:30:43 +0100 | [diff] [blame] | 1030 | This->wineD3DDevice->updateStateBlock->gl_primitive_type = This->gl_primitive_type; |
Stefan Dösinger | cb1c9dc | 2009-04-09 10:50:31 +0200 | [diff] [blame] | 1031 | IWineD3DDevice_SetIndices(pDevice, This->pIndexData, This->IndexFmt); |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 1032 | IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex); |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 1033 | IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl); |
| 1034 | IWineD3DDevice_SetMaterial(pDevice, &This->material); |
| 1035 | IWineD3DDevice_SetViewport(pDevice, &This->viewport); |
| 1036 | IWineD3DDevice_SetScissorRect(pDevice, &This->scissorRect); |
| 1037 | |
| 1038 | /* TODO: Proper implementation using SetStreamSource offset (set to 0 for the moment)\n") */ |
| 1039 | for (i=0; i<MAX_STREAMS; i++) { |
| 1040 | IWineD3DDevice_SetStreamSource(pDevice, i, This->streamSource[i], 0, This->streamStride[i]); |
| 1041 | IWineD3DDevice_SetStreamSourceFreq(pDevice, i, This->streamFreq[i] | This->streamFlags[i]); |
| 1042 | } |
| 1043 | for (j = 0 ; j < MAX_COMBINED_SAMPLERS; j++){ |
| 1044 | UINT sampler = j < MAX_FRAGMENT_SAMPLERS ? j : WINED3DVERTEXTEXTURESAMPLER0 + j - MAX_FRAGMENT_SAMPLERS; |
| 1045 | |
| 1046 | IWineD3DDevice_SetTexture(pDevice, sampler, This->textures[j]); |
Henri Verbeet | 691894d | 2009-01-07 09:00:55 +0100 | [diff] [blame] | 1047 | for (i = 1; i <= WINED3D_HIGHEST_SAMPLER_STATE; ++i) |
| 1048 | { |
Stefan Dösinger | f5e6313 | 2007-08-04 00:46:37 +0200 | [diff] [blame] | 1049 | IWineD3DDevice_SetSamplerState(pDevice, sampler, i, This->samplerState[j][i]); |
| 1050 | } |
| 1051 | } |
| 1052 | for (i = 0; i < GL_LIMITS(clipplanes); i++) { |
| 1053 | float clip[4]; |
| 1054 | |
| 1055 | clip[0] = This->clipplane[i][0]; |
| 1056 | clip[1] = This->clipplane[i][1]; |
| 1057 | clip[2] = This->clipplane[i][2]; |
| 1058 | clip[3] = This->clipplane[i][3]; |
| 1059 | IWineD3DDevice_SetClipPlane(pDevice, i, clip); |
| 1060 | } |
Stefan Dösinger | 59fb292 | 2007-08-03 20:23:52 +0200 | [diff] [blame] | 1061 | } |
Stefan Dösinger | 93155ea | 2007-07-31 15:04:56 +0200 | [diff] [blame] | 1062 | |
Stefan Dösinger | 762af47 | 2006-12-19 23:00:58 +0100 | [diff] [blame] | 1063 | ((IWineD3DDeviceImpl *)pDevice)->stateBlock->lowest_disabled_stage = MAX_TEXTURES - 1; |
| 1064 | for(j = 0; j < MAX_TEXTURES - 1; j++) { |
H. Verbeet | 1a07d31 | 2007-02-15 13:32:19 +0100 | [diff] [blame] | 1065 | if(((IWineD3DDeviceImpl *)pDevice)->stateBlock->textureState[j][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE) { |
Stefan Dösinger | 762af47 | 2006-12-19 23:00:58 +0100 | [diff] [blame] | 1066 | ((IWineD3DDeviceImpl *)pDevice)->stateBlock->lowest_disabled_stage = j; |
| 1067 | break; |
| 1068 | } |
| 1069 | } |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1070 | TRACE("(%p) : Applied state block %p ------------------^\n", This, pDevice); |
| 1071 | |
Stefan Dösinger | 9d67b42 | 2006-04-07 12:51:12 +0200 | [diff] [blame] | 1072 | return WINED3D_OK; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1073 | } |
| 1074 | |
Alexandre Julliard | e9cbc66 | 2006-06-10 13:15:32 +0200 | [diff] [blame] | 1075 | static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock* iface) { |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 1076 | IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1077 | IWineD3DDevice *device = (IWineD3DDevice *)This->wineD3DDevice; |
| 1078 | IWineD3DDeviceImpl *ThisDevice = (IWineD3DDeviceImpl *)device; |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1079 | union { |
Ivan Gyurdiev | 4934b7a | 2006-10-31 03:21:15 -0500 | [diff] [blame] | 1080 | WINED3DLINEPATTERN lp; |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1081 | DWORD d; |
| 1082 | } lp; |
| 1083 | union { |
| 1084 | float f; |
| 1085 | DWORD d; |
| 1086 | } tmpfloat; |
| 1087 | unsigned int i; |
Rico Schüller | 525e30e | 2008-08-31 12:20:28 +0200 | [diff] [blame] | 1088 | IWineD3DSwapChain *swapchain; |
| 1089 | IWineD3DSurface *backbuffer; |
Rico Schüller | 525e30e | 2008-08-31 12:20:28 +0200 | [diff] [blame] | 1090 | HRESULT hr; |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 1091 | |
| 1092 | /* Note this may have a large overhead but it should only be executed |
Oliver Stieber | 9253e0e | 2005-07-13 14:15:54 +0000 | [diff] [blame] | 1093 | once, in order to initialize the complete state of the device and |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 1094 | all opengl equivalents */ |
Francois Gouget | 0edbaf7 | 2005-11-10 12:14:56 +0000 | [diff] [blame] | 1095 | TRACE("(%p) -----------------------> Setting up device defaults... %p\n", This, This->wineD3DDevice); |
Oliver Stieber | 7cb748f | 2005-07-26 18:49:30 +0000 | [diff] [blame] | 1096 | /* TODO: make a special stateblock type for the primary stateblock (it never gets applied so it doesn't need a real type) */ |
| 1097 | This->blockType = WINED3DSBT_INIT; |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 1098 | |
Oliver Stieber | 7cb748f | 2005-07-26 18:49:30 +0000 | [diff] [blame] | 1099 | /* Set some of the defaults for lights, transforms etc */ |
Andrew Talbot | 0064976 | 2008-07-11 21:58:34 +0100 | [diff] [blame] | 1100 | memcpy(&This->transforms[WINED3DTS_PROJECTION], identity, sizeof(identity)); |
| 1101 | memcpy(&This->transforms[WINED3DTS_VIEW], identity, sizeof(identity)); |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1102 | for (i = 0; i < 256; ++i) { |
Andrew Talbot | 0064976 | 2008-07-11 21:58:34 +0100 | [diff] [blame] | 1103 | memcpy(&This->transforms[WINED3DTS_WORLDMATRIX(i)], identity, sizeof(identity)); |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1104 | } |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1105 | |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1106 | TRACE("Render states\n"); |
| 1107 | /* Render states: */ |
Stefan Dösinger | e4f8a2d | 2007-11-10 00:19:19 +0100 | [diff] [blame] | 1108 | if (ThisDevice->auto_depth_stencil_buffer != NULL) { |
Ivan Gyurdiev | 5f79e80 | 2006-10-24 06:06:19 -0400 | [diff] [blame] | 1109 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ZENABLE, WINED3DZB_TRUE); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1110 | } else { |
Ivan Gyurdiev | 5f79e80 | 2006-10-24 06:06:19 -0400 | [diff] [blame] | 1111 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ZENABLE, WINED3DZB_FALSE); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1112 | } |
Ivan Gyurdiev | f5cc612 | 2006-10-29 21:43:51 -0500 | [diff] [blame] | 1113 | IWineD3DDevice_SetRenderState(device, WINED3DRS_FILLMODE, WINED3DFILL_SOLID); |
Ivan Gyurdiev | 16767d2 | 2006-10-29 21:42:47 -0500 | [diff] [blame] | 1114 | IWineD3DDevice_SetRenderState(device, WINED3DRS_SHADEMODE, WINED3DSHADE_GOURAUD); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1115 | lp.lp.wRepeatFactor = 0; |
| 1116 | lp.lp.wLinePattern = 0; |
| 1117 | IWineD3DDevice_SetRenderState(device, WINED3DRS_LINEPATTERN, lp.d); |
| 1118 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ZWRITEENABLE, TRUE); |
| 1119 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ALPHATESTENABLE, FALSE); |
| 1120 | IWineD3DDevice_SetRenderState(device, WINED3DRS_LASTPIXEL, TRUE); |
Ivan Gyurdiev | 10cbffb | 2006-10-24 06:05:39 -0400 | [diff] [blame] | 1121 | IWineD3DDevice_SetRenderState(device, WINED3DRS_SRCBLEND, WINED3DBLEND_ONE); |
| 1122 | IWineD3DDevice_SetRenderState(device, WINED3DRS_DESTBLEND, WINED3DBLEND_ZERO); |
Ivan Gyurdiev | 02fb9f6 | 2006-10-29 21:43:18 -0500 | [diff] [blame] | 1123 | IWineD3DDevice_SetRenderState(device, WINED3DRS_CULLMODE, WINED3DCULL_CCW); |
Ivan Gyurdiev | 206d248 | 2006-10-29 21:44:58 -0500 | [diff] [blame] | 1124 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ZFUNC, WINED3DCMP_LESSEQUAL); |
| 1125 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ALPHAFUNC, WINED3DCMP_ALWAYS); |
Ivan Gyurdiev | 99272f0 | 2006-07-20 23:05:22 -0400 | [diff] [blame] | 1126 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ALPHAREF, 0); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1127 | IWineD3DDevice_SetRenderState(device, WINED3DRS_DITHERENABLE, FALSE); |
| 1128 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ALPHABLENDENABLE, FALSE); |
| 1129 | IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGENABLE, FALSE); |
| 1130 | IWineD3DDevice_SetRenderState(device, WINED3DRS_SPECULARENABLE, FALSE); |
| 1131 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ZVISIBLE, 0); |
| 1132 | IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGCOLOR, 0); |
Ivan Gyurdiev | 4eced8e | 2006-10-29 21:41:42 -0500 | [diff] [blame] | 1133 | IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGTABLEMODE, WINED3DFOG_NONE); |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1134 | tmpfloat.f = 0.0f; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1135 | IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGSTART, tmpfloat.d); |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1136 | tmpfloat.f = 1.0f; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1137 | IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGEND, tmpfloat.d); |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1138 | tmpfloat.f = 1.0f; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1139 | IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGDENSITY, tmpfloat.d); |
| 1140 | IWineD3DDevice_SetRenderState(device, WINED3DRS_EDGEANTIALIAS, FALSE); |
| 1141 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ZBIAS, 0); |
| 1142 | IWineD3DDevice_SetRenderState(device, WINED3DRS_RANGEFOGENABLE, FALSE); |
| 1143 | IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILENABLE, FALSE); |
Ivan Gyurdiev | 2b6deb8 | 2006-10-29 21:44:22 -0500 | [diff] [blame] | 1144 | IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILFAIL, WINED3DSTENCILOP_KEEP); |
| 1145 | IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILZFAIL, WINED3DSTENCILOP_KEEP); |
| 1146 | IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILPASS, WINED3DSTENCILOP_KEEP); |
Stefan Dösinger | f41ab3b | 2007-07-30 18:46:20 +0200 | [diff] [blame] | 1147 | IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILREF, 0); |
| 1148 | IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILMASK, 0xFFFFFFFF); |
Ivan Gyurdiev | 206d248 | 2006-10-29 21:44:58 -0500 | [diff] [blame] | 1149 | IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILFUNC, WINED3DCMP_ALWAYS); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1150 | IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILWRITEMASK, 0xFFFFFFFF); |
| 1151 | IWineD3DDevice_SetRenderState(device, WINED3DRS_TEXTUREFACTOR, 0xFFFFFFFF); |
| 1152 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP0, 0); |
| 1153 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP1, 0); |
| 1154 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP2, 0); |
| 1155 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP3, 0); |
| 1156 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP4, 0); |
| 1157 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP5, 0); |
| 1158 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP6, 0); |
| 1159 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP7, 0); |
| 1160 | IWineD3DDevice_SetRenderState(device, WINED3DRS_CLIPPING, TRUE); |
| 1161 | IWineD3DDevice_SetRenderState(device, WINED3DRS_LIGHTING, TRUE); |
| 1162 | IWineD3DDevice_SetRenderState(device, WINED3DRS_AMBIENT, 0); |
Ivan Gyurdiev | 4eced8e | 2006-10-29 21:41:42 -0500 | [diff] [blame] | 1163 | IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGVERTEXMODE, WINED3DFOG_NONE); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1164 | IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORVERTEX, TRUE); |
| 1165 | IWineD3DDevice_SetRenderState(device, WINED3DRS_LOCALVIEWER, TRUE); |
| 1166 | IWineD3DDevice_SetRenderState(device, WINED3DRS_NORMALIZENORMALS, FALSE); |
Ivan Gyurdiev | 908853f | 2006-10-29 21:45:23 -0500 | [diff] [blame] | 1167 | IWineD3DDevice_SetRenderState(device, WINED3DRS_DIFFUSEMATERIALSOURCE, WINED3DMCS_COLOR1); |
| 1168 | IWineD3DDevice_SetRenderState(device, WINED3DRS_SPECULARMATERIALSOURCE, WINED3DMCS_COLOR2); |
| 1169 | IWineD3DDevice_SetRenderState(device, WINED3DRS_AMBIENTMATERIALSOURCE, WINED3DMCS_MATERIAL); |
| 1170 | IWineD3DDevice_SetRenderState(device, WINED3DRS_EMISSIVEMATERIALSOURCE, WINED3DMCS_MATERIAL); |
Ivan Gyurdiev | 6f0bb0f | 2006-10-12 23:33:44 -0400 | [diff] [blame] | 1171 | IWineD3DDevice_SetRenderState(device, WINED3DRS_VERTEXBLEND, WINED3DVBF_DISABLE); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1172 | IWineD3DDevice_SetRenderState(device, WINED3DRS_CLIPPLANEENABLE, 0); |
| 1173 | IWineD3DDevice_SetRenderState(device, WINED3DRS_SOFTWAREVERTEXPROCESSING, FALSE); |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1174 | tmpfloat.f = 1.0f; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1175 | IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSIZE, tmpfloat.d); |
Henri Verbeet | 29b826b | 2008-12-29 09:14:29 +0100 | [diff] [blame] | 1176 | tmpfloat.f = ((IWineD3DImpl *)This->wineD3DDevice->wineD3D)->dxVersion < 9 ? 0.0f : 1.0f; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1177 | IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSIZE_MIN, tmpfloat.d); |
| 1178 | IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSPRITEENABLE, FALSE); |
| 1179 | IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSCALEENABLE, FALSE); |
Ivan Gyurdiev | 99272f0 | 2006-07-20 23:05:22 -0400 | [diff] [blame] | 1180 | tmpfloat.f = 1.0f; |
| 1181 | IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSCALE_A, tmpfloat.d); |
| 1182 | tmpfloat.f = 0.0f; |
| 1183 | IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSCALE_B, tmpfloat.d); |
| 1184 | tmpfloat.f = 0.0f; |
| 1185 | IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSCALE_C, tmpfloat.d); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1186 | IWineD3DDevice_SetRenderState(device, WINED3DRS_MULTISAMPLEANTIALIAS, TRUE); |
| 1187 | IWineD3DDevice_SetRenderState(device, WINED3DRS_MULTISAMPLEMASK, 0xFFFFFFFF); |
Ivan Gyurdiev | 50130fd | 2006-10-31 03:20:48 -0500 | [diff] [blame] | 1188 | IWineD3DDevice_SetRenderState(device, WINED3DRS_PATCHEDGESTYLE, WINED3DPATCHEDGE_DISCRETE); |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1189 | tmpfloat.f = 1.0f; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1190 | IWineD3DDevice_SetRenderState(device, WINED3DRS_PATCHSEGMENTS, tmpfloat.d); |
Ivan Gyurdiev | 99272f0 | 2006-07-20 23:05:22 -0400 | [diff] [blame] | 1191 | IWineD3DDevice_SetRenderState(device, WINED3DRS_DEBUGMONITORTOKEN, 0xbaadcafe); |
Henri Verbeet | de494ff | 2008-12-29 09:14:29 +0100 | [diff] [blame] | 1192 | tmpfloat.f = GL_LIMITS(pointsize); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1193 | IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSIZE_MAX, tmpfloat.d); |
| 1194 | IWineD3DDevice_SetRenderState(device, WINED3DRS_INDEXEDVERTEXBLENDENABLE, FALSE); |
| 1195 | IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORWRITEENABLE, 0x0000000F); |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1196 | tmpfloat.f = 0.0f; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1197 | IWineD3DDevice_SetRenderState(device, WINED3DRS_TWEENFACTOR, tmpfloat.d); |
Ivan Gyurdiev | 042fa7b | 2006-10-29 21:42:14 -0500 | [diff] [blame] | 1198 | IWineD3DDevice_SetRenderState(device, WINED3DRS_BLENDOP, WINED3DBLENDOP_ADD); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1199 | IWineD3DDevice_SetRenderState(device, WINED3DRS_POSITIONDEGREE, WINED3DDEGREE_CUBIC); |
| 1200 | IWineD3DDevice_SetRenderState(device, WINED3DRS_NORMALDEGREE, WINED3DDEGREE_LINEAR); |
| 1201 | /* states new in d3d9 */ |
| 1202 | IWineD3DDevice_SetRenderState(device, WINED3DRS_SCISSORTESTENABLE, FALSE); |
| 1203 | IWineD3DDevice_SetRenderState(device, WINED3DRS_SLOPESCALEDEPTHBIAS, 0); |
| 1204 | tmpfloat.f = 1.0f; |
| 1205 | IWineD3DDevice_SetRenderState(device, WINED3DRS_MINTESSELLATIONLEVEL, tmpfloat.d); |
| 1206 | IWineD3DDevice_SetRenderState(device, WINED3DRS_MAXTESSELLATIONLEVEL, tmpfloat.d); |
| 1207 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ANTIALIASEDLINEENABLE, FALSE); |
| 1208 | tmpfloat.f = 0.0f; |
| 1209 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ADAPTIVETESS_X, tmpfloat.d); |
| 1210 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ADAPTIVETESS_Y, tmpfloat.d); |
| 1211 | tmpfloat.f = 1.0f; |
| 1212 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ADAPTIVETESS_Z, tmpfloat.d); |
| 1213 | tmpfloat.f = 0.0f; |
| 1214 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ADAPTIVETESS_W, tmpfloat.d); |
| 1215 | IWineD3DDevice_SetRenderState(device, WINED3DRS_ENABLEADAPTIVETESSELLATION, FALSE); |
| 1216 | IWineD3DDevice_SetRenderState(device, WINED3DRS_TWOSIDEDSTENCILMODE, FALSE); |
Ivan Gyurdiev | 2b6deb8 | 2006-10-29 21:44:22 -0500 | [diff] [blame] | 1217 | IWineD3DDevice_SetRenderState(device, WINED3DRS_CCW_STENCILFAIL, WINED3DSTENCILOP_KEEP); |
| 1218 | IWineD3DDevice_SetRenderState(device, WINED3DRS_CCW_STENCILZFAIL, WINED3DSTENCILOP_KEEP); |
| 1219 | IWineD3DDevice_SetRenderState(device, WINED3DRS_CCW_STENCILPASS, WINED3DSTENCILOP_KEEP); |
Ivan Gyurdiev | 206d248 | 2006-10-29 21:44:58 -0500 | [diff] [blame] | 1220 | IWineD3DDevice_SetRenderState(device, WINED3DRS_CCW_STENCILFUNC, WINED3DCMP_ALWAYS); |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1221 | IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORWRITEENABLE1, 0x0000000F); |
| 1222 | IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORWRITEENABLE2, 0x0000000F); |
| 1223 | IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORWRITEENABLE3, 0x0000000F); |
| 1224 | IWineD3DDevice_SetRenderState(device, WINED3DRS_BLENDFACTOR, 0xFFFFFFFF); |
| 1225 | IWineD3DDevice_SetRenderState(device, WINED3DRS_SRGBWRITEENABLE, 0); |
| 1226 | IWineD3DDevice_SetRenderState(device, WINED3DRS_DEPTHBIAS, 0); |
| 1227 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP8, 0); |
| 1228 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP9, 0); |
| 1229 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP10, 0); |
| 1230 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP11, 0); |
| 1231 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP12, 0); |
| 1232 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP13, 0); |
| 1233 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP14, 0); |
| 1234 | IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP15, 0); |
| 1235 | IWineD3DDevice_SetRenderState(device, WINED3DRS_SEPARATEALPHABLENDENABLE, FALSE); |
Ivan Gyurdiev | 10cbffb | 2006-10-24 06:05:39 -0400 | [diff] [blame] | 1236 | IWineD3DDevice_SetRenderState(device, WINED3DRS_SRCBLENDALPHA, WINED3DBLEND_ONE); |
| 1237 | IWineD3DDevice_SetRenderState(device, WINED3DRS_DESTBLENDALPHA, WINED3DBLEND_ZERO); |
Ivan Gyurdiev | 042fa7b | 2006-10-29 21:42:14 -0500 | [diff] [blame] | 1238 | IWineD3DDevice_SetRenderState(device, WINED3DRS_BLENDOPALPHA, WINED3DBLENDOP_ADD); |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1239 | |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1240 | /* clipping status */ |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1241 | This->clip_status.ClipUnion = 0; |
| 1242 | This->clip_status.ClipIntersection = 0xFFFFFFFF; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1243 | |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1244 | /* Texture Stage States - Put directly into state block, we will call function below */ |
H. Verbeet | 440ca84 | 2007-06-22 00:02:12 +0200 | [diff] [blame] | 1245 | for (i = 0; i < MAX_TEXTURES; i++) { |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1246 | TRACE("Setting up default texture states for texture Stage %d\n", i); |
Andrew Talbot | 0064976 | 2008-07-11 21:58:34 +0100 | [diff] [blame] | 1247 | memcpy(&This->transforms[WINED3DTS_TEXTURE0 + i], identity, sizeof(identity)); |
Ivan Gyurdiev | c912032 | 2006-10-12 23:33:03 -0400 | [diff] [blame] | 1248 | This->textureState[i][WINED3DTSS_COLOROP ] = (i==0)? WINED3DTOP_MODULATE : WINED3DTOP_DISABLE; |
Ivan Gyurdiev | 4f611bc | 2006-10-24 06:05:00 -0400 | [diff] [blame] | 1249 | This->textureState[i][WINED3DTSS_COLORARG1 ] = WINED3DTA_TEXTURE; |
| 1250 | This->textureState[i][WINED3DTSS_COLORARG2 ] = WINED3DTA_CURRENT; |
Ivan Gyurdiev | c912032 | 2006-10-12 23:33:03 -0400 | [diff] [blame] | 1251 | This->textureState[i][WINED3DTSS_ALPHAOP ] = (i==0)? WINED3DTOP_SELECTARG1 : WINED3DTOP_DISABLE; |
Ivan Gyurdiev | 4f611bc | 2006-10-24 06:05:00 -0400 | [diff] [blame] | 1252 | This->textureState[i][WINED3DTSS_ALPHAARG1 ] = WINED3DTA_TEXTURE; |
| 1253 | This->textureState[i][WINED3DTSS_ALPHAARG2 ] = WINED3DTA_CURRENT; |
Michael Stefaniuc | efeab9d | 2008-11-03 22:34:44 +0100 | [diff] [blame] | 1254 | This->textureState[i][WINED3DTSS_BUMPENVMAT00 ] = 0; |
| 1255 | This->textureState[i][WINED3DTSS_BUMPENVMAT01 ] = 0; |
| 1256 | This->textureState[i][WINED3DTSS_BUMPENVMAT10 ] = 0; |
| 1257 | This->textureState[i][WINED3DTSS_BUMPENVMAT11 ] = 0; |
Ivan Gyurdiev | 837027f | 2006-10-10 21:52:50 -0400 | [diff] [blame] | 1258 | This->textureState[i][WINED3DTSS_TEXCOORDINDEX ] = i; |
Michael Stefaniuc | efeab9d | 2008-11-03 22:34:44 +0100 | [diff] [blame] | 1259 | This->textureState[i][WINED3DTSS_BUMPENVLSCALE ] = 0; |
| 1260 | This->textureState[i][WINED3DTSS_BUMPENVLOFFSET ] = 0; |
Ivan Gyurdiev | 9846602 | 2006-10-12 23:36:09 -0400 | [diff] [blame] | 1261 | This->textureState[i][WINED3DTSS_TEXTURETRANSFORMFLAGS ] = WINED3DTTFF_DISABLE; |
Ivan Gyurdiev | 4f611bc | 2006-10-24 06:05:00 -0400 | [diff] [blame] | 1262 | This->textureState[i][WINED3DTSS_COLORARG0 ] = WINED3DTA_CURRENT; |
| 1263 | This->textureState[i][WINED3DTSS_ALPHAARG0 ] = WINED3DTA_CURRENT; |
| 1264 | This->textureState[i][WINED3DTSS_RESULTARG ] = WINED3DTA_CURRENT; |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1265 | } |
Stefan Dösinger | 762af47 | 2006-12-19 23:00:58 +0100 | [diff] [blame] | 1266 | This->lowest_disabled_stage = 1; |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1267 | |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1268 | /* Sampler states*/ |
H. Verbeet | 5b7758f | 2007-06-25 22:45:40 +0200 | [diff] [blame] | 1269 | for (i = 0 ; i < MAX_COMBINED_SAMPLERS; i++) { |
Oliver Stieber | 9253e0e | 2005-07-13 14:15:54 +0000 | [diff] [blame] | 1270 | TRACE("Setting up default samplers states for sampler %d\n", i); |
Ivan Gyurdiev | 997e670 | 2006-10-24 06:03:18 -0400 | [diff] [blame] | 1271 | This->samplerState[i][WINED3DSAMP_ADDRESSU ] = WINED3DTADDRESS_WRAP; |
| 1272 | This->samplerState[i][WINED3DSAMP_ADDRESSV ] = WINED3DTADDRESS_WRAP; |
| 1273 | This->samplerState[i][WINED3DSAMP_ADDRESSW ] = WINED3DTADDRESS_WRAP; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1274 | This->samplerState[i][WINED3DSAMP_BORDERCOLOR ] = 0x00; |
Stefan Dösinger | 63fd9a7 | 2006-04-06 19:02:16 +0200 | [diff] [blame] | 1275 | This->samplerState[i][WINED3DSAMP_MAGFILTER ] = WINED3DTEXF_POINT; |
| 1276 | This->samplerState[i][WINED3DSAMP_MINFILTER ] = WINED3DTEXF_POINT; |
| 1277 | This->samplerState[i][WINED3DSAMP_MIPFILTER ] = WINED3DTEXF_NONE; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1278 | This->samplerState[i][WINED3DSAMP_MIPMAPLODBIAS ] = 0; |
| 1279 | This->samplerState[i][WINED3DSAMP_MAXMIPLEVEL ] = 0; |
| 1280 | This->samplerState[i][WINED3DSAMP_MAXANISOTROPY ] = 1; |
Phil Costin | 622f62d | 2007-06-06 23:13:16 +0000 | [diff] [blame] | 1281 | This->samplerState[i][WINED3DSAMP_SRGBTEXTURE ] = 0; |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1282 | This->samplerState[i][WINED3DSAMP_ELEMENTINDEX ] = 0; /* TODO: Indicates which element of a multielement texture to use */ |
Ivan Gyurdiev | a648d4e | 2006-10-28 19:55:03 -0400 | [diff] [blame] | 1283 | This->samplerState[i][WINED3DSAMP_DMAPOFFSET ] = 0; /* TODO: Vertex offset in the presampled displacement map */ |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1284 | } |
| 1285 | |
Stefan Dösinger | 220d9eb | 2008-02-15 15:54:37 +0100 | [diff] [blame] | 1286 | for(i = 0; i < GL_LIMITS(textures); i++) { |
Austin English | 6e59cd2 | 2008-04-22 01:18:14 -0500 | [diff] [blame] | 1287 | /* Note: This avoids calling SetTexture, so pretend it has been called */ |
Henri Verbeet | 9a889f6 | 2009-01-02 16:19:12 +0100 | [diff] [blame] | 1288 | This->changed.textures |= 1 << i; |
Stefan Dösinger | 1e264e5 | 2006-12-19 22:37:37 +0100 | [diff] [blame] | 1289 | This->textures[i] = NULL; |
Jason Edmeades | 2003c7a | 2004-12-13 13:35:38 +0000 | [diff] [blame] | 1290 | } |
Stefan Dösinger | 1e264e5 | 2006-12-19 22:37:37 +0100 | [diff] [blame] | 1291 | |
Rico Schüller | 525e30e | 2008-08-31 12:20:28 +0200 | [diff] [blame] | 1292 | /* check the return values, because the GetBackBuffer call isn't valid for ddraw */ |
| 1293 | hr = IWineD3DDevice_GetSwapChain(device, 0, &swapchain); |
| 1294 | if( hr == WINED3D_OK && swapchain != NULL) { |
Henri Verbeet | ef7365a | 2008-12-19 19:21:55 +0100 | [diff] [blame] | 1295 | WINED3DVIEWPORT vp; |
| 1296 | |
Rico Schüller | 525e30e | 2008-08-31 12:20:28 +0200 | [diff] [blame] | 1297 | hr = IWineD3DSwapChain_GetBackBuffer(swapchain, 0, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer); |
Henri Verbeet | 88162fa | 2009-06-15 09:06:50 +0200 | [diff] [blame] | 1298 | if (SUCCEEDED(hr) && backbuffer) |
| 1299 | { |
| 1300 | WINED3DSURFACE_DESC desc; |
| 1301 | RECT scissorrect; |
| 1302 | |
Rico Schüller | 525e30e | 2008-08-31 12:20:28 +0200 | [diff] [blame] | 1303 | IWineD3DSurface_GetDesc(backbuffer, &desc); |
| 1304 | IWineD3DSurface_Release(backbuffer); |
| 1305 | |
Henri Verbeet | 88162fa | 2009-06-15 09:06:50 +0200 | [diff] [blame] | 1306 | /* Set the default scissor rect values */ |
Rico Schüller | 525e30e | 2008-08-31 12:20:28 +0200 | [diff] [blame] | 1307 | scissorrect.left = 0; |
Henri Verbeet | 88162fa | 2009-06-15 09:06:50 +0200 | [diff] [blame] | 1308 | scissorrect.right = desc.width; |
Rico Schüller | 525e30e | 2008-08-31 12:20:28 +0200 | [diff] [blame] | 1309 | scissorrect.top = 0; |
Henri Verbeet | 88162fa | 2009-06-15 09:06:50 +0200 | [diff] [blame] | 1310 | scissorrect.bottom = desc.height; |
Rico Schüller | 525e30e | 2008-08-31 12:20:28 +0200 | [diff] [blame] | 1311 | hr = IWineD3DDevice_SetScissorRect(device, &scissorrect); |
Henri Verbeet | 88162fa | 2009-06-15 09:06:50 +0200 | [diff] [blame] | 1312 | if (FAILED(hr)) ERR("This should never happen, expect rendering issues!\n"); |
Rico Schüller | 525e30e | 2008-08-31 12:20:28 +0200 | [diff] [blame] | 1313 | } |
Henri Verbeet | ef7365a | 2008-12-19 19:21:55 +0100 | [diff] [blame] | 1314 | |
| 1315 | /* Set the default viewport */ |
| 1316 | vp.X = 0; |
| 1317 | vp.Y = 0; |
| 1318 | vp.Width = ((IWineD3DSwapChainImpl *)swapchain)->presentParms.BackBufferWidth; |
| 1319 | vp.Height = ((IWineD3DSwapChainImpl *)swapchain)->presentParms.BackBufferHeight; |
| 1320 | vp.MinZ = 0.0f; |
| 1321 | vp.MaxZ = 1.0f; |
| 1322 | IWineD3DDevice_SetViewport(device, &vp); |
| 1323 | |
Rico Schüller | 525e30e | 2008-08-31 12:20:28 +0200 | [diff] [blame] | 1324 | IWineD3DSwapChain_Release(swapchain); |
| 1325 | } |
| 1326 | |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 1327 | TRACE("-----------------------> Device defaults now set up...\n"); |
Stefan Dösinger | 9d67b42 | 2006-04-07 12:51:12 +0200 | [diff] [blame] | 1328 | return WINED3D_OK; |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 1329 | } |
| 1330 | |
| 1331 | /********************************************************** |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 1332 | * IWineD3DStateBlock VTbl follows |
| 1333 | **********************************************************/ |
| 1334 | |
Dmitry Timoshkov | eba47f1 | 2005-06-06 19:50:35 +0000 | [diff] [blame] | 1335 | const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl = |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 1336 | { |
Oliver Stieber | 9253e0e | 2005-07-13 14:15:54 +0000 | [diff] [blame] | 1337 | /* IUnknown */ |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 1338 | IWineD3DStateBlockImpl_QueryInterface, |
| 1339 | IWineD3DStateBlockImpl_AddRef, |
| 1340 | IWineD3DStateBlockImpl_Release, |
Oliver Stieber | 9253e0e | 2005-07-13 14:15:54 +0000 | [diff] [blame] | 1341 | /* IWineD3DStateBlock */ |
Jason Edmeades | 289562e | 2004-11-23 13:52:46 +0000 | [diff] [blame] | 1342 | IWineD3DStateBlockImpl_GetParent, |
Oliver Stieber | abb11f3 | 2005-07-05 14:05:18 +0000 | [diff] [blame] | 1343 | IWineD3DStateBlockImpl_GetDevice, |
| 1344 | IWineD3DStateBlockImpl_Capture, |
| 1345 | IWineD3DStateBlockImpl_Apply, |
Jason Edmeades | 447d5ed | 2004-10-21 20:59:12 +0000 | [diff] [blame] | 1346 | IWineD3DStateBlockImpl_InitStartupStateBlock |
| 1347 | }; |