• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A categorical programming language


Commit MetaInfo

修订版baafff008d25054cdd6025b8c069bc62f5e30320 (tree)
时间2023-03-03 04:02:50
作者Corbin <cds@corb...>
CommiterCorbin

Log Message

Enable the JIT during animations. 60 FPS!

更改概述

差异

--- a/sampler/animate.py
+++ b/sampler/animate.py
@@ -2,6 +2,7 @@ from __future__ import division
22
33 import os, time
44
5+from rpython.rlib.jit import JitDriver
56 from rpython.rlib.rstring import StringBuilder
67 from rpython.rtyper.lltypesystem import rffi
78
@@ -24,6 +25,10 @@ def resize(displayWidth, displayHeight):
2425 print "Buffer is %d x %d" % (bufferWidth, bufferHeight)
2526 return displayWidth, displayHeight, bufferWidth, bufferHeight
2627
28+sample_driver = JitDriver(name="animate_sample",
29+ greens=["program", "sampler"], reds="auto",
30+ is_recursive=True)
31+
2732 def drawDisplay(sampler, cam, canvas, display):
2833 displayWidth, displayHeight, w, h = resize(
2934 caca.get_canvas_width(canvas),
@@ -54,6 +59,7 @@ def drawDisplay(sampler, cam, canvas, display):
5459 for y in range(h - hoff, -hoff, -1):
5560 for x in range(-woff, w - woff):
5661 coords = P(P(F(x / scale), F(y / scale)), F(t))
62+ sample_driver.jit_merge_point(program=cam, sampler=sampler)
5763 sampler.clear()
5864 sampler.sampleAt(cam, coords)
5965 buf.append(sampler.packPixel(1))
--- a/sampler/cammylib/pixel.py
+++ b/sampler/cammylib/pixel.py
@@ -16,7 +16,7 @@ class RGB(Sampler):
1616 sexp.Functor("pair", [sexp.Atom("F"), sexp.Atom("F")]),
1717 ])
1818 channels = 3
19- mask = 0xff, 0xff00, 0xff0000, 0x0
19+ masks = 0xff, 0xff00, 0xff0000, 0x0
2020 def clear(self): self.r = self.g = self.b = 0.0
2121 def sampleAt(self, program, coords):
2222 rgb = program.execute(coords)
--- a/sampler/default.nix
+++ b/sampler/default.nix
@@ -13,7 +13,7 @@ let
1313 };
1414 in
1515 let
16- opt = if false then "jit" else "2";
16+ opt = if true then "jit" else "2";
1717 in stdenv.mkDerivation {
1818 name = "sampler";
1919
--- a/sampler/draw.py
+++ b/sampler/draw.py
@@ -49,7 +49,7 @@ class Welford(object):
4949 return mean, stddev, skew, kurtosis
5050
5151
52-sample_driver = JitDriver(name="sample",
52+sample_driver = JitDriver(name="draw_sample",
5353 greens=["program", "sampler"], reds="auto",
5454 is_recursive=True)
5555