Changeset 405 for branches/thune
- Timestamp:
- 06/02/07 06:45:33 (18 months ago)
- Location:
- branches/thune/thread_safe
- Files:
-
- 7 modified
-
gl/boot.c (modified) (2 diffs)
-
gl/draw_list.c (modified) (6 diffs)
-
gl/draw_ops.h (modified) (1 diff)
-
gl/gx.h (modified) (1 diff)
-
gl/gx.t (modified) (1 diff)
-
gl/scripts/view.t (modified) (8 diffs)
-
urlan.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/thune/thread_safe/gl/boot.c
r403 r405 100 100 " shadow-begin\n" 101 101 " shadow-end\n" 102 " samples-query\n" 103 " samples-begin\n" 102 104 "]\n" 103 105 "make-opcodes :draw-list-opcodes\n" … … 149 151 "] func :load.tex.clamp\n" 150 152 "#[\n" 151 " 1.0 0.0 0.0 0.0 \n"152 " 0.0 1.0 0.0 0.0 \n"153 " 0.0 0.0 1.0 0.0 \n"154 " 0.0 0.0 0.0 1.0 \n"153 " 1.0 0.0 0.0 0.0 \n" 154 " 0.0 1.0 0.0 0.0 \n" 155 " 0.0 0.0 1.0 0.0 \n" 156 " 0.0 0.0 0.0 1.0 \n" 155 157 "] :unit-matrix\n" 156 158 "[\n" -
branches/thune/thread_safe/gl/draw_list.c
r403 r405 75 75 _state.attr[0].vals = 0; 76 76 _state.attr[1].vals = 0; 77 _state.samplesQueryId = 0; 77 78 } 78 79 … … 132 133 { 133 134 glDepthMask( GL_FALSE ); 135 136 //glEnable( GL_DEPTH_TEST ); 134 137 135 138 glDisable( GL_ALPHA_TEST ); … … 345 348 } 346 349 } 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 347 396 348 397 … … 792 841 { 793 842 case DOP_NOP: 843 //printf( "KR DL NOP\n" ); 794 844 break; 795 845 … … 858 908 case UR_ATOM_SPRITE: 859 909 gr_setState( GRS_PARTICLE ); 860 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); 910 //glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); 911 //glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ); 912 glBlendFunc( GL_SRC_ALPHA, GL_ONE ); 861 913 glEnable( GL_POINT_SPRITE ); 862 914 break; … … 1085 1137 break; 1086 1138 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 1087 1198 default: 1088 1199 assert( 0 && "Invalid Draw List Opcode" ); -
branches/thune/thread_safe/gl/draw_ops.h
r383 r405 37 37 #define DOP_SHADOW_BEGIN 34 38 38 #define DOP_SHADOW_END 35 39 #define DOP_SAMPLES_QUERY 36 40 #define DOP_SAMPLES_BEGIN 37 -
branches/thune/thread_safe/gl/gx.h
r390 r405 144 144 145 145 GrVertexAttribute attr[2]; 146 GLuint samplesQueryId; 146 147 }; 147 148 -
branches/thune/thread_safe/gl/gx.t
r403 r405 165 165 shadow-begin 166 166 shadow-end 167 168 samples-query 169 samples-begin 167 170 ] 168 171 make-opcodes :draw-list-opcodes -
branches/thune/thread_safe/gl/scripts/view.t
r403 r405 6 6 10,0,10 :bg-color 7 7 ;off key-repeat 8 0.0,0 :win-size 9 10 "shader/matte.gx" load.shader :matte 8 11 9 12 "scripts/stars.t" load do 400 make-stars :star-dl … … 19 22 "image/star.png" load.tex :bstar-sh/cmap 20 23 24 "shader/ship-lights.gx" load.shader :rlight-shader 25 "image/lightFlareA.png" load.tex :rlight-shader/cmap 21 26 22 27 /* … … 70 75 model-list :d7-dl 71 76 model-shader :d7-shader 77 78 "model/d7_lights.gx" load do 72 79 ] :d7 73 80 … … 83 90 84 91 1024,1024 dup :smap-size shadowmap :light-fb 85 "shader/matte.gx" load.shader :smap-shader86 92 camera [ 87 93 ;'ortho … … 109 115 110 116 d7 do light-fb/texture :d7-shader/smap 111 ent do light-fb/texture :ent-shader/smap117 ;ent do light-fb/texture :ent-shader/smap 112 118 113 119 … … 177 183 dup :view-cam/viewport 178 184 185 /* 186 area/3 :win-size/x 187 area/4 :win-size/y 188 win-size :rlight-shader/windowsize 189 */ 179 190 ;vec3! [area/3 area/4] reduce make :star-sh/windowsize 180 191 ] … … 196 207 camera light-cam 197 208 shadow-begin light-fb 198 shader smap-shader209 shader matte 199 210 call model-list 200 211 camera view-cam … … 226 237 shader model-shader 227 238 call model-list 228 shader none 229 239 ;shader none 240 241 /* 242 */ 243 shader matte 244 call d7-lights-query 245 particle/sprite 246 shader rlight-shader call d7-lights 247 particle/off 230 248 231 249 ;ortho-cam -
branches/thune/thread_safe/urlan.h
r403 r405 600 600 601 601 UIndex ur_hold( UThread*, int type, UIndex which ); 602 UIndex ur_holdIndex( UThread*, UIndex );603 602 void ur_release( UThread*, UIndex ); 604 603
