Skip to content

Commit 6143a88

Browse files
authored
Adapt vulkan worker wrapper to new worker (#88)
1 parent 622e2b8 commit 6143a88

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

python/src/main/python/drivers/worker_vk.py

+34-13
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ def prepareShaders(frag):
117117

118118
################################################################################
119119

120-
def getImageVulkanAndroid(args, frag):
120+
def getImageVulkanAndroid(args, frag, skipRender):
121121

122-
app = 'vulkan.samples.vulkan_worker'
122+
app = 'com.graphicsfuzz.vkworker'
123+
if args.oldworker:
124+
app = 'vulkan.samples.vulkan_worker'
123125

124126
print('## ' + frag)
125127

@@ -169,11 +171,14 @@ def getImageVulkanAndroid(args, frag):
169171

170172
adb('push test.vert.spv test.frag.spv test.json /sdcard/graphicsfuzz/')
171173

174+
# Skip render
175+
if skipRender:
176+
adb('shell touch /sdcard/graphicsfuzz/SKIP_RENDER')
177+
172178
# clean all buffers of logcat
173179
adb('logcat -b all -c')
174180

175-
runtestcmd = 'shell am start'
176-
runtestcmd += ' -n ' + app + '/android.app.NativeActivity'
181+
runtestcmd = 'shell am start ' + app + '/android.app.NativeActivity'
177182

178183
print('* Will run: ' + runtestcmd)
179184
adb(runtestcmd)
@@ -224,15 +229,24 @@ def getImageVulkanAndroid(args, frag):
224229
adb('shell am force-stop ' + app)
225230
return 'timeout'
226231

227-
# Get the image and convert it to PNG
228-
adb('pull /sdcard/graphicsfuzz/image.ppm')
229-
if os.path.exists('image.ppm'):
230-
subprocess.run('convert image.ppm image.png', shell=True)
231-
return 'success'
232+
# Get the image
233+
if args.oldworker:
234+
adb('pull /sdcard/graphicsfuzz/image.ppm')
235+
if os.path.exists('image.ppm'):
236+
subprocess.run('convert image.ppm image.png', shell=True)
237+
return 'success'
238+
else:
239+
with open('log.txt', 'a') as f:
240+
f.write('\nWEIRD ERROR: No crash detected but no image found on device ??\n')
241+
return 'unexpected_error'
232242
else:
233-
with open('log.txt', 'a') as f:
234-
f.write('\nWEIRD ERROR: No crash detected but no image found on device ??\n')
235-
return 'unexpected_error'
243+
adb('pull /sdcard/graphicsfuzz/image.png')
244+
if os.path.exists('image.png'):
245+
return 'success'
246+
else:
247+
with open('log.txt', 'a') as f:
248+
f.write('\nWEIRD ERROR: No crash detected but no image found on device ??\n')
249+
return 'unexpected_error'
236250

237251
################################################################################
238252

@@ -245,6 +259,8 @@ def doImageJob(args, imageJob):
245259

246260
res = tt.ImageJobResult()
247261

262+
skipRender = imageJob.skipRender
263+
248264
# Set nice defaults to fields we will not update anyway
249265
res.passSanityCheck = True
250266
res.log = 'Start: ' + name + '\n'
@@ -255,7 +271,7 @@ def doImageJob(args, imageJob):
255271
remove(png)
256272
remove(log)
257273

258-
getimageResult = getImageVulkanAndroid(args, fragFile)
274+
getimageResult = getImageVulkanAndroid(args, fragFile, skipRender)
259275

260276
# Try to get our own log file in any case
261277
if os.path.exists('log.txt'):
@@ -361,6 +377,11 @@ def get_service(server, args):
361377
'--spirvopt',
362378
help='Enable spirv-opt with these optimisation flags (e.g. --spirvopt=-O)')
363379

380+
parser.add_argument(
381+
'--oldworker',
382+
action='store_true',
383+
help='Use old worker')
384+
364385
args = parser.parse_args()
365386

366387
print('token: ' + args.token)

0 commit comments

Comments
 (0)