summaryrefslogtreecommitdiff
path: root/run.sh
blob: c724a32a94578f0c4af7e0d857509fbf15b59a2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash

# MESA_GLSL_VERSION_OVERRIDE
#
# changes the value returned by glGetString(GL_SHADING_LANGUAGE_VERSION). Valid
# values are integers, such as "130". Mesa will not really implement all the
# features of the given language version if it's higher than what's normally
# reported. (for developers only)

# MESA_GL_VERSION_OVERRIDE
#
# changes the value returned by glGetString(GL_VERSION) and possibly the GL API
# type.  The format should be MAJOR.MINOR[FC|COMPAT]
#
#     FC is an optional suffix that indicates a forward compatible context.
#     This is only valid for versions >= 3.0.
#
#     COMPAT is an optional suffix that indicates a compatibility context or
#     GL_ARB_compatibility support. This is only valid for versions >= 3.1.
#
#     GL versions <= 3.0 are set to a compatibility (non-Core) profile
#
#     GL versions = 3.1, depending on the driver, it may or may not have the
#     ARB_compatibility extension enabled.
#
#     GL versions >= 3.2 are set to a Core profile
#
#     Examples: 2.1, 3.0, 3.0FC, 3.1, 3.1FC, 3.1COMPAT, X.Y, X.YFC, X.YCOMPAT.
#         2.1 - select a compatibility (non-Core) profile with GL version 2.1.
#         3.0 - select a compatibility (non-Core) profile with GL version 3.0.
#         3.0FC - select a Core+Forward Compatible profile with GL version 3.0.
#         3.1 - select GL version 3.1 with GL_ARB_compatibility enabled per the driver default.
#         3.1FC - select GL version 3.1 with forward compatibility and GL_ARB_compatibility disabled.
#         3.1COMPAT - select GL version 3.1 with GL_ARB_compatibility enabled.
#         X.Y - override GL version to X.Y without changing the profile.
#         X.YFC - select a Core+Forward Compatible profile with GL version X.Y.
#         X.YCOMPAT - select a Compatibility profile with GL version X.Y.
#
#     Mesa may not really implement all the features of the given version. (for
#     developers only)

#cmd=gix
cmd=meshsketch
cmdpath=$(ls -1ta $(find .stack-work/ dist/ dist-newstyle -type f -name $cmd 2>/dev/null) | head -n1)

[ -n "$cmdpath" ] || stack build

cmdpath=$(ls -1ta $(find .stack-work/ dist/ dist-newstyle -type f -name $cmd 2>/dev/null) | head -n1)

if [ "${cmdpath#.stack-work}" = "$cmdpath" ]; then
	lc=./lc
else
	lc="stack run -- lc"
fi

export MESA_GL_VERSION_OVERRIDE=3.3
export MESA_GLSL_VERSION_OVERRIDE=330

set -x

if [ "$cmd" = meshsketch ]; then
    [ ! -e hello_obj2.json -o hello_obj2.json -ot hello_obj2.lc ] && $lc hello_obj2.lc
fi

$cmdpath "$@"