| 65 | } |
| 66 | |
| 67 | GFXOcclusionQuery::OcclusionQueryStatus GFXGLOcclusionQuery::getStatus(bool block, U32* data) |
| 68 | { |
| 69 | // If this ever shows up near the top of a profile |
| 70 | // then your system is GPU bound. |
| 71 | PROFILE_SCOPE(GFXGLOcclusionQuery_getStatus); |
| 72 | |
| 73 | if (GFXDevice::getDisableOcclusionQuery()) |
| 74 | return NotOccluded; |
| 75 | |
| 76 | if (!glIsQuery(mQuery)) |
| 77 | return NotOccluded; |
| 78 | |
| 79 | GLint numPixels = 0; |
| 80 | GLint queryDone = false; |
| 81 | |
| 82 | if (block) |
| 83 | { |
| 84 | while (!queryDone) |
| 85 | { |
| 86 | //If we're stalled out, proceed with worst-case scenario -BJR |
| 87 | if (GFX->mFrameTime->getElapsedMs()>4) |
| 88 | { |
| 89 | this->begin(); |
| 90 | this->end(); |
| 91 | return NotOccluded; |
| 92 | } |
| 93 | glGetQueryObjectiv(mQuery, GL_QUERY_RESULT_AVAILABLE, &queryDone); |
| 94 | } |
| 95 | } |
| 96 | else |
| 97 | { |
| 98 | glGetQueryObjectiv(mQuery, GL_QUERY_RESULT_AVAILABLE, &queryDone); |
| 99 | } |
| 100 | |
| 101 | if (queryDone) |
| 102 | glGetQueryObjectiv(mQuery, GL_QUERY_RESULT, &numPixels); |
| 103 | else |
| 104 | return Waiting; |
| 105 | |
| 106 | if (data) |
| 107 | *data = numPixels; |
| 108 | |
| 109 | return numPixels > 0 ? NotOccluded : Occluded; |
| 110 | } |
| 111 | |
| 112 | void GFXGLOcclusionQuery::zombify() |
| 113 | { |
nothing calls this directly
no test coverage detected