Skip to content

Commit 83e1ffb

Browse files
committed
Add OES_standard_derivatives if available
1 parent 8853450 commit 83e1ffb

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/openfl/display/OpenGLRenderer.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import lime.math.Matrix4;
5555
class OpenGLRenderer extends DisplayObjectRenderer
5656
{
5757
@:noCompletion private static var __blendMinMaxSupported:Null<Bool>;
58+
@:noCompletion private static var __standardDerivativesSupported:Null<Bool>;
5859
@:noCompletion private static var __complexBlendsSupported:Null<Bool>;
5960
@:noCompletion private static var __coherentBlendsSupported:Null<Bool>;
6061
@:noCompletion private static var __sRGBWriteControlSupported:Null<Bool>;
@@ -172,6 +173,10 @@ class OpenGLRenderer extends DisplayObjectRenderer
172173
{
173174
__coherentBlendsSupported = exts.contains("KHR_blend_equation_advanced_coherent");
174175
}
176+
if (__standardDerivativesSupported == null)
177+
{
178+
__standardDerivativesSupported = exts.contains("OES_standard_derivatives");
179+
}
175180

176181
#if (js && html5)
177182
__softwareRenderer = new CanvasRenderer(null);

src/openfl/display/Shader.hx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ class Shader
627627
}
628628

629629
var complexBlendsSupported = OpenGLRenderer.__complexBlendsSupported && isFragment;
630+
var standardDerivativesSupported = OpenGLRenderer.__standardDerivativesSupported && isFragment;
630631

631632
#if lime
632633
if (__context.__context.type == OPENGL)
@@ -653,6 +654,11 @@ class Shader
653654
#end
654655
}
655656

657+
if (standardDerivativesSupported)
658+
{
659+
extensions += "#extension GL_OES_standard_derivatives : enable\n";
660+
}
661+
656662
// #version must be the first directive and cannot be repeated,
657663
// while #extension directives must be before any non-preprocessor tokens.
658664

0 commit comments

Comments
 (0)