Skip to content

Commit

Permalink
- improve handling of -v2 pmfx and ignore default techniques, fixup h…
Browse files Browse the repository at this point in the history
…lsl / windows readme command lines so they are copy pastable and work
  • Loading branch information
polymonster committed Mar 22, 2023
1 parent dfc152e commit 2286731
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pmfx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ def inherit_technique(technique, pmfx_json):


# parse pmfx file to find the json block pmfx: { }
def find_pmfx_json(shader_file_text):
def find_pmfx_json(shader_file_text, create_default=True):
pmfx_loc = shader_file_text.find("pmfx:")
if pmfx_loc != -1:
# pmfx json exists, return the block
Expand All @@ -1106,7 +1106,7 @@ def find_pmfx_json(shader_file_text):
pmfx_json = jsn.loads(shader_file_text[json_loc:pmfx_end + json_loc])
shader_text_removed = shader_file_text[:pmfx_loc] + shader_file_text[pmfx_loc + pmfx_end:].strip()
return pmfx_json, shader_text_removed
else:
elif create_default:
# shader can have no pmfx, provided it supplies vs_main and ps_main
if find_function(shader_file_text, "vs_main") and find_function(shader_file_text, "ps_main"):
pmfx_json = dict()
Expand Down
2 changes: 1 addition & 1 deletion pmfx_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ def generate_pmfx(file, root):

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

if not pmfx_json:
pmfx_json, shader_source, included_files = load_pmfx_jsn(file, root)
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ python3 pmfx.py -v1 -shader_platform metal -metal_sdk iphoneos -metal_min_os 0.9
python3 pmfx.py -v1 -shader_platform spirv -i examples/v1 -o output/bin -h output/structs -t output/temp
// hlsl d3d11
python3 pmfx.py -v1 -shader_platform hlsl -shader_version 4_0 -i examples/v1 -o output/bin -h output/structs -t output/temp
py -3 pmfx.py -v1 -shader_platform hlsl -shader_version 5_0 -i examples/v1 -o output/bin -h output/structs -t output/temp
// glsl
python3 pmfx.py -v1 -shader_platform glsl -shader_version 330 -i examples/v1 -o output/bin -h output/structs -t output/temp
Expand Down Expand Up @@ -609,7 +609,7 @@ Full [documentation](https://github.com/polymonster/pmfx-shader/blob/master/docs
Compilation is simple with command line args as so:

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

### Examples
Expand Down

0 comments on commit 2286731

Please sign in to comment.