mightymandel v16

GPU-based Mandelbrot set explorer

render.c File Reference

(v16)

Manage calculation and rendering. More...

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "render.h"
#include "utility.h"
#include "find_ref.h"
#include "atom.h"
#include "logging.h"
#include "mightymandel.h"
#include "image.h"
#include "stopwatch.h"
#include "poll.h"
#include "texture.h"
+ Include dependency graph for render.c:

Go to the source code of this file.

Macros

#define CHECK   assert(vbo_bytes > 0 && "--size is too big for my tiny GLsizei, try increasing --slice")
#define PINGPONG(fp, FP)
#define COLOUR

Functions

void render_options_init (struct render_options *o)
void render_options_end (struct render_options *o)
void render_options_set_location (struct render_options *o, const mpfr_t cx, const mpfr_t cy, const mpfr_t r)
void render_options_copy (struct render_options *o, const struct render_options *p)
void render_begin (struct render *s)
void render_end (struct render *s)
static void fpX_start (struct render *s)
bool render_reshape (struct render *s, int new_width, int new_height, int new_slice, GLsizei *bytes_allocated)
static bool render_update_options (struct render *s, const struct render_options *o)
void render_start (struct render *s, const struct render_options *o)
void render_cont (struct render *s)
void render_next_slice (struct render *s)
void fp32_start (struct render *s)
void fp64_start (struct render *s)
bool fpxx_start_atom_abort (void *userdata)
void fpxx_start (struct render *s)
bool render_calculate (struct render *s, const struct render_options *o, struct poll *poll)
bool render_display (struct render *s, const struct render_options *o, struct poll *poll)
enum render_result render_do (struct render *render, struct render_options *render_options, struct poll *poll)

Variables

const char * render_method_name [3]

Detailed Description

Manage calculation and rendering.

Definition in file render.c.

Macro Definition Documentation

#define CHECK   assert(vbo_bytes > 0 && "--size is too big for my tiny GLsizei, try increasing --slice")

Referenced by render_reshape().

#define COLOUR
Value:
do{ \
fp32_colour_do(&s->fp32_colour, o->win_width, o->win_height, o->width, o->height, s->timeout || s->all_done, s->pass > 0 || s->all_done, o->show_glitches, pow(0.5, o->weight), o->slice, s->slice_n); \
glBindFramebuffer(GL_FRAMEBUFFER, s->fbo);D; \
poll_swap_buffers(poll); \
}while(0)

Referenced by render_display().

#define PINGPONG (   fp,
  FP 
)
Value:
void fp##_pingpong(struct render *s) { \
if (! (s->active_count == 0)) { \
fp##_step_do(&s->fp##_step, &s->active_count, s->vbo[1], s->query); \
GLuint unescaped = 0; \
fp##_unescaped_do(&s->fp##_unescaped, &unescaped, s->active_count, s->vbo[0], s->query); \
int escaped = s->active_count - unescaped; \
if (escaped) { \
fp##_escaped_do(&s->fp##_escaped, s->active_count); \
} \
if (completion_update(&s->completion, unescaped, escaped, 1, s->options.sharpness)) { \
render_next_slice(s); \
} \
} else { \
s->slice_done = false; \
s->idle.f = fp##_pingpong; \
} \
s->active_count = unescaped; \
} else { \
render_next_slice(s); \
} \
}

Definition at line 277 of file render.c.

Function Documentation

void fp32_start ( struct render s)

Definition at line 305 of file render.c.

References render::active_count, render_options::centerx, render_options::centery, render::completion, completion_start(), render::escaperadius2, idlefunc_t::f, render::fbo, render::fp32_escaped, fp32_escaped_start(), render::fp32_fillc, fp32_fillc_do(), render::fp32_init, fp32_init_do(), render::fp32_step, fp32_step_start(), render::fp32_unescaped, fp32_unescaped_start(), render_options::height, render::idle, render::options, render::pass, render::query, render_options::radius, render_options::slice, render::slice_done, render::slice_n, render::slice_table, slice_table_coords(), render::tex, render::tex2, render::vbo, and render_options::width.

Referenced by fpX_start().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fp64_start ( struct render s)

Definition at line 319 of file render.c.

References render::active_count, render_options::centerx, render_options::centery, render::completion, completion_start(), render::escaperadius2, idlefunc_t::f, render::fbo, render::fp32_fillc, fp32_fillc_do(), render::fp64_escaped, fp64_escaped_start(), render::fp64_init, fp64_init_do(), render::fp64_step, fp64_step_start(), render::fp64_unescaped, fp64_unescaped_start(), render_options::height, render::idle, render::options, render::pass, render::query, render_options::radius, render_options::slice, render::slice_done, render::slice_n, render::slice_table, slice_table_coords(), render::tex, render::tex2, render::vbo, and render_options::width.

Referenced by fpX_start().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fpX_start ( struct render s)
static

Definition at line 419 of file render.c.

References D, render::fbo, fp32_start(), fp64_start(), fpxx_start(), LOG_DEBUG, log_message, render_options::method, render::options, render_method_fp32, render_method_fp64, render_method_fpxx, and render::slice_n.

Referenced by render_cont(), render_next_slice(), and render_start().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fpxx_start ( struct render s)
bool fpxx_start_atom_abort ( void *  userdata)

Definition at line 333 of file render.c.

References render::aborted, render::poll, poll_abort, poll_continue, poll_display, poll_timeout, poll_ui(), and render::timeout.

Referenced by fpxx_start().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool render_calculate ( struct render s,
const struct render_options o,
struct poll poll 
)

Definition at line 429 of file render.c.

References render::aborted, debug_message, idlefunc_t::f, render::idle, render::poll, poll_abort, poll_continue, poll_display, poll_timeout, poll_ui(), ref_set_delete(), render::refs, render_display(), render_start(), render::render_time, render_update_options(), stopwatch_elapsed(), stopwatch_reset(), and render::timeout.

Referenced by render_do().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void render_cont ( struct render s)

Definition at line 256 of file render.c.

References render::all_done, debug_message, idlefunc_t::f, fpX_start(), render::idle, LOG_INFO, log_message, render_options::method, render::options, render::pass, render_method_fpxx, and render::slice_n.

Referenced by render_display().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool render_display ( struct render s,
const struct render_options o,
struct poll poll 
)
enum render_result render_do ( struct render render,
struct render_options render_options,
struct poll poll 
)

Definition at line 539 of file render.c.

References render::aborted, render_aborted, render_calculate(), render_complete, render_display(), and render::timeout.

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void render_next_slice ( struct render s)

Definition at line 268 of file render.c.

References render::done, idlefunc_t::f, fpX_start(), render::idle, render::options, render_options::slice, and render::slice_n.

+ Here is the call graph for this function:

void render_options_end ( struct render_options o)

Definition at line 40 of file render.c.

References render_options::centerx, render_options::centery, and render_options::radius.

Referenced by render_end().

+ Here is the caller graph for this function:

void render_options_init ( struct render_options o)

Definition at line 33 of file render.c.

References render_options::centerx, render_options::centery, and render_options::radius.

Referenced by main(), and render_begin().

+ Here is the caller graph for this function:

void render_options_set_location ( struct render_options o,
const mpfr_t  cx,
const mpfr_t  cy,
const mpfr_t  r 
)

Definition at line 46 of file render.c.

References render_options::centerx, render_options::centery, FP64, render_options::height, render_options::method, pxbits(), render_options::radius, render_method_fp32, render_method_fp64, and render_method_fpxx.

Referenced by main(), and poll_ui().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool render_reshape ( struct render s,
int  new_width,
int  new_height,
int  new_slice,
GLsizei *  bytes_allocated 
)

Definition at line 196 of file render.c.

References CHECK, D, DE, render_options::height, render::options, render_options::slice, TEX_FILLC, TEX_RAW, TEX_RGB, render::vbo, and render_options::width.

Referenced by main(), and render_update_options().

+ Here is the caller graph for this function:

void render_start ( struct render s,
const struct render_options o 
)

Definition at line 242 of file render.c.

References render::all_done, debug_message, render::done, idlefunc_t::f, render::fp32_colour, fp32_colour_clear(), fpX_start(), render_options::height, render::idle, LOG_INFO, log_message, render::options, render::pass, render_options_copy(), render::slice_done, render::slice_n, render::timeout, and render_options::width.

Referenced by render_calculate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool render_update_options ( struct render s,
const struct render_options o 
)
static

Definition at line 228 of file render.c.

References render_options::calculate_de, render_options::centerx, render_options::centery, render_options::height, render_options::method, render::options, render_options::radius, render_options_copy(), render_reshape(), render_options::slice, and render_options::width.

Referenced by render_calculate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const char* render_method_name[3]
Initial value:
{
"fp32",
"fp64",
"fpxx"
}

Definition at line 27 of file render.c.

Referenced by log_result().