@@ -107,13 +107,10 @@ export class ServerVersion {
107107 this . path = ServerVersion . getPlatformBinaryUri ( extensionUri , null , this . platform ) ;
108108 this . cwd = ServerVersion . getPlatformBinaryDirectoryPath ( extensionUri , null , this . platform ) ;
109109 }
110- }
111- update ( ) {
112-
113110 }
114111 private static getUserServerPathAndVersion ( platform : ServerPlatform ) : [ string , string ] | null {
115- if ( isRunningOnWeb ( ) ) {
116- return null ;
112+ if ( platform === ServerPlatform . wasi ) {
113+ return null ; // Bundled wasi version
117114 } else {
118115 // Check configuration.
119116 let serverPath = vscode . workspace . getConfiguration ( "shader-validator" ) . get < string > ( "serverPath" ) ;
@@ -201,10 +198,14 @@ export class ServerVersion {
201198 return vscode . Uri . joinPath ( ServerVersion . getPlatformBinaryDirectoryPath ( extensionUri , serverPath , platform ) , ServerVersion . getPlatformBinaryName ( serverPath , platform ) ) ;
202199 }
203200 static getServerPlatform ( ) : ServerPlatform {
204- if ( isRunningOnWeb ( ) ) {
201+ let useWasiServer = vscode . workspace . getConfiguration ( "shader-validator" ) . get < boolean > ( "useWasiServer" ) ! ;
202+ if ( isRunningOnWeb ( ) || useWasiServer ) {
205203 return ServerPlatform . wasi ;
206204 } else {
207205 // Dxc only built for linux x64 & windows x64. Fallback to WASI for every other situations.
206+ // TODO: ARM DLL available aswell, need to bundle them, along with correct version of server.
207+ // Should have an extension version per platform.
208+ // Could have a setting for user provided DLL path aswell, but useless if server does not match the platform.
208209 switch ( process . platform ) {
209210 case "win32" :
210211 return ( process . arch === 'x64' ) ? ServerPlatform . windows : ServerPlatform . wasi ;
@@ -280,7 +281,7 @@ export class ShaderLanguageClient {
280281 this . statusChangedCallback = statusChangedCallback ;
281282 }
282283
283- async start ( context : vscode . ExtensionContext ) : Promise < ServerStatus > {
284+ async start ( context : vscode . ExtensionContext , updateServerUsed : boolean ) : Promise < ServerStatus > {
284285 if ( this . serverStatus === ServerStatus . running ) {
285286 return ServerStatus . running ;
286287 }
@@ -296,20 +297,25 @@ export class ShaderLanguageClient {
296297 this . channel = null ;
297298 break ;
298299 }
299- this . serverVersion . update ( ) ;
300+ if ( updateServerUsed ) {
301+ this . updateServerVersion ( context . extensionUri ) ;
302+ }
300303 this . client = await this . createLanguageClient ( context ) ;
301304 this . serverStatus = this . client !== null ? ServerStatus . running : ServerStatus . error ;
302305 return this . serverStatus ;
303306 }
304307 async restart ( context : vscode . ExtensionContext ) {
305308 await this . stop ( ) ;
306- await this . start ( context ) ;
309+ await this . start ( context , true ) ;
307310 }
308311 async stop ( ) {
309312 await this . client ?. stop ( 100 ) . catch ( _ => { } ) ;
310313 this . dispose ( ) ;
311314 this . serverStatus = ServerStatus . stopped ;
312315 }
316+ updateServerVersion ( extensionUri : vscode . Uri ) {
317+ this . serverVersion = new ServerVersion ( extensionUri ) ;
318+ }
313319 updateStatus ( status : ServerStatus ) {
314320 this . serverStatus = status ;
315321 this . statusChangedCallback ( status ) ;
0 commit comments