ACMX 2.139.0
Dual-Backend Real-Time GPU Video Synthesis
Loading...
Searching...
No Matches
ShaderLibrary Class Reference

Manages the complete collection of compiled GLSL shader programs. More...

Classes

struct  ProgramData
 Cached uniform locations for a single compiled shader program. More...

Public Member Functions

void activeTime (bool t)
 Enable or disable automatic wall-clock time advancement.
int audioBufferCount () const
 Number of spectrum history array layers currently configured.
bool audioDelta () const
void audioTime (bool t)
 Enable or disable audio-reactive time advancement.
bool buildShaderCache (gl::GLWindow *win, const std::string &library_path, const std::string &vert_2d, const std::string &vert_3d, mx::Font *loadingFont=nullptr)
 Build the on-disk shader binary cache for all shaders in a library.
int cacheSize () const
 Active cache ring size as seen by the shader-compile path.
void clear ()
 Remove all compiled shader programs and reset the library index.
bool compileShaderCacheEntry (const std::string &shader_file, const std::string &full_path, const std::string &vert_2d, const std::string &vert_3d, bool include_3d, ShaderCacheEntry &entry)
 Compile one shader and replace a single binary-cache entry.
void dec ()
 Move to the previous shader in the library (clamped at zero).
void decTime (float value)
 Step time_f backward manually (when auto-time is paused).
void decTimeSpeed (float step)
 Decrease the time_f speed multiplier by step, clamped to zero.
bool dispatchCompute2D (gl::GLWindow *win, size_t idx, GLuint input_texture, GLuint output_texture)
 Run a compute library slot as a full-frame image pass.
void enableCache (bool enable)
 Enable or disable use of the ac::ShaderProgram binary-cache wrapper.
void enableDualMode (bool enable)
 Enable or disable dual-mode compilation (2D + 3D vertex shaders).
void event (SDL_Event &e)
 Reserved for future SDL event handling inside the library.
int findShaderByName (const std::string &name)
 Look up a shader index by its stem name.
bool get3D () const
 Return true if currently in 3D mode.
float getAmp () const
float getAmpUntouched () const
std::string getFullShaderName ()
 Get a display string for the currently active shader.
std::string getFullShaderName (const std::vector< int > &pass_list)
 Get a display string including the active shader and the pass list.
gl::ShaderProgram * getShader (size_t idx)
 Get a shader by index from the active set (2D or 3D).
gl::ShaderProgram * getShader2D (size_t idx)
 Get a 2D shader by index (regardless of current 2D/3D mode).
gl::ShaderProgram * getShader3D (size_t idx)
 Get a 3D shader by index (regardless of current 2D/3D mode).
std::string getShaderNameByIndex (size_t idx)
 Get the stem name of a shader by its numeric index.
void inc ()
 Advance to the next shader in the library (clamped at the end).
void incTime (float value)
 Step time_f forward manually (when auto-time is paused).
void incTimeSpeed (float step)
 Increase the time_f speed multiplier by step.
size_t index ()
 Return the current shader index.
void is3D (bool is3d)
 Switch between the 2D and 3D program vectors.
bool isBypassed () const
 Return true if shader processing is currently bypassed.
bool isCache ()
 Check whether the currently active shader is a texture-cache shader.
bool isCache2D (size_t idx) const
 Check whether the 2D shader at idx is a texture-cache shader.
bool isCompute (size_t idx) const
 Return whether a library slot contains an executable compute program.
bool isDualMode () const
 Return whether dual mode (2D + 3D) is active.
bool loadFromCache (gl::GLWindow *win, const std::string &library_path, mx::Font &loadingFont, const std::string &vert_2d="", const std::string &vert_3d="")
 Attempt to load all shader programs from the binary cache file.
void loadProgram (gl::GLWindow *win, const std::string text)
 Compile a single fragment shader with the 2D (and optionally 3D) vertex shader.
void loadPrograms (gl::GLWindow *win, const std::string &text, mx::Font &loadingFont)
 Compile every shader listed in the preferred manifest.
void loadProgramsWithCache (gl::GLWindow *win, const std::string &text, mx::Font &loadingFont)
 Try loading a full shader library from the binary cache, with fallback.
bool reloadProgram (gl::GLWindow *win, size_t shader_index, const std::string &fragment_path, std::string &error)
 Recompile one library slot and atomically replace it on success.
bool removeBrokenShaders (gl::GLWindow *win, const std::string &library_path, const std::string &vert_2d, const std::string &vert_3d)
 Compile every shader in a library and rewrite its manifest without the ones that fail to compile.
void setAudioBufferCount (int n)
 Configure the runtime depth of spectrum_history.
void setAudioWarmupEnvelope (float env)
 Set startup audio warmup envelope in [0,1] for uniform scaling.
void setCacheSize (int size)
 Set the active texture-cache ring length.
void setCustomUniformValues (const std::vector< ShaderManifestData::CustomUniform > &uniforms)
void setFPS (float fps_value)
 Upload the current frame-rate to the active shader's iFrameRate uniform.
void setHistoryHead (int layer)
 Set the physical array layer that represents logical history zero.
void setHistoryTextureArray (bool enabled)
 Select the cache sampler representation before compiling shaders.
void setIndex (size_t i)
 Set the active shader by index.
void setMidiSlider (int idx, float val)
 Set a MIDI slider value (index 0–3, value 0.0–1.0).
void setNormalizedTime (bool enabled)
 Select fixed-per-frame or elapsed real-time advancement.
void setSpectrumHistoryHead (int layer)
 Set the physical array layer containing the newest FFT frame.
void setTimeSpeed (float speed)
 Set the absolute time_f advancement speed multiplier.
void setUniform (const std::string &name, int value)
 Bind a cache sampler slot for texture-cache shaders.
void setupProgramUniforms (gl::GLWindow *win, gl::ShaderProgram *prog, std::unordered_map< int, ProgramData > &names, size_t pos, const std::string &text)
 Query and store all uniform locations for a compiled shader program.
void setVideoFPS (double fps)
 Set the frame rate used by normalized time advancement.
gl::ShaderProgram * shader ()
 Return a raw pointer to the currently active ShaderProgram.
 ShaderLibrary (const acmx2::audio::AudioAnalyzer *analyzer=nullptr)
size_t size ()
 Number of programs in the currently active set (2D or 3D).
size_t size2d ()
 Number of 2D programs.
size_t size3d ()
 Number of 3D programs.
void stepAcidCamUniforms ()
 Advance acidcamGL-compatible colour-alpha oscillators and random values.
bool timeActive () const
bool timeAudio () const
void toggle3D ()
 Toggle between 2D and 3D rendering modes.
void toggleAudioDelta ()
 Toggle delta-time scaling for audio-reactive mode.
void toggleBypass ()
 Toggle the shader bypass flag.
void update (gl::GLWindow *win)
 Per-frame update: advance time_f, upload all uniforms to the active shader.
void updateShaderUniforms (gl::GLWindow *win, size_t idx)
 Upload all uniforms for an arbitrary shader in the active set.
void updateShaderUniforms2D (gl::GLWindow *win, size_t idx)
 Upload all uniforms for a shader in the 2D set specifically.
void uploadAcidCamUniforms (const ProgramData &n, size_t idx)
void uploadCustomUniforms (const ProgramData &data) const
 Upload configured custom uniforms to the GPU for the given program.
void useProgram ()
 Activate the current shader program on the GPU (glUseProgram).
 ~ShaderLibrary ()

Private Member Functions

std::unique_ptr< gl::ShaderProgram > compileProgramForReload (const std::string &vert_path, const std::string &frag_path, std::string &error) const
 Compile a replacement program while retaining complete driver diagnostics.
std::string injectShaderSize (const std::string &frag_path, int size, bool use_array) const
 Read a fragment shader file and inject #define SIZE N immediately after its #version directive.
bool loadProgramWithSize (gl::ShaderProgram *prog, const std::string &vert_path, const std::string &frag_path) const
 Compile a shader from file pair, injecting #define SIZE N into the fragment source.
std::unique_ptr< gl::ShaderProgram > makeComputeProgram (const std::string &compute_path, std::string &error) const
 Compile and link a standalone OpenGL compute program.
std::unique_ptr< gl::ShaderProgram > makePassthroughProgram (const std::string &vert_path)
 Compile a minimal passthrough fragment shader as a stand-in.
std::unique_ptr< gl::ShaderProgram > makeProgram ()
uint64_t preparedFragmentHash (const std::string &frag_path) const

Static Private Member Functions

static std::string programInfoLog (GLuint program)
static std::string shaderCacheFilePath (const std::string &assets_path, const std::string &library_path, int cache_size=8, bool use_array=false)
 Resolve the on-disk path for the shader binary cache file.
static std::string shaderInfoLog (GLuint shader)

Private Attributes

float alpha = 0.1f
bool alpha_dir = true
const acmx2::audio::AudioAnalyzer * audio_analyzer = nullptr
int audio_buffer_count = 0
 Runtime depth of the spectrum history array.
bool audio_delta = false
float audio_warmup_envelope = 1.0f
 Startup ramp [0..1] used to soften initial audio-reactive intensity.
int cache_size = 8
 Active runtime size of the texture-cache ring buffer.
float clickStartX = 0.0f
float clickStartY = 0.0f
float color_alpha_b = 0.3f
float color_alpha_g = 0.2f
float color_alpha_r = 0.1f
std::vector< std::regex > custom_uniform_declarations
std::vector< std::regex > custom_uniform_references
std::vector< ShaderManifestData::CustomUniform > custom_uniforms
bool dual_mode = false
int history_head = 0
glm::vec4 inc_value = glm::vec4(0.0f)
glm::vec4 inc_valuex = glm::vec4(0.0f)
bool is3d = false
bool isDraggingLeft = false
bool isDraggingRight = false
float lastClickX = 0.0f
float lastClickY = 0.0f
size_t library_index = 0
float midi_slider [4] = {0.0f, 0.0f, 0.0f, 0.0f}
 MIDI CC slider values (0.0–1.0) for shader uniforms slider1–slider4.
bool normalized_time = false
glm::vec4 optx = glm::vec4(0.5f, 0.5f, 0.5f, 0.5f)
std::vector< ShaderProgramKind > program_kinds
std::unordered_map< int, ProgramData > program_names_2d
std::unordered_map< int, ProgramData > program_names_3d
std::vector< std::unique_ptr< gl::ShaderProgram > > programs_2d
std::vector< std::unique_ptr< gl::ShaderProgram > > programs_3d
glm::vec4 random_var = glm::vec4(0.0f)
bool restore_black = false
bool shader_bypass = false
int spectrum_history_head = 0
 Physical layer containing the newest spectrum.
bool time_active = true
bool time_audio = false
float time_f = 1.0
float time_speed = 1.0f
bool use_cache = false
bool use_history_array = false
double video_fps = 0.0
bool wasClicked = false

Detailed Description

Manages the complete collection of compiled GLSL shader programs.

Responsibilities:

  • Load a single shader or a full library from JSON or text manifests.
  • Optionally build and restore a binary shader cache for fast startup.
  • Track and upload all shader uniforms each frame (time, mouse, audio, etc.).
  • Support dual-mode (2D + 3D vertex shader) compilation.
  • Provide navigation (inc/dec/setIndex) and bypass controls.

acidcamGL-compatible uniforms (value_alpha_r/g/b, optx, random_var, etc.) are maintained here so legacy shaders work unmodified.

Definition at line 3067 of file ACMX2/acmx.cpp.

Constructor & Destructor Documentation

◆ ShaderLibrary()

ShaderLibrary::ShaderLibrary ( const acmx2::audio::AudioAnalyzer * analyzer = nullptr)
inlineexplicit

Definition at line 3617 of file ACMX2/acmx.cpp.

References audio_analyzer.

◆ ~ShaderLibrary()

ShaderLibrary::~ShaderLibrary ( )
inline

Definition at line 3648 of file ACMX2/acmx.cpp.

Member Function Documentation

◆ activeTime()

void ShaderLibrary::activeTime ( bool t)
inline

Enable or disable automatic wall-clock time advancement.

When disabled, time_f only changes via manual incTime/decTime or audio-reactive mode, allowing the user to freeze and scrub the shader's temporal state.

Parameters
tTrue to enable, false to pause.

Definition at line 6250 of file ACMX2/acmx.cpp.

References time_active.

◆ audioBufferCount()

int ShaderLibrary::audioBufferCount ( ) const
inline

Number of spectrum history array layers currently configured.

Definition at line 4097 of file ACMX2/acmx.cpp.

References audio_buffer_count.

◆ audioDelta()

bool ShaderLibrary::audioDelta ( ) const
inline

Definition at line 6284 of file ACMX2/acmx.cpp.

References audio_delta.

◆ audioTime()

void ShaderLibrary::audioTime ( bool t)
inline

Enable or disable audio-reactive time advancement.

When enabled, time_f is driven by analyzer amplitude and sensitivity instead of wall-clock delta, making the shader evolve in sync with the audio input.

Parameters
tTrue to enable audio-reactive time.

Definition at line 6266 of file ACMX2/acmx.cpp.

References time_audio.

◆ buildShaderCache()

bool ShaderLibrary::buildShaderCache ( gl::GLWindow * win,
const std::string & library_path,
const std::string & vert_2d,
const std::string & vert_3d,
mx::Font * loadingFont = nullptr )
inline

Build the on-disk shader binary cache for all shaders in a library.

Parameters
winGL window (provides vertex shader paths).
library_pathDirectory containing a shader manifest and GLSL files.
vert_2dPath to the 2D vertex shader.
vert_3dPath to the 3D vertex shader.
loadingFontOptional font used to render rebuild progress.
Returns
true on success.

Definition at line 4699 of file ACMX2/acmx.cpp.

References ShaderCacheEntry::binary_2d, ShaderCacheEntry::binary_3d, cache_size, collectShaderLibraryEntries(), compileShaderCacheEntry(), ShaderManifestData::custom_uniforms, ShaderCache::dual_mode, dual_mode, ShaderCache::entries, ShaderCacheEntry::failed, ShaderCacheEntry::format_2d, ShaderCacheEntry::format_3d, ShaderCache::gl_renderer, ShaderCache::gl_version, glGetProgramBinaryFunc, isComputeShaderFile(), loadProgramBinaryFunctions(), loadProgramWithSize(), loadShaderManifest(), preparedFragmentHash(), safeGLString(), ShaderCache::save(), setCustomUniformValues(), ShaderCacheEntry::shader_name, shaderCacheFilePath(), ShaderCacheEntry::source_hash, and use_history_array.

Referenced by loadProgramsWithCache(), and main().

◆ cacheSize()

int ShaderLibrary::cacheSize ( ) const
inline

Active cache ring size as seen by the shader-compile path.

Definition at line 3692 of file ACMX2/acmx.cpp.

References cache_size.

Referenced by ACView::bindPassHistoryTextures().

◆ clear()

void ShaderLibrary::clear ( )
inline

Remove all compiled shader programs and reset the library index.

Releases every unique_ptr in both the 2D and 3D program vectors, clears the associated uniform-location maps, and resets the current library_index to zero. Called before rebuilding the shader cache when a count or hash mismatch is detected.

Definition at line 3710 of file ACMX2/acmx.cpp.

References library_index, program_kinds, program_names_2d, program_names_3d, programs_2d, and programs_3d.

Referenced by main().

◆ compileProgramForReload()

std::unique_ptr< gl::ShaderProgram > ShaderLibrary::compileProgramForReload ( const std::string & vert_path,
const std::string & frag_path,
std::string & error ) const
inlineprivate

Compile a replacement program while retaining complete driver diagnostics.

Definition at line 3494 of file ACMX2/acmx.cpp.

References cache_size, injectShaderSize(), isComputeShaderFile(), makeComputeProgram(), programInfoLog(), shader(), shaderInfoLog(), and use_history_array.

Referenced by reloadProgram().

◆ compileShaderCacheEntry()

bool ShaderLibrary::compileShaderCacheEntry ( const std::string & shader_file,
const std::string & full_path,
const std::string & vert_2d,
const std::string & vert_3d,
bool include_3d,
ShaderCacheEntry & entry )
inline

Compile one shader and replace a single binary-cache entry.

A failed compile is recorded in the entry so its manifest slot remains stable and can use the normal passthrough fallback.

Definition at line 4598 of file ACMX2/acmx.cpp.

References ShaderCacheEntry::binary_2d, ShaderCacheEntry::binary_3d, Compute, compute_shader_supported, ComputeUnavailable, ShaderCacheEntry::failed, ShaderCacheEntry::format_2d, ShaderCacheEntry::format_3d, Fragment, glGetProgramBinaryFunc, isComputeShaderFile(), ShaderCacheEntry::kind, loadProgramWithSize(), makeComputeProgram(), preparedFragmentHash(), ShaderCacheEntry::shader_name, and ShaderCacheEntry::source_hash.

Referenced by buildShaderCache(), and loadFromCache().

◆ dec()

void ShaderLibrary::dec ( )
inline

Move to the previous shader in the library (clamped at zero).

Definition at line 5502 of file ACMX2/acmx.cpp.

References library_index, and setIndex().

◆ decTime()

void ShaderLibrary::decTime ( float value)
inline

Step time_f backward manually (when auto-time is paused).

Clamps at 1.0 to avoid negative or zero time values.

Parameters
valueAmount to subtract from time_f.

Definition at line 6224 of file ACMX2/acmx.cpp.

References time_active, and time_f.

◆ decTimeSpeed()

void ShaderLibrary::decTimeSpeed ( float step)
inline

Decrease the time_f speed multiplier by step, clamped to zero.

Parameters
stepAmount to subtract (e.g. 0.1).

Definition at line 4130 of file ACMX2/acmx.cpp.

References time_speed.

Referenced by ACView::pollMidi().

◆ dispatchCompute2D()

bool ShaderLibrary::dispatchCompute2D ( gl::GLWindow * win,
size_t idx,
GLuint input_texture,
GLuint output_texture )
inline

Run a compute library slot as a full-frame image pass.

Compute shaders read the input through uniform sampler2D samp on texture unit 0 and write an RGBA16F image on image unit 0. The image may be declared with explicit binding = 0, or use one of the conventional names outputImage, output_image, destTex, or img_output.

Definition at line 5443 of file ACMX2/acmx.cpp.

References compute_shader_supported, ShaderLibrary::ProgramData::compute_work_group_size, isCompute(), program_names_2d, programs_2d, and updateShaderUniforms2D().

Referenced by ACView::runComputePass().

◆ enableCache()

void ShaderLibrary::enableCache ( bool enable)
inline

Enable or disable use of the ac::ShaderProgram binary-cache wrapper.

When enabled, makeProgram() returns an ac::ShaderProgram instead of the base gl::ShaderProgram, allowing shader binaries to be loaded from the on-disk cache rather than recompiled from source.

Parameters
enableTrue to use the caching wrapper.

Definition at line 3667 of file ACMX2/acmx.cpp.

References use_cache.

◆ enableDualMode()

void ShaderLibrary::enableDualMode ( bool enable)
inline

Enable or disable dual-mode compilation (2D + 3D vertex shaders).

When dual mode is on, every shader source is compiled twice: once with data/vert.glsl (flat quad) and once with data/vertex.glsl (3D model). This doubles compilation time but allows runtime switching between 2D and 3D rendering with a single key press.

Parameters
enableTrue to compile both shader variants.

Definition at line 4152 of file ACMX2/acmx.cpp.

References dual_mode.

Referenced by main().

◆ event()

void ShaderLibrary::event ( SDL_Event & e)
inline

Reserved for future SDL event handling inside the library.

Definition at line 6292 of file ACMX2/acmx.cpp.

◆ findShaderByName()

int ShaderLibrary::findShaderByName ( const std::string & name)
inline

Look up a shader index by its stem name.

Parameters
nameStem name to search for (case-sensitive).
Returns
Zero-based index, or -1 if not found.

Definition at line 5514 of file ACMX2/acmx.cpp.

References is3d, program_names_2d, and program_names_3d.

◆ get3D()

bool ShaderLibrary::get3D ( ) const
inline

Return true if currently in 3D mode.

Definition at line 4177 of file ACMX2/acmx.cpp.

References is3d.

◆ getAmp()

float ShaderLibrary::getAmp ( ) const
inline

◆ getAmpUntouched()

float ShaderLibrary::getAmpUntouched ( ) const
inline

Definition at line 6289 of file ACMX2/acmx.cpp.

References audio_analyzer, and acmx2::audio::AudioAnalyzer::sensitivity().

◆ getFullShaderName() [1/2]

std::string ShaderLibrary::getFullShaderName ( )
inline

Get a display string for the currently active shader.

Returns a string of the form "42: bloom" (index + stem name). Used for the on-screen overlay and window title.

Returns
Formatted shader name, or empty string if index is invalid.

Definition at line 5019 of file ACMX2/acmx.cpp.

References is3d, library_index, program_names_2d, and program_names_3d.

◆ getFullShaderName() [2/2]

std::string ShaderLibrary::getFullShaderName ( const std::vector< int > & pass_list)
inline

Get a display string including the active shader and the pass list.

Format: "42: bloom [edge, blur, vhs]" when multi-pass is active.

Parameters
pass_listVector of additional shader indices applied as post-passes.
Returns
Formatted composite name.

Definition at line 5049 of file ACMX2/acmx.cpp.

References is3d, library_index, program_names_2d, and program_names_3d.

◆ getShader()

gl::ShaderProgram * ShaderLibrary::getShader ( size_t idx)
inline

Get a shader by index from the active set (2D or 3D).

Parameters
idxZero-based program index.
Returns
Pointer to the program, or nullptr if out of range.

Definition at line 5546 of file ACMX2/acmx.cpp.

References is3d, programs_2d, and programs_3d.

◆ getShader2D()

gl::ShaderProgram * ShaderLibrary::getShader2D ( size_t idx)
inline

Get a 2D shader by index (regardless of current 2D/3D mode).

Parameters
idxZero-based program index in the 2D vector.
Returns
Pointer, or nullptr if out of range.

Definition at line 5558 of file ACMX2/acmx.cpp.

References programs_2d.

◆ getShader3D()

gl::ShaderProgram * ShaderLibrary::getShader3D ( size_t idx)
inline

Get a 3D shader by index (regardless of current 2D/3D mode).

Parameters
idxZero-based program index in the 3D vector.
Returns
Pointer, or nullptr if out of range.

Definition at line 5569 of file ACMX2/acmx.cpp.

References programs_3d.

◆ getShaderNameByIndex()

std::string ShaderLibrary::getShaderNameByIndex ( size_t idx)
inline

Get the stem name of a shader by its numeric index.

Parameters
idxZero-based shader program index.
Returns
Shader name, or empty string if idx is out of range.

Definition at line 5033 of file ACMX2/acmx.cpp.

References is3d, program_names_2d, and program_names_3d.

◆ inc()

void ShaderLibrary::inc ( )
inline

Advance to the next shader in the library (clamped at the end).

Definition at line 5496 of file ACMX2/acmx.cpp.

References is3d, library_index, programs_2d, programs_3d, and setIndex().

◆ incTime()

void ShaderLibrary::incTime ( float value)
inline

Step time_f forward manually (when auto-time is paused).

Parameters
valueAmount to add to time_f.

Definition at line 6202 of file ACMX2/acmx.cpp.

References time_active, and time_f.

◆ incTimeSpeed()

void ShaderLibrary::incTimeSpeed ( float step)
inline

Increase the time_f speed multiplier by step.

Holding Page Up in the render loop calls this every frame, giving the user continuous acceleration control.

Parameters
stepAmount to add to the speed (e.g. 0.1).

Definition at line 4120 of file ACMX2/acmx.cpp.

References time_speed.

Referenced by ACView::pollMidi().

◆ index()

size_t ShaderLibrary::index ( )
inline

Return the current shader index.

Definition at line 5507 of file ACMX2/acmx.cpp.

References library_index.

Referenced by loadFromCache(), setCustomUniformValues(), setFPS(), setUniform(), shader(), update(), and useProgram().

◆ injectShaderSize()

std::string ShaderLibrary::injectShaderSize ( const std::string & frag_path,
int size,
bool use_array ) const
inlineprivate

Read a fragment shader file and inject #define SIZE N immediately after its #version directive.

GLSL sampler array sizes must be compile-time constants, so the cache-frame count has to be baked into the source string before glShaderSource. This helper preserves the original source line numbering as best it can: the inserted line replaces no existing line, only shifts everything after #version down by one.

If the file cannot be opened the returned string is empty (the caller falls through to the file-based loader, which surfaces the proper error).

Parameters
frag_pathFilesystem path to the fragment .glsl source.
sizeCache ring length to bake as SIZE.
use_arrayWhether to inject the texture-array compatibility define.
Returns
Modified fragment source, or empty string on read failure.

Definition at line 3270 of file ACMX2/acmx.cpp.

References custom_uniform_declarations, custom_uniform_references, custom_uniforms, and size().

Referenced by compileProgramForReload(), loadProgramWithSize(), makeComputeProgram(), and preparedFragmentHash().

◆ is3D()

void ShaderLibrary::is3D ( bool is3d)
inline

Switch between the 2D and 3D program vectors.

Parameters
is3dTrue selects the 3D shader set; false selects 2D.

Definition at line 4078 of file ACMX2/acmx.cpp.

References is3d.

◆ isBypassed()

bool ShaderLibrary::isBypassed ( ) const
inline

Return true if shader processing is currently bypassed.

Definition at line 4194 of file ACMX2/acmx.cpp.

References shader_bypass.

◆ isCache()

bool ShaderLibrary::isCache ( )
inline

Check whether the currently active shader is a texture-cache shader.

Returns true when the shader name contains the substring "cache", which signals ACView::draw() to bind the 8 historical textures.

Returns
True if the current shader is a cache shader.

Definition at line 5411 of file ACMX2/acmx.cpp.

References is3d, library_index, program_names_2d, and program_names_3d.

◆ isCache2D()

bool ShaderLibrary::isCache2D ( size_t idx) const
inline

Check whether the 2D shader at idx is a texture-cache shader.

Used by the multipass pipeline (which always renders pass shaders out of the 2D set) to decide per-pass whether to bind the cache texture units.

Definition at line 5425 of file ACMX2/acmx.cpp.

References program_names_2d.

Referenced by ACView::bindPassHistoryTextures().

◆ isCompute()

bool ShaderLibrary::isCompute ( size_t idx) const
inline

Return whether a library slot contains an executable compute program.

Definition at line 5433 of file ACMX2/acmx.cpp.

References Compute, and program_kinds.

Referenced by dispatchCompute2D().

◆ isDualMode()

bool ShaderLibrary::isDualMode ( ) const
inline

Return whether dual mode (2D + 3D) is active.

Definition at line 4155 of file ACMX2/acmx.cpp.

References dual_mode.

◆ loadFromCache()

◆ loadProgram()

void ShaderLibrary::loadProgram ( gl::GLWindow * win,
const std::string text )
inline

Compile a single fragment shader with the 2D (and optionally 3D) vertex shader.

Loads data/vert.glsl (2D) and optionally data/vertex.glsl (3D) paired with the supplied fragment shader path. After compilation the shader's uniform locations are cached via setupProgramUniforms().

Parameters
winPointer to the GL window (provides asset path resolution).
textFull path to the fragment shader source file.
Exceptions
mx::Exceptionif either compile/link stage fails.

Definition at line 3730 of file ACMX2/acmx.cpp.

References Compute, compute_shader_supported, ComputeUnavailable, dual_mode, Fragment, isComputeShaderFile(), loadProgramWithSize(), makeComputeProgram(), makePassthroughProgram(), makeProgram(), program_kinds, program_names_2d, program_names_3d, programs_2d, programs_3d, and setupProgramUniforms().

◆ loadPrograms()

void ShaderLibrary::loadPrograms ( gl::GLWindow * win,
const std::string & text,
mx::Font & loadingFont )
inline

◆ loadProgramsWithCache()

void ShaderLibrary::loadProgramsWithCache ( gl::GLWindow * win,
const std::string & text,
mx::Font & loadingFont )
inline

Try loading a full shader library from the binary cache, with fallback.

Calls loadFromCache() first; if the cache is missing, stale, or incompatible, falls back to loadPrograms() (compile from source).

Parameters
winGL window for asset resolution.
textShader library directory containing a supported manifest.
loadingFontFont used for the on-screen progress overlay.

Definition at line 5372 of file ACMX2/acmx.cpp.

References buildShaderCache(), cache_size, ShaderManifestData::custom_uniforms, loadFromCache(), loadPrograms(), loadShaderManifest(), program_kinds, program_names_2d, program_names_3d, programs_2d, programs_3d, setCustomUniformValues(), shaderCacheFilePath(), and use_history_array.

◆ loadProgramWithSize()

bool ShaderLibrary::loadProgramWithSize ( gl::ShaderProgram * prog,
const std::string & vert_path,
const std::string & frag_path ) const
inlineprivate

Compile a shader from file pair, injecting #define SIZE N into the fragment source.

Falls back to the plain file-based loader if the fragment cannot be read in-process.

The vertex source is not modified — SIZE is only meaningful for fragment-side cache shaders.

Returns
true if the program compiled and linked successfully.

Definition at line 3354 of file ACMX2/acmx.cpp.

References cache_size, injectShaderSize(), and use_history_array.

Referenced by buildShaderCache(), compileShaderCacheEntry(), loadProgram(), and removeBrokenShaders().

◆ makeComputeProgram()

std::unique_ptr< gl::ShaderProgram > ShaderLibrary::makeComputeProgram ( const std::string & compute_path,
std::string & error ) const
inlineprivate

◆ makePassthroughProgram()

std::unique_ptr< gl::ShaderProgram > ShaderLibrary::makePassthroughProgram ( const std::string & vert_path)
inlineprivate

Compile a minimal passthrough fragment shader as a stand-in.

Used when a shader in the library fails to compile (either during cache-build or source-compile). A placeholder program is inserted at the failing shader's index so that numeric indices remain aligned with the on-disk shader manifest — this keeps user-selected indices (e.g. from the Qt interface or CLI –shader-index) pointing at the intended slot even when one or more shaders in the library are broken.

The fragment shader samples the input frame texture samp and writes it unchanged, so the placeholder renders as a no-op passthrough instead of causing a hard error.

Parameters
vert_pathPath to the vertex shader to pair with the passthrough.
Returns
A compiled ShaderProgram, or an empty unique_ptr on failure.

Definition at line 3591 of file ACMX2/acmx.cpp.

References makeProgram().

Referenced by loadFromCache(), loadProgram(), and reloadProgram().

◆ makeProgram()

std::unique_ptr< gl::ShaderProgram > ShaderLibrary::makeProgram ( )
inlineprivate

Definition at line 3386 of file ACMX2/acmx.cpp.

References use_cache.

Referenced by loadFromCache(), loadProgram(), and makePassthroughProgram().

◆ preparedFragmentHash()

uint64_t ShaderLibrary::preparedFragmentHash ( const std::string & frag_path) const
inlineprivate

◆ programInfoLog()

std::string ShaderLibrary::programInfoLog ( GLuint program)
inlinestaticprivate

Definition at line 3479 of file ACMX2/acmx.cpp.

Referenced by compileProgramForReload(), and makeComputeProgram().

◆ reloadProgram()

bool ShaderLibrary::reloadProgram ( gl::GLWindow * win,
size_t shader_index,
const std::string & fragment_path,
std::string & error )
inline

Recompile one library slot and atomically replace it on success.

Both 2D and 3D variants are compiled into temporary programs first. The currently running programs remain installed if compilation, linking, or uniform setup fails.

Definition at line 3783 of file ACMX2/acmx.cpp.

References compileProgramForReload(), Compute, dual_mode, Fragment, isComputeShaderFile(), makePassthroughProgram(), program_kinds, program_names_2d, program_names_3d, programs_2d, programs_3d, setupProgramUniforms(), and shader().

◆ removeBrokenShaders()

bool ShaderLibrary::removeBrokenShaders ( gl::GLWindow * win,
const std::string & library_path,
const std::string & vert_2d,
const std::string & vert_3d )
inline

Compile every shader in a library and rewrite its manifest without the ones that fail to compile.

Reads library.json when present, otherwise index.txt, and compiles each fragment shader against the supplied 2D (and optionally 3D) vertex shader. The selected manifest is rewritten without broken entries and preserved as a .bak file before replacement.

Non-shader lines (blank lines and lines containing "material") are preserved verbatim. Files listed in the manifest that do not exist on disk are also dropped.

The existing .shader_cache is deleted so the library is rebuilt fresh on next launch.

Parameters
winGL window (for asset resolution).
library_pathDirectory containing a shader manifest and GLSL files.
vert_2dPath to the 2D vertex shader.
vert_3dPath to the 3D vertex shader (only used when dual_mode is set).
Returns
true if the manifest was rewritten successfully.

< Original line text.

< True if this line references a fragment shader file.

< False if the shader failed to compile.

Definition at line 4377 of file ACMX2/acmx.cpp.

References cache_size, compute_shader_supported, ShaderManifestData::custom_uniforms, dual_mode, ShaderManifestData::entries, ShaderManifestData::format, isComputeShaderFile(), Json, loadProgramWithSize(), loadShaderManifest(), makeComputeProgram(), normalizeShaderIndexEntry(), ShaderManifestData::path, resolveShaderPathInLibrary(), setCustomUniformValues(), shaderCacheFilePath(), use_history_array, and writeJsonShaderManifest().

Referenced by main().

◆ setAudioBufferCount()

void ShaderLibrary::setAudioBufferCount ( int n)
inline

Configure the runtime depth of spectrum_history.

Definition at line 4090 of file ACMX2/acmx.cpp.

References audio_buffer_count, and spectrum_history_head.

◆ setAudioWarmupEnvelope()

void ShaderLibrary::setAudioWarmupEnvelope ( float env)
inline

Set startup audio warmup envelope in [0,1] for uniform scaling.

Definition at line 4103 of file ACMX2/acmx.cpp.

References audio_warmup_envelope.

◆ setCacheSize()

void ShaderLibrary::setCacheSize ( int size)
inline

Set the active texture-cache ring length.

Must be called before loadPrograms / loadProgramsWithCache so the value is in effect when shaders are compiled (it is baked into the fragment source as #define SIZE N) and when uniform locations are queried (it sizes the per-program texture_array_loc lookup).

Values outside [1, 64] are clamped silently to keep us under any reasonable GL_MAX_TEXTURE_IMAGE_UNITS minimum (driver minimum for GL 3.3 core is 16; the runtime caller already clamps to 1..64).

Parameters
sizeRing buffer size in frames.

Definition at line 3683 of file ACMX2/acmx.cpp.

References cache_size, and size().

Referenced by main().

◆ setCustomUniformValues()

◆ setFPS()

void ShaderLibrary::setFPS ( float fps_value)
inline

Upload the current frame-rate to the active shader's iFrameRate uniform.

Parameters
fps_valueFrames per second to send to the GPU.

Definition at line 4013 of file ACMX2/acmx.cpp.

References index(), is3d, program_names_2d, and program_names_3d.

◆ setHistoryHead()

void ShaderLibrary::setHistoryHead ( int layer)
inline

Set the physical array layer that represents logical history zero.

The array texture is updated as a ring, so this offset advances whenever the oldest frame is overwritten. Shaders map a logical index with (history_head + index) % SIZE.

Definition at line 4072 of file ACMX2/acmx.cpp.

References history_head.

◆ setHistoryTextureArray()

void ShaderLibrary::setHistoryTextureArray ( bool enabled)
inline

Select the cache sampler representation before compiling shaders.

Array mode binds a single sampler2DArray history at texture unit 1. Legacy mode binds samp1..samp8 and textures[SIZE] to units 1..SIZE.

Definition at line 3700 of file ACMX2/acmx.cpp.

References use_history_array.

Referenced by main().

◆ setIndex()

void ShaderLibrary::setIndex ( size_t i)
inline

Set the active shader by index.

Bounds-checked against the current program vector (2D or 3D). Logs the shader name to stdout.

Parameters
iZero-based shader index in the active program vector.

Definition at line 5486 of file ACMX2/acmx.cpp.

References is3d, library_index, program_names_2d, program_names_3d, programs_2d, and programs_3d.

Referenced by dec(), and inc().

◆ setMidiSlider()

void ShaderLibrary::setMidiSlider ( int idx,
float val )
inline

Set a MIDI slider value (index 0–3, value 0.0–1.0).

Definition at line 3652 of file ACMX2/acmx.cpp.

References midi_slider.

Referenced by ACView::pollMidi().

◆ setNormalizedTime()

void ShaderLibrary::setNormalizedTime ( bool enabled)
inline

Select fixed-per-frame or elapsed real-time advancement.

Definition at line 4084 of file ACMX2/acmx.cpp.

References normalized_time.

◆ setSpectrumHistoryHead()

void ShaderLibrary::setSpectrumHistoryHead ( int layer)
inline

Set the physical array layer containing the newest FFT frame.

Definition at line 4100 of file ACMX2/acmx.cpp.

References audio_buffer_count, and spectrum_history_head.

◆ setTimeSpeed()

void ShaderLibrary::setTimeSpeed ( float speed)
inline

Set the absolute time_f advancement speed multiplier.

Definition at line 4081 of file ACMX2/acmx.cpp.

References time_speed.

◆ setUniform()

void ShaderLibrary::setUniform ( const std::string & name,
int value )
inline

Bind a cache sampler slot for texture-cache shaders.

Sets the sampler uniform samp1–samp8 at the given slot to point at texture unit value + 1. Only meaningful for shaders whose filename contains "cache".

Parameters
nameUniform name (unused — the slot index is used directly).
valueZero-based cache texture slot (0–7).

Definition at line 4033 of file ACMX2/acmx.cpp.

References cache_size, index(), is3d, program_names_2d, program_names_3d, and use_history_array.

◆ setupProgramUniforms()

void ShaderLibrary::setupProgramUniforms ( gl::GLWindow * win,
gl::ShaderProgram * prog,
std::unordered_map< int, ProgramData > & names,
size_t pos,
const std::string & text )
inline

Query and store all uniform locations for a compiled shader program.

Called immediately after a program is compiled (or restored from cache). Activates the program with useProgram(), then queries locations for every known uniform—Shadertoy-compatible (iTime, iResolution, iMouse, iFrame, iDate, iTimeDelta, iChannelTime, iChannelResolution, iSampleRate, iFrameRate), audio reactivity (amp, uamp, iamp, amp_peak, amp_rms, amp_smooth, amp_low/mid/high), and acidcamGL legacy (value_alpha_r/g/b, alpha_r/g/b, alpha_value, index_value, optx, random_var, restore_black, inc_value, inc_valuex).

Results are stored in the ProgramData struct keyed by program index in the provided map, avoiding per-frame glGetUniformLocation calls.

Parameters
winGL window (used for error reporting).
progThe compiled shader program to query.
namesMap to store the resulting ProgramData into.
posIndex key under which the data is stored.
textFragment shader file path (stem becomes the display name).
Exceptions
mx::Exceptionon any GL error after useProgram or setUniform.

Definition at line 3891 of file ACMX2/acmx.cpp.

References cache_size, Compute, custom_uniforms, history_head, program_kinds, program_names_2d, and use_history_array.

Referenced by loadFromCache(), loadProgram(), and reloadProgram().

◆ setVideoFPS()

void ShaderLibrary::setVideoFPS ( double fps)
inline

Set the frame rate used by normalized time advancement.

Definition at line 4107 of file ACMX2/acmx.cpp.

References video_fps.

◆ shader()

gl::ShaderProgram * ShaderLibrary::shader ( )
inline

Return a raw pointer to the currently active ShaderProgram.

Definition at line 5536 of file ACMX2/acmx.cpp.

References index(), is3d, programs_2d, and programs_3d.

Referenced by compileProgramForReload(), makeComputeProgram(), reloadProgram(), and shaderInfoLog().

◆ shaderCacheFilePath()

std::string ShaderLibrary::shaderCacheFilePath ( const std::string & assets_path,
const std::string & library_path,
int cache_size = 8,
bool use_array = false )
inlinestaticprivate

Resolve the on-disk path for the shader binary cache file.

The cache is preferentially stored under the assets directory (--path) so users can point multiple read-only shader libraries at a single writable cache location. If the assets directory is not writable we fall back to placing the cache directly inside the shader library directory (legacy behaviour).

The filename is derived from a hash of the absolute, normalised library path so different libraries do not collide.

Parameters
assets_pathAssets directory passed via --path (may be empty).
library_pathShader library directory containing a supported manifest.
cache_sizeActive texture-cache size used to key binary-cache compatibility.
use_arrayWhether texture history uses a sampler array; included in the cache key.
Returns
Absolute or relative path to the shader cache file.

Definition at line 3177 of file ACMX2/acmx.cpp.

References cache_size.

Referenced by buildShaderCache(), loadFromCache(), loadProgramsWithCache(), and removeBrokenShaders().

◆ shaderInfoLog()

std::string ShaderLibrary::shaderInfoLog ( GLuint shader)
inlinestaticprivate

Definition at line 3465 of file ACMX2/acmx.cpp.

References shader().

Referenced by compileProgramForReload(), and makeComputeProgram().

◆ size()

size_t ShaderLibrary::size ( )
inline

Number of programs in the currently active set (2D or 3D).

Definition at line 5524 of file ACMX2/acmx.cpp.

References is3d, programs_2d, and programs_3d.

Referenced by injectShaderSize(), and setCacheSize().

◆ size2d()

size_t ShaderLibrary::size2d ( )
inline

Number of 2D programs.

Definition at line 5526 of file ACMX2/acmx.cpp.

References programs_2d.

◆ size3d()

size_t ShaderLibrary::size3d ( )
inline

Number of 3D programs.

Definition at line 5528 of file ACMX2/acmx.cpp.

References programs_3d.

◆ stepAcidCamUniforms()

void ShaderLibrary::stepAcidCamUniforms ( )
inline

Advance acidcamGL-compatible colour-alpha oscillators and random values.

Each colour channel (R, G, B) is incremented by a random 0–0.99 and reset to 0.1 when exceeding 1.5. The alpha value oscillates between 1.0 and 6.0. random_var receives four new random bytes. These values are consumed by legacy acidcamGL shaders that expect per-frame animation in these uniforms.

Definition at line 6127 of file ACMX2/acmx.cpp.

References alpha, alpha_dir, color_alpha_b, color_alpha_g, color_alpha_r, and random_var.

Referenced by update().

◆ timeActive()

bool ShaderLibrary::timeActive ( ) const
inline

Definition at line 6286 of file ACMX2/acmx.cpp.

References time_active.

◆ timeAudio()

bool ShaderLibrary::timeAudio ( ) const
inline

Definition at line 6287 of file ACMX2/acmx.cpp.

References time_audio.

◆ toggle3D()

void ShaderLibrary::toggle3D ( )
inline

Toggle between 2D and 3D rendering modes.

Only effective when dual_mode is enabled; otherwise prints a diagnostic and returns. Flips the internal is3d flag so that subsequent calls to shader(), useProgram(), size(), etc. use the alternate program vector.

Definition at line 4165 of file ACMX2/acmx.cpp.

References dual_mode, and is3d.

◆ toggleAudioDelta()

void ShaderLibrary::toggleAudioDelta ( )
inline

Toggle delta-time scaling for audio-reactive mode.

When on, the audio amplitude contribution to time_f is multiplied by the frame delta time, smoothing the advance rate. When off, each frame advances by the raw amplitude.

Definition at line 6279 of file ACMX2/acmx.cpp.

References audio_delta.

◆ toggleBypass()

void ShaderLibrary::toggleBypass ( )
inline

Toggle the shader bypass flag.

When bypassed, ACView::draw() uses the plain framebuffer pass-through shader instead of the current library shader, showing the raw camera/video feed. Press Space at runtime to toggle.

Definition at line 4186 of file ACMX2/acmx.cpp.

References shader_bypass.

◆ update()

void ShaderLibrary::update ( gl::GLWindow * win)
inline

Per-frame update: advance time_f, upload all uniforms to the active shader.

Called once per frame from ACView::draw(). This method:

  1. Computes delta time from SDL performance counters.
  2. Advances time_f either by a normalized fixed frame interval or by wall-clock delta (scaled by time_speed), or by audio amplitude when audio-reactive time is enabled.
  3. Uploads time_f, iTime, iFrame, iTimeDelta, iDate, iFrameRate, iMouse (with Shadertoy click semantics), and iResolution.
  4. Steps and uploads the acidcamGL-compatible oscillator uniforms.
  5. Uploads all audio amplitude and frequency-band uniforms (when AUDIO_ENABLED is defined and time_audio is true).
Parameters
winGL window providing resolution and drawable size.

Definition at line 5920 of file ACMX2/acmx.cpp.

References alpha, audio_analyzer, audio_buffer_count, audio_delta, audio_warmup_envelope, clickStartX, clickStartY, history_head, index(), is3d, isDraggingLeft, isDraggingRight, lastClickX, lastClickY, acmx2::audio::AudioAnalyzer::metrics(), midi_slider, normalized_time, program_names_2d, program_names_3d, acmx2::audio::AudioAnalyzer::sample_rate(), acmx2::audio::AudioAnalyzer::sensitivity(), spectrum_history_head, SpectrumTexture::SPECTRUM_TEXTURE_UNIT, stepAcidCamUniforms(), SpectrumHistory::TEXTURE_UNIT, time_active, time_audio, time_f, time_speed, uploadAcidCamUniforms(), uploadCustomUniforms(), use_history_array, video_fps, and wasClicked.

◆ updateShaderUniforms()

void ShaderLibrary::updateShaderUniforms ( gl::GLWindow * win,
size_t idx )
inline

Upload all uniforms for an arbitrary shader in the active set.

Used by the multi-pass pipeline when each pass may target a different shader index. Computes elapsed time, delta time, frame count, date, mouse state, and all audio metrics, then uploads them to the program at idx.

Parameters
winGL window (provides resolution and mouse coordinates).
idxIndex of the shader whose uniforms to upload.

Definition at line 5586 of file ACMX2/acmx.cpp.

References alpha, audio_analyzer, audio_buffer_count, audio_warmup_envelope, cache_size, clickStartX, clickStartY, history_head, is3d, isDraggingLeft, isDraggingRight, lastClickX, lastClickY, acmx2::audio::AudioAnalyzer::metrics(), midi_slider, program_names_2d, program_names_3d, programs_2d, programs_3d, acmx2::audio::AudioAnalyzer::sample_rate(), acmx2::audio::AudioAnalyzer::sensitivity(), spectrum_history_head, SpectrumTexture::SPECTRUM_TEXTURE_UNIT, SpectrumHistory::TEXTURE_UNIT, time_audio, time_f, time_speed, uploadAcidCamUniforms(), uploadCustomUniforms(), use_history_array, and wasClicked.

◆ updateShaderUniforms2D()

void ShaderLibrary::updateShaderUniforms2D ( gl::GLWindow * win,
size_t idx )
inline

Upload all uniforms for a shader in the 2D set specifically.

Identical to updateShaderUniforms() but explicitly indexes into programs_2d / program_names_2d, bypassing the 2D/3D mode switch. This is used during 3D-mode multi-pass rendering, where the post-processing passes always run in 2D but the final composite runs in 3D.

Parameters
winGL window.
idxIndex in the 2D program vector.

Definition at line 5753 of file ACMX2/acmx.cpp.

References alpha, audio_analyzer, audio_buffer_count, audio_warmup_envelope, cache_size, clickStartX, clickStartY, history_head, isDraggingLeft, isDraggingRight, lastClickX, lastClickY, acmx2::audio::AudioAnalyzer::metrics(), midi_slider, program_names_2d, programs_2d, acmx2::audio::AudioAnalyzer::sample_rate(), acmx2::audio::AudioAnalyzer::sensitivity(), spectrum_history_head, SpectrumTexture::SPECTRUM_TEXTURE_UNIT, SpectrumHistory::TEXTURE_UNIT, time_audio, time_f, time_speed, uploadAcidCamUniforms(), uploadCustomUniforms(), use_history_array, and wasClicked.

Referenced by dispatchCompute2D().

◆ uploadAcidCamUniforms()

◆ uploadCustomUniforms()

void ShaderLibrary::uploadCustomUniforms ( const ProgramData & data) const
inline

Upload configured custom uniforms to the GPU for the given program.

Uploads each configured custom uniform to its location cached in data. Each upload is skipped if the location is -1 (uniform not declared in that shader).

Parameters
dataProgramData containing cached custom-uniform locations.

Definition at line 6160 of file ACMX2/acmx.cpp.

References ShaderLibrary::ProgramData::custom_uniform_locs, and custom_uniforms.

Referenced by update(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ useProgram()

void ShaderLibrary::useProgram ( )
inline

Activate the current shader program on the GPU (glUseProgram).

Definition at line 5531 of file ACMX2/acmx.cpp.

References index(), is3d, programs_2d, and programs_3d.

Member Data Documentation

◆ alpha

float ShaderLibrary::alpha = 0.1f
private

◆ alpha_dir

bool ShaderLibrary::alpha_dir = true
private

Definition at line 3090 of file ACMX2/acmx.cpp.

Referenced by stepAcidCamUniforms().

◆ audio_analyzer

const acmx2::audio::AudioAnalyzer* ShaderLibrary::audio_analyzer = nullptr
private

◆ audio_buffer_count

int ShaderLibrary::audio_buffer_count = 0
private

Runtime depth of the spectrum history array.

Definition at line 3076 of file ACMX2/acmx.cpp.

Referenced by audioBufferCount(), setAudioBufferCount(), setSpectrumHistoryHead(), update(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ audio_delta

bool ShaderLibrary::audio_delta = false
private

Definition at line 3374 of file ACMX2/acmx.cpp.

Referenced by audioDelta(), toggleAudioDelta(), and update().

◆ audio_warmup_envelope

float ShaderLibrary::audio_warmup_envelope = 1.0f
private

Startup ramp [0..1] used to soften initial audio-reactive intensity.

Definition at line 3078 of file ACMX2/acmx.cpp.

Referenced by setAudioWarmupEnvelope(), update(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ cache_size

int ShaderLibrary::cache_size = 8
private

Active runtime size of the texture-cache ring buffer.

Set via setCacheSize() before any program load; defaults to 8 to preserve the legacy samp1..samp8 binding behaviour. Used to:

  • inject #define SIZE N into fragment sources at compile time so uniform sampler2D textures[SIZE]; declarations resolve to the right array length;
  • size the per-program texture_array_loc lookup vector;
  • bound the runtime binding loop in the cache-render path.

Definition at line 3247 of file ACMX2/acmx.cpp.

Referenced by buildShaderCache(), cacheSize(), compileProgramForReload(), loadFromCache(), loadProgramsWithCache(), loadProgramWithSize(), makeComputeProgram(), preparedFragmentHash(), removeBrokenShaders(), setCacheSize(), setUniform(), setupProgramUniforms(), shaderCacheFilePath(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ clickStartX

float ShaderLibrary::clickStartX = 0.0f
private

Definition at line 3381 of file ACMX2/acmx.cpp.

Referenced by update(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ clickStartY

float ShaderLibrary::clickStartY = 0.0f
private

Definition at line 3382 of file ACMX2/acmx.cpp.

Referenced by update(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ color_alpha_b

float ShaderLibrary::color_alpha_b = 0.3f
private

Definition at line 3089 of file ACMX2/acmx.cpp.

Referenced by stepAcidCamUniforms(), and uploadAcidCamUniforms().

◆ color_alpha_g

float ShaderLibrary::color_alpha_g = 0.2f
private

Definition at line 3088 of file ACMX2/acmx.cpp.

Referenced by stepAcidCamUniforms(), and uploadAcidCamUniforms().

◆ color_alpha_r

float ShaderLibrary::color_alpha_r = 0.1f
private

Definition at line 3087 of file ACMX2/acmx.cpp.

Referenced by stepAcidCamUniforms(), and uploadAcidCamUniforms().

◆ custom_uniform_declarations

std::vector<std::regex> ShaderLibrary::custom_uniform_declarations
private

Definition at line 3097 of file ACMX2/acmx.cpp.

Referenced by injectShaderSize(), and setCustomUniformValues().

◆ custom_uniform_references

std::vector<std::regex> ShaderLibrary::custom_uniform_references
private

Definition at line 3098 of file ACMX2/acmx.cpp.

Referenced by injectShaderSize(), and setCustomUniformValues().

◆ custom_uniforms

std::vector<ShaderManifestData::CustomUniform> ShaderLibrary::custom_uniforms
private

◆ dual_mode

bool ShaderLibrary::dual_mode = false
private

◆ history_head

int ShaderLibrary::history_head = 0
private

◆ inc_value

glm::vec4 ShaderLibrary::inc_value = glm::vec4(0.0f)
private

Definition at line 3093 of file ACMX2/acmx.cpp.

Referenced by uploadAcidCamUniforms().

◆ inc_valuex

glm::vec4 ShaderLibrary::inc_valuex = glm::vec4(0.0f)
private

Definition at line 3094 of file ACMX2/acmx.cpp.

Referenced by uploadAcidCamUniforms().

◆ is3d

◆ isDraggingLeft

bool ShaderLibrary::isDraggingLeft = false
private

Definition at line 3378 of file ACMX2/acmx.cpp.

Referenced by update(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ isDraggingRight

bool ShaderLibrary::isDraggingRight = false
private

Definition at line 3379 of file ACMX2/acmx.cpp.

Referenced by update(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ lastClickX

float ShaderLibrary::lastClickX = 0.0f
private

Definition at line 3383 of file ACMX2/acmx.cpp.

Referenced by update(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ lastClickY

float ShaderLibrary::lastClickY = 0.0f
private

Definition at line 3384 of file ACMX2/acmx.cpp.

Referenced by update(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ library_index

size_t ShaderLibrary::library_index = 0
private

◆ midi_slider

float ShaderLibrary::midi_slider[4] = {0.0f, 0.0f, 0.0f, 0.0f}
private

MIDI CC slider values (0.0–1.0) for shader uniforms slider1–slider4.

Definition at line 3081 of file ACMX2/acmx.cpp.

Referenced by setMidiSlider(), update(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ normalized_time

bool ShaderLibrary::normalized_time = false
private

Definition at line 3072 of file ACMX2/acmx.cpp.

Referenced by setNormalizedTime(), and update().

◆ optx

glm::vec4 ShaderLibrary::optx = glm::vec4(0.5f, 0.5f, 0.5f, 0.5f)
private

Definition at line 3091 of file ACMX2/acmx.cpp.

Referenced by uploadAcidCamUniforms().

◆ program_kinds

std::vector<ShaderProgramKind> ShaderLibrary::program_kinds
private

◆ program_names_2d

◆ program_names_3d

◆ programs_2d

◆ programs_3d

std::vector<std::unique_ptr<gl::ShaderProgram> > ShaderLibrary::programs_3d
private

◆ random_var

glm::vec4 ShaderLibrary::random_var = glm::vec4(0.0f)
private

Definition at line 3092 of file ACMX2/acmx.cpp.

Referenced by stepAcidCamUniforms(), and uploadAcidCamUniforms().

◆ restore_black

bool ShaderLibrary::restore_black = false
private

Definition at line 3095 of file ACMX2/acmx.cpp.

Referenced by uploadAcidCamUniforms().

◆ shader_bypass

bool ShaderLibrary::shader_bypass = false
private

Definition at line 3377 of file ACMX2/acmx.cpp.

Referenced by isBypassed(), and toggleBypass().

◆ spectrum_history_head

int ShaderLibrary::spectrum_history_head = 0
private

Physical layer containing the newest spectrum.

Definition at line 3077 of file ACMX2/acmx.cpp.

Referenced by setAudioBufferCount(), setSpectrumHistoryHead(), update(), updateShaderUniforms(), and updateShaderUniforms2D().

◆ time_active

bool ShaderLibrary::time_active = true
private

Definition at line 3069 of file ACMX2/acmx.cpp.

Referenced by activeTime(), decTime(), incTime(), timeActive(), and update().

◆ time_audio

bool ShaderLibrary::time_audio = false
private

◆ time_f

float ShaderLibrary::time_f = 1.0
private

◆ time_speed

float ShaderLibrary::time_speed = 1.0f
private

◆ use_cache

bool ShaderLibrary::use_cache = false
private

Definition at line 3157 of file ACMX2/acmx.cpp.

Referenced by enableCache(), makeComputeProgram(), and makeProgram().

◆ use_history_array

◆ video_fps

double ShaderLibrary::video_fps = 0.0
private

Definition at line 3073 of file ACMX2/acmx.cpp.

Referenced by setVideoFPS(), and update().

◆ wasClicked

bool ShaderLibrary::wasClicked = false
private

Definition at line 3380 of file ACMX2/acmx.cpp.

Referenced by update(), updateShaderUniforms(), and updateShaderUniforms2D().


The documentation for this class was generated from the following file: