Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1

This commit is contained in:
Ben Skeggs 2008-07-27 00:54:57 +10:00
commit 9e445d3e63
162 changed files with 1178 additions and 912 deletions

View file

@ -76,6 +76,27 @@ def get_wce500_paths(env):
exe_path = string.join(exe_paths, os.pathsep )
return (include_path, lib_path, exe_path)
def get_wce600_root(env):
try:
return os.environ['_WINCEROOT']
except KeyError:
pass
if SCons.Util.can_read_reg:
key = r'SOFTWARE\Microsoft\Platform Builder\6.00\Directories\OS Install Dir'
try:
path, t = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key)
except SCons.Util.RegError:
pass
else:
return path
default_path = os.path.join(r'C:\WINCE600', version)
if os.path.exists(default_path):
return default_path
return None
def get_wce600_paths(env):
"""Return a 3-tuple of (INCLUDE, LIB, PATH) as the values
of those three environment variables that should be set
@ -87,16 +108,19 @@ def get_wce600_paths(env):
# See also C:\WINCE600\public\common\oak\misc\wince.bat
os_version = os.environ.get('_winceosver', '600')
wince_root = os.environ.get('_winceroot', r'C:\WINCE600')
platform_root = os.environ.get('_platformroot', os.path.join(wince_root, 'platform'))
sdk_root = os.environ.get('_sdkroot' ,os.path.join(wince_root, 'sdk'))
wince_root = get_wce600_root(env)
if wince_root is None:
raise SCons.Errors.InternalError, "Windows CE 6.0 SDK not found"
os_version = os.environ.get('_WINCEOSVER', '600')
platform_root = os.environ.get('_PLATFORMROOT', os.path.join(wince_root, 'platform'))
sdk_root = os.environ.get('_SDKROOT' ,os.path.join(wince_root, 'sdk'))
platform_root = os.environ.get('_platformroot', os.path.join(wince_root, 'platform'))
sdk_root = os.environ.get('_sdkroot' ,os.path.join(wince_root, 'sdk'))
platform_root = os.environ.get('_PLATFORMROOT', os.path.join(wince_root, 'platform'))
sdk_root = os.environ.get('_SDKROOT' ,os.path.join(wince_root, 'sdk'))
host_cpu = os.environ.get('_hostcputype', 'i386')
target_cpu = os.environ.get('_tgtcpu', 'x86')
host_cpu = os.environ.get('_HOSTCPUTYPE', 'i386')
target_cpu = os.environ.get('_TGTCPU', 'x86')
if env['debug']:
build = 'debug'
@ -104,7 +128,7 @@ def get_wce600_paths(env):
build = 'retail'
try:
project_root = os.environ['_projectroot']
project_root = os.environ['_PROJECTROOT']
except KeyError:
# No project root defined -- use the common stuff instead
project_root = os.path.join(wince_root, 'public', 'common')
@ -147,12 +171,6 @@ def generate(env):
pass
def exists(env):
if not msvc_sa.exits(env):
return 0
if not mslib_sa.exits(env):
return 0
if not mslink_sa.exits(env):
return 0
return 1
return get_wce600_root(env) is not None
# vim:set ts=4 sw=4 et:

View file

@ -44,7 +44,30 @@ import msvc_sa
import mslib_sa
import mslink_sa
def get_winddk_paths(env, version=None):
def get_winddk_root(env):
try:
return os.environ['BASEDIR']
except KeyError:
pass
version = "3790.1830"
if SCons.Util.can_read_reg:
key = r'SOFTWARE\Microsoft\WINDDK\%s\LFNDirectory' % version
try:
path, t = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key)
except SCons.Util.RegError:
pass
else:
return path
default_path = os.path.join(r'C:\WINDDK', version)
if os.path.exists(default_path):
return default_path
return None
def get_winddk_paths(env):
"""Return a 3-tuple of (INCLUDE, LIB, PATH) as the values
of those three environment variables that should be set
in order to execute the MSVC tools properly."""
@ -54,10 +77,9 @@ def get_winddk_paths(env, version=None):
lib_paths = []
include_paths = []
if 'BASEDIR' in os.environ:
WINDDKdir = os.environ['BASEDIR']
else:
WINDDKdir = "C:\\WINDDK\\3790.1830"
WINDDKdir = get_winddk_root(env)
if WINDDKdir is None:
raise SCons.Errors.InternalError, "WINDDK not found"
exe_paths.append( os.path.join(WINDDKdir, 'bin') )
exe_paths.append( os.path.join(WINDDKdir, 'bin', 'x86') )
@ -103,12 +125,6 @@ def generate(env):
pass
def exists(env):
if not msvc_sa.exits(env):
return 0
if not mslib_sa.exits(env):
return 0
if not mslink_sa.exits(env):
return 0
return 1
return get_winddk_root(env) is not None
# vim:set ts=4 sw=4 et:

View file

@ -100,7 +100,7 @@ struct tgsi_exec_labels
};
#define TGSI_EXEC_NUM_TEMPS 64
#define TGSI_EXEC_NUM_TEMPS 128
#define TGSI_EXEC_NUM_TEMP_EXTRAS 6
#define TGSI_EXEC_NUM_IMMEDIATES 256

View file

@ -491,9 +491,17 @@ tgsi_dump_instruction(
src->SrcRegisterExtSwz.ExtSwizzleZ != TGSI_EXTSWIZZLE_Z ||
src->SrcRegisterExtSwz.ExtSwizzleW != TGSI_EXTSWIZZLE_W) {
CHR( '.' );
if (src->SrcRegisterExtSwz.NegateX)
TXT("-");
ENM( src->SrcRegisterExtSwz.ExtSwizzleX, extswizzle_names );
if (src->SrcRegisterExtSwz.NegateY)
TXT("-");
ENM( src->SrcRegisterExtSwz.ExtSwizzleY, extswizzle_names );
if (src->SrcRegisterExtSwz.NegateZ)
TXT("-");
ENM( src->SrcRegisterExtSwz.ExtSwizzleZ, extswizzle_names );
if (src->SrcRegisterExtSwz.NegateW)
TXT("-");
ENM( src->SrcRegisterExtSwz.ExtSwizzleW, extswizzle_names );
}

View file

@ -198,7 +198,7 @@ iter_instruction(
inst->FullSrcRegisters[i].SrcRegister.File,
inst->FullSrcRegisters[i].SrcRegister.Index,
"source",
inst->FullSrcRegisters[i].SrcRegister.Indirect );
(boolean)inst->FullSrcRegisters[i].SrcRegister.Indirect );
if (inst->FullSrcRegisters[i].SrcRegister.Indirect) {
uint file;
int index;

View file

@ -119,7 +119,7 @@ tgsi_util_get_full_src_register_extswizzle(
if( swizzle <= TGSI_SWIZZLE_W ) {
swizzle = tgsi_util_get_src_register_swizzle(
&reg->SrcRegister,
component );
swizzle );
}
return swizzle;

View file

@ -73,8 +73,7 @@ _EngDebugPrint(const char *format, ...)
void _debug_vprintf(const char *format, va_list ap)
{
#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
#ifndef WINCE
#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
/* EngDebugPrint does not handle float point arguments, so we need to use
* our own vsnprintf implementation. It is also very slow, so buffer until
* we find a newline. */
@ -85,9 +84,6 @@ void _debug_vprintf(const char *format, va_list ap)
_EngDebugPrint("%s", buf);
buf[0] = '\0';
}
#else
/* TODO: Implement debug print for WINCE */
#endif
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
/* EngDebugPrint does not handle float point arguments, so we need to use
* our own vsnprintf implementation. It is also very slow, so buffer until
@ -99,7 +95,9 @@ void _debug_vprintf(const char *format, va_list ap)
OutputDebugStringA(buf);
buf[0] = '\0';
}
#else
#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
/* TODO */
#else /* !PIPE_SUBSYSTEM_WINDOWS */
vfprintf(stderr, format, ap);
#endif
}
@ -211,7 +209,7 @@ _debug_get_option(const char *name)
#else
return NULL;
#endif
#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE)
#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
/* TODO: implement */
return NULL;
#else

View file

@ -162,6 +162,8 @@
* <http://www.jhweiss.de/software/snprintf.html>.
*/
#include "pipe/p_config.h"
#if HAVE_CONFIG_H
#include <config.h>
#else
@ -1102,7 +1104,11 @@ again:
* Factor of ten with the number of digits needed for the fractional
* part. For example, if the precision is 3, the mask will be 1000.
*/
#if defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
mask = (unsigned long)mypow10(precision);
#else
mask = (UINTMAX_T)mypow10(precision);
#endif
/*
* We "cheat" by converting the fractional part to integer by
* multiplying by a factor of ten.
@ -1354,7 +1360,11 @@ cast(LDOUBLE value)
if (value >= UINTMAX_MAX)
return UINTMAX_MAX;
#if defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
result = (unsigned long)value;
#else
result = (UINTMAX_T)value;
#endif
/*
* At least on NetBSD/sparc64 3.0.2 and 4.99.30, casting long double to
* an integer type converts e.g. 1.9 to 2 instead of 1 (which violates

View file

@ -364,7 +364,6 @@ void
sp_flush_tile_cache(struct softpipe_context *softpipe,
struct softpipe_tile_cache *tc)
{
struct pipe_context *pipe = &softpipe->pipe;
struct pipe_surface *ps = tc->surface;
int inuse = 0, pos;
@ -414,7 +413,6 @@ struct softpipe_cached_tile *
sp_get_cached_tile(struct softpipe_context *softpipe,
struct softpipe_tile_cache *tc, int x, int y)
{
struct pipe_context *pipe = &softpipe->pipe;
struct pipe_surface *ps = tc->surface;
/* tile pos in framebuffer: */

View file

@ -33,8 +33,71 @@
#include "p_debug.h"
#include "p_format.h"
#include "p_pointer.h"
#if defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
__inline double ceil(double val)
{
double ceil_val;
if((val - (long) val) == 0) {
ceil_val = val;
} else {
if(val > 0) {
ceil_val = (long) val + 1;
} else {
ceil_val = (long) val;
}
}
return ceil_val;
}
#ifndef PIPE_SUBSYSTEM_WINDOWS_CE
__inline double floor(double val)
{
double floor_val;
if((val - (long) val) == 0) {
floor_val = val;
} else {
if(val > 0) {
floor_val = (long) val;
} else {
floor_val = (long) val - 1;
}
}
return floor_val;
}
#endif
#pragma function(pow)
__inline double __cdecl pow(double val, double exponent)
{
/* XXX */
assert(0);
return 0;
}
#pragma function(log)
__inline double __cdecl log(double val)
{
/* XXX */
assert(0);
return 0;
}
#pragma function(atan2)
__inline double __cdecl atan2(double val)
{
/* XXX */
assert(0);
return 0;
}
#else
#include <math.h>
#include <stdarg.h>
#endif
#ifdef __cplusplus

View file

@ -253,12 +253,10 @@ intel_flush_frontbuffer( struct pipe_winsys *winsys,
struct pipe_surface *surf,
void *context_private)
{
//struct intel_context *intel = (struct intel_context *) context_private;
//__DRIdrawablePrivate *dPriv = intel->driDrawable;
struct intel_context *intel = (struct intel_context *) context_private;
__DRIdrawablePrivate *dPriv = intel->driDrawable;
assert((int)"Doesn't work currently" & 0);
//intelDisplaySurface(dPriv, surf, NULL);
intelDisplaySurface(dPriv, surf, NULL);
}
static boolean

View file

@ -10,7 +10,6 @@ if env['platform'] != 'winddk':
env.Append(CPPPATH = [
'#/src/mesa',
'#/src/mesa/main',
])
if gcc:

View file

@ -50,7 +50,7 @@
#include "glheader.h"
#include "main/glheader.h"
#include "glapi.h"
#include "glapioffsets.h"
#include "glapitable.h"

View file

@ -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"

View file

@ -29,7 +29,7 @@
*/
#include "glheader.h"
#include "main/glheader.h"
#include "glthread.h"

View file

@ -33,6 +33,76 @@
#include "extensions.h"
/**
* 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 || \

View file

@ -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() */
};

View file

@ -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);

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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,

View file

@ -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"

View file

@ -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

View file

@ -26,7 +26,7 @@
#define GRAMMAR_MESA_H
#include "imports.h"
#include "main/imports.h"
/* NOTE: include Mesa 3-D specific headers here */

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -31,7 +31,7 @@
#ifndef PROG_PARAMETER_H
#define PROG_PARAMETER_H
#include "mtypes.h"
#include "main/mtypes.h"
#include "prog_statevars.h"

View file

@ -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"

View file

@ -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"

View file

@ -25,7 +25,7 @@
#ifndef PROG_STATEVARS_H
#define PROG_STATEVARS_H
#include "mtypes.h"
#include "main/mtypes.h"
/**

View file

@ -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"

View file

@ -40,7 +40,7 @@
#ifndef PROGRAM_H
#define PROGRAM_H
#include "mtypes.h"
#include "main/mtypes.h"
extern struct gl_program _mesa_DummyProgram;

View file

@ -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"

View file

@ -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) {

View file

@ -27,8 +27,8 @@
#define SHADER_API_H
#include "glheader.h"
#include "mtypes.h"
#include "main/glheader.h"
#include "main/mtypes.h"
/**

View file

@ -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]++);
}

View file

@ -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

View file

@ -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;

View file

@ -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,

View file

@ -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)
_slang_find_function_by_argc(slang_function_scope *scope,
const char *name, int numArgs)
{
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;
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 (!fun) {
fun = _slang_locate_struct_constructor(A, name);
if (error) {
slang_info_log_error(A->log,
"Function '%s' not found (check argument types)",
name);
return NULL;
}
if (!fun) {
/* A function with exactly the right parameters/types was not found.
* Try adapting the parameters.
/* Next, try locating a constructor function for a user-defined type */
fun = _slang_locate_struct_constructor(A, name);
}
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 {

View file

@ -27,7 +27,7 @@
#define SLANG_CODEGEN_H
#include "imports.h"
#include "main/imports.h"
#include "slang_compile.h"

View file

@ -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
}

View file

@ -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"

View file

@ -28,7 +28,7 @@
* \author Michal Krol
*/
#include "imports.h"
#include "main/imports.h"
#include "slang_compile.h"
#include "slang_mem.h"

View file

@ -28,7 +28,7 @@
* \author Michal Krol
*/
#include "imports.h"
#include "main/imports.h"
#include "slang_compile.h"
#include "slang_mem.h"

View file

@ -28,7 +28,7 @@
* \author Michal Krol
*/
#include "imports.h"
#include "main/imports.h"
#include "slang_mem.h"
#include "slang_compile.h"

View file

@ -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;
}

View file

@ -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;
}
/* do codegen for array */
emit(emitInfo, n->Children[0]);
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
/* 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 */
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);
/* 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;
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]);

View file

@ -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

View file

@ -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"

View file

@ -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"
/**

View file

@ -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) )

View file

@ -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()");
}

View file

@ -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"

View file

@ -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"

View file

@ -27,7 +27,7 @@
#define SLANG_MEM_H
#include "imports.h"
#include "main/imports.h"
typedef struct slang_mempool_ slang_mempool;

View file

@ -28,7 +28,7 @@
* \author Michal Krol
*/
#include "imports.h"
#include "main/imports.h"
#include "shader/grammar/grammar_mesa.h"
#include "slang_preprocess.h"

View file

@ -4,7 +4,7 @@
*/
#include "imports.h"
#include "main/imports.h"
#include "slang_compile.h"
#include "slang_print.h"

View file

@ -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);
if (dbg)
printf("Adapt call of %d args to func %s (%d params)\n",
callOper->num_children, (char*) fun->header.a_name, 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;
}
}
} /* 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;
@ -445,6 +378,107 @@ _slang_adapt_call(slang_operation *callOper, const slang_function *fun,
slang_typeinfo_destruct(&argType);
}
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);

View file

@ -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
@ -13,6 +36,11 @@ _slang_simplify(slang_operation *oper,
slang_atom_pool * atoms);
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,

View file

@ -28,7 +28,7 @@
* \author Michal Krol
*/
#include "imports.h"
#include "main/imports.h"
#include "slang_storage.h"
#include "slang_mem.h"

View file

@ -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;
*error = GL_FALSE;
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;
}
if (!slang_type_specifier_compatible(&ti.spec,
&f->parameters->variables[j]->type.specifier)) {
slang_typeinfo_destruct(&ti);
break;
}
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;
/* 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;
}
if (j == num_args)
return f;
}
if (funcs->outer_scope != NULL)
return _slang_locate_function(funcs->outer_scope, a_name, args,
num_args, space, atoms, log);
/* 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 (j == num_args) {
/* name and args match! */
return f;
}
}
funcs = funcs->outer_scope;
}
return NULL;
}

View file

@ -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

View file

@ -28,7 +28,7 @@
* \author Michal Krol
*/
#include "imports.h"
#include "main/imports.h"
#include "slang_utility.h"
#include "slang_mem.h"

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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);
}
}
}

View file

@ -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

View file

@ -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 */

View file

@ -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

View file

@ -28,7 +28,7 @@
#define S_AALINE_H
#include "mtypes.h"
#include "main/mtypes.h"
#include "swrast.h"

View file

@ -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"

View file

@ -28,7 +28,7 @@
#define S_AATRIANGLE_H
#include "mtypes.h"
#include "main/mtypes.h"
#include "swrast.h"

View file

@ -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"

View file

@ -27,7 +27,7 @@
#define S_ACCUM_H
#include "mtypes.h"
#include "main/mtypes.h"
extern void

View file

@ -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"

View file

@ -28,7 +28,7 @@
#define S_ALPHA_H
#include "mtypes.h"
#include "main/mtypes.h"
#include "s_context.h"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -27,7 +27,7 @@
#define S_BLEND_H
#include "mtypes.h"
#include "main/mtypes.h"
#include "s_context.h"

View file

@ -23,8 +23,8 @@
*/
#include "glheader.h"
#include "macros.h"
#include "main/glheader.h"
#include "main/macros.h"
#include "s_context.h"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -27,7 +27,7 @@
#define S_DEPTH_H
#include "mtypes.h"
#include "main/mtypes.h"
#include "s_context.h"

Some files were not shown because too many files have changed in this diff Show more