mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-24 18:02:02 +01:00
internal/graphicsdriver/metal: refactoring
This commit is contained in:
parent
aace620b7e
commit
caab1ee29f
@ -42,12 +42,11 @@ func (c *precompiledLibraries) put(hash shaderir.SourceHash, bin []byte) {
|
|||||||
c.binaries[hash] = bin
|
c.binaries[hash] = bin
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *precompiledLibraries) get(hash shaderir.SourceHash) ([]byte, bool) {
|
func (c *precompiledLibraries) get(hash shaderir.SourceHash) []byte {
|
||||||
c.m.Lock()
|
c.m.Lock()
|
||||||
defer c.m.Unlock()
|
defer c.m.Unlock()
|
||||||
|
|
||||||
bin, ok := c.binaries[hash]
|
return c.binaries[hash]
|
||||||
return bin, ok
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var thePrecompiledLibraries precompiledLibraries
|
var thePrecompiledLibraries precompiledLibraries
|
||||||
@ -104,7 +103,7 @@ func (s *Shader) Dispose() {
|
|||||||
|
|
||||||
func (s *Shader) init(device mtl.Device) error {
|
func (s *Shader) init(device mtl.Device) error {
|
||||||
var src string
|
var src string
|
||||||
if libBin, ok := thePrecompiledLibraries.get(s.ir.SourceHash); ok {
|
if libBin := thePrecompiledLibraries.get(s.ir.SourceHash); len(libBin) > 0 {
|
||||||
lib, err := device.MakeLibraryWithData(libBin)
|
lib, err := device.MakeLibraryWithData(libBin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user