Skip to content

Instantly share code, notes, and snippets.

@pricklywiggles
Created May 27, 2025 18:24
Show Gist options
  • Select an option

  • Save pricklywiggles/908fe6580cf2732e993b01d1895e49aa to your computer and use it in GitHub Desktop.

Select an option

Save pricklywiggles/908fe6580cf2732e993b01d1895e49aa to your computer and use it in GitHub Desktop.
Shader optimization
{
"task": "optimize_shader",
"description": "Optimize this shader for maximum performance while maintaining visual quality",
"shader_info": {
"type": "fragment|vertex|compute",
"version": "300 es|100|etc",
"target_platform": "web|mobile|desktop",
"current_performance": "heavy|medium|light",
"file_path": "optional/path/to/shader.glsl"
},
"optimization_goals": {
"primary_goal": "performance|quality|compatibility|memory",
"target_fps": 60,
"target_devices": ["mobile", "low-end-desktop", "integrated-graphics"],
"acceptable_quality_loss": "minimal|moderate|aggressive"
},
"specific_requirements": {
"maintain_features": [
"list specific visual effects that must be preserved",
"e.g., 'distortion effects', 'color accuracy', 'smooth gradients'"
],
"can_remove": [
"list features that can be simplified or removed",
"e.g., 'complex noise', 'extra glow passes', 'high particle count'"
],
"constraints": [
"specific limitations or requirements",
"e.g., 'must support WebGL 1.0', 'no texture arrays', 'max 8 texture samples'"
]
},
"optimization_techniques": {
"allowed": [
"reduce_precision",
"simplify_math",
"reduce_texture_samples",
"loop_unrolling",
"early_exit",
"precompute_values",
"approximate_functions",
"reduce_branches",
"cache_calculations",
"use_lookup_tables"
],
"forbidden": [
"list any techniques that should NOT be used",
"e.g., 'don't remove lighting', 'keep all uniforms'"
]
},
"performance_metrics": {
"measure": true,
"current_metrics": {
"gpu_time_ms": "optional current GPU time",
"draw_calls": "optional number of draw calls",
"texture_memory_mb": "optional texture memory usage"
},
"target_improvement": "2x|3x|50%|specific target"
},
"output_preferences": {
"include_comments": true,
"highlight_changes": true,
"provide_alternatives": false,
"benchmark_suggestions": true,
"compatibility_notes": true
},
"shader_code": "paste your shader code here or reference the uploaded file"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment