Skip to content

Commit 2286731

Browse files
committed
- improve handling of -v2 pmfx and ignore default techniques, fixup hlsl / windows readme command lines so they are copy pastable and work
1 parent dfc152e commit 2286731

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pmfx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ def inherit_technique(technique, pmfx_json):
10971097

10981098

10991099
# parse pmfx file to find the json block pmfx: { }
1100-
def find_pmfx_json(shader_file_text):
1100+
def find_pmfx_json(shader_file_text, create_default=True):
11011101
pmfx_loc = shader_file_text.find("pmfx:")
11021102
if pmfx_loc != -1:
11031103
# pmfx json exists, return the block
@@ -1106,7 +1106,7 @@ def find_pmfx_json(shader_file_text):
11061106
pmfx_json = jsn.loads(shader_file_text[json_loc:pmfx_end + json_loc])
11071107
shader_text_removed = shader_file_text[:pmfx_loc] + shader_file_text[pmfx_loc + pmfx_end:].strip()
11081108
return pmfx_json, shader_text_removed
1109-
else:
1109+
elif create_default:
11101110
# shader can have no pmfx, provided it supplies vs_main and ps_main
11111111
if find_function(shader_file_text, "vs_main") and find_function(shader_file_text, "ps_main"):
11121112
pmfx_json = dict()

pmfx_pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ def generate_pmfx(file, root):
799799

800800
# semi similar to v1-path, allows pmfx: {} and hls source code to be mixed in the ame file
801801
shader_file_text_full, included_files = build_pmfx.create_shader_set(input_pmfx_filepath, root)
802-
pmfx_json, shader_source = build_pmfx.find_pmfx_json(shader_file_text_full)
802+
pmfx_json, shader_source = build_pmfx.find_pmfx_json(shader_file_text_full, False)
803803

804804
if not pmfx_json:
805805
pmfx_json, shader_source, included_files = load_pmfx_jsn(file, root)

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ python3 pmfx.py -v1 -shader_platform metal -metal_sdk iphoneos -metal_min_os 0.9
107107
python3 pmfx.py -v1 -shader_platform spirv -i examples/v1 -o output/bin -h output/structs -t output/temp
108108
109109
// hlsl d3d11
110-
python3 pmfx.py -v1 -shader_platform hlsl -shader_version 4_0 -i examples/v1 -o output/bin -h output/structs -t output/temp
110+
py -3 pmfx.py -v1 -shader_platform hlsl -shader_version 5_0 -i examples/v1 -o output/bin -h output/structs -t output/temp
111111
112112
// glsl
113113
python3 pmfx.py -v1 -shader_platform glsl -shader_version 330 -i examples/v1 -o output/bin -h output/structs -t output/temp
@@ -609,7 +609,7 @@ Full [documentation](https://github.com/polymonster/pmfx-shader/blob/master/docs
609609
Compilation is simple with command line args as so:
610610

611611
```text
612-
python3 pmfx.py -shader_platform hlsl -shader_version 6_0 -i examples/v2/ -o ${data_dir}/shaders -t ${temp_dir}/shaders
612+
py -3 pmfx.py -shader_platform hlsl -shader_version 6_0 -i examples/v2/ -o build/data/shaders -t build/temp/shaders
613613
```
614614

615615
### Examples

0 commit comments

Comments
 (0)