MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / getStatus

Method getStatus

Engine/source/gfx/gl/gfxGLOcclusionQuery.cpp:67–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67GFXOcclusionQuery::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
112void GFXGLOcclusionQuery::zombify()
113{

Callers

nothing calls this directly

Calls 3

beginMethod · 0.95
endMethod · 0.95
getElapsedMsMethod · 0.45

Tested by

no test coverage detected