summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
Commit message (Expand)AuthorAgeFilesLines
* Killed mmath.[ch]. Moved low-level functions/assembly code into imports.[ch]Brian Paul2003-03-0110-25/+17
* fix-up pixel_format enum stuffBrian Paul2003-02-251-23/+24
* casts to silence g++ warningsBrian Paul2003-02-252-7/+7
* latest DOS updates (Daniel Borca)Brian Paul2003-02-2020-211/+4121
* Replace some #defines with enums. (Klaus Niederkrueger)Brian Paul2003-02-175-121/+123
* DOS updates (Daniel Borca)Brian Paul2003-02-046-96/+194
* Check only LEFT bits for clearing alpha buffer. (Evgeny Kotsuba)Karl Schultz2003-01-301-2/+2
* renamed dither-related preprocessor symbols (bug 536406)Brian Paul2003-01-242-51/+46
* fix for framebuffer width and height when window hasn't been realized.Alan Hourihane2003-01-161-3/+9
* Fix SourceForge bug 664908. wglDescribePixelFormat should return theKarl Schultz2003-01-151-1/+3
* initial code for render-to-textureBrian Paul2003-01-144-12/+100
* fix fog stride bugs (Michel Danzer)Brian Paul2003-01-131-6/+6
* fix some float/ubyte mistakes (Daniel Borca)Brian Paul2003-01-082-4/+4
* obsoleteBrian Paul2002-12-192-139/+0
* DOS updatesBrian Paul2002-12-193-0/+467
* DOS updates from Daniel Borca.Brian Paul2002-12-188-403/+1376
* bring in a few AGP-related bits from 4.0.4Brian Paul2002-11-182-7/+37
* enable 1.4 extensionsBrian Paul2002-11-181-1/+1
* bump version to 5.1Brian Paul2002-11-141-3/+3
* Overhaul of line drawing template code. Make better use of sw_span mechanism.Brian Paul2002-11-142-360/+111
* fix compilation problem (Philippe Houdoin)Brian Paul2002-11-131-7/+4
* Lots of clean-ups.Brian Paul2002-11-131-1512/+843
* moved function declaration into the template, define the NAME to specify the ...Brian Paul2002-11-132-491/+263
* check for NULL span argumentBrian Paul2002-11-131-4/+4
* compilation fixesBrian Paul2002-11-1110-37/+38
* changes to vishandle usage to prevent segfault in some circumstancesBrian Paul2002-11-103-41/+73
* minor multi-sample clean-upsBrian Paul2002-11-051-4/+14
* Updates for DOS driver from Daniel Borca.Brian Paul2002-11-052-131/+116
* misc driver updates (Daniel Borca)Brian Paul2002-11-045-14/+16
* use wrappers from imports.h rather than stdio, stdlib, etc functions.Brian Paul2002-10-304-99/+77
* s/BZERO/_mesa_bzero/Brian Paul2002-10-301-2/+2
* more version bumpsBrian Paul2002-10-292-5/+5
* update versioning/extensions for OpenGL 1.4 / Mesa 5.0Brian Paul2002-10-293-7/+8
* updated email addressesBrian Paul2002-10-2910-19/+19
* added some casts for mallocs (bug 630379)Brian Paul2002-10-291-2/+2
* wrapped a few more C library functionsBrian Paul2002-10-253-37/+37
* #include fixesBrian Paul2002-10-252-2/+3
* include GL/glx.hBrian Paul2002-10-251-3/+4
* Header file clean-up:Brian Paul2002-10-2418-83/+36
* Fix projtex interp bugKeith Whitwell2002-10-231-2/+2
* patches from Gerk Huisma for float-channel renderingBrian Paul2002-10-171-7/+7
* applied Philippe Houdoin's patch, plus minor clean-upsBrian Paul2002-10-171-75/+27
* context-related cleanups (ex: _mesa_notifySwapBuffers instead of _mesa_swapbu...Brian Paul2002-10-148-14/+16
* Another round of glRead/DrawBuffer() clean-ups and simplifications.Brian Paul2002-10-117-22/+23
* lineloop fixKeith Whitwell2002-10-111-8/+16
* disable XMesaCreatePBuffer() for XFree86Brian Paul2002-10-091-1/+5
* finally get rid of ctx->Texture._ReallyEnabled fieldBrian Paul2002-10-081-1/+1
* change fog from GLfloat to GLfloat[4] (like other vertex attribs)Brian Paul2002-10-081-7/+9
* added missing dispatch code for new AGP-related functionsBrian Paul2002-10-083-5/+23
* import from DRI CVSBrian Paul2002-10-082-0/+1252
break; case ir_var_out: var->shader_out = true; break; case ir_var_uniform: var->shader_in = true; var->read_only = true; break; default: assert(0); break; } var->location = slot; /* Once the variable is created an initialized, add it to the symbol table * and add the declaration to the IR stream. */ instructions->push_tail(var); symtab->add_variable(var->name, var); return var; } static ir_variable * add_uniform(exec_list *instructions, struct _mesa_glsl_parse_state *state, const char *name, const glsl_type *type) { return add_variable(name, ir_var_uniform, -1, type, instructions, state->symbols); } static void add_builtin_variable(const builtin_variable *proto, exec_list *instructions, glsl_symbol_table *symtab) { /* Create a new variable declaration from the description supplied by * the caller. */ const glsl_type *const type = symtab->get_type(proto->type); assert(type != NULL); add_variable(proto->name, proto->mode, proto->slot, type, instructions, symtab); } static void add_builtin_constant(exec_list *instructions, struct _mesa_glsl_parse_state *state, const char *name, int value) { ir_variable *const var = add_variable(name, ir_var_auto, -1, glsl_type::int_type, instructions, state->symbols); var->constant_value = new(var) ir_constant(value); } static void generate_110_uniforms(exec_list *instructions, struct _mesa_glsl_parse_state *state) { for (unsigned i = 0 ; i < Elements(builtin_110_deprecated_uniforms) ; i++) { add_builtin_variable(& builtin_110_deprecated_uniforms[i], instructions, state->symbols); } add_builtin_constant(instructions, state, "gl_MaxLights", state->Const.MaxLights); add_builtin_constant(instructions, state, "gl_MaxClipPlanes", state->Const.MaxClipPlanes); add_builtin_constant(instructions, state, "gl_MaxTextureUnits", state->Const.MaxTextureUnits); add_builtin_constant(instructions, state, "gl_MaxTextureCoords", state->Const.MaxTextureCoords); add_builtin_constant(instructions, state, "gl_MaxVertexAttribs", state->Const.MaxVertexAttribs); add_builtin_constant(instructions, state, "gl_MaxVertexUniformComponents", state->Const.MaxVertexUniformComponents); add_builtin_constant(instructions, state, "gl_MaxVaryingFloats", state->Const.MaxVaryingFloats); add_builtin_constant(instructions, state, "gl_MaxVertexTextureImageUnits", state->Const.MaxVertexTextureImageUnits); add_builtin_constant(instructions, state, "gl_MaxCombinedTextureImageUnits", state->Const.MaxCombinedTextureImageUnits); add_builtin_constant(instructions, state, "gl_MaxTextureImageUnits", state->Const.MaxTextureImageUnits); add_builtin_constant(instructions, state, "gl_MaxFragmentUniformComponents", state->Const.MaxFragmentUniformComponents); const glsl_type *const mat4_array_type = glsl_type::get_array_instance(glsl_type::mat4_type, state->Const.MaxTextureCoords); add_uniform(instructions, state, "gl_TextureMatrix", mat4_array_type); add_uniform(instructions, state, "gl_DepthRangeParameters", state->symbols->get_type("gl_DepthRangeParameters")); add_uniform(instructions, state, "gl_ClipPlane", glsl_type::get_array_instance(glsl_type::vec4_type, state->Const.MaxClipPlanes)); add_uniform(instructions, state, "gl_Point", state->symbols->get_type("gl_PointParameters")); const glsl_type *const material_parameters_type = state->symbols->get_type("gl_MaterialParameters"); add_uniform(instructions, state, "gl_FrontMaterial", material_parameters_type); add_uniform(instructions, state, "gl_BackMaterial", material_parameters_type); const glsl_type *const light_source_array_type = glsl_type::get_array_instance(state->symbols->get_type("gl_LightSourceParameters"), state->Const.MaxLights); add_uniform(instructions, state, "gl_LightSource", light_source_array_type); const glsl_type *const light_model_products_type = state->symbols->get_type("gl_LightModelProducts"); add_uniform(instructions, state, "gl_FrontLightModelProduct", light_model_products_type); add_uniform(instructions, state, "gl_BackLightModelProduct", light_model_products_type); const glsl_type *const light_products_type = glsl_type::get_array_instance(state->symbols->get_type("gl_LightProducts"), state->Const.MaxLights); add_uniform(instructions, state, "gl_FrontLightProduct", light_products_type); add_uniform(instructions, state, "gl_BackLightProduct", light_products_type); add_uniform(instructions, state, "gl_TextureEnvColor", glsl_type::get_array_instance(glsl_type::vec4_type, state->Const.MaxTextureUnits)); const glsl_type *const texcoords_vec4 = glsl_type::get_array_instance(glsl_type::vec4_type, state->Const.MaxTextureCoords); add_uniform(instructions, state, "gl_EyePlaneS", texcoords_vec4); add_uniform(instructions, state, "gl_EyePlaneT", texcoords_vec4); add_uniform(instructions, state, "gl_EyePlaneR", texcoords_vec4); add_uniform(instructions, state, "gl_EyePlaneQ", texcoords_vec4); add_uniform(instructions, state, "gl_ObjectPlaneS", texcoords_vec4); add_uniform(instructions, state, "gl_ObjectPlaneT", texcoords_vec4); add_uniform(instructions, state, "gl_ObjectPlaneR", texcoords_vec4); add_uniform(instructions, state, "gl_ObjectPlaneQ", texcoords_vec4); add_uniform(instructions, state, "gl_Fog", state->symbols->get_type("gl_FogParameters")); } static void generate_110_vs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) { add_builtin_variable(& builtin_core_vs_variables[i], instructions, state->symbols); } for (unsigned i = 0 ; i < Elements(builtin_110_deprecated_vs_variables) ; i++) { add_builtin_variable(& builtin_110_deprecated_vs_variables[i], instructions, state->symbols); } generate_110_uniforms(instructions, state); /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec: * * "As with all arrays, indices used to subscript gl_TexCoord must * either be an integral constant expressions, or this array must be * re-declared by the shader with a size. The size can be at most * gl_MaxTextureCoords. Using indexes close to 0 may aid the * implementation in preserving varying resources." */ const glsl_type *const vec4_array_type = glsl_type::get_array_instance(glsl_type::vec4_type, 0); add_variable("gl_TexCoord", ir_var_out, VERT_RESULT_TEX0, vec4_array_type, instructions, state->symbols); generate_ARB_draw_buffers_variables(instructions, state, false, vertex_shader); } static void generate_120_vs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { /* GLSL version 1.20 did not add any built-in variables in the vertex * shader. */ generate_110_vs_variables(instructions, state); } static void generate_130_vs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { generate_120_vs_variables(instructions, state); for (unsigned i = 0; i < Elements(builtin_130_vs_variables); i++) { add_builtin_variable(& builtin_130_vs_variables[i], instructions, state->symbols); } const glsl_type *const clip_distance_array_type = glsl_type::get_array_instance(glsl_type::float_type, state->Const.MaxClipPlanes); /* FINISHME: gl_ClipDistance needs a real location assigned. */ add_variable("gl_ClipDistance", ir_var_out, -1, clip_distance_array_type, instructions, state->symbols); } static void initialize_vs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { switch (state->language_version) { case 110: generate_110_vs_variables(instructions, state); break; case 120: generate_120_vs_variables(instructions, state); break; case 130: generate_130_vs_variables(instructions, state); break; } } static void generate_110_fs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) { add_builtin_variable(& builtin_core_fs_variables[i], instructions, state->symbols); } for (unsigned i = 0 ; i < Elements(builtin_110_deprecated_fs_variables) ; i++) { add_builtin_variable(& builtin_110_deprecated_fs_variables[i], instructions, state->symbols); } generate_110_uniforms(instructions, state); /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec: * * "As with all arrays, indices used to subscript gl_TexCoord must * either be an integral constant expressions, or this array must be * re-declared by the shader with a size. The size can be at most * gl_MaxTextureCoords. Using indexes close to 0 may aid the * implementation in preserving varying resources." */ const glsl_type *const vec4_array_type = glsl_type::get_array_instance(glsl_type::vec4_type, 0); add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type, instructions, state->symbols); generate_ARB_draw_buffers_variables(instructions, state, false, fragment_shader); } static void generate_ARB_draw_buffers_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state, bool warn, _mesa_glsl_parser_targets target) { /* gl_MaxDrawBuffers is available in all shader stages. */ ir_variable *const mdb = add_variable("gl_MaxDrawBuffers", ir_var_auto, -1, glsl_type::int_type, instructions, state->symbols); if (warn) mdb->warn_extension = "GL_ARB_draw_buffers"; mdb->constant_value = new(mdb) ir_constant(int(state->Const.MaxDrawBuffers)); /* gl_FragData is only available in the fragment shader. */ if (target == fragment_shader) { const glsl_type *const vec4_array_type = glsl_type::get_array_instance(glsl_type::vec4_type, state->Const.MaxDrawBuffers); ir_variable *const fd = add_variable("gl_FragData", ir_var_out, FRAG_RESULT_DATA0, vec4_array_type, instructions, state->symbols); if (warn) fd->warn_extension = "GL_ARB_draw_buffers"; } } static void generate_120_fs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { generate_110_fs_variables(instructions, state); for (unsigned i = 0 ; i < Elements(builtin_120_fs_variables) ; i++) { add_builtin_variable(& builtin_120_fs_variables[i], instructions, state->symbols); } } static void generate_130_fs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { generate_120_fs_variables(instructions, state); const glsl_type *const clip_distance_array_type = glsl_type::get_array_instance(glsl_type::float_type, state->Const.MaxClipPlanes); /* FINISHME: gl_ClipDistance needs a real location assigned. */ add_variable("gl_ClipDistance", ir_var_in, -1, clip_distance_array_type, instructions, state->symbols); } static void initialize_fs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { switch (state->language_version) { case 110: generate_110_fs_variables(instructions, state); break; case 120: generate_120_fs_variables(instructions, state); break; case 130: generate_130_fs_variables(instructions, state); break; } } void _mesa_glsl_initialize_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { switch (state->target) { case vertex_shader: initialize_vs_variables(instructions, state); break; case geometry_shader: break; case fragment_shader: initialize_fs_variables(instructions, state); break; case ir_shader: fprintf(stderr, "ir reader has no builtin variables"); exit(1); break; } }