GPU/SW: Fix performance regression on 32-bit ARM

This commit is contained in:
Connor McLaughlin
2021-07-17 14:02:54 +10:00
parent 75b69a6f7e
commit e9374646e9
3 changed files with 148 additions and 1301 deletions

View File

@ -1,73 +1,46 @@
texmode = [
"GPUTextureMode::Palette4Bit",
"GPUTextureMode::Palette8Bit",
"GPUTextureMode::Direct16Bit",
"GPUTextureMode::Direct16Bit",
"GPUTextureMode::RawPalette4Bit",
"GPUTextureMode::RawPalette8Bit",
"GPUTextureMode::RawDirect16Bit",
"GPUTextureMode::RawDirect16Bit",
"GPUTextureMode::Disabled"
]
transparentmode = [
"GPUTransparencyMode::HalfBackgroundPlusHalfForeground",
"GPUTransparencyMode::BackgroundPlusForeground",
"GPUTransparencyMode::BackgroundMinusForeground",
"GPUTransparencyMode::BackgroundPlusQuarterForeground",
"GPUTransparencyMode::Disabled"
]
bools = ["false", "true"]
"""
print("const GPU_SW_Backend::DrawRectangleFunction GPU_SW_Backend::s_rectangle_draw_functions[%d][%d][2] = {" % (len(texmode), len(transparentmode)))
for texture in range(len(texmode)):
print(" { // %s" % texmode[texture])
for transparency in range(len(transparentmode)):
print(" { // %s" % transparentmode[transparency])
for check_mask in range(2):
line = "&GPU_SW_Backend::DrawRectangle<%s, %s, %s>" % (texmode[texture], transparentmode[transparency], bools[check_mask])
print(" %s%s" % (line, "," if check_mask == 0 else ""))
print(" }%s" % ("," if transparency < (len(transparentmode) - 1) else ""))
print(" }%s" % ("," if texture < (len(texmode) - 1) else ""))
print("static constexpr DrawRectangleFunction funcs[2][2][2] = {")
for texture in range(2):
print(" {")
for raw_texture in range(2):
print(" {")
for transparency in range(2):
line = "&GPU_SW_Backend::DrawRectangle<%s, %s, %s>" % (bools[texture], bools[0 if texture == 0 else raw_texture], bools[transparency])
print(" %s%s" % (line, "," if transparency == 0 else ""))
print(" }%s" % ("," if raw_texture == 0 else ""))
print(" }%s" % ("," if texture == 0 else ""))
print("};")
"""
"""
print("const GPU_SW_Backend::DrawTriangleFunction GPU_SW_Backend::s_triangle_draw_functions[2][%d][%d][2][2] = {" % (len(texmode), len(transparentmode)))
print("static constexpr DrawTriangleFunction funcs[2][2][2][2][2] = {")
for shading in range(2):
print(" { // shading %s" % bools[shading])
for texture in range(len(texmode)):
print(" { // %s" % texmode[texture])
for transparency in range(len(transparentmode)):
print(" { // %s" % transparentmode[transparency])
for dither in range(2):
print(" { // dither %s" % bools[dither])
for check_mask in range(2):
line = "&GPU_SW_Backend::DrawTriangle<%s, %s, %s, %s, %s>" % (bools[shading], texmode[texture], transparentmode[transparency], bools[dither], bools[check_mask])
print(" %s%s" % (line, "," if check_mask == 0 else ""))
print(" }%s" % ("," if dither == 0 else ""))
print(" }%s" % ("," if transparency < (len(transparentmode) - 1) else ""))
print(" }%s" % ("," if texture < (len(texmode) - 1) else ""))
print(" {")
for texture in range(2):
print(" {")
for raw_texture in range(2):
print(" {")
for transparency in range(2):
print(" {")
for dither in range(2):
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])
print(" %s%s" % (line, "," if dither == 0 else ""))
print(" }%s" % ("," if transparency == 0 else ""))
print(" }%s" % ("," if raw_texture == 0 else ""))
print(" }%s" % ("," if texture == 0 else ""))
print(" }%s" % ("," if shading == 0 else ""))
print("};")
"""
print("const GPU_SW_Backend::DrawLineFunction GPU_SW_Backend::s_line_draw_functions[2][%d][2][2] = {" % (len(transparentmode)))
print("static constexpr DrawLineFunction funcs[2][2][2] = {")
for shading in range(2):
print(" { // shading %s" % bools[shading])
for transparency in range(len(transparentmode)):
print(" { // %s" % transparentmode[transparency])
print(" {")
for transparency in range(2):
print(" {")
for dither in range(2):
print(" { // dither %s" % bools[dither])
for check_mask in range(2):
line = "&GPU_SW_Backend::DrawLine<%s, %s, %s, %s>" % (bools[shading], transparentmode[transparency], bools[dither], bools[check_mask])
print(" %s%s" % (line, "," if check_mask == 0 else ""))
print(" }%s" % ("," if dither == 0 else ""))
print(" }%s" % ("," if transparency < (len(transparentmode) - 1) else ""))
line = "&GPU_SW_Backend::DrawLine<%s, %s, %s>" % (bools[shading], bools[transparency], bools[dither])
print(" %s%s" % (line, "," if dither == 0 else ""))
print(" }%s" % ("," if transparency == 0 else ""))
print(" }%s" % ("," if shading == 0 else ""))
print("};")