Skip to content

Commit f7ca4eb

Browse files
committed
Support optional shader in compile script
1 parent 6af30af commit f7ca4eb

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

shaders/rust/compileshaders.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ def main():
104104
# Check requirements
105105
check_requirements()
106106

107+
# Parse command line arguments
108+
shader_filter = None
109+
if len(sys.argv) > 1:
110+
shader_filter = sys.argv[1]
111+
print(f"Filtering for shader: {shader_filter}")
112+
107113
# Get workspace members from cargo metadata
108114
try:
109115
result = subprocess.run(['cargo', 'metadata', '--format-version', '1'],
@@ -116,14 +122,23 @@ def main():
116122
for package in metadata['packages']:
117123
if package['id'] == member:
118124
package_path = Path(package['manifest_path']).parent
119-
shader_dirs.append(package_path)
125+
# Apply filter if specified
126+
if shader_filter:
127+
# Check if the filter matches the path or package name
128+
if shader_filter in str(package_path) or shader_filter == package['name']:
129+
shader_dirs.append(package_path)
130+
else:
131+
shader_dirs.append(package_path)
120132
break
121133
except (subprocess.CalledProcessError, json.JSONDecodeError, KeyError) as e:
122134
print(f"Error getting workspace metadata: {e}")
123135
sys.exit(1)
124136

125137
if not shader_dirs:
126-
print("No shader crates found")
138+
if shader_filter:
139+
print(f"No shader crates found matching '{shader_filter}'")
140+
else:
141+
print("No shader crates found")
127142
sys.exit(1)
128143

129144
print(f"Found {len(shader_dirs)} shader crates to build")

0 commit comments

Comments
 (0)