summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/SConscript1
-rw-r--r--src/mesa/glapi/glapi.c2
-rw-r--r--src/mesa/glapi/glapi_getproc.c2
-rw-r--r--src/mesa/glapi/glthread.c2
-rw-r--r--src/mesa/main/getstring.c146
-rw-r--r--src/mesa/main/mtypes.h4
-rw-r--r--src/mesa/main/texstore.c6
-rw-r--r--src/mesa/math/m_debug_clip.c8
-rw-r--r--src/mesa/math/m_debug_norm.c8
-rw-r--r--src/mesa/math/m_debug_xform.c8
-rw-r--r--src/mesa/math/m_matrix.c8
-rw-r--r--src/mesa/math/m_translate.c6
-rw-r--r--src/mesa/math/m_vector.c8
-rw-r--r--src/mesa/math/m_xform.h4
-rw-r--r--src/mesa/shader/arbprogparse.c6
-rw-r--r--src/mesa/shader/arbprogparse.h2
-rw-r--r--src/mesa/shader/arbprogram.c12
-rw-r--r--src/mesa/shader/atifragshader.c14
-rw-r--r--src/mesa/shader/grammar/grammar_mesa.h2
-rw-r--r--src/mesa/shader/nvfragparse.c8
-rw-r--r--src/mesa/shader/nvprogram.c10
-rw-r--r--src/mesa/shader/nvvertparse.c8
-rw-r--r--src/mesa/shader/prog_debug.c6
-rw-r--r--src/mesa/shader/prog_execute.c6
-rw-r--r--src/mesa/shader/prog_instruction.c6
-rw-r--r--src/mesa/shader/prog_parameter.c6
-rw-r--r--src/mesa/shader/prog_parameter.h2
-rw-r--r--src/mesa/shader/prog_print.c6
-rw-r--r--src/mesa/shader/prog_statevars.c12
-rw-r--r--src/mesa/shader/prog_statevars.h2
-rw-r--r--src/mesa/shader/program.c6
-rw-r--r--src/mesa/shader/program.h2
-rw-r--r--src/mesa/shader/programopt.c4
-rw-r--r--src/mesa/shader/shader_api.c17
-rw-r--r--src/mesa/shader/shader_api.h4
-rw-r--r--src/mesa/shader/slang/library/slang_120_core.gc50
-rw-r--r--src/mesa/shader/slang/library/slang_120_core_gc.h22
-rw-r--r--src/mesa/shader/slang/library/slang_core.gc24
-rw-r--r--src/mesa/shader/slang/library/slang_core_gc.h18
-rw-r--r--src/mesa/shader/slang/slang_codegen.c249
-rw-r--r--src/mesa/shader/slang/slang_codegen.h2
-rw-r--r--src/mesa/shader/slang/slang_compile.c77
-rw-r--r--src/mesa/shader/slang/slang_compile.h4
-rw-r--r--src/mesa/shader/slang/slang_compile_function.c2
-rw-r--r--src/mesa/shader/slang/slang_compile_operation.c2
-rw-r--r--src/mesa/shader/slang/slang_compile_struct.c2
-rw-r--r--src/mesa/shader/slang/slang_compile_variable.c24
-rw-r--r--src/mesa/shader/slang/slang_emit.c70
-rw-r--r--src/mesa/shader/slang/slang_emit.h4
-rw-r--r--src/mesa/shader/slang/slang_ir.c4
-rw-r--r--src/mesa/shader/slang/slang_ir.h4
-rw-r--r--src/mesa/shader/slang/slang_library_noise.c2
-rw-r--r--src/mesa/shader/slang/slang_link.c11
-rw-r--r--src/mesa/shader/slang/slang_log.c2
-rw-r--r--src/mesa/shader/slang/slang_mem.c4
-rw-r--r--src/mesa/shader/slang/slang_mem.h2
-rw-r--r--src/mesa/shader/slang/slang_preprocess.c2
-rw-r--r--src/mesa/shader/slang/slang_print.c2
-rw-r--r--src/mesa/shader/slang/slang_simplify.c278
-rw-r--r--src/mesa/shader/slang/slang_simplify.h28
-rw-r--r--src/mesa/shader/slang/slang_storage.c2
-rw-r--r--src/mesa/shader/slang/slang_typeinfo.c100
-rw-r--r--src/mesa/shader/slang/slang_typeinfo.h7
-rw-r--r--src/mesa/shader/slang/slang_utility.c2
-rw-r--r--src/mesa/sources1
-rw-r--r--src/mesa/sparc/sparc.c2
-rw-r--r--src/mesa/state_tracker/st_atom.c4
-rw-r--r--src/mesa/state_tracker/st_atom_viewport.c4
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c38
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.h2
-rw-r--r--src/mesa/state_tracker/st_texture.c2
-rw-r--r--src/mesa/swrast/s_aaline.c8
-rw-r--r--src/mesa/swrast/s_aaline.h2
-rw-r--r--src/mesa/swrast/s_aatriangle.c12
-rw-r--r--src/mesa/swrast/s_aatriangle.h2
-rw-r--r--src/mesa/swrast/s_accum.c8
-rw-r--r--src/mesa/swrast/s_accum.h2
-rw-r--r--src/mesa/swrast/s_alpha.c8
-rw-r--r--src/mesa/swrast/s_alpha.h2
-rw-r--r--src/mesa/swrast/s_atifragshader.c8
-rw-r--r--src/mesa/swrast/s_bitmap.c4
-rw-r--r--src/mesa/swrast/s_blend.c8
-rw-r--r--src/mesa/swrast/s_blend.h2
-rw-r--r--src/mesa/swrast/s_blit.c4
-rw-r--r--src/mesa/swrast/s_buffers.c10
-rw-r--r--src/mesa/swrast/s_context.c8
-rw-r--r--src/mesa/swrast/s_copypix.c10
-rw-r--r--src/mesa/swrast/s_depth.c8
-rw-r--r--src/mesa/swrast/s_depth.h2
-rw-r--r--src/mesa/swrast/s_drawpix.c8
-rw-r--r--src/mesa/swrast/s_drawpix.h2
-rw-r--r--src/mesa/swrast/s_feedback.c10
-rw-r--r--src/mesa/swrast/s_feedback.h2
-rw-r--r--src/mesa/swrast/s_fog.c8
-rw-r--r--src/mesa/swrast/s_fog.h2
-rw-r--r--src/mesa/swrast/s_lines.c8
-rw-r--r--src/mesa/swrast/s_lines.h2
-rw-r--r--src/mesa/swrast/s_logic.c8
-rw-r--r--src/mesa/swrast/s_logic.h2
-rw-r--r--src/mesa/swrast/s_masking.c4
-rw-r--r--src/mesa/swrast/s_masking.h2
-rw-r--r--src/mesa/swrast/s_points.c8
-rw-r--r--src/mesa/swrast/s_points.h2
-rw-r--r--src/mesa/swrast/s_readpix.c10
-rw-r--r--src/mesa/swrast/s_span.c10
-rw-r--r--src/mesa/swrast/s_span.h2
-rw-r--r--src/mesa/swrast/s_spantemp.h2
-rw-r--r--src/mesa/swrast/s_stencil.c6
-rw-r--r--src/mesa/swrast/s_stencil.h2
-rw-r--r--src/mesa/swrast/s_texcombine.c10
-rw-r--r--src/mesa/swrast/s_texcombine.h2
-rw-r--r--src/mesa/swrast/s_texfilter.c8
-rw-r--r--src/mesa/swrast/s_texfilter.h2
-rw-r--r--src/mesa/swrast/s_texstore.c10
-rw-r--r--src/mesa/swrast/s_triangle.c10
-rw-r--r--src/mesa/swrast/s_triangle.h2
-rw-r--r--src/mesa/swrast/s_zoom.c8
-rw-r--r--src/mesa/swrast/s_zoom.h2
-rw-r--r--src/mesa/swrast_setup/ss_context.c6
-rw-r--r--src/mesa/swrast_setup/ss_context.h2
-rw-r--r--src/mesa/swrast_setup/ss_triangle.c8
-rw-r--r--src/mesa/swrast_setup/ss_triangle.h2
-rw-r--r--src/mesa/swrast_setup/ss_vb.h2
-rw-r--r--src/mesa/tnl/t_draw.c12
-rw-r--r--src/mesa/tnl/t_pipeline.h2
-rw-r--r--src/mesa/tnl/t_rasterpos.c10
-rw-r--r--src/mesa/tnl/t_vb_cull.c12
-rw-r--r--src/mesa/tnl/t_vb_fog.c12
-rw-r--r--src/mesa/tnl/t_vb_light.c10
-rw-r--r--src/mesa/tnl/t_vb_normals.c12
-rw-r--r--src/mesa/tnl/t_vb_points.c4
-rw-r--r--src/mesa/tnl/t_vb_program.c10
-rw-r--r--src/mesa/tnl/t_vb_render.c12
-rw-r--r--src/mesa/tnl/t_vb_texgen.c12
-rw-r--r--src/mesa/tnl/t_vb_texmat.c12
-rw-r--r--src/mesa/tnl/t_vb_vertex.c12
-rw-r--r--src/mesa/tnl/t_vertex.c6
-rw-r--r--src/mesa/tnl/t_vertex.h2
-rw-r--r--src/mesa/tnl/t_vertex_generic.c6
-rw-r--r--src/mesa/tnl/t_vertex_sse.c8
-rw-r--r--src/mesa/tnl/t_vp_build.c2
-rw-r--r--src/mesa/tnl/t_vp_build.h2
-rw-r--r--src/mesa/vf/vf.c6
-rw-r--r--src/mesa/vf/vf_generic.c8
-rw-r--r--src/mesa/vf/vf_sse.c8
-rw-r--r--src/mesa/x86-64/x86-64.c4
-rw-r--r--src/mesa/x86/3dnow.c4
-rw-r--r--src/mesa/x86/common_x86.c2
-rw-r--r--src/mesa/x86/rtasm/x86sse.c2
-rw-r--r--src/mesa/x86/sse.c4
-rw-r--r--src/mesa/x86/x86.c4
151 files changed, 1023 insertions, 866 deletions
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index d2de189f690..2c74dc7dd07 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -10,7 +10,6 @@ if env['platform'] != 'winddk':
env.Append(CPPPATH = [
'#/src/mesa',
- '#/src/mesa/main',
])
if gcc:
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index c236656d9a6..53efd7eef47 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -50,7 +50,7 @@
-#include "glheader.h"
+#include "main/glheader.h"
#include "glapi.h"
#include "glapioffsets.h"
#include "glapitable.h"
diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c
index 3634444c855..6d40b495c7e 100644
--- a/src/mesa/glapi/glapi_getproc.c
+++ b/src/mesa/glapi/glapi_getproc.c
@@ -32,7 +32,7 @@
#include <stdlib.h>
#include <string.h>
-#include "glheader.h"
+#include "main/glheader.h"
#include "glapi.h"
#include "glapioffsets.h"
#include "glapitable.h"
diff --git a/src/mesa/glapi/glthread.c b/src/mesa/glapi/glthread.c
index 4513853f5a2..09cc8cfcde2 100644
--- a/src/mesa/glapi/glthread.c
+++ b/src/mesa/glapi/glthread.c
@@ -29,7 +29,7 @@
*/
-#include "glheader.h"
+#include "main/glheader.h"
#include "glthread.h"
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index 973649da0dd..89daa0e21db 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -34,6 +34,76 @@
/**
+ * Examine enabled GL extensions to determine GL version.
+ * \return version string
+ */
+static const char *
+compute_version(const GLcontext *ctx)
+{
+ static const char *version_1_2 = "1.2 Mesa " MESA_VERSION_STRING;
+ static const char *version_1_3 = "1.3 Mesa " MESA_VERSION_STRING;
+ static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING;
+ static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING;
+ static const char *version_2_0 = "2.0 Mesa " MESA_VERSION_STRING;
+ static const char *version_2_1 = "2.1 Mesa " MESA_VERSION_STRING;
+
+ const GLboolean ver_1_3 = (ctx->Extensions.ARB_multisample &&
+ ctx->Extensions.ARB_multitexture &&
+ ctx->Extensions.ARB_texture_border_clamp &&
+ ctx->Extensions.ARB_texture_compression &&
+ ctx->Extensions.ARB_texture_cube_map &&
+ ctx->Extensions.EXT_texture_env_add &&
+ ctx->Extensions.ARB_texture_env_combine &&
+ ctx->Extensions.ARB_texture_env_dot3);
+ const GLboolean ver_1_4 = (ver_1_3 &&
+ ctx->Extensions.ARB_depth_texture &&
+ ctx->Extensions.ARB_shadow &&
+ ctx->Extensions.ARB_texture_env_crossbar &&
+ ctx->Extensions.ARB_texture_mirrored_repeat &&
+ ctx->Extensions.ARB_window_pos &&
+ ctx->Extensions.EXT_blend_color &&
+ ctx->Extensions.EXT_blend_func_separate &&
+ ctx->Extensions.EXT_blend_minmax &&
+ ctx->Extensions.EXT_blend_subtract &&
+ ctx->Extensions.EXT_fog_coord &&
+ ctx->Extensions.EXT_multi_draw_arrays &&
+ ctx->Extensions.EXT_point_parameters &&
+ ctx->Extensions.EXT_secondary_color &&
+ ctx->Extensions.EXT_stencil_wrap &&
+ ctx->Extensions.EXT_texture_lod_bias &&
+ ctx->Extensions.SGIS_generate_mipmap);
+ const GLboolean ver_1_5 = (ver_1_4 &&
+ ctx->Extensions.ARB_occlusion_query &&
+ ctx->Extensions.ARB_vertex_buffer_object &&
+ ctx->Extensions.EXT_shadow_funcs);
+ const GLboolean ver_2_0 = (ver_1_5 &&
+ ctx->Extensions.ARB_draw_buffers &&
+ ctx->Extensions.ARB_point_sprite &&
+ ctx->Extensions.ARB_shader_objects &&
+ ctx->Extensions.ARB_vertex_shader &&
+ ctx->Extensions.ARB_fragment_shader &&
+ ctx->Extensions.ARB_texture_non_power_of_two &&
+ ctx->Extensions.EXT_blend_equation_separate);
+ const GLboolean ver_2_1 = (ver_2_0 &&
+ ctx->Extensions.ARB_shading_language_120 &&
+ ctx->Extensions.EXT_pixel_buffer_object &&
+ ctx->Extensions.EXT_texture_sRGB);
+ if (ver_2_1)
+ return version_2_1;
+ if (ver_2_0)
+ return version_2_0;
+ if (ver_1_5)
+ return version_1_5;
+ if (ver_1_4)
+ return version_1_4;
+ if (ver_1_3)
+ return version_1_3;
+ return version_1_2;
+}
+
+
+
+/**
* Query string-valued state. The return value should _not_ be freed by
* the caller.
*
@@ -50,15 +120,11 @@ _mesa_GetString( GLenum name )
GET_CURRENT_CONTEXT(ctx);
static const char *vendor = "Brian Paul";
static const char *renderer = "Mesa";
- static const char *version_1_2 = "1.2 Mesa " MESA_VERSION_STRING;
- static const char *version_1_3 = "1.3 Mesa " MESA_VERSION_STRING;
- static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING;
- static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING;
- static const char *version_2_0 = "2.0 Mesa " MESA_VERSION_STRING;
- static const char *version_2_1 = "2.1 Mesa " MESA_VERSION_STRING;
-#if FEATURE_ARB_shading_language_100
- static const char *sl_version_110 = "1.10 Mesa " MESA_VERSION_STRING;
+#if FEATURE_ARB_shading_language_120_foo /* support not complete! */
+ static const char *sl_version = "1.20";
+#elif FEATURE_ARB_shading_language_100
+ static const char *sl_version = "1.10";
#endif
if (!ctx)
@@ -79,67 +145,9 @@ _mesa_GetString( GLenum name )
case GL_VENDOR:
return (const GLubyte *) vendor;
case GL_RENDERER:
- return (const GLubyte *) renderer;
+ return (const GLubyte *) renderer;
case GL_VERSION:
- if (ctx->Extensions.ARB_multisample &&
- ctx->Extensions.ARB_multitexture &&
- ctx->Extensions.ARB_texture_border_clamp &&
- ctx->Extensions.ARB_texture_compression &&
- ctx->Extensions.ARB_texture_cube_map &&
- ctx->Extensions.EXT_texture_env_add &&
- ctx->Extensions.ARB_texture_env_combine &&
- ctx->Extensions.ARB_texture_env_dot3) {
- if (ctx->Extensions.ARB_depth_texture &&
- ctx->Extensions.ARB_shadow &&
- ctx->Extensions.ARB_texture_env_crossbar &&
- ctx->Extensions.ARB_texture_mirrored_repeat &&
- ctx->Extensions.ARB_window_pos &&
- ctx->Extensions.EXT_blend_color &&
- ctx->Extensions.EXT_blend_func_separate &&
- ctx->Extensions.EXT_blend_logic_op &&
- ctx->Extensions.EXT_blend_minmax &&
- ctx->Extensions.EXT_blend_subtract &&
- ctx->Extensions.EXT_fog_coord &&
- ctx->Extensions.EXT_multi_draw_arrays &&
- ctx->Extensions.EXT_point_parameters && /*aka ARB*/
- ctx->Extensions.EXT_secondary_color &&
- ctx->Extensions.EXT_stencil_wrap &&
- ctx->Extensions.EXT_texture_lod_bias &&
- ctx->Extensions.SGIS_generate_mipmap) {
- if (ctx->Extensions.ARB_occlusion_query &&
- ctx->Extensions.ARB_vertex_buffer_object &&
- ctx->Extensions.EXT_shadow_funcs) {
- if (ctx->Extensions.ARB_draw_buffers &&
- ctx->Extensions.ARB_point_sprite &&
- ctx->Extensions.ARB_shader_objects &&
- ctx->Extensions.ARB_vertex_shader &&
- ctx->Extensions.ARB_fragment_shader &&
- ctx->Extensions.ARB_texture_non_power_of_two &&
- ctx->Extensions.EXT_blend_equation_separate) {
- if (ctx->Extensions.ARB_shading_language_120 &&
- ctx->Extensions.EXT_pixel_buffer_object &&
- ctx->Extensions.EXT_texture_sRGB) {
- return (const GLubyte *) version_2_1;
- }
- else {
- return (const GLubyte *) version_2_0;
- }
- }
- else {
- return (const GLubyte *) version_1_5;
- }
- }
- else {
- return (const GLubyte *) version_1_4;
- }
- }
- else {
- return (const GLubyte *) version_1_3;
- }
- }
- else {
- return (const GLubyte *) version_1_2;
- }
+ return (const GLubyte *) compute_version(ctx);
case GL_EXTENSIONS:
if (!ctx->Extensions.String)
ctx->Extensions.String = _mesa_make_extension_string(ctx);
@@ -147,7 +155,7 @@ _mesa_GetString( GLenum name )
#if FEATURE_ARB_shading_language_100
case GL_SHADING_LANGUAGE_VERSION_ARB:
if (ctx->Extensions.ARB_shading_language_100)
- return (const GLubyte *) sl_version_110;
+ return (const GLubyte *) sl_version;
goto error;
#endif
#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 88312da7f05..a95f02b889b 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2123,9 +2123,9 @@ struct gl_shader
const GLchar *Source; /**< Source code string */
GLboolean CompileStatus;
- GLuint NumPrograms; /**< size of Programs[] array */
- struct gl_program **Programs; /**< Post-compile assembly code */
+ struct gl_program *Program; /**< Post-compile assembly code */
GLchar *InfoLog;
+ GLboolean Main; /**< shader defines main() */
};
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index edb1ae965d0..97fdfd39b2a 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -380,12 +380,14 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
dst += srcWidth * 4;
}
+ /* size after optional convolution */
+ convWidth = srcWidth;
+ convHeight = srcHeight;
+
#if FEATURE_convolve
/* do convolution */
{
GLfloat *src = tempImage + img * (srcWidth * srcHeight * 4);
- convWidth = srcWidth;
- convHeight = srcHeight;
if (dims == 1) {
ASSERT(ctx->Pixel.Convolution1DEnabled);
_mesa_convolve_1d_image(ctx, &convWidth, src, convImage);
diff --git a/src/mesa/math/m_debug_clip.c b/src/mesa/math/m_debug_clip.c
index ab288183597..460fed4a754 100644
--- a/src/mesa/math/m_debug_clip.c
+++ b/src/mesa/math/m_debug_clip.c
@@ -25,10 +25,10 @@
* Gareth Hughes
*/
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "m_matrix.h"
#include "m_xform.h"
diff --git a/src/mesa/math/m_debug_norm.c b/src/mesa/math/m_debug_norm.c
index 11cae6bba7a..89c632e7d59 100644
--- a/src/mesa/math/m_debug_norm.c
+++ b/src/mesa/math/m_debug_norm.c
@@ -26,10 +26,10 @@
* Gareth Hughes
*/
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "m_matrix.h"
#include "m_xform.h"
diff --git a/src/mesa/math/m_debug_xform.c b/src/mesa/math/m_debug_xform.c
index 0b07b4fd68d..df8cc066b6e 100644
--- a/src/mesa/math/m_debug_xform.c
+++ b/src/mesa/math/m_debug_xform.c
@@ -26,10 +26,10 @@
* Updated for P6 architecture by Gareth Hughes.
*/
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "m_matrix.h"
#include "m_xform.h"
diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c
index b4ba1bc2a08..84b4cae4adb 100644
--- a/src/mesa/math/m_matrix.c
+++ b/src/mesa/math/m_matrix.c
@@ -34,10 +34,10 @@
*/
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "m_matrix.h"
diff --git a/src/mesa/math/m_translate.c b/src/mesa/math/m_translate.c
index c7423e9d9db..4a20f45ee43 100644
--- a/src/mesa/math/m_translate.c
+++ b/src/mesa/math/m_translate.c
@@ -28,9 +28,9 @@
*/
-#include "glheader.h"
-#include "mtypes.h" /* GLchan hack */
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/mtypes.h" /* GLchan hack */
+#include "main/colormac.h"
#include "m_translate.h"
diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c
index 3ad81d468b2..c5e2fd1de12 100644
--- a/src/mesa/math/m_vector.c
+++ b/src/mesa/math/m_vector.c
@@ -28,10 +28,10 @@
*/
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "m_vector.h"
diff --git a/src/mesa/math/m_xform.h b/src/mesa/math/m_xform.h
index 99b071a46b6..d1b974f0433 100644
--- a/src/mesa/math/m_xform.h
+++ b/src/mesa/math/m_xform.h
@@ -27,8 +27,8 @@
#define _M_XFORM_H
-#include "glheader.h"
-#include "config.h"
+#include "main/glheader.h"
+#include "main/config.h"
#include "math/m_vector.h"
#include "math/m_matrix.h"
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index ff583352cec..78cc6aa9cc0 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -38,9 +38,9 @@
#include "programopt.h"
#include "prog_parameter.h"
#include "prog_statevars.h"
-#include "context.h"
-#include "macros.h"
-#include "mtypes.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/mtypes.h"
#include "prog_instruction.h"
diff --git a/src/mesa/shader/arbprogparse.h b/src/mesa/shader/arbprogparse.h
index 4574e5cd553..980d39fb9fe 100644
--- a/src/mesa/shader/arbprogparse.h
+++ b/src/mesa/shader/arbprogparse.h
@@ -26,7 +26,7 @@
#ifndef ARBPROGPARSE_H
#define ARBPROGPARSE_H
-#include "mtypes.h"
+#include "main/mtypes.h"
extern void
_mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target,
diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c
index 81c20a01507..beb5deea505 100644
--- a/src/mesa/shader/arbprogram.c
+++ b/src/mesa/shader/arbprogram.c
@@ -29,14 +29,14 @@
*/
-#include "glheader.h"
+#include "main/glheader.h"
#include "arbprogram.h"
#include "arbprogparse.h"
-#include "context.h"
-#include "hash.h"
-#include "imports.h"
-#include "macros.h"
-#include "mtypes.h"
+#include "main/context.h"
+#include "main/hash.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/mtypes.h"
#include "program.h"
diff --git a/src/mesa/shader/atifragshader.c b/src/mesa/shader/atifragshader.c
index 854c9118741..ac087d415c5 100644
--- a/src/mesa/shader/atifragshader.c
+++ b/src/mesa/shader/atifragshader.c
@@ -21,13 +21,13 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "glheader.h"
-#include "context.h"
-#include "hash.h"
-#include "imports.h"
-#include "macros.h"
-#include "enums.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/hash.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/enums.h"
+#include "main/mtypes.h"
#include "atifragshader.h"
#define MESA_DEBUG_ATI_FS 0
diff --git a/src/mesa/shader/grammar/grammar_mesa.h b/src/mesa/shader/grammar/grammar_mesa.h
index c14033a9d45..6c92c5812da 100644
--- a/src/mesa/shader/grammar/grammar_mesa.h
+++ b/src/mesa/shader/grammar/grammar_mesa.h
@@ -26,7 +26,7 @@
#define GRAMMAR_MESA_H
-#include "imports.h"
+#include "main/imports.h"
/* NOTE: include Mesa 3-D specific headers here */
diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c
index 0f1a1eade4a..a2a7a5f3f49 100644
--- a/src/mesa/shader/nvfragparse.c
+++ b/src/mesa/shader/nvfragparse.c
@@ -37,10 +37,10 @@
* including any use thereof or modifications thereto.
*/
-#include "glheader.h"
-#include "context.h"
-#include "imports.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/imports.h"
+#include "main/macros.h"
#include "prog_parameter.h"
#include "prog_instruction.h"
#include "nvfragparse.h"
diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c
index 409c61cdc11..d656d4b28b6 100644
--- a/src/mesa/shader/nvprogram.c
+++ b/src/mesa/shader/nvprogram.c
@@ -37,11 +37,11 @@
* including any use thereof or modifications thereto.
*/
-#include "glheader.h"
-#include "context.h"
-#include "hash.h"
-#include "imports.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/hash.h"
+#include "main/imports.h"
+#include "main/macros.h"
#include "prog_parameter.h"
#include "prog_instruction.h"
#include "nvfragparse.h"
diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c
index ac96d4a60ed..08538c0ee4f 100644
--- a/src/mesa/shader/nvvertparse.c
+++ b/src/mesa/shader/nvvertparse.c
@@ -37,10 +37,10 @@
* including any use thereof or modifications thereto.
*/
-#include "glheader.h"
-#include "context.h"
-#include "imports.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/imports.h"
+#include "main/macros.h"
#include "nvprogram.h"
#include "nvvertparse.h"
#include "prog_instruction.h"
diff --git a/src/mesa/shader/prog_debug.c b/src/mesa/shader/prog_debug.c
index 57929fcbcae..7bcb2ef734a 100644
--- a/src/mesa/shader/prog_debug.c
+++ b/src/mesa/shader/prog_debug.c
@@ -23,9 +23,9 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/macros.h"
#include "nvfragparse.h"
#include "nvvertparse.h"
#include "program.h"
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index 4745211c659..5afd9eb1534 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -35,9 +35,9 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
#include "program.h"
#include "prog_execute.h"
#include "prog_instruction.h"
diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c
index bea5d0551e4..1033496d978 100644
--- a/src/mesa/shader/prog_instruction.c
+++ b/src/mesa/shader/prog_instruction.c
@@ -23,9 +23,9 @@
*/
-#include "glheader.h"
-#include "imports.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "prog_instruction.h"
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index d87e8f6e15f..e0d2096b305 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -29,9 +29,9 @@
*/
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/macros.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
#include "prog_statevars.h"
diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h
index dfb8c39ca4e..ac5c629fabc 100644
--- a/src/mesa/shader/prog_parameter.h
+++ b/src/mesa/shader/prog_parameter.h
@@ -31,7 +31,7 @@
#ifndef PROG_PARAMETER_H
#define PROG_PARAMETER_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "prog_statevars.h"
diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c
index 5368ab21877..10c5afec189 100644
--- a/src/mesa/shader/prog_print.c
+++ b/src/mesa/shader/prog_print.c
@@ -28,9 +28,9 @@
* \author Brian Paul
*/
-#include "glheader.h"
-#include "context.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/imports.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
#include "prog_print.h"
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index 81bb4122f20..819db25a001 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -29,12 +29,12 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "hash.h"
-#include "imports.h"
-#include "macros.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/hash.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/mtypes.h"
#include "prog_statevars.h"
#include "prog_parameter.h"
diff --git a/src/mesa/shader/prog_statevars.h b/src/mesa/shader/prog_statevars.h
index a515fda3aae..0a1c2358283 100644
--- a/src/mesa/shader/prog_statevars.h
+++ b/src/mesa/shader/prog_statevars.h
@@ -25,7 +25,7 @@
#ifndef PROG_STATEVARS_H
#define PROG_STATEVARS_H
-#include "mtypes.h"
+#include "main/mtypes.h"
/**
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index 13d6df1ce6e..02e23aaa3a0 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -29,9 +29,9 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "hash.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/hash.h"
#include "program.h"
#include "prog_cache.h"
#include "prog_parameter.h"
diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h
index 74849613641..f8bd63233ed 100644
--- a/src/mesa/shader/program.h
+++ b/src/mesa/shader/program.h
@@ -40,7 +40,7 @@
#ifndef PROGRAM_H
#define PROGRAM_H
-#include "mtypes.h"
+#include "main/mtypes.h"
extern struct gl_program _mesa_DummyProgram;
diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c
index f3511ba00ec..d6a32310551 100644
--- a/src/mesa/shader/programopt.c
+++ b/src/mesa/shader/programopt.c
@@ -31,8 +31,8 @@
*/
-#include "glheader.h"
-#include "context.h"
+#include "main/glheader.h"
+#include "main/context.h"
#include "prog_parameter.h"
#include "prog_statevars.h"
#include "program.h"
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index bd3745cfe60..5c18e55dacf 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -35,10 +35,10 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "hash.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/hash.h"
+#include "main/macros.h"
#include "program.h"
#include "prog_parameter.h"
#include "prog_print.h"
@@ -262,15 +262,11 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type)
void
_mesa_free_shader(GLcontext *ctx, struct gl_shader *sh)
{
- GLuint i;
if (sh->Source)
_mesa_free((void *) sh->Source);
if (sh->InfoLog)
_mesa_free(sh->InfoLog);
- for (i = 0; i < sh->NumPrograms; i++)
- _mesa_reference_program(ctx, &sh->Programs[i], NULL);
- if (sh->Programs)
- _mesa_free(sh->Programs);
+ _mesa_reference_program(ctx, &sh->Program, NULL);
_mesa_free(sh);
}
@@ -513,7 +509,7 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
struct gl_shader_program *shProg;
const GLint size = -1; /* unknown size */
GLint i, oldIndex;
- GLenum datatype;
+ GLenum datatype = GL_FLOAT_VEC4;
shProg = _mesa_lookup_shader_program_err(ctx, program,
"glBindAttribLocation");
@@ -547,6 +543,7 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
i = _mesa_add_attribute(shProg->Attributes, name, size, datatype, index);
if (i < 0) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindAttribLocation");
+ return;
}
if (shProg->VertexProgram && oldIndex >= 0 && oldIndex != index) {
diff --git a/src/mesa/shader/shader_api.h b/src/mesa/shader/shader_api.h
index 5521c585b53..e7f12669156 100644
--- a/src/mesa/shader/shader_api.h
+++ b/src/mesa/shader/shader_api.h
@@ -27,8 +27,8 @@
#define SHADER_API_H
-#include "glheader.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/mtypes.h"
/**
diff --git a/src/mesa/shader/slang/library/slang_120_core.gc b/src/mesa/shader/slang/library/slang_120_core.gc
index 15ca3a81ad7..04c5ec2ec5c 100644
--- a/src/mesa/shader/slang/library/slang_120_core.gc
+++ b/src/mesa/shader/slang/library/slang_120_core.gc
@@ -1976,53 +1976,3 @@ void __operator ++ (inout mat4x3 m) {
++m[3];
}
-
-mat2x3 __operator -- (inout mat2x3 m, const int) {
- return mat2x3 (m[0]--, m[1]--);
-}
-
-mat2x4 __operator -- (inout mat2x4 m, const int) {
- return mat2x4 (m[0]--, m[1]--);
-}
-
-mat3x2 __operator -- (inout mat3x2 m, const int) {
- return mat3x2 (m[0]--, m[1]--, m[2]--);
-}
-
-mat3x4 __operator -- (inout mat3x4 m, const int) {
- return mat3x4 (m[0]--, m[1]--, m[2]--);
-}
-
-mat4x2 __operator -- (inout mat4x2 m, const int) {
- return mat4x2 (m[0]--, m[1]--, m[2]--, m[3]--);
-}
-
-mat4x3 __operator -- (inout mat4x3 m, const int) {
- return mat4x3 (m[0]--, m[1]--, m[2]--, m[3]--);
-}
-
-
-mat2x3 __operator ++ (inout mat2x3 m, const int) {
- return mat2x3 (m[0]++, m[1]++);
-}
-
-mat2x4 __operator ++ (inout mat2x4 m, const int) {
- return mat2x4 (m[0]++, m[1]++);
-}
-
-mat3x2 __operator ++ (inout mat3x2 m, const int) {
- return mat3x2 (m[0]++, m[1]++, m[2]++);
-}
-
-mat3x4 __operator ++ (inout mat3x4 m, const int) {
- return mat3x4 (m[0]++, m[1]++, m[2]++);
-}
-
-mat4x2 __operator ++ (inout mat4x2 m, const int) {
- return mat4x2 (m[0]++, m[1]++, m[2]++, m[3]++);
-}
-
-mat4x3 __operator ++ (inout mat4x3 m, const int) {
- return mat4x3 (m[0]++, m[1]++, m[2]++, m[3]++);
-}
-
diff --git a/src/mesa/shader/slang/library/slang_120_core_gc.h b/src/mesa/shader/slang/library/slang_120_core_gc.h
index b7ef5ed6c64..1bd781ffe55 100644
--- a/src/mesa/shader/slang/library/slang_120_core_gc.h
+++ b/src/mesa/shader/slang/library/slang_120_core_gc.h
@@ -707,24 +707,4 @@
109,0,16,10,49,0,57,51,0,9,18,109,0,16,10,50,0,57,51,0,0,1,0,0,2,24,1,0,2,29,109,0,0,0,1,9,18,109,
0,16,8,48,0,57,51,0,9,18,109,0,16,10,49,0,57,51,0,9,18,109,0,16,10,50,0,57,51,0,9,18,109,0,16,10,
51,0,57,51,0,0,1,0,0,2,24,1,0,2,31,109,0,0,0,1,9,18,109,0,16,8,48,0,57,51,0,9,18,109,0,16,10,49,0,
-57,51,0,9,18,109,0,16,10,50,0,57,51,0,9,18,109,0,16,10,51,0,57,51,0,0,1,0,26,2,25,1,0,2,26,109,0,0,
-1,1,0,5,0,0,0,1,8,58,109,97,116,50,120,51,0,18,109,0,16,8,48,0,57,61,0,18,109,0,16,10,49,0,57,61,0,
-0,0,0,1,0,28,2,25,1,0,2,28,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,116,50,120,52,0,18,109,0,16,8,48,0,
-57,61,0,18,109,0,16,10,49,0,57,61,0,0,0,0,1,0,27,2,25,1,0,2,27,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,
-116,51,120,50,0,18,109,0,16,8,48,0,57,61,0,18,109,0,16,10,49,0,57,61,0,18,109,0,16,10,50,0,57,61,0,
-0,0,0,1,0,30,2,25,1,0,2,30,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,116,51,120,52,0,18,109,0,16,8,48,0,
-57,61,0,18,109,0,16,10,49,0,57,61,0,18,109,0,16,10,50,0,57,61,0,0,0,0,1,0,29,2,25,1,0,2,29,109,0,0,
-1,1,0,5,0,0,0,1,8,58,109,97,116,52,120,50,0,18,109,0,16,8,48,0,57,61,0,18,109,0,16,10,49,0,57,61,0,
-18,109,0,16,10,50,0,57,61,0,18,109,0,16,10,51,0,57,61,0,0,0,0,1,0,31,2,25,1,0,2,31,109,0,0,1,1,0,5,
-0,0,0,1,8,58,109,97,116,52,120,51,0,18,109,0,16,8,48,0,57,61,0,18,109,0,16,10,49,0,57,61,0,18,109,
-0,16,10,50,0,57,61,0,18,109,0,16,10,51,0,57,61,0,0,0,0,1,0,26,2,24,1,0,2,26,109,0,0,1,1,0,5,0,0,0,
-1,8,58,109,97,116,50,120,51,0,18,109,0,16,8,48,0,57,60,0,18,109,0,16,10,49,0,57,60,0,0,0,0,1,0,28,
-2,24,1,0,2,28,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,116,50,120,52,0,18,109,0,16,8,48,0,57,60,0,18,
-109,0,16,10,49,0,57,60,0,0,0,0,1,0,27,2,24,1,0,2,27,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,116,51,120,
-50,0,18,109,0,16,8,48,0,57,60,0,18,109,0,16,10,49,0,57,60,0,18,109,0,16,10,50,0,57,60,0,0,0,0,1,0,
-30,2,24,1,0,2,30,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,116,51,120,52,0,18,109,0,16,8,48,0,57,60,0,18,
-109,0,16,10,49,0,57,60,0,18,109,0,16,10,50,0,57,60,0,0,0,0,1,0,29,2,24,1,0,2,29,109,0,0,1,1,0,5,0,
-0,0,1,8,58,109,97,116,52,120,50,0,18,109,0,16,8,48,0,57,60,0,18,109,0,16,10,49,0,57,60,0,18,109,0,
-16,10,50,0,57,60,0,18,109,0,16,10,51,0,57,60,0,0,0,0,1,0,31,2,24,1,0,2,31,109,0,0,1,1,0,5,0,0,0,1,
-8,58,109,97,116,52,120,51,0,18,109,0,16,8,48,0,57,60,0,18,109,0,16,10,49,0,57,60,0,18,109,0,16,10,
-50,0,57,60,0,18,109,0,16,10,51,0,57,60,0,0,0,0,0
+57,51,0,9,18,109,0,16,10,50,0,57,51,0,9,18,109,0,16,10,51,0,57,51,0,0,0
diff --git a/src/mesa/shader/slang/library/slang_core.gc b/src/mesa/shader/slang/library/slang_core.gc
index 2c3a5a6c452..1f579970518 100644
--- a/src/mesa/shader/slang/library/slang_core.gc
+++ b/src/mesa/shader/slang/library/slang_core.gc
@@ -110,6 +110,16 @@ int __constructor(const float f)
__asm float_to_int __retVal, f;
}
+int __constructor(const bool b)
+{
+ __retVal = b;
+}
+
+int __constructor(const int i)
+{
+ __retVal = i;
+}
+
bool __constructor(const int i)
{
const float zero = 0.0;
@@ -122,12 +132,7 @@ bool __constructor(const float f)
__asm vec4_sne __retVal, f, zero;
}
-int __constructor(const bool b)
-{
- __retVal = b;
-}
-
-float __constructor(const bool b)
+bool __constructor(const bool b)
{
__retVal = b;
}
@@ -137,16 +142,11 @@ float __constructor(const int i)
__asm int_to_float __retVal, i;
}
-bool __constructor(const bool b)
+float __constructor(const bool b)
{
__retVal = b;
}
-int __constructor(const int i)
-{
- __retVal = i;
-}
-
float __constructor(const float f)
{
__retVal = f;
diff --git a/src/mesa/shader/slang/library/slang_core_gc.h b/src/mesa/shader/slang/library/slang_core_gc.h
index f71fe28cdac..44170946ce1 100644
--- a/src/mesa/shader/slang/library/slang_core_gc.h
+++ b/src/mesa/shader/slang/library/slang_core_gc.h
@@ -3,15 +3,15 @@
/* slang_core.gc */
3,1,0,5,1,1,1,0,9,102,0,0,0,1,4,102,108,111,97,116,95,116,111,95,105,110,116,0,18,95,95,114,101,
-116,86,97,108,0,0,18,102,0,0,0,0,1,0,1,1,1,1,0,5,105,0,0,0,1,3,2,1,9,1,122,101,114,111,0,2,17,48,0,
-48,0,0,0,0,4,118,101,99,52,95,115,110,101,0,18,95,95,114,101,116,86,97,108,0,0,18,105,0,0,18,122,
-101,114,111,0,0,0,0,1,0,1,1,1,1,0,9,102,0,0,0,1,3,2,1,9,1,122,101,114,111,0,2,17,48,0,48,0,0,0,0,4,
-118,101,99,52,95,115,110,101,0,18,95,95,114,101,116,86,97,108,0,0,18,102,0,0,18,122,101,114,111,0,
-0,0,0,1,0,5,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,98,0,20,0,0,1,0,9,1,1,1,0,1,
-98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,98,0,20,0,0,1,0,9,1,1,1,0,5,105,0,0,0,1,4,105,110,
-116,95,116,111,95,102,108,111,97,116,0,18,95,95,114,101,116,86,97,108,0,0,18,105,0,0,0,0,1,0,1,1,1,
-1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,98,0,20,0,0,1,0,5,1,1,1,0,5,105,0,0,0,1,9,
-18,95,95,114,101,116,86,97,108,0,18,105,0,20,0,0,1,0,9,1,1,1,0,9,102,0,0,0,1,9,18,95,95,114,101,
+116,86,97,108,0,0,18,102,0,0,0,0,1,0,5,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,
+98,0,20,0,0,1,0,5,1,1,1,0,5,105,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,105,0,20,0,0,1,0,1,1,
+1,1,0,5,105,0,0,0,1,3,2,1,9,1,122,101,114,111,0,2,17,48,0,48,0,0,0,0,4,118,101,99,52,95,115,110,
+101,0,18,95,95,114,101,116,86,97,108,0,0,18,105,0,0,18,122,101,114,111,0,0,0,0,1,0,1,1,1,1,0,9,102,
+0,0,0,1,3,2,1,9,1,122,101,114,111,0,2,17,48,0,48,0,0,0,0,4,118,101,99,52,95,115,110,101,0,18,95,95,
+114,101,116,86,97,108,0,0,18,102,0,0,18,122,101,114,111,0,0,0,0,1,0,1,1,1,1,0,1,98,0,0,0,1,9,18,95,
+95,114,101,116,86,97,108,0,18,98,0,20,0,0,1,0,9,1,1,1,0,5,105,0,0,0,1,4,105,110,116,95,116,111,95,
+102,108,111,97,116,0,18,95,95,114,101,116,86,97,108,0,0,18,105,0,0,0,0,1,0,9,1,1,1,0,1,98,0,0,0,1,
+9,18,95,95,114,101,116,86,97,108,0,18,98,0,20,0,0,1,0,9,1,1,1,0,9,102,0,0,0,1,9,18,95,95,114,101,
116,86,97,108,0,18,102,0,20,0,0,1,0,10,1,1,1,0,9,120,0,0,1,1,0,9,121,0,0,0,1,9,18,95,95,114,101,
116,86,97,108,0,59,120,0,18,120,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,18,121,0,20,0,0,
1,0,10,1,1,1,0,9,102,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,0,18,102,0,59,120,120,0,
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index d4bf99f78f9..ad9cf06e275 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -1178,7 +1178,8 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
slang_operation_copy(inlined, fun->body);
/*** XXX review this */
- assert(inlined->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE);
+ assert(inlined->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE ||
+ inlined->type == SLANG_OPER_BLOCK_NEW_SCOPE);
inlined->type = SLANG_OPER_BLOCK_NEW_SCOPE;
#if 0
@@ -1702,7 +1703,7 @@ print_funcs(struct slang_function_scope_ *scope, const char *name)
/**
- * Return first function in the scope that has the given name.
+ * Find a function of the given name, taking 'numArgs' arguments.
* This is the function we'll try to call when there is no exact match
* between function parameters and call arguments.
*
@@ -1710,20 +1711,51 @@ print_funcs(struct slang_function_scope_ *scope, const char *name)
* all of them...
*/
static slang_function *
-_slang_first_function(struct slang_function_scope_ *scope, const char *name)
-{
- GLuint i;
- for (i = 0; i < scope->num_functions; i++) {
- slang_function *f = &scope->functions[i];
- if (strcmp(name, (char*) f->header.a_name) == 0)
- return f;
+_slang_find_function_by_argc(slang_function_scope *scope,
+ const char *name, int numArgs)
+{
+ while (scope) {
+ GLuint i;
+ for (i = 0; i < scope->num_functions; i++) {
+ slang_function *f = &scope->functions[i];
+ if (strcmp(name, (char*) f->header.a_name) == 0) {
+ int haveRetValue = _slang_function_has_return_value(f);
+ if (numArgs == f->param_count - haveRetValue)
+ return f;
+ }
+ }
+ scope = scope->outer_scope;
}
- if (scope->outer_scope)
- return _slang_first_function(scope->outer_scope, name);
+
return NULL;
}
+static slang_function *
+_slang_find_function_by_max_argc(slang_function_scope *scope,
+ const char *name)
+{
+ slang_function *maxFunc = NULL;
+ GLuint maxArgs = 0;
+
+ while (scope) {
+ GLuint i;
+ for (i = 0; i < scope->num_functions; i++) {
+ slang_function *f = &scope->functions[i];
+ if (strcmp(name, (char*) f->header.a_name) == 0) {
+ if (f->param_count > maxArgs) {
+ maxArgs = f->param_count;
+ maxFunc = f;
+ }
+ }
+ }
+ scope = scope->outer_scope;
+ }
+
+ return maxFunc;
+}
+
+
/**
* Generate a new slang_function which is a constructor for a user-defined
* struct type.
@@ -1754,7 +1786,8 @@ _slang_make_constructor(slang_assemble_ctx *A, slang_struct *str)
printf("Field %d: %s\n", i, (char*) str->fields->variables[i]->a_name);
*/
slang_variable *p = slang_variable_scope_grow(fun->parameters);
- *p = *str->fields->variables[i];
+ *p = *str->fields->variables[i]; /* copy the type */
+ p->type.qualifier = SLANG_QUAL_CONST;
}
fun->param_count = fun->parameters->num_variables;
}
@@ -1780,16 +1813,20 @@ _slang_make_constructor(slang_assemble_ctx *A, slang_struct *str)
* return T;
*/
{
+ slang_variable_scope *scope;
slang_variable *var;
GLint i;
fun->body = slang_operation_new(1);
- fun->body->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE;
+ fun->body->type = SLANG_OPER_BLOCK_NEW_SCOPE;
fun->body->num_children = numFields + 2;
fun->body->children = slang_operation_new(numFields + 2);
+ scope = fun->body->locals;
+ scope->outer_scope = fun->parameters;
+
/* create local var 't' */
- var = slang_variable_scope_grow(fun->parameters);
+ var = slang_variable_scope_grow(scope);
var->a_name = slang_atom_pool_atom(A->atoms, "t");
var->type = fun->header.type;
@@ -1799,7 +1836,7 @@ _slang_make_constructor(slang_assemble_ctx *A, slang_struct *str)
decl = &fun->body->children[0];
decl->type = SLANG_OPER_VARIABLE_DECL;
- decl->locals = _slang_variable_scope_new(fun->parameters);
+ decl->locals = _slang_variable_scope_new(scope);
decl->a_id = var->a_name;
}
@@ -1808,7 +1845,7 @@ _slang_make_constructor(slang_assemble_ctx *A, slang_struct *str)
slang_operation *assign = &fun->body->children[1 + i];
assign->type = SLANG_OPER_ASSIGN;
- assign->locals = _slang_variable_scope_new(fun->parameters);
+ assign->locals = _slang_variable_scope_new(scope);
assign->num_children = 2;
assign->children = slang_operation_new(2);
@@ -1816,21 +1853,21 @@ _slang_make_constructor(slang_assemble_ctx *A, slang_struct *str)
slang_operation *lhs = &assign->children[0];
lhs->type = SLANG_OPER_FIELD;
- lhs->locals = _slang_variable_scope_new(fun->parameters);
+ lhs->locals = _slang_variable_scope_new(scope);
lhs->num_children = 1;
lhs->children = slang_operation_new(1);
lhs->a_id = str->fields->variables[i]->a_name;
lhs->children[0].type = SLANG_OPER_IDENTIFIER;
lhs->children[0].a_id = var->a_name;
- lhs->children[0].locals = _slang_variable_scope_new(fun->parameters);
+ lhs->children[0].locals = _slang_variable_scope_new(scope);
#if 0
lhs->children[1].num_children = 1;
lhs->children[1].children = slang_operation_new(1);
lhs->children[1].children[0].type = SLANG_OPER_IDENTIFIER;
lhs->children[1].children[0].a_id = str->fields->variables[i]->a_name;
- lhs->children[1].children->locals = _slang_variable_scope_new(fun->parameters);
+ lhs->children[1].children->locals = _slang_variable_scope_new(scope);
#endif
}
@@ -1838,7 +1875,7 @@ _slang_make_constructor(slang_assemble_ctx *A, slang_struct *str)
slang_operation *rhs = &assign->children[1];
rhs->type = SLANG_OPER_IDENTIFIER;
- rhs->locals = _slang_variable_scope_new(fun->parameters);
+ rhs->locals = _slang_variable_scope_new(scope);
rhs->a_id = str->fields->variables[i]->a_name;
}
}
@@ -1848,12 +1885,12 @@ _slang_make_constructor(slang_assemble_ctx *A, slang_struct *str)
slang_operation *ret = &fun->body->children[numFields + 1];
ret->type = SLANG_OPER_RETURN;
- ret->locals = _slang_variable_scope_new(fun->parameters);
+ ret->locals = _slang_variable_scope_new(scope);
ret->num_children = 1;
ret->children = slang_operation_new(1);
ret->children[0].type = SLANG_OPER_IDENTIFIER;
ret->children[0].a_id = var->a_name;
- ret->children[0].locals = _slang_variable_scope_new(fun->parameters);
+ ret->children[0].locals = _slang_variable_scope_new(scope);
}
}
@@ -1870,7 +1907,7 @@ _slang_make_constructor(slang_assemble_ctx *A, slang_struct *str)
static slang_function *
_slang_locate_struct_constructor(slang_assemble_ctx *A, const char *name)
{
- int i;
+ unsigned int i;
for (i = 0; i < A->space.structs->num_structs; i++) {
slang_struct *str = &A->space.structs->structs[i];
if (strcmp(name, (const char *) str->a_name) == 0) {
@@ -1886,6 +1923,27 @@ _slang_locate_struct_constructor(slang_assemble_ctx *A, const char *name)
}
+
+static GLboolean
+_slang_is_vec_mat_type(const char *name)
+{
+ static const char *vecmat_types[] = {
+ "float", "int", "bool",
+ "vec2", "vec3", "vec4",
+ "ivec2", "ivec3", "ivec4",
+ "bvec2", "bvec3", "bvec4",
+ "mat2", "mat3", "mat4",
+ "mat2x3", "mat2x4", "mat3x2", "mat3x4", "mat4x2", "mat4x3",
+ NULL
+ };
+ int i;
+ for (i = 0; vecmat_types[i]; i++)
+ if (_mesa_strcmp(name, vecmat_types[i]) == 0)
+ return GL_TRUE;
+ return GL_FALSE;
+}
+
+
/**
* Assemble a function call, given a particular function name.
* \param name the function's name (operators like '*' are possible).
@@ -1898,28 +1956,53 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name,
const GLuint param_count = oper->num_children;
slang_atom atom;
slang_function *fun;
+ GLboolean error;
atom = slang_atom_pool_atom(A->atoms, name);
if (atom == SLANG_ATOM_NULL)
return NULL;
/*
- * Use 'name' to find the function to call
+ * First, try to find function by name and exact argument type matching.
*/
fun = _slang_locate_function(A->space.funcs, atom, params, param_count,
- &A->space, A->atoms, A->log);
+ &A->space, A->atoms, A->log, &error);
+
+ if (error) {
+ slang_info_log_error(A->log,
+ "Function '%s' not found (check argument types)",
+ name);
+ return NULL;
+ }
if (!fun) {
+ /* Next, try locating a constructor function for a user-defined type */
fun = _slang_locate_struct_constructor(A, name);
}
- if (!fun) {
- /* A function with exactly the right parameters/types was not found.
- * Try adapting the parameters.
+ if (!fun && _slang_is_vec_mat_type(name)) {
+ /* Next, if this call looks like a vec() or mat() constructor call,
+ * try "unwinding" the args to satisfy a constructor.
*/
- fun = _slang_first_function(A->space.funcs, name);
- if (!fun || !_slang_adapt_call(oper, fun, &A->space, A->atoms, A->log)) {
- slang_info_log_error(A->log, "Function '%s' not found (check argument types)", name);
+ fun = _slang_find_function_by_max_argc(A->space.funcs, name);
+ if (fun) {
+ if (!_slang_adapt_call(oper, fun, &A->space, A->atoms, A->log)) {
+ slang_info_log_error(A->log,
+ "Function '%s' not found (check argument types)",
+ name);
+ return NULL;
+ }
+ }
+ }
+
+ if (!fun) {
+ /* Next, try casting args to the types of the formal parameters */
+ int numArgs = oper->num_children;
+ fun = _slang_find_function_by_argc(A->space.funcs, name, numArgs);
+ if (!fun || !_slang_cast_func_params(oper, fun, &A->space, A->atoms, A->log)) {
+ slang_info_log_error(A->log,
+ "Function '%s' not found (check argument types)",
+ name);
return NULL;
}
assert(fun);
@@ -2193,22 +2276,16 @@ _slang_gen_if(slang_assemble_ctx * A, const slang_operation *oper)
cond = _slang_gen_operation(A, &oper->children[0]);
cond = new_cond(cond);
- if (is_operation_type(&oper->children[1], SLANG_OPER_BREAK)) {
+ if (is_operation_type(&oper->children[1], SLANG_OPER_BREAK)
+ && !haveElseClause) {
/* Special case: generate a conditional break */
ifBody = new_break_if_true(A->CurLoop, cond);
- if (haveElseClause) {
- elseBody = _slang_gen_operation(A, &oper->children[2]);
- return new_seq(ifBody, elseBody);
- }
return ifBody;
}
- else if (is_operation_type(&oper->children[1], SLANG_OPER_CONTINUE)) {
+ else if (is_operation_type(&oper->children[1], SLANG_OPER_CONTINUE)
+ && !haveElseClause) {
/* Special case: generate a conditional break */
ifBody = new_cont_if_true(A->CurLoop, cond);
- if (haveElseClause) {
- elseBody = _slang_gen_operation(A, &oper->children[2]);
- return new_seq(ifBody, elseBody);
- }
return ifBody;
}
else {
@@ -2318,6 +2395,11 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var)
n->Store->File = PROGRAM_TEMPORARY;
n->Store->Size = _slang_sizeof_type_specifier(&n->Var->type.specifier);
+ if (n->Store->Size <= 0) {
+ slang_info_log_error(A->log, "invalid declaration for '%s'",
+ (char*) var->a_name);
+ return NULL;
+ }
#if 0
printf("%s var %p %s store=%p index=%d size=%d\n",
__FUNCTION__, (void *) var, (char *) var->a_name,
@@ -2553,8 +2635,16 @@ _slang_gen_declaration(slang_assemble_ctx *A, slang_operation *oper)
assert(oper->num_children == 0 || oper->num_children == 1);
v = _slang_locate_variable(oper->locals, oper->a_id, GL_TRUE);
+ /*printf("Declare %s at %p\n", varName, v);*/
assert(v);
+#if 0
+ if (v->declared) {
+ slang_info_log_error(A->log, "variable '%s' redeclared", varName);
+ return NULL;
+ }
+#endif
+
varDecl = _slang_gen_var_decl(A, v);
if (oper->num_children > 0) {
@@ -2711,6 +2801,11 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
lhs = _slang_gen_operation(A, &oper->children[0]);
if (lhs) {
+ if (!lhs->Store) {
+ slang_info_log_error(A->log,
+ "invalid left hand side for assignment");
+ return NULL;
+ }
if (!(lhs->Store->File == PROGRAM_OUTPUT ||
lhs->Store->File == PROGRAM_TEMPORARY ||
(lhs->Store->File == PROGRAM_VARYING &&
@@ -2764,6 +2859,7 @@ _slang_gen_struct_field(slang_assemble_ctx * A, slang_operation *oper)
GLuint swizzle;
if (!_slang_is_swizzle((char *) oper->a_id, rows, &swz)) {
slang_info_log_error(A->log, "Bad swizzle");
+ return NULL;
}
swizzle = MAKE_SWIZZLE4(swz.swizzle[0],
swz.swizzle[1],
@@ -2812,10 +2908,14 @@ _slang_gen_struct_field(slang_assemble_ctx * A, slang_operation *oper)
fieldOffset = _slang_field_offset(&ti.spec, oper->a_id);
if (fieldSize == 0 || fieldOffset < 0) {
+ const char *structName;
+ if (ti.spec._struct)
+ structName = (char *) ti.spec._struct->a_name;
+ else
+ structName = "unknown";
slang_info_log_error(A->log,
"\"%s\" is not a member of struct \"%s\"",
- (char *) oper->a_id,
- (char *) ti.spec._struct->a_name);
+ (char *) oper->a_id, structName);
return NULL;
}
assert(fieldSize >= 0);
@@ -2889,6 +2989,7 @@ _slang_gen_array_element(slang_assemble_ctx * A, slang_operation *oper)
/*n->Store = _slang_clone_ir_storage_swz(n->Store, */
n->Writemask = WRITEMASK_X << index;
}
+ assert(n->Store);
return n;
}
else {
@@ -2933,11 +3034,17 @@ _slang_gen_array_element(slang_assemble_ctx * A, slang_operation *oper)
}
}
+ if (!array->Store) {
+ slang_info_log_error(A->log, "Invalid array");
+ return NULL;
+ }
+
elem = new_node2(IR_ELEMENT, array, index);
elem->Store = _slang_new_ir_storage_relative(constIndex,
elemSize,
array->Store);
+ assert(elem->Store->Parent);
/* XXX try to do some array bounds checking here */
return elem;
}
@@ -2950,6 +3057,39 @@ _slang_gen_array_element(slang_assemble_ctx * A, slang_operation *oper)
}
+#if 0
+static void
+print_vars(slang_variable_scope *s)
+{
+ int i;
+ printf("vars: ");
+ for (i = 0; i < s->num_variables; i++) {
+ printf("%s %d, \n",
+ (char*) s->variables[i]->a_name,
+ s->variables[i]->declared);
+ }
+
+ printf("\n");
+}
+#endif
+
+
+#if 0
+static void
+_slang_undeclare_vars(slang_variable_scope *locals)
+{
+ if (locals->num_variables > 0) {
+ int i;
+ for (i = 0; i < locals->num_variables; i++) {
+ slang_variable *v = locals->variables[i];
+ printf("undeclare %s at %p\n", (char*) v->a_name, v);
+ v->declared = GL_FALSE;
+ }
+ }
+}
+#endif
+
+
/**
* Generate IR tree for a slang_operation (AST node)
*/
@@ -2969,6 +3109,9 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
_slang_pop_var_table(A->vartable);
+ /*_slang_undeclare_vars(oper->locals);*/
+ /*print_vars(oper->locals);*/
+
if (n)
n = new_node1(IR_SCOPE, n);
return n;
@@ -2991,26 +3134,6 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
tree = new_seq(tree, n);
}
-#if 00
- if (oper->locals->num_variables > 0) {
- int i;
- /*
- printf("\n****** Deallocate vars in scope!\n");
- */
- for (i = 0; i < oper->locals->num_variables; i++) {
- slang_variable *v = oper->locals->variables + i;
- if (v->aux) {
- slang_ir_storage *store = (slang_ir_storage *) v->aux;
- /*
- printf(" Deallocate var %s\n", (char*) v->a_name);
- */
- assert(store->File == PROGRAM_TEMPORARY);
- assert(store->Index >= 0);
- _slang_free_temp(A->vartable, store->Index, store->Size);
- }
- }
- }
-#endif
return tree;
}
else {
diff --git a/src/mesa/shader/slang/slang_codegen.h b/src/mesa/shader/slang/slang_codegen.h
index 821d3961625..ba7ca4c142c 100644
--- a/src/mesa/shader/slang/slang_codegen.h
+++ b/src/mesa/shader/slang/slang_codegen.h
@@ -27,7 +27,7 @@
#define SLANG_CODEGEN_H
-#include "imports.h"
+#include "main/imports.h"
#include "slang_compile.h"
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index fd5d4afacb6..60539f19b6e 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -337,9 +337,10 @@ convert_to_array(slang_parse_ctx * C, slang_variable * var,
static GLboolean
parse_struct_field_var(slang_parse_ctx * C, slang_output_ctx * O,
- slang_variable * var, const slang_type_specifier * sp)
+ slang_variable * var, slang_atom a_name,
+ const slang_type_specifier * sp)
{
- var->a_name = parse_identifier(C);
+ var->a_name = a_name;
if (var->a_name == SLANG_ATOM_NULL)
return GL_FALSE;
@@ -372,12 +373,19 @@ parse_struct_field(slang_parse_ctx * C, slang_output_ctx * O,
return 0;
do {
+ slang_atom a_name;
slang_variable *var = slang_variable_scope_grow(st->fields);
if (!var) {
slang_info_log_memory(C->L);
return 0;
}
- if (!parse_struct_field_var(C, &o, var, sp))
+ a_name = parse_identifier(C);
+ if (_slang_locate_variable(st->fields, a_name, GL_FALSE)) {
+ slang_info_log_error(C->L, "duplicate field '%s'", (char *) a_name);
+ return 0;
+ }
+
+ if (!parse_struct_field_var(C, &o, var, a_name, sp))
return 0;
}
while (*C->I++ != FIELD_NONE);
@@ -1579,11 +1587,22 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
const slang_fully_specified_type * type)
{
slang_variable *var;
+ slang_atom a_name;
/* empty init declatator (without name, e.g. "float ;") */
if (*C->I++ == VARIABLE_NONE)
return 1;
+ a_name = parse_identifier(C);
+
+ /* check if name is already in this scope */
+ if (_slang_locate_variable(O->vars, a_name, GL_FALSE)) {
+ slang_info_log_error(C->L,
+ "declaration of '%s' conflicts with previous declaration",
+ (char *) a_name);
+ return 0;
+ }
+
/* make room for the new variable and initialize it */
var = slang_variable_scope_grow(O->vars);
if (!var) {
@@ -1593,7 +1612,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
/* copy the declarator qualifier type, parse the identifier */
var->type.qualifier = type->qualifier;
- var->a_name = parse_identifier(C);
+ var->a_name = a_name;
if (var->a_name == SLANG_ATOM_NULL)
return 0;
@@ -1657,6 +1676,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
A.space.vars = O->vars;
A.program = O->program;
A.vartable = O->vartable;
+ A.log = C->L;
A.curFuncEndLabel = NULL;
if (!_slang_codegen_global_variable(&A, var, C->type))
return 0;
@@ -1930,7 +1950,7 @@ parse_invariant(slang_parse_ctx * C, slang_output_ctx * O)
static GLboolean
parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
- struct gl_program *program)
+ struct gl_shader *shader)
{
GET_CURRENT_CONTEXT(ctx);
slang_output_ctx o;
@@ -1954,7 +1974,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
o.structs = &unit->structs;
o.vars = &unit->vars;
o.global_pool = &unit->object->varpool;
- o.program = program;
+ o.program = shader ? shader->Program : NULL;
o.vartable = _slang_new_var_table(maxRegs);
_slang_push_var_table(o.vartable);
@@ -2007,6 +2027,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
_slang_codegen_function(&A, mainFunc);
+ shader->Main = GL_TRUE; /* this shader defines main() */
}
_slang_pop_var_table(o.vartable);
@@ -2020,7 +2041,7 @@ compile_binary(const byte * prod, slang_code_unit * unit,
GLuint version,
slang_unit_type type, slang_info_log * infolog,
slang_code_unit * builtin, slang_code_unit * downlink,
- struct gl_program *program)
+ struct gl_shader *shader)
{
slang_parse_ctx C;
@@ -2045,14 +2066,14 @@ compile_binary(const byte * prod, slang_code_unit * unit,
}
/* parse translation unit */
- return parse_code_unit(&C, unit, program);
+ return parse_code_unit(&C, unit, shader);
}
static GLboolean
compile_with_grammar(grammar id, const char *source, slang_code_unit * unit,
slang_unit_type type, slang_info_log * infolog,
slang_code_unit * builtin,
- struct gl_program *program)
+ struct gl_shader *shader)
{
byte *prod;
GLuint size, start, version;
@@ -2114,7 +2135,7 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit,
/* Syntax is okay - translate it to internal representation. */
if (!compile_binary(prod, unit, version, type, infolog, builtin,
&builtin[SLANG_BUILTIN_TOTAL - 1],
- program)) {
+ shader)) {
grammar_alloc_free(prod);
return GL_FALSE;
}
@@ -2153,7 +2174,7 @@ static const byte slang_vertex_builtin_gc[] = {
static GLboolean
compile_object(grammar * id, const char *source, slang_code_object * object,
slang_unit_type type, slang_info_log * infolog,
- struct gl_program *program)
+ struct gl_shader *shader)
{
slang_code_unit *builtins = NULL;
GLuint base_version = 110;
@@ -2252,7 +2273,7 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
/* compile the actual shader - pass-in built-in library for external shader */
return compile_with_grammar(*id, source, &object->unit, type, infolog,
- builtins, program);
+ builtins, shader);
}
@@ -2261,22 +2282,21 @@ compile_shader(GLcontext *ctx, slang_code_object * object,
slang_unit_type type, slang_info_log * infolog,
struct gl_shader *shader)
{
- struct gl_program *program = shader->Programs[0];
GLboolean success;
grammar id = 0;
-#if 0 /* for debug */
+#if 1 /* for debug */
_mesa_printf("********* COMPILE SHADER ***********\n");
_mesa_printf("%s\n", shader->Source);
_mesa_printf("************************************\n");
#endif
- assert(program);
+ assert(shader->Program);
_slang_code_object_dtr(object);
_slang_code_object_ctr(object);
- success = compile_object(&id, shader->Source, object, type, infolog, program);
+ success = compile_object(&id, shader->Source, object, type, infolog, shader);
if (id != 0)
grammar_destroy(id);
if (!success)
@@ -2308,21 +2328,18 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
ctx->Shader.MemPool = _slang_new_mempool(1024*1024);
- /* XXX temporary hack */
- if (!shader->Programs) {
+ shader->Main = GL_FALSE;
+
+ if (!shader->Program) {
GLenum progTarget;
if (shader->Type == GL_VERTEX_SHADER)
progTarget = GL_VERTEX_PROGRAM_ARB;
else
progTarget = GL_FRAGMENT_PROGRAM_ARB;
- shader->Programs
- = (struct gl_program **) malloc(sizeof(struct gl_program*));
- shader->Programs[0] = ctx->Driver.NewProgram(ctx, progTarget, 1);
- shader->NumPrograms = 1;
-
- shader->Programs[0]->Parameters = _mesa_new_parameter_list();
- shader->Programs[0]->Varying = _mesa_new_parameter_list();
- shader->Programs[0]->Attributes = _mesa_new_parameter_list();
+ shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1);
+ shader->Program->Parameters = _mesa_new_parameter_list();
+ shader->Program->Varying = _mesa_new_parameter_list();
+ shader->Program->Attributes = _mesa_new_parameter_list();
}
slang_info_log_construct(&info_log);
@@ -2355,13 +2372,13 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
/* remove any reads of varying (output) registers */
#if 0
printf("Pre-remove output reads:\n");
- _mesa_print_program(shader->Programs[0]);
+ _mesa_print_program(shader->Programs);
#endif
- _mesa_remove_output_reads(shader->Programs[0], PROGRAM_VARYING);
- _mesa_remove_output_reads(shader->Programs[0], PROGRAM_OUTPUT);
+ _mesa_remove_output_reads(shader->Program, PROGRAM_VARYING);
+ _mesa_remove_output_reads(shader->Program, PROGRAM_OUTPUT);
#if 0
printf("Post-remove output reads:\n");
- _mesa_print_program(shader->Programs[0]);
+ _mesa_print_program(shader->Programs);
#endif
}
diff --git a/src/mesa/shader/slang/slang_compile.h b/src/mesa/shader/slang/slang_compile.h
index 0f1f820d2e0..35e468b44e7 100644
--- a/src/mesa/shader/slang/slang_compile.h
+++ b/src/mesa/shader/slang/slang_compile.h
@@ -25,8 +25,8 @@
#if !defined SLANG_COMPILE_H
#define SLANG_COMPILE_H
-#include "imports.h"
-#include "mtypes.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "slang_typeinfo.h"
#include "slang_compile_variable.h"
#include "slang_compile_struct.h"
diff --git a/src/mesa/shader/slang/slang_compile_function.c b/src/mesa/shader/slang/slang_compile_function.c
index 80769b33ae8..8405d7f778c 100644
--- a/src/mesa/shader/slang/slang_compile_function.c
+++ b/src/mesa/shader/slang/slang_compile_function.c
@@ -28,7 +28,7 @@
* \author Michal Krol
*/
-#include "imports.h"
+#include "main/imports.h"
#include "slang_compile.h"
#include "slang_mem.h"
diff --git a/src/mesa/shader/slang/slang_compile_operation.c b/src/mesa/shader/slang/slang_compile_operation.c
index 4d2fd5b6667..c0d469c8294 100644
--- a/src/mesa/shader/slang/slang_compile_operation.c
+++ b/src/mesa/shader/slang/slang_compile_operation.c
@@ -28,7 +28,7 @@
* \author Michal Krol
*/
-#include "imports.h"
+#include "main/imports.h"
#include "slang_compile.h"
#include "slang_mem.h"
diff --git a/src/mesa/shader/slang/slang_compile_struct.c b/src/mesa/shader/slang/slang_compile_struct.c
index 96bdb1f4910..e6c38730d7d 100644
--- a/src/mesa/shader/slang/slang_compile_struct.c
+++ b/src/mesa/shader/slang/slang_compile_struct.c
@@ -28,7 +28,7 @@
* \author Michal Krol
*/
-#include "imports.h"
+#include "main/imports.h"
#include "slang_mem.h"
#include "slang_compile.h"
diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c
index d53255075f6..3428b49e166 100644
--- a/src/mesa/shader/slang/slang_compile_variable.c
+++ b/src/mesa/shader/slang/slang_compile_variable.c
@@ -28,7 +28,7 @@
* \author Michal Krol
*/
-#include "imports.h"
+#include "main/imports.h"
#include "slang_compile.h"
#include "slang_mem.h"
@@ -267,6 +267,7 @@ slang_variable_construct(slang_variable * var)
var->size = 0;
var->isTemp = GL_FALSE;
var->aux = NULL;
+ var->declared = 0;
return 1;
}
@@ -325,16 +326,23 @@ slang_variable_copy(slang_variable * x, const slang_variable * y)
}
+/**
+ * Search for named variable in given scope.
+ * \param all if true, search parent scopes too.
+ */
slang_variable *
_slang_locate_variable(const slang_variable_scope * scope,
const slang_atom a_name, GLboolean all)
{
- GLuint i;
-
- for (i = 0; i < scope->num_variables; i++)
- if (a_name == scope->variables[i]->a_name)
- return scope->variables[i];
- if (all && scope->outer_scope != NULL)
- return _slang_locate_variable(scope->outer_scope, a_name, 1);
+ while (scope) {
+ GLuint i;
+ for (i = 0; i < scope->num_variables; i++)
+ if (a_name == scope->variables[i]->a_name)
+ return scope->variables[i];
+ if (all)
+ scope = scope->outer_scope;
+ else
+ scope = NULL;
+ }
return NULL;
}
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index 912c325bb2f..f1af6902ea1 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -161,9 +161,7 @@ free_temp_storage(slang_var_table *vt, slang_ir_node *n)
if (_slang_is_temp(vt, n->Store)) {
_slang_free_temp(vt, n->Store);
n->Store->Index = -1;
- n->Store->Size = -1;
- /*_mesa_free(n->Store);*/ /* XXX leak */
- n->Store = NULL;
+ n->Store = NULL; /* XXX this may not be needed */
}
}
}
@@ -258,6 +256,12 @@ storage_to_src_reg(struct prog_src_register *src, const slang_ir_storage *st)
}
assert(st->File >= 0);
+#if 1 /* XXX temporary */
+ if (st->File == PROGRAM_UNDEFINED) {
+ slang_ir_storage *st0 = (slang_ir_storage *) st;
+ st0->File = PROGRAM_TEMPORARY;
+ }
+#endif
assert(st->File < PROGRAM_UNDEFINED);
src->File = st->File;
@@ -627,7 +631,11 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
emit(emitInfo, n->Children[0]);
emit(emitInfo, n->Children[1]);
- assert(n->Children[0]->Store->Size == n->Children[1]->Store->Size);
+ if (n->Children[0]->Store->Size != n->Children[1]->Store->Size) {
+ slang_info_log_error(emitInfo->log, "invalid operands to == or !=");
+ return NULL;
+ }
+
size = n->Children[0]->Store->Size;
if (size == 1) {
@@ -717,10 +725,10 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
for (i = 0; i < num; i++) {
/* SNE t0, left[i], right[i] */
inst = new_instruction(emitInfo, OPCODE_SNE);
- inst->SrcReg[0].File = n->Children[0]->Store->File;
- inst->SrcReg[0].Index = n->Children[0]->Store->Index + i;
- inst->SrcReg[1].File = n->Children[1]->Store->File;
- inst->SrcReg[1].Index = n->Children[1]->Store->Index + i;
+ storage_to_src_reg(&inst->SrcReg[0], n->Children[0]->Store);
+ storage_to_src_reg(&inst->SrcReg[1], n->Children[1]->Store);
+ inst->SrcReg[0].Index += i;
+ inst->SrcReg[1].Index += i;
if (i == 0) {
inst->DstReg.File = accTemp.File;
inst->DstReg.Index = accTemp.Index;
@@ -1547,48 +1555,24 @@ emit_array_element(slang_emit_info *emitInfo, slang_ir_node *n)
return NULL;
}
- if (n->Children[1]->Opcode == IR_FLOAT) {
- /* Constant array index */
-#if 0 /* just debug code */
- const GLint arrayAddr = n->Children[0]->Store->Index;
- const GLint index = (GLint) n->Children[1]->Value[0];
- assert(index == n->Store->Index);
- assert(arrayAddr == parent->Index);
- assert(n->Children[0]->Store == parent);
- assert(n->Children[0]->Store->Index == parent->Index);
-#endif
-
- GLint index = n->Store->Index;
-
- slang_ir_storage *p = n->Store;
- index = 0;
- while (p->Parent) {
- int sz = (p->Size + 3) / 4;
- /*printf("element [%d] of size %d (%d)\n", p->Index, p->Size, sz);*/
- index += sz * p->Index;
- p = p->Parent;
- }
- index += p->Index;
-
- assert(root->File != PROGRAM_UNDEFINED);
+ /* do codegen for array */
+ emit(emitInfo, n->Children[0]);
- /* resolve new absolute storage location */
- assert(n->Store);
- n->Store->File = root->File;
- if (root->File == PROGRAM_STATE_VAR)
- n->Store->Index = 0;
- else
- n->Store->Index = index;
+ if (n->Children[1]->Opcode == IR_FLOAT) {
+ /* Constant array index.
+ * Set Store's index to be the offset of the array element in
+ * the register file.
+ */
+ const GLint element = (GLint) n->Children[1]->Value[0];
+ const GLint sz = (n->Store->Size + 3) / 4; /* size in slots/registers */
- n->Store->Parent = NULL;
+ n->Store->Index = sz * element;
+ assert(n->Store->Parent);
}
else {
/* Variable array index */
struct prog_instruction *inst;
- /* do codegen for array */
- emit(emitInfo, n->Children[0]);
-
/* do codegen for array index expression */
emit(emitInfo, n->Children[1]);
diff --git a/src/mesa/shader/slang/slang_emit.h b/src/mesa/shader/slang/slang_emit.h
index 153e872d740..4db4bbe5621 100644
--- a/src/mesa/shader/slang/slang_emit.h
+++ b/src/mesa/shader/slang/slang_emit.h
@@ -26,10 +26,10 @@
#define SLANG_EMIT_H
-#include "imports.h"
+#include "main/imports.h"
#include "slang_compile.h"
#include "slang_ir.h"
-#include "mtypes.h"
+#include "main/mtypes.h"
extern void
diff --git a/src/mesa/shader/slang/slang_ir.c b/src/mesa/shader/slang/slang_ir.c
index a414036a362..23d554234ee 100644
--- a/src/mesa/shader/slang/slang_ir.c
+++ b/src/mesa/shader/slang/slang_ir.c
@@ -23,8 +23,8 @@
*/
-#include "imports.h"
-#include "context.h"
+#include "main/imports.h"
+#include "main/context.h"
#include "slang_ir.h"
#include "slang_mem.h"
#include "shader/prog_print.h"
diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h
index 61ff649e5cc..e4697ba3b47 100644
--- a/src/mesa/shader/slang/slang_ir.h
+++ b/src/mesa/shader/slang/slang_ir.h
@@ -33,10 +33,10 @@
#define SLANG_IR_H
-#include "imports.h"
+#include "main/imports.h"
#include "slang_compile.h"
#include "slang_label.h"
-#include "mtypes.h"
+#include "main/mtypes.h"
/**
diff --git a/src/mesa/shader/slang/slang_library_noise.c b/src/mesa/shader/slang/slang_library_noise.c
index 46075c492c7..25a05657cc8 100644
--- a/src/mesa/shader/slang/slang_library_noise.c
+++ b/src/mesa/shader/slang/slang_library_noise.c
@@ -49,7 +49,7 @@
*/
-#include "imports.h"
+#include "main/imports.h"
#include "slang_library_noise.h"
#define FASTFLOOR(x) ( ((x)>0) ? ((int)x) : (((int)x)-1) )
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index e9b9bbc43f1..1de561930a4 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -401,15 +401,16 @@ _slang_link(GLcontext *ctx,
shProg->Varying = _mesa_new_parameter_list();
/**
- * Find attached vertex shader, fragment shader
+ * Find attached vertex, fragment shaders defining main()
*/
vertProg = NULL;
fragProg = NULL;
for (i = 0; i < shProg->NumShaders; i++) {
- if (shProg->Shaders[i]->Type == GL_VERTEX_SHADER)
- vertProg = vertex_program(shProg->Shaders[i]->Programs[0]);
- else if (shProg->Shaders[i]->Type == GL_FRAGMENT_SHADER)
- fragProg = fragment_program(shProg->Shaders[i]->Programs[0]);
+ struct gl_shader *shader = shProg->Shaders[i];
+ if (shader->Type == GL_VERTEX_SHADER && shader->Main)
+ vertProg = vertex_program(shader->Program);
+ else if (shader->Type == GL_FRAGMENT_SHADER && shader->Main)
+ fragProg = fragment_program(shader->Program);
else
_mesa_problem(ctx, "unexpected shader target in slang_link()");
}
diff --git a/src/mesa/shader/slang/slang_log.c b/src/mesa/shader/slang/slang_log.c
index c963914fe3c..01591ceba5c 100644
--- a/src/mesa/shader/slang/slang_log.c
+++ b/src/mesa/shader/slang/slang_log.c
@@ -22,7 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "imports.h"
+#include "main/imports.h"
#include "slang_log.h"
#include "slang_utility.h"
diff --git a/src/mesa/shader/slang/slang_mem.c b/src/mesa/shader/slang/slang_mem.c
index e1d1e6ba14e..21d6bfce88d 100644
--- a/src/mesa/shader/slang/slang_mem.c
+++ b/src/mesa/shader/slang/slang_mem.c
@@ -32,8 +32,8 @@
* \author Brian Paul
*/
-#include "context.h"
-#include "macros.h"
+#include "main/context.h"
+#include "main/macros.h"
#include "slang_mem.h"
diff --git a/src/mesa/shader/slang/slang_mem.h b/src/mesa/shader/slang/slang_mem.h
index 49885b6c982..b5bfae24791 100644
--- a/src/mesa/shader/slang/slang_mem.h
+++ b/src/mesa/shader/slang/slang_mem.h
@@ -27,7 +27,7 @@
#define SLANG_MEM_H
-#include "imports.h"
+#include "main/imports.h"
typedef struct slang_mempool_ slang_mempool;
diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c
index d3f412c211e..bfe29b6bc98 100644
--- a/src/mesa/shader/slang/slang_preprocess.c
+++ b/src/mesa/shader/slang/slang_preprocess.c
@@ -28,7 +28,7 @@
* \author Michal Krol
*/
-#include "imports.h"
+#include "main/imports.h"
#include "shader/grammar/grammar_mesa.h"
#include "slang_preprocess.h"
diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/shader/slang/slang_print.c
index f48762fb111..4422f70159f 100644
--- a/src/mesa/shader/slang/slang_print.c
+++ b/src/mesa/shader/slang/slang_print.c
@@ -4,7 +4,7 @@
*/
-#include "imports.h"
+#include "main/imports.h"
#include "slang_compile.h"
#include "slang_print.h"
diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/shader/slang/slang_simplify.c
index 88ca83d2881..c4bf0175bef 100644
--- a/src/mesa/shader/slang/slang_simplify.c
+++ b/src/mesa/shader/slang/slang_simplify.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.2
+ * Version: 7.1
*
- * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 2005-2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -23,20 +23,29 @@
*/
/**
- * \file slang_assemble_typeinfo.c
- * slang type info
- * \author Michal Krol
+ * Functions for constant folding, built-in constant lookup, and function
+ * call casting.
*/
-#include "imports.h"
-#include "macros.h"
-#include "get.h"
+
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/get.h"
#include "slang_compile.h"
#include "slang_codegen.h"
#include "slang_simplify.h"
#include "slang_print.h"
+#ifndef GL_MAX_FRAGMENT_UNIFORM_VECTORS
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#endif
+#ifndef GL_MAX_VERTEX_UNIFORM_VECTORS
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#endif
+#ifndef GL_MAX_VARYING_VECTORS
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#endif
/**
@@ -49,25 +58,24 @@ _slang_lookup_constant(const char *name)
struct constant_info {
const char *Name;
const GLenum Token;
- GLint Divisor;
};
static const struct constant_info info[] = {
- { "gl_MaxClipPlanes", GL_MAX_CLIP_PLANES, 1 },
- { "gl_MaxCombinedTextureImageUnits", GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, 1 },
- { "gl_MaxDrawBuffers", GL_MAX_DRAW_BUFFERS, 1 },
- { "gl_MaxFragmentUniformComponents", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, 1 },
- { "gl_MaxLights", GL_MAX_LIGHTS, 1 },
- { "gl_MaxTextureUnits", GL_MAX_TEXTURE_UNITS, 1 },
- { "gl_MaxTextureCoords", GL_MAX_TEXTURE_COORDS, 1 },
- { "gl_MaxVertexAttribs", GL_MAX_VERTEX_ATTRIBS, 1 },
- { "gl_MaxVertexUniformComponents", GL_MAX_VERTEX_UNIFORM_COMPONENTS, 1 },
- { "gl_MaxVaryingFloats", GL_MAX_VARYING_FLOATS, 1 },
- { "gl_MaxVertexTextureImageUnits", GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 1 },
- { "gl_MaxTextureImageUnits", GL_MAX_TEXTURE_IMAGE_UNITS, 1 },
+ { "gl_MaxClipPlanes", GL_MAX_CLIP_PLANES },
+ { "gl_MaxCombinedTextureImageUnits", GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS },
+ { "gl_MaxDrawBuffers", GL_MAX_DRAW_BUFFERS },
+ { "gl_MaxFragmentUniformComponents", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS },
+ { "gl_MaxLights", GL_MAX_LIGHTS },
+ { "gl_MaxTextureUnits", GL_MAX_TEXTURE_UNITS },
+ { "gl_MaxTextureCoords", GL_MAX_TEXTURE_COORDS },
+ { "gl_MaxVertexAttribs", GL_MAX_VERTEX_ATTRIBS },
+ { "gl_MaxVertexUniformComponents", GL_MAX_VERTEX_UNIFORM_COMPONENTS },
+ { "gl_MaxVaryingFloats", GL_MAX_VARYING_FLOATS },
+ { "gl_MaxVertexTextureImageUnits", GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS },
+ { "gl_MaxTextureImageUnits", GL_MAX_TEXTURE_IMAGE_UNITS },
#if FEATURE_es2_glsl
- { "gl_MaxVertexUniformVectors", GL_MAX_VERTEX_UNIFORM_COMPONENTS, 4 },
- { "gl_MaxVaryingVectors", GL_MAX_VARYING_FLOATS, 4 },
- { "gl_MaxFragmentUniformVectors", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, 4 },
+ { "gl_MaxVertexUniformVectors", GL_MAX_VERTEX_UNIFORM_VECTORS },
+ { "gl_MaxVaryingVectors", GL_MAX_VARYING_VECTORS },
+ { "gl_MaxFragmentUniformVectors", GL_MAX_FRAGMENT_UNIFORM_VECTORS },
#endif
{ NULL, 0 }
};
@@ -79,7 +87,7 @@ _slang_lookup_constant(const char *name)
GLint value = -1;
_mesa_GetIntegerv(info[i].Token, &value);
ASSERT(value >= 0); /* sanity check that glGetFloatv worked */
- return value / info[i].Divisor;
+ return value;
}
}
return -1;
@@ -306,112 +314,28 @@ _slang_simplify(slang_operation *oper,
/**
- * Adapt the arguments for a function call to match the parameters of
- * the given function.
- * This is for:
- * 1. converting/casting argument types to match parameters
- * 2. breaking up vector/matrix types into individual components to
- * satisfy constructors.
+ * Insert casts to try to adapt actual parameters to formal parameters for a
+ * function call when an exact match for the parameter types is not found.
+ * Example:
+ * void foo(int i, bool b) {}
+ * x = foo(3.15, 9);
+ * Gets translated into:
+ * x = foo(int(3.15), bool(9))
*/
GLboolean
-_slang_adapt_call(slang_operation *callOper, const slang_function *fun,
- const slang_name_space * space,
- slang_atom_pool * atoms, slang_info_log *log)
+_slang_cast_func_params(slang_operation *callOper, const slang_function *fun,
+ const slang_name_space * space,
+ slang_atom_pool * atoms, slang_info_log *log)
{
const GLboolean haveRetValue = _slang_function_has_return_value(fun);
const int numParams = fun->param_count - haveRetValue;
int i;
int dbg = 0;
- if (dbg) printf("Adapt %d args to %d parameters\n",
- callOper->num_children, numParams);
-
- /* Only try adapting for constructors */
- if (fun->kind != SLANG_FUNC_CONSTRUCTOR)
- return GL_FALSE;
-
- if (callOper->num_children != numParams) {
- /* number of arguments doesn't match number of parameters */
-
- if (fun->kind == SLANG_FUNC_CONSTRUCTOR) {
- /* For constructor calls, we can try to unroll vector/matrix args
- * into individual floats/ints and try to match the function params.
- */
- for (i = 0; i < numParams; i++) {
- slang_typeinfo argType;
- GLint argSz, j;
-
- /* Get type of arg[i] */
- if (!slang_typeinfo_construct(&argType))
- return GL_FALSE;
- if (!_slang_typeof_operation_(&callOper->children[i], space,
- &argType, atoms, log)) {
- slang_typeinfo_destruct(&argType);
- return GL_FALSE;
- }
-
- /*
- paramSz = _slang_sizeof_type_specifier(&paramVar->type.specifier);
- assert(paramSz == 1);
- */
- argSz = _slang_sizeof_type_specifier(&argType.spec);
- if (argSz > 1) {
- slang_operation origArg;
- /* break up arg[i] into components */
- if (dbg)
- printf("Break up arg %d from 1 to %d elements\n", i, argSz);
-
- slang_operation_construct(&origArg);
- slang_operation_copy(&origArg,
- &callOper->children[i]);
-
- /* insert argSz-1 new children/args */
- for (j = 0; j < argSz - 1; j++) {
- (void) slang_operation_insert(&callOper->num_children,
- &callOper->children, i);
- }
-
- /* replace arg[i+j] with subscript/index oper */
- for (j = 0; j < argSz; j++) {
- callOper->children[i + j].type = SLANG_OPER_SUBSCRIPT;
- callOper->children[i + j].num_children = 2;
- callOper->children[i + j].children = slang_operation_new(2);
- slang_operation_copy(&callOper->children[i + j].children[0],
- &origArg);
- callOper->children[i + j].children[1].type
- = SLANG_OPER_LITERAL_INT;
- callOper->children[i + j].children[1].literal[0] = (GLfloat) j;
- }
+ if (dbg)
+ printf("Adapt call of %d args to func %s (%d params)\n",
+ callOper->num_children, (char*) fun->header.a_name, numParams);
- }
- } /* for i */
- }
- else {
- /* non-constructor function: number of args must match number
- * of function params.
- */
- return GL_FALSE; /* caller will record an error msg */
- }
- }
-
- if (callOper->num_children < (GLuint) numParams) {
- /* still not enough args for all params */
- return GL_FALSE;
- }
- else if (callOper->num_children > (GLuint) numParams) {
- /* now too many arguments */
- /* XXX this isn't always an error, see spec */
- return GL_FALSE;
- }
-
- /*
- * Second phase, argument casting.
- * Example:
- * void foo(int i, bool b) {}
- * x = foo(3.15, 9);
- * Gets translated into:
- * x = foo(int(3.15), bool(9))
- */
for (i = 0; i < numParams; i++) {
slang_typeinfo argType;
slang_variable *paramVar = fun->parameters->variables[i];
@@ -433,9 +357,18 @@ _slang_adapt_call(slang_operation *callOper, const slang_function *fun,
slang_type_specifier_type_to_string(paramVar->type.specifier.type);
slang_operation *child = slang_operation_new(1);
+ if (dbg)
+ printf("Need to adapt types of arg %d\n", i);
+
slang_operation_copy(child, &callOper->children[i]);
child->locals->outer_scope = callOper->children[i].locals;
+#if 0
+ if (_slang_sizeof_type_specifier(&argType.spec) >
+ _slang_sizeof_type_specifier(&paramVar->type.specifier)) {
+ }
+#endif
+
callOper->children[i].type = SLANG_OPER_CALL;
callOper->children[i].a_id = slang_atom_pool_atom(atoms, constructorName);
callOper->children[i].num_children = 1;
@@ -446,6 +379,107 @@ _slang_adapt_call(slang_operation *callOper, const slang_function *fun,
}
if (dbg) {
+ printf("===== New call to %s with cast arguments ===============\n",
+ (char*) fun->header.a_name);
+ slang_print_tree(callOper, 5);
+ }
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Adapt the arguments for a function call to match the parameters of
+ * the given function.
+ * This is for:
+ * 1. converting/casting argument types to match parameters
+ * 2. breaking up vector/matrix types into individual components to
+ * satisfy constructors.
+ */
+GLboolean
+_slang_adapt_call(slang_operation *callOper, const slang_function *fun,
+ const slang_name_space * space,
+ slang_atom_pool * atoms, slang_info_log *log)
+{
+ const GLboolean haveRetValue = _slang_function_has_return_value(fun);
+ const int numParams = fun->param_count - haveRetValue;
+ int i;
+ int dbg = 0;
+
+ if (dbg)
+ printf("Adapt %d args to %d parameters for %s\n",
+ callOper->num_children, numParams, (char *) fun->header.a_name);
+
+ /* Only try adapting for constructors */
+ if (fun->kind != SLANG_FUNC_CONSTRUCTOR)
+ return GL_FALSE;
+
+ if (callOper->num_children != numParams) {
+ /* number of arguments doesn't match number of parameters */
+
+ /* For constructor calls, we can try to unroll vector/matrix args
+ * into individual floats/ints and try to match the function params.
+ */
+ for (i = 0; i < numParams; i++) {
+ slang_typeinfo argType;
+ GLint argSz, j;
+
+ /* Get type of arg[i] */
+ if (!slang_typeinfo_construct(&argType))
+ return GL_FALSE;
+ if (!_slang_typeof_operation_(&callOper->children[i], space,
+ &argType, atoms, log)) {
+ slang_typeinfo_destruct(&argType);
+ return GL_FALSE;
+ }
+
+ /*
+ paramSz = _slang_sizeof_type_specifier(&paramVar->type.specifier);
+ assert(paramSz == 1);
+ */
+ argSz = _slang_sizeof_type_specifier(&argType.spec);
+ if (argSz > 1) {
+ slang_operation origArg;
+ /* break up arg[i] into components */
+ if (dbg)
+ printf("Break up arg %d from 1 to %d elements\n", i, argSz);
+
+ slang_operation_construct(&origArg);
+ slang_operation_copy(&origArg, &callOper->children[i]);
+
+ /* insert argSz-1 new children/args */
+ for (j = 0; j < argSz - 1; j++) {
+ (void) slang_operation_insert(&callOper->num_children,
+ &callOper->children, i);
+ }
+
+ /* replace arg[i+j] with subscript/index oper */
+ for (j = 0; j < argSz; j++) {
+ callOper->children[i + j].type = SLANG_OPER_SUBSCRIPT;
+ callOper->children[i + j].locals = _slang_variable_scope_new(callOper->locals);
+ callOper->children[i + j].num_children = 2;
+ callOper->children[i + j].children = slang_operation_new(2);
+ slang_operation_copy(&callOper->children[i + j].children[0],
+ &origArg);
+ callOper->children[i + j].children[1].type
+ = SLANG_OPER_LITERAL_INT;
+ callOper->children[i + j].children[1].literal[0] = (GLfloat) j;
+ }
+ }
+ }
+ }
+
+ if (callOper->num_children < (GLuint) numParams) {
+ /* still not enough args for all params */
+ return GL_FALSE;
+ }
+ else if (callOper->num_children > (GLuint) numParams) {
+ /* now too many arguments */
+ /* just truncate */
+ callOper->num_children = (GLuint) numParams;
+ }
+
+ if (dbg) {
printf("===== New call to %s with adapted arguments ===============\n",
(char*) fun->header.a_name);
slang_print_tree(callOper, 5);
diff --git a/src/mesa/shader/slang/slang_simplify.h b/src/mesa/shader/slang/slang_simplify.h
index b3840ee9df8..8689c23b1a0 100644
--- a/src/mesa/shader/slang/slang_simplify.h
+++ b/src/mesa/shader/slang/slang_simplify.h
@@ -1,3 +1,26 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 2005-2008 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
#ifndef SLANG_SIMPLIFY_H
#define SLANG_SIMPLIFY_H
@@ -14,6 +37,11 @@ _slang_simplify(slang_operation *oper,
extern GLboolean
+_slang_cast_func_params(slang_operation *callOper, const slang_function *fun,
+ const slang_name_space * space,
+ slang_atom_pool * atoms, slang_info_log *log);
+
+extern GLboolean
_slang_adapt_call(slang_operation *callOper, const slang_function *fun,
const slang_name_space * space,
slang_atom_pool * atoms, slang_info_log *log);
diff --git a/src/mesa/shader/slang/slang_storage.c b/src/mesa/shader/slang/slang_storage.c
index bc32aa4b022..e8b0fb7747d 100644
--- a/src/mesa/shader/slang/slang_storage.c
+++ b/src/mesa/shader/slang/slang_storage.c
@@ -28,7 +28,7 @@
* \author Michal Krol
*/
-#include "imports.h"
+#include "main/imports.h"
#include "slang_storage.h"
#include "slang_mem.h"
diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c
index 8a1c3abf480..26f9f6ca850 100644
--- a/src/mesa/shader/slang/slang_typeinfo.c
+++ b/src/mesa/shader/slang/slang_typeinfo.c
@@ -273,6 +273,7 @@ slang_type_specifier_compatible(const slang_type_specifier * x,
GLboolean
slang_typeinfo_construct(slang_typeinfo * ti)
{
+ /*_mesa_bzero(ti, sizeof(*ti));*/
slang_type_specifier_ctr(&ti->spec);
ti->array_len = 0;
return GL_TRUE;
@@ -304,10 +305,16 @@ _slang_typeof_function(slang_atom a_name,
slang_function **funFound,
slang_atom_pool *atoms, slang_info_log *log)
{
+ GLboolean error;
+
*funFound = _slang_locate_function(space->funcs, a_name, params,
- num_params, space, atoms, log);
+ num_params, space, atoms, log, &error);
+ if (error)
+ return GL_FALSE;
+
if (!*funFound)
return GL_TRUE; /* yes, not false */
+
return slang_type_specifier_copy(spec, &(*funFound)->header.type.specifier);
}
@@ -755,51 +762,66 @@ slang_function *
_slang_locate_function(const slang_function_scope * funcs, slang_atom a_name,
slang_operation * args, GLuint num_args,
const slang_name_space * space, slang_atom_pool * atoms,
- slang_info_log *log)
+ slang_info_log *log, GLboolean *error)
{
+ slang_typeinfo arg_ti[100];
GLuint i;
- for (i = 0; i < funcs->num_functions; i++) {
- slang_function *f = &funcs->functions[i];
- const GLuint haveRetValue = _slang_function_has_return_value(f);
- GLuint j;
-
- if (a_name != f->header.a_name)
- continue;
- if (f->param_count - haveRetValue != num_args)
- continue;
-
- /* compare parameter / argument types */
- for (j = 0; j < num_args; j++) {
- slang_typeinfo ti;
-
- if (!slang_typeinfo_construct(&ti))
- return NULL;
- if (!_slang_typeof_operation_(&args[j], space, &ti, atoms, log)) {
- slang_typeinfo_destruct(&ti);
- return NULL;
+ *error = GL_FALSE;
+
+ /* determine type of each argument */
+ assert(num_args < 100);
+ for (i = 0; i < num_args; i++) {
+ if (!slang_typeinfo_construct(&arg_ti[i]))
+ return NULL;
+ if (!_slang_typeof_operation_(&args[i], space, &arg_ti[i], atoms, log)) {
+ return NULL;
+ }
+ }
+
+ /* loop over function scopes */
+ while (funcs) {
+
+ /* look for function with matching name and argument/param types */
+ for (i = 0; i < funcs->num_functions; i++) {
+ slang_function *f = &funcs->functions[i];
+ const GLuint haveRetValue = _slang_function_has_return_value(f);
+ GLuint j;
+
+ if (a_name != f->header.a_name)
+ continue;
+ if (f->param_count - haveRetValue != num_args)
+ continue;
+
+ /* compare parameter / argument types */
+ for (j = 0; j < num_args; j++) {
+ if (!slang_type_specifier_compatible(&arg_ti[j].spec,
+ &f->parameters->variables[j]->type.specifier)) {
+ /* param/arg types don't match */
+ break;
+ }
+
+ /* "out" and "inout" formal parameter requires the actual
+ * argument to be an l-value.
+ */
+ if (!arg_ti[j].can_be_referenced &&
+ (f->parameters->variables[j]->type.qualifier == SLANG_QUAL_OUT ||
+ f->parameters->variables[j]->type.qualifier == SLANG_QUAL_INOUT)) {
+ /* param is not an lvalue! */
+ *error = GL_TRUE;
+ return NULL;
+ }
}
- if (!slang_type_specifier_compatible(&ti.spec,
- &f->parameters->variables[j]->type.specifier)) {
- slang_typeinfo_destruct(&ti);
- break;
+
+ if (j == num_args) {
+ /* name and args match! */
+ return f;
}
- slang_typeinfo_destruct(&ti);
-
- /* "out" and "inout" formal parameter requires the actual
- * parameter to be l-value.
- */
- if (!ti.can_be_referenced &&
- (f->parameters->variables[j]->type.qualifier == SLANG_QUAL_OUT ||
- f->parameters->variables[j]->type.qualifier == SLANG_QUAL_INOUT))
- break;
}
- if (j == num_args)
- return f;
+
+ funcs = funcs->outer_scope;
}
- if (funcs->outer_scope != NULL)
- return _slang_locate_function(funcs->outer_scope, a_name, args,
- num_args, space, atoms, log);
+
return NULL;
}
diff --git a/src/mesa/shader/slang/slang_typeinfo.h b/src/mesa/shader/slang/slang_typeinfo.h
index 587331e8b1e..960e99bda23 100644
--- a/src/mesa/shader/slang/slang_typeinfo.h
+++ b/src/mesa/shader/slang/slang_typeinfo.h
@@ -25,8 +25,8 @@
#ifndef SLANG_TYPEINFO_H
#define SLANG_TYPEINFO_H 1
-#include "imports.h"
-#include "mtypes.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "slang_log.h"
#include "slang_utility.h"
#include "slang_vartable.h"
@@ -73,7 +73,8 @@ _slang_locate_function(const struct slang_function_scope_ *funcs,
slang_atom name, struct slang_operation_ *params,
GLuint num_params,
const slang_name_space *space,
- slang_atom_pool *atoms, slang_info_log *log);
+ slang_atom_pool *atoms, slang_info_log *log,
+ GLboolean *error);
extern GLboolean
diff --git a/src/mesa/shader/slang/slang_utility.c b/src/mesa/shader/slang/slang_utility.c
index 2a2dc8e54ff..3631e32b3c3 100644
--- a/src/mesa/shader/slang/slang_utility.c
+++ b/src/mesa/shader/slang/slang_utility.c
@@ -28,7 +28,7 @@
* \author Michal Krol
*/
-#include "imports.h"
+#include "main/imports.h"
#include "slang_utility.h"
#include "slang_mem.h"
diff --git a/src/mesa/sources b/src/mesa/sources
index e6b050c3f28..0e0e10979b6 100644
--- a/src/mesa/sources
+++ b/src/mesa/sources
@@ -342,7 +342,6 @@ COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_SOURCES:.c=.o)
INCLUDE_DIRS = \
-I$(TOP)/include \
-I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/drivers \
-I$(TOP)/src/gallium/auxiliary
diff --git a/src/mesa/sparc/sparc.c b/src/mesa/sparc/sparc.c
index 1b77b0bb7ba..84e8ac6723a 100644
--- a/src/mesa/sparc/sparc.c
+++ b/src/mesa/sparc/sparc.c
@@ -31,7 +31,7 @@
#ifdef USE_SPARC_ASM
-#include "context.h"
+#include "main/context.h"
#include "math/m_xform.h"
#include "tnl/t_context.h"
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index ecfd1179189..fc8587f4598 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -26,8 +26,8 @@
**************************************************************************/
-#include "glheader.h"
-#include "context.h"
+#include "main/glheader.h"
+#include "main/context.h"
#include "pipe/p_defines.h"
#include "st_context.h"
diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c
index 8b9f1abda4b..27ec2eb0331 100644
--- a/src/mesa/state_tracker/st_atom_viewport.c
+++ b/src/mesa/state_tracker/st_atom_viewport.c
@@ -26,8 +26,8 @@
**************************************************************************/
-#include "context.h"
-#include "colormac.h"
+#include "main/context.h"
+#include "main/colormac.h"
#include "st_context.h"
#include "st_atom.h"
#include "pipe/p_context.h"
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 150545dfadc..9029f12056f 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -39,8 +39,6 @@
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
-#define TGSI_DEBUG 0
-
/*
* Map mesa register file to TGSI register file.
@@ -56,8 +54,8 @@ map_register_file(
return TGSI_FILE_NULL;
case PROGRAM_TEMPORARY:
return TGSI_FILE_TEMPORARY;
- //case PROGRAM_LOCAL_PARAM:
- //case PROGRAM_ENV_PARAM:
+ /*case PROGRAM_LOCAL_PARAM:*/
+ /*case PROGRAM_ENV_PARAM:*/
/* Because of the longstanding problem with mesa arb shaders
* where constants, immediates and state variables are all
@@ -230,21 +228,27 @@ compile_instruction(
outputMapping,
immediateMapping);
- for( j = 0; j < 4; j++ ) {
- GLuint swz;
-
- swz = GET_SWZ( inst->SrcReg[i].Swizzle, j );
- if( swz > SWIZZLE_W ) {
- tgsi_util_set_src_register_extswizzle(
- &fullsrc->SrcRegisterExtSwz,
- swz,
- j );
+ /* swizzle (ext swizzle also depends on negation) */
+ {
+ GLuint swz[4];
+ GLboolean extended = (inst->SrcReg[i].NegateBase != NEGATE_NONE &&
+ inst->SrcReg[i].NegateBase != NEGATE_XYZW);
+ for( j = 0; j < 4; j++ ) {
+ swz[j] = GET_SWZ( inst->SrcReg[i].Swizzle, j );
+ if (swz[j] > SWIZZLE_W)
+ extended = GL_TRUE;
+ }
+ if (extended) {
+ for (j = 0; j < 4; j++) {
+ tgsi_util_set_src_register_extswizzle(&fullsrc->SrcRegisterExtSwz,
+ swz[j], j);
+ }
}
else {
- tgsi_util_set_src_register_swizzle(
- &fullsrc->SrcRegister,
- swz,
- j );
+ for (j = 0; j < 4; j++) {
+ tgsi_util_set_src_register_swizzle(&fullsrc->SrcRegister,
+ swz[j], j);
+ }
}
}
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h
index 63fc855b535..f17f2eac963 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.h
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h
@@ -29,7 +29,7 @@
#ifndef ST_MESA_TO_TGSI_H
#define ST_MESA_TO_TGSI_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#if defined __cplusplus
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 3e5054ecd2d..289b78b38b3 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -28,7 +28,7 @@
#include "st_context.h"
#include "st_format.h"
#include "st_texture.h"
-#include "enums.h"
+#include "main/enums.h"
#undef Elements /* fix re-defined macro warning */
diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c
index d6a9afb4212..ee65a71d7e6 100644
--- a/src/mesa/swrast/s_aaline.c
+++ b/src/mesa/swrast/s_aaline.c
@@ -23,14 +23,14 @@
*/
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/macros.h"
#include "swrast/s_aaline.h"
#include "swrast/s_context.h"
#include "swrast/s_span.h"
#include "swrast/swrast.h"
-#include "mtypes.h"
+#include "main/mtypes.h"
#define SUB_PIXEL 4
diff --git a/src/mesa/swrast/s_aaline.h b/src/mesa/swrast/s_aaline.h
index 41e7e5fd4d4..9fb4959f917 100644
--- a/src/mesa/swrast/s_aaline.h
+++ b/src/mesa/swrast/s_aaline.h
@@ -28,7 +28,7 @@
#define S_AALINE_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c
index 66891f9fec8..078f16aea09 100644
--- a/src/mesa/swrast/s_aatriangle.c
+++ b/src/mesa/swrast/s_aatriangle.c
@@ -28,12 +28,12 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "s_aatriangle.h"
#include "s_context.h"
#include "s_span.h"
diff --git a/src/mesa/swrast/s_aatriangle.h b/src/mesa/swrast/s_aatriangle.h
index ebb828eb19f..734d420b628 100644
--- a/src/mesa/swrast/s_aatriangle.h
+++ b/src/mesa/swrast/s_aatriangle.h
@@ -28,7 +28,7 @@
#define S_AATRIANGLE_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c
index 3c45dee3998..13a42fdf53e 100644
--- a/src/mesa/swrast/s_accum.c
+++ b/src/mesa/swrast/s_accum.c
@@ -23,10 +23,10 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "fbobject.h"
#include "s_accum.h"
diff --git a/src/mesa/swrast/s_accum.h b/src/mesa/swrast/s_accum.h
index 97d2bef4c31..42e38cf02b3 100644
--- a/src/mesa/swrast/s_accum.h
+++ b/src/mesa/swrast/s_accum.h
@@ -27,7 +27,7 @@
#define S_ACCUM_H
-#include "mtypes.h"
+#include "main/mtypes.h"
extern void
diff --git a/src/mesa/swrast/s_alpha.c b/src/mesa/swrast/s_alpha.c
index 3c55d3e9e33..5761bb00b4e 100644
--- a/src/mesa/swrast/s_alpha.c
+++ b/src/mesa/swrast/s_alpha.c
@@ -27,10 +27,10 @@
* \brief Functions to apply alpha test.
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/macros.h"
#include "s_alpha.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_alpha.h b/src/mesa/swrast/s_alpha.h
index a85ef8a83ad..92cb01b18ad 100644
--- a/src/mesa/swrast/s_alpha.h
+++ b/src/mesa/swrast/s_alpha.h
@@ -28,7 +28,7 @@
#define S_ALPHA_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c
index 55ec757ee06..9fa352c36bf 100644
--- a/src/mesa/swrast/s_atifragshader.c
+++ b/src/mesa/swrast/s_atifragshader.c
@@ -20,10 +20,10 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
#include "shader/program.h"
#include "shader/atifragshader.h"
#include "swrast/s_atifragshader.h"
diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c
index f3dda12e252..2308acae1cd 100644
--- a/src/mesa/swrast/s_bitmap.c
+++ b/src/mesa/swrast/s_bitmap.c
@@ -28,10 +28,10 @@
* \author Brian Paul
*/
-#include "glheader.h"
+#include "main/glheader.h"
#include "bufferobj.h"
#include "image.h"
-#include "macros.h"
+#include "main/macros.h"
#include "pixel.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c
index 82c5e84294a..7fd89453545 100644
--- a/src/mesa/swrast/s_blend.c
+++ b/src/mesa/swrast/s_blend.c
@@ -35,10 +35,10 @@
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/macros.h"
#include "s_blend.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_blend.h b/src/mesa/swrast/s_blend.h
index 0b8cbed1a01..c8abecc099b 100644
--- a/src/mesa/swrast/s_blend.h
+++ b/src/mesa/swrast/s_blend.h
@@ -27,7 +27,7 @@
#define S_BLEND_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c
index 5aec4aad035..0e12dfa1da6 100644
--- a/src/mesa/swrast/s_blit.c
+++ b/src/mesa/swrast/s_blit.c
@@ -23,8 +23,8 @@
*/
-#include "glheader.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/macros.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c
index 90a56284c51..a70f4745872 100644
--- a/src/mesa/swrast/s_buffers.c
+++ b/src/mesa/swrast/s_buffers.c
@@ -24,11 +24,11 @@
/** XXX This file should be named s_clear.c */
-#include "glheader.h"
-#include "colormac.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "s_accum.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index f43fa61f8a3..4d9b956f856 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -26,11 +26,11 @@
* Brian Paul
*/
-#include "imports.h"
+#include "main/imports.h"
#include "bufferobj.h"
-#include "context.h"
-#include "colormac.h"
-#include "mtypes.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/mtypes.h"
#include "teximage.h"
#include "swrast.h"
#include "shader/prog_statevars.h"
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index bbe1081860d..7385a9942c9 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -23,14 +23,14 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
#include "convolve.h"
#include "histogram.h"
#include "image.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "pixel.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 408174c990f..a9d3e9d98e7 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -23,10 +23,10 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "fbobject.h"
#include "s_depth.h"
diff --git a/src/mesa/swrast/s_depth.h b/src/mesa/swrast/s_depth.h
index d1ed050efd6..484cc73f493 100644
--- a/src/mesa/swrast/s_depth.h
+++ b/src/mesa/swrast/s_depth.h
@@ -27,7 +27,7 @@
#define S_DEPTH_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index cbf66170588..d1120d2cee5 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -23,13 +23,13 @@
*/
-#include "glheader.h"
+#include "main/glheader.h"
#include "bufferobj.h"
-#include "context.h"
+#include "main/context.h"
#include "convolve.h"
#include "image.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "pixel.h"
#include "state.h"
diff --git a/src/mesa/swrast/s_drawpix.h b/src/mesa/swrast/s_drawpix.h
index 66067115ddb..7882a799663 100644
--- a/src/mesa/swrast/s_drawpix.h
+++ b/src/mesa/swrast/s_drawpix.h
@@ -28,7 +28,7 @@
#define S_DRAWPIXELS_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
/* XXX kill this header? */
diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c
index 07b7409ab57..31cea8e41f3 100644
--- a/src/mesa/swrast/s_feedback.c
+++ b/src/mesa/swrast/s_feedback.c
@@ -22,12 +22,12 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "enums.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/enums.h"
#include "feedback.h"
-#include "macros.h"
+#include "main/macros.h"
#include "s_context.h"
#include "s_feedback.h"
diff --git a/src/mesa/swrast/s_feedback.h b/src/mesa/swrast/s_feedback.h
index 73f45c10be5..6484f1dc751 100644
--- a/src/mesa/swrast/s_feedback.h
+++ b/src/mesa/swrast/s_feedback.h
@@ -28,7 +28,7 @@
#define S_FEEDBACK_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c
index 7b143f6e5bb..b9ba265db6d 100644
--- a/src/mesa/swrast/s_fog.c
+++ b/src/mesa/swrast/s_fog.c
@@ -23,10 +23,10 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
#include "s_context.h"
#include "s_fog.h"
diff --git a/src/mesa/swrast/s_fog.h b/src/mesa/swrast/s_fog.h
index 9639bee2cc3..2346dd1734d 100644
--- a/src/mesa/swrast/s_fog.h
+++ b/src/mesa/swrast/s_fog.h
@@ -28,7 +28,7 @@
#define S_FOG_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c
index 3de438760b5..23cb9b57eff 100644
--- a/src/mesa/swrast/s_lines.c
+++ b/src/mesa/swrast/s_lines.c
@@ -23,10 +23,10 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/macros.h"
#include "s_aaline.h"
#include "s_context.h"
#include "s_depth.h"
diff --git a/src/mesa/swrast/s_lines.h b/src/mesa/swrast/s_lines.h
index 5372b99b915..6c629ca2d45 100644
--- a/src/mesa/swrast/s_lines.h
+++ b/src/mesa/swrast/s_lines.h
@@ -27,7 +27,7 @@
#ifndef S_LINES_H
#define S_LINES_H
-#include "mtypes.h"
+#include "main/mtypes.h"
void
_swrast_choose_line( GLcontext *ctx );
diff --git a/src/mesa/swrast/s_logic.c b/src/mesa/swrast/s_logic.c
index 0af9063968a..f0274b4c0b1 100644
--- a/src/mesa/swrast/s_logic.c
+++ b/src/mesa/swrast/s_logic.c
@@ -23,10 +23,10 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "imports.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/imports.h"
+#include "main/macros.h"
#include "s_context.h"
#include "s_logic.h"
diff --git a/src/mesa/swrast/s_logic.h b/src/mesa/swrast/s_logic.h
index 0bc2c3f8a82..04ef00bb996 100644
--- a/src/mesa/swrast/s_logic.h
+++ b/src/mesa/swrast/s_logic.h
@@ -27,7 +27,7 @@
#define S_LOGIC_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
diff --git a/src/mesa/swrast/s_masking.c b/src/mesa/swrast/s_masking.c
index a69720e83ae..df779b07392 100644
--- a/src/mesa/swrast/s_masking.c
+++ b/src/mesa/swrast/s_masking.c
@@ -28,8 +28,8 @@
*/
-#include "glheader.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/macros.h"
#include "s_context.h"
#include "s_masking.h"
diff --git a/src/mesa/swrast/s_masking.h b/src/mesa/swrast/s_masking.h
index 0596cb3f458..688c07c7ae7 100644
--- a/src/mesa/swrast/s_masking.h
+++ b/src/mesa/swrast/s_masking.h
@@ -27,7 +27,7 @@
#define S_MASKING_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c
index f4b3650210e..9f52da980c7 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -23,10 +23,10 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
#include "texstate.h"
#include "s_context.h"
#include "s_feedback.h"
diff --git a/src/mesa/swrast/s_points.h b/src/mesa/swrast/s_points.h
index 40b442e951f..3fda115c0df 100644
--- a/src/mesa/swrast/s_points.h
+++ b/src/mesa/swrast/s_points.h
@@ -27,7 +27,7 @@
#ifndef S_POINTS_H
#define S_POINTS_H
-#include "mtypes.h"
+#include "main/mtypes.h"
extern void
_swrast_choose_point( GLcontext *ctx );
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index 2f155d0b705..6186f92899e 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -23,15 +23,15 @@
*/
-#include "glheader.h"
+#include "main/glheader.h"
#include "bufferobj.h"
-#include "colormac.h"
+#include "main/colormac.h"
#include "convolve.h"
-#include "context.h"
+#include "main/context.h"
#include "feedback.h"
#include "image.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "pixel.h"
#include "state.h"
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index d9c1d1bec7d..457dc4a6ce2 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -30,11 +30,11 @@
* \author Brian Paul
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "image.h"
#include "s_atifragshader.h"
diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h
index 512134db0f8..6b814fc8fb1 100644
--- a/src/mesa/swrast/s_span.h
+++ b/src/mesa/swrast/s_span.h
@@ -27,7 +27,7 @@
#define S_SPAN_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
diff --git a/src/mesa/swrast/s_spantemp.h b/src/mesa/swrast/s_spantemp.h
index 1eef81eb914..bab2ca7378f 100644
--- a/src/mesa/swrast/s_spantemp.h
+++ b/src/mesa/swrast/s_spantemp.h
@@ -43,7 +43,7 @@
* ignored otherwise.
*/
-#include "macros.h"
+#include "main/macros.h"
#ifdef CI_MODE
diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c
index d0cbdd6917d..cdb7e4669ce 100644
--- a/src/mesa/swrast/s_stencil.c
+++ b/src/mesa/swrast/s_stencil.c
@@ -23,9 +23,9 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/imports.h"
#include "s_context.h"
#include "s_depth.h"
diff --git a/src/mesa/swrast/s_stencil.h b/src/mesa/swrast/s_stencil.h
index 1fcb538fecf..742f8d4c946 100644
--- a/src/mesa/swrast/s_stencil.h
+++ b/src/mesa/swrast/s_stencil.h
@@ -27,7 +27,7 @@
#define S_STENCIL_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c
index 4c5e22618ee..b7724f7b20a 100644
--- a/src/mesa/swrast/s_texcombine.c
+++ b/src/mesa/swrast/s_texcombine.c
@@ -23,11 +23,11 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "imports.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/imports.h"
+#include "main/macros.h"
#include "image.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_texcombine.h b/src/mesa/swrast/s_texcombine.h
index 3bf70e0b86e..20cd2bd8ad1 100644
--- a/src/mesa/swrast/s_texcombine.h
+++ b/src/mesa/swrast/s_texcombine.h
@@ -27,7 +27,7 @@
#define S_TEXCOMBINE_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
extern void
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index c2a7512388e..bb0fc823e7e 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -23,10 +23,10 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/imports.h"
#include "texformat.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_texfilter.h b/src/mesa/swrast/s_texfilter.h
index e4445e79a09..6267ad17eb8 100644
--- a/src/mesa/swrast/s_texfilter.h
+++ b/src/mesa/swrast/s_texfilter.h
@@ -27,7 +27,7 @@
#define S_TEXFILTER_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
diff --git a/src/mesa/swrast/s_texstore.c b/src/mesa/swrast/s_texstore.c
index 3f49b40d9c1..f5d081d7a3f 100644
--- a/src/mesa/swrast/s_texstore.c
+++ b/src/mesa/swrast/s_texstore.c
@@ -36,13 +36,13 @@
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "context.h"
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/colormac.h"
+#include "main/context.h"
#include "convolve.h"
#include "image.h"
-#include "macros.h"
+#include "main/macros.h"
#include "mipmap.h"
#include "texformat.h"
#include "teximage.h"
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index c2555452173..00cff6635f1 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -29,11 +29,11 @@
* functions to draw triangles.
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "imports.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/imports.h"
+#include "main/macros.h"
#include "texformat.h"
#include "s_aatriangle.h"
diff --git a/src/mesa/swrast/s_triangle.h b/src/mesa/swrast/s_triangle.h
index 0de812500c5..c3cadae2d4e 100644
--- a/src/mesa/swrast/s_triangle.h
+++ b/src/mesa/swrast/s_triangle.h
@@ -28,7 +28,7 @@
#define S_TRIANGLES_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c
index 9f1a4c6f0a7..48b4d1e2407 100644
--- a/src/mesa/swrast/s_zoom.c
+++ b/src/mesa/swrast/s_zoom.c
@@ -22,10 +22,10 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "glheader.h"
-#include "macros.h"
-#include "imports.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/colormac.h"
#include "s_context.h"
#include "s_span.h"
diff --git a/src/mesa/swrast/s_zoom.h b/src/mesa/swrast/s_zoom.h
index 6ca11ac2111..7701515476b 100644
--- a/src/mesa/swrast/s_zoom.h
+++ b/src/mesa/swrast/s_zoom.h
@@ -25,7 +25,7 @@
#ifndef S_ZOOM_H
#define S_ZOOM_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast.h"
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
index a9c7d941e5b..fd6935e7be8 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -25,9 +25,9 @@
* Keith Whitwell <[email protected]>
*/
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/colormac.h"
#include "ss_context.h"
#include "ss_triangle.h"
#include "swrast_setup.h"
diff --git a/src/mesa/swrast_setup/ss_context.h b/src/mesa/swrast_setup/ss_context.h
index 11f9ded3ffb..1ec293fade1 100644
--- a/src/mesa/swrast_setup/ss_context.h
+++ b/src/mesa/swrast_setup/ss_context.h
@@ -28,7 +28,7 @@
#ifndef SS_CONTEXT_H
#define SS_CONTEXT_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast/swrast.h"
#include "swrast_setup.h"
#include "tnl/t_context.h"
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c
index b4207f2c64a..9fef7a52eca 100644
--- a/src/mesa/swrast_setup/ss_triangle.c
+++ b/src/mesa/swrast_setup/ss_triangle.c
@@ -25,10 +25,10 @@
* Keith Whitwell <[email protected]>
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "macros.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/macros.h"
+#include "main/mtypes.h"
#include "tnl/t_context.h"
diff --git a/src/mesa/swrast_setup/ss_triangle.h b/src/mesa/swrast_setup/ss_triangle.h
index 78833269e6e..863e744607b 100644
--- a/src/mesa/swrast_setup/ss_triangle.h
+++ b/src/mesa/swrast_setup/ss_triangle.h
@@ -29,7 +29,7 @@
#ifndef SS_TRIANGLE_H
#define SS_TRIANGLE_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "ss_context.h"
diff --git a/src/mesa/swrast_setup/ss_vb.h b/src/mesa/swrast_setup/ss_vb.h
index 6ea0cb1a704..2ad1f56f396 100644
--- a/src/mesa/swrast_setup/ss_vb.h
+++ b/src/mesa/swrast_setup/ss_vb.h
@@ -29,7 +29,7 @@
#ifndef SS_VB_H
#define SS_VB_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "swrast_setup.h"
void _swsetup_vb_init( GLcontext *ctx );
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 5b2b2ae5495..a1a46f6b827 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -26,13 +26,13 @@
* Keith Whitwell <[email protected]>
*/
-#include "glheader.h"
-#include "context.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/imports.h"
#include "state.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "enums.h"
+#include "main/mtypes.h"
+#include "main/macros.h"
+#include "main/enums.h"
#include "t_context.h"
#include "t_pipeline.h"
diff --git a/src/mesa/tnl/t_pipeline.h b/src/mesa/tnl/t_pipeline.h
index 0952854b855..d110010f04e 100644
--- a/src/mesa/tnl/t_pipeline.h
+++ b/src/mesa/tnl/t_pipeline.h
@@ -30,7 +30,7 @@
#ifndef _T_PIPELINE_H_
#define _T_PIPELINE_H_
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "t_context.h"
extern void _tnl_run_pipeline( GLcontext *ctx );
diff --git a/src/mesa/tnl/t_rasterpos.c b/src/mesa/tnl/t_rasterpos.c
index be963867c00..dfbe0f18069 100644
--- a/src/mesa/tnl/t_rasterpos.c
+++ b/src/mesa/tnl/t_rasterpos.c
@@ -23,15 +23,15 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
#include "feedback.h"
#include "light.h"
-#include "macros.h"
+#include "main/macros.h"
#include "rastpos.h"
#include "simple_list.h"
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "math/m_matrix.h"
#include "tnl/tnl.h"
diff --git a/src/mesa/tnl/t_vb_cull.c b/src/mesa/tnl/t_vb_cull.c
index 21a32e5b1d8..712901acf30 100644
--- a/src/mesa/tnl/t_vb_cull.c
+++ b/src/mesa/tnl/t_vb_cull.c
@@ -26,12 +26,12 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "math/m_xform.h"
diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c
index f6518500d80..00c0979f3f6 100644
--- a/src/mesa/tnl/t_vb_fog.c
+++ b/src/mesa/tnl/t_vb_fog.c
@@ -26,12 +26,12 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "math/m_xform.h"
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index 12f2cc7735e..ebd3412d20f 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -24,13 +24,13 @@
-#include "glheader.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
#include "light.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "simple_list.h"
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "math/m_translate.h"
diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c
index 01fad0cee21..a4821cc1ccc 100644
--- a/src/mesa/tnl/t_vb_normals.c
+++ b/src/mesa/tnl/t_vb_normals.c
@@ -26,12 +26,12 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "math/m_xform.h"
diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c
index 1ac14fedf99..01d055c1dd8 100644
--- a/src/mesa/tnl/t_vb_points.c
+++ b/src/mesa/tnl/t_vb_points.c
@@ -25,8 +25,8 @@
* Brian Paul
*/
-#include "mtypes.h"
-#include "imports.h"
+#include "main/mtypes.h"
+#include "main/imports.h"
#include "t_context.h"
#include "t_pipeline.h"
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index f8e561ac57e..c778f5d2488 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -30,11 +30,11 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "shader/prog_instruction.h"
#include "shader/prog_statevars.h"
#include "shader/prog_execute.h"
diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c
index c38f0745e1b..c1bebc99423 100644
--- a/src/mesa/tnl/t_vb_render.c
+++ b/src/mesa/tnl/t_vb_render.c
@@ -38,12 +38,12 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "enums.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/enums.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "t_pipeline.h"
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index e98ab743c5e..14d3876e547 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -35,12 +35,12 @@
* including any use thereof or modifications thereto.
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "math/m_xform.h"
diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c
index 674d36f8cbe..0abe8cc35dd 100644
--- a/src/mesa/tnl/t_vb_texmat.c
+++ b/src/mesa/tnl/t_vb_texmat.c
@@ -26,12 +26,12 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "math/m_xform.h"
diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c
index 276305b5e67..30aa7c40868 100644
--- a/src/mesa/tnl/t_vb_vertex.c
+++ b/src/mesa/tnl/t_vb_vertex.c
@@ -26,12 +26,12 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "math/m_xform.h"
diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c
index a6728c318fe..b661524c870 100644
--- a/src/mesa/tnl/t_vertex.c
+++ b/src/mesa/tnl/t_vertex.c
@@ -25,9 +25,9 @@
* Keith Whitwell <[email protected]>
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
#include "t_context.h"
#include "t_vertex.h"
diff --git a/src/mesa/tnl/t_vertex.h b/src/mesa/tnl/t_vertex.h
index fda8f151d3e..712311a1463 100644
--- a/src/mesa/tnl/t_vertex.h
+++ b/src/mesa/tnl/t_vertex.h
@@ -28,7 +28,7 @@
#ifndef _TNL_VERTEX_H
#define _TNL_VERTEX_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#include "t_context.h"
/* New mechanism to specify hardware vertices so that tnl can build
diff --git a/src/mesa/tnl/t_vertex_generic.c b/src/mesa/tnl/t_vertex_generic.c
index 236a5bedc80..c399423b9ec 100644
--- a/src/mesa/tnl/t_vertex_generic.c
+++ b/src/mesa/tnl/t_vertex_generic.c
@@ -26,9 +26,9 @@
* Keith Whitwell <[email protected]>
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
#include "t_context.h"
#include "t_vertex.h"
#include "simple_list.h"
diff --git a/src/mesa/tnl/t_vertex_sse.c b/src/mesa/tnl/t_vertex_sse.c
index a180441a5a6..96def25206b 100644
--- a/src/mesa/tnl/t_vertex_sse.c
+++ b/src/mesa/tnl/t_vertex_sse.c
@@ -25,13 +25,13 @@
* Keith Whitwell <[email protected]>
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
#include "t_context.h"
#include "t_vertex.h"
#include "simple_list.h"
-#include "enums.h"
+#include "main/enums.h"
#if defined(USE_SSE_ASM)
diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c
index 249bccb4432..b3b63cd3e4a 100644
--- a/src/mesa/tnl/t_vp_build.c
+++ b/src/mesa/tnl/t_vp_build.c
@@ -30,7 +30,7 @@
*/
-#include "glheader.h"
+#include "main/glheader.h"
#include "main/ffvertex_prog.h"
#include "t_vp_build.h"
diff --git a/src/mesa/tnl/t_vp_build.h b/src/mesa/tnl/t_vp_build.h
index efe12e41a41..d6ebc66c045 100644
--- a/src/mesa/tnl/t_vp_build.h
+++ b/src/mesa/tnl/t_vp_build.h
@@ -27,7 +27,7 @@
#ifndef T_VP_BUILD_H
#define T_VP_BUILD_H
-#include "mtypes.h"
+#include "main/mtypes.h"
#define TNL_FIXED_FUNCTION_STATE_FLAGS (_NEW_PROGRAM | \
_NEW_LIGHT | \
diff --git a/src/mesa/vf/vf.c b/src/mesa/vf/vf.c
index cb25f2e1131..82f3d2b641d 100644
--- a/src/mesa/vf/vf.c
+++ b/src/mesa/vf/vf.c
@@ -25,9 +25,9 @@
* Keith Whitwell <[email protected]>
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
#include "vf.h"
diff --git a/src/mesa/vf/vf_generic.c b/src/mesa/vf/vf_generic.c
index 68d8d0897b8..baa00af29a6 100644
--- a/src/mesa/vf/vf_generic.c
+++ b/src/mesa/vf/vf_generic.c
@@ -26,10 +26,10 @@
* Keith Whitwell <[email protected]>
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "simple_list.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/simple_list.h"
#include "vf/vf.h"
diff --git a/src/mesa/vf/vf_sse.c b/src/mesa/vf/vf_sse.c
index c3a2166578c..4d70196ffed 100644
--- a/src/mesa/vf/vf_sse.c
+++ b/src/mesa/vf/vf_sse.c
@@ -25,10 +25,10 @@
* Keith Whitwell <[email protected]>
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "simple_list.h"
-#include "enums.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/simple_list.h"
+#include "main/enums.h"
#include "vf/vf.h"
diff --git a/src/mesa/x86-64/x86-64.c b/src/mesa/x86-64/x86-64.c
index dee09fd648d..9ec43c841d3 100644
--- a/src/mesa/x86-64/x86-64.c
+++ b/src/mesa/x86-64/x86-64.c
@@ -30,8 +30,8 @@
#ifdef USE_X86_64_ASM
-#include "glheader.h"
-#include "context.h"
+#include "main/glheader.h"
+#include "main/context.h"
#include "math/m_xform.h"
#include "tnl/t_context.h"
#include "x86-64.h"
diff --git a/src/mesa/x86/3dnow.c b/src/mesa/x86/3dnow.c
index 4122ee4b007..c037a617618 100644
--- a/src/mesa/x86/3dnow.c
+++ b/src/mesa/x86/3dnow.c
@@ -28,8 +28,8 @@
* Holger Waechtler <[email protected]>
*/
-#include "glheader.h"
-#include "context.h"
+#include "main/glheader.h"
+#include "main/context.h"
#include "math/m_xform.h"
#include "tnl/t_context.h"
diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c
index 0caa36a5a0c..dc80d26fa9b 100644
--- a/src/mesa/x86/common_x86.c
+++ b/src/mesa/x86/common_x86.c
@@ -49,7 +49,7 @@
#endif
#include "common_x86_asm.h"
-#include "imports.h"
+#include "main/imports.h"
int _mesa_x86_cpu_features = 0;
diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c
index 7a91364ed8a..5c4bab73312 100644
--- a/src/mesa/x86/rtasm/x86sse.c
+++ b/src/mesa/x86/rtasm/x86sse.c
@@ -1,7 +1,7 @@
#ifdef USE_X86_ASM
#if defined(__i386__) || defined(__386__)
-#include "imports.h"
+#include "main/imports.h"
#include "x86sse.h"
#define DISASSEM 0
diff --git a/src/mesa/x86/sse.c b/src/mesa/x86/sse.c
index 4b016a1e850..1c185387c64 100644
--- a/src/mesa/x86/sse.c
+++ b/src/mesa/x86/sse.c
@@ -27,8 +27,8 @@
* Andre Werthmann <[email protected]>
*/
-#include "glheader.h"
-#include "context.h"
+#include "main/glheader.h"
+#include "main/context.h"
#include "math/m_xform.h"
#include "tnl/t_context.h"
diff --git a/src/mesa/x86/x86.c b/src/mesa/x86/x86.c
index 82caa42dbd6..ce649f66b0b 100644
--- a/src/mesa/x86/x86.c
+++ b/src/mesa/x86/x86.c
@@ -27,8 +27,8 @@
* Intel x86 assembly code by Josh Vanderhoof
*/
-#include "glheader.h"
-#include "context.h"
+#include "main/glheader.h"
+#include "main/context.h"
#include "math/m_xform.h"
#include "tnl/t_context.h"