Changeset 25949 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/query.c
- Timestamp:
- Jan 21, 2010 9:26:23 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/query.c
r23571 r25949 4 4 * Copyright 2005 Oliver Stieber 5 5 * Copyright 2007-2008 Stefan Dösinger for CodeWeavers 6 * Copyright 2009 Henri Verbeet for CodeWeavers. 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 39 40 40 41 WINE_DEFAULT_DEBUG_CHANNEL(d3d); 41 #define GLINFO_LOCATION This-> wineD3DDevice->adapter->gl_info42 #define GLINFO_LOCATION This->device->adapter->gl_info 42 43 43 44 /* ******************************************* … … 97 98 IWineD3DQuery IWineD3DQuery parts follow 98 99 ******************************************* */ 99 static HRESULT WINAPI IWineD3DQueryImpl_GetParent(IWineD3DQuery *iface, IUnknown** parent){ 100 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface; 101 102 *parent= (IUnknown*) parent; 100 static HRESULT WINAPI IWineD3DQueryImpl_GetParent(IWineD3DQuery *iface, IUnknown **parent) 101 { 102 TRACE("iface %p, parent %p.\n", iface, parent); 103 104 *parent = (IUnknown *)parent; 103 105 IUnknown_AddRef(*parent); 104 TRACE("(%p) : returning %p\n", This, *parent); 106 107 TRACE("Returning %p.\n", *parent); 108 105 109 return WINED3D_OK; 106 110 } 107 108 static HRESULT WINAPI IWineD3DQueryImpl_GetDevice(IWineD3DQuery* iface, IWineD3DDevice **pDevice){109 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;110 IWineD3DDevice_AddRef((IWineD3DDevice *)This->wineD3DDevice);111 *pDevice = (IWineD3DDevice *)This->wineD3DDevice;112 TRACE("(%p) returning %p\n", This, *pDevice);113 return WINED3D_OK;114 }115 116 111 117 112 static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags){ … … 280 275 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface; 281 276 struct wined3d_occlusion_query *query = This->extendedData; 277 IWineD3DDeviceImpl *device = This->device; 278 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; 279 struct wined3d_context *context; 282 280 DWORD* data = pData; 283 281 GLuint available; … … 304 302 } 305 303 306 if (! GL_SUPPORT(ARB_OCCLUSION_QUERY))304 if (!gl_info->supported[ARB_OCCLUSION_QUERY]) 307 305 { 308 306 WARN("(%p) : Occlusion queries not supported. Returning 1.\n", This); … … 318 316 } 319 317 320 ActivateContext(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);318 context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD); 321 319 322 320 ENTER_GL(); … … 344 342 LEAVE_GL(); 345 343 344 context_release(context); 345 346 346 return res; 347 347 } … … 350 350 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface; 351 351 struct wined3d_event_query *query = This->extendedData; 352 BOOL* data = pData; 352 struct wined3d_context *context; 353 BOOL *data = pData; 353 354 354 355 TRACE("(%p) : type D3DQUERY_EVENT, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags); … … 358 359 if (!query->context) 359 360 { 360 ERR("Query not started, returning TRUE.\n");361 TRACE("Query not started, returning TRUE.\n"); 361 362 *data = TRUE; 362 363 … … 373 374 } 374 375 375 ActivateContext(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);376 context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD); 376 377 377 378 ENTER_GL(); 378 379 379 if ( GL_SUPPORT(APPLE_FENCE))380 if (context->gl_info->supported[APPLE_FENCE]) 380 381 { 381 382 *data = GL_EXTCALL(glTestFenceAPPLE(query->id)); 382 383 checkGLcall("glTestFenceAPPLE"); 383 384 } 384 else if ( GL_SUPPORT(NV_FENCE))385 else if (context->gl_info->supported[NV_FENCE]) 385 386 { 386 387 *data = GL_EXTCALL(glTestFenceNV(query->id)); … … 394 395 395 396 LEAVE_GL(); 397 398 context_release(context); 396 399 397 400 return S_OK; … … 481 484 { 482 485 context_free_event_query(query); 483 context = ActivateContext(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);486 context = context_acquire(This->device, NULL, CTXUSAGE_RESOURCELOAD); 484 487 context_alloc_event_query(context, query); 485 488 } 486 489 else 487 490 { 488 ActivateContext(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);491 context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD); 489 492 } 490 493 } 491 494 else 492 495 { 493 context = ActivateContext(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);496 context = context_acquire(This->device, NULL, CTXUSAGE_RESOURCELOAD); 494 497 context_alloc_event_query(context, query); 495 498 } … … 497 500 ENTER_GL(); 498 501 499 if ( GL_SUPPORT(APPLE_FENCE))502 if (context->gl_info->supported[APPLE_FENCE]) 500 503 { 501 504 GL_EXTCALL(glSetFenceAPPLE(query->id)); 502 505 checkGLcall("glSetFenceAPPLE"); 503 506 } 504 else if ( GL_SUPPORT(NV_FENCE))507 else if (context->gl_info->supported[NV_FENCE]) 505 508 { 506 509 GL_EXTCALL(glSetFenceNV(query->id, GL_ALL_COMPLETED_NV)); … … 509 512 510 513 LEAVE_GL(); 514 515 context_release(context); 511 516 } 512 517 else if(dwIssueFlags & WINED3DISSUE_BEGIN) … … 527 532 static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) { 528 533 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface; 529 530 if (GL_SUPPORT(ARB_OCCLUSION_QUERY)) 534 IWineD3DDeviceImpl *device = This->device; 535 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; 536 537 if (gl_info->supported[ARB_OCCLUSION_QUERY]) 531 538 { 532 539 struct wined3d_occlusion_query *query = This->extendedData; … … 543 550 544 551 context_free_occlusion_query(query); 545 context = ActivateContext(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);552 context = context_acquire(This->device, NULL, CTXUSAGE_RESOURCELOAD); 546 553 context_alloc_occlusion_query(context, query); 547 554 } 548 555 else 549 556 { 550 ActivateContext(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);557 context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD); 551 558 552 559 ENTER_GL(); … … 559 566 { 560 567 if (query->context) context_free_occlusion_query(query); 561 context = ActivateContext(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);568 context = context_acquire(This->device, NULL, CTXUSAGE_RESOURCELOAD); 562 569 context_alloc_occlusion_query(context, query); 563 570 } … … 567 574 checkGLcall("glBeginQuery()"); 568 575 LEAVE_GL(); 576 577 context_release(context); 569 578 } 570 579 if (dwIssueFlags & WINED3DISSUE_END) { … … 581 590 else 582 591 { 583 ActivateContext(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);592 context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD); 584 593 585 594 ENTER_GL(); … … 587 596 checkGLcall("glEndQuery()"); 588 597 LEAVE_GL(); 598 599 context_release(context); 589 600 } 590 601 } … … 632 643 /*** IWineD3Dquery methods ***/ 633 644 IWineD3DQueryImpl_GetParent, 634 IWineD3DQueryImpl_GetDevice,635 645 IWineD3DQueryImpl_GetData, 636 646 IWineD3DQueryImpl_GetDataSize, … … 647 657 /*** IWineD3Dquery methods ***/ 648 658 IWineD3DQueryImpl_GetParent, 649 IWineD3DQueryImpl_GetDevice,650 659 IWineD3DEventQueryImpl_GetData, 651 660 IWineD3DEventQueryImpl_GetDataSize, … … 662 671 /*** IWineD3Dquery methods ***/ 663 672 IWineD3DQueryImpl_GetParent, 664 IWineD3DQueryImpl_GetDevice,665 673 IWineD3DOcclusionQueryImpl_GetData, 666 674 IWineD3DOcclusionQueryImpl_GetDataSize,
Note:
See TracChangeset
for help on using the changeset viewer.