mirror of
https://github.com/stevenrobertson/cuburn.git
synced 2025-02-05 11:40:04 -05:00
Switch to 1024x1024 (still fixed, tho)
This commit is contained in:
parent
9f3604b670
commit
4612d753cc
@ -7,7 +7,7 @@ __global__
|
|||||||
void logfilt(float4 *pixbuf, float k1, float k2,
|
void logfilt(float4 *pixbuf, float k1, float k2,
|
||||||
float gamma, float vibrancy, float highpow) {
|
float gamma, float vibrancy, float highpow) {
|
||||||
// TODO: test if over an edge of the framebuffer
|
// TODO: test if over an edge of the framebuffer
|
||||||
int i = 512 * blockIdx.x + threadIdx.x;
|
int i = 1024 * blockIdx.x + threadIdx.x;
|
||||||
float4 pix = pixbuf[i];
|
float4 pix = pixbuf[i];
|
||||||
|
|
||||||
if (pix.w <= 0) return;
|
if (pix.w <= 0) return;
|
||||||
|
@ -65,9 +65,9 @@ void apply_xf{{xfid}}(float *ix, float *iy, float *icolor,
|
|||||||
def _iterbody(self):
|
def _iterbody(self):
|
||||||
tmpl = tempita.Template("""
|
tmpl = tempita.Template("""
|
||||||
__global__
|
__global__
|
||||||
void iter(mwc_st *msts, const iter_info *infos, float *accbuf, float *denbuf) {
|
void iter(mwc_st *msts, iter_info *infos, float *accbuf, float *denbuf) {
|
||||||
mwc_st rctx = msts[gtid()];
|
mwc_st rctx = msts[gtid()];
|
||||||
const iter_info *info = &(infos[blockIdx.x]);
|
iter_info *info = &(infos[blockIdx.x]);
|
||||||
|
|
||||||
int consec_bad = -{{features.fuse}};
|
int consec_bad = -{{features.fuse}};
|
||||||
int nsamps = 2560;
|
int nsamps = 2560;
|
||||||
@ -109,8 +109,8 @@ void iter(mwc_st *msts, const iter_info *infos, float *accbuf, float *denbuf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: dither?
|
// TODO: dither?
|
||||||
int i = ((int)((y + 1.0f) * 255.0f) * 512)
|
int i = ((int)((y + 1.0f) * 511.0f) * 1024)
|
||||||
+ (int)((x + 1.0f) * 255.0f);
|
+ (int)((x + 1.0f) * 511.0f) + 1025;
|
||||||
|
|
||||||
// since info was declared const, C++ barfs unless it's loaded first
|
// since info was declared const, C++ barfs unless it's loaded first
|
||||||
float cp_step_frac = {{packer.get('cp_step_frac')}};
|
float cp_step_frac = {{packer.get('cp_step_frac')}};
|
||||||
@ -130,14 +130,16 @@ void iter(mwc_st *msts, const iter_info *infos, float *accbuf, float *denbuf) {
|
|||||||
|
|
||||||
def silly(features, cps):
|
def silly(features, cps):
|
||||||
nsteps = 1000
|
nsteps = 1000
|
||||||
abuf = np.zeros((512, 512, 4), dtype=np.float32)
|
abuf = np.zeros((1024, 1024, 4), dtype=np.float32)
|
||||||
dbuf = np.zeros((512, 512), dtype=np.float32)
|
dbuf = np.zeros((1024, 1024), dtype=np.float32)
|
||||||
seeds = mwc.MWC.make_seeds(512 * nsteps)
|
seeds = mwc.MWC.make_seeds(512 * nsteps)
|
||||||
|
|
||||||
iter = IterCode(features)
|
iter = IterCode(features)
|
||||||
code = assemble_code(BaseCode, mwc.MWC, iter, iter.packer, filter.ColorClip)
|
code = assemble_code(BaseCode, mwc.MWC, iter, iter.packer, filter.ColorClip)
|
||||||
print code
|
|
||||||
mod = SourceModule(code, options=['-use_fast_math'], keep=True)
|
for lno, line in enumerate(code.split('\n')):
|
||||||
|
print '%3d %s' % (lno, line)
|
||||||
|
mod = SourceModule(code, options=[], keep=True)
|
||||||
|
|
||||||
cps_as_array = (Genome * len(cps))()
|
cps_as_array = (Genome * len(cps))()
|
||||||
for i, cp in enumerate(cps):
|
for i, cp in enumerate(cps):
|
||||||
@ -152,7 +154,7 @@ def silly(features, cps):
|
|||||||
sampAt = [int(i/15.*(nsteps-1)) for i in range(16)]
|
sampAt = [int(i/15.*(nsteps-1)) for i in range(16)]
|
||||||
|
|
||||||
for n in range(nsteps):
|
for n in range(nsteps):
|
||||||
flam3_interpolate(cps_as_array, 2, (n - nsteps/2) * 0.001, 0, byref(cp))
|
flam3_interpolate(cps_as_array, 2, float(n)/nsteps - 0.5, 0, byref(cp))
|
||||||
cp._init()
|
cp._init()
|
||||||
if n in sampAt:
|
if n in sampAt:
|
||||||
pidx = sampAt.index(n)
|
pidx = sampAt.index(n)
|
||||||
@ -166,12 +168,13 @@ def silly(features, cps):
|
|||||||
tref.set_array(dpal)
|
tref.set_array(dpal)
|
||||||
tref.set_format(cuda.array_format.UNSIGNED_INT8, 4)
|
tref.set_format(cuda.array_format.UNSIGNED_INT8, 4)
|
||||||
tref.set_flags(cuda.TRSF_NORMALIZED_COORDINATES)
|
tref.set_flags(cuda.TRSF_NORMALIZED_COORDINATES)
|
||||||
|
tref.set_filter_mode(cuda.filter_mode.LINEAR)
|
||||||
|
|
||||||
abufd = cuda.to_device(abuf)
|
abufd = cuda.to_device(abuf)
|
||||||
dbufd = cuda.to_device(dbuf)
|
dbufd = cuda.to_device(dbuf)
|
||||||
|
|
||||||
fun = mod.get_function("iter")
|
fun = mod.get_function("iter")
|
||||||
t = fun(InOut(seeds), In(infos), abufd, dbufd,
|
t = fun(InOut(seeds), InOut(infos), abufd, dbufd,
|
||||||
block=(512,1,1), grid=(nsteps,1), time_kernel=True)
|
block=(512,1,1), grid=(nsteps,1), time_kernel=True)
|
||||||
print "Completed render in %g seconds" % t
|
print "Completed render in %g seconds" % t
|
||||||
|
|
||||||
@ -179,14 +182,15 @@ def silly(features, cps):
|
|||||||
|
|
||||||
k1 = cp.contrast * cp.brightness * 268 / 256
|
k1 = cp.contrast * cp.brightness * 268 / 256
|
||||||
area = 1
|
area = 1
|
||||||
k2 = 4 / (cp.contrast * 5000)
|
k2 = 16 / (cp.contrast * 5000 * 256)
|
||||||
|
|
||||||
fun = mod.get_function("logfilt")
|
fun = mod.get_function("logfilt")
|
||||||
t = fun(abufd, f(k1), f(k2),
|
t = fun(abufd, f(k1), f(k2),
|
||||||
f(1 / cp.gamma), f(cp.vibrancy), f(cp.highlight_power),
|
f(1 / cp.gamma), f(cp.vibrancy), f(cp.highlight_power),
|
||||||
block=(512,1,1), grid=(512,1), time_kernel=True)
|
block=(1024,1,1), grid=(1024,1), time_kernel=True)
|
||||||
print "Completed color filtering in %g seconds" % t
|
print "Completed color filtering in %g seconds" % t
|
||||||
|
|
||||||
abuf = cuda.from_device_like(abufd, abuf)
|
abuf = cuda.from_device_like(abufd, abuf)
|
||||||
|
dbuf = cuda.from_device_like(dbufd, dbuf)
|
||||||
return abuf, dbuf
|
return abuf, dbuf
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ def sinusoidal():
|
|||||||
@_var(2)
|
@_var(2)
|
||||||
def spherical():
|
def spherical():
|
||||||
return """
|
return """
|
||||||
float r2 = w / (tx*tx + ty*ty);
|
float r2 = w / (tx*tx + ty*ty + 1e-20);
|
||||||
ox += tx * r2;
|
ox += tx * r2;
|
||||||
oy += ty * r2;
|
oy += ty * r2;
|
||||||
"""
|
"""
|
||||||
|
8
main.py
8
main.py
@ -20,9 +20,10 @@ import scipy
|
|||||||
|
|
||||||
from fr0stlib.pyflam3 import *
|
from fr0stlib.pyflam3 import *
|
||||||
from fr0stlib.pyflam3._flam3 import *
|
from fr0stlib.pyflam3._flam3 import *
|
||||||
import pyglet
|
|
||||||
|
|
||||||
import pycuda.autoinit
|
import pyglet
|
||||||
|
window = pyglet.window.Window(1024, 1024)
|
||||||
|
import pycuda.gl.autoinit
|
||||||
|
|
||||||
from cuburn.render import *
|
from cuburn.render import *
|
||||||
from cuburn.code.mwc import MWCTest
|
from cuburn.code.mwc import MWCTest
|
||||||
@ -43,8 +44,7 @@ def main(args):
|
|||||||
|
|
||||||
imgbuf = (np.minimum(accum * 255, 255)).astype(np.uint8)
|
imgbuf = (np.minimum(accum * 255, 255)).astype(np.uint8)
|
||||||
|
|
||||||
window = pyglet.window.Window(1600, 900)
|
image = pyglet.image.ImageData(1024, 1024, 'RGBA', imgbuf.tostring(), -4096)
|
||||||
image = pyglet.image.ImageData(512, 512, 'RGBA', imgbuf.tostring(), -2048)
|
|
||||||
tex = image.texture
|
tex = image.texture
|
||||||
|
|
||||||
#pal = (anim.ctx.ptx.instances[PaletteLookup].pal * 255.).astype(np.uint8)
|
#pal = (anim.ctx.ptx.instances[PaletteLookup].pal * 255.).astype(np.uint8)
|
||||||
|
Loading…
Reference in New Issue
Block a user