mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-12 22:17:26 +01:00
Merge d7ff8820a2
into 9d4f88c992
This commit is contained in:
commit
32c7fdcfeb
@ -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_notsinglethread.go
Normal file
32
shader_notsinglethread.go
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright 2024 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
23
shader_singlethread.go
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2024 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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user