Ignore:
Timestamp:
05/13/05 15:14:12 (19 years ago)
Author:
mattausch
Message:

ogre: changed from occlusion_query_nv to occlusion_query_arb (in ogre_changes)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/work/ogre_changes/RenderSystems/Direct3D9/src/OgreD3D9HardwareOcclusionQuery.cpp

    r88 r97  
    7171} 
    7272 
     73#ifndef GTP_VISIBILITY_MODIFIED_OGRE 
    7374//------------------------------------------------------------------ 
    7475// Occlusion query functions (see base class documentation for this) 
     
    7879        if( m_bHWOcclusionSupport )             // Make it fail silently if hardware occlusion isn't supported 
    7980        { 
    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         
    8490void D3D9HardwareOcclusionQuery::endOcclusionQuery()  
    8591{  
    8692        if( m_bHWOcclusionSupport )     // Make it fail silently if hardware occlusion isn't supported 
    8793        { 
    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  
    8999        } 
    90100} 
     
    95105// Note: OpenGL dosn't use this flag at all so the application running OpenGL won't display any different behaviour. 
    96106//-- 
    97 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult )  
    98 { 
    99         return pullOcclusionQuery(NumOfFragments, waitForResult, HWOCCLUSIONQUERY_FLUSH); 
     107bool 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        } 
    100130} 
    101131 
     
    106136// Note: OpenGL dosn't use this flag at all so the application running OpenGL won't display any different behaviour. 
    107137//-- 
     138bool 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//------------------------------------------------------------------ 
     178void 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//------------------------------------------------------------------ 
     186void 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//------------------------------------------------------------------ 
     194bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult )  
     195{ 
     196        return pullOcclusionQuery(NumOfFragments, waitForResult, HWOCCLUSIONQUERY_FLUSH); 
     197} 
     198 
     199//------------------------------------------------------------------ 
    108200bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult,  
    109201                                                                                                     const HW_OCCLUSIONQUERY flag  )  
     
    114206        return pullOcclusionQuery(NumOfFragments, waitForResult, queryFlag); 
    115207} 
     208 
    116209//------------------------------------------------------------------ 
    117210bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult,  
     
    137230        return hr == S_OK; 
    138231} 
     232 
     233 
     234#endif // GTP_VISIBILITY_MODIFIED_OGRE 
     235 
    139236} // namespace OGre 
Note: See TracChangeset for help on using the changeset viewer.