Changeset 97 for trunk/VUT/work/ogre_changes/RenderSystems/Direct3D9
- Timestamp:
- 05/13/05 15:14:12 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/ogre_changes/RenderSystems/Direct3D9/src/OgreD3D9HardwareOcclusionQuery.cpp
r88 r97 71 71 } 72 72 73 #ifndef GTP_VISIBILITY_MODIFIED_OGRE 73 74 //------------------------------------------------------------------ 74 75 // Occlusion query functions (see base class documentation for this) … … 78 79 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 79 80 { 80 m_pD3DQuery->Issue(D3DISSUE_BEGIN); 81 } 82 } 83 //------------------------------------------------------------------ 81 if ( m_SkipCounter == m_Skip ) { m_SkipCounter = 0; }; // Counter starts at 0 again at m_Skip 82 83 if ( m_SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped 84 { 85 m_pD3DQuery->Issue(D3DISSUE_BEGIN); 86 } 87 } 88 } 89 84 90 void D3D9HardwareOcclusionQuery::endOcclusionQuery() 85 91 { 86 92 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 87 93 { 88 m_pD3DQuery->Issue(D3DISSUE_END); 94 if (m_SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped 95 { 96 m_pD3DQuery->Issue(D3DISSUE_END); 97 } 98 m_SkipCounter++; // The skip counter is increased 89 99 } 90 100 } … … 95 105 // Note: OpenGL dosn't use this flag at all so the application running OpenGL won't display any different behaviour. 96 106 //-- 97 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult ) 98 { 99 return pullOcclusionQuery(NumOfFragments, waitForResult, HWOCCLUSIONQUERY_FLUSH); 107 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments) 108 { 109 HRESULT hr; 110 111 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 112 { 113 hr = m_pD3DQuery->GetData( NumOfFragments, sizeof( NumOfFragments ), D3DGETDATA_FLUSH ); 114 115 if ( hr != S_OK ) 116 { 117 return false; 118 } 119 else 120 { 121 m_uintPixelCount = *NumOfFragments; 122 return true; 123 } 124 } 125 else 126 { 127 m_uintPixelCount = 100000; // Fails quitlly if hardware occlusion is not supported - every object is visable 128 return true; 129 } 100 130 } 101 131 … … 106 136 // Note: OpenGL dosn't use this flag at all so the application running OpenGL won't display any different behaviour. 107 137 //-- 138 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag ) 139 { 140 HRESULT hr; 141 142 // TO DO: USE lockOpts= D3D9Mappings::get(options); instead of RS_OCCLUSIONQUERY enum 143 144 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 145 { 146 147 switch( flag ) 148 { 149 case HWOCCLUSIONQUERY_FLUSH : 150 hr = m_pD3DQuery->GetData( NumOfFragments, sizeof( NumOfFragments ), D3DGETDATA_FLUSH ); 151 break; 152 153 case HWOCCLUSIONQUERY_NOFLUSH : 154 hr = m_pD3DQuery->GetData( NumOfFragments, sizeof( NumOfFragments ), 0 ); 155 break; 156 }; 157 158 159 160 if ( hr != S_OK ) 161 { 162 return false; 163 } 164 else 165 { 166 m_uintPixelCount = *NumOfFragments; 167 return true; 168 } 169 } 170 else 171 { 172 m_uintPixelCount = 100000; // Fails quitlly if hardware occlusion is not supported - every object is visable 173 return true; 174 } 175 } 176 #else // GTP_VISIBILITY_MODIFIED_OGRE 177 //------------------------------------------------------------------ 178 void D3D9HardwareOcclusionQuery::beginOcclusionQuery() 179 { 180 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 181 { 182 m_pD3DQuery->Issue(D3DISSUE_BEGIN); 183 } 184 } 185 //------------------------------------------------------------------ 186 void D3D9HardwareOcclusionQuery::endOcclusionQuery() 187 { 188 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 189 { 190 m_pD3DQuery->Issue(D3DISSUE_END); 191 } 192 } 193 //------------------------------------------------------------------ 194 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult ) 195 { 196 return pullOcclusionQuery(NumOfFragments, waitForResult, HWOCCLUSIONQUERY_FLUSH); 197 } 198 199 //------------------------------------------------------------------ 108 200 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, 109 201 const HW_OCCLUSIONQUERY flag ) … … 114 206 return pullOcclusionQuery(NumOfFragments, waitForResult, queryFlag); 115 207 } 208 116 209 //------------------------------------------------------------------ 117 210 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, … … 137 230 return hr == S_OK; 138 231 } 232 233 234 #endif // GTP_VISIBILITY_MODIFIED_OGRE 235 139 236 } // namespace OGre
Note: See TracChangeset
for help on using the changeset viewer.