gen_sw_functions.py (1857B)
1 bools = ["false", "true"] 2 3 4 print("static constexpr DrawRectangleFunction funcs[2][2][2] = {") 5 for texture in range(2): 6 print(" {") 7 for raw_texture in range(2): 8 print(" {") 9 for transparency in range(2): 10 line = "&GPU_SW_Backend::DrawRectangle<%s, %s, %s>" % (bools[texture], bools[0 if texture == 0 else raw_texture], bools[transparency]) 11 print(" %s%s" % (line, "," if transparency == 0 else "")) 12 print(" }%s" % ("," if raw_texture == 0 else "")) 13 print(" }%s" % ("," if texture == 0 else "")) 14 print("};") 15 16 17 print("static constexpr DrawTriangleFunction funcs[2][2][2][2][2] = {") 18 for shading in range(2): 19 print(" {") 20 for texture in range(2): 21 print(" {") 22 for raw_texture in range(2): 23 print(" {") 24 for transparency in range(2): 25 print(" {") 26 for dither in range(2): 27 line = "&GPU_SW_Backend::DrawTriangle<%s, %s, %s, %s, %s>" % (bools[shading], bools[texture], bools[0 if texture == 0 else raw_texture], bools[transparency], bools[0 if raw_texture != 0 else dither]) 28 print(" %s%s" % (line, "," if dither == 0 else "")) 29 print(" }%s" % ("," if transparency == 0 else "")) 30 print(" }%s" % ("," if raw_texture == 0 else "")) 31 print(" }%s" % ("," if texture == 0 else "")) 32 print(" }%s" % ("," if shading == 0 else "")) 33 print("};") 34 35 36 print("static constexpr DrawLineFunction funcs[2][2][2] = {") 37 for shading in range(2): 38 print(" {") 39 for transparency in range(2): 40 print(" {") 41 for dither in range(2): 42 line = "&GPU_SW_Backend::DrawLine<%s, %s, %s>" % (bools[shading], bools[transparency], bools[dither]) 43 print(" %s%s" % (line, "," if dither == 0 else "")) 44 print(" }%s" % ("," if transparency == 0 else "")) 45 print(" }%s" % ("," if shading == 0 else "")) 46 print("};")