Skip to content

Limitations

This document describes the known limitations of the AXSLC compiler.

Type System Limitations

AXSLC does not catch type-level errors. These are delegated to the downstream GLSL compiler.

What AXSLC Does Not Check

  • Type errors - wrong argument types to functions
  • Type mismatches - assigning int to float without cast
  • Missing main function - shader entry point validation
  • Interface block mismatches - mismatches between shader stages

These are reported by the GLSL compiler (OpenGL driver) when you call glCompileShader. Always check the GLSL compiler's error log.

Example Workflow

cpp
// Compile AXSL
Compiler compiler;
auto result = compiler.compile(source, "shader.axsl");

if (!result.errors.empty()) {
    // AXSLC errors (symbol resolution, includes, parse errors)
    for (const auto& err : result.errors) {
        std::cerr << err << std::endl;
    }
    return 1;
}

// Write GLSL files
write_file("shader.vert.glsl", result.stages[StageKind::Vertex]);

// Compile with OpenGL
GLuint shader = glCreateShader(GL_VERTEX_SHADER);
const char* source_cstr = result.stages[StageKind::Vertex].c_str();
glShaderSource(shader, 1, &source_cstr, nullptr);
glCompileShader(shader);

// Check GLSL compilation status
GLint success;
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
if (!success) {
    // GLSL errors (type errors, etc.)
    char info_log[512];
    glGetShaderInfoLog(shader, 512, nullptr, info_log);
    std::cerr << "GLSL compilation failed:\n" << info_log << std::endl;
}

Best Practices

  1. Fix AXSLC errors first - symbol resolution and syntax errors before worrying about GLSL type errors
  2. Check both compilers - AXSLC for structure, GLSL for semantics
  3. Use verbose mode (-v) to see which stages are being compiled
  4. Verify output files - inspect generated .glsl files if GLSL compilation fails