@@ -417,29 +417,31 @@ u32 ShaderSource::getShaderId(const std::string &name)
417
417
if (get_current_thread_id () == m_main_thread){
418
418
return getShaderIdDirect (name);
419
419
} else {
420
- infostream <<" getShaderId(): Queued: name=\" " <<name<<" \" " <<std::endl;
420
+ /* errorstream <<"getShaderId(): Queued: name=\""<<name<<"\""<<std::endl;*/
421
421
422
422
// We're gonna ask the result to be put into here
423
- ResultQueue<std::string, u32, u8, u8> result_queue;
423
+
424
+ static ResultQueue<std::string, u32, u8, u8> result_queue;
424
425
425
426
// Throw a request in
426
427
m_get_shader_queue.add (name, 0 , 0 , &result_queue);
427
428
428
- infostream<<" Waiting for shader from main thread, name=\" "
429
- <<name<<" \" " <<std::endl;
429
+ /* infostream<<"Waiting for shader from main thread, name=\""
430
+ <<name<<"\""<<std::endl;*/
430
431
431
432
try {
432
- // Wait result for a second
433
- GetResult<std::string, u32, u8, u8>
433
+ while (true ) {
434
+ // Wait result for a second
435
+ GetResult<std::string, u32, u8, u8>
434
436
result = result_queue.pop_front (1000 );
435
437
436
- // Check that at least something worked OK
437
- assert ( result.key == name) ;
438
-
439
- return result. item ;
438
+ if (result. key == name) {
439
+ return result.item ;
440
+ }
441
+ }
440
442
}
441
443
catch (ItemNotFoundException &e){
442
- infostream <<" Waiting for shader timed out." <<std::endl;
444
+ errorstream <<" Waiting for shader " << name << " timed out." <<std::endl;
443
445
return 0 ;
444
446
}
445
447
}
@@ -541,10 +543,10 @@ void ShaderSource::processQueue()
541
543
GetRequest<std::string, u32, u8, u8>
542
544
request = m_get_shader_queue.pop ();
543
545
544
- /* infostream <<"ShaderSource::processQueue(): "
546
+ /* *errorstream <<"ShaderSource::processQueue(): "
545
547
<<"got shader request with "
546
548
<<"name=\""<<request.key<<"\""
547
- <<std::endl;*/
549
+ <<std::endl;** /
548
550
549
551
m_get_shader_queue.pushResult (request,getShaderIdDirect (request.key ));
550
552
}
@@ -594,7 +596,7 @@ void ShaderSource::onSetConstants(video::IMaterialRendererServices *services,
594
596
setter->onSetConstants (services, is_highlevel);
595
597
}
596
598
}
597
-
599
+
598
600
ShaderInfo generate_shader (std::string name, IrrlichtDevice *device,
599
601
video::IShaderConstantSetCallBack *callback,
600
602
SourceShaderCache *sourcecache)
0 commit comments