Skip to content

Commit 54e3748

Browse files
committed
2 parents eeaa8b5 + 02d47b7 commit 54e3748

File tree

3 files changed

+48
-27
lines changed

3 files changed

+48
-27
lines changed

.github/workflows/release.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ jobs:
6161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6262
with:
6363
upload_url: ${{ needs.setup.outputs.upload_url }}
64-
asset_path: ./dist/macOS-universal.zip
65-
asset_name: macOS-universal.zip
64+
asset_path: ./dist/macOS-x64.zip
65+
asset_name: macOS-x64.zip
6666
asset_content_type: application/zip
6767
linux:
6868
needs: setup
@@ -82,6 +82,6 @@ jobs:
8282
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8383
with:
8484
upload_url: ${{ needs.setup.outputs.upload_url }}
85-
asset_path: ./dist/Linux-aarch64.zip
86-
asset_name: Linux-aarch64.zip
85+
asset_path: ./dist/Linux-x64.zip
86+
asset_name: Linux-x64.zip
8787
asset_content_type: application/zip

build_pmfx.py

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class BuildInfo:
2121
metal_min_os = "" # iOS (9.0 - 13.0), macOS (10.11 - 10.15)
2222
debug = False # generate shader with debug info
2323
inputs = [] # array of input files or directories
24-
extensions = [] # array of shader extension currently for glsl
24+
extensions = [] # array of shader extension currently for glsl/gles
25+
nvn_extensions = [] # array of shader extensions for nvn/glsl
2526
root_dir = "" # cwd dir to run from
2627
build_config = "" # json contents of build_config.json
2728
pmfx_dir = "" # location of pmfx
@@ -120,44 +121,48 @@ def parse_args():
120121
_info.inputs.append(sys.argv[j])
121122
j = j + 1
122123
i = j
123-
if sys.argv[i] == "-o":
124+
elif sys.argv[i] == "-o":
124125
_info.output_dir = sys.argv[i + 1]
125-
if sys.argv[i] == "-h":
126+
elif sys.argv[i] == "-h":
126127
_info.struct_dir = sys.argv[i + 1]
127-
if sys.argv[i] == "-t":
128+
elif sys.argv[i] == "-t":
128129
_info.temp_dir = sys.argv[i + 1]
129-
if sys.argv[i] == "-source":
130+
elif sys.argv[i] == "-source":
130131
_info.compiled = False
131-
if sys.argv[i] == "-cbuffer_offset":
132+
elif sys.argv[i] == "-cbuffer_offset":
132133
_info.cbuffer_offset = sys.argv[i + 1]
133-
if sys.argv[i] == "-texture_offset":
134+
elif sys.argv[i] == "-texture_offset":
134135
_info.cbuffer_offset = sys.argv[i + 1]
135-
if sys.argv[i] == "-stage_in":
136+
elif sys.argv[i] == "-stage_in":
136137
_info.stage_in = sys.argv[i + 1]
137-
if sys.argv[i] == "-v_flip":
138+
elif sys.argv[i] == "-v_flip":
138139
_info.v_flip = True
139-
if sys.argv[i] == "-d":
140+
elif sys.argv[i] == "-d":
140141
_info.debug = False
141-
if sys.argv[i] == "-metal_min_os":
142+
elif sys.argv[i] == "-metal_min_os":
142143
_info.metal_min_os = sys.argv[i+1]
143-
if sys.argv[i] == "-metal_sdk":
144+
elif sys.argv[i] == "-metal_sdk":
144145
_info.metal_sdk = sys.argv[i+1]
145-
if sys.argv[i] == "-nvn_exe":
146+
elif sys.argv[i] == "-nvn_exe":
146147
_info.nvn_exe = sys.argv[i+1]
147-
if sys.argv[i] == "-extensions":
148+
elif sys.argv[i] == "-extensions":
148149
j = i + 1
149150
while j < len(sys.argv) and sys.argv[j][0] != '-':
150151
_info.extensions.append(sys.argv[j])
151152
j = j + 1
152153
i = j
154+
elif sys.argv[i] == "-nvn_extensions":
155+
j = i + 1
156+
while j < len(sys.argv) and sys.argv[j][0] != '-':
157+
_info.nvn_extensions.append(sys.argv[j])
158+
j = j + 1
159+
i = j
153160
required = [
154161
"-shader_platform",
155162
"-i",
156163
"-o",
157164
"-t"
158165
]
159-
if _info.shader_platform == "metal":
160-
required.append("-metal_sdk")
161166
if _info.shader_platform == "nvm":
162167
required.append("-nvn_exe")
163168
missing = False
@@ -167,7 +172,8 @@ def parse_args():
167172
missing = True
168173
if missing:
169174
print("exit")
170-
sys.exit(1)
175+
sys.exit(1)
176+
171177

172178

173179
# display help for args
@@ -182,9 +188,10 @@ def display_help():
182188
print(" metal: 2.0 (default)")
183189
print(" nvn: (glsl)")
184190
print(" -metal_sdk [metal only] <iphoneos, macosx, appletvos>")
185-
print(" -metal_min_os (optional) <9.0 - 13.0 (ios), 10.11 - 10.15 (macos)>")
191+
print(" -metal_min_os (optional) [metal only] <9.0 - 13.0 (ios), 10.11 - 10.15 (macos)>")
186192
print(" -nvn_exe [nvn only] <path to execulatble that can compile glsl to nvn glslc>")
187-
print(" -extensions (optional) <list of glsl extension strings separated by spaces>")
193+
print(" -extensions (optional) [glsl/gles only] <list of glsl extension strings separated by spaces>")
194+
print(" -nvn_extensions (optional) [nvn only] <list of nvn glsl extension strings separated by spaces>")
188195
print(" -i <list of input files or directories separated by spaces>")
189196
print(" -o <output dir for shaders>")
190197
print(" -t <output dir for temp files>")
@@ -198,7 +205,7 @@ def display_help():
198205
print(" specifies an offset applied to cbuffer locations to avoid collisions with vertex buffers")
199206
print(" -texture_offset (optional) [vulkan only] (default 32) ")
200207
print(" specifies an offset applied to texture locations to avoid collisions with buffers")
201-
print(" -v_flip (optional) (inserts glsl uniform to conditionally flip verts in the y axis)")
208+
print(" -v_flip (optional) [glsl only] (inserts glsl uniform to conditionally flip verts in the y axis)")
202209
sys.stdout.flush()
203210
sys.exit(0)
204211

@@ -1761,6 +1768,13 @@ def compile_glsl(_info, pmfx_name, _tp, _shader):
17611768
shader_source += "#define PMFX_GLES_COMPUTE\n"
17621769
else:
17631770
shader_source += "#version " + _tp.shader_version + " core\n"
1771+
# extensions
1772+
for ext in _info.extensions:
1773+
shader_source += "#extension " + ext + " : require\n"
1774+
shader_source += "#define PMFX_" + ext + " 1\n"
1775+
for ext in _info.nvn_extensions:
1776+
shader_source += "#extension " + ext + " : enable\n"
1777+
shader_source += "#define PMFX_" + ext + " 1\n"
17641778
shader_source += "#define GLSL\n"
17651779
if binding_points:
17661780
shader_source += "#define PMFX_BINDING_POINTS\n"
@@ -2885,6 +2899,7 @@ def parse_pmfx(file, root):
28852899
else:
28862900
print(output_name + " failed to compile", flush=True)
28872901
pmfx_output_info["failures"][c.pmfx_name] = True
2902+
_info.error_code = 1
28882903
for out in c.output_list:
28892904
print(out, flush=True)
28902905
for err in c.error_list:
@@ -3033,7 +3048,7 @@ def build_executable():
30333048
# zip
30343049
exe_names = {
30353050
"win64": "Windows-x64",
3036-
"osx": "macOS-universal",
3037-
"linux": "Linux-aarch64"
3051+
"osx": "macOS-x64",
3052+
"linux": "Linux-x64"
30383053
}
30393054
shutil.make_archive("dist/" + exe_names[platform], 'zip', "dist/{}".format(platform))

platform/glsl.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ precision highp samplerExternalOES;
103103
#if !defined(GLES) || defined(PMFX_GLES_COMPUTE)
104104
#define texture_2d_rw( image_name, layout_index ) layout (_compute_tex_binding(layout_index), rgba8) uniform image2D image_name
105105
#define texture_2d_r( image_name, layout_index ) layout (_compute_tex_binding(layout_index), rgba8) uniform readonly image2D image_name
106-
#define texture_2d_w( image_name, layout_index ) layout (_compute_tex_binding(layout_index), rgba8) uniform image2D image_name
106+
#define texture_2d_w( image_name, layout_index ) layout (_compute_tex_binding(layout_index), rgba8) uniform writeonly image2D image_name
107107
#define texture_3d_rw( image_name, layout_index ) layout (_compute_tex_binding(layout_index), rgba8) uniform image3D image_name
108108
#define texture_3d_r( image_name, layout_index ) layout (_compute_tex_binding(layout_index), rgba8) uniform readonly image3D image_name
109109
#define texture_3d_w( image_name, layout_index ) texture3d_rw(image_name, layout_index)
@@ -114,6 +114,12 @@ precision highp samplerExternalOES;
114114
#define write_texture( image_name, value, coord ) imageStore(image_name, coord, value)
115115
#define read_texture_array( image_name, coord, slice ) imageLoad(image_name, ivec3(coord.xy, slice))
116116
#define write_texture_array( image_name, value, coord, slice ) imageStore(image_name, ivec3(coord.xy, slice), value)
117+
118+
// bindless
119+
#define texture2d_table(name, type, dimension, register_index, space_index) _compute_tex_binding(register_index) uniform sampler2D name##dimension
120+
#define texture2d_rw_table(name, type, dimension, register_index, space_index) layout (_compute_tex_binding(register_index), rgba8) uniform image2D name##dimension
121+
#define cbuffer_table(name, type, dimension, register_index, space_index) layout(std430, binding=register_index) buffer name##_buffer { type name##dimension; }
122+
117123
#endif
118124

119125
#ifndef GLES

0 commit comments

Comments
 (0)