Compare commits

...

3 Commits

Author SHA1 Message Date
Ernest Romero Climent
66da80a100
Merge 117957cf2a into 4267664b8b 2024-07-02 06:47:51 +09:00
Hajime Hoshi
4267664b8b all: update Oto to v3.3.0-alpha.2 2024-07-02 00:06:58 +09:00
ernestrc
117957cf2a
Update builtinShader to not use mutex when single thread build tag is set 2024-06-24 09:18:09 -07:00
5 changed files with 60 additions and 10 deletions

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.19
require (
github.com/ebitengine/gomobile v0.0.0-20240518074828-e86332849895
github.com/ebitengine/hideconsole v1.0.0
github.com/ebitengine/oto/v3 v3.3.0-alpha.1.0.20240629064540-d586bcb56190
github.com/ebitengine/oto/v3 v3.3.0-alpha.2
github.com/ebitengine/purego v0.8.0-alpha.3
github.com/gen2brain/mpeg v0.3.2-0.20240412154320-a2ac4fc8a46f
github.com/go-text/typesetting v0.1.1

4
go.sum
View File

@ -2,8 +2,8 @@ github.com/ebitengine/gomobile v0.0.0-20240518074828-e86332849895 h1:48bCqKTuD7Z
github.com/ebitengine/gomobile v0.0.0-20240518074828-e86332849895/go.mod h1:XZdLv05c5hOZm3fM2NlJ92FyEZjnslcMcNRrhxs8+8M=
github.com/ebitengine/hideconsole v1.0.0 h1:5J4U0kXF+pv/DhiXt5/lTz0eO5ogJ1iXb8Yj1yReDqE=
github.com/ebitengine/hideconsole v1.0.0/go.mod h1:hTTBTvVYWKBuxPr7peweneWdkUwEuHuB3C1R/ielR1A=
github.com/ebitengine/oto/v3 v3.3.0-alpha.1.0.20240629064540-d586bcb56190 h1:9wXCvZNC5XAZWZcInWz85M+TNHhAZ1x6Q9io1fiQsdw=
github.com/ebitengine/oto/v3 v3.3.0-alpha.1.0.20240629064540-d586bcb56190/go.mod h1:yYvXK7mgNwsFawY5RsvGI6yhMHtD+0MfaPkDTl9/uv8=
github.com/ebitengine/oto/v3 v3.3.0-alpha.2 h1:ex2UbULSPuLt76yyaR2JBXICx83Ph6Oz5ugN7h1Jo/I=
github.com/ebitengine/oto/v3 v3.3.0-alpha.2/go.mod h1:yYvXK7mgNwsFawY5RsvGI6yhMHtD+0MfaPkDTl9/uv8=
github.com/ebitengine/purego v0.8.0-alpha.3 h1:qoFlpGuVwJ6J85kuj6Qpyp0DBgxsNYfSY9efidSNFgA=
github.com/ebitengine/purego v0.8.0-alpha.3/go.mod h1:b94LtM1jUWDZPKDyENVhB0WsLdLWFApjbNw5AyxmKyI=
github.com/gen2brain/mpeg v0.3.2-0.20240412154320-a2ac4fc8a46f h1:ysqRe+lvUiL0dH5XzkH0Bz68bFMPJ4f5Si4L/HD9SGk=

View File

@ -16,7 +16,6 @@ package ebiten
import (
"fmt"
"sync"
"github.com/hajimehoshi/ebiten/v2/internal/builtinshader"
"github.com/hajimehoshi/ebiten/v2/internal/graphics"
@ -82,14 +81,10 @@ func (s *Shader) appendUniforms(dst []uint32, uniforms map[string]any) []uint32
}
var (
builtinShaders [builtinshader.FilterCount][builtinshader.AddressCount][2]*Shader
builtinShadersM sync.Mutex
builtinShaders [builtinshader.FilterCount][builtinshader.AddressCount][2]*Shader
)
func builtinShader(filter builtinshader.Filter, address builtinshader.Address, useColorM bool) *Shader {
builtinShadersM.Lock()
defer builtinShadersM.Unlock()
func getBuiltinShader(filter builtinshader.Filter, address builtinshader.Address, useColorM bool) *Shader {
var c int
if useColorM {
c = 1

32
shader_multithread.go Normal file
View File

@ -0,0 +1,32 @@
// Copyright 2020 The Ebiten Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !ebitenginesinglethread && !ebitensinglethread
package ebiten
import (
"sync"
"github.com/hajimehoshi/ebiten/v2/internal/builtinshader"
)
var shaderMu sync.Mutex
func builtinShader(filter builtinshader.Filter, address builtinshader.Address, useColorM bool) *Shader {
shaderMu.Lock()
defer shaderMu.Unlock()
return getBuiltinShader(filter, address, useColorM)
}

23
shader_singlethread.go Normal file
View File

@ -0,0 +1,23 @@
// Copyright 2020 The Ebiten Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build ebitenginesinglethread || ebitensinglethread
package ebiten
import "github.com/hajimehoshi/ebiten/v2/internal/builtinshader"
func builtinShader(filter builtinshader.Filter, address builtinshader.Address, useColorM bool) *Shader {
return getBuiltinShader(filter, address, useColorM)
}