Ejemplo n.º 1
0
void codeGen(TreeNode *syntaxTree, char *fileName, char *moduleName)
{
    /* attempt to open output file for writing */
    output = fopen(fileName, "w");
    if (output == NULL)
    {
	Error = TRUE;
	fprintf(listing, ">>> Unable to open output file for writing.\n");
    }
    else
    {
	/* begin code generation */

	/*
	 * There are three attributes that need to be synthesised before
	 *  code generation can begin.  They're the locals-on-the-stack
	 *  size, and the "assembly-area" size (assembly area is where
	 *  parameters for function calls are set up before execution), as
	 *  well as AP/LP stack-offsets for locals/parameters.
	 */
	calcAsmAttribute(syntaxTree);
	calcSizeAttribute(syntaxTree);
	calcStackOffsets(syntaxTree);
	
	genProgram(syntaxTree, fileName, moduleName);
    }
}
Ejemplo n.º 2
0
Render::Render()
    : particleTexture1(0), particleProgram1(0), particleTexture2(0), particleProgram2(0),
      particleFrameBuffer(0)
{
    particleProgram1 = genProgram
    (
        0,
        genShader(GL_FRAGMENT_SHADER, particleFragmentShader1Source)
    );
    particleProgram2 = genProgram
    (
        genShader(GL_VERTEX_SHADER, particleVertexShader2Source),
        genShader(GL_FRAGMENT_SHADER, particleFragmentShader2Source)
    );
    genParticleTexture1();
    genParticleTexture2();
    genParticleFrameBuffer();
}