if( source_mode == k_audio_source_mono )
{
i16 *src_buffer = ent->info.source->data,
- *src = &src_buffer[cursor];
+ *src = &src_buffer[cursor];
audio_decode_uncompressed_mono( src, samples_this_run, dst );
}
#include "vg/vg_ui.h"
#include "vg/vg_log.h"
+#define VG_VAR_F32_PERSISTENT( NAME ) \
+ vg_var_push( (struct vg_var){ \
+ .name = #NAME, \
+ .data = &NAME, \
+ .data_type = k_var_dtype_f32, \
+ .persistent = 1 \
+ });
+
+#define VG_VAR_F32( NAME ) \
+ vg_var_push( (struct vg_var){ \
+ .name = #NAME, \
+ .data = &NAME, \
+ .data_type = k_var_dtype_f32, \
+ });
+
+#define VG_VAR_I32_PERSISTENT( NAME ) \
+ vg_var_push( (struct vg_var){ \
+ .name = #NAME, \
+ .data = &NAME, \
+ .data_type = k_var_dtype_i32, \
+ .persistent = 1 \
+ });
+
+#define VG_VAR_I32( NAME ) \
+ vg_var_push( (struct vg_var){ \
+ .name = #NAME, \
+ .data = &NAME, \
+ .data_type = k_var_dtype_i32, \
+ });
+
typedef struct vg_var vg_var;
typedef struct vg_cmd vg_cmd;
int persistent; /* Should this var be stored to cfg/auto.conf? */
}
- vars[ 32 ];
+ vars[ 64 ];
struct vg_cmd
{
--- /dev/null
+#ifndef VG_GRAPH_H
+#define VG_GRAPH_H
+
+#define VG_GAME
+#include "vg/vg.h"
+
+enum { k_vg_graph_max_samples = 1024 };
+enum { k_vg_graph_max_vertices = k_vg_graph_max_samples * 2 };
+enum { k_vg_graph_max_indices = (k_vg_graph_max_samples-1) * 6 };
+
+struct vg_graph
+{
+ GLuint vao, vbo, ebo;
+};
+
+VG_STATIC void vg_graph_init( struct vg_graph *graph )
+{
+ vg_acquire_thread_sync();
+ {
+ glGenVertexArrays( 1, &graph->vao );
+ glGenBuffers( 1, &graph->vbo );
+ glGenBuffers( 1, &graph->ebo );
+ glBindVertexArray( graph->vao );
+
+ size_t stride = sizeof(v2f);
+
+ glBindBuffer( GL_ARRAY_BUFFER, graph->vbo );
+ glBufferData( GL_ARRAY_BUFFER, k_vg_graph_max_vertices*stride,
+ NULL, GL_DYNAMIC_DRAW );
+
+ glBindVertexArray( graph->vao );
+ glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, graph->ebo );
+ glBufferData( GL_ELEMENT_ARRAY_BUFFER,
+ k_vg_graph_max_indices*sizeof(u16), NULL,
+ GL_DYNAMIC_DRAW );
+
+ glVertexAttribPointer( 0, 2, GL_FLOAT, GL_FALSE, stride, (void *)0 );
+ glEnableVertexAttribArray( 0 );
+ VG_CHECK_GL_ERR();
+ }
+}
+
+VG_STATIC void vg_graph_add_sample( struct vg_graph *graph )
+{
+
+}
+
+#endif /* VG_GRAPH_H */
{
const char *name;
- u64 samples[ VG_PROFILE_SAMPLE_COUNT ];
- u32 buffer_count, buffer_current;
+ float samples[ VG_PROFILE_SAMPLE_COUNT ];
+ u32 buffer_count, buffer_current;
enum profile_mode
{
if( profile->buffer_current >= VG_PROFILE_SAMPLE_COUNT )
profile->buffer_current = 0;
- profile->samples[ profile->buffer_current ] = 0;
+ profile->samples[ profile->buffer_current ] = 0.0f;
}
VG_STATIC void vg_profile_end( struct vg_profile *profile )
if( profile->mode == k_profile_mode_frame )
{
- profile->samples[ profile->buffer_current ] = delta;
+ profile->samples[ profile->buffer_current ] = (float)delta;
vg_profile_increment( profile );
}
else
}
}
+VG_STATIC void vg_profile_graph_sample( struct vg_profile *profile, float s )
+{
+ profile->samples[ profile->buffer_current ] = s;
+ vg_profile_increment( profile );
+}
+
VG_STATIC void vg_profile_drawn( struct vg_profile **profiles, u32 count,
float budget, ui_rect panel, u32 colour_offset )
{
u32 colours[] = { 0xff0000ff, 0xff00ff00, 0xff00ffff, 0xffff0000,
0xffff00ff, 0xffffff00 };
- double rate_mul = 1000.0 / (double)SDL_GetPerformanceFrequency();
+ float rate_mul = 1000.0f / (float)SDL_GetPerformanceFrequency();
for( int i=0; i<VG_PROFILE_SAMPLE_COUNT-1; i++ )
{
if( ptrs[j] < 0 )
ptrs[j] = VG_PROFILE_SAMPLE_COUNT-1;
- float sample = (double)profiles[j]->samples[ptrs[j]] * rate_mul,
+ float sample = profiles[j]->samples[ptrs[j]] * rate_mul,
px = (total / (budget)) * sw,
wx = (sample / (budget)) * sw;