Просмотр исходного кода

Use different shader version depending on target architecture

Daniel Salvadori 6 лет назад
Родитель
Сommit
a2e3b3863c
3 измененных файлов с 20 добавлено и 5 удалено
  1. 2 5
      renderer/shaman.go
  2. 9 0
      renderer/version-wasm.go
  3. 9 0
      renderer/version.go

+ 2 - 5
renderer/shaman.go

@@ -15,10 +15,9 @@ import (
 	"strconv"
 )
 
-const GLSL_VERSION = "330 core"
-
 // Regular expression to parse #include <name> [quantity] directive
 var rexInclude *regexp.Regexp
+
 const indexParameter = "{i}"
 
 func init() {
@@ -245,7 +244,6 @@ func (sm *Shaman) GenProgram(specs *ShaderSpecs) (*gls.Program, error) {
 	return prog, nil
 }
 
-
 func (sm *Shaman) preprocess(source string, defines map[string]string) (string, error) {
 
 	// If defines map supplied, generate prefix with glsl version directive first,
@@ -258,10 +256,9 @@ func (sm *Shaman) preprocess(source string, defines map[string]string) (string,
 		}
 	}
 
-	return sm.processIncludes(prefix + source, defines)
+	return sm.processIncludes(prefix+source, defines)
 }
 
-
 // preprocess preprocesses the specified source prefixing it with optional defines directives
 // contained in "defines" parameter and replaces '#include <name>' directives
 // by the respective source code of include chunk of the specified name.

+ 9 - 0
renderer/version-wasm.go

@@ -0,0 +1,9 @@
+// Copyright 2016 The G3N Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build wasm
+
+package renderer
+
+const GLSL_VERSION = "300 es"

+ 9 - 0
renderer/version.go

@@ -0,0 +1,9 @@
+// Copyright 2016 The G3N Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !wasm
+
+package renderer
+
+const GLSL_VERSION = "330 core"