Commit 4c0342be authored by Laurent Le Brun's avatar Laurent Le Brun
Browse files

Fix warning, cleanup

parent 0966114c
......@@ -21,7 +21,7 @@
<Tailcalls>false</Tailcalls>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<WarningLevel>5</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<DocumentationFile>bin\Debug\Checker.XML</DocumentationFile>
<Prefer32Bit>true</Prefer32Bit>
......
......@@ -22,7 +22,7 @@
<Tailcalls>false</Tailcalls>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<WarningLevel>5</WarningLevel>
<StartArguments>-o "" ../../tests\unit\commas.frag --smoothstep</StartArguments>
<OtherFlags>--warnon:1182</OtherFlags>
</PropertyGroup>
......
......@@ -6,7 +6,7 @@ open System.IO
type targetOutput = Text | CHeader | CList | JS | Nasm
let version = "1.1.6" // Shader Minifer version
let debugMode = true
let debugMode = false
let nullOut = new StreamWriter(Stream.Null) :> TextWriter
......@@ -86,6 +86,7 @@ let makeDecl name size sem init = {name=name; size=size; semantics=sem; init=ini
let makeFunctionType ty name args sem =
{retType=ty; fName=name; args=args; semantics=sem}
[<NoComparison; NoEquality>]
type MapEnv = {
fExpr: MapEnv -> Expr -> Expr
fInstr: Instr -> Instr
......@@ -96,7 +97,7 @@ let mapEnv fe fi = {fExpr = fe; fInstr = fi; vars = Map.empty}
let foldList env fct li =
let env = ref env
let res = li |> List.map (fun i -> // FIXME: use List.fold is cleaner :)
let res = li |> List.map (fun i ->
let x = fct !env i
env := fst x
snd x)
......@@ -117,7 +118,9 @@ let rec mapExpr env = function
and mapDecl env (ty, vars) =
let aux env decl =
let env = {env with vars = env.vars.Add(decl.name, (ty, decl.size, decl.init))}
env, {decl with size=Option.map (mapExpr env) decl.size; init=Option.map (mapExpr env) decl.init}
env, {decl with
size=Option.map (mapExpr env) decl.size
init=Option.map (mapExpr env) decl.init}
let env, vars = foldList env aux vars
env, (ty, vars)
......
......@@ -124,8 +124,6 @@ let () =
"--no-renaming-list", ArgType.String noRenamingFct, "Comma-separated list of functions to preserve"
"--no-sequence", ArgType.Unit (fun() -> Ast.noSequence<-true), "Do not use the comma operator trick"
"--smoothstep", ArgType.Unit (fun() -> Ast.smoothstepTrick<-true), "Use IQ's smoothstep trick"
//"--macro-threshold", ArgType.Int (fun i ->
// printfn "Macros are disabled in the release."; Ast.macroThreshold <- i), "[disabled] Use a #define macro if it can save at least <int> bytes"
"--", ArgType.Rest setFile, "Stop parsing command line"
] |> List.map ArgInfo
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment