MCPcopy Create free account
hub / github.com/carbonengine/trinity / WorkItem

Class WorkItem

shadercompiler/pythonBuildScript/build.py:65–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64
65class WorkItem:
66 def __init__(self, src, platform, sm, compiler, warnings, extra_args, staging):
67 self.src = src
68 self.platform = platform
69 self.sm = sm
70 self.compiler = compiler
71 self.warnings = warnings
72 self.compiled = get_output_file(src, sm, platform)
73 self.dest = self.compiled
74 self.permutations = 0
75 self.extra_args = extra_args
76 self.staging = staging
77 if self.staging:
78 self.dest = Path(self.staging, Path(self.compiled).relative_to(BRANCH_DIR))
79
80 def get_command_line(self):
81 args = [str(self.compiler), '/single', '/O3']
82 if not self.warnings:
83 args.append('/no_warnings')
84 return args + ['/define', 'SHADERMODEL', str(SHADER_MODELS[self.sm]),
85 '/define', 'PLATFORM', str(PLATFORMS[self.platform]), str(self.src), str(self.dest)] + self.extra_args
86
87 def get_mtime_line(self):
88 return f'{self.src} {self.compiled} SHADERMODEL {SHADER_MODELS[self.sm]} PLATFORM {PLATFORMS[self.platform]}'
89
90 def get_permutations(self):
91 output = subprocess.check_output([self.compiler, '/single', '/permutations', self.src])
92 try:
93 desc = yaml.safe_load(output) or {}
94 count = 1
95 for each in desc.values():
96 count *= len(each['options'])
97 return max(count, 1)
98 except Exception:
99 return 1
100
101 def __str__(self):
102 return f'{self.src}, {self.platform}, {self.sm}'
103
104
105def get_outputs(path, platforms, shader_models, compiler, warnings, extra_args, staging):

Callers 1

get_outputsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected