File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ impl PipelineCompiler {
143
143
& specialized_descriptor. shader_stages . vertex ,
144
144
& pipeline_specialization. shader_specialization ,
145
145
)
146
- . unwrap ( ) ;
146
+ . unwrap_or_else ( |e| panic_shader_error ( e ) ) ;
147
147
specialized_descriptor. shader_stages . vertex = specialized_vertex_shader. clone_weak ( ) ;
148
148
let mut specialized_fragment_shader = None ;
149
149
specialized_descriptor. shader_stages . fragment = specialized_descriptor
@@ -158,7 +158,7 @@ impl PipelineCompiler {
158
158
fragment,
159
159
& pipeline_specialization. shader_specialization ,
160
160
)
161
- . unwrap ( ) ;
161
+ . unwrap_or_else ( |e| panic_shader_error ( e ) ) ;
162
162
specialized_fragment_shader = Some ( shader. clone_weak ( ) ) ;
163
163
shader
164
164
} ) ;
@@ -356,3 +356,10 @@ impl PipelineCompiler {
356
356
Ok ( ( ) )
357
357
}
358
358
}
359
+
360
+ fn panic_shader_error ( error : ShaderError ) -> ! {
361
+ let msg = error. to_string ( ) ;
362
+ let msg = msg. trim_end ( ) . trim_end_matches ( "Debug log:" ) ; // if this matches, then there wasn't a debug log anyways
363
+ let msg = msg. trim_end ( ) ;
364
+ panic ! ( "{}\n " , msg) ;
365
+ }
Original file line number Diff line number Diff line change @@ -24,12 +24,12 @@ pub enum ShaderStage {
24
24
#[ derive( Error , Debug ) ]
25
25
pub enum ShaderError {
26
26
/// Shader compilation error.
27
- #[ error( "Shader compilation error: {0}" ) ]
27
+ #[ error( "Shader compilation error:\n {0}" ) ]
28
28
Compilation ( String ) ,
29
29
30
30
#[ cfg( any( target_os = "ios" , all( target_arch = "aarch64" , target_os = "macos" ) ) ) ]
31
31
/// shaderc error.
32
- #[ error( "shaderc error" ) ]
32
+ #[ error( "shaderc error: {} " ) ]
33
33
ShaderC ( #[ from] shaderc:: Error ) ,
34
34
35
35
#[ cfg( any( target_os = "ios" , all( target_arch = "aarch64" , target_os = "macos" ) ) ) ]
You can’t perform that action at this time.
0 commit comments