VirtualBox

Ignore:
Timestamp:
Jun 16, 2009 9:20:54 AM (16 years ago)
Author:
vboxsync
Message:

crOpenGL: update wine to 1.1.23

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c

    r19678 r20612  
    6161};
    6262
    63 /* static function declarations */
    64 static void IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3DResource *resource);
    65 
    6663/**********************************************************
    6764 * Global variable / Constants follow
     
    450447{
    451448    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     449    const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(WINED3DFMT_UNKNOWN, &This->adapter->gl_info);
    452450    struct wined3d_buffer *object;
    453451    HRESULT hr;
     
    467465    FIXME("Ignoring access flags (pool)\n");
    468466
    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);
    471469    if (FAILED(hr))
    472470    {
     
    478476
    479477    TRACE("Created resource %p\n", object);
    480 
    481     IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);
    482478
    483479    TRACE("size %#x, usage=%#x, format %s, memory @ %p, iface @ %p\n", object->resource.size, object->resource.usage,
     
    545541
    546542    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);
    548544    if (FAILED(hr))
    549545    {
     
    556552
    557553    TRACE("(%p) : Created resource %p\n", This, object);
    558 
    559     IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);
    560554
    561555    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);
     
    612606
    613607    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);
    615609    if (FAILED(hr))
    616610    {
     
    623617
    624618    TRACE("(%p) : Created resource %p\n", This, object);
    625 
    626     IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);
    627619
    628620    if(Pool != WINED3DPOOL_SYSTEMMEM && !(Usage & WINED3DUSAGE_DYNAMIC) && GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT)) {
     
    988980    }
    989981
    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);
    991983    if (FAILED(hr))
    992984    {
     
    998990
    999991    TRACE("(%p) : Created resource %p\n", This, object);
    1000 
    1001     IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);
    1002992
    1003993    *ppSurface = (IWineD3DSurface *)object;
     
    11031093{
    11041094    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
    1105     const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapter->gl_info);
    11061095    IWineD3DTextureImpl *object;
    1107     unsigned int i;
    1108     UINT tmpW;
    1109     UINT tmpH;
    11101096    HRESULT hr;
    1111     unsigned int pow2Width;
    1112     unsigned int pow2Height;
    11131097
    11141098    TRACE("(%p) : Width %d, Height %d, Levels %d, Usage %#x\n", This, Width, Height, Levels, Usage);
    11151099    TRACE("Format %#x (%s), Pool %#x, ppTexture %p, parent %p\n",
    11161100            Format, debug_d3dformat(Format), Pool, ppTexture, parent);
    1117 
    1118     /* TODO: It should only be possible to create textures for formats
    1119              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     else
    1132     {
    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     }
    11711101
    11721102    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     
    11791109
    11801110    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);
    11821113    if (FAILED(hr))
    11831114    {
    1184         WARN("Failed to initialize resource, returning %#x\n", hr);
     1115        WARN("Failed to initialize texture, returning %#x\n", hr);
    11851116        HeapFree(GetProcessHeap(), 0, object);
    11861117        *ppTexture = NULL;
     
    11881119    }
    11891120
    1190     TRACE("(%p) : Created resource %p\n", This, object);
    1191 
    1192     IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);
    1193 
    11941121    *ppTexture = (IWineD3DTexture *)object;
    11951122
    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
    12811125    return WINED3D_OK;
    12821126}
     
    12871131{
    12881132    IWineD3DDeviceImpl        *This = (IWineD3DDeviceImpl *)iface;
    1289     const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapter->gl_info);
    12901133    IWineD3DVolumeTextureImpl *object;
    1291     unsigned int               i;
    1292     UINT                       tmpW;
    1293     UINT                       tmpH;
    1294     UINT                       tmpD;
    12951134    HRESULT hr;
    12961135
    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));
    13301138
    13311139    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     
    13381146
    13391147    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);
    13411149    if (FAILED(hr))
    13421150    {
    1343         WARN("Failed to initialize resource, returning %#x\n", hr);
     1151        WARN("Failed to initialize volumetexture, returning %#x\n", hr);
    13441152        HeapFree(GetProcessHeap(), 0, object);
    13451153        *ppVolumeTexture = NULL;
     
    13471155    }
    13481156
    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
    14031160    return WINED3D_OK;
    14041161}
     
    14271184
    14281185    object->lpVtbl = &IWineD3DVolume_Vtbl;
    1429     hr = resource_init(&object->resource, WINED3DRTYPE_VOLUME, This,
     1186    hr = resource_init((IWineD3DResource *)object, WINED3DRTYPE_VOLUME, This,
    14301187            Width * Height * Depth * format_desc->byte_count, Usage, format_desc, Pool, parent);
    14311188    if (FAILED(hr))
     
    14391196    TRACE("(%p) : Created resource %p\n", This, object);
    14401197
    1441     IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);
    1442 
    14431198    *ppVolume = (IWineD3DVolume *)object;
    14441199
     
    14661221{
    14671222    IWineD3DDeviceImpl      *This = (IWineD3DDeviceImpl *)iface;
    1468     const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapter->gl_info);
    14691223    IWineD3DCubeTextureImpl *object; /** NOTE: impl ref allowed since this is a create function **/
    1470     unsigned int             i, j;
    1471     UINT                     tmpW;
    14721224    HRESULT                  hr;
    1473     unsigned int pow2EdgeLength;
    1474 
    1475     /* TODO: It should only be possible to create textures for formats
    1476              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     }
    15091225
    15101226    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     
    15171233
    15181234    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);
    15201236    if (FAILED(hr))
    15211237    {
    1522         WARN("Failed to initialize resource, returning %#x\n", hr);
     1238        WARN("Failed to initialize cubetexture, returning %#x\n", hr);
    15231239        HeapFree(GetProcessHeap(), 0, object);
    15241240        *ppCubeTexture = NULL;
     
    15261242    }
    15271243
    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_ARB
    1577             };
    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 
    15961244    TRACE("(%p) : Created Cube Texture %p\n", This, object);
    1597     *ppCubeTexture = (IWineD3DCubeTexture *) object;
     1245    *ppCubeTexture = (IWineD3DCubeTexture *)object;
     1246
    15981247    return WINED3D_OK;
    15991248}
     
    23371986}
    23381987
    2339 static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, IWineD3DVertexDeclaration *vertex_declaration, CONST DWORD *pFunction, IWineD3DVertexShader **ppVertexShader, IUnknown *parent) {
     1988static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface,
     1989        const DWORD *pFunction, const struct wined3d_shader_signature *output_signature,
     1990        IWineD3DVertexShader **ppVertexShader, IUnknown *parent)
     1991{
    23401992    IWineD3DDeviceImpl       *This = (IWineD3DDeviceImpl *)iface;
    23411993    IWineD3DVertexShaderImpl *object;  /* NOTE: impl usage is ok, this is a create */
     
    23602012    TRACE("(%p) : Created vertex shader %p\n", This, *ppVertexShader);
    23612013
    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);
    23672015    if (FAILED(hr))
    23682016    {
     
    23762024}
    23772025
    2378 static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface, CONST DWORD *pFunction, IWineD3DPixelShader **ppPixelShader, IUnknown *parent) {
     2026static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface,
     2027        const DWORD *pFunction, const struct wined3d_shader_signature *output_signature,
     2028        IWineD3DPixelShader **ppPixelShader, IUnknown *parent)
     2029{
    23792030    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
    23802031    IWineD3DPixelShaderImpl *object; /* NOTE: impl allowed, this is a create */
     
    23992050    TRACE("(%p) : Created pixel shader %p\n", This, *ppPixelShader);
    24002051
    2401     hr = IWineD3DPixelShader_SetFunction(*ppPixelShader, pFunction);
     2052    hr = IWineD3DPixelShader_SetFunction(*ppPixelShader, pFunction, output_signature);
    24022053    if (FAILED(hr))
    24032054    {
     
    28412492     */
    28422493    if(This->depth_blt_texture) {
     2494        ENTER_GL();
    28432495        glDeleteTextures(1, &This->depth_blt_texture);
     2496        LEAVE_GL();
    28442497        This->depth_blt_texture = 0;
    28452498    }
    28462499    if (This->depth_blt_rb) {
     2500        ENTER_GL();
    28472501        GL_EXTCALL(glDeleteRenderbuffersEXT(1, &This->depth_blt_rb));
     2502        LEAVE_GL();
    28482503        This->depth_blt_rb = 0;
    28492504        This->depth_blt_rb_w = 0;
     
    77827437* (e.g. a texture should release all held surfaces because telling the device that it's been released.)
    77837438 *****************************************************/
    7784 static void IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3DResource *resource){
    7785     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
    7786 
    7787     TRACE("(%p) : Adding Resource %p\n", This, resource);
     7439void device_resource_add(IWineD3DDeviceImpl *This, IWineD3DResource *resource)
     7440{
     7441    TRACE("(%p) : Adding resource %p\n", This, resource);
     7442
    77887443    list_add_head(&This->resources, &((IWineD3DResourceImpl *) resource)->resource.resource_list_entry);
    77897444}
    77907445
    7791 static void IWineD3DDeviceImpl_RemoveResource(IWineD3DDevice *iface, IWineD3DResource *resource){
    7792     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
    7793 
     7446static void device_resource_remove(IWineD3DDeviceImpl *This, IWineD3DResource *resource)
     7447{
    77947448    TRACE("(%p) : Removing resource %p\n", This, resource);
    77957449
     
    77977451}
    77987452
    7799 
    7800 static void WINAPI IWineD3DDeviceImpl_ResourceReleased(IWineD3DDevice *iface, IWineD3DResource *resource){
    7801     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
     7453void device_resource_released(IWineD3DDeviceImpl *This, IWineD3DResource *resource)
     7454{
    78027455    WINED3DRESOURCETYPE type = IWineD3DResource_GetType(resource);
    78037456    int counter;
     
    78057458    TRACE("(%p) : resource %p\n", This, resource);
    78067459
    7807     context_resource_released(iface, resource, type);
     7460    context_resource_released((IWineD3DDevice *)This, resource, type);
    78087461
    78097462    switch (type) {
     
    79207573
    79217574    /* Remove the resource from the resourceStore */
    7922     IWineD3DDeviceImpl_RemoveResource(iface, resource);
     7575    device_resource_remove(This, resource);
    79237576
    79247577    TRACE("Resource released\n");
     
    80927745    IWineD3DDeviceImpl_GetFrontBufferData,
    80937746    /*** object tracking ***/
    8094     IWineD3DDeviceImpl_ResourceReleased,
    80957747    IWineD3DDeviceImpl_EnumResources
    80967748};
Note: See TracChangeset for help on using the changeset viewer.

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