| | 350 | |
| | 351 | |
| | 352 | //---------------------------------------------------------------------------- |
| | 353 | |
| | 354 | |
| | 355 | #if 0 |
| | 356 | GLuint gr_querySamples() |
| | 357 | { |
| | 358 | GLuint sampleCount; |
| | 359 | //const GLuint id = 1; |
| | 360 | int id; |
| | 361 | int endId = 1 + 1; |
| | 362 | |
| | 363 | #if 0 |
| | 364 | // 32 bits on GeForce 6600 GT |
| | 365 | GLint bits; |
| | 366 | glGetQueryiv( GL_SAMPLES_PASSED, GL_QUERY_COUNTER_BITS, &bits ); |
| | 367 | printf( "KR GL_QUERY_COUNTER_BITS = %d\n", bits ); |
| | 368 | #endif |
| | 369 | |
| | 370 | glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); |
| | 371 | glDepthMask( GL_FALSE ); |
| | 372 | |
| | 373 | for( id = 1; id < endId; ++id ) |
| | 374 | { |
| | 375 | glBeginQuery( GL_SAMPLES_PASSED, id ); |
| | 376 | |
| | 377 | // Draw... |
| | 378 | |
| | 379 | glEndQuery( GL_SAMPLES_PASSED ); |
| | 380 | } |
| | 381 | |
| | 382 | //glFlush(); |
| | 383 | |
| | 384 | glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); |
| | 385 | glDepthMask( GL_TRUE ); |
| | 386 | |
| | 387 | for( id = 1; id < endId; ++id ) |
| | 388 | { |
| | 389 | glGetQueryObjectuiv( id, GL_QUERY_RESULT, &sampleCount ); |
| | 390 | //printf( "KR GL_QUERY_RESULT = %d\n", sampleCount ); |
| | 391 | } |
| | 392 | |
| | 393 | return sampleCount; |
| | 394 | } |
| | 395 | #endif |
| | 1139 | case DOP_SAMPLES_QUERY: // dlist-block process-block |
| | 1140 | ++pc; |
| | 1141 | if( ! ur_is(pc, UT_BLOCK) ) |
| | 1142 | return 0; |
| | 1143 | |
| | 1144 | _state.samplesQueryId = 0; |
| | 1145 | |
| | 1146 | glEnable( GL_CULL_FACE ); |
| | 1147 | glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); |
| | 1148 | glDepthMask( GL_FALSE ); |
| | 1149 | |
| | 1150 | // Run draw-list containing samples-begin ops. |
| | 1151 | if( ! _runDrawList( ut, pc ) ) |
| | 1152 | return 0; |
| | 1153 | |
| | 1154 | if( _state.samplesQueryId ) |
| | 1155 | glEndQuery( GL_SAMPLES_PASSED ); |
| | 1156 | |
| | 1157 | glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); |
| | 1158 | glDepthMask( GL_TRUE ); |
| | 1159 | |
| | 1160 | ++pc; |
| | 1161 | if( ur_is(pc, UT_BLOCK) ) |
| | 1162 | { |
| | 1163 | GLuint samples; |
| | 1164 | GLuint id; |
| | 1165 | //UBinary* bin; |
| | 1166 | //UIndex binN; |
| | 1167 | |
| | 1168 | // Push query results on stack and call process-block. |
| | 1169 | |
| | 1170 | //bin = ur_binaryPtr( binN ); |
| | 1171 | |
| | 1172 | for( id = 1; id <= _state.samplesQueryId; ++id ) |
| | 1173 | { |
| | 1174 | glGetQueryObjectuiv( id, GL_QUERY_RESULT, &samples ); |
| | 1175 | //printf( "KR samples %d %d\n", id, samples ); |
| | 1176 | |
| | 1177 | UR_S_GROW; |
| | 1178 | ur_initType( UR_TOS, UT_INT ); |
| | 1179 | ur_int(UR_TOS) = samples; |
| | 1180 | } |
| | 1181 | |
| | 1182 | if( ur_eval( ut, pc->series.n, pc->series.it ) |
| | 1183 | != UR_EVAL_OK ) |
| | 1184 | return 0; |
| | 1185 | } |
| | 1186 | |
| | 1187 | _state.samplesQueryId = 0; |
| | 1188 | break; |
| | 1189 | |
| | 1190 | case DOP_SAMPLES_BEGIN: |
| | 1191 | if( _state.samplesQueryId ) |
| | 1192 | glEndQuery( GL_SAMPLES_PASSED ); |
| | 1193 | |
| | 1194 | ++_state.samplesQueryId; |
| | 1195 | glBeginQuery( GL_SAMPLES_PASSED, _state.samplesQueryId ); |
| | 1196 | break; |
| | 1197 | |