Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Introduce MAX_PRECISION which will override precision declatation for…
… int and float
  • Loading branch information
Sechgulo committed Nov 18, 2024
commit 3a06c65d404c5f8cd33618e94463bdd3814a6435
6 changes: 5 additions & 1 deletion h3d/impl/GlDriver.hx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package h3d.impl;
import h3d.impl.Driver;
import h3d.mat.Data;
import h3d.mat.Pass;
import h3d.mat.Stencil;
import h3d.mat.Data;

#if (js||hlsdl||usegl)

Expand Down Expand Up @@ -87,6 +87,7 @@ class GlDriver extends Driver {
static var UID = 0;
public var gl : GL;
public static var ALLOW_WEBGL2 = true;
public static var MAX_PRECISION = null;
#end

#if (hlsdl||usegl)
Expand Down Expand Up @@ -277,6 +278,9 @@ class GlDriver extends Driver {
var glout = new ShaderCompiler();
glout.glES = glES;
glout.version = shaderVersion;
#if js
glout.precision = MAX_PRECISION;
#end
#if !usegl
@:privateAccess glout.intelDriverFix = isIntelGpu;
#end
Expand Down
11 changes: 9 additions & 2 deletions hxsl/GlslOut.hx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class GlslOut {
public var varNames : Map<Int,String>;
public var glES : Null<Float>;
public var version : Null<Int>;
public var precision : Null<String> = null;

/*
Intel HD driver fix:
Expand Down Expand Up @@ -811,10 +812,16 @@ class GlslOut {

if( isCompute ) {
// no prec
} else if( isVertex )
} else if( precision != null ) {
decl('precision $precision float;');
decl('precision $precision int;');
} else if( isVertex ) {
decl("precision highp float;");
else
decl("precision highp int;");
} else {
decl("precision mediump float;");
decl("precision mediump int;");
}

initVars(s);

Expand Down