Browse Source

[DX11] Allow to recover when shader from the shadercache fails to compile

TothBenoit 1 year ago
parent
commit
d4ce5f1070
1 changed files with 7 additions and 3 deletions
  1. 7 3
      h3d/impl/DirectXDriver.hx

+ 7 - 3
h3d/impl/DirectXDriver.hx

@@ -839,9 +839,13 @@ class DirectXDriver extends h3d.impl.Driver {
 		if( shaderCache != null ) {
 			var bytes = shaderCache.resolveShaderBinary(code, shaderVersion);
 			if( bytes != null ) {
-				var sh = vertex ? Driver.createVertexShader(bytes) : Driver.createPixelShader(bytes);
-				// shader can't be compiled !
-				if( sh == null )
+				try {
+					var sh = vertex ? Driver.createVertexShader(bytes) : Driver.createPixelShader(bytes);
+					// shader can't be compiled !
+					if( sh == null )
+						return null;
+				}
+				catch( d : Dynamic)
 					return null;
 				return bytes;
 			}