mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 10:42:42 +01:00
internal/shaderlister: add SourceHash
This commit is contained in:
parent
53687aafb0
commit
960189b051
@ -51,6 +51,7 @@ type Shader struct {
|
|||||||
Package string
|
Package string
|
||||||
File string
|
File string
|
||||||
Source string
|
Source string
|
||||||
|
SourceHash string
|
||||||
GLSL *GLSL `json:",omitempty"`
|
GLSL *GLSL `json:",omitempty"`
|
||||||
GLSLES *GLSLES `json:",omitempty"`
|
GLSLES *GLSLES `json:",omitempty"`
|
||||||
HLSL *HLSL `json:",omitempty"`
|
HLSL *HLSL `json:",omitempty"`
|
||||||
@ -125,6 +126,17 @@ func xmain() error {
|
|||||||
origN := len(shaders)
|
origN := len(shaders)
|
||||||
shaders = appendShaderSources(shaders, pkg)
|
shaders = appendShaderSources(shaders, pkg)
|
||||||
|
|
||||||
|
// Add source hashes.
|
||||||
|
for i := range shaders[origN:] {
|
||||||
|
shader := &shaders[i]
|
||||||
|
hash, err := graphics.CalcSourceHash([]byte(shader.Source))
|
||||||
|
if err != nil {
|
||||||
|
visitErr = err
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
shader.SourceHash = hash.String()
|
||||||
|
}
|
||||||
|
|
||||||
// Compile shaders.
|
// Compile shaders.
|
||||||
if len(targets) == 0 {
|
if len(targets) == 0 {
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user