Changeset 20612 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
- Timestamp:
- Jun 16, 2009 9:20:54 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
r19678 r20612 61 61 }; 62 62 63 /* static function declarations */64 static void IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3DResource *resource);65 66 63 /********************************************************** 67 64 * Global variable / Constants follow … … 450 447 { 451 448 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; 449 const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(WINED3DFMT_UNKNOWN, &This->adapter->gl_info); 452 450 struct wined3d_buffer *object; 453 451 HRESULT hr; … … 467 465 FIXME("Ignoring access flags (pool)\n"); 468 466 469 hr = resource_init( &object->resource, WINED3DRTYPE_BUFFER, This, desc->byte_width,470 desc->usage, WINED3DFMT_UNKNOWN, WINED3DPOOL_MANAGED, parent);467 hr = resource_init((IWineD3DResource *)object, WINED3DRTYPE_BUFFER, This, desc->byte_width, 468 desc->usage, format_desc, WINED3DPOOL_MANAGED, parent); 471 469 if (FAILED(hr)) 472 470 { … … 478 476 479 477 TRACE("Created resource %p\n", object); 480 481 IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);482 478 483 479 TRACE("size %#x, usage=%#x, format %s, memory @ %p, iface @ %p\n", object->resource.size, object->resource.usage, … … 545 541 546 542 object->vtbl = &wined3d_buffer_vtbl; 547 hr = resource_init( &object->resource, WINED3DRTYPE_BUFFER, This, Size, Usage, format_desc, Pool, parent);543 hr = resource_init((IWineD3DResource *)object, WINED3DRTYPE_BUFFER, This, Size, Usage, format_desc, Pool, parent); 548 544 if (FAILED(hr)) 549 545 { … … 556 552 557 553 TRACE("(%p) : Created resource %p\n", This, object); 558 559 IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);560 554 561 555 TRACE("(%p) : Size=%d, Usage=0x%08x, FVF=%x, Pool=%d - Memory@%p, Iface@%p\n", This, Size, Usage, FVF, Pool, object->resource.allocatedMemory, object); … … 612 606 613 607 object->vtbl = &wined3d_buffer_vtbl; 614 hr = resource_init( &object->resource, WINED3DRTYPE_BUFFER, This, Length, Usage, format_desc, Pool, parent);608 hr = resource_init((IWineD3DResource *)object, WINED3DRTYPE_BUFFER, This, Length, Usage, format_desc, Pool, parent); 615 609 if (FAILED(hr)) 616 610 { … … 623 617 624 618 TRACE("(%p) : Created resource %p\n", This, object); 625 626 IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);627 619 628 620 if(Pool != WINED3DPOOL_SYSTEMMEM && !(Usage & WINED3DUSAGE_DYNAMIC) && GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT)) { … … 988 980 } 989 981 990 hr = resource_init( &object->resource, WINED3DRTYPE_SURFACE, This, Size, Usage, glDesc, Pool, parent);982 hr = resource_init((IWineD3DResource *)object, WINED3DRTYPE_SURFACE, This, Size, Usage, glDesc, Pool, parent); 991 983 if (FAILED(hr)) 992 984 { … … 998 990 999 991 TRACE("(%p) : Created resource %p\n", This, object); 1000 1001 IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);1002 992 1003 993 *ppSurface = (IWineD3DSurface *)object; … … 1103 1093 { 1104 1094 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; 1105 const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapter->gl_info);1106 1095 IWineD3DTextureImpl *object; 1107 unsigned int i;1108 UINT tmpW;1109 UINT tmpH;1110 1096 HRESULT hr; 1111 unsigned int pow2Width;1112 unsigned int pow2Height;1113 1097 1114 1098 TRACE("(%p) : Width %d, Height %d, Levels %d, Usage %#x\n", This, Width, Height, Levels, Usage); 1115 1099 TRACE("Format %#x (%s), Pool %#x, ppTexture %p, parent %p\n", 1116 1100 Format, debug_d3dformat(Format), Pool, ppTexture, parent); 1117 1118 /* TODO: It should only be possible to create textures for formats1119 that are reported as supported */1120 if (WINED3DFMT_UNKNOWN >= Format) {1121 WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN\n", This);1122 return WINED3DERR_INVALIDCALL;1123 }1124 1125 /* Non-power2 support */1126 if (GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO))1127 {1128 pow2Width = Width;1129 pow2Height = Height;1130 }1131 else1132 {1133 /* Find the nearest pow2 match */1134 pow2Width = pow2Height = 1;1135 while (pow2Width < Width) pow2Width <<= 1;1136 while (pow2Height < Height) pow2Height <<= 1;1137 1138 if (pow2Width != Width || pow2Height != Height)1139 {1140 if (Levels > 1)1141 {1142 WARN("Attempted to create a mipmapped np2 texture without unconditional np2 support\n");1143 return WINED3DERR_INVALIDCALL;1144 }1145 Levels = 1;1146 }1147 }1148 1149 /* Calculate levels for mip mapping */1150 if (Usage & WINED3DUSAGE_AUTOGENMIPMAP)1151 {1152 if (!GL_SUPPORT(SGIS_GENERATE_MIPMAP))1153 {1154 WARN("No mipmap generation support, returning D3DERR_INVALIDCALL\n");1155 return WINED3DERR_INVALIDCALL;1156 }1157 1158 if (Levels > 1)1159 {1160 WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL\n");1161 return WINED3DERR_INVALIDCALL;1162 }1163 1164 Levels = 1;1165 }1166 else if (!Levels)1167 {1168 Levels = wined3d_log2i(max(Width, Height)) + 1;1169 TRACE("Calculated levels = %d\n", Levels);1170 }1171 1101 1172 1102 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); … … 1179 1109 1180 1110 object->lpVtbl = &IWineD3DTexture_Vtbl; 1181 hr = resource_init(&object->resource, WINED3DRTYPE_TEXTURE, This, 0, Usage, format_desc, Pool, parent); 1111 1112 hr = texture_init(object, Width, Height, Levels, This, Usage, Format, Pool, parent); 1182 1113 if (FAILED(hr)) 1183 1114 { 1184 WARN("Failed to initialize resource, returning %#x\n", hr);1115 WARN("Failed to initialize texture, returning %#x\n", hr); 1185 1116 HeapFree(GetProcessHeap(), 0, object); 1186 1117 *ppTexture = NULL; … … 1188 1119 } 1189 1120 1190 TRACE("(%p) : Created resource %p\n", This, object);1191 1192 IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);1193 1194 1121 *ppTexture = (IWineD3DTexture *)object; 1195 1122 1196 basetexture_init(&object->baseTexture, Levels, Usage); 1197 1198 if (object->resource.format_desc->Flags & WINED3DFMT_FLAG_FILTERING) 1199 { 1200 object->baseTexture.minMipLookup = minMipLookup; 1201 object->baseTexture.magLookup = magLookup; 1202 } else { 1203 object->baseTexture.minMipLookup = minMipLookup_noFilter; 1204 object->baseTexture.magLookup = magLookup_noFilter; 1205 } 1206 1207 /** FIXME: add support for real non-power-two if it's provided by the video card **/ 1208 /* Precalculated scaling for 'faked' non power of two texture coords. 1209 Second also don't use ARB_TEXTURE_RECTANGLE in case the surface format is P8 and EXT_PALETTED_TEXTURE 1210 is used in combination with texture uploads (RTL_READTEX/RTL_TEXTEX). The reason is that EXT_PALETTED_TEXTURE 1211 doesn't work in combination with ARB_TEXTURE_RECTANGLE. 1212 */ 1213 if(GL_SUPPORT(WINE_NORMALIZED_TEXRECT) && (Width != pow2Width || Height != pow2Height)) { 1214 object->baseTexture.pow2Matrix[0] = 1.0; 1215 object->baseTexture.pow2Matrix[5] = 1.0; 1216 object->baseTexture.pow2Matrix[10] = 1.0; 1217 object->baseTexture.pow2Matrix[15] = 1.0; 1218 object->target = GL_TEXTURE_2D; 1219 object->cond_np2 = TRUE; 1220 object->baseTexture.minMipLookup = minMipLookup_noFilter; 1221 } else if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE) && 1222 (Width != pow2Width || Height != pow2Height) && 1223 !((Format == WINED3DFMT_P8) && GL_SUPPORT(EXT_PALETTED_TEXTURE) && (wined3d_settings.rendertargetlock_mode == RTL_READTEX || wined3d_settings.rendertargetlock_mode == RTL_TEXTEX))) 1224 { 1225 if ((Width != 1) || (Height != 1)) { 1226 object->baseTexture.pow2Matrix_identity = FALSE; 1227 } 1228 1229 object->baseTexture.pow2Matrix[0] = (float)Width; 1230 object->baseTexture.pow2Matrix[5] = (float)Height; 1231 object->baseTexture.pow2Matrix[10] = 1.0; 1232 object->baseTexture.pow2Matrix[15] = 1.0; 1233 object->target = GL_TEXTURE_RECTANGLE_ARB; 1234 object->cond_np2 = TRUE; 1235 object->baseTexture.minMipLookup = minMipLookup_noFilter; 1236 } else { 1237 if ((Width != pow2Width) || (Height != pow2Height)) { 1238 object->baseTexture.pow2Matrix_identity = FALSE; 1239 object->baseTexture.pow2Matrix[0] = (((float)Width) / ((float)pow2Width)); 1240 object->baseTexture.pow2Matrix[5] = (((float)Height) / ((float)pow2Height)); 1241 } else { 1242 object->baseTexture.pow2Matrix[0] = 1.0; 1243 object->baseTexture.pow2Matrix[5] = 1.0; 1244 } 1245 1246 object->baseTexture.pow2Matrix[10] = 1.0; 1247 object->baseTexture.pow2Matrix[15] = 1.0; 1248 object->target = GL_TEXTURE_2D; 1249 object->cond_np2 = FALSE; 1250 } 1251 TRACE(" xf(%f) yf(%f)\n", object->baseTexture.pow2Matrix[0], object->baseTexture.pow2Matrix[5]); 1252 1253 /* Generate all the surfaces */ 1254 tmpW = Width; 1255 tmpH = Height; 1256 for (i = 0; i < object->baseTexture.levels; i++) 1257 { 1258 /* use the callback to create the texture surface */ 1259 hr = IWineD3DDeviceParent_CreateSurface(This->device_parent, parent, tmpW, tmpH, Format, 1260 Usage, Pool, i, WINED3DCUBEMAP_FACE_POSITIVE_X, &object->surfaces[i]); 1261 if (hr!= WINED3D_OK || ( (IWineD3DSurfaceImpl *) object->surfaces[i])->Flags & SFLAG_OVERSIZE) { 1262 FIXME("Failed to create surface %p\n", object); 1263 /* clean up */ 1264 object->surfaces[i] = NULL; 1265 IWineD3DTexture_Release((IWineD3DTexture *)object); 1266 1267 *ppTexture = NULL; 1268 return hr; 1269 } 1270 1271 IWineD3DSurface_SetContainer(object->surfaces[i], (IWineD3DBase *)object); 1272 TRACE("Created surface level %d @ %p\n", i, object->surfaces[i]); 1273 surface_set_texture_target(object->surfaces[i], object->target); 1274 /* calculate the next mipmap level */ 1275 tmpW = max(1, tmpW >> 1); 1276 tmpH = max(1, tmpH >> 1); 1277 } 1278 object->baseTexture.internal_preload = texture_internal_preload; 1279 1280 TRACE("(%p) : Created texture %p\n", This, object); 1123 TRACE("(%p) : Created texture %p\n", This, object); 1124 1281 1125 return WINED3D_OK; 1282 1126 } … … 1287 1131 { 1288 1132 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; 1289 const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapter->gl_info);1290 1133 IWineD3DVolumeTextureImpl *object; 1291 unsigned int i;1292 UINT tmpW;1293 UINT tmpH;1294 UINT tmpD;1295 1134 HRESULT hr; 1296 1135 1297 /* TODO: It should only be possible to create textures for formats 1298 that are reported as supported */ 1299 if (WINED3DFMT_UNKNOWN >= Format) { 1300 WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN\n", This); 1301 return WINED3DERR_INVALIDCALL; 1302 } 1303 if(!GL_SUPPORT(EXT_TEXTURE3D)) { 1304 WARN("(%p) : Texture cannot be created - no volume texture support\n", This); 1305 return WINED3DERR_INVALIDCALL; 1306 } 1307 1308 /* Calculate levels for mip mapping */ 1309 if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) 1310 { 1311 if (!GL_SUPPORT(SGIS_GENERATE_MIPMAP)) 1312 { 1313 WARN("No mipmap generation support, returning D3DERR_INVALIDCALL\n"); 1314 return WINED3DERR_INVALIDCALL; 1315 } 1316 1317 if (Levels > 1) 1318 { 1319 WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL\n"); 1320 return WINED3DERR_INVALIDCALL; 1321 } 1322 1323 Levels = 1; 1324 } 1325 else if (!Levels) 1326 { 1327 Levels = wined3d_log2i(max(max(Width, Height), Depth)) + 1; 1328 TRACE("Calculated levels = %d\n", Levels); 1329 } 1136 TRACE("(%p) : W(%u) H(%u) D(%u), Lvl(%u) Usage(%#x), Fmt(%u,%s), Pool(%s)\n", This, Width, Height, 1137 Depth, Levels, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool)); 1330 1138 1331 1139 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); … … 1338 1146 1339 1147 object->lpVtbl = &IWineD3DVolumeTexture_Vtbl; 1340 hr = resource_init(&object->resource, WINED3DRTYPE_VOLUMETEXTURE, This, 0, Usage, format_desc, Pool, parent);1148 hr = volumetexture_init(object, Width, Height, Depth, Levels, This, Usage, Format, Pool, parent); 1341 1149 if (FAILED(hr)) 1342 1150 { 1343 WARN("Failed to initialize resource, returning %#x\n", hr);1151 WARN("Failed to initialize volumetexture, returning %#x\n", hr); 1344 1152 HeapFree(GetProcessHeap(), 0, object); 1345 1153 *ppVolumeTexture = NULL; … … 1347 1155 } 1348 1156 1349 TRACE("(%p) : Created resource %p\n", This, object); 1350 1351 IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object); 1352 1353 basetexture_init(&object->baseTexture, Levels, Usage); 1354 1355 TRACE("(%p) : W(%d) H(%d) D(%d), Lvl(%d) Usage(%d), Fmt(%u,%s), Pool(%s)\n", This, Width, Height, 1356 Depth, Levels, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool)); 1357 1358 /* Is NP2 support for volumes needed? */ 1359 object->baseTexture.pow2Matrix[ 0] = 1.0; 1360 object->baseTexture.pow2Matrix[ 5] = 1.0; 1361 object->baseTexture.pow2Matrix[10] = 1.0; 1362 object->baseTexture.pow2Matrix[15] = 1.0; 1363 1364 if (object->resource.format_desc->Flags & WINED3DFMT_FLAG_FILTERING) 1365 { 1366 object->baseTexture.minMipLookup = minMipLookup; 1367 object->baseTexture.magLookup = magLookup; 1368 } else { 1369 object->baseTexture.minMipLookup = minMipLookup_noFilter; 1370 object->baseTexture.magLookup = magLookup_noFilter; 1371 } 1372 1373 /* Generate all the surfaces */ 1374 tmpW = Width; 1375 tmpH = Height; 1376 tmpD = Depth; 1377 1378 for (i = 0; i < object->baseTexture.levels; i++) 1379 { 1380 HRESULT hr; 1381 /* Create the volume */ 1382 hr = IWineD3DDeviceParent_CreateVolume(This->device_parent, parent, 1383 tmpW, tmpH, tmpD, Format, Pool, Usage, &object->volumes[i]); 1384 if(FAILED(hr)) { 1385 ERR("Creating a volume for the volume texture failed(%08x)\n", hr); 1386 IWineD3DVolumeTexture_Release((IWineD3DVolumeTexture *) object); 1387 *ppVolumeTexture = NULL; 1388 return hr; 1389 } 1390 1391 /* Set its container to this object */ 1392 IWineD3DVolume_SetContainer(object->volumes[i], (IWineD3DBase *)object); 1393 1394 /* calculate the next mipmap level */ 1395 tmpW = max(1, tmpW >> 1); 1396 tmpH = max(1, tmpH >> 1); 1397 tmpD = max(1, tmpD >> 1); 1398 } 1399 object->baseTexture.internal_preload = volumetexture_internal_preload; 1400 1401 *ppVolumeTexture = (IWineD3DVolumeTexture *) object; 1402 TRACE("(%p) : Created volume texture %p\n", This, object); 1157 TRACE("(%p) : Created volume texture %p.\n", This, object); 1158 *ppVolumeTexture = (IWineD3DVolumeTexture *)object; 1159 1403 1160 return WINED3D_OK; 1404 1161 } … … 1427 1184 1428 1185 object->lpVtbl = &IWineD3DVolume_Vtbl; 1429 hr = resource_init( &object->resource, WINED3DRTYPE_VOLUME, This,1186 hr = resource_init((IWineD3DResource *)object, WINED3DRTYPE_VOLUME, This, 1430 1187 Width * Height * Depth * format_desc->byte_count, Usage, format_desc, Pool, parent); 1431 1188 if (FAILED(hr)) … … 1439 1196 TRACE("(%p) : Created resource %p\n", This, object); 1440 1197 1441 IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);1442 1443 1198 *ppVolume = (IWineD3DVolume *)object; 1444 1199 … … 1466 1221 { 1467 1222 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; 1468 const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapter->gl_info);1469 1223 IWineD3DCubeTextureImpl *object; /** NOTE: impl ref allowed since this is a create function **/ 1470 unsigned int i, j;1471 UINT tmpW;1472 1224 HRESULT hr; 1473 unsigned int pow2EdgeLength;1474 1475 /* TODO: It should only be possible to create textures for formats1476 that are reported as supported */1477 if (WINED3DFMT_UNKNOWN >= Format) {1478 WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN\n", This);1479 return WINED3DERR_INVALIDCALL;1480 }1481 1482 if (!GL_SUPPORT(ARB_TEXTURE_CUBE_MAP) && Pool != WINED3DPOOL_SCRATCH) {1483 WARN("(%p) : Tried to create not supported cube texture\n", This);1484 return WINED3DERR_INVALIDCALL;1485 }1486 1487 /* Calculate levels for mip mapping */1488 if (Usage & WINED3DUSAGE_AUTOGENMIPMAP)1489 {1490 if (!GL_SUPPORT(SGIS_GENERATE_MIPMAP))1491 {1492 WARN("No mipmap generation support, returning D3DERR_INVALIDCALL\n");1493 return WINED3DERR_INVALIDCALL;1494 }1495 1496 if (Levels > 1)1497 {1498 WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL\n");1499 return WINED3DERR_INVALIDCALL;1500 }1501 1502 Levels = 1;1503 }1504 else if (!Levels)1505 {1506 Levels = wined3d_log2i(EdgeLength) + 1;1507 TRACE("Calculated levels = %d\n", Levels);1508 }1509 1225 1510 1226 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); … … 1517 1233 1518 1234 object->lpVtbl = &IWineD3DCubeTexture_Vtbl; 1519 hr = resource_init(&object->resource, WINED3DRTYPE_CUBETEXTURE, This, 0, Usage, format_desc, Pool, parent);1235 hr = cubetexture_init(object, EdgeLength, Levels, This, Usage, Format, Pool, parent); 1520 1236 if (FAILED(hr)) 1521 1237 { 1522 WARN("Failed to initialize resource, returning %#x\n", hr);1238 WARN("Failed to initialize cubetexture, returning %#x\n", hr); 1523 1239 HeapFree(GetProcessHeap(), 0, object); 1524 1240 *ppCubeTexture = NULL; … … 1526 1242 } 1527 1243 1528 TRACE("(%p) : Created resource %p\n", This, object);1529 1530 IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);1531 1532 basetexture_init(&object->baseTexture, Levels, Usage);1533 1534 TRACE("(%p) Create Cube Texture\n", This);1535 1536 /* Find the nearest pow2 match */1537 pow2EdgeLength = 1;1538 while (pow2EdgeLength < EdgeLength) pow2EdgeLength <<= 1;1539 1540 if (GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO) || (EdgeLength == pow2EdgeLength)) {1541 /* Precalculated scaling for 'faked' non power of two texture coords */1542 object->baseTexture.pow2Matrix[ 0] = 1.0;1543 object->baseTexture.pow2Matrix[ 5] = 1.0;1544 object->baseTexture.pow2Matrix[10] = 1.0;1545 object->baseTexture.pow2Matrix[15] = 1.0;1546 } else {1547 /* Precalculated scaling for 'faked' non power of two texture coords */1548 object->baseTexture.pow2Matrix[ 0] = ((float)EdgeLength) / ((float)pow2EdgeLength);1549 object->baseTexture.pow2Matrix[ 5] = ((float)EdgeLength) / ((float)pow2EdgeLength);1550 object->baseTexture.pow2Matrix[10] = ((float)EdgeLength) / ((float)pow2EdgeLength);1551 object->baseTexture.pow2Matrix[15] = 1.0;1552 object->baseTexture.pow2Matrix_identity = FALSE;1553 }1554 1555 if (object->resource.format_desc->Flags & WINED3DFMT_FLAG_FILTERING)1556 {1557 object->baseTexture.minMipLookup = minMipLookup;1558 object->baseTexture.magLookup = magLookup;1559 } else {1560 object->baseTexture.minMipLookup = minMipLookup_noFilter;1561 object->baseTexture.magLookup = magLookup_noFilter;1562 }1563 1564 /* Generate all the surfaces */1565 tmpW = EdgeLength;1566 for (i = 0; i < object->baseTexture.levels; i++) {1567 1568 /* Create the 6 faces */1569 for (j = 0; j < 6; j++) {1570 static const GLenum cube_targets[6] = {1571 GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,1572 GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,1573 GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,1574 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,1575 GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,1576 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB1577 };1578 1579 hr = IWineD3DDeviceParent_CreateSurface(This->device_parent, parent, tmpW, tmpW,1580 Format, Usage, Pool, i /* Level */, j, &object->surfaces[j][i]);1581 if (FAILED(hr))1582 {1583 FIXME("(%p) Failed to create surface\n",object);1584 IWineD3DCubeTexture_Release((IWineD3DCubeTexture *)object);1585 *ppCubeTexture = NULL;1586 return hr;1587 }1588 IWineD3DSurface_SetContainer(object->surfaces[j][i], (IWineD3DBase *)object);1589 TRACE("Created surface level %d @ %p,\n", i, object->surfaces[j][i]);1590 surface_set_texture_target(object->surfaces[j][i], cube_targets[j]);1591 }1592 tmpW = max(1, tmpW >> 1);1593 }1594 object->baseTexture.internal_preload = cubetexture_internal_preload;1595 1596 1244 TRACE("(%p) : Created Cube Texture %p\n", This, object); 1597 *ppCubeTexture = (IWineD3DCubeTexture *) object; 1245 *ppCubeTexture = (IWineD3DCubeTexture *)object; 1246 1598 1247 return WINED3D_OK; 1599 1248 } … … 2337 1986 } 2338 1987 2339 static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, IWineD3DVertexDeclaration *vertex_declaration, CONST DWORD *pFunction, IWineD3DVertexShader **ppVertexShader, IUnknown *parent) { 1988 static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, 1989 const DWORD *pFunction, const struct wined3d_shader_signature *output_signature, 1990 IWineD3DVertexShader **ppVertexShader, IUnknown *parent) 1991 { 2340 1992 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; 2341 1993 IWineD3DVertexShaderImpl *object; /* NOTE: impl usage is ok, this is a create */ … … 2360 2012 TRACE("(%p) : Created vertex shader %p\n", This, *ppVertexShader); 2361 2013 2362 if (vertex_declaration) { 2363 IWineD3DVertexShader_FakeSemantics(*ppVertexShader, vertex_declaration); 2364 } 2365 2366 hr = IWineD3DVertexShader_SetFunction(*ppVertexShader, pFunction); 2014 hr = IWineD3DVertexShader_SetFunction(*ppVertexShader, pFunction, output_signature); 2367 2015 if (FAILED(hr)) 2368 2016 { … … 2376 2024 } 2377 2025 2378 static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface, CONST DWORD *pFunction, IWineD3DPixelShader **ppPixelShader, IUnknown *parent) { 2026 static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface, 2027 const DWORD *pFunction, const struct wined3d_shader_signature *output_signature, 2028 IWineD3DPixelShader **ppPixelShader, IUnknown *parent) 2029 { 2379 2030 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; 2380 2031 IWineD3DPixelShaderImpl *object; /* NOTE: impl allowed, this is a create */ … … 2399 2050 TRACE("(%p) : Created pixel shader %p\n", This, *ppPixelShader); 2400 2051 2401 hr = IWineD3DPixelShader_SetFunction(*ppPixelShader, pFunction );2052 hr = IWineD3DPixelShader_SetFunction(*ppPixelShader, pFunction, output_signature); 2402 2053 if (FAILED(hr)) 2403 2054 { … … 2841 2492 */ 2842 2493 if(This->depth_blt_texture) { 2494 ENTER_GL(); 2843 2495 glDeleteTextures(1, &This->depth_blt_texture); 2496 LEAVE_GL(); 2844 2497 This->depth_blt_texture = 0; 2845 2498 } 2846 2499 if (This->depth_blt_rb) { 2500 ENTER_GL(); 2847 2501 GL_EXTCALL(glDeleteRenderbuffersEXT(1, &This->depth_blt_rb)); 2502 LEAVE_GL(); 2848 2503 This->depth_blt_rb = 0; 2849 2504 This->depth_blt_rb_w = 0; … … 7782 7437 * (e.g. a texture should release all held surfaces because telling the device that it's been released.) 7783 7438 *****************************************************/ 7784 static void IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3DResource *resource){ 7785 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; 7786 7787 TRACE("(%p) : Adding Resource %p\n", This, resource); 7439 void device_resource_add(IWineD3DDeviceImpl *This, IWineD3DResource *resource) 7440 { 7441 TRACE("(%p) : Adding resource %p\n", This, resource); 7442 7788 7443 list_add_head(&This->resources, &((IWineD3DResourceImpl *) resource)->resource.resource_list_entry); 7789 7444 } 7790 7445 7791 static void IWineD3DDeviceImpl_RemoveResource(IWineD3DDevice *iface, IWineD3DResource *resource){ 7792 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; 7793 7446 static void device_resource_remove(IWineD3DDeviceImpl *This, IWineD3DResource *resource) 7447 { 7794 7448 TRACE("(%p) : Removing resource %p\n", This, resource); 7795 7449 … … 7797 7451 } 7798 7452 7799 7800 static void WINAPI IWineD3DDeviceImpl_ResourceReleased(IWineD3DDevice *iface, IWineD3DResource *resource){ 7801 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; 7453 void device_resource_released(IWineD3DDeviceImpl *This, IWineD3DResource *resource) 7454 { 7802 7455 WINED3DRESOURCETYPE type = IWineD3DResource_GetType(resource); 7803 7456 int counter; … … 7805 7458 TRACE("(%p) : resource %p\n", This, resource); 7806 7459 7807 context_resource_released( iface, resource, type);7460 context_resource_released((IWineD3DDevice *)This, resource, type); 7808 7461 7809 7462 switch (type) { … … 7920 7573 7921 7574 /* Remove the resource from the resourceStore */ 7922 IWineD3DDeviceImpl_RemoveResource(iface, resource);7575 device_resource_remove(This, resource); 7923 7576 7924 7577 TRACE("Resource released\n"); … … 8092 7745 IWineD3DDeviceImpl_GetFrontBufferData, 8093 7746 /*** object tracking ***/ 8094 IWineD3DDeviceImpl_ResourceReleased,8095 7747 IWineD3DDeviceImpl_EnumResources 8096 7748 };
Note:
See TracChangeset
for help on using the changeset viewer.