graphicsdriver/opengl: Enable dFdx for mobiles

Fixes #1404
This commit is contained in:
Hajime Hoshi 2020-11-21 19:40:07 +09:00
parent b72848dc97
commit dd46221968
4 changed files with 30 additions and 3 deletions

View File

@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build !android
// +build !js // +build !js
// +build !ios
package opengl package opengl

View File

@ -22,5 +22,5 @@ func glslVersion() glsl.GLSLVersion {
if isWebGL2Available { if isWebGL2Available {
return glsl.GLSLVersionES300 return glsl.GLSLVersionES300
} }
return glsl.GLSLVersionWebGL1 return glsl.GLSLVersionES100
} }

View File

@ -0,0 +1,25 @@
// 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.
// +build android ios
package opengl
import (
"github.com/hajimehoshi/ebiten/v2/internal/shaderir/glsl"
)
func glslVersion() glsl.GLSLVersion {
return glsl.GLSLVersionES100
}

View File

@ -28,7 +28,7 @@ type GLSLVersion int
const ( const (
GLSLVersionDefault GLSLVersion = iota GLSLVersionDefault GLSLVersion = iota
GLSLVersionWebGL1 GLSLVersionES100
GLSLVersionES300 GLSLVersionES300
) )
@ -42,7 +42,7 @@ func VertexPrelude(version GLSLVersion) string {
func FragmentPrelude(version GLSLVersion) string { func FragmentPrelude(version GLSLVersion) string {
var prefix string var prefix string
switch version { switch version {
case GLSLVersionWebGL1: case GLSLVersionES100:
prefix = `#extension GL_OES_standard_derivatives : enable` + "\n\n" prefix = `#extension GL_OES_standard_derivatives : enable` + "\n\n"
case GLSLVersionES300: case GLSLVersionES300:
prefix = `#version 300 es` + "\n\n" prefix = `#version 300 es` + "\n\n"