mirror of
https://github.com/stevenrobertson/cuburn.git
synced 2025-07-05 15:55:14 -04:00
Before I rip out tempita and start a DSL
This commit is contained in:
38
main.py
38
main.py
@ -11,39 +11,25 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import ctypes
|
||||
import struct
|
||||
|
||||
# These imports are order-sensitive!
|
||||
import pyglet
|
||||
import pyglet.gl as gl
|
||||
gl.get_current_context()
|
||||
from ctypes import *
|
||||
|
||||
import numpy as np
|
||||
|
||||
from fr0stlib import pyflam3
|
||||
from cuburnlib.device_code import MWCRNGTest
|
||||
from cuburnlib.cuda import LaunchContext
|
||||
|
||||
class CUGenome(pyflam3.Genome):
|
||||
def _render(self, frame, trans):
|
||||
obuf = (ctypes.c_ubyte * ((3+trans)*self.width*self.height))()
|
||||
stats = pyflam3.RenderStats()
|
||||
pyflam3.flam3_render(ctypes.byref(frame), obuf,
|
||||
pyflam3.flam3_field_both,
|
||||
trans+3, trans, ctypes.byref(stats))
|
||||
return obuf, stats, frame
|
||||
|
||||
#from cuburnlib.device_code import MWCRNGTest
|
||||
#from cuburnlib.cuda import LaunchContext
|
||||
from fr0stlib.pyflam3 import *
|
||||
from fr0stlib.pyflam3._flam3 import *
|
||||
from cuburnlib.render import *
|
||||
|
||||
def main(genome_path):
|
||||
ctx = LaunchContext([MWCRNGTest], block=(256,1,1), grid=(64,1), tests=True)
|
||||
ctx.compile(True)
|
||||
ctx.run_tests()
|
||||
#ctx = LaunchContext([MWCRNGTest], block=(256,1,1), grid=(64,1), tests=True)
|
||||
#ctx.compile(True)
|
||||
#ctx.run_tests()
|
||||
|
||||
with open(genome_path) as fp:
|
||||
genome = CUGenome.from_string(fp.read())[0]
|
||||
|
||||
genomes = Genome.from_string(fp.read())
|
||||
render = Render(genomes)
|
||||
render.render_frame()
|
||||
|
||||
#genome.width, genome.height = 512, 512
|
||||
#genome.sample_density = 1000
|
||||
|
Reference in New Issue
Block a user