Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHANGE GCC optimization level from O3 to O2 #76

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/playdate/bindings/graphics.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
import utils, types

type LCDRect* {.importc: "LCDRect", header: "pd_api.h".} = object
left* {.importc.}: int # int32?
right* {.importc.}: int
top* {.importc.}: int
bottom* {.importc.}: int
left* {.importc.}: int32
right* {.importc.}: int32
top* {.importc.}: int32
bottom* {.importc.}: int32

proc makeLCDRect*(x: int, y: int, width: int, height: int): LCDRect =
proc makeLCDRect*(x: int32, y: int32, width: int32, height: int32): LCDRect =
return LCDRect(left: x, right: x + width, top: y, bottom: y + height)

proc translateLCDRect*(rect: LCDRect, dx: int, dy: int): LCDRect {.importc: "PDStringEncoding", header: "pd_api.h".}

const LCD_COLUMNS*: int = 400
const LCD_ROWS*: int = 240
const LCD_ROWSIZE*: int = 52
const LCD_COLUMNS*: int32 = 400
const LCD_ROWS*: int32 = 240
const LCD_ROWSIZE*: int32 = 52
const LCD_SCREEN_RECT* = makeLCDRect(0, 0, LCD_COLUMNS, LCD_ROWS)

# Enums
Expand Down
5 changes: 4 additions & 1 deletion src/playdate/build/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ when defined(device):

if defined(release):
switch("define", "release")
switch("opt", "speed")
# Normally, one would use opt = speed, which implies O3 (optimization level 3),
# but O2 outperforms O3 on the Playdate
switch("opt", "none")
switch("passC", "-O2")
switch("debuginfo", "off")
switch("index", "off")
switch("stackTrace", "off")
Expand Down
2 changes: 1 addition & 1 deletion src/playdate/graphics.nim
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ proc createPattern*(this: ptr PlaydateGraphics, bitmap: LCDBitmap, x: int, y: in

import macros

proc fillPolygon*[Int32x2](this: ptr PlaydateGraphics, points: seq[Int32x2], color: LCDColor, fillRule: LCDPolygonFillRule) =
proc fillPolygon*[Int32x2](this: ptr PlaydateGraphics, points: openArray[Int32x2], color: LCDColor, fillRule: LCDPolygonFillRule) =
when sizeof(Int32x2) != sizeof(int32) * 2: {.error: "size of points is not sizeof(int32) * 2".}

privateAccess(PlaydateGraphics)
Expand Down
Loading