extern "C" const unsigned * brw_gs_emit(struct brw_context *brw, struct gl_shader_program *prog, struct brw_gs_compile *c, void *mem_ctx, unsigned *final_assembly_size) { struct brw_shader *shader = (brw_shader *) prog->_LinkedShaders[MESA_SHADER_GEOMETRY]; if (unlikely(INTEL_DEBUG & DEBUG_GS)) { printf("GLSL IR for native geometry shader %d:\n", prog->Name); _mesa_print_ir(shader->ir, NULL); printf("\n\n"); } vec4_gs_visitor v(brw, c, prog, shader, mem_ctx); if (!v.run()) { prog->LinkStatus = false; ralloc_strcat(&prog->InfoLog, v.fail_msg); return NULL; } vec4_generator g(brw, prog, &c->gp->program.Base, &c->prog_data.base, mem_ctx, INTEL_DEBUG & DEBUG_GS); const unsigned *generated = g.generate_assembly(&v.instructions, final_assembly_size); return generated; }
/** * Compile a shader. */ static void compile_shader(struct gl_context *ctx, GLuint shaderObj) { struct gl_shader *sh; struct gl_shader_compiler_options *options; sh = _mesa_lookup_shader_err(ctx, shaderObj, "glCompileShader"); if (!sh) return; options = &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(sh->Type)]; /* set default pragma state for shader */ sh->Pragmas = options->DefaultPragmas; if (!sh->Source) { /* If the user called glCompileShader without first calling * glShaderSource, we should fail to compile, but not raise a GL_ERROR. */ sh->CompileStatus = GL_FALSE; } else { if (ctx->Shader.Flags & GLSL_DUMP) { printf("GLSL source for %s shader %d:\n", _mesa_glsl_shader_target_name(sh->Type), sh->Name); printf("%s\n", sh->Source); } /* this call will set the shader->CompileStatus field to indicate if * compilation was successful. */ _mesa_glsl_compile_shader(ctx, sh, false, false); if (ctx->Shader.Flags & GLSL_LOG) { _mesa_write_shader_to_file(sh); } if (ctx->Shader.Flags & GLSL_DUMP) { if (sh->CompileStatus) { printf("GLSL IR for shader %d:\n", sh->Name); _mesa_print_ir(sh->ir, NULL); printf("\n\n"); } else { printf("GLSL shader %d failed to compile.\n", sh->Name); } if (sh->InfoLog && sh->InfoLog[0] != 0) { printf("GLSL shader %d info log:\n", sh->Name); printf("%s\n", sh->InfoLog); } } } if (!sh->CompileStatus) { if (ctx->Shader.Flags & GLSL_DUMP_ON_ERROR) { fprintf(stderr, "GLSL source for %s shader %d:\n", _mesa_glsl_shader_target_name(sh->Type), sh->Name); fprintf(stderr, "%s\n", sh->Source); } if (ctx->Shader.Flags & GLSL_REPORT_ERRORS) { _mesa_debug(ctx, "Error compiling shader %u:\n%s\n", sh->Name, sh->InfoLog); } } }