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

This commit is contained in:
Ben Skeggs 2008-07-23 14:05:22 +10:00
commit 704dca40c4
120 changed files with 7636 additions and 3858 deletions

View File

@ -53,7 +53,7 @@ opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys,
env = Environment(
options = opts,
tools = ['gallium'],
toolpath = ['scons'],
toolpath = ['#scons'],
ENV = os.environ,
)

View File

@ -246,7 +246,7 @@ case $ARCH in
if [ $EXPORTS ] ; then
#OPTS="${OPTS} -Xlinker --retain-symbols-file ${EXPORTS}"
# Make the 'exptmp' file for --version-script option
echo "VERSION_${MAJOR}.${MINOR} {" > exptmp
echo "{" > exptmp
echo "global:" >> exptmp
sed 's/$/;/' ${EXPORTS} >> exptmp
echo "local:" >> exptmp

View File

@ -254,30 +254,40 @@ def yuv2rgb(y, u, v):
return r, g, b
def translate_rgba(data):
r, g, b, a = data
def translate_r5g6b5(data):
value, = struct.unpack_from("H", data)
r = ((value >> 11) & 0x1f)*0xff/0x1f
g = ((value >> 5) & 0x3f)*0xff/0x3f
b = ((value >> 0) & 0x1f)*0xff/0x1f
a = 255
return [[(r, g, b, a)]]
def translate_r8g8b8a8(data):
r, g, b, a = struct.unpack_from("BBBB", data)
return [[(r, g, b, a)]]
def translate_ycbcr(data):
y1, u, y2, v = data
y1, u, y2, v = struct.unpack_from("BBBB", data)
r1, g1, b1 = yuv2rgb(y1, u, v)
r2, g2, b2 = yuv2rgb(y1, u, v)
return [[(r1, g1, b1, 255), (r2, g2, b2, 255)]]
def translate_ycbcr_rev(data):
v, y2, u, y1 = data
v, y2, u, y1 = struct.unpack_from("BBBB", data)
r1, g1, b1 = yuv2rgb(y1, u, v)
r2, g2, b2 = yuv2rgb(y1, u, v)
return [[(r1, g1, b1, 255), (r2, g2, b2, 255)]]
translate = {
PIPE_FORMAT_A8R8G8B8_UNORM: (4, 1, 1, translate_rgba),
PIPE_FORMAT_X8R8G8B8_UNORM: (4, 1, 1, translate_rgba),
PIPE_FORMAT_B8G8R8A8_UNORM: (4, 1, 1, translate_rgba),
PIPE_FORMAT_B8G8R8X8_UNORM: (4, 1, 1, translate_rgba),
PIPE_FORMAT_A8B8G8R8_SNORM: (4, 1, 1, translate_rgba),
PIPE_FORMAT_A8R8G8B8_UNORM: (4, 1, 1, translate_r8g8b8a8),
PIPE_FORMAT_X8R8G8B8_UNORM: (4, 1, 1, translate_r8g8b8a8),
PIPE_FORMAT_B8G8R8A8_UNORM: (4, 1, 1, translate_r8g8b8a8),
PIPE_FORMAT_B8G8R8X8_UNORM: (4, 1, 1, translate_r8g8b8a8),
PIPE_FORMAT_A8B8G8R8_SNORM: (4, 1, 1, translate_r8g8b8a8),
PIPE_FORMAT_R5G6B5_UNORM: (2, 1, 1, translate_r5g6b5),
PIPE_FORMAT_YCBCR: (4, 2, 1, translate_ycbcr),
PIPE_FORMAT_YCBCR_REV: (4, 2, 1, translate_ycbcr_rev),
}
@ -304,7 +314,7 @@ def process(infilename, outfilename):
return
for y in range(0, height, bheight):
for x in range(0, width, bwidth):
indata = map(ord, infile.read(4))
indata = infile.read(bsize)
outdata = translate_func(indata)
for j in range(bheight):
for i in range(bwidth):

View File

@ -32,266 +32,278 @@ import optparse
import re
import struct
from gprof2dot import Call, Function, Profile
from gprof2dot import CALLS, SAMPLES, TIME, TIME_RATIO, TOTAL_TIME, TOTAL_TIME_RATIO
from gprof2dot import DotWriter, TEMPERATURE_COLORMAP
__version__ = '0.1'
verbose = False
class ParseError(Exception):
pass
pass
class MsvcDemangler:
# http://www.kegel.com/mangle.html
# http://www.kegel.com/mangle.html
def __init__(self, symbol):
self._symbol = symbol
self._pos = 0
def __init__(self, symbol):
self._symbol = symbol
self._pos = 0
def lookahead(self):
return self._symbol[self._pos]
def lookahead(self):
return self._symbol[self._pos]
def consume(self):
ret = self.lookahead()
self._pos += 1
return ret
def match(self, c):
if self.lookahead() != c:
raise ParseError
self.consume()
def consume(self):
ret = self.lookahead()
self._pos += 1
return ret
def match(self, c):
if self.lookahead() != c:
raise ParseError
self.consume()
def parse(self):
self.match('?')
name = self.parse_name()
qualifications = self.parse_qualifications()
return '::'.join(qualifications + [name])
def parse(self):
self.match('?')
name = self.parse_name()
qualifications = self.parse_qualifications()
return '::'.join(qualifications + [name])
def parse_name(self):
if self.lookahead() == '?':
return self.consume() + self.consume()
else:
name = self.parse_id()
self.match('@')
return name
def parse_name(self):
if self.lookahead() == '?':
return self.consume() + self.consume()
else:
name = self.parse_id()
self.match('@')
return name
def parse_qualifications(self):
qualifications = []
while self.lookahead() != '@':
name = self.parse_id()
qualifications.append(name)
self.match('@')
return qualifications
def parse_qualifications(self):
qualifications = []
while self.lookahead() != '@':
name = self.parse_id()
qualifications.append(name)
self.match('@')
return qualifications
def parse_id(self):
s = ''
while True:
c = self.lookahead()
if c.isalnum() or c in '_':
s += c
self.consume()
else:
break
return s
def parse_id(self):
s = ''
while True:
c = self.lookahead()
if c.isalnum() or c in '_':
s += c
self.consume()
else:
break
return s
def demangle(name):
if name.startswith('_'):
name = name[1:]
idx = name.rfind('@')
if idx != -1 and name[idx+1:].isdigit():
name = name[:idx]
return name
if name.startswith('?'):
demangler = MsvcDemangler(name)
return demangler.parse()
return name
return name
if name.startswith('_'):
name = name[1:]
idx = name.rfind('@')
if idx != -1 and name[idx+1:].isdigit():
name = name[:idx]
return name
if name.startswith('?'):
demangler = MsvcDemangler(name)
return demangler.parse()
return name
class Profile:
class Reader:
def __init__(self):
self.symbols = []
self.symbol_cache = {}
self.base_addr = None
self.functions = {}
self.last_stamp = 0
self.stamp_base = 0
def unwrap_stamp(self, stamp):
if stamp < self.last_stamp:
self.stamp_base += 1 << 32
self.last_stamp = stamp
return self.stamp_base + stamp
def __init__(self):
self.symbols = []
self.symbol_cache = {}
self.base_addr = None
def read_map(self, mapfile):
# See http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
last_addr = 0
last_name = 0
for line in file(mapfile, "rt"):
fields = line.split()
try:
section_offset, name, addr, type, lib_object = fields
except ValueError:
continue
if type != 'f':
continue
section, offset = section_offset.split(':')
addr = int(offset, 16)
self.symbols.append((addr, name))
last_addr = addr
last_name = name
def read_map(self, mapfile):
# See http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
last_addr = 0
last_name = 0
for line in file(mapfile, "rt"):
fields = line.split()
try:
section_offset, name, addr, type, lib_object = fields
except ValueError:
continue
if type != 'f':
continue
section, offset = section_offset.split(':')
addr = int(offset, 16)
name = demangle(name)
if last_addr == addr:
# TODO: handle collapsed functions
#assert last_name == name
continue
self.symbols.append((addr, name))
last_addr = addr
last_name = name
# sort symbols
self.symbols.sort(key = lambda (addr, name): addr)
# sort symbols
self.symbols.sort(key = lambda (addr, name): addr)
def lookup_addr(self, addr):
try:
return self.symbol_cache[addr]
except KeyError:
pass
def lookup_addr(self, addr):
try:
return self.symbol_cache[addr]
except KeyError:
pass
tolerance = 4196
s, e = 0, len(self.symbols)
while s != e:
i = (s + e)//2
start_addr, name = self.symbols[i]
try:
end_addr, next_name = self.symbols[i + 1]
except IndexError:
end_addr = start_addr + tolerance
if addr < start_addr:
e = i
continue
if addr == end_addr:
return next_name, addr - start_addr
if addr > end_addr:
s = i
continue
return name, addr - start_addr
raise ValueError
tolerance = 4196
s, e = 0, len(self.symbols)
while s != e:
i = (s + e)//2
start_addr, name = self.symbols[i]
try:
end_addr, next_name = self.symbols[i + 1]
except IndexError:
end_addr = start_addr + tolerance
if addr < start_addr:
e = i
continue
if addr == end_addr:
return next_name
if addr > end_addr:
s = i
continue
return name
return "0x%08x" % addr
def lookup_symbol(self, name):
for symbol_addr, symbol_name in self.symbols:
if name == symbol_name:
return symbol_addr
return 0
def lookup_symbol(self, name):
for symbol_addr, symbol_name in self.symbols:
if name == symbol_name:
return symbol_addr
return 0
def read_data(self, data):
profile = Profile()
def read_data(self, data):
# TODO: compute these automatically
caller_overhead = 672 - 2*144 # __debug_profile_reference2 - 2*__debug_profile_reference1
callee_overhead = 144 # __debug_profile_reference1
callee_overhead -= 48 # tolerance
caller_overhead = callee_overhead
fp = file(data, "rb")
entry_format = "IIII"
entry_size = struct.calcsize(entry_format)
caller = None
caller_stack = []
while True:
entry = fp.read(entry_size)
if len(entry) < entry_size:
break
caller_addr, callee_addr, samples_lo, samples_hi = struct.unpack(entry_format, entry)
if caller_addr == 0 and callee_addr == 0:
continue
fp = file(data, "rb")
entry_format = "II"
entry_size = struct.calcsize(entry_format)
stack = []
last_stamp = 0
delta = 0
while True:
entry = fp.read(entry_size)
if len(entry) < entry_size:
break
addr_exit, stamp = struct.unpack(entry_format, entry)
if addr_exit == 0 and stamp == 0:
break
addr = addr_exit & 0xfffffffe
exit = addr_exit & 0x00000001
if self.base_addr is None:
ref_addr = self.lookup_symbol('___debug_profile_reference@0')
if ref_addr:
self.base_addr = (caller_addr - ref_addr) & ~(options.align - 1)
else:
self.base_addr = 0
sys.stderr.write('Base addr: %08x\n' % self.base_addr)
if self.base_addr is None:
ref_addr = self.lookup_symbol('__debug_profile_reference2')
if ref_addr:
self.base_addr = addr - ref_addr
else:
self.base_addr = 0
#print hex(self.base_addr)
rel_addr = addr - self.base_addr
#print hex(addr - self.base_addr)
samples = (samples_hi << 32) | samples_lo
try:
caller_raddr = caller_addr - self.base_addr
caller_sym, caller_ofs = self.lookup_addr(caller_raddr)
name = self.lookup_addr(rel_addr)
stamp = self.unwrap_stamp(stamp)
try:
caller = profile.functions[caller_sym]
except KeyError:
caller_name = demangle(caller_sym)
caller = Function(caller_sym, caller_name)
profile.add_function(caller)
caller[CALLS] = 0
caller[SAMPLES] = 0
except ValueError:
caller = None
delta += stamp - last_stamp
if not callee_addr:
if caller:
caller[SAMPLES] += samples
else:
callee_raddr = callee_addr - self.base_addr
callee_sym, callee_ofs = self.lookup_addr(callee_raddr)
if not exit:
if verbose >= 2:
print "%10u >> 0x%08x" % (stamp, addr)
if verbose:
print "%10u >> %s" % (stamp, name)
delta -= caller_overhead
stack.append((name, stamp, delta))
delta = 0
else:
if verbose >= 2:
print "%10u << 0x%08x" % (stamp, addr)
if len(stack):
self_time = delta - callee_overhead
entry_name, entry_stamp, delta = stack.pop()
if entry_name != name:
if verbose:
print "%10u << %s" % (stamp, name)
#assert entry_name == name
break
total_time = stamp - entry_stamp
self.functions[entry_name] = self.functions.get(entry_name, 0) + self_time
if verbose:
print "%10u << %s %+u" % (stamp, name, self_time)
else:
delta = 0
try:
callee = profile.functions[callee_sym]
except KeyError:
callee_name = demangle(callee_sym)
callee = Function(callee_sym, callee_name)
profile.add_function(callee)
callee[CALLS] = samples
callee[SAMPLES] = 0
else:
callee[CALLS] += samples
last_stamp = stamp
if caller is not None:
try:
call = caller.calls[callee.id]
except KeyError:
call = Call(callee.id)
call[CALLS] = samples
caller.add_call(call)
else:
call[CALLS] += samples
if options.verbose:
if not callee_addr:
sys.stderr.write('%s+%u: %u\n' % (caller_sym, caller_ofs, samples))
else:
sys.stderr.write('%s+%u -> %s+%u: %u\n' % (caller_sym, caller_ofs, callee_sym, callee_ofs, samples))
def write_report(self):
total = sum(self.functions.values())
results = self.functions.items()
results.sort(key = lambda (name, time): -time)
for name, time in results:
perc = float(time)/float(total)*100.0
print "%6.03f %s" % (perc, name)
# compute derived data
profile.validate()
profile.find_cycles()
profile.aggregate(SAMPLES)
profile.ratio(TIME_RATIO, SAMPLES)
profile.call_ratios(CALLS)
profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
return profile
def main():
parser = optparse.OptionParser(
usage="\n\t%prog [options] [file] ...",
version="%%prog %s" % __version__)
parser.add_option(
'-m', '--map', metavar='FILE',
type="string", dest="map",
help="map file")
parser.add_option(
'-b', '--base', metavar='FILE',
type="string", dest="base",
help="base addr")
parser.add_option(
'-v', '--verbose',
action="count",
dest="verbose", default=0,
help="verbose output")
(options, args) = parser.parse_args(sys.argv[1:])
parser = optparse.OptionParser(
usage="\n\t%prog [options] [file] ...",
version="%%prog %s" % __version__)
parser.add_option(
'-a', '--align', metavar='NUMBER',
type="int", dest="align", default=16,
help="section alignment")
parser.add_option(
'-m', '--map', metavar='FILE',
type="string", dest="map",
help="map file")
parser.add_option(
'-b', '--base', metavar='FILE',
type="string", dest="base",
help="base addr")
parser.add_option(
'-n', '--node-thres', metavar='PERCENTAGE',
type="float", dest="node_thres", default=0.5,
help="eliminate nodes below this threshold [default: %default]")
parser.add_option(
'-e', '--edge-thres', metavar='PERCENTAGE',
type="float", dest="edge_thres", default=0.1,
help="eliminate edges below this threshold [default: %default]")
parser.add_option(
'-v', '--verbose',
action="count",
dest="verbose", default=0,
help="verbose output")
global verbose
verbose = options.verbose
global options
(options, args) = parser.parse_args(sys.argv[1:])
profile = Profile()
if options.base is not None:
profile.base_addr = int(options.base, 16)
if options.map is not None:
profile.read_map(options.map)
for arg in args:
profile.read_data(arg)
profile.write_report()
reader = Reader()
if options.base is not None:
reader.base_addr = int(options.base, 16)
if options.map is not None:
reader.read_map(options.map)
for arg in args:
profile = reader.read_data(arg)
profile.prune(options.node_thres/100.0, options.edge_thres/100.0)
output = sys.stdout
dot = DotWriter(output)
colormap = TEMPERATURE_COLORMAP
dot.graph(profile, colormap)
if __name__ == '__main__':
main()
main()

View File

@ -66,6 +66,8 @@ DRIVER_DIRS =
# Which subdirs under $(TOP)/progs/ to enter:
PROGRAM_DIRS = demos redbook samples glsl xdemos
# EGL directories
EGL_DRIVERS_DIRS = demo
# Gallium directories and
GALLIUM_AUXILIARY_DIRS = draw translate cso_cache pipebuffer tgsi sct rtasm util

View File

@ -50,6 +50,8 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
SRC_DIRS := glx/x11 egl $(SRC_DIRS)
# EGL directories
EGL_DRIVERS_DIRS = demo dri xdri
DRIVER_DIRS =
WINDOW_SYSTEM = dri

View File

@ -58,7 +58,7 @@
# else /* for use with static link lib build of Win32 edition only */
# define GLAPI extern
# endif /* _STATIC_MESA support */
# if defined(__MINGW32__) && defined(GL_NO_STDCALL) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
# if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
# define GLAPIENTRY
# else
# define GLAPIENTRY __stdcall

View File

@ -3416,16 +3416,16 @@ typedef unsigned short GLhalfNV;
#endif
#ifndef GLEXT_64_TYPES_DEFINED
/* This code block is duplicated in glext.h, so must be protected */
/* This code block is duplicated in glxext.h, so must be protected */
#define GLEXT_64_TYPES_DEFINED
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
/* (as used in the GL_EXT_timer_query extension). */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#include <inttypes.h>
#elif defined(__sun__)
#elif defined(__sun__) || defined(__digital__)
#include <inttypes.h>
#if defined(__STDC__)
#if defined(__arch64__)
#if defined(__arch64__) || defined(_LP64)
typedef long int int64_t;
typedef unsigned long int uint64_t;
#else
@ -3433,7 +3433,7 @@ typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#endif /* __arch64__ */
#endif /* __STDC__ */
#elif defined( __VMS )
#elif defined( __VMS ) || defined(__sgi)
#include <inttypes.h>
#elif defined(__SCO__) || defined(__USLC__)
#include <stdint.h>

View File

@ -380,7 +380,7 @@ typedef struct {
#endif
#ifndef GLEXT_64_TYPES_DEFINED
/* This code block is duplicated in glxext.h, so must be protected */
/* This code block is duplicated in glext.h, so must be protected */
#define GLEXT_64_TYPES_DEFINED
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
/* (as used in the GLX_OML_sync_control extension). */
@ -389,7 +389,7 @@ typedef struct {
#elif defined(__sun__) || defined(__digital__)
#include <inttypes.h>
#if defined(__STDC__)
#if defined(__arch64__)
#if defined(__arch64__) || defined(_LP64)
typedef long int int64_t;
typedef unsigned long int uint64_t;
#else
@ -397,7 +397,7 @@ typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#endif /* __arch64__ */
#endif /* __STDC__ */
#elif defined( __VMS )
#elif defined( __VMS ) || defined(__sgi)
#include <inttypes.h>
#elif defined(__SCO__) || defined(__USLC__)
#include <stdint.h>

View File

@ -51,7 +51,11 @@ extern "C" {
# else
# define GL_API __declspec(dllimport)
# endif
# define GL_APIENTRY __stdcall
# ifdef UNDER_CE
# define GL_APIENTRY
# else
# define GL_APIENTRY __stdcall
# endif
#else
# ifdef __GL_EXPORTS
# define GL_API

View File

@ -51,7 +51,11 @@ extern "C" {
# else
# define GL_APICALL __declspec(dllimport)
# endif
# define GL_APIENTRY __stdcall
# ifdef UNDER_CE
# define GL_APIENTRY
# else
# define GL_APIENTRY __stdcall
# endif
#else
# ifdef __GL_EXPORTS
# define GL_APICALL

View File

@ -12,6 +12,7 @@ enum Filter {
SHARPEN,
MEAN_REMOVAL,
EMBOSS,
EDGE_DETECT,
NO_FILTER,
LAST
};
@ -146,6 +147,17 @@ static void fillConvolution(GLint *k,
color[2] = 0.5;
color[3] = 0.5;
break;
case EDGE_DETECT:
k[0] = 1; k[1] = 1; k[2] = 1;
k[3] = 0; k[4] = 0; k[5] = 0;
k[6] = -1; k[7] = -1; k[8] = -1;
*scale = 1.;
color[0] = 0.5;
color[1] = 0.5;
color[2] = 0.5;
color[3] = 0.5;
break;
case NO_FILTER:
k[0] = 0; k[1] = 0; k[2] = 0;
k[3] = 0; k[4] = 1; k[5] = 0;
@ -294,6 +306,7 @@ static void menuInit()
glutAddMenuEntry("Sharpen", SHARPEN);
glutAddMenuEntry("Mean removal", MEAN_REMOVAL);
glutAddMenuEntry("Emboss", EMBOSS);
glutAddMenuEntry("Edge detect", EDGE_DETECT);
glutAddMenuEntry("None", NO_FILTER);
glutAddMenuEntry("Quit", QUIT);

View File

@ -4,10 +4,10 @@ Frontend-tool for Gallium3D architecture.
"""
#
#
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
# 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
@ -15,11 +15,11 @@ Frontend-tool for Gallium3D architecture.
# distribute, sub license, 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 (including the
# next paragraph) 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 NON-INFRINGEMENT.
@ -27,7 +27,7 @@ Frontend-tool for Gallium3D architecture.
# 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.
#
#
import os
@ -40,13 +40,13 @@ import SCons.Scanner
def quietCommandLines(env):
# Quiet command lines
# See also http://www.scons.org/wiki/HidingCommandLinesInOutput
env['CCCOMSTR'] = "Compiling $SOURCE ..."
env['CXXCOMSTR'] = "Compiling $SOURCE ..."
env['ARCOMSTR'] = "Archiving $TARGET ..."
env['RANLIBCOMSTR'] = ""
env['LINKCOMSTR'] = "Linking $TARGET ..."
# Quiet command lines
# See also http://www.scons.org/wiki/HidingCommandLinesInOutput
env['CCCOMSTR'] = "Compiling $SOURCE ..."
env['CXXCOMSTR'] = "Compiling $SOURCE ..."
env['ARCOMSTR'] = "Archiving $TARGET ..."
env['RANLIBCOMSTR'] = ""
env['LINKCOMSTR'] = "Linking $TARGET ..."
def createConvenienceLibBuilder(env):
@ -54,7 +54,7 @@ def createConvenienceLibBuilder(env):
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
Based on the stock StaticLibrary and SharedLibrary builders.
"""
@ -82,337 +82,348 @@ def createConvenienceLibBuilder(env):
import_re = re.compile(r'^import\s+(\S+)$', re.M)
def python_scan(node, env, path):
# http://www.scons.org/doc/0.98.5/HTML/scons-user/c2781.html#AEN2789
contents = node.get_contents()
source_dir = node.get_dir()
imports = import_re.findall(contents)
results = []
for imp in imports:
for dir in path:
file = os.path.join(str(dir), imp.replace('.', os.sep) + '.py')
if os.path.exists(file):
results.append(env.File(file))
break
file = os.path.join(str(dir), imp.replace('.', os.sep), '__init__.py')
if os.path.exists(file):
results.append(env.File(file))
break
return results
# http://www.scons.org/doc/0.98.5/HTML/scons-user/c2781.html#AEN2789
contents = node.get_contents()
source_dir = node.get_dir()
imports = import_re.findall(contents)
results = []
for imp in imports:
for dir in path:
file = os.path.join(str(dir), imp.replace('.', os.sep) + '.py')
if os.path.exists(file):
results.append(env.File(file))
break
file = os.path.join(str(dir), imp.replace('.', os.sep), '__init__.py')
if os.path.exists(file):
results.append(env.File(file))
break
return results
python_scanner = SCons.Scanner.Scanner(function = python_scan, skeys = ['.py'])
def code_generate(env, script, target, source, command):
"""Method to simplify code generation via python scripts.
http://www.scons.org/wiki/UsingCodeGenerators
http://www.scons.org/doc/0.98.5/HTML/scons-user/c2768.html
"""
# We're generating code using Python scripts, so we have to be
# careful with our scons elements. This entry represents
# the generator file *in the source directory*.
script_src = env.File(script).srcnode()
# This command creates generated code *in the build directory*.
command = command.replace('$SCRIPT', script_src.path)
code = env.Command(target, source, command)
"""Method to simplify code generation via python scripts.
# Explicitly mark that the generated code depends on the generator,
# and on implicitly imported python modules
path = (script_src.get_dir(),)
deps = [script_src]
deps += script_src.get_implicit_deps(env, python_scanner, path)
env.Depends(code, deps)
# Running the Python script causes .pyc files to be generated in the
# source directory. When we clean up, they should go too. So add side
# effects for .pyc files
for dep in deps:
pyc = env.File(str(dep) + 'c')
env.SideEffect(pyc, code)
return code
http://www.scons.org/wiki/UsingCodeGenerators
http://www.scons.org/doc/0.98.5/HTML/scons-user/c2768.html
"""
# We're generating code using Python scripts, so we have to be
# careful with our scons elements. This entry represents
# the generator file *in the source directory*.
script_src = env.File(script).srcnode()
# This command creates generated code *in the build directory*.
command = command.replace('$SCRIPT', script_src.path)
code = env.Command(target, source, command)
# Explicitly mark that the generated code depends on the generator,
# and on implicitly imported python modules
path = (script_src.get_dir(),)
deps = [script_src]
deps += script_src.get_implicit_deps(env, python_scanner, path)
env.Depends(code, deps)
# Running the Python script causes .pyc files to be generated in the
# source directory. When we clean up, they should go too. So add side
# effects for .pyc files
for dep in deps:
pyc = env.File(str(dep) + 'c')
env.SideEffect(pyc, code)
return code
def createCodeGenerateMethod(env):
env.Append(SCANNERS = python_scanner)
env.AddMethod(code_generate, 'CodeGenerate')
env.Append(SCANNERS = python_scanner)
env.AddMethod(code_generate, 'CodeGenerate')
def generate(env):
"""Common environment generation code"""
# FIXME: this is already too late
#if env.get('quiet', False):
# quietCommandLines(env)
# shortcuts
debug = env['debug']
machine = env['machine']
platform = env['platform']
x86 = env['machine'] == 'x86'
gcc = env['platform'] in ('linux', 'freebsd', 'darwin')
msvc = env['platform'] in ('windows', 'winddk', 'wince')
"""Common environment generation code"""
# Tool
if platform == 'winddk':
env.Tool('winddk')
elif platform == 'wince':
env.Tool('wcesdk')
else:
env.Tool('default')
# FIXME: this is already too late
#if env.get('quiet', False):
# quietCommandLines(env)
# Put build output in a separate dir, which depends on the current
# configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
build_topdir = 'build'
build_subdir = env['platform']
if env['dri']:
build_subdir += "-dri"
if env['llvm']:
build_subdir += "-llvm"
if env['machine'] != 'generic':
build_subdir += '-' + env['machine']
if env['debug']:
build_subdir += "-debug"
if env['profile']:
build_subdir += "-profile"
build_dir = os.path.join(build_topdir, build_subdir)
# Place the .sconsign file in the build dir too, to avoid issues with
# different scons versions building the same source file
env['build'] = build_dir
env.SConsignFile(os.path.join(build_dir, '.sconsign'))
# shortcuts
debug = env['debug']
machine = env['machine']
platform = env['platform']
x86 = env['machine'] == 'x86'
gcc = env['platform'] in ('linux', 'freebsd', 'darwin')
msvc = env['platform'] in ('windows', 'winddk', 'wince')
# C preprocessor options
cppdefines = []
if debug:
cppdefines += ['DEBUG']
else:
cppdefines += ['NDEBUG']
if env['profile']:
cppdefines += ['PROFILE']
if platform == 'windows':
cppdefines += [
'WIN32',
'_WINDOWS',
'_UNICODE',
'UNICODE',
# http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
'WIN32_LEAN_AND_MEAN',
'VC_EXTRALEAN',
'_CRT_SECURE_NO_DEPRECATE',
]
if debug:
cppdefines += ['_DEBUG']
if platform == 'winddk':
# Mimic WINDDK's builtin flags. See also:
# - WINDDK's bin/makefile.new i386mk.inc for more info.
# - buildchk_wxp_x86.log files, generated by the WINDDK's build
# - http://alter.org.ua/docs/nt_kernel/vc8_proj/
cppdefines += [
('_X86_', '1'),
('i386', '1'),
'STD_CALL',
('CONDITION_HANDLING', '1'),
('NT_INST', '0'),
('WIN32', '100'),
('_NT1X_', '100'),
('WINNT', '1'),
('_WIN32_WINNT', '0x0501'), # minimum required OS version
('WINVER', '0x0501'),
('_WIN32_IE', '0x0603'),
('WIN32_LEAN_AND_MEAN', '1'),
('DEVL', '1'),
('__BUILDMACHINE__', 'WinDDK'),
('FPO', '0'),
]
if debug:
cppdefines += [('DBG', 1)]
if platform == 'wince':
cppdefines += [
'_CRT_SECURE_NO_DEPRECATE',
'_USE_32BIT_TIME_T',
'UNICODE',
'_UNICODE',
('UNDER_CE', '600'),
('_WIN32_WCE', '0x600'),
'WINCEOEM',
'WINCEINTERNAL',
'WIN32',
'STRICT',
'x86',
'_X86_',
'INTERNATIONAL',
('INTLMSG_CODEPAGE', '1252'),
]
if platform == 'windows':
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER']
if platform == 'winddk':
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_DISPLAY']
if platform == 'wince':
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE']
env.Append(CPPDEFINES = cppdefines)
# Tool
if platform == 'winddk':
env.Tool('winddk')
elif platform == 'wince':
env.Tool('wcesdk')
else:
env.Tool('default')
# C preprocessor includes
if platform == 'winddk':
env.Append(CPPPATH = [
env['SDK_INC_PATH'],
env['DDK_INC_PATH'],
env['WDM_INC_PATH'],
env['CRT_INC_PATH'],
])
# Put build output in a separate dir, which depends on the current
# configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
build_topdir = 'build'
build_subdir = env['platform']
if env['dri']:
build_subdir += "-dri"
if env['llvm']:
build_subdir += "-llvm"
if env['machine'] != 'generic':
build_subdir += '-' + env['machine']
if env['debug']:
build_subdir += "-debug"
if env['profile']:
build_subdir += "-profile"
build_dir = os.path.join(build_topdir, build_subdir)
# Place the .sconsign file in the build dir too, to avoid issues with
# different scons versions building the same source file
env['build'] = build_dir
env.SConsignFile(os.path.join(build_dir, '.sconsign'))
# C compiler options
cflags = []
if gcc:
if debug:
cflags += ['-O0', '-g3']
else:
cflags += ['-O3', '-g3']
if env['profile']:
cflags += ['-pg']
if env['machine'] == 'x86':
cflags += [
'-m32',
#'-march=pentium4',
'-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
#'-mfpmath=sse',
]
if env['machine'] == 'x86_64':
cflags += ['-m64']
cflags += [
'-Wall',
'-Wmissing-prototypes',
'-Wno-long-long',
'-ffast-math',
'-pedantic',
'-fmessage-length=0', # be nice to Eclipse
]
if msvc:
# See also:
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
# - cl /?
if debug:
cflags += [
'/Od', # disable optimizations
'/Oi', # enable intrinsic functions
'/Oy-', # disable frame pointer omission
]
else:
cflags += [
'/Ox', # maximum optimizations
'/Oi', # enable intrinsic functions
'/Os', # favor code space
]
if env['profile']:
cflags += [
'/Gh', # enable _penter hook function
'/GH', # enable _pexit hook function
]
cflags += [
'/W3', # warning level
#'/Wp64', # enable 64 bit porting warnings
]
if platform == 'windows':
cflags += [
# TODO
]
if platform == 'winddk':
cflags += [
'/Zl', # omit default library name in .OBJ
'/Zp8', # 8bytes struct member alignment
'/Gy', # separate functions for linker
'/Gm-', # disable minimal rebuild
'/WX', # treat warnings as errors
'/Gz', # __stdcall Calling convention
'/GX-', # disable C++ EH
'/GR-', # disable C++ RTTI
'/GF', # enable read-only string pooling
'/G6', # optimize for PPro, P-II, P-III
'/Ze', # enable extensions
'/Gi-', # disable incremental compilation
'/QIfdiv-', # disable Pentium FDIV fix
'/hotpatch', # prepares an image for hotpatching.
#'/Z7', #enable old-style debug info
]
if platform == 'wince':
# See also C:\WINCE600\public\common\oak\misc\makefile.def
cflags += [
'/GF', # enable read-only string pooling
'/GR-', # disable C++ RTTI
'/GS', # enable security checks
# Allow disabling language conformance to maintain backward compat
#'/Zc:wchar_t-', # don't force wchar_t as native type, instead of typedef
#'/Zc:forScope-', # don't enforce Standard C++ for scoping rules
#'/wd4867',
#'/wd4430',
#'/MT',
#'/U_MT',
]
# Automatic pdb generation
# See http://scons.tigris.org/issues/show_bug.cgi?id=1656
env.EnsureSConsVersion(0, 98, 0)
env['PDB'] = '${TARGET.base}.pdb'
env.Append(CFLAGS = cflags)
env.Append(CXXFLAGS = cflags)
# C preprocessor options
cppdefines = []
if debug:
cppdefines += ['DEBUG']
else:
cppdefines += ['NDEBUG']
if env['profile']:
cppdefines += ['PROFILE']
if platform == 'windows':
cppdefines += [
'WIN32',
'_WINDOWS',
'_UNICODE',
'UNICODE',
# http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
'WIN32_LEAN_AND_MEAN',
'VC_EXTRALEAN',
'_CRT_SECURE_NO_DEPRECATE',
]
if debug:
cppdefines += ['_DEBUG']
if platform == 'winddk':
# Mimic WINDDK's builtin flags. See also:
# - WINDDK's bin/makefile.new i386mk.inc for more info.
# - buildchk_wxp_x86.log files, generated by the WINDDK's build
# - http://alter.org.ua/docs/nt_kernel/vc8_proj/
cppdefines += [
('_X86_', '1'),
('i386', '1'),
'STD_CALL',
('CONDITION_HANDLING', '1'),
('NT_INST', '0'),
('WIN32', '100'),
('_NT1X_', '100'),
('WINNT', '1'),
('_WIN32_WINNT', '0x0501'), # minimum required OS version
('WINVER', '0x0501'),
('_WIN32_IE', '0x0603'),
('WIN32_LEAN_AND_MEAN', '1'),
('DEVL', '1'),
('__BUILDMACHINE__', 'WinDDK'),
('FPO', '0'),
]
if debug:
cppdefines += [('DBG', 1)]
if platform == 'wince':
cppdefines += [
'_CRT_SECURE_NO_DEPRECATE',
'_USE_32BIT_TIME_T',
'UNICODE',
'_UNICODE',
('UNDER_CE', '600'),
('_WIN32_WCE', '0x600'),
'WINCEOEM',
'WINCEINTERNAL',
'WIN32',
'STRICT',
'x86',
'_X86_',
'INTERNATIONAL',
('INTLMSG_CODEPAGE', '1252'),
]
if platform == 'windows':
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER']
if platform == 'winddk':
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_DISPLAY']
if platform == 'wince':
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE']
env.Append(CPPDEFINES = cppdefines)
# Assembler options
if gcc:
if env['machine'] == 'x86':
env.Append(ASFLAGS = ['-m32'])
if env['machine'] == 'x86_64':
env.Append(ASFLAGS = ['-m64'])
# C preprocessor includes
if platform == 'winddk':
env.Append(CPPPATH = [
env['SDK_INC_PATH'],
env['DDK_INC_PATH'],
env['WDM_INC_PATH'],
env['CRT_INC_PATH'],
])
# Linker options
linkflags = []
if gcc:
if env['machine'] == 'x86':
linkflags += ['-m32']
if env['machine'] == 'x86_64':
linkflags += ['-m64']
if platform == 'winddk':
# See also:
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
linkflags += [
'/merge:_PAGE=PAGE',
'/merge:_TEXT=.text',
'/section:INIT,d',
'/opt:ref',
'/opt:icf',
'/ignore:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221',
'/incremental:no',
'/fullbuild',
'/release',
'/nodefaultlib',
'/wx',
'/debug',
'/debugtype:cv',
'/version:5.1',
'/osversion:5.1',
'/functionpadmin:5',
'/safeseh',
'/pdbcompress',
'/stack:0x40000,0x1000',
'/driver',
'/align:0x80',
'/subsystem:native,5.01',
'/base:0x10000',
'/entry:DrvEnableDriver',
]
if env['profile']:
linkflags += [
'/MAP', # http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
]
env.Append(LINKFLAGS = linkflags)
# C compiler options
cflags = []
if gcc:
if debug:
cflags += ['-O0', '-g3']
else:
cflags += ['-O3', '-g3']
if env['profile']:
cflags += ['-pg']
if env['machine'] == 'x86':
cflags += [
'-m32',
#'-march=pentium4',
'-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
#'-mfpmath=sse',
]
if env['machine'] == 'x86_64':
cflags += ['-m64']
cflags += [
'-Wall',
'-Wmissing-prototypes',
'-Wno-long-long',
'-ffast-math',
'-pedantic',
'-fmessage-length=0', # be nice to Eclipse
]
if msvc:
# See also:
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
# - cl /?
if debug:
cflags += [
'/Od', # disable optimizations
'/Oi', # enable intrinsic functions
'/Oy-', # disable frame pointer omission
]
else:
cflags += [
'/Ox', # maximum optimizations
'/Oi', # enable intrinsic functions
'/Os', # favor code space
]
if env['profile']:
cflags += [
'/Gh', # enable _penter hook function
'/GH', # enable _pexit hook function
]
cflags += [
'/W3', # warning level
#'/Wp64', # enable 64 bit porting warnings
]
if platform == 'windows':
cflags += [
# TODO
]
if platform == 'winddk':
cflags += [
'/Zl', # omit default library name in .OBJ
'/Zp8', # 8bytes struct member alignment
'/Gy', # separate functions for linker
'/Gm-', # disable minimal rebuild
'/WX', # treat warnings as errors
'/Gz', # __stdcall Calling convention
'/GX-', # disable C++ EH
'/GR-', # disable C++ RTTI
'/GF', # enable read-only string pooling
'/G6', # optimize for PPro, P-II, P-III
'/Ze', # enable extensions
'/Gi-', # disable incremental compilation
'/QIfdiv-', # disable Pentium FDIV fix
'/hotpatch', # prepares an image for hotpatching.
#'/Z7', #enable old-style debug info
]
if platform == 'wince':
# See also C:\WINCE600\public\common\oak\misc\makefile.def
cflags += [
'/Zl', # omit default library name in .OBJ
'/GF', # enable read-only string pooling
'/GR-', # disable C++ RTTI
'/GS', # enable security checks
# Allow disabling language conformance to maintain backward compat
#'/Zc:wchar_t-', # don't force wchar_t as native type, instead of typedef
#'/Zc:forScope-', # don't enforce Standard C++ for scoping rules
#'/wd4867',
#'/wd4430',
#'/MT',
#'/U_MT',
]
# Automatic pdb generation
# See http://scons.tigris.org/issues/show_bug.cgi?id=1656
env.EnsureSConsVersion(0, 98, 0)
env['PDB'] = '${TARGET.base}.pdb'
env.Append(CFLAGS = cflags)
env.Append(CXXFLAGS = cflags)
# Custom builders and methods
createConvenienceLibBuilder(env)
createCodeGenerateMethod(env)
# Assembler options
if gcc:
if env['machine'] == 'x86':
env.Append(ASFLAGS = ['-m32'])
if env['machine'] == 'x86_64':
env.Append(ASFLAGS = ['-m64'])
# for debugging
#print env.Dump()
# Linker options
linkflags = []
if gcc:
if env['machine'] == 'x86':
linkflags += ['-m32']
if env['machine'] == 'x86_64':
linkflags += ['-m64']
if platform == 'winddk':
# See also:
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
linkflags += [
'/merge:_PAGE=PAGE',
'/merge:_TEXT=.text',
'/section:INIT,d',
'/opt:ref',
'/opt:icf',
'/ignore:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221',
'/incremental:no',
'/fullbuild',
'/release',
'/nodefaultlib',
'/wx',
'/debug',
'/debugtype:cv',
'/version:5.1',
'/osversion:5.1',
'/functionpadmin:5',
'/safeseh',
'/pdbcompress',
'/stack:0x40000,0x1000',
'/driver',
'/align:0x80',
'/subsystem:native,5.01',
'/base:0x10000',
'/entry:DrvEnableDriver',
]
if env['profile']:
linkflags += [
'/MAP', # http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
]
if platform == 'wince':
linkflags += [
'/nodefaultlib',
#'/incremental:no',
#'/fullbuild',
'/entry:_DllMainCRTStartup',
]
env.Append(LINKFLAGS = linkflags)
# Default libs
env.Append(LIBS = [])
# Custom builders and methods
createConvenienceLibBuilder(env)
createCodeGenerateMethod(env)
# for debugging
#print env.Dump()
def exists(env):
return 1
return 1

70
scons/python.py Normal file
View File

@ -0,0 +1,70 @@
"""gallium
Frontend-tool for Gallium3D architecture.
"""
#
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
# 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, sub license, 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 (including the
# next paragraph) 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 NON-INFRINGEMENT.
# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
#
import sys
import distutils.sysconfig
import os.path
def generate(env):
# See http://www.scons.org/wiki/PythonExtensions
if sys.platform in ['windows']:
python_root = sys.prefix
python_version = '%u%u' % sys.version_info[:2]
python_include = os.path.join(python_root, 'include')
python_libs = os.path.join(python_root, 'libs')
python_lib = os.path.join(python_libs, 'python' + python_version + '.lib')
env.Append(CPPPATH = [python_include])
env.Append(LIBPATH = [python_libs])
env.Append(LIBS = ['python' + python_version + '.lib'])
env.Replace(SHLIBPREFIX = '')
env.Replace(SHLIBSUFFIX = '.pyd')
# XXX; python25_d.lib is not included in Python for windows, and
# we'll get missing symbols unless we undefine _DEBUG
cppdefines = env['CPPDEFINES']
cppdefines = [define for define in cppdefines if define != '_DEBUG']
env.Replace(CPPDEFINES = cppdefines)
else:
#env.ParseConfig('python-config --cflags --ldflags --libs')
env.AppendUnique(CPPPATH = [distutils.sysconfig.get_python_inc()])
env.Replace(SHLIBPREFIX = '')
env.Replace(SHLIBSUFFIX = distutils.sysconfig.get_config_vars()['SO'])
# for debugging
#print env.Dump()
def exists(env):
return 1

View File

@ -3,27 +3,10 @@
TOP = ../../..
include $(TOP)/configs/current
SUBDIRS = demo dri xdri
SUBDIRS = $(EGL_DRIVERS_DIRS)
default: dri_subdirs
# (UNUSED) depending on $DRIVER_DIRS...
conditional_subdirs:
@if [ "${DRIVER_DIRS}" = "dri" ] ; then \
$(MAKE) dri_subdirs ; \
fi
dri_subdirs:
@ (cd dri ; $(MAKE)) || exit 1
@ (cd xdri ; $(MAKE)) || exit 1
demo_subdir:
@ (cd demo ; $(MAKE)) || exit 1
default: subdirs
subdirs:

View File

@ -181,6 +181,10 @@ get_drawable_size(Display *dpy, Drawable d, uint *width, uint *height)
static void
create_configs(_EGLDisplay *disp, __GLXdisplayPrivate *glx_priv)
{
static const EGLint all_apis = (EGL_OPENGL_ES_BIT |
EGL_OPENGL_ES2_BIT |
EGL_OPENVG_BIT |
EGL_OPENGL_BIT);
__GLXscreenConfigs *scrn = glx_priv->screenConfigs;
const __GLcontextModes *m;
int id = 1;
@ -199,8 +203,12 @@ create_configs(_EGLDisplay *disp, __GLXdisplayPrivate *glx_priv)
SET_CONFIG_ATTRIB(&config->Base, EGL_ALPHA_SIZE, m->alphaBits);
SET_CONFIG_ATTRIB(&config->Base, EGL_DEPTH_SIZE, m->depthBits);
SET_CONFIG_ATTRIB(&config->Base, EGL_STENCIL_SIZE, m->stencilBits);
SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLES, m->samples);
SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLE_BUFFERS, m->sampleBuffers);
SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, m->visualID);
SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_TYPE, m->visualType);
SET_CONFIG_ATTRIB(&config->Base, EGL_CONFORMANT, all_apis);
SET_CONFIG_ATTRIB(&config->Base, EGL_RENDERABLE_TYPE, all_apis);
/* XXX only window rendering allowed ATM */
SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
@ -654,7 +662,9 @@ xdri_eglTerminate(_EGLDriver *drv, EGLDisplay dpy)
_eglLog(_EGL_DEBUG, "XDRI: eglTerminate");
_eglLog(_EGL_DEBUG, "XDRI: Closing %s", xdri_drv->dri_driver_name);
#if 0
dlclose(xdri_drv->dri_driver_handle);
#endif
xdri_drv->dri_driver_handle = NULL;
free((void*) xdri_drv->dri_driver_name);
@ -748,15 +758,16 @@ xdri_eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d,
struct xdri_egl_context *xdri_ctx = lookup_context(context);
struct xdri_egl_surface *xdri_draw = lookup_surface(d);
struct xdri_egl_surface *xdri_read = lookup_surface(r);
__DRIid draw = xdri_draw->driDrawable;
__DRIid read = xdri_read->driDrawable;
__DRIid draw = xdri_draw ? xdri_draw->driDrawable : 0;
__DRIid read = xdri_read ? xdri_read->driDrawable : 0;
int scrn = DefaultScreen(disp->Xdpy);
if (!_eglMakeCurrent(drv, dpy, d, r, context))
return EGL_FALSE;
if (!xdri_ctx->driContext.bindContext(disp->Xdpy, scrn, draw, read,
if (xdri_ctx &&
!xdri_ctx->driContext.bindContext(disp->Xdpy, scrn, draw, read,
&xdri_ctx->driContext)) {
return EGL_FALSE;
}

View File

@ -109,7 +109,7 @@ static const uint8_t random_pattern[32] = {
static INLINE void
fill_random_pattern(uint8_t *dst, size_t size)
{
unsigned i = 0;
size_t i = 0;
while(size--) {
*dst++ = random_pattern[i++];
i &= sizeof(random_pattern) - 1;
@ -118,15 +118,21 @@ fill_random_pattern(uint8_t *dst, size_t size)
static INLINE boolean
check_random_pattern(const uint8_t *dst, size_t size)
check_random_pattern(const uint8_t *dst, size_t size,
size_t *min_ofs, size_t *max_ofs)
{
unsigned i = 0;
while(size--) {
if(*dst++ != random_pattern[i++])
return FALSE;
i &= sizeof(random_pattern) - 1;
boolean result = TRUE;
size_t i;
*min_ofs = size;
*max_ofs = 0;
for(i = 0; i < size; ++i) {
if(*dst++ != random_pattern[i % sizeof(random_pattern)]) {
*min_ofs = MIN2(*min_ofs, i);
*max_ofs = MIN2(*max_ofs, i);
result = FALSE;
}
}
return TRUE;
return result;
}
@ -141,15 +147,28 @@ pb_debug_buffer_destroy(struct pb_buffer *_buf)
map = pb_map(buf->buffer, PIPE_BUFFER_USAGE_CPU_READ);
assert(map);
if(map) {
if(!check_random_pattern(map, buf->underflow_size)) {
debug_error("buffer underflow detected\n");
debug_assert(0);
boolean underflow, overflow;
size_t min_ofs, max_ofs;
underflow = !check_random_pattern(map, buf->underflow_size,
&min_ofs, &max_ofs);
if(underflow) {
debug_printf("buffer underflow (%u of %u bytes) detected\n",
buf->underflow_size - min_ofs,
buf->underflow_size);
}
if(!check_random_pattern(map + buf->underflow_size + buf->base.base.size,
buf->overflow_size)) {
debug_error("buffer overflow detected\n");
debug_assert(0);
overflow = !check_random_pattern(map + buf->underflow_size + buf->base.base.size,
buf->overflow_size,
&min_ofs, &max_ofs);
if(overflow) {
debug_printf("buffer overflow (%u of %u bytes) detected\n",
max_ofs,
buf->overflow_size);
}
debug_assert(!underflow && !overflow);
pb_unmap(buf->buffer);
}

View File

@ -6,6 +6,7 @@ LIBNAME = tgsi
C_SOURCES = \
exec/tgsi_exec.c \
exec/tgsi_sse2.c \
util/tgsi_iterate.c \
util/tgsi_build.c \
util/tgsi_dump.c \
util/tgsi_parse.c \

View File

@ -7,7 +7,10 @@ tgsi = env.ConvenienceLibrary(
'exec/tgsi_sse2.c',
'util/tgsi_build.c',
'util/tgsi_dump.c',
'util/tgsi_dump_c.c',
'util/tgsi_iterate.c',
'util/tgsi_parse.c',
'util/tgsi_sanity.c',
'util/tgsi_scan.c',
'util/tgsi_text.c',
'util/tgsi_transform.c',

View File

@ -2400,7 +2400,8 @@ exec_instruction(
/* Restore ContMask, but don't pop */
assert(mach->ContStackTop > 0);
mach->ContMask = mach->ContStack[mach->ContStackTop - 1];
if (mach->LoopMask) {
UPDATE_EXEC_MASK(mach);
if (mach->ExecMask) {
/* repeat loop: jump to instruction just past BGNLOOP */
*pc = inst->InstructionExtLabel.Label + 1;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/**************************************************************************
*
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
* Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@ -28,18 +28,16 @@
#ifndef TGSI_DUMP_H
#define TGSI_DUMP_H
#include "pipe/p_shader_tokens.h"
#if defined __cplusplus
extern "C" {
#endif
#define TGSI_DUMP_VERBOSE 1
#define TGSI_DUMP_NO_IGNORED 2
#define TGSI_DUMP_NO_DEFAULT 4
void
tgsi_dump(
const struct tgsi_token *tokens,
unsigned flags );
uint flags );
struct tgsi_full_immediate;
struct tgsi_full_instruction;
@ -51,12 +49,12 @@ tgsi_dump_immediate(
void
tgsi_dump_instruction(
const struct tgsi_full_instruction *inst,
unsigned instno );
const struct tgsi_full_instruction *inst,
uint instno );
void
tgsi_dump_declaration(
const struct tgsi_full_declaration *decl );
const struct tgsi_full_declaration *decl );
#if defined __cplusplus
}

View File

@ -0,0 +1,845 @@
/**************************************************************************
*
* Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
*
**************************************************************************/
#include "pipe/p_debug.h"
#include "pipe/p_util.h"
#include "util/u_string.h"
#include "tgsi_dump_c.h"
#include "tgsi_parse.h"
#include "tgsi_build.h"
static void
dump_enum(
const unsigned e,
const char **enums,
const unsigned enums_count )
{
if (e >= enums_count) {
debug_printf( "%u", e );
}
else {
debug_printf( "%s", enums[e] );
}
}
#define EOL() debug_printf( "\n" )
#define TXT(S) debug_printf( "%s", S )
#define CHR(C) debug_printf( "%c", C )
#define UIX(I) debug_printf( "0x%x", I )
#define UID(I) debug_printf( "%u", I )
#define SID(I) debug_printf( "%d", I )
#define FLT(F) debug_printf( "%10.4f", F )
#define ENM(E,ENUMS) dump_enum( E, ENUMS, sizeof( ENUMS ) / sizeof( *ENUMS ) )
static const char *TGSI_PROCESSOR_TYPES[] =
{
"PROCESSOR_FRAGMENT",
"PROCESSOR_VERTEX",
"PROCESSOR_GEOMETRY"
};
static const char *TGSI_TOKEN_TYPES[] =
{
"TOKEN_TYPE_DECLARATION",
"TOKEN_TYPE_IMMEDIATE",
"TOKEN_TYPE_INSTRUCTION"
};
static const char *TGSI_FILES[] =
{
"FILE_NULL",
"FILE_CONSTANT",
"FILE_INPUT",
"FILE_OUTPUT",
"FILE_TEMPORARY",
"FILE_SAMPLER",
"FILE_ADDRESS",
"FILE_IMMEDIATE"
};
static const char *TGSI_INTERPOLATES[] =
{
"INTERPOLATE_CONSTANT",
"INTERPOLATE_LINEAR",
"INTERPOLATE_PERSPECTIVE"
};
static const char *TGSI_SEMANTICS[] =
{
"SEMANTIC_POSITION",
"SEMANTIC_COLOR",
"SEMANTIC_BCOLOR",
"SEMANTIC_FOG",
"SEMANTIC_PSIZE",
"SEMANTIC_GENERIC",
"SEMANTIC_NORMAL"
};
static const char *TGSI_IMMS[] =
{
"IMM_FLOAT32"
};
static const char *TGSI_OPCODES[TGSI_OPCODE_LAST] =
{
"OPCODE_ARL",
"OPCODE_MOV",
"OPCODE_LIT",
"OPCODE_RCP",
"OPCODE_RSQ",
"OPCODE_EXP",
"OPCODE_LOG",
"OPCODE_MUL",
"OPCODE_ADD",
"OPCODE_DP3",
"OPCODE_DP4",
"OPCODE_DST",
"OPCODE_MIN",
"OPCODE_MAX",
"OPCODE_SLT",
"OPCODE_SGE",
"OPCODE_MAD",
"OPCODE_SUB",
"OPCODE_LERP",
"OPCODE_CND",
"OPCODE_CND0",
"OPCODE_DOT2ADD",
"OPCODE_INDEX",
"OPCODE_NEGATE",
"OPCODE_FRAC",
"OPCODE_CLAMP",
"OPCODE_FLOOR",
"OPCODE_ROUND",
"OPCODE_EXPBASE2",
"OPCODE_LOGBASE2",
"OPCODE_POWER",
"OPCODE_CROSSPRODUCT",
"OPCODE_MULTIPLYMATRIX",
"OPCODE_ABS",
"OPCODE_RCC",
"OPCODE_DPH",
"OPCODE_COS",
"OPCODE_DDX",
"OPCODE_DDY",
"OPCODE_KILP",
"OPCODE_PK2H",
"OPCODE_PK2US",
"OPCODE_PK4B",
"OPCODE_PK4UB",
"OPCODE_RFL",
"OPCODE_SEQ",
"OPCODE_SFL",
"OPCODE_SGT",
"OPCODE_SIN",
"OPCODE_SLE",
"OPCODE_SNE",
"OPCODE_STR",
"OPCODE_TEX",
"OPCODE_TXD",
"OPCODE_TXP",
"OPCODE_UP2H",
"OPCODE_UP2US",
"OPCODE_UP4B",
"OPCODE_UP4UB",
"OPCODE_X2D",
"OPCODE_ARA",
"OPCODE_ARR",
"OPCODE_BRA",
"OPCODE_CAL",
"OPCODE_RET",
"OPCODE_SSG",
"OPCODE_CMP",
"OPCODE_SCS",
"OPCODE_TXB",
"OPCODE_NRM",
"OPCODE_DIV",
"OPCODE_DP2",
"OPCODE_TXL",
"OPCODE_BRK",
"OPCODE_IF",
"OPCODE_LOOP",
"OPCODE_REP",
"OPCODE_ELSE",
"OPCODE_ENDIF",
"OPCODE_ENDLOOP",
"OPCODE_ENDREP",
"OPCODE_PUSHA",
"OPCODE_POPA",
"OPCODE_CEIL",
"OPCODE_I2F",
"OPCODE_NOT",
"OPCODE_TRUNC",
"OPCODE_SHL",
"OPCODE_SHR",
"OPCODE_AND",
"OPCODE_OR",
"OPCODE_MOD",
"OPCODE_XOR",
"OPCODE_SAD",
"OPCODE_TXF",
"OPCODE_TXQ",
"OPCODE_CONT",
"OPCODE_EMIT",
"OPCODE_ENDPRIM",
"OPCODE_BGNLOOP2",
"OPCODE_BGNSUB",
"OPCODE_ENDLOOP2",
"OPCODE_ENDSUB",
"OPCODE_NOISE1",
"OPCODE_NOISE2",
"OPCODE_NOISE3",
"OPCODE_NOISE4",
"OPCODE_NOP",
"OPCODE_M4X3",
"OPCODE_M3X4",
"OPCODE_M3X3",
"OPCODE_M3X2",
"OPCODE_NRM4",
"OPCODE_CALLNZ",
"OPCODE_IFC",
"OPCODE_BREAKC",
"OPCODE_KIL",
"OPCODE_END"
};
static const char *TGSI_SATS[] =
{
"SAT_NONE",
"SAT_ZERO_ONE",
"SAT_MINUS_PLUS_ONE"
};
static const char *TGSI_INSTRUCTION_EXTS[] =
{
"INSTRUCTION_EXT_TYPE_NV",
"INSTRUCTION_EXT_TYPE_LABEL",
"INSTRUCTION_EXT_TYPE_TEXTURE"
};
static const char *TGSI_PRECISIONS[] =
{
"PRECISION_DEFAULT",
"PRECISION_FLOAT32",
"PRECISION_FLOAT16",
"PRECISION_FIXED12"
};
static const char *TGSI_CCS[] =
{
"CC_GT",
"CC_EQ",
"CC_LT",
"CC_UN",
"CC_GE",
"CC_LE",
"CC_NE",
"CC_TR",
"CC_FL"
};
static const char *TGSI_SWIZZLES[] =
{
"SWIZZLE_X",
"SWIZZLE_Y",
"SWIZZLE_Z",
"SWIZZLE_W"
};
static const char *TGSI_TEXTURES[] =
{
"TEXTURE_UNKNOWN",
"TEXTURE_1D",
"TEXTURE_2D",
"TEXTURE_3D",
"TEXTURE_CUBE",
"TEXTURE_RECT",
"TEXTURE_SHADOW1D",
"TEXTURE_SHADOW2D",
"TEXTURE_SHADOWRECT"
};
static const char *TGSI_SRC_REGISTER_EXTS[] =
{
"SRC_REGISTER_EXT_TYPE_SWZ",
"SRC_REGISTER_EXT_TYPE_MOD"
};
static const char *TGSI_EXTSWIZZLES[] =
{
"EXTSWIZZLE_X",
"EXTSWIZZLE_Y",
"EXTSWIZZLE_Z",
"EXTSWIZZLE_W",
"EXTSWIZZLE_ZERO",
"EXTSWIZZLE_ONE"
};
static const char *TGSI_WRITEMASKS[] =
{
"0",
"WRITEMASK_X",
"WRITEMASK_Y",
"WRITEMASK_XY",
"WRITEMASK_Z",
"WRITEMASK_XZ",
"WRITEMASK_YZ",
"WRITEMASK_XYZ",
"WRITEMASK_W",
"WRITEMASK_XW",
"WRITEMASK_YW",
"WRITEMASK_XYW",
"WRITEMASK_ZW",
"WRITEMASK_XZW",
"WRITEMASK_YZW",
"WRITEMASK_XYZW"
};
static const char *TGSI_DST_REGISTER_EXTS[] =
{
"DST_REGISTER_EXT_TYPE_CONDCODE",
"DST_REGISTER_EXT_TYPE_MODULATE"
};
static const char *TGSI_MODULATES[] =
{
"MODULATE_1X",
"MODULATE_2X",
"MODULATE_4X",
"MODULATE_8X",
"MODULATE_HALF",
"MODULATE_QUARTER",
"MODULATE_EIGHTH"
};
static void
dump_declaration_verbose(
struct tgsi_full_declaration *decl,
unsigned ignored,
unsigned deflt,
struct tgsi_full_declaration *fd )
{
TXT( "\nFile : " );
ENM( decl->Declaration.File, TGSI_FILES );
if( deflt || fd->Declaration.UsageMask != decl->Declaration.UsageMask ) {
TXT( "\nUsageMask : " );
if( decl->Declaration.UsageMask & TGSI_WRITEMASK_X ) {
CHR( 'X' );
}
if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Y ) {
CHR( 'Y' );
}
if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Z ) {
CHR( 'Z' );
}
if( decl->Declaration.UsageMask & TGSI_WRITEMASK_W ) {
CHR( 'W' );
}
}
if( deflt || fd->Declaration.Interpolate != decl->Declaration.Interpolate ) {
TXT( "\nInterpolate: " );
ENM( decl->Declaration.Interpolate, TGSI_INTERPOLATES );
}
if( deflt || fd->Declaration.Semantic != decl->Declaration.Semantic ) {
TXT( "\nSemantic : " );
UID( decl->Declaration.Semantic );
}
if( ignored ) {
TXT( "\nPadding : " );
UIX( decl->Declaration.Padding );
}
EOL();
TXT( "\nFirst: " );
UID( decl->DeclarationRange.First );
TXT( "\nLast : " );
UID( decl->DeclarationRange.Last );
if( decl->Declaration.Semantic ) {
EOL();
TXT( "\nSemanticName : " );
ENM( decl->Semantic.SemanticName, TGSI_SEMANTICS );
TXT( "\nSemanticIndex: " );
UID( decl->Semantic.SemanticIndex );
if( ignored ) {
TXT( "\nPadding : " );
UIX( decl->Semantic.Padding );
}
}
}
static void
dump_immediate_verbose(
struct tgsi_full_immediate *imm,
unsigned ignored )
{
unsigned i;
TXT( "\nDataType : " );
ENM( imm->Immediate.DataType, TGSI_IMMS );
if( ignored ) {
TXT( "\nPadding : " );
UIX( imm->Immediate.Padding );
}
for( i = 0; i < imm->Immediate.Size - 1; i++ ) {
EOL();
switch( imm->Immediate.DataType ) {
case TGSI_IMM_FLOAT32:
TXT( "\nFloat: " );
FLT( imm->u.ImmediateFloat32[i].Float );
break;
default:
assert( 0 );
}
}
}
static void
dump_instruction_verbose(
struct tgsi_full_instruction *inst,
unsigned ignored,
unsigned deflt,
struct tgsi_full_instruction *fi )
{
unsigned i;
TXT( "\nOpcode : " );
ENM( inst->Instruction.Opcode, TGSI_OPCODES );
if( deflt || fi->Instruction.Saturate != inst->Instruction.Saturate ) {
TXT( "\nSaturate : " );
ENM( inst->Instruction.Saturate, TGSI_SATS );
}
if( deflt || fi->Instruction.NumDstRegs != inst->Instruction.NumDstRegs ) {
TXT( "\nNumDstRegs : " );
UID( inst->Instruction.NumDstRegs );
}
if( deflt || fi->Instruction.NumSrcRegs != inst->Instruction.NumSrcRegs ) {
TXT( "\nNumSrcRegs : " );
UID( inst->Instruction.NumSrcRegs );
}
if( ignored ) {
TXT( "\nPadding : " );
UIX( inst->Instruction.Padding );
}
if( deflt || tgsi_compare_instruction_ext_nv( inst->InstructionExtNv, fi->InstructionExtNv ) ) {
EOL();
TXT( "\nType : " );
ENM( inst->InstructionExtNv.Type, TGSI_INSTRUCTION_EXTS );
if( deflt || fi->InstructionExtNv.Precision != inst->InstructionExtNv.Precision ) {
TXT( "\nPrecision : " );
ENM( inst->InstructionExtNv.Precision, TGSI_PRECISIONS );
}
if( deflt || fi->InstructionExtNv.CondDstIndex != inst->InstructionExtNv.CondDstIndex ) {
TXT( "\nCondDstIndex : " );
UID( inst->InstructionExtNv.CondDstIndex );
}
if( deflt || fi->InstructionExtNv.CondFlowIndex != inst->InstructionExtNv.CondFlowIndex ) {
TXT( "\nCondFlowIndex : " );
UID( inst->InstructionExtNv.CondFlowIndex );
}
if( deflt || fi->InstructionExtNv.CondMask != inst->InstructionExtNv.CondMask ) {
TXT( "\nCondMask : " );
ENM( inst->InstructionExtNv.CondMask, TGSI_CCS );
}
if( deflt || fi->InstructionExtNv.CondSwizzleX != inst->InstructionExtNv.CondSwizzleX ) {
TXT( "\nCondSwizzleX : " );
ENM( inst->InstructionExtNv.CondSwizzleX, TGSI_SWIZZLES );
}
if( deflt || fi->InstructionExtNv.CondSwizzleY != inst->InstructionExtNv.CondSwizzleY ) {
TXT( "\nCondSwizzleY : " );
ENM( inst->InstructionExtNv.CondSwizzleY, TGSI_SWIZZLES );
}
if( deflt || fi->InstructionExtNv.CondSwizzleZ != inst->InstructionExtNv.CondSwizzleZ ) {
TXT( "\nCondSwizzleZ : " );
ENM( inst->InstructionExtNv.CondSwizzleZ, TGSI_SWIZZLES );
}
if( deflt || fi->InstructionExtNv.CondSwizzleW != inst->InstructionExtNv.CondSwizzleW ) {
TXT( "\nCondSwizzleW : " );
ENM( inst->InstructionExtNv.CondSwizzleW, TGSI_SWIZZLES );
}
if( deflt || fi->InstructionExtNv.CondDstUpdate != inst->InstructionExtNv.CondDstUpdate ) {
TXT( "\nCondDstUpdate : " );
UID( inst->InstructionExtNv.CondDstUpdate );
}
if( deflt || fi->InstructionExtNv.CondFlowEnable != inst->InstructionExtNv.CondFlowEnable ) {
TXT( "\nCondFlowEnable: " );
UID( inst->InstructionExtNv.CondFlowEnable );
}
if( ignored ) {
TXT( "\nPadding : " );
UIX( inst->InstructionExtNv.Padding );
if( deflt || fi->InstructionExtNv.Extended != inst->InstructionExtNv.Extended ) {
TXT( "\nExtended : " );
UID( inst->InstructionExtNv.Extended );
}
}
}
if( deflt || tgsi_compare_instruction_ext_label( inst->InstructionExtLabel, fi->InstructionExtLabel ) ) {
EOL();
TXT( "\nType : " );
ENM( inst->InstructionExtLabel.Type, TGSI_INSTRUCTION_EXTS );
if( deflt || fi->InstructionExtLabel.Label != inst->InstructionExtLabel.Label ) {
TXT( "\nLabel : " );
UID( inst->InstructionExtLabel.Label );
}
if( ignored ) {
TXT( "\nPadding : " );
UIX( inst->InstructionExtLabel.Padding );
if( deflt || fi->InstructionExtLabel.Extended != inst->InstructionExtLabel.Extended ) {
TXT( "\nExtended: " );
UID( inst->InstructionExtLabel.Extended );
}
}
}
if( deflt || tgsi_compare_instruction_ext_texture( inst->InstructionExtTexture, fi->InstructionExtTexture ) ) {
EOL();
TXT( "\nType : " );
ENM( inst->InstructionExtTexture.Type, TGSI_INSTRUCTION_EXTS );
if( deflt || fi->InstructionExtTexture.Texture != inst->InstructionExtTexture.Texture ) {
TXT( "\nTexture : " );
ENM( inst->InstructionExtTexture.Texture, TGSI_TEXTURES );
}
if( ignored ) {
TXT( "\nPadding : " );
UIX( inst->InstructionExtTexture.Padding );
if( deflt || fi->InstructionExtTexture.Extended != inst->InstructionExtTexture.Extended ) {
TXT( "\nExtended: " );
UID( inst->InstructionExtTexture.Extended );
}
}
}
for( i = 0; i < inst->Instruction.NumDstRegs; i++ ) {
struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i];
struct tgsi_full_dst_register *fd = &fi->FullDstRegisters[i];
EOL();
TXT( "\nFile : " );
ENM( dst->DstRegister.File, TGSI_FILES );
if( deflt || fd->DstRegister.WriteMask != dst->DstRegister.WriteMask ) {
TXT( "\nWriteMask: " );
ENM( dst->DstRegister.WriteMask, TGSI_WRITEMASKS );
}
if( ignored ) {
if( deflt || fd->DstRegister.Indirect != dst->DstRegister.Indirect ) {
TXT( "\nIndirect : " );
UID( dst->DstRegister.Indirect );
}
if( deflt || fd->DstRegister.Dimension != dst->DstRegister.Dimension ) {
TXT( "\nDimension: " );
UID( dst->DstRegister.Dimension );
}
}
if( deflt || fd->DstRegister.Index != dst->DstRegister.Index ) {
TXT( "\nIndex : " );
SID( dst->DstRegister.Index );
}
if( ignored ) {
TXT( "\nPadding : " );
UIX( dst->DstRegister.Padding );
if( deflt || fd->DstRegister.Extended != dst->DstRegister.Extended ) {
TXT( "\nExtended : " );
UID( dst->DstRegister.Extended );
}
}
if( deflt || tgsi_compare_dst_register_ext_concode( dst->DstRegisterExtConcode, fd->DstRegisterExtConcode ) ) {
EOL();
TXT( "\nType : " );
ENM( dst->DstRegisterExtConcode.Type, TGSI_DST_REGISTER_EXTS );
if( deflt || fd->DstRegisterExtConcode.CondMask != dst->DstRegisterExtConcode.CondMask ) {
TXT( "\nCondMask : " );
ENM( dst->DstRegisterExtConcode.CondMask, TGSI_CCS );
}
if( deflt || fd->DstRegisterExtConcode.CondSwizzleX != dst->DstRegisterExtConcode.CondSwizzleX ) {
TXT( "\nCondSwizzleX: " );
ENM( dst->DstRegisterExtConcode.CondSwizzleX, TGSI_SWIZZLES );
}
if( deflt || fd->DstRegisterExtConcode.CondSwizzleY != dst->DstRegisterExtConcode.CondSwizzleY ) {
TXT( "\nCondSwizzleY: " );
ENM( dst->DstRegisterExtConcode.CondSwizzleY, TGSI_SWIZZLES );
}
if( deflt || fd->DstRegisterExtConcode.CondSwizzleZ != dst->DstRegisterExtConcode.CondSwizzleZ ) {
TXT( "\nCondSwizzleZ: " );
ENM( dst->DstRegisterExtConcode.CondSwizzleZ, TGSI_SWIZZLES );
}
if( deflt || fd->DstRegisterExtConcode.CondSwizzleW != dst->DstRegisterExtConcode.CondSwizzleW ) {
TXT( "\nCondSwizzleW: " );
ENM( dst->DstRegisterExtConcode.CondSwizzleW, TGSI_SWIZZLES );
}
if( deflt || fd->DstRegisterExtConcode.CondSrcIndex != dst->DstRegisterExtConcode.CondSrcIndex ) {
TXT( "\nCondSrcIndex: " );
UID( dst->DstRegisterExtConcode.CondSrcIndex );
}
if( ignored ) {
TXT( "\nPadding : " );
UIX( dst->DstRegisterExtConcode.Padding );
if( deflt || fd->DstRegisterExtConcode.Extended != dst->DstRegisterExtConcode.Extended ) {
TXT( "\nExtended : " );
UID( dst->DstRegisterExtConcode.Extended );
}
}
}
if( deflt || tgsi_compare_dst_register_ext_modulate( dst->DstRegisterExtModulate, fd->DstRegisterExtModulate ) ) {
EOL();
TXT( "\nType : " );
ENM( dst->DstRegisterExtModulate.Type, TGSI_DST_REGISTER_EXTS );
if( deflt || fd->DstRegisterExtModulate.Modulate != dst->DstRegisterExtModulate.Modulate ) {
TXT( "\nModulate: " );
ENM( dst->DstRegisterExtModulate.Modulate, TGSI_MODULATES );
}
if( ignored ) {
TXT( "\nPadding : " );
UIX( dst->DstRegisterExtModulate.Padding );
if( deflt || fd->DstRegisterExtModulate.Extended != dst->DstRegisterExtModulate.Extended ) {
TXT( "\nExtended: " );
UID( dst->DstRegisterExtModulate.Extended );
}
}
}
}
for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) {
struct tgsi_full_src_register *src = &inst->FullSrcRegisters[i];
struct tgsi_full_src_register *fs = &fi->FullSrcRegisters[i];
EOL();
TXT( "\nFile : ");
ENM( src->SrcRegister.File, TGSI_FILES );
if( deflt || fs->SrcRegister.SwizzleX != src->SrcRegister.SwizzleX ) {
TXT( "\nSwizzleX : " );
ENM( src->SrcRegister.SwizzleX, TGSI_SWIZZLES );
}
if( deflt || fs->SrcRegister.SwizzleY != src->SrcRegister.SwizzleY ) {
TXT( "\nSwizzleY : " );
ENM( src->SrcRegister.SwizzleY, TGSI_SWIZZLES );
}
if( deflt || fs->SrcRegister.SwizzleZ != src->SrcRegister.SwizzleZ ) {
TXT( "\nSwizzleZ : " );
ENM( src->SrcRegister.SwizzleZ, TGSI_SWIZZLES );
}
if( deflt || fs->SrcRegister.SwizzleW != src->SrcRegister.SwizzleW ) {
TXT( "\nSwizzleW : " );
ENM( src->SrcRegister.SwizzleW, TGSI_SWIZZLES );
}
if( deflt || fs->SrcRegister.Negate != src->SrcRegister.Negate ) {
TXT( "\nNegate : " );
UID( src->SrcRegister.Negate );
}
if( ignored ) {
if( deflt || fs->SrcRegister.Indirect != src->SrcRegister.Indirect ) {
TXT( "\nIndirect : " );
UID( src->SrcRegister.Indirect );
}
if( deflt || fs->SrcRegister.Dimension != src->SrcRegister.Dimension ) {
TXT( "\nDimension: " );
UID( src->SrcRegister.Dimension );
}
}
if( deflt || fs->SrcRegister.Index != src->SrcRegister.Index ) {
TXT( "\nIndex : " );
SID( src->SrcRegister.Index );
}
if( ignored ) {
if( deflt || fs->SrcRegister.Extended != src->SrcRegister.Extended ) {
TXT( "\nExtended : " );
UID( src->SrcRegister.Extended );
}
}
if( deflt || tgsi_compare_src_register_ext_swz( src->SrcRegisterExtSwz, fs->SrcRegisterExtSwz ) ) {
EOL();
TXT( "\nType : " );
ENM( src->SrcRegisterExtSwz.Type, TGSI_SRC_REGISTER_EXTS );
if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleX != src->SrcRegisterExtSwz.ExtSwizzleX ) {
TXT( "\nExtSwizzleX: " );
ENM( src->SrcRegisterExtSwz.ExtSwizzleX, TGSI_EXTSWIZZLES );
}
if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleY != src->SrcRegisterExtSwz.ExtSwizzleY ) {
TXT( "\nExtSwizzleY: " );
ENM( src->SrcRegisterExtSwz.ExtSwizzleY, TGSI_EXTSWIZZLES );
}
if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleZ != src->SrcRegisterExtSwz.ExtSwizzleZ ) {
TXT( "\nExtSwizzleZ: " );
ENM( src->SrcRegisterExtSwz.ExtSwizzleZ, TGSI_EXTSWIZZLES );
}
if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleW != src->SrcRegisterExtSwz.ExtSwizzleW ) {
TXT( "\nExtSwizzleW: " );
ENM( src->SrcRegisterExtSwz.ExtSwizzleW, TGSI_EXTSWIZZLES );
}
if( deflt || fs->SrcRegisterExtSwz.NegateX != src->SrcRegisterExtSwz.NegateX ) {
TXT( "\nNegateX : " );
UID( src->SrcRegisterExtSwz.NegateX );
}
if( deflt || fs->SrcRegisterExtSwz.NegateY != src->SrcRegisterExtSwz.NegateY ) {
TXT( "\nNegateY : " );
UID( src->SrcRegisterExtSwz.NegateY );
}
if( deflt || fs->SrcRegisterExtSwz.NegateZ != src->SrcRegisterExtSwz.NegateZ ) {
TXT( "\nNegateZ : " );
UID( src->SrcRegisterExtSwz.NegateZ );
}
if( deflt || fs->SrcRegisterExtSwz.NegateW != src->SrcRegisterExtSwz.NegateW ) {
TXT( "\nNegateW : " );
UID( src->SrcRegisterExtSwz.NegateW );
}
if( ignored ) {
TXT( "\nPadding : " );
UIX( src->SrcRegisterExtSwz.Padding );
if( deflt || fs->SrcRegisterExtSwz.Extended != src->SrcRegisterExtSwz.Extended ) {
TXT( "\nExtended : " );
UID( src->SrcRegisterExtSwz.Extended );
}
}
}
if( deflt || tgsi_compare_src_register_ext_mod( src->SrcRegisterExtMod, fs->SrcRegisterExtMod ) ) {
EOL();
TXT( "\nType : " );
ENM( src->SrcRegisterExtMod.Type, TGSI_SRC_REGISTER_EXTS );
if( deflt || fs->SrcRegisterExtMod.Complement != src->SrcRegisterExtMod.Complement ) {
TXT( "\nComplement: " );
UID( src->SrcRegisterExtMod.Complement );
}
if( deflt || fs->SrcRegisterExtMod.Bias != src->SrcRegisterExtMod.Bias ) {
TXT( "\nBias : " );
UID( src->SrcRegisterExtMod.Bias );
}
if( deflt || fs->SrcRegisterExtMod.Scale2X != src->SrcRegisterExtMod.Scale2X ) {
TXT( "\nScale2X : " );
UID( src->SrcRegisterExtMod.Scale2X );
}
if( deflt || fs->SrcRegisterExtMod.Absolute != src->SrcRegisterExtMod.Absolute ) {
TXT( "\nAbsolute : " );
UID( src->SrcRegisterExtMod.Absolute );
}
if( deflt || fs->SrcRegisterExtMod.Negate != src->SrcRegisterExtMod.Negate ) {
TXT( "\nNegate : " );
UID( src->SrcRegisterExtMod.Negate );
}
if( ignored ) {
TXT( "\nPadding : " );
UIX( src->SrcRegisterExtMod.Padding );
if( deflt || fs->SrcRegisterExtMod.Extended != src->SrcRegisterExtMod.Extended ) {
TXT( "\nExtended : " );
UID( src->SrcRegisterExtMod.Extended );
}
}
}
}
}
void
tgsi_dump_c(
const struct tgsi_token *tokens,
uint flags )
{
struct tgsi_parse_context parse;
struct tgsi_full_instruction fi;
struct tgsi_full_declaration fd;
uint ignored = flags & TGSI_DUMP_C_IGNORED;
uint deflt = flags & TGSI_DUMP_C_DEFAULT;
uint instno = 0;
/* sanity checks */
assert(strcmp(TGSI_OPCODES[TGSI_OPCODE_CONT], "OPCODE_CONT") == 0);
assert(strcmp(TGSI_OPCODES[TGSI_OPCODE_END], "OPCODE_END") == 0);
tgsi_parse_init( &parse, tokens );
TXT( "tgsi-dump begin -----------------" );
TXT( "\nMajorVersion: " );
UID( parse.FullVersion.Version.MajorVersion );
TXT( "\nMinorVersion: " );
UID( parse.FullVersion.Version.MinorVersion );
EOL();
TXT( "\nHeaderSize: " );
UID( parse.FullHeader.Header.HeaderSize );
TXT( "\nBodySize : " );
UID( parse.FullHeader.Header.BodySize );
TXT( "\nProcessor : " );
ENM( parse.FullHeader.Processor.Processor, TGSI_PROCESSOR_TYPES );
EOL();
fi = tgsi_default_full_instruction();
fd = tgsi_default_full_declaration();
while( !tgsi_parse_end_of_tokens( &parse ) ) {
tgsi_parse_token( &parse );
TXT( "\nType : " );
ENM( parse.FullToken.Token.Type, TGSI_TOKEN_TYPES );
if( ignored ) {
TXT( "\nSize : " );
UID( parse.FullToken.Token.Size );
if( deflt || parse.FullToken.Token.Extended ) {
TXT( "\nExtended : " );
UID( parse.FullToken.Token.Extended );
}
}
switch( parse.FullToken.Token.Type ) {
case TGSI_TOKEN_TYPE_DECLARATION:
dump_declaration_verbose(
&parse.FullToken.FullDeclaration,
ignored,
deflt,
&fd );
break;
case TGSI_TOKEN_TYPE_IMMEDIATE:
dump_immediate_verbose(
&parse.FullToken.FullImmediate,
ignored );
break;
case TGSI_TOKEN_TYPE_INSTRUCTION:
dump_instruction_verbose(
&parse.FullToken.FullInstruction,
ignored,
deflt,
&fi );
break;
default:
assert( 0 );
}
EOL();
}
TXT( "\ntgsi-dump end -------------------\n" );
tgsi_parse_free( &parse );
}

View File

@ -0,0 +1,49 @@
/**************************************************************************
*
* Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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 TGSI_DUMP_C_H
#define TGSI_DUMP_C_H
#include "pipe/p_shader_tokens.h"
#if defined __cplusplus
extern "C" {
#endif
#define TGSI_DUMP_C_IGNORED 1
#define TGSI_DUMP_C_DEFAULT 2
void
tgsi_dump_c(
const struct tgsi_token *tokens,
uint flags );
#if defined __cplusplus
}
#endif
#endif /* TGSI_DUMP_C_H */

View File

@ -0,0 +1,85 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
*
**************************************************************************/
#include "pipe/p_debug.h"
#include "tgsi_iterate.h"
boolean
tgsi_iterate_shader(
const struct tgsi_token *tokens,
struct tgsi_iterate_context *ctx )
{
struct tgsi_parse_context parse;
if (tgsi_parse_init( &parse, tokens ) != TGSI_PARSE_OK)
return FALSE;
ctx->processor = parse.FullHeader.Processor;
ctx->version = parse.FullVersion.Version;
if (ctx->prolog)
if (!ctx->prolog( ctx ))
goto fail;
while (!tgsi_parse_end_of_tokens( &parse )) {
tgsi_parse_token( &parse );
switch (parse.FullToken.Token.Type) {
case TGSI_TOKEN_TYPE_INSTRUCTION:
if (ctx->iterate_instruction)
if (!ctx->iterate_instruction( ctx, &parse.FullToken.FullInstruction ))
goto fail;
break;
case TGSI_TOKEN_TYPE_DECLARATION:
if (ctx->iterate_declaration)
if (!ctx->iterate_declaration( ctx, &parse.FullToken.FullDeclaration ))
goto fail;
break;
case TGSI_TOKEN_TYPE_IMMEDIATE:
if (ctx->iterate_immediate)
if (!ctx->iterate_immediate( ctx, &parse.FullToken.FullImmediate ))
goto fail;
break;
default:
assert( 0 );
}
}
if (ctx->epilog)
if (!ctx->epilog( ctx ))
goto fail;
tgsi_parse_free( &parse );
return TRUE;
fail:
tgsi_parse_free( &parse );
return FALSE;
}

View File

@ -0,0 +1,76 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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 TGSI_ITERATE_H
#define TGSI_ITERATE_H
#include "pipe/p_shader_tokens.h"
#include "tgsi/util/tgsi_parse.h"
#if defined __cplusplus
extern "C" {
#endif
struct tgsi_iterate_context
{
boolean
(* prolog)(
struct tgsi_iterate_context *ctx );
boolean
(* iterate_instruction)(
struct tgsi_iterate_context *ctx,
struct tgsi_full_instruction *inst );
boolean
(* iterate_declaration)(
struct tgsi_iterate_context *ctx,
struct tgsi_full_declaration *decl );
boolean
(* iterate_immediate)(
struct tgsi_iterate_context *ctx,
struct tgsi_full_immediate *imm );
boolean
(* epilog)(
struct tgsi_iterate_context *ctx );
struct tgsi_processor processor;
struct tgsi_version version;
};
boolean
tgsi_iterate_shader(
const struct tgsi_token *tokens,
struct tgsi_iterate_context *ctx );
#if defined __cplusplus
}
#endif
#endif /* TGSI_ITERATE_H */

View File

@ -0,0 +1,341 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
*
**************************************************************************/
#include "pipe/p_debug.h"
#include "tgsi_sanity.h"
#include "tgsi_iterate.h"
#define MAX_REGISTERS 256
typedef uint reg_flag;
#define BITS_IN_REG_FLAG (sizeof( reg_flag ) * 8)
struct sanity_check_ctx
{
struct tgsi_iterate_context iter;
reg_flag regs_decl[TGSI_FILE_COUNT][MAX_REGISTERS / BITS_IN_REG_FLAG];
reg_flag regs_used[TGSI_FILE_COUNT][MAX_REGISTERS / BITS_IN_REG_FLAG];
boolean regs_ind_used[TGSI_FILE_COUNT];
uint num_imms;
uint num_instructions;
uint index_of_END;
uint errors;
uint warnings;
};
static void
report_error(
struct sanity_check_ctx *ctx,
const char *format,
... )
{
va_list args;
debug_printf( "Error : " );
va_start( args, format );
_debug_vprintf( format, args );
va_end( args );
debug_printf( "\n" );
ctx->errors++;
}
static void
report_warning(
struct sanity_check_ctx *ctx,
const char *format,
... )
{
va_list args;
debug_printf( "Warning: " );
va_start( args, format );
_debug_vprintf( format, args );
va_end( args );
debug_printf( "\n" );
ctx->warnings++;
}
static boolean
check_file_name(
struct sanity_check_ctx *ctx,
uint file )
{
if (file <= TGSI_FILE_NULL || file >= TGSI_FILE_COUNT) {
report_error( ctx, "Invalid register file name" );
return FALSE;
}
return TRUE;
}
static boolean
is_register_declared(
struct sanity_check_ctx *ctx,
uint file,
int index )
{
assert( index >= 0 && index < MAX_REGISTERS );
return (ctx->regs_decl[file][index / BITS_IN_REG_FLAG] & (1 << (index % BITS_IN_REG_FLAG))) ? TRUE : FALSE;
}
static boolean
is_any_register_declared(
struct sanity_check_ctx *ctx,
uint file )
{
uint i;
for (i = 0; i < MAX_REGISTERS / BITS_IN_REG_FLAG; i++)
if (ctx->regs_decl[file][i])
return TRUE;
return FALSE;
}
static boolean
is_register_used(
struct sanity_check_ctx *ctx,
uint file,
int index )
{
assert( index < MAX_REGISTERS );
return (ctx->regs_used[file][index / BITS_IN_REG_FLAG] & (1 << (index % BITS_IN_REG_FLAG))) ? TRUE : FALSE;
}
static const char *file_names[] =
{
"NULL",
"CONST",
"IN",
"OUT",
"TEMP",
"SAMP",
"ADDR",
"IMM"
};
static boolean
check_register_usage(
struct sanity_check_ctx *ctx,
uint file,
int index,
const char *name,
boolean indirect_access )
{
if (!check_file_name( ctx, file ))
return FALSE;
if (indirect_access) {
if (!is_any_register_declared( ctx, file ))
report_error( ctx, "%s: Undeclared %s register", file_names[file], name );
ctx->regs_ind_used[file] = TRUE;
}
else {
if (!is_register_declared( ctx, file, index ))
report_error( ctx, "%s[%d]: Undeclared %s register", file_names[file], index, name );
ctx->regs_used[file][index / BITS_IN_REG_FLAG] |= (1 << (index % BITS_IN_REG_FLAG));
}
return TRUE;
}
static boolean
iter_instruction(
struct tgsi_iterate_context *iter,
struct tgsi_full_instruction *inst )
{
struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
uint i;
/* There must be no other instructions after END.
*/
if (ctx->index_of_END != ~0) {
report_error( ctx, "Unexpected instruction after END" );
}
else if (inst->Instruction.Opcode == TGSI_OPCODE_END) {
ctx->index_of_END = ctx->num_instructions;
}
/* Check destination and source registers' validity.
* Mark the registers as used.
*/
for (i = 0; i < inst->Instruction.NumDstRegs; i++) {
check_register_usage(
ctx,
inst->FullDstRegisters[i].DstRegister.File,
inst->FullDstRegisters[i].DstRegister.Index,
"destination",
FALSE );
}
for (i = 0; i < inst->Instruction.NumSrcRegs; i++) {
check_register_usage(
ctx,
inst->FullSrcRegisters[i].SrcRegister.File,
inst->FullSrcRegisters[i].SrcRegister.Index,
"source",
inst->FullSrcRegisters[i].SrcRegister.Indirect );
if (inst->FullSrcRegisters[i].SrcRegister.Indirect) {
uint file;
int index;
file = inst->FullSrcRegisters[i].SrcRegisterInd.File;
index = inst->FullSrcRegisters[i].SrcRegisterInd.Index;
check_register_usage(
ctx,
file,
index,
"indirect",
FALSE );
if (file != TGSI_FILE_ADDRESS || index != 0)
report_warning( ctx, "Indirect register not ADDR[0]" );
}
}
ctx->num_instructions++;
return TRUE;
}
static boolean
iter_declaration(
struct tgsi_iterate_context *iter,
struct tgsi_full_declaration *decl )
{
struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
uint file;
uint i;
/* No declarations allowed after the first instruction.
*/
if (ctx->num_instructions > 0)
report_error( ctx, "Instruction expected but declaration found" );
/* Check registers' validity.
* Mark the registers as declared.
*/
file = decl->Declaration.File;
if (!check_file_name( ctx, file ))
return TRUE;
for (i = decl->DeclarationRange.First; i <= decl->DeclarationRange.Last; i++) {
if (is_register_declared( ctx, file, i ))
report_error( ctx, "The same register declared twice" );
ctx->regs_decl[file][i / BITS_IN_REG_FLAG] |= (1 << (i % BITS_IN_REG_FLAG));
}
return TRUE;
}
static boolean
iter_immediate(
struct tgsi_iterate_context *iter,
struct tgsi_full_immediate *imm )
{
struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
assert( ctx->num_imms < MAX_REGISTERS );
/* No immediates allowed after the first instruction.
*/
if (ctx->num_instructions > 0)
report_error( ctx, "Instruction expected but immediate found" );
/* Mark the register as declared.
*/
ctx->regs_decl[TGSI_FILE_IMMEDIATE][ctx->num_imms / BITS_IN_REG_FLAG] |= (1 << (ctx->num_imms % BITS_IN_REG_FLAG));
ctx->num_imms++;
/* Check data type validity.
*/
if (imm->Immediate.DataType != TGSI_IMM_FLOAT32) {
report_error( ctx, "Invalid immediate data type" );
return TRUE;
}
return TRUE;
}
static boolean
epilog(
struct tgsi_iterate_context *iter )
{
struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
uint file;
/* There must be an END instruction at the end.
*/
if (ctx->index_of_END == ~0 || ctx->index_of_END != ctx->num_instructions - 1) {
report_error( ctx, "Expected END at end of instruction sequence" );
}
/* Check if all declared registers were used.
*/
for (file = TGSI_FILE_NULL; file < TGSI_FILE_COUNT; file++) {
uint i;
for (i = 0; i < MAX_REGISTERS; i++) {
if (is_register_declared( ctx, file, i ) && !is_register_used( ctx, file, i ) && !ctx->regs_ind_used[file]) {
report_warning( ctx, "Register never used" );
}
}
}
/* Print totals, if any.
*/
if (ctx->errors || ctx->warnings)
debug_printf( "\n%u errors, %u warnings", ctx->errors, ctx->warnings );
return TRUE;
}
boolean
tgsi_sanity_check(
struct tgsi_token *tokens )
{
struct sanity_check_ctx ctx;
ctx.iter.prolog = NULL;
ctx.iter.iterate_instruction = iter_instruction;
ctx.iter.iterate_declaration = iter_declaration;
ctx.iter.iterate_immediate = iter_immediate;
ctx.iter.epilog = epilog;
memset( ctx.regs_decl, 0, sizeof( ctx.regs_decl ) );
memset( ctx.regs_used, 0, sizeof( ctx.regs_used ) );
memset( ctx.regs_ind_used, 0, sizeof( ctx.regs_ind_used ) );
ctx.num_imms = 0;
ctx.num_instructions = 0;
ctx.index_of_END = ~0;
ctx.errors = 0;
ctx.warnings = 0;
if (!tgsi_iterate_shader( tokens, &ctx.iter ))
return FALSE;
return ctx.errors == 0;
}

View File

@ -0,0 +1,49 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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 TGSI_SANITY_H
#define TGSI_SANITY_H
#include "pipe/p_shader_tokens.h"
#if defined __cplusplus
extern "C" {
#endif
/* Check the given token stream for errors and common mistakes.
* Diagnostic messages are printed out to the debug output.
* Returns TRUE if there are no errors, even though there could be some warnings.
*/
boolean
tgsi_sanity_check(
struct tgsi_token *tokens );
#if defined __cplusplus
}
#endif
#endif /* TGSI_SANITY_H */

View File

@ -29,6 +29,7 @@
#include "tgsi_text.h"
#include "tgsi_build.h"
#include "tgsi_parse.h"
#include "tgsi_sanity.h"
#include "tgsi_util.h"
static boolean is_alpha_underscore( const char *cur )
@ -225,24 +226,21 @@ static const char *file_names[TGSI_FILE_COUNT] =
};
static boolean
parse_file(
struct translate_ctx *ctx,
uint *file )
parse_file( const char **pcur, uint *file )
{
uint i;
for (i = 0; i < TGSI_FILE_COUNT; i++) {
const char *cur = ctx->cur;
const char *cur = *pcur;
if (str_match_no_case( &cur, file_names[i] )) {
if (!is_digit_alpha_underscore( cur )) {
ctx->cur = cur;
*pcur = cur;
*file = i;
return TRUE;
}
}
}
report_error( ctx, "Unknown register file" );
return FALSE;
}
@ -289,41 +287,57 @@ parse_opt_writemask(
return TRUE;
}
/* Parse register part common for decls and operands.
* <register_prefix> ::= <file> `[' <index>
/* <register_file_bracket> ::= <file> `['
*/
static boolean
parse_register_prefix(
parse_register_file_bracket(
struct translate_ctx *ctx,
uint *file,
uint *index )
uint *file )
{
if (!parse_file( ctx, file ))
if (!parse_file( &ctx->cur, file )) {
report_error( ctx, "Unknown register file" );
return FALSE;
}
eat_opt_white( &ctx->cur );
if (*ctx->cur != '[') {
report_error( ctx, "Expected `['" );
return FALSE;
}
ctx->cur++;
eat_opt_white( &ctx->cur );
if (!parse_uint( &ctx->cur, index )) {
report_error( ctx, "Expected literal integer" );
return FALSE;
}
return TRUE;
}
/* Parse register operand.
* <register> ::= <register_prefix> `]'
/* <register_file_bracket_index> ::= <register_file_bracket> <uint>
*/
static boolean
parse_register(
parse_register_file_bracket_index(
struct translate_ctx *ctx,
uint *file,
uint *index )
int *index )
{
if (!parse_register_prefix( ctx, file, index ))
uint uindex;
if (!parse_register_file_bracket( ctx, file ))
return FALSE;
eat_opt_white( &ctx->cur );
if (!parse_uint( &ctx->cur, &uindex )) {
report_error( ctx, "Expected literal unsigned integer" );
return FALSE;
}
*index = (int) uindex;
return TRUE;
}
/* Parse destination register operand.
* <register_dst> ::= <register_file_bracket_index> `]'
*/
static boolean
parse_register_dst(
struct translate_ctx *ctx,
uint *file,
int *index )
{
if (!parse_register_file_bracket_index( ctx, file, index ))
return FALSE;
eat_opt_white( &ctx->cur );
if (*ctx->cur != ']') {
@ -331,30 +345,95 @@ parse_register(
return FALSE;
}
ctx->cur++;
/* TODO: Modulate suffix */
return TRUE;
}
/* Parse source register operand.
* <register_src> ::= <register_file_bracket_index> `]' |
* <register_file_bracket> <register_dst> `]' |
* <register_file_bracket> <register_dst> `+' <uint> `]' |
* <register_file_bracket> <register_dst> `-' <uint> `]'
*/
static boolean
parse_register_src(
struct translate_ctx *ctx,
uint *file,
int *index,
uint *ind_file,
int *ind_index )
{
const char *cur;
uint uindex;
if (!parse_register_file_bracket( ctx, file ))
return FALSE;
eat_opt_white( &ctx->cur );
cur = ctx->cur;
if (parse_file( &cur, ind_file )) {
if (!parse_register_dst( ctx, ind_file, ind_index ))
return FALSE;
eat_opt_white( &ctx->cur );
if (*ctx->cur == '+' || *ctx->cur == '-') {
boolean negate;
negate = *ctx->cur == '-';
ctx->cur++;
eat_opt_white( &ctx->cur );
if (!parse_uint( &ctx->cur, &uindex )) {
report_error( ctx, "Expected literal unsigned integer" );
return FALSE;
}
if (negate)
*index = -(int) uindex;
else
*index = (int) uindex;
}
else {
*index = 0;
}
}
else {
if (!parse_uint( &ctx->cur, &uindex )) {
report_error( ctx, "Expected literal unsigned integer" );
return FALSE;
}
*index = (int) uindex;
*ind_file = TGSI_FILE_NULL;
*ind_index = 0;
}
eat_opt_white( &ctx->cur );
if (*ctx->cur != ']') {
report_error( ctx, "Expected `]'" );
return FALSE;
}
ctx->cur++;
return TRUE;
}
/* Parse register declaration.
* <register> ::= <register_prefix> `]' | <register_prefix> `..' <index> `]'
* <register_dcl> ::= <register_file_bracket_index> `]' |
* <register_file_bracket_index> `..' <index> `]'
*/
static boolean
parse_register_dcl(
struct translate_ctx *ctx,
uint *file,
uint *first,
uint *last )
int *first,
int *last )
{
if (!parse_register_prefix( ctx, file, first ))
if (!parse_register_file_bracket_index( ctx, file, first ))
return FALSE;
eat_opt_white( &ctx->cur );
if (ctx->cur[0] == '.' && ctx->cur[1] == '.') {
uint uindex;
ctx->cur += 2;
eat_opt_white( &ctx->cur );
if (!parse_uint( &ctx->cur, last )) {
if (!parse_uint( &ctx->cur, &uindex )) {
report_error( ctx, "Expected literal integer" );
return FALSE;
}
*last = (int) uindex;
eat_opt_white( &ctx->cur );
}
else {
@ -385,11 +464,11 @@ parse_dst_operand(
struct tgsi_full_dst_register *dst )
{
uint file;
uint index;
int index;
uint writemask;
const char *cur;
if (!parse_register( ctx, &file, &index ))
if (!parse_register_dst( ctx, &file, &index ))
return FALSE;
cur = ctx->cur;
@ -417,6 +496,52 @@ parse_dst_operand(
return TRUE;
}
static boolean
parse_optional_swizzle(
struct translate_ctx *ctx,
uint swizzle[4],
boolean *parsed_swizzle,
boolean *parsed_extswizzle )
{
const char *cur = ctx->cur;
*parsed_swizzle = FALSE;
*parsed_extswizzle = FALSE;
eat_opt_white( &cur );
if (*cur == '.') {
uint i;
cur++;
eat_opt_white( &cur );
for (i = 0; i < 4; i++) {
if (toupper( *cur ) == 'X')
swizzle[i] = TGSI_SWIZZLE_X;
else if (toupper( *cur ) == 'Y')
swizzle[i] = TGSI_SWIZZLE_Y;
else if (toupper( *cur ) == 'Z')
swizzle[i] = TGSI_SWIZZLE_Z;
else if (toupper( *cur ) == 'W')
swizzle[i] = TGSI_SWIZZLE_W;
else {
if (*cur == '0')
swizzle[i] = TGSI_EXTSWIZZLE_ZERO;
else if (*cur == '1')
swizzle[i] = TGSI_EXTSWIZZLE_ONE;
else {
report_error( ctx, "Expected register swizzle component `x', `y', `z', `w', `0' or `1'" );
return FALSE;
}
*parsed_extswizzle = TRUE;
}
cur++;
}
*parsed_swizzle = TRUE;
ctx->cur = cur;
}
return TRUE;
}
static boolean
parse_src_operand(
struct translate_ctx *ctx,
@ -425,7 +550,12 @@ parse_src_operand(
const char *cur;
float value;
uint file;
uint index;
int index;
uint ind_file;
int ind_index;
uint swizzle[4];
boolean parsed_swizzle;
boolean parsed_extswizzle;
if (*ctx->cur == '-') {
cur = ctx->cur;
@ -497,40 +627,33 @@ parse_src_operand(
}
}
if (!parse_register( ctx, &file, &index ))
if (!parse_register_src( ctx, &file, &index, &ind_file, &ind_index ))
return FALSE;
src->SrcRegister.File = file;
src->SrcRegister.Index = index;
if (ind_file != TGSI_FILE_NULL) {
src->SrcRegister.Indirect = 1;
src->SrcRegisterInd.File = ind_file;
src->SrcRegisterInd.Index = ind_index;
}
/* Parse optional swizzle
/* Parse optional swizzle.
*/
cur = ctx->cur;
eat_opt_white( &cur );
if (*cur == '.') {
uint i;
if (parse_optional_swizzle( ctx, swizzle, &parsed_swizzle, &parsed_extswizzle )) {
if (parsed_extswizzle) {
assert( parsed_swizzle );
cur++;
eat_opt_white( &cur );
for (i = 0; i < 4; i++) {
uint swizzle;
if (toupper( *cur ) == 'X')
swizzle = TGSI_SWIZZLE_X;
else if (toupper( *cur ) == 'Y')
swizzle = TGSI_SWIZZLE_Y;
else if (toupper( *cur ) == 'Z')
swizzle = TGSI_SWIZZLE_Z;
else if (toupper( *cur ) == 'W')
swizzle = TGSI_SWIZZLE_W;
else {
report_error( ctx, "Expected register swizzle component either `x', `y', `z' or `w'" );
return FALSE;
}
cur++;
tgsi_util_set_src_register_swizzle( &src->SrcRegister, swizzle, i );
src->SrcRegisterExtSwz.ExtSwizzleX = swizzle[0];
src->SrcRegisterExtSwz.ExtSwizzleY = swizzle[1];
src->SrcRegisterExtSwz.ExtSwizzleZ = swizzle[2];
src->SrcRegisterExtSwz.ExtSwizzleW = swizzle[3];
}
else if (parsed_swizzle) {
src->SrcRegister.SwizzleX = swizzle[0];
src->SrcRegister.SwizzleY = swizzle[1];
src->SrcRegister.SwizzleZ = swizzle[2];
src->SrcRegister.SwizzleW = swizzle[3];
}
ctx->cur = cur;
}
if (src->SrcRegisterExtMod.Complement) {
@ -601,130 +724,131 @@ struct opcode_info
uint num_dst;
uint num_src;
uint is_tex;
uint is_branch;
const char *mnemonic;
};
static const struct opcode_info opcode_info[TGSI_OPCODE_LAST] =
{
{ 1, 1, 0, "ARL" },
{ 1, 1, 0, "MOV" },
{ 1, 1, 0, "LIT" },
{ 1, 1, 0, "RCP" },
{ 1, 1, 0, "RSQ" },
{ 1, 1, 0, "EXP" },
{ 1, 1, 0, "LOG" },
{ 1, 2, 0, "MUL" },
{ 1, 2, 0, "ADD" },
{ 1, 2, 0, "DP3" },
{ 1, 2, 0, "DP4" },
{ 1, 2, 0, "DST" },
{ 1, 2, 0, "MIN" },
{ 1, 2, 0, "MAX" },
{ 1, 2, 0, "SLT" },
{ 1, 2, 0, "SGE" },
{ 1, 3, 0, "MAD" },
{ 1, 2, 0, "SUB" },
{ 1, 3, 0, "LERP" },
{ 1, 3, 0, "CND" },
{ 1, 3, 0, "CND0" },
{ 1, 3, 0, "DOT2ADD" },
{ 1, 2, 0, "INDEX" },
{ 1, 1, 0, "NEGATE" },
{ 1, 1, 0, "FRAC" },
{ 1, 3, 0, "CLAMP" },
{ 1, 1, 0, "FLOOR" },
{ 1, 1, 0, "ROUND" },
{ 1, 1, 0, "EXPBASE2" },
{ 1, 1, 0, "LOGBASE2" },
{ 1, 2, 0, "POWER" },
{ 1, 2, 0, "CROSSPRODUCT" },
{ 1, 2, 0, "MULTIPLYMATRIX" },
{ 1, 1, 0, "ABS" },
{ 1, 1, 0, "RCC" },
{ 1, 2, 0, "DPH" },
{ 1, 1, 0, "COS" },
{ 1, 1, 0, "DDX" },
{ 1, 1, 0, "DDY" },
{ 0, 1, 0, "KILP" },
{ 1, 1, 0, "PK2H" },
{ 1, 1, 0, "PK2US" },
{ 1, 1, 0, "PK4B" },
{ 1, 1, 0, "PK4UB" },
{ 1, 2, 0, "RFL" },
{ 1, 2, 0, "SEQ" },
{ 1, 2, 0, "SFL" },
{ 1, 2, 0, "SGT" },
{ 1, 1, 0, "SIN" },
{ 1, 2, 0, "SLE" },
{ 1, 2, 0, "SNE" },
{ 1, 2, 0, "STR" },
{ 1, 2, 1, "TEX" },
{ 1, 4, 1, "TXD" },
{ 1, 2, 1, "TXP" },
{ 1, 1, 0, "UP2H" },
{ 1, 1, 0, "UP2US" },
{ 1, 1, 0, "UP4B" },
{ 1, 1, 0, "UP4UB" },
{ 1, 3, 0, "X2D" },
{ 1, 1, 0, "ARA" },
{ 1, 1, 0, "ARR" },
{ 0, 1, 0, "BRA" },
{ 0, 0, 0, "CAL" },
{ 0, 0, 0, "RET" },
{ 1, 1, 0, "SSG" },
{ 1, 3, 0, "CMP" },
{ 1, 1, 0, "SCS" },
{ 1, 2, 1, "TXB" },
{ 1, 1, 0, "NRM" },
{ 1, 2, 0, "DIV" },
{ 1, 2, 0, "DP2" },
{ 1, 2, 1, "TXL" },
{ 0, 0, 0, "BRK" },
{ 0, 1, 0, "IF" },
{ 0, 0, 0, "LOOP" },
{ 0, 1, 0, "REP" },
{ 0, 0, 0, "ELSE" },
{ 0, 0, 0, "ENDIF" },
{ 0, 0, 0, "ENDLOOP" },
{ 0, 0, 0, "ENDREP" },
{ 0, 1, 0, "PUSHA" },
{ 1, 0, 0, "POPA" },
{ 1, 1, 0, "CEIL" },
{ 1, 1, 0, "I2F" },
{ 1, 1, 0, "NOT" },
{ 1, 1, 0, "TRUNC" },
{ 1, 2, 0, "SHL" },
{ 1, 2, 0, "SHR" },
{ 1, 2, 0, "AND" },
{ 1, 2, 0, "OR" },
{ 1, 2, 0, "MOD" },
{ 1, 2, 0, "XOR" },
{ 1, 3, 0, "SAD" },
{ 1, 2, 1, "TXF" },
{ 1, 2, 1, "TXQ" },
{ 0, 0, 0, "CONT" },
{ 0, 0, 0, "EMIT" },
{ 0, 0, 0, "ENDPRIM" },
{ 0, 0, 0, "BGNLOOP2" },
{ 0, 0, 0, "BGNSUB" },
{ 0, 0, 0, "ENDLOOP2" },
{ 0, 0, 0, "ENDSUB" },
{ 1, 1, 0, "NOISE1" },
{ 1, 1, 0, "NOISE2" },
{ 1, 1, 0, "NOISE3" },
{ 1, 1, 0, "NOISE4" },
{ 0, 0, 0, "NOP" },
{ 1, 2, 0, "M4X3" },
{ 1, 2, 0, "M3X4" },
{ 1, 2, 0, "M3X3" },
{ 1, 2, 0, "M3X2" },
{ 1, 1, 0, "NRM4" },
{ 0, 1, 0, "CALLNZ" },
{ 0, 1, 0, "IFC" },
{ 0, 1, 0, "BREAKC" },
{ 0, 0, 0, "KIL" },
{ 0, 0, 0, "END" },
{ 1, 1, 0, "SWZ" }
{ 1, 1, 0, 0, "ARL" },
{ 1, 1, 0, 0, "MOV" },
{ 1, 1, 0, 0, "LIT" },
{ 1, 1, 0, 0, "RCP" },
{ 1, 1, 0, 0, "RSQ" },
{ 1, 1, 0, 0, "EXP" },
{ 1, 1, 0, 0, "LOG" },
{ 1, 2, 0, 0, "MUL" },
{ 1, 2, 0, 0, "ADD" },
{ 1, 2, 0, 0, "DP3" },
{ 1, 2, 0, 0, "DP4" },
{ 1, 2, 0, 0, "DST" },
{ 1, 2, 0, 0, "MIN" },
{ 1, 2, 0, 0, "MAX" },
{ 1, 2, 0, 0, "SLT" },
{ 1, 2, 0, 0, "SGE" },
{ 1, 3, 0, 0, "MAD" },
{ 1, 2, 0, 0, "SUB" },
{ 1, 3, 0, 0, "LERP" },
{ 1, 3, 0, 0, "CND" },
{ 1, 3, 0, 0, "CND0" },
{ 1, 3, 0, 0, "DOT2ADD" },
{ 1, 2, 0, 0, "INDEX" },
{ 1, 1, 0, 0, "NEGATE" },
{ 1, 1, 0, 0, "FRAC" },
{ 1, 3, 0, 0, "CLAMP" },
{ 1, 1, 0, 0, "FLOOR" },
{ 1, 1, 0, 0, "ROUND" },
{ 1, 1, 0, 0, "EXPBASE2" },
{ 1, 1, 0, 0, "LOGBASE2" },
{ 1, 2, 0, 0, "POWER" },
{ 1, 2, 0, 0, "CROSSPRODUCT" },
{ 1, 2, 0, 0, "MULTIPLYMATRIX" },
{ 1, 1, 0, 0, "ABS" },
{ 1, 1, 0, 0, "RCC" },
{ 1, 2, 0, 0, "DPH" },
{ 1, 1, 0, 0, "COS" },
{ 1, 1, 0, 0, "DDX" },
{ 1, 1, 0, 0, "DDY" },
{ 0, 1, 0, 0, "KILP" },
{ 1, 1, 0, 0, "PK2H" },
{ 1, 1, 0, 0, "PK2US" },
{ 1, 1, 0, 0, "PK4B" },
{ 1, 1, 0, 0, "PK4UB" },
{ 1, 2, 0, 0, "RFL" },
{ 1, 2, 0, 0, "SEQ" },
{ 1, 2, 0, 0, "SFL" },
{ 1, 2, 0, 0, "SGT" },
{ 1, 1, 0, 0, "SIN" },
{ 1, 2, 0, 0, "SLE" },
{ 1, 2, 0, 0, "SNE" },
{ 1, 2, 0, 0, "STR" },
{ 1, 2, 1, 0, "TEX" },
{ 1, 4, 1, 0, "TXD" },
{ 1, 2, 1, 0, "TXP" },
{ 1, 1, 0, 0, "UP2H" },
{ 1, 1, 0, 0, "UP2US" },
{ 1, 1, 0, 0, "UP4B" },
{ 1, 1, 0, 0, "UP4UB" },
{ 1, 3, 0, 0, "X2D" },
{ 1, 1, 0, 0, "ARA" },
{ 1, 1, 0, 0, "ARR" },
{ 0, 1, 0, 0, "BRA" },
{ 0, 0, 0, 1, "CAL" },
{ 0, 0, 0, 0, "RET" },
{ 1, 1, 0, 0, "SSG" },
{ 1, 3, 0, 0, "CMP" },
{ 1, 1, 0, 0, "SCS" },
{ 1, 2, 1, 0, "TXB" },
{ 1, 1, 0, 0, "NRM" },
{ 1, 2, 0, 0, "DIV" },
{ 1, 2, 0, 0, "DP2" },
{ 1, 2, 1, 0, "TXL" },
{ 0, 0, 0, 0, "BRK" },
{ 0, 1, 0, 1, "IF" },
{ 0, 0, 0, 0, "LOOP" },
{ 0, 1, 0, 0, "REP" },
{ 0, 0, 0, 1, "ELSE" },
{ 0, 0, 0, 0, "ENDIF" },
{ 0, 0, 0, 0, "ENDLOOP" },
{ 0, 0, 0, 0, "ENDREP" },
{ 0, 1, 0, 0, "PUSHA" },
{ 1, 0, 0, 0, "POPA" },
{ 1, 1, 0, 0, "CEIL" },
{ 1, 1, 0, 0, "I2F" },
{ 1, 1, 0, 0, "NOT" },
{ 1, 1, 0, 0, "TRUNC" },
{ 1, 2, 0, 0, "SHL" },
{ 1, 2, 0, 0, "SHR" },
{ 1, 2, 0, 0, "AND" },
{ 1, 2, 0, 0, "OR" },
{ 1, 2, 0, 0, "MOD" },
{ 1, 2, 0, 0, "XOR" },
{ 1, 3, 0, 0, "SAD" },
{ 1, 2, 1, 0, "TXF" },
{ 1, 2, 1, 0, "TXQ" },
{ 0, 0, 0, 0, "CONT" },
{ 0, 0, 0, 0, "EMIT" },
{ 0, 0, 0, 0, "ENDPRIM" },
{ 0, 0, 0, 1, "BGNLOOP2" },
{ 0, 0, 0, 0, "BGNSUB" },
{ 0, 0, 0, 1, "ENDLOOP2" },
{ 0, 0, 0, 0, "ENDSUB" },
{ 1, 1, 0, 0, "NOISE1" },
{ 1, 1, 0, 0, "NOISE2" },
{ 1, 1, 0, 0, "NOISE3" },
{ 1, 1, 0, 0, "NOISE4" },
{ 0, 0, 0, 0, "NOP" },
{ 1, 2, 0, 0, "M4X3" },
{ 1, 2, 0, 0, "M3X4" },
{ 1, 2, 0, 0, "M3X3" },
{ 1, 2, 0, 0, "M3X2" },
{ 1, 1, 0, 0, "NRM4" },
{ 0, 1, 0, 0, "CALLNZ" },
{ 0, 1, 0, 0, "IFC" },
{ 0, 1, 0, 0, "BREAKC" },
{ 0, 0, 0, 0, "KIL" },
{ 0, 0, 0, 0, "END" },
{ 1, 1, 0, 0, "SWZ" }
};
static const char *texture_names[TGSI_TEXTURE_COUNT] =
@ -740,7 +864,10 @@ static const char *texture_names[TGSI_TEXTURE_COUNT] =
"SHADOWRECT"
};
static boolean parse_instruction( struct translate_ctx *ctx )
static boolean
parse_instruction(
struct translate_ctx *ctx,
boolean has_label )
{
uint i;
uint saturate = TGSI_SAT_NONE;
@ -754,23 +881,32 @@ static boolean parse_instruction( struct translate_ctx *ctx )
for (i = 0; i < TGSI_OPCODE_LAST; i++) {
const char *cur = ctx->cur;
if (str_match_no_case( &cur, opcode_info[i].mnemonic )) {
info = &opcode_info[i];
if (str_match_no_case( &cur, info->mnemonic )) {
if (str_match_no_case( &cur, "_SATNV" ))
saturate = TGSI_SAT_MINUS_PLUS_ONE;
else if (str_match_no_case( &cur, "_SAT" ))
saturate = TGSI_SAT_ZERO_ONE;
if (*cur == '\0' || eat_white( &cur )) {
if (info->num_dst + info->num_src + info->is_tex == 0) {
if (!is_digit_alpha_underscore( cur )) {
ctx->cur = cur;
break;
}
}
else if (*cur == '\0' || eat_white( &cur )) {
ctx->cur = cur;
break;
}
}
}
if (i == TGSI_OPCODE_LAST) {
report_error( ctx, "Unknown opcode" );
if (has_label)
report_error( ctx, "Unknown opcode" );
else
report_error( ctx, "Expected `DCL', `IMM' or a label" );
return FALSE;
}
info = &opcode_info[i];
inst = tgsi_default_full_instruction();
inst.Instruction.Opcode = i;
@ -817,6 +953,23 @@ static boolean parse_instruction( struct translate_ctx *ctx )
}
}
if (info->is_branch) {
uint target;
eat_opt_white( &ctx->cur );
if (*ctx->cur != ':') {
report_error( ctx, "Expected `:'" );
return FALSE;
}
ctx->cur++;
eat_opt_white( &ctx->cur );
if (!parse_uint( &ctx->cur, &target )) {
report_error( ctx, "Expected a label" );
return FALSE;
}
inst.InstructionExtLabel.Label = target;
}
advance = tgsi_build_full_instruction(
&inst,
ctx->tokens_cur,
@ -851,8 +1004,8 @@ static boolean parse_declaration( struct translate_ctx *ctx )
{
struct tgsi_full_declaration decl;
uint file;
uint first;
uint last;
int first;
int last;
uint writemask;
const char *cur;
uint advance;
@ -1024,8 +1177,11 @@ static boolean translate( struct translate_ctx *ctx )
return FALSE;
}
if (*ctx->cur == '\0')
break;
if (parse_label( ctx, &label_val )) {
if (!parse_instruction( ctx ))
if (!parse_instruction( ctx, TRUE ))
return FALSE;
}
else if (str_match_no_case( &ctx->cur, "DCL" )) {
@ -1036,8 +1192,7 @@ static boolean translate( struct translate_ctx *ctx )
if (!parse_immediate( ctx ))
return FALSE;
}
else {
report_error( ctx, "Expected `DCL', `IMM' or a label" );
else if (!parse_instruction( ctx, FALSE )) {
return FALSE;
}
}
@ -1059,5 +1214,8 @@ tgsi_text_translate(
ctx.tokens_cur = tokens;
ctx.tokens_end = tokens + num_tokens;
return translate( &ctx );
if (!translate( &ctx ))
return FALSE;
return tgsi_sanity_check( tokens );
}

View File

@ -174,20 +174,19 @@ copy(char *dst, const char *start, const char *end, size_t n)
#endif
const char *
debug_get_option(const char *name, const char *dfault)
static INLINE const char *
_debug_get_option(const char *name)
{
const char *result;
#if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
/* EngMapFile creates the file if it does not exists, so it must either be
* disabled on release versions (or put in a less conspicuous place). */
#ifdef DEBUG
const char *result = NULL;
ULONG_PTR iFile = 0;
const void *pMap = NULL;
const char *sol, *eol, *sep;
static char output[1024];
result = dfault;
pMap = EngMapFile(L"\\??\\c:\\gallium.cfg", 0, &iFile);
if(pMap) {
sol = (const char *)pMap;
@ -208,18 +207,27 @@ debug_get_option(const char *name, const char *dfault)
}
EngUnmapFile(iFile);
}
return result;
#else
result = dfault;
return NULL;
#endif
#elif defined(PIPE_SUBSYSTEM_WINDOWS_CE)
/* TODO: implement */
result = dfault;
return NULL;
#else
result = getenv(name);
return getenv(name);
#endif
}
const char *
debug_get_option(const char *name, const char *dfault)
{
const char *result;
result = _debug_get_option(name);
if(!result)
result = dfault;
#endif
debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? result : "(null)");
return result;
@ -228,7 +236,7 @@ debug_get_option(const char *name, const char *dfault)
boolean
debug_get_bool_option(const char *name, boolean dfault)
{
const char *str = debug_get_option(name, NULL);
const char *str = _debug_get_option(name);
boolean result;
if(str == NULL)
@ -258,7 +266,7 @@ debug_get_num_option(const char *name, long dfault)
long result;
const char *str;
str = debug_get_option(name, NULL);
str = _debug_get_option(name);
if(!str)
result = dfault;
else {
@ -294,7 +302,7 @@ debug_get_flags_option(const char *name,
unsigned long result;
const char *str;
str = debug_get_option(name, NULL);
str = _debug_get_option(name);
if(!str)
result = dfault;
else {

View File

@ -46,15 +46,86 @@
#include "util/u_string.h"
#define PROFILE_FILE_SIZE 4*1024*1024
#define PROFILE_TABLE_SIZE (1024*1024)
#define FILE_NAME_SIZE 256
static WCHAR wFileName[FILE_NAME_SIZE];
struct debug_profile_entry
{
uintptr_t caller;
uintptr_t callee;
uint64_t samples;
};
static unsigned long enabled = 0;
static WCHAR wFileName[FILE_NAME_SIZE] = L"\\??\\c:\\00000000.prof";
static ULONG_PTR iFile = 0;
static void *pMap = NULL;
static void *pMapEnd = NULL;
static struct debug_profile_entry *table = NULL;
static unsigned long free_table_entries = 0;
static unsigned long max_table_entries = 0;
uint64_t start_stamp = 0;
uint64_t end_stamp = 0;
static void
debug_profile_entry(uintptr_t caller, uintptr_t callee, uint64_t samples)
{
unsigned hash = ( caller + callee ) & PROFILE_TABLE_SIZE - 1;
while(1) {
if(table[hash].caller == 0 && table[hash].callee == 0) {
table[hash].caller = caller;
table[hash].callee = callee;
table[hash].samples = samples;
--free_table_entries;
break;
}
else if(table[hash].caller == caller && table[hash].callee == callee) {
table[hash].samples += samples;
break;
}
else {
++hash;
}
}
}
static uintptr_t caller_stack[1024];
static unsigned last_caller = 0;
static int64_t delta(void) {
int64_t result = end_stamp - start_stamp;
if(result > UINT64_C(0xffffffff))
result = 0;
return result;
}
static void __cdecl
debug_profile_enter(uintptr_t callee)
{
uintptr_t caller = last_caller ? caller_stack[last_caller - 1] : 0;
if (caller)
debug_profile_entry(caller, 0, delta());
debug_profile_entry(caller, callee, 1);
caller_stack[last_caller++] = callee;
}
static void __cdecl
debug_profile_exit(uintptr_t callee)
{
debug_profile_entry(callee, 0, delta());
if(last_caller)
--last_caller;
}
/**
* Called at the start of every method or function.
*
@ -63,27 +134,49 @@ static void *pMapEnd = NULL;
void __declspec(naked) __cdecl
_penter(void) {
_asm {
push ebx
mov ebx, [pMap]
test ebx, ebx
jz done
cmp ebx, [pMapEnd]
je done
push eax
mov eax, [enabled]
test eax, eax
jz skip
push edx
mov eax, [esp+12]
and eax, 0xfffffffe
mov [ebx], eax
add ebx, 4
rdtsc
mov [ebx], eax
add ebx, 4
mov [pMap], ebx
pop edx
pop eax
done:
mov dword ptr [end_stamp], eax
mov dword ptr [end_stamp+4], edx
xor eax, eax
mov [enabled], eax
mov eax, [esp+8]
push ebx
push ecx
push ebp
push edi
push esi
push eax
call debug_profile_enter
add esp, 4
pop esi
pop edi
pop ebp
pop ecx
pop ebx
ret
mov eax, 1
mov [enabled], eax
rdtsc
mov dword ptr [start_stamp], eax
mov dword ptr [start_stamp+4], edx
pop edx
skip:
pop eax
ret
}
}
@ -96,33 +189,58 @@ done:
void __declspec(naked) __cdecl
_pexit(void) {
_asm {
push ebx
mov ebx, [pMap]
test ebx, ebx
jz done
cmp ebx, [pMapEnd]
je done
push eax
mov eax, [enabled]
test eax, eax
jz skip
push edx
mov eax, [esp+12]
or eax, 0x00000001
mov [ebx], eax
add ebx, 4
rdtsc
mov [ebx], eax
add ebx, 4
mov [pMap], ebx
pop edx
pop eax
done:
mov dword ptr [end_stamp], eax
mov dword ptr [end_stamp+4], edx
xor eax, eax
mov [enabled], eax
mov eax, [esp+8]
push ebx
push ecx
push ebp
push edi
push esi
push eax
call debug_profile_exit
add esp, 4
pop esi
pop edi
pop ebp
pop ecx
pop ebx
mov eax, 1
mov [enabled], eax
rdtsc
mov dword ptr [start_stamp], eax
mov dword ptr [start_stamp+4], edx
pop edx
skip:
pop eax
ret
}
}
/**
* Reference function for calibration.
*/
void __declspec(naked)
__debug_profile_reference1(void) {
__debug_profile_reference(void) {
_asm {
call _penter
call _pexit
@ -131,45 +249,72 @@ __debug_profile_reference1(void) {
}
void __declspec(naked)
__debug_profile_reference2(void) {
_asm {
call _penter
call __debug_profile_reference1
call _pexit
ret
}
}
void
debug_profile_start(void)
{
static unsigned no = 0;
char filename[FILE_NAME_SIZE];
unsigned i;
WCHAR *p;
util_snprintf(filename, sizeof(filename), "\\??\\c:\\%03u.prof", ++no);
for(i = 0; i < FILE_NAME_SIZE; ++i)
wFileName[i] = (WCHAR)filename[i];
pMap = EngMapFile(wFileName, PROFILE_FILE_SIZE, &iFile);
if(pMap) {
pMapEnd = (unsigned char*)pMap + PROFILE_FILE_SIZE;
/* reference functions for calibration purposes */
__debug_profile_reference2();
// increment starting from the less significant digit
p = &wFileName[14];
while(1) {
if(*p == '9') {
*p-- = '0';
}
else {
*p += 1;
break;
}
}
table = EngMapFile(wFileName,
PROFILE_TABLE_SIZE*sizeof(struct debug_profile_entry),
&iFile);
if(table) {
unsigned i;
free_table_entries = max_table_entries = PROFILE_TABLE_SIZE;
memset(table, 0, PROFILE_TABLE_SIZE*sizeof(struct debug_profile_entry));
table[0].caller = (uintptr_t)&__debug_profile_reference;
table[0].callee = 0;
table[0].samples = 0;
--free_table_entries;
_asm {
push edx
push eax
rdtsc
mov dword ptr [start_stamp], eax
mov dword ptr [start_stamp+4], edx
pop edx
pop eax
}
last_caller = 0;
enabled = 1;
for(i = 0; i < 8; ++i) {
_asm {
call __debug_profile_reference
}
}
}
}
void
debug_profile_stop(void)
{
if(iFile) {
enabled = 0;
if(iFile)
EngUnmapFile(iFile);
/* TODO: truncate file */
}
iFile = 0;
pMapEnd = pMap = NULL;
table = NULL;
free_table_entries = max_table_entries = 0;
}
#endif /* PROFILE */

View File

@ -346,7 +346,7 @@ r5g6b5_get_tile_rgba(ushort *src,
static void
r5g5b5_put_tile_rgba(ushort *dst,
r5g6b5_put_tile_rgba(ushort *dst,
unsigned w, unsigned h,
const float *p,
unsigned src_stride)
@ -632,13 +632,10 @@ ycbcr_get_tile_rgba(ushort *src,
const float scale = 1.0f / 255.0f;
unsigned i, j;
/* we're assuming we're being asked for an even number of texels */
assert((w & 1) == 0);
for (i = 0; i < h; i++) {
float *pRow = p;
/* do two texels at a time */
for (j = 0; j < w; j += 2, src += 2) {
for (j = 0; j < (w & ~1); j += 2, src += 2) {
const ushort t0 = src[0];
const ushort t1 = src[1];
const ubyte y0 = (t0 >> 8) & 0xff; /* luminance */
@ -676,11 +673,103 @@ ycbcr_get_tile_rgba(ushort *src,
pRow += 4;
}
/* do the last texel */
if (w & 1) {
const ushort t0 = src[0];
const ushort t1 = src[1];
const ubyte y0 = (t0 >> 8) & 0xff; /* luminance */
ubyte cb, cr;
float r, g, b;
if (rev) {
cb = t1 & 0xff; /* chroma U */
cr = t0 & 0xff; /* chroma V */
}
else {
cb = t0 & 0xff; /* chroma U */
cr = t1 & 0xff; /* chroma V */
}
/* even pixel: y0,cr,cb */
r = 1.164f * (y0-16) + 1.596f * (cr-128);
g = 1.164f * (y0-16) - 0.813f * (cr-128) - 0.391f * (cb-128);
b = 1.164f * (y0-16) + 2.018f * (cb-128);
pRow[0] = r * scale;
pRow[1] = g * scale;
pRow[2] = b * scale;
pRow[3] = 1.0f;
pRow += 4;
}
p += dst_stride;
}
}
void
pipe_tile_raw_to_rgba(enum pipe_format format,
void *src,
uint w, uint h,
float *dst, unsigned dst_stride)
{
switch (format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
a8r8g8b8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_X8R8G8B8_UNORM:
x8r8g8b8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_B8G8R8A8_UNORM:
b8g8r8a8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_A1R5G5B5_UNORM:
a1r5g5b5_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_A4R4G4B4_UNORM:
a4r4g4b4_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_R5G6B5_UNORM:
r5g6b5_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_L8_UNORM:
l8_get_tile_rgba((ubyte *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_A8_UNORM:
a8_get_tile_rgba((ubyte *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_I8_UNORM:
i8_get_tile_rgba((ubyte *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_A8L8_UNORM:
a8_l8_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_R16G16B16A16_SNORM:
r16g16b16a16_get_tile_rgba((short *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_Z16_UNORM:
z16_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_Z32_UNORM:
z32_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_S8Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
s8z24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_Z24S8_UNORM:
z24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_YCBCR:
ycbcr_get_tile_rgba((ushort *) src, w, h, dst, dst_stride, FALSE);
break;
case PIPE_FORMAT_YCBCR_REV:
ycbcr_get_tile_rgba((ushort *) src, w, h, dst, dst_stride, TRUE);
break;
default:
assert(0);
}
}
void
pipe_get_tile_rgba(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
@ -697,66 +786,12 @@ pipe_get_tile_rgba(struct pipe_surface *ps,
if (!packed)
return;
if(ps->format == PIPE_FORMAT_YCBCR || ps->format == PIPE_FORMAT_YCBCR_REV)
assert((x & 1) == 0);
pipe_get_tile_raw(ps, x, y, w, h, packed, 0);
switch (ps->format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
a8r8g8b8_get_tile_rgba((unsigned *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_X8R8G8B8_UNORM:
x8r8g8b8_get_tile_rgba((unsigned *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_B8G8R8A8_UNORM:
b8g8r8a8_get_tile_rgba((unsigned *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_A1R5G5B5_UNORM:
a1r5g5b5_get_tile_rgba((ushort *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_A4R4G4B4_UNORM:
a4r4g4b4_get_tile_rgba((ushort *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_R5G6B5_UNORM:
r5g6b5_get_tile_rgba((ushort *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_L8_UNORM:
l8_get_tile_rgba((ubyte *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_A8_UNORM:
a8_get_tile_rgba((ubyte *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_I8_UNORM:
i8_get_tile_rgba((ubyte *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_A8L8_UNORM:
a8_l8_get_tile_rgba((ushort *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_R16G16B16A16_SNORM:
r16g16b16a16_get_tile_rgba((short *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_Z16_UNORM:
z16_get_tile_rgba((ushort *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_Z32_UNORM:
z32_get_tile_rgba((unsigned *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_S8Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
s8z24_get_tile_rgba((unsigned *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_Z24S8_UNORM:
z24s8_get_tile_rgba((unsigned *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_YCBCR:
assert((x & 1) == 0);
ycbcr_get_tile_rgba((ushort *) packed, w, h, p, dst_stride, FALSE);
break;
case PIPE_FORMAT_YCBCR_REV:
assert((x & 1) == 0);
ycbcr_get_tile_rgba((ushort *) packed, w, h, p, dst_stride, TRUE);
break;
default:
assert(0);
}
pipe_tile_raw_to_rgba(ps->format, packed, w, h, p, dst_stride);
FREE(packed);
}
@ -792,7 +827,7 @@ pipe_put_tile_rgba(struct pipe_surface *ps,
/*a1r5g5b5_put_tile_rgba((ushort *) packed, w, h, p, src_stride);*/
break;
case PIPE_FORMAT_R5G6B5_UNORM:
r5g5b5_put_tile_rgba((ushort *) packed, w, h, p, src_stride);
r5g6b5_put_tile_rgba((ushort *) packed, w, h, p, src_stride);
break;
case PIPE_FORMAT_R8G8B8A8_UNORM:
assert(0);

View File

@ -87,6 +87,13 @@ pipe_put_tile_z(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const uint *z);
void
pipe_tile_raw_to_rgba(enum pipe_format format,
void *src,
uint w, uint h,
float *dst, unsigned dst_stride);
#ifdef __cplusplus
}
#endif

View File

@ -307,8 +307,10 @@ util_blit_pixels(struct blit_state *ctx,
dstY1 = tmp;
}
assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE));
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE));
assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER, 0));
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER, 0));
if(dst->format == src->format && (dstX1 - dstX0) == srcW && (dstY1 - dstY0) == srcH) {
/* FIXME: this will most surely fail for overlapping rectangles */
@ -319,7 +321,8 @@ util_blit_pixels(struct blit_state *ctx,
return;
}
assert(screen->is_format_supported(screen, dst->format, PIPE_SURFACE));
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
/*
* XXX for now we're always creating a temporary texture.
@ -449,7 +452,8 @@ util_blit_pixels_tex(struct blit_state *ctx,
t0 = srcY0 / (float)tex->height[0];
t1 = srcY1 / (float)tex->height[0];
assert(screen->is_format_supported(screen, dst->format, PIPE_SURFACE));
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
/* save state (restored below) */
cso_save_blend(ctx->cso);

View File

@ -858,7 +858,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
uint zslice = 0;
/* check if we can render in the texture's format */
if (!screen->is_format_supported(screen, pt->format, PIPE_SURFACE)) {
if (!screen->is_format_supported(screen, pt->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
fallback_gen_mipmap(ctx, pt, face, baseLevel, lastLevel);
return;
}

View File

@ -115,23 +115,17 @@ cell_get_paramf(struct pipe_screen *screen, int param)
static boolean
cell_is_format_supported( struct pipe_screen *screen,
enum pipe_format format, uint type )
enum pipe_format format,
enum pipe_texture_target target,
unsigned tex_usage,
unsigned geom_flags )
{
switch (type) {
case PIPE_TEXTURE:
/* cell supports most texture formats, XXX for now anyway */
if (format == PIPE_FORMAT_DXT5_RGBA ||
format == PIPE_FORMAT_R8G8B8A8_SRGB)
return FALSE;
else
return TRUE;
case PIPE_SURFACE:
/* cell supports all (off-screen) surface formats, XXX for now */
return TRUE;
default:
assert(0);
/* cell supports most formats, XXX for now anyway */
if (format == PIPE_FORMAT_DXT5_RGBA ||
format == PIPE_FORMAT_R8G8B8A8_SRGB)
return FALSE;
}
else
return TRUE;
}

View File

@ -148,7 +148,10 @@ i915_get_paramf(struct pipe_screen *screen, int param)
static boolean
i915_is_format_supported( struct pipe_screen *screen,
enum pipe_format format, uint type )
enum pipe_format format,
enum pipe_texture_target target,
unsigned tex_usage,
unsigned geom_flags )
{
static const enum pipe_format tex_supported[] = {
PIPE_FORMAT_R8G8B8A8_UNORM,
@ -173,17 +176,10 @@ i915_is_format_supported( struct pipe_screen *screen,
const enum pipe_format *list;
uint i;
switch (type) {
case PIPE_TEXTURE:
list = tex_supported;
break;
case PIPE_SURFACE:
if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET)
list = surface_supported;
break;
default:
assert(0);
return FALSE;
}
else
list = tex_supported;
for (i = 0; list[i] != PIPE_FORMAT_NONE; i++) {
if (list[i] == format)

View File

@ -136,7 +136,10 @@ brw_get_paramf(struct pipe_screen *screen, int param)
static boolean
brw_is_format_supported( struct pipe_screen *screen,
enum pipe_format format, uint type )
enum pipe_format format,
enum pipe_texture_target target,
unsigned tex_usage,
unsigned geom_flags )
{
#if 0
/* XXX: This is broken -- rewrite if still needed. */

View File

@ -115,18 +115,19 @@ softpipe_get_paramf(struct pipe_screen *screen, int param)
*/
static boolean
softpipe_is_format_supported( struct pipe_screen *screen,
enum pipe_format format, uint type )
enum pipe_format format,
enum pipe_texture_target target,
unsigned tex_usage,
unsigned geom_flags )
{
switch (type) {
case PIPE_TEXTURE:
/* softpipe supports all texture formats */
return TRUE;
case PIPE_SURFACE:
/* softpipe supports all (off-screen) surface formats */
return TRUE;
default:
assert(0);
switch(format) {
case PIPE_FORMAT_DXT1_RGB:
case PIPE_FORMAT_DXT1_RGBA:
case PIPE_FORMAT_DXT3_RGBA:
case PIPE_FORMAT_DXT5_RGBA:
return FALSE;
default:
return TRUE;
}
}

View File

@ -941,6 +941,11 @@ setup_line(struct setup_context *setup,
print_vertex(setup, v1);
#endif
assert(v0[0][0] < 1.0e9);
assert(v0[0][1] < 1.0e9);
assert(v1[0][0] < 1.0e9);
assert(v1[0][1] < 1.0e9);
if (setup->softpipe->no_rast)
return;

View File

@ -166,11 +166,14 @@ enum pipe_texture_target {
#define PIPE_TEX_FACE_NEG_Z 5
#define PIPE_TEX_FACE_MAX 6
/**
* Surfaces, textures, etc. (others may be added)
*/
#define PIPE_TEXTURE 1
#define PIPE_SURFACE 2 /**< user-created surfaces */
#define PIPE_TEXTURE_USAGE_RENDER_TARGET 0x1
#define PIPE_TEXTURE_USAGE_DISPLAY_TARGET 0x2 /* ie a backbuffer */
#define PIPE_TEXTURE_USAGE_PRIMARY 0x4 /* ie a frontbuffer */
#define PIPE_TEXTURE_USAGE_DEPTH_STENCIL 0x8
#define PIPE_TEXTURE_USAGE_SAMPLER 0x10
#define PIPE_TEXTURE_GEOM_NON_SQUARE 0x1
#define PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO 0x2
/**

View File

@ -519,27 +519,16 @@ pf_get_nblocks(const struct pipe_format_block *block, unsigned width, unsigned h
return pf_get_nblocksx(block, width)*pf_get_nblocksy(block, height);
}
static INLINE void
pipe_rect_to_blocks(const struct pipe_format_block *block,
unsigned *width, unsigned *height,
unsigned *src_x, unsigned *src_y,
unsigned *dst_x, unsigned *dst_y)
static INLINE boolean
pf_is_compressed( enum pipe_format format )
{
assert(block->size > 0);
assert(block->width > 0);
assert(block->height > 0);
if(width)
*width = pf_get_nblocksx(block, *width);
if(height)
*height = pf_get_nblocksy(block, *height);
if(src_x)
*src_x /= block->width;
if(src_y)
*src_y /= block->height;
if(dst_x)
*dst_x /= block->width;
if(dst_y)
*dst_y /= block->height;
return pf_layout(format) == PIPE_FORMAT_LAYOUT_DXT ? TRUE : FALSE;
}
static INLINE boolean
pf_is_ycbcr( enum pipe_format format )
{
return pf_layout(format) == PIPE_FORMAT_LAYOUT_YCBCR ? TRUE : FALSE;
}
#ifdef __cplusplus

View File

@ -77,11 +77,14 @@ struct pipe_screen {
/**
* Check if the given pipe_format is supported as a texture or
* drawing surface.
* \param type one of PIPE_TEXTURE, PIPE_SURFACE
* \param tex_usage bitmask of PIPE_TEXTURE_USAGE_*
* \param flags bitmask of PIPE_TEXTURE_GEOM_*
*/
boolean (*is_format_supported)( struct pipe_screen *,
enum pipe_format format,
uint type );
enum pipe_format format,
enum pipe_texture_target target,
unsigned tex_usage,
unsigned geom_flags );
/**
* Create a new texture object, using the given template info.

View File

@ -287,12 +287,6 @@ struct pipe_surface
};
#define PIPE_TEXTURE_USAGE_RENDER_TARGET 0x1
#define PIPE_TEXTURE_USAGE_DISPLAY_TARGET 0x2 /* ie a backbuffer */
#define PIPE_TEXTURE_USAGE_PRIMARY 0x4 /* ie a frontbuffer */
#define PIPE_TEXTURE_USAGE_DEPTH_STENCIL 0x8
#define PIPE_TEXTURE_USAGE_SAMPLER 0x10
/**
* Texture object.
*/

View File

@ -1,24 +1,34 @@
import sys
import os.path
Import('*')
if 'python' in env['statetrackers']:
env = env.Clone()
env.Append(CPPPATH = '.')
env.Tool('python')
env.Tool('swig')
env.Append(SWIGPATH = ['#src/gallium/include', '#src/gallium/include/pipe'])
env.Append(SWIGFLAGS = ['-python', '-keyword'])
env.ParseConfig('python-config --cflags --ldflags --libs')
env.SharedLibrary(
target = '_gallium',
source = [
'gallium.i',
env.Append(CPPPATH = '.')
pyst = env.ConvenienceLibrary(
target = 'pyst',
source = [
'gallium.i',
'st_device.c',
'st_sample.c',
'st_softpipe_winsys.c',
],
SHLIBPREFIX = '',
LIBS = softpipe + auxiliaries + env['LIBS'],
],
)
env.SharedLibrary(
target = '_gallium',
source = [
'st_hardpipe_winsys.c',
],
LIBS = [pyst, softpipe] + auxiliaries + env['LIBS'],
)

View File

@ -44,15 +44,19 @@
#include "pipe/p_inlines.h"
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
#include "cso_cache/cso_context.h"
#include "util/u_draw_quad.h"
#include "util/p_tile.h"
#include "cso_cache/cso_context.h"
#include "tgsi/util/tgsi_text.h"
#include "tgsi/util/tgsi_dump.h"
#include "st_device.h"
#include "st_sample.h"
%}
%include "carrays.i"
%array_class(unsigned char, ByteArray);
%array_class(int, IntArray);
%array_class(float, FloatArray);
@ -63,6 +67,7 @@
%rename(Surface) pipe_surface;
%rename(Buffer) pipe_buffer;
%rename(BlendColor) pipe_blend_color;
%rename(Blend) pipe_blend_state;
%rename(Clip) pipe_clip_state;
@ -79,15 +84,30 @@
%rename(VertexElement) pipe_vertex_element;
%rename(Viewport) pipe_viewport_state;
%nodefaultctor st_device;
%nodefaultctor st_context;
%nodefaultctor pipe_texture;
%nodefaultctor pipe_surface;
%nodefaultctor pipe_buffer;
%nodefaultdtor st_device;
%nodefaultdtor st_context;
%nodefaultdtor pipe_texture;
%nodefaultdtor pipe_surface;
%nodefaultdtor pipe_buffer;
%ignore pipe_texture::screen;
%ignore pipe_surface::winsys;
%immutable pipe_surface::texture;
%immutable pipe_surface::buffer;
%include "p_format.i";
%include "pipe/p_defines.h";
%include "pipe/p_state.h";
%include "pipe/p_shader_tokens.h";
%nodefaultctor;
%nodefaultdtor;
struct st_device {
};
@ -95,9 +115,13 @@ struct st_context {
};
%newobject st_device::texture_create;
%newobject st_device::context_create;
%newobject st_device::buffer_create;
%extend st_device {
st_device(int hardware = 0) {
st_device(int hardware = 1) {
return st_device_create(hardware ? TRUE : FALSE);
}
@ -134,8 +158,15 @@ struct st_context {
* drawing surface.
* \param type one of PIPE_TEXTURE, PIPE_SURFACE
*/
int is_format_supported( enum pipe_format format, unsigned type ) {
return $self->screen->is_format_supported( $self->screen, format, type);
int is_format_supported( enum pipe_format format,
enum pipe_texture_target target,
unsigned tex_usage,
unsigned geom_flags ) {
return $self->screen->is_format_supported( $self->screen,
format,
target,
tex_usage,
geom_flags );
}
struct st_context *
@ -151,7 +182,7 @@ struct st_context {
unsigned depth = 1,
unsigned last_level = 0,
enum pipe_texture_target target = PIPE_TEXTURE_2D,
unsigned usage = 0
unsigned tex_usage = 0
) {
struct pipe_texture templat;
memset(&templat, 0, sizeof(templat));
@ -162,7 +193,7 @@ struct st_context {
templat.depth[0] = depth;
templat.last_level = last_level;
templat.target = target;
templat.tex_usage = usage;
templat.tex_usage = tex_usage;
return $self->screen->texture_create($self->screen, &templat);
}
@ -201,29 +232,32 @@ struct st_context {
cso_set_depth_stencil_alpha($self->cso, state);
}
void * create_fs( const struct pipe_shader_state *state ) {
return $self->pipe->create_fs_state($self->pipe, state);
}
void bind_fs( void *state_obj ) {
$self->pipe->bind_fs_state($self->pipe, state_obj);
}
void delete_fs( void *state_obj ) {
$self->pipe->delete_fs_state($self->pipe, state_obj);
void set_fragment_shader( const struct pipe_shader_state *state ) {
void *fs;
fs = $self->pipe->create_fs_state($self->pipe, state);
if(!fs)
return;
if(cso_set_fragment_shader_handle($self->cso, fs) != PIPE_OK)
return;
cso_delete_fragment_shader($self->cso, $self->fs);
$self->fs = fs;
}
void * create_vs( const struct pipe_shader_state *state ) {
return $self->pipe->create_vs_state($self->pipe, state);
}
void bind_vs( void *state_obj ) {
$self->pipe->bind_vs_state($self->pipe, state_obj);
}
void delete_vs( void *state_obj ) {
$self->pipe->delete_vs_state($self->pipe, state_obj);
void set_vertex_shader( const struct pipe_shader_state *state ) {
void *vs;
vs = $self->pipe->create_vs_state($self->pipe, state);
if(!vs)
return;
if(cso_set_vertex_shader_handle($self->cso, vs) != PIPE_OK)
return;
cso_delete_vertex_shader($self->cso, $self->vs);
$self->vs = vs;
}
/*
@ -261,6 +295,8 @@ struct st_context {
void set_sampler_texture(unsigned index,
struct pipe_texture *texture) {
if(!texture)
texture = $self->default_texture;
pipe_texture_reference(&$self->sampler_textures[index], texture);
$self->pipe->set_sampler_textures($self->pipe,
PIPE_MAX_SAMPLERS,
@ -327,10 +363,6 @@ error1:
;
}
void draw_quad(float x0, float y0, float x1, float y1, float z = 0.0f) {
util_draw_texquad($self->pipe, x0, y0, x1, y1, z);
}
void
flush(void) {
struct pipe_fence_handle *fence = NULL;
@ -360,13 +392,15 @@ error1:
$self->pipe->surface_fill($self->pipe, dst, x, y, width, height, value);
}
void clear(struct pipe_surface *surface, unsigned value) {
void surface_clear(struct pipe_surface *surface, unsigned value = 0) {
$self->pipe->clear($self->pipe, surface, value);
}
};
%newobject pipe_texture::get_surface;
%extend pipe_texture {
~pipe_texture() {
@ -374,6 +408,26 @@ error1:
pipe_texture_reference(&ptr, NULL);
}
unsigned get_width(unsigned level=0) {
return $self->width[level];
}
unsigned get_height(unsigned level=0) {
return $self->height[level];
}
unsigned get_depth(unsigned level=0) {
return $self->depth[level];
}
unsigned get_nblocksx(unsigned level=0) {
return $self->nblocksx[level];
}
unsigned get_nblocksy(unsigned level=0) {
return $self->nblocksy[level];
}
/** Get a surface which is a "view" into a texture */
struct pipe_surface *
get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0, unsigned usage=0 )
@ -399,13 +453,23 @@ error1:
void unmap( void );
void
get_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, float *p) {
pipe_get_tile_rgba($self, x, y, w, h, p);
get_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, unsigned char *raw, unsigned stride) {
pipe_get_tile_raw($self, x, y, w, h, raw, stride);
}
void
put_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *p) {
pipe_put_tile_rgba($self, x, y, w, h, p);
put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const unsigned char *raw, unsigned stride) {
pipe_put_tile_raw($self, x, y, w, h, raw, stride);
}
void
get_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, float *rgba) {
pipe_get_tile_rgba($self, x, y, w, h, rgba);
}
void
put_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba) {
pipe_put_tile_rgba($self, x, y, w, h, rgba);
}
void
@ -418,6 +482,43 @@ error1:
pipe_put_tile_z($self, x, y, w, h, z);
}
void
sample_rgba(float *rgba) {
st_sample_surface($self, rgba);
}
unsigned
compare_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba, float tol = 0.0)
{
float *rgba2;
const float *p1;
const float *p2;
unsigned i, j, n;
rgba2 = MALLOC(h*w*4*sizeof(float));
if(!rgba2)
return ~0;
pipe_get_tile_rgba($self, x, y, w, h, rgba2);
p1 = rgba;
p2 = rgba2;
n = 0;
for(i = h*w; i; --i) {
unsigned differs = 0;
for(j = 4; j; --j) {
float delta = *p2++ - *p1++;
if (delta < -tol || delta > tol)
differs = 1;
}
n += differs;
}
FREE(rgba2);
return n;
}
};
@ -446,3 +547,42 @@ error1:
}
};
%extend pipe_shader_state {
pipe_shader_state(const char *text, unsigned num_tokens = 1024) {
struct tgsi_token *tokens;
struct pipe_shader_state *shader;
tokens = MALLOC(num_tokens * sizeof(struct tgsi_token));
if(!tokens)
goto error1;
if(tgsi_text_translate(text, tokens, num_tokens ) != TRUE)
goto error2;
shader = CALLOC_STRUCT(pipe_shader_state);
if(!shader)
goto error3;
shader->tokens = tokens;
return shader;
error3:
error2:
FREE(tokens);
error1:
return NULL;
}
~pipe_shader_state() {
FREE((void*)$self->tokens);
FREE($self);
}
void dump(unsigned flags = 0) {
tgsi_dump($self->tokens, flags);
}
}

View File

@ -30,7 +30,7 @@
from gallium import *
def save_image(filename, surface):
def make_image(surface):
pixels = FloatArray(surface.height*surface.width*4)
surface.get_tile_rgba(0, 0, surface.width, surface.height, pixels)
@ -45,14 +45,38 @@ def save_image(filename, surface):
offset = (y*surface.width + x)*4
r, g, b, a = [int(pixels[offset + ch]*255) for ch in range(4)]
outpixels[x, y] = r, g, b
return outimage
def save_image(filename, surface):
outimage = make_image(surface)
outimage.save(filename, "PNG")
def show_image(surface):
outimage = make_image(surface)
import Tkinter as tk
from PIL import Image, ImageTk
root = tk.Tk()
root.title('background image')
image1 = ImageTk.PhotoImage(outimage)
w = image1.width()
h = image1.height()
x = 100
y = 100
root.geometry("%dx%d+%d+%d" % (w, h, x, y))
panel1 = tk.Label(root, image=image1)
panel1.pack(side='top', fill='both', expand='yes')
panel1.image = image1
root.mainloop()
def test(dev):
ctx = dev.context_create()
width = 256
height = 256
width = 255
height = 255
# disabled blending/masking
blend = Blend()
@ -72,6 +96,7 @@ def test(dev):
rasterizer.front_winding = PIPE_WINDING_CW
rasterizer.cull_mode = PIPE_WINDING_NONE
rasterizer.bypass_clipping = 1
rasterizer.scissor = 1
#rasterizer.bypass_vs = 1
ctx.set_rasterizer(rasterizer)
@ -102,55 +127,102 @@ def test(dev):
sampler.normalized_coords = 1
ctx.set_sampler(0, sampler)
# texture
texture = dev.texture_create(PIPE_FORMAT_A8R8G8B8_UNORM, width, height, usage=PIPE_TEXTURE_USAGE_RENDER_TARGET)
ctx.set_sampler_texture(0, texture)
# scissor
scissor = Scissor()
scissor.minx = 0
scissor.miny = 0
scissor.maxx = width
scissor.maxy = height
ctx.set_scissor(scissor)
# drawing dest
surface = texture.get_surface(usage = PIPE_BUFFER_USAGE_GPU_WRITE)
clip = Clip()
clip.nr = 0
ctx.set_clip(clip)
# framebuffer
cbuf = dev.texture_create(
PIPE_FORMAT_X8R8G8B8_UNORM,
width, height,
tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET,
)
_cbuf = cbuf.get_surface(usage = PIPE_BUFFER_USAGE_GPU_READ|PIPE_BUFFER_USAGE_GPU_WRITE)
fb = Framebuffer()
fb.width = surface.width
fb.height = surface.height
fb.width = width
fb.height = height
fb.num_cbufs = 1
fb.set_cbuf(0, surface)
fb.set_cbuf(0, _cbuf)
ctx.set_framebuffer(fb)
_cbuf.clear_value = 0x00000000
ctx.surface_clear(_cbuf, _cbuf.clear_value)
del _cbuf
# vertex shader
# vs = Shader()
#ctx.set_vertex_shader(vs)
vs = Shader('''
VERT1.1
DCL IN[0], POSITION, CONSTANT
DCL IN[1], COLOR, CONSTANT
DCL OUT[0], POSITION, CONSTANT
DCL OUT[1], COLOR, CONSTANT
0:MOV OUT[0], IN[0]
1:MOV OUT[1], IN[1]
2:END
''')
#vs.dump()
ctx.set_vertex_shader(vs)
# fragment shader
#fs = Shader()
#ctx.set_fragment_shader(fs)
fs = Shader('''
FRAG1.1
DCL IN[0], COLOR, LINEAR
DCL OUT[0], COLOR, CONSTANT
0:MOV OUT[0], IN[0]
1:END
''')
#fs.dump()
ctx.set_fragment_shader(fs)
if 0:
nverts = 4
nattrs = 1
vertices = FloatArray(n_verts * nattrs * 4)
nverts = 3
nattrs = 2
verts = FloatArray(nverts * nattrs * 4)
# init vertex data that doesn't change
for i in range(nverts):
for j in range(nattrs):
vertices[(i*nattrs +j)*4 + 0] = 0.0
vertices[(i*nattrs +j)*4 + 1] = 0.0
vertices[(i*nattrs +j)*4 + 2] = 0.0
vertices[(i*nattrs +j)*4 + 3] = 0.0
verts[ 0] = 128.0 # x1
verts[ 1] = 32.0 # y1
verts[ 2] = 0.0 # z1
verts[ 3] = 1.0 # w1
verts[ 4] = 1.0 # r1
verts[ 5] = 0.0 # g1
verts[ 6] = 0.0 # b1
verts[ 7] = 1.0 # a1
verts[ 8] = 32.0 # x2
verts[ 9] = 224.0 # y2
verts[10] = 0.0 # z2
verts[11] = 1.0 # w2
verts[12] = 0.0 # r2
verts[13] = 1.0 # g2
verts[14] = 0.0 # b2
verts[15] = 1.0 # a2
verts[16] = 224.0 # x3
verts[17] = 224.0 # y3
verts[18] = 0.0 # z3
verts[19] = 1.0 # w3
verts[20] = 0.0 # r3
verts[21] = 0.0 # g3
verts[22] = 1.0 # b3
verts[23] = 1.0 # a3
ctx.draw_vertices(PIPE_PRIM_TRIANGLE_FAN,
4, # verts
2, # attribs/vert
vertices)
else:
ctx.draw_quad(32.0, 32.0, 224.0, 224.0)
ctx.draw_vertices(PIPE_PRIM_TRIANGLES,
nverts,
nattrs,
verts)
ctx.flush()
save_image("simple.png", surface)
show_image(cbuf.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE))
def main():
dev = Device(0)
dev = Device()
test(dev)

View File

@ -70,6 +70,7 @@ st_device_create_from_st_winsys(const struct st_winsys *st_ws)
if(!st_dev)
return NULL;
st_dev->refcount = 1;
st_dev->st_ws = st_ws;
st_dev->screen = st_ws->screen_create();
@ -82,12 +83,10 @@ st_device_create_from_st_winsys(const struct st_winsys *st_ws)
struct st_device *
st_device_create(boolean hardware) {
#if 0
if(hardware)
return st_device_create_from_st_winsys(&st_hardware_winsys);
return st_device_create_from_st_winsys(&st_hardpipe_winsys);
else
#endif
return st_device_create_from_st_winsys(&st_software_winsys);
return st_device_create_from_st_winsys(&st_softpipe_winsys);
}
@ -99,25 +98,20 @@ st_context_destroy(struct st_context *st_ctx)
if(st_ctx) {
struct st_device *st_dev = st_ctx->st_dev;
if(st_ctx->vs) {
st_ctx->pipe->bind_vs_state(st_ctx->pipe, NULL);
st_ctx->pipe->delete_vs_state(st_ctx->pipe, st_ctx->vs);
}
if(st_ctx->fs) {
st_ctx->pipe->bind_fs_state(st_ctx->pipe, NULL);
st_ctx->pipe->delete_fs_state(st_ctx->pipe, st_ctx->fs);
}
if(st_ctx->cso)
if(st_ctx->cso) {
cso_delete_vertex_shader(st_ctx->cso, st_ctx->vs);
cso_delete_fragment_shader(st_ctx->cso, st_ctx->fs);
cso_destroy_context(st_ctx->cso);
}
if(st_ctx->pipe)
st_ctx->st_dev->st_ws->context_destroy(st_ctx->pipe);
for(i = 0; i < PIPE_MAX_SAMPLERS; ++i)
pipe_texture_reference(&st_ctx->sampler_textures[i], NULL);
pipe_texture_reference(&st_ctx->default_texture, NULL);
FREE(st_ctx);
if(!--st_dev->refcount)
@ -146,8 +140,111 @@ st_context_create(struct st_device *st_dev)
if(!st_ctx->cso)
st_context_destroy(st_ctx);
/* disabled blending/masking */
{
struct pipe_blend_state blend;
memset(&blend, 0, sizeof(blend));
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
blend.colormask = PIPE_MASK_RGBA;
cso_set_blend(st_ctx->cso, &blend);
}
/* no-op depth/stencil/alpha */
{
struct pipe_depth_stencil_alpha_state depthstencil;
memset(&depthstencil, 0, sizeof(depthstencil));
cso_set_depth_stencil_alpha(st_ctx->cso, &depthstencil);
}
/* rasterizer */
{
struct pipe_rasterizer_state rasterizer;
memset(&rasterizer, 0, sizeof(rasterizer));
rasterizer.front_winding = PIPE_WINDING_CW;
rasterizer.cull_mode = PIPE_WINDING_NONE;
rasterizer.bypass_clipping = 1;
/*rasterizer.bypass_vs = 1;*/
cso_set_rasterizer(st_ctx->cso, &rasterizer);
}
/* identity viewport */
{
struct pipe_viewport_state viewport;
viewport.scale[0] = 1.0;
viewport.scale[1] = 1.0;
viewport.scale[2] = 1.0;
viewport.scale[3] = 1.0;
viewport.translate[0] = 0.0;
viewport.translate[1] = 0.0;
viewport.translate[2] = 0.0;
viewport.translate[3] = 0.0;
cso_set_viewport(st_ctx->cso, &viewport);
}
/* samplers */
{
struct pipe_sampler_state sampler;
unsigned i;
memset(&sampler, 0, sizeof(sampler));
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST;
sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST;
sampler.normalized_coords = 1;
for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
cso_single_sampler(st_ctx->cso, i, &sampler);
cso_single_sampler_done(st_ctx->cso);
}
/* default textures */
{
struct pipe_screen *screen = st_dev->screen;
struct pipe_texture templat;
struct pipe_surface *surface;
unsigned i;
memset( &templat, 0, sizeof( templat ) );
templat.target = PIPE_TEXTURE_2D;
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
templat.block.size = 4;
templat.block.width = 1;
templat.block.height = 1;
templat.width[0] = 1;
templat.height[0] = 1;
templat.depth[0] = 1;
templat.last_level = 0;
st_ctx->default_texture = screen->texture_create( screen, &templat );
if(st_ctx->default_texture) {
surface = screen->get_tex_surface( screen,
st_ctx->default_texture, 0, 0, 0,
PIPE_BUFFER_USAGE_CPU_WRITE );
if(surface) {
uint32_t *map;
map = (uint32_t *) pipe_surface_map(surface, PIPE_BUFFER_USAGE_CPU_WRITE );
if(map) {
*map = 0x00000000;
pipe_surface_unmap( surface );
}
pipe_surface_reference(&surface, NULL);
}
}
for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
pipe_texture_reference(&st_ctx->sampler_textures[i], st_ctx->default_texture);
cso_set_sampler_textures(st_ctx->cso, PIPE_MAX_SAMPLERS, st_ctx->sampler_textures);
}
/* vertex shader */
{
struct pipe_shader_state vert_shader;
const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
TGSI_SEMANTIC_GENERIC };
const uint semantic_indexes[] = { 0, 0 };
@ -155,15 +252,17 @@ st_context_create(struct st_device *st_dev)
2,
semantic_names,
semantic_indexes,
&st_ctx->vert_shader);
&vert_shader);
cso_set_vertex_shader_handle(st_ctx->cso, st_ctx->vs);
}
/* fragment shader */
st_ctx->fs = util_make_fragment_passthrough_shader(st_ctx->pipe,
&st_ctx->frag_shader);
st_ctx->pipe->bind_fs_state(st_ctx->pipe, st_ctx->fs);
st_ctx->pipe->bind_vs_state(st_ctx->pipe, st_ctx->vs);
{
struct pipe_shader_state frag_shader;
st_ctx->fs = util_make_fragment_passthrough_shader(st_ctx->pipe,
&frag_shader);
cso_set_fragment_shader_handle(st_ctx->cso, st_ctx->fs);
}
return st_ctx;
}

View File

@ -45,12 +45,10 @@ struct st_context {
struct cso_context *cso;
struct pipe_shader_state vert_shader;
struct pipe_shader_state frag_shader;
void *vs;
void *fs;
struct pipe_texture *default_texture;
struct pipe_texture *sampler_textures[PIPE_MAX_SAMPLERS];
struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS];

View File

@ -0,0 +1,78 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Bismarck, ND., USA
* 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, sub license, 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 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
*
**************************************************************************/
/**
* @file
* Stub for hardware pipe driver support.
*/
#include "pipe/p_compiler.h"
#include "st_winsys.h"
/* XXX: Force init_gallium symbol to be linked */
extern void init_gallium(void);
void (*force_init_gallium_linkage)(void) = &init_gallium;
static void
st_hardpipe_screen_destroy(struct pipe_screen *screen)
{
st_softpipe_winsys.screen_destroy(screen);
}
static struct pipe_screen *
st_hardpipe_screen_create(void)
{
return st_softpipe_winsys.screen_create();
}
static void
st_hardpipe_context_destroy(struct pipe_context *pipe)
{
st_softpipe_winsys.context_destroy(pipe);
}
static struct pipe_context *
st_hardpipe_context_create(struct pipe_screen *screen)
{
return st_softpipe_winsys.context_create(screen);
}
const struct st_winsys st_hardpipe_winsys = {
&st_hardpipe_screen_create,
&st_hardpipe_screen_destroy,
&st_hardpipe_context_create,
&st_hardpipe_context_destroy
};

View File

@ -0,0 +1,548 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
*
**************************************************************************/
#include "pipe/p_compiler.h"
#include "pipe/p_format.h"
#include "pipe/p_state.h"
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "util/p_tile.h"
#include "st_sample.h"
/**
* Use our own pseudo random generator to ensure consistent runs among
* multiple runs and platforms.
*
* @sa http://en.wikipedia.org/wiki/Linear_congruential_generator
*/
static uint32_t st_random(void) {
static uint64_t seed = UINT64_C(0xbb9a063afb0a739d);
seed = UINT64_C(134775813) * seed + UINT64_C(1);
return (uint16_t)(seed >> 32);
}
/**
* We don't want to include the patent-encumbered DXT code here, so instead
* we store several uncompressed/compressed data pairs for hardware testing
* purposes.
*/
struct dxt_data
{
uint8_t rgba[16*4];
uint8_t raw[16];
};
static const struct dxt_data
dxt1_rgb_data[] = {
{
{
0x99, 0xb0, 0x8e, 0xff,
0x5d, 0x62, 0x89, 0xff,
0x99, 0xb0, 0x8e, 0xff,
0x99, 0xb0, 0x8e, 0xff,
0xd6, 0xff, 0x94, 0xff,
0x5d, 0x62, 0x89, 0xff,
0x99, 0xb0, 0x8e, 0xff,
0xd6, 0xff, 0x94, 0xff,
0x5d, 0x62, 0x89, 0xff,
0x5d, 0x62, 0x89, 0xff,
0x99, 0xb0, 0x8e, 0xff,
0x21, 0x14, 0x84, 0xff,
0x5d, 0x62, 0x89, 0xff,
0x21, 0x14, 0x84, 0xff,
0x21, 0x14, 0x84, 0xff,
0x99, 0xb0, 0x8e, 0xff
},
{0xf2, 0xd7, 0xb0, 0x20, 0xae, 0x2c, 0x6f, 0x97}
},
{
{
0xb5, 0xcf, 0x9c, 0xff,
0x83, 0x8c, 0x8b, 0xff,
0x21, 0x08, 0x6b, 0xff,
0x83, 0x8c, 0x8b, 0xff,
0x52, 0x4a, 0x7b, 0xff,
0x83, 0x8c, 0x8b, 0xff,
0x83, 0x8c, 0x8b, 0xff,
0xb5, 0xcf, 0x9c, 0xff,
0x21, 0x08, 0x6b, 0xff,
0xb5, 0xcf, 0x9c, 0xff,
0x83, 0x8c, 0x8b, 0xff,
0x52, 0x4a, 0x7b, 0xff,
0xb5, 0xcf, 0x9c, 0xff,
0x83, 0x8c, 0x8b, 0xff,
0x52, 0x4a, 0x7b, 0xff,
0x83, 0x8c, 0x8b, 0xff
},
{0x73, 0xb6, 0x4d, 0x20, 0x98, 0x2b, 0xe1, 0xb8}
},
{
{
0x00, 0x2c, 0xff, 0xff,
0x94, 0x8d, 0x7b, 0xff,
0x4a, 0x5c, 0xbd, 0xff,
0x4a, 0x5c, 0xbd, 0xff,
0x4a, 0x5c, 0xbd, 0xff,
0x94, 0x8d, 0x7b, 0xff,
0x94, 0x8d, 0x7b, 0xff,
0x94, 0x8d, 0x7b, 0xff,
0xde, 0xbe, 0x39, 0xff,
0x94, 0x8d, 0x7b, 0xff,
0xde, 0xbe, 0x39, 0xff,
0xde, 0xbe, 0x39, 0xff,
0xde, 0xbe, 0x39, 0xff,
0xde, 0xbe, 0x39, 0xff,
0xde, 0xbe, 0x39, 0xff,
0x94, 0x8d, 0x7b, 0xff
},
{0xe7, 0xdd, 0x7f, 0x01, 0xf9, 0xab, 0x08, 0x80}
},
{
{
0x6b, 0x24, 0x21, 0xff,
0x7b, 0x4f, 0x5d, 0xff,
0x7b, 0x4f, 0x5d, 0xff,
0x8b, 0x7a, 0x99, 0xff,
0x7b, 0x4f, 0x5d, 0xff,
0x7b, 0x4f, 0x5d, 0xff,
0x6b, 0x24, 0x21, 0xff,
0x8b, 0x7a, 0x99, 0xff,
0x9c, 0xa6, 0xd6, 0xff,
0x6b, 0x24, 0x21, 0xff,
0x7b, 0x4f, 0x5d, 0xff,
0x8b, 0x7a, 0x99, 0xff,
0x6b, 0x24, 0x21, 0xff,
0x8b, 0x7a, 0x99, 0xff,
0x7b, 0x4f, 0x5d, 0xff,
0x9c, 0xa6, 0xd6, 0xff
},
{0x3a, 0x9d, 0x24, 0x69, 0xbd, 0x9f, 0xb4, 0x39}
}
};
static const struct dxt_data
dxt1_rgba_data[] = {
{
{
0x00, 0x00, 0x00, 0x00,
0x4e, 0xaa, 0x90, 0xff,
0x4e, 0xaa, 0x90, 0xff,
0x00, 0x00, 0x00, 0x00,
0x4e, 0xaa, 0x90, 0xff,
0x29, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00,
0x4e, 0xaa, 0x90, 0xff,
0x73, 0x55, 0x21, 0xff,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x4e, 0xaa, 0x90, 0xff,
0x4e, 0xaa, 0x90, 0xff,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x4e, 0xaa, 0x90, 0xff
},
{0xff, 0x2f, 0xa4, 0x72, 0xeb, 0xb2, 0xbd, 0xbe}
},
{
{
0xb5, 0xe3, 0x63, 0xff,
0x00, 0x00, 0x00, 0x00,
0x6b, 0x24, 0x84, 0xff,
0xb5, 0xe3, 0x63, 0xff,
0x00, 0x00, 0x00, 0x00,
0xb5, 0xe3, 0x63, 0xff,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x6b, 0x24, 0x84, 0xff,
0x6b, 0x24, 0x84, 0xff,
0x00, 0x00, 0x00, 0x00,
0xb5, 0xe3, 0x63, 0xff,
0x90, 0x83, 0x73, 0xff,
0xb5, 0xe3, 0x63, 0xff
},
{0x30, 0x69, 0x0c, 0xb7, 0x4d, 0xf7, 0x0f, 0x67}
},
{
{
0x00, 0x00, 0x00, 0x00,
0xc6, 0x86, 0x8c, 0xff,
0xc6, 0x86, 0x8c, 0xff,
0x21, 0x65, 0x42, 0xff,
0x21, 0x65, 0x42, 0xff,
0x21, 0x65, 0x42, 0xff,
0x21, 0x65, 0x42, 0xff,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x21, 0x65, 0x42, 0xff,
0xc6, 0x86, 0x8c, 0xff,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xc6, 0x86, 0x8c, 0xff
},
{0x28, 0x23, 0x31, 0xc4, 0x17, 0xc0, 0xd3, 0x7f}
},
{
{
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xc6, 0xe3, 0x9c, 0xff,
0x7b, 0x1c, 0x52, 0xff,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x7b, 0x1c, 0x52, 0xff,
0x00, 0x00, 0x00, 0x00,
0x7b, 0x1c, 0x52, 0xff,
0xa0, 0x7f, 0x77, 0xff,
0xc6, 0xe3, 0x9c, 0xff,
0x00, 0x00, 0x00, 0x00,
0xa0, 0x7f, 0x77, 0xff
},
{0xea, 0x78, 0x13, 0xc7, 0x7f, 0xfc, 0x33, 0xb6}
},
};
static const struct dxt_data
dxt3_rgba_data[] = {
{
{
0x6d, 0xc6, 0x96, 0x77,
0x6d, 0xc6, 0x96, 0xee,
0x6d, 0xc6, 0x96, 0xaa,
0x8c, 0xff, 0xb5, 0x44,
0x6d, 0xc6, 0x96, 0xff,
0x6d, 0xc6, 0x96, 0x88,
0x31, 0x55, 0x5a, 0x66,
0x6d, 0xc6, 0x96, 0x99,
0x31, 0x55, 0x5a, 0xbb,
0x31, 0x55, 0x5a, 0x55,
0x31, 0x55, 0x5a, 0x11,
0x6d, 0xc6, 0x96, 0xcc,
0x6d, 0xc6, 0x96, 0xcc,
0x6d, 0xc6, 0x96, 0x11,
0x31, 0x55, 0x5a, 0x44,
0x31, 0x55, 0x5a, 0x88
},
{0xe7, 0x4a, 0x8f, 0x96, 0x5b, 0xc1, 0x1c, 0x84, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a}
},
{
{
0xad, 0xeb, 0x73, 0x99,
0x97, 0xaa, 0x86, 0x66,
0x6b, 0x28, 0xad, 0x99,
0xad, 0xeb, 0x73, 0x99,
0x6b, 0x28, 0xad, 0x22,
0xad, 0xeb, 0x73, 0xff,
0x97, 0xaa, 0x86, 0x55,
0x6b, 0x28, 0xad, 0x55,
0x6b, 0x28, 0xad, 0x44,
0xad, 0xeb, 0x73, 0x33,
0x6b, 0x28, 0xad, 0xee,
0x6b, 0x28, 0xad, 0x99,
0x97, 0xaa, 0x86, 0x66,
0xad, 0xeb, 0x73, 0xbb,
0x97, 0xaa, 0x86, 0x99,
0xad, 0xeb, 0x73, 0xbb
},
{0x69, 0x99, 0xf2, 0x55, 0x34, 0x9e, 0xb6, 0xb9, 0x4e, 0xaf, 0x55, 0x69, 0x18, 0x61, 0x51, 0x22}
},
{
{
0x63, 0xd7, 0xd6, 0x00,
0x57, 0x62, 0x5d, 0xdd,
0x57, 0x62, 0x5d, 0xcc,
0x57, 0x62, 0x5d, 0xbb,
0x52, 0x28, 0x21, 0xaa,
0x57, 0x62, 0x5d, 0xcc,
0x57, 0x62, 0x5d, 0xcc,
0x57, 0x62, 0x5d, 0x66,
0x57, 0x62, 0x5d, 0x22,
0x57, 0x62, 0x5d, 0xdd,
0x63, 0xd7, 0xd6, 0xee,
0x57, 0x62, 0x5d, 0x33,
0x63, 0xd7, 0xd6, 0x55,
0x52, 0x28, 0x21, 0x55,
0x57, 0x62, 0x5d, 0x11,
0x5d, 0x9c, 0x99, 0xee
},
{0xd0, 0xbc, 0xca, 0x6c, 0xd2, 0x3e, 0x55, 0xe1, 0xba, 0x66, 0x44, 0x51, 0xfc, 0xfd, 0xcf, 0xb4}
},
{
{
0x94, 0x6f, 0x60, 0x22,
0x94, 0x6f, 0x60, 0x22,
0xc5, 0xab, 0x76, 0x11,
0xc5, 0xab, 0x76, 0xee,
0x63, 0x34, 0x4a, 0xdd,
0x63, 0x34, 0x4a, 0x33,
0x94, 0x6f, 0x60, 0x77,
0xf7, 0xe7, 0x8c, 0x00,
0x94, 0x6f, 0x60, 0x33,
0x63, 0x34, 0x4a, 0xaa,
0x94, 0x6f, 0x60, 0x77,
0x63, 0x34, 0x4a, 0xcc,
0x94, 0x6f, 0x60, 0xaa,
0xf7, 0xe7, 0x8c, 0x99,
0x63, 0x34, 0x4a, 0x44,
0xc5, 0xab, 0x76, 0xaa
},
{0x22, 0xe1, 0x3d, 0x07, 0xa3, 0xc7, 0x9a, 0xa4, 0x31, 0xf7, 0xa9, 0x61, 0xaf, 0x35, 0x77, 0x93}
},
};
static const struct dxt_data
dxt5_rgba_data[] = {
{
{
0x6d, 0xc6, 0x96, 0x74,
0x6d, 0xc6, 0x96, 0xf8,
0x6d, 0xc6, 0x96, 0xb6,
0x8c, 0xff, 0xb5, 0x53,
0x6d, 0xc6, 0x96, 0xf8,
0x6d, 0xc6, 0x96, 0x95,
0x31, 0x55, 0x5a, 0x53,
0x6d, 0xc6, 0x96, 0x95,
0x31, 0x55, 0x5a, 0xb6,
0x31, 0x55, 0x5a, 0x53,
0x31, 0x55, 0x5a, 0x11,
0x6d, 0xc6, 0x96, 0xd7,
0x6d, 0xc6, 0x96, 0xb6,
0x6d, 0xc6, 0x96, 0x11,
0x31, 0x55, 0x5a, 0x32,
0x31, 0x55, 0x5a, 0x95
},
{0xf8, 0x11, 0xc5, 0x0c, 0x9a, 0x73, 0xb4, 0x9c, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a}
},
{
{
0xad, 0xeb, 0x73, 0xa1,
0x97, 0xaa, 0x86, 0x65,
0x6b, 0x28, 0xad, 0xa1,
0xad, 0xeb, 0x73, 0xa1,
0x6b, 0x28, 0xad, 0x2a,
0xad, 0xeb, 0x73, 0xfb,
0x97, 0xaa, 0x86, 0x47,
0x6b, 0x28, 0xad, 0x65,
0x6b, 0x28, 0xad, 0x47,
0xad, 0xeb, 0x73, 0x47,
0x6b, 0x28, 0xad, 0xdd,
0x6b, 0x28, 0xad, 0xa1,
0x97, 0xaa, 0x86, 0x65,
0xad, 0xeb, 0x73, 0xbf,
0x97, 0xaa, 0x86, 0xa1,
0xad, 0xeb, 0x73, 0xbf
},
{0xfb, 0x2a, 0x34, 0x19, 0xdc, 0xbf, 0xe8, 0x71, 0x4e, 0xaf, 0x55, 0x69, 0x18, 0x61, 0x51, 0x22}
},
{
{
0x63, 0xd7, 0xd6, 0x00,
0x57, 0x62, 0x5d, 0xf5,
0x57, 0x62, 0x5d, 0xd2,
0x57, 0x62, 0x5d, 0xaf,
0x52, 0x28, 0x21, 0xaf,
0x57, 0x62, 0x5d, 0xd2,
0x57, 0x62, 0x5d, 0xd2,
0x57, 0x62, 0x5d, 0x69,
0x57, 0x62, 0x5d, 0x23,
0x57, 0x62, 0x5d, 0xd2,
0x63, 0xd7, 0xd6, 0xf5,
0x57, 0x62, 0x5d, 0x46,
0x63, 0xd7, 0xd6, 0x46,
0x52, 0x28, 0x21, 0x69,
0x57, 0x62, 0x5d, 0x23,
0x5d, 0x9c, 0x99, 0xf5
},
{0xf5, 0x00, 0x81, 0x36, 0xa9, 0x17, 0xec, 0x1e, 0xba, 0x66, 0x44, 0x51, 0xfc, 0xfd, 0xcf, 0xb4}
},
{
{
0x94, 0x6f, 0x60, 0x25,
0x94, 0x6f, 0x60, 0x25,
0xc5, 0xab, 0x76, 0x05,
0xc5, 0xab, 0x76, 0xe8,
0x63, 0x34, 0x4a, 0xe8,
0x63, 0x34, 0x4a, 0x25,
0x94, 0x6f, 0x60, 0x86,
0xf7, 0xe7, 0x8c, 0x05,
0x94, 0x6f, 0x60, 0x25,
0x63, 0x34, 0x4a, 0xa7,
0x94, 0x6f, 0x60, 0x66,
0x63, 0x34, 0x4a, 0xc7,
0x94, 0x6f, 0x60, 0xa7,
0xf7, 0xe7, 0x8c, 0xa7,
0x63, 0x34, 0x4a, 0x45,
0xc5, 0xab, 0x76, 0xa7
},
{0xe8, 0x05, 0x7f, 0x80, 0x33, 0x5f, 0xb5, 0x79, 0x31, 0xf7, 0xa9, 0x61, 0xaf, 0x35, 0x77, 0x93}
},
};
static INLINE void
st_sample_dxt_pixel_block(enum pipe_format format,
const struct pipe_format_block *block,
uint8_t *raw,
float *rgba, unsigned rgba_stride,
unsigned w, unsigned h)
{
const struct dxt_data *data;
unsigned n;
unsigned i;
unsigned x, y, ch;
switch(format) {
case PIPE_FORMAT_DXT1_RGB:
data = dxt1_rgb_data;
n = sizeof(dxt1_rgb_data)/sizeof(dxt1_rgb_data[0]);
break;
case PIPE_FORMAT_DXT1_RGBA:
data = dxt1_rgba_data;
n = sizeof(dxt1_rgba_data)/sizeof(dxt1_rgba_data[0]);
break;
case PIPE_FORMAT_DXT3_RGBA:
data = dxt3_rgba_data;
n = sizeof(dxt3_rgba_data)/sizeof(dxt3_rgba_data[0]);
break;
case PIPE_FORMAT_DXT5_RGBA:
data = dxt5_rgba_data;
n = sizeof(dxt5_rgba_data)/sizeof(dxt5_rgba_data[0]);
break;
default:
assert(0);
}
i = st_random() % n;
for(y = 0; y < h; ++y)
for(x = 0; x < w; ++x)
for(ch = 0; ch < 4; ++ch)
rgba[y*rgba_stride + x*4 + ch] = (float)(data[i].rgba[y*4*4 + x*4 + ch])/255.0f;
memcpy(raw, data[i].raw, block->size);
}
static INLINE void
st_sample_generic_pixel_block(enum pipe_format format,
const struct pipe_format_block *block,
uint8_t *raw,
float *rgba, unsigned rgba_stride,
unsigned w, unsigned h)
{
unsigned i;
unsigned x, y, ch;
for(i = 0; i < block->size; ++i)
raw[i] = (uint8_t)st_random();
pipe_tile_raw_to_rgba(format,
raw,
w, h,
rgba, rgba_stride);
if(format == PIPE_FORMAT_YCBCR || format == PIPE_FORMAT_YCBCR_REV) {
for(y = 0; y < h; ++y) {
for(x = 0; x < w; ++x) {
for(ch = 0; ch < 4; ++ch) {
unsigned offset = y*rgba_stride + x*4 + ch;
rgba[offset] = CLAMP(rgba[offset], 0.0f, 1.0f);
}
}
}
}
}
/**
* Randomly sample pixels.
*/
void
st_sample_pixel_block(enum pipe_format format,
const struct pipe_format_block *block,
void *raw,
float *rgba, unsigned rgba_stride,
unsigned w, unsigned h)
{
switch(format) {
case PIPE_FORMAT_DXT1_RGB:
case PIPE_FORMAT_DXT1_RGBA:
case PIPE_FORMAT_DXT3_RGBA:
case PIPE_FORMAT_DXT5_RGBA:
st_sample_dxt_pixel_block(format, block, raw, rgba, rgba_stride, w, h);
break;
default:
st_sample_generic_pixel_block(format, block, raw, rgba, rgba_stride, w, h);
break;
}
}
void
st_sample_surface(struct pipe_surface *surface, float *rgba)
{
const struct pipe_format_block *block = &surface->block;
unsigned rgba_stride = surface->width*4;
void *raw;
unsigned x, y;
raw = pipe_surface_map(surface, PIPE_BUFFER_USAGE_CPU_READ);
if(!raw)
return;
for (y = 0; y < surface->nblocksy; ++y) {
for(x = 0; x < surface->nblocksx; ++x) {
st_sample_pixel_block(surface->format,
block,
(uint8_t*)raw + y*surface->stride + x*block->size,
rgba + y*block->height*rgba_stride + x*block->width*4,
rgba_stride,
MIN2(block->width, surface->width - x*block->width),
MIN2(block->height, surface->height - y*block->height));
}
}
pipe_surface_unmap(surface);
}

View File

@ -0,0 +1,47 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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 ST_SAMPLE_H_
#define ST_SAMPLE_H_
#include "pipe/p_format.h"
void
st_sample_pixel_block(enum pipe_format format,
const struct pipe_format_block *block,
void *raw,
float *rgba, unsigned rgba_stride,
unsigned w, unsigned h);
void
st_sample_surface(struct pipe_surface *surface, float *rgba);
#endif /* ST_SAMPLE_H_ */

View File

@ -313,7 +313,7 @@ st_softpipe_context_create(struct pipe_screen *screen)
}
const struct st_winsys st_software_winsys = {
const struct st_winsys st_softpipe_winsys = {
&st_softpipe_screen_create,
&st_softpipe_screen_destroy,
&st_softpipe_context_create,

View File

@ -50,9 +50,9 @@ struct st_winsys
};
extern const struct st_winsys st_software_winsys;
extern const struct st_winsys st_softpipe_winsys;
extern const struct st_winsys st_hardware_winsys;
extern const struct st_winsys st_hardpipe_winsys;
#endif /* ST_WINSYS_H_ */

View File

@ -0,0 +1,193 @@
#!/usr/bin/env python
##########################################################################
#
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
# 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, sub license, 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 (including the
# next paragraph) 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 NON-INFRINGEMENT.
# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
#
##########################################################################
"""Base classes for tests.
Loosely inspired on Python's unittest module.
"""
from gallium import *
# Enumerate all pixel formats
formats = {}
for name, value in globals().items():
if name.startswith("PIPE_FORMAT_") and isinstance(value, int):
formats[value] = name
def make_image(width, height, rgba):
import Image
outimage = Image.new(
mode='RGB',
size=(width, height),
color=(0,0,0))
outpixels = outimage.load()
for y in range(0, height):
for x in range(0, width):
offset = (y*width + x)*4
r, g, b, a = [int(min(max(rgba[offset + ch], 0.0), 1.0)*255) for ch in range(4)]
outpixels[x, y] = r, g, b
return outimage
def save_image(width, height, rgba, filename):
outimage = make_image(width, height, rgba)
outimage.save(filename, "PNG")
def show_image(width, height, **rgbas):
import Tkinter as tk
from PIL import Image, ImageTk
root = tk.Tk()
x = 64
y = 64
labels = rgbas.keys()
labels.sort()
for i in range(len(labels)):
label = labels[i]
outimage = make_image(width, height, rgbas[label])
if i:
window = tk.Toplevel(root)
else:
window = root
window.title(label)
image1 = ImageTk.PhotoImage(outimage)
w = image1.width()
h = image1.height()
window.geometry("%dx%d+%d+%d" % (w, h, x, y))
panel1 = tk.Label(window, image=image1)
panel1.pack(side='top', fill='both', expand='yes')
panel1.image = image1
x += w + 2
root.mainloop()
class TestFailure(Exception):
pass
class TestSkip(Exception):
pass
class Test:
def __init__(self):
pass
def _run(self, result):
raise NotImplementedError
def run(self):
result = TestResult()
self._run(result)
result.summary()
class TestCase(Test):
def __init__(self, dev, **kargs):
Test.__init__(self)
self.dev = dev
self.__dict__.update(kargs)
def description(self):
raise NotImplementedError
def test(self):
raise NotImplementedError
def _run(self, result):
result.test_start(self)
try:
self.test()
except KeyboardInterrupt:
raise
except TestSkip:
result.test_skipped(self)
except TestFailure:
result.test_failed(self)
else:
result.test_passed(self)
class TestSuite(Test):
def __init__(self, tests = None):
Test.__init__(self)
if tests is None:
self.tests = []
else:
self.tests = tests
def add_test(self, test):
self.tests.append(test)
def _run(self, result):
for test in self.tests:
test._run(result)
class TestResult:
def __init__(self):
self.tests = 0
self.passed = 0
self.skipped = 0
self.failed = 0
self.failed_descriptions = []
def test_start(self, test):
self.tests += 1
print "Running %s..." % test.description()
def test_passed(self, test):
self.passed += 1
print "PASS"
def test_skipped(self, test):
self.skipped += 1
print "SKIP"
def test_failed(self, test):
self.failed += 1
self.failed_descriptions.append(test.description())
print "FAIL"
def summary(self):
print "%u tests, %u passed, %u skipped, %u failed" % (self.tests, self.passed, self.skipped, self.failed)
for description in self.failed_descriptions:
print " %s" % description

View File

@ -0,0 +1,397 @@
#!/usr/bin/env python
##########################################################################
#
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
# 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, sub license, 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 (including the
# next paragraph) 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 NON-INFRINGEMENT.
# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
#
##########################################################################
import sys
from gallium import *
from base import *
def lods(*dims):
size = max(dims)
lods = 0
while size:
lods += 1
size >>= 1
return lods
def minify(dims, level = 1):
return [max(dim>>level, 1) for dim in dims]
def tex_coords(texture, face, level, zslice):
st = [
[0.0, 0.0],
[1.0, 0.0],
[1.0, 1.0],
[0.0, 1.0],
]
if texture.target == PIPE_TEXTURE_2D:
return [[s, t, 0.0] for s, t in st]
elif texture.target == PIPE_TEXTURE_3D:
depth = texture.get_depth(level)
if depth > 1:
r = float(zslice)/float(depth - 1)
else:
r = 0.0
return [[s, t, r] for s, t in st]
elif texture.target == PIPE_TEXTURE_CUBE:
result = []
for s, t in st:
# See http://developer.nvidia.com/object/cube_map_ogl_tutorial.html
sc = 2.0*s - 1.0
tc = 2.0*t - 1.0
if face == PIPE_TEX_FACE_POS_X:
rx = 1.0
ry = -tc
rz = -sc
if face == PIPE_TEX_FACE_NEG_X:
rx = -1.0
ry = -tc
rz = sc
if face == PIPE_TEX_FACE_POS_Y:
rx = sc
ry = 1.0
rz = tc
if face == PIPE_TEX_FACE_NEG_Y:
rx = sc
ry = -1.0
rz = -tc
if face == PIPE_TEX_FACE_POS_Z:
rx = sc
ry = -tc
rz = 1.0
if face == PIPE_TEX_FACE_NEG_Z:
rx = -sc
ry = -tc
rz = -1.0
result.append([rx, ry, rz])
return result
def is_pot(n):
return n & (n - 1) == 0
class TextureTest(TestCase):
def description(self):
target = {
PIPE_TEXTURE_1D: "1d",
PIPE_TEXTURE_2D: "2d",
PIPE_TEXTURE_3D: "3d",
PIPE_TEXTURE_CUBE: "cube",
}[self.target]
format = formats[self.format]
if self.target == PIPE_TEXTURE_CUBE:
face = {
PIPE_TEX_FACE_POS_X: "+x",
PIPE_TEX_FACE_NEG_X: "-x",
PIPE_TEX_FACE_POS_Y: "+y",
PIPE_TEX_FACE_NEG_Y: "-y",
PIPE_TEX_FACE_POS_Z: "+z",
PIPE_TEX_FACE_NEG_Z: "-z",
}[self.face]
else:
face = ""
return "%s %s %ux%ux%u last_level=%u face=%s level=%u zslice=%u" % (
target, format,
self.width, self.height, self.depth, self.last_level,
face, self.level, self.zslice,
)
def test(self):
dev = self.dev
target = self.target
format = self.format
width = self.width
height = self.height
depth = self.depth
last_level = self.last_level
face = self.face
level = self.level
zslice = self.zslice
tex_usage = PIPE_TEXTURE_USAGE_SAMPLER
geom_flags = 0
if width != height:
geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE
if not is_pot(width) or not is_pot(height) or not is_pot(depth):
geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO
if not dev.is_format_supported(format, target, tex_usage, geom_flags):
raise TestSkip
ctx = self.dev.context_create()
# disabled blending/masking
blend = Blend()
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
blend.colormask = PIPE_MASK_RGBA
ctx.set_blend(blend)
# no-op depth/stencil/alpha
depth_stencil_alpha = DepthStencilAlpha()
ctx.set_depth_stencil_alpha(depth_stencil_alpha)
# rasterizer
rasterizer = Rasterizer()
rasterizer.front_winding = PIPE_WINDING_CW
rasterizer.cull_mode = PIPE_WINDING_NONE
rasterizer.bypass_clipping = 1
#rasterizer.bypass_vs = 1
ctx.set_rasterizer(rasterizer)
# viewport (identity, we setup vertices in wincoords)
viewport = Viewport()
scale = FloatArray(4)
scale[0] = 1.0
scale[1] = 1.0
scale[2] = 1.0
scale[3] = 1.0
viewport.scale = scale
translate = FloatArray(4)
translate[0] = 0.0
translate[1] = 0.0
translate[2] = 0.0
translate[3] = 0.0
viewport.translate = translate
ctx.set_viewport(viewport)
# samplers
sampler = Sampler()
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE
sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE
sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE
sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST
sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST
sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST
sampler.normalized_coords = 1
sampler.min_lod = 0
sampler.max_lod = PIPE_MAX_TEXTURE_LEVELS - 1
ctx.set_sampler(0, sampler)
# texture
texture = dev.texture_create(
target = target,
format = format,
width = width,
height = height,
depth = depth,
last_level = last_level,
tex_usage = tex_usage,
)
expected_rgba = FloatArray(height*width*4)
texture.get_surface(
usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE,
face = face,
level = level,
zslice = zslice,
).sample_rgba(expected_rgba)
ctx.set_sampler_texture(0, texture)
# framebuffer
cbuf_tex = dev.texture_create(
PIPE_FORMAT_A8R8G8B8_UNORM,
width,
height,
tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
)
cbuf = cbuf_tex.get_surface(usage = PIPE_BUFFER_USAGE_GPU_WRITE|PIPE_BUFFER_USAGE_GPU_READ)
fb = Framebuffer()
fb.width = width
fb.height = height
fb.num_cbufs = 1
fb.set_cbuf(0, cbuf)
ctx.set_framebuffer(fb)
ctx.surface_clear(cbuf, 0x00000000)
del fb
# vertex shader
vs = Shader('''
VERT1.1
DCL IN[0], POSITION, CONSTANT
DCL IN[1], GENERIC, CONSTANT
DCL OUT[0], POSITION, CONSTANT
DCL OUT[1], GENERIC, CONSTANT
0:MOV OUT[0], IN[0]
1:MOV OUT[1], IN[1]
2:END
''')
#vs.dump()
ctx.set_vertex_shader(vs)
# fragment shader
op = {
PIPE_TEXTURE_1D: "1D",
PIPE_TEXTURE_2D: "2D",
PIPE_TEXTURE_3D: "3D",
PIPE_TEXTURE_CUBE: "CUBE",
}[target]
fs = Shader('''
FRAG1.1
DCL IN[0], GENERIC[0], LINEAR
DCL OUT[0], COLOR, CONSTANT
DCL SAMP[0], CONSTANT
0:TEX OUT[0], IN[0], SAMP[0], %s
1:END
''' % op)
#fs.dump()
ctx.set_fragment_shader(fs)
nverts = 4
nattrs = 2
verts = FloatArray(nverts * nattrs * 4)
x = 0
y = 0
w, h = minify((width, height), level)
pos = [
[x, y],
[x+w, y],
[x+w, y+h],
[x, y+h],
]
tex = tex_coords(texture, face, level, zslice)
for i in range(0, 4):
j = 8*i
verts[j + 0] = pos[i][0] # x
verts[j + 1] = pos[i][1] # y
verts[j + 2] = 0.0 # z
verts[j + 3] = 1.0 # w
verts[j + 4] = tex[i][0] # s
verts[j + 5] = tex[i][1] # r
verts[j + 6] = tex[i][2] # q
verts[j + 7] = 1.0
ctx.draw_vertices(PIPE_PRIM_TRIANGLE_FAN,
nverts,
nattrs,
verts)
ctx.flush()
cbuf = cbuf_tex.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ)
total = h*w
different = cbuf.compare_tile_rgba(x, y, w, h, expected_rgba, tol=4.0/256)
if different:
sys.stderr.write("%u out of %u pixels differ\n" % (different, total))
if float(total - different)/float(total) < 0.85:
if 0:
rgba = FloatArray(h*w*4)
cbuf.get_tile_rgba(x, y, w, h, rgba)
show_image(w, h, Result=rgba, Expected=expected_rgba)
save_image(w, h, rgba, "result.png")
save_image(w, h, expected_rgba, "expected.png")
#sys.exit(0)
raise TestFailure
del ctx
def main():
dev = Device()
suite = TestSuite()
targets = []
targets += [PIPE_TEXTURE_2D]
targets += [PIPE_TEXTURE_CUBE]
targets += [PIPE_TEXTURE_3D]
formats = []
formats += [PIPE_FORMAT_A8R8G8B8_UNORM]
formats += [PIPE_FORMAT_R5G6B5_UNORM]
formats += [PIPE_FORMAT_L8_UNORM]
formats += [PIPE_FORMAT_YCBCR]
formats += [PIPE_FORMAT_DXT1_RGB]
sizes = [64, 32, 16, 8, 4, 2, 1]
#sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
#sizes = [64]
#sizes = [63]
for target in targets:
for format in formats:
for size in sizes:
if target == PIPE_TEXTURE_CUBE:
faces = [
PIPE_TEX_FACE_POS_X,
PIPE_TEX_FACE_NEG_X,
PIPE_TEX_FACE_POS_Y,
PIPE_TEX_FACE_NEG_Y,
PIPE_TEX_FACE_POS_Z,
PIPE_TEX_FACE_NEG_Z,
]
#faces = [PIPE_TEX_FACE_NEG_X]
else:
faces = [0]
if target == PIPE_TEXTURE_3D:
depth = size
else:
depth = 1
for face in faces:
levels = lods(size)
for last_level in range(levels):
for level in range(0, last_level + 1):
zslice = 0
while zslice < depth >> level:
test = TextureTest(
dev = dev,
target = target,
format = format,
width = size,
height = size,
depth = depth,
last_level = last_level,
face = face,
level = level,
zslice = zslice,
)
suite.add_test(test)
zslice = (zslice + 1)*2 - 1
suite.run()
if __name__ == '__main__':
main()

View File

@ -139,6 +139,7 @@ $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS)
$(TOP)/bin/mklib -o $(GLU_LIB) -linker '$(CXX)' \
-major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \
-cplusplus $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
-exports glu.exports \
$(GLU_LIB_DEPS) $(OBJECTS)

59
src/glu/sgi/glu.exports Normal file
View File

@ -0,0 +1,59 @@
gluBeginCurve
gluBeginPolygon
gluBeginSurface
gluBeginTrim
gluBuild1DMipmapLevels
gluBuild1DMipmaps
gluBuild2DMipmapLevels
gluBuild2DMipmaps
gluBuild3DMipmapLevels
gluBuild3DMipmaps
gluCheckExtension
gluCylinder
gluDeleteNurbsRenderer
gluDeleteQuadric
gluDeleteTess
gluDisk
gluEndCurve
gluEndPolygon
gluEndSurface
gluEndTrim
gluErrorString
gluGetNurbsProperty
gluGetString
gluGetTessProperty
gluLoadSamplingMatrices
gluLookAt
gluNewNurbsRenderer
gluNewQuadric
gluNewTess
gluNextContour
gluNurbsCallback
gluNurbsCallbackData
gluNurbsCallbackDataEXT
gluNurbsCurve
gluNurbsProperty
gluNurbsSurface
gluOrtho2D
gluPartialDisk
gluPerspective
gluPickMatrix
gluProject
gluPwlCurve
gluQuadricCallback
gluQuadricDrawStyle
gluQuadricNormals
gluQuadricOrientation
gluQuadricTexture
gluScaleImage
gluSphere
gluTessBeginContour
gluTessBeginPolygon
gluTessCallback
gluTessEndContour
gluTessEndPolygon
gluTessNormal
gluTessProperty
gluTessVertex
gluUnProject
gluUnProject4

View File

@ -190,8 +190,8 @@
#define MAX_PROGRAM_CALL_DEPTH 8
#define MAX_PROGRAM_TEMPS 128
#define MAX_PROGRAM_ADDRESS_REGS 2
#define MAX_UNIFORMS 128
#define MAX_VARYING 8
#define MAX_UNIFORMS 128 /**< number of float components */
#define MAX_VARYING 8 /**< number of float[4] vectors */
#define MAX_SAMPLERS 8
/*@}*/

View File

@ -36,7 +36,7 @@
#if defined(__linux__) || defined(__OpenBSD__)
#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__)
/*
* Allocate a large block of memory which can hold code then dole it out

View File

@ -749,6 +749,15 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
case GL_POLYGON_OFFSET_UNITS:
params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits );
break;
case GL_POLYGON_OFFSET_POINT:
params[0] = ctx->Polygon.OffsetPoint;
break;
case GL_POLYGON_OFFSET_LINE:
params[0] = ctx->Polygon.OffsetLine;
break;
case GL_POLYGON_OFFSET_FILL:
params[0] = ctx->Polygon.OffsetFill;
break;
case GL_POLYGON_SMOOTH:
params[0] = ctx->Polygon.SmoothFlag;
break;
@ -891,18 +900,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
CHECK_EXT1(MESA_texture_array, "GetBooleanv");
params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name);
break;
case GL_TEXTURE_ENV_COLOR:
{
const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;
params[0] = FLOAT_TO_BOOLEAN(color[0]);
params[1] = FLOAT_TO_BOOLEAN(color[1]);
params[2] = FLOAT_TO_BOOLEAN(color[2]);
params[3] = FLOAT_TO_BOOLEAN(color[3]);
}
break;
case GL_TEXTURE_ENV_MODE:
params[0] = ENUM_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode);
break;
case GL_TEXTURE_GEN_S:
params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0);
break;
@ -2596,6 +2593,15 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
case GL_POLYGON_OFFSET_UNITS:
params[0] = ctx->Polygon.OffsetUnits ;
break;
case GL_POLYGON_OFFSET_POINT:
params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetPoint);
break;
case GL_POLYGON_OFFSET_LINE:
params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetLine);
break;
case GL_POLYGON_OFFSET_FILL:
params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetFill);
break;
case GL_POLYGON_SMOOTH:
params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.SmoothFlag);
break;
@ -2738,18 +2744,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
CHECK_EXT1(MESA_texture_array, "GetFloatv");
params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name);
break;
case GL_TEXTURE_ENV_COLOR:
{
const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;
params[0] = color[0];
params[1] = color[1];
params[2] = color[2];
params[3] = color[3];
}
break;
case GL_TEXTURE_ENV_MODE:
params[0] = ENUM_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode);
break;
case GL_TEXTURE_GEN_S:
params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0));
break;
@ -4443,6 +4437,15 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
case GL_POLYGON_OFFSET_UNITS:
params[0] = IROUND(ctx->Polygon.OffsetUnits );
break;
case GL_POLYGON_OFFSET_POINT:
params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetPoint);
break;
case GL_POLYGON_OFFSET_LINE:
params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetLine);
break;
case GL_POLYGON_OFFSET_FILL:
params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetFill);
break;
case GL_POLYGON_SMOOTH:
params[0] = BOOLEAN_TO_INT(ctx->Polygon.SmoothFlag);
break;
@ -4585,18 +4588,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
CHECK_EXT1(MESA_texture_array, "GetIntegerv");
params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name;
break;
case GL_TEXTURE_ENV_COLOR:
{
const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;
params[0] = FLOAT_TO_INT(color[0]);
params[1] = FLOAT_TO_INT(color[1]);
params[2] = FLOAT_TO_INT(color[2]);
params[3] = FLOAT_TO_INT(color[3]);
}
break;
case GL_TEXTURE_ENV_MODE:
params[0] = ENUM_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode);
break;
case GL_TEXTURE_GEN_S:
params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0));
break;

View File

@ -372,6 +372,9 @@ StateVars = [
( "GL_POLYGON_OFFSET_BIAS_EXT", GLfloat, ["ctx->Polygon.OffsetUnits"], "", None ),
( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", None ),
( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", None ),
( "GL_POLYGON_OFFSET_POINT", GLboolean, ["ctx->Polygon.OffsetPoint"], "", None ),
( "GL_POLYGON_OFFSET_LINE", GLboolean, ["ctx->Polygon.OffsetLine"], "", None ),
( "GL_POLYGON_OFFSET_FILL", GLboolean, ["ctx->Polygon.OffsetFill"], "", None ),
( "GL_POLYGON_SMOOTH", GLboolean, ["ctx->Polygon.SmoothFlag"], "", None ),
( "GL_POLYGON_SMOOTH_HINT", GLenum, ["ctx->Hint.PolygonSmooth"], "", None ),
( "GL_POLYGON_STIPPLE", GLboolean, ["ctx->Polygon.StippleFlag"], "", None ),
@ -437,12 +440,6 @@ StateVars = [
["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name"], "", ["MESA_texture_array"] ),
( "GL_TEXTURE_BINDING_2D_ARRAY_EXT", GLint,
["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name"], "", ["MESA_texture_array"] ),
( "GL_TEXTURE_ENV_COLOR", GLfloatN,
["color[0]", "color[1]", "color[2]", "color[3]"],
"const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;",
None ),
( "GL_TEXTURE_ENV_MODE", GLenum,
["ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode"], "", None ),
( "GL_TEXTURE_GEN_S", GLboolean,
["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None ),
( "GL_TEXTURE_GEN_T", GLboolean,

View File

@ -2519,7 +2519,7 @@ struct gl_constants
GLuint MaxRenderbufferSize;
/* GL_ARB_vertex_shader */
GLuint MaxVertexTextureImageUnits;
GLuint MaxVarying;
GLuint MaxVarying; /**< Number of float[4] vectors */
};

View File

@ -207,7 +207,23 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
ref = CLAMP( ref, 0, stencilMax );
if (ctx->Extensions.ATI_separate_stencil) {
if (ctx->Extensions.EXT_stencil_two_side) {
/* only set active face state */
const GLint face = ctx->Stencil.ActiveFace;
if (ctx->Stencil.Function[face] == func &&
ctx->Stencil.ValueMask[face] == mask &&
ctx->Stencil.Ref[face] == ref)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.Function[face] = func;
ctx->Stencil.Ref[face] = ref;
ctx->Stencil.ValueMask[face] = mask;
if (ctx->Driver.StencilFuncSeparate) {
ctx->Driver.StencilFuncSeparate(ctx, face ? GL_BACK : GL_FRONT,
func, ref, mask);
}
}
else {
/* set both front and back state */
if (ctx->Stencil.Function[0] == func &&
ctx->Stencil.Function[1] == func &&
@ -225,22 +241,6 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
func, ref, mask);
}
}
else {
/* only set active face state */
const GLint face = ctx->Stencil.ActiveFace;
if (ctx->Stencil.Function[face] == func &&
ctx->Stencil.ValueMask[face] == mask &&
ctx->Stencil.Ref[face] == ref)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.Function[face] = func;
ctx->Stencil.Ref[face] = ref;
ctx->Stencil.ValueMask[face] = mask;
if (ctx->Driver.StencilFuncSeparate) {
ctx->Driver.StencilFuncSeparate(ctx, face ? GL_BACK : GL_FRONT,
func, ref, mask);
}
}
}
@ -261,18 +261,7 @@ _mesa_StencilMask( GLuint mask )
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->Extensions.ATI_separate_stencil) {
/* set both front and back state */
if (ctx->Stencil.WriteMask[0] == mask &&
ctx->Stencil.WriteMask[1] == mask)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask;
if (ctx->Driver.StencilMaskSeparate) {
ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT_AND_BACK, mask);
}
}
else {
if (ctx->Extensions.EXT_stencil_two_side) {
/* only set active face state */
const GLint face = ctx->Stencil.ActiveFace;
if (ctx->Stencil.WriteMask[face] == mask)
@ -283,6 +272,17 @@ _mesa_StencilMask( GLuint mask )
ctx->Driver.StencilMaskSeparate(ctx, face ? GL_BACK : GL_FRONT, mask);
}
}
else {
/* set both front and back state */
if (ctx->Stencil.WriteMask[0] == mask &&
ctx->Stencil.WriteMask[1] == mask)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask;
if (ctx->Driver.StencilMaskSeparate) {
ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT_AND_BACK, mask);
}
}
}
@ -319,7 +319,23 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
return;
}
if (ctx->Extensions.ATI_separate_stencil) {
if (ctx->Extensions.EXT_stencil_two_side) {
/* only set active face state */
const GLint face = ctx->Stencil.ActiveFace;
if (ctx->Stencil.ZFailFunc[face] == zfail &&
ctx->Stencil.ZPassFunc[face] == zpass &&
ctx->Stencil.FailFunc[face] == fail)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.ZFailFunc[face] = zfail;
ctx->Stencil.ZPassFunc[face] = zpass;
ctx->Stencil.FailFunc[face] = fail;
if (ctx->Driver.StencilOpSeparate) {
ctx->Driver.StencilOpSeparate(ctx, face ? GL_BACK : GL_FRONT,
fail, zfail, zpass);
}
}
else {
/* set both front and back state */
if (ctx->Stencil.ZFailFunc[0] == zfail &&
ctx->Stencil.ZFailFunc[1] == zfail &&
@ -337,22 +353,6 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
fail, zfail, zpass);
}
}
else {
/* only set active face state */
const GLint face = ctx->Stencil.ActiveFace;
if (ctx->Stencil.ZFailFunc[face] == zfail &&
ctx->Stencil.ZPassFunc[face] == zpass &&
ctx->Stencil.FailFunc[face] == fail)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.ZFailFunc[face] = zfail;
ctx->Stencil.ZPassFunc[face] = zpass;
ctx->Stencil.FailFunc[face] = fail;
if (ctx->Driver.StencilOpSeparate) {
ctx->Driver.StencilOpSeparate(ctx, face ? GL_BACK : GL_FRONT,
fail, zfail, zpass);
}
}
}
@ -463,12 +463,14 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
FLUSH_VERTICES(ctx, _NEW_STENCIL);
if (face == GL_FRONT || face == GL_FRONT_AND_BACK) {
if (face != GL_BACK) {
/* set front */
ctx->Stencil.Function[0] = func;
ctx->Stencil.Ref[0] = ref;
ctx->Stencil.ValueMask[0] = mask;
}
if (face == GL_BACK || face == GL_FRONT_AND_BACK) {
if (face != GL_FRONT) {
/* set back */
ctx->Stencil.Function[1] = func;
ctx->Stencil.Ref[1] = ref;
ctx->Stencil.ValueMask[1] = mask;

View File

@ -55,10 +55,10 @@ nonlinear_to_linear(GLubyte cs8)
for (i = 0; i < 256; i++) {
const GLfloat cs = UBYTE_TO_FLOAT(i);
if (cs <= 0.04045) {
table[i] = cs / 12.92;
table[i] = cs / 12.92f;
}
else {
table[i] = _mesa_pow((cs + 0.055) / 1.055, 2.4);
table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4);
}
}
tableReady = GL_TRUE;

View File

@ -159,7 +159,7 @@ texture_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLuint *zValues = (const GLuint *) values;
for (i = 0; i < count; i++) {
if (!mask || mask[i]) {
GLfloat flt = (zValues[i] >> 8) * (1.0 / 0xffffff);
GLfloat flt = (GLfloat) ((zValues[i] >> 8) * (1.0 / 0xffffff));
trb->Store(trb->TexImage, x + i, y, z, &flt);
}
}
@ -199,7 +199,7 @@ texture_put_mono_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
}
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
const GLuint zValue = *((const GLuint *) value);
const GLfloat flt = (zValue >> 8) * (1.0 / 0xffffff);
const GLfloat flt = (GLfloat) ((zValue >> 8) * (1.0 / 0xffffff));
for (i = 0; i < count; i++) {
if (!mask || mask[i]) {
trb->Store(trb->TexImage, x + i, y, z, &flt);
@ -244,7 +244,7 @@ texture_put_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLuint *zValues = (const GLuint *) values;
for (i = 0; i < count; i++) {
if (!mask || mask[i]) {
GLfloat flt = (zValues[i] >> 8) * (1.0 / 0xffffff);
GLfloat flt = (GLfloat) ((zValues[i] >> 8) * (1.0 / 0xffffff));
trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &flt);
}
}
@ -283,7 +283,7 @@ texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb,
}
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
const GLuint zValue = *((const GLuint *) value);
const GLfloat flt = (zValue >> 8) * (1.0 / 0xffffff);
const GLfloat flt = (GLfloat) ((zValue >> 8) * (1.0 / 0xffffff));
for (i = 0; i < count; i++) {
if (!mask || mask[i]) {
trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &flt);

View File

@ -2377,7 +2377,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
_mesa_unpack_depth_span(ctx, srcWidth,
GL_UNSIGNED_INT_24_8_EXT, /* dst type */
dstRow, /* dst addr */
depthScale,
(GLuint) depthScale,
srcType, src, srcPacking);
/* get the 8-bit stencil values */
_mesa_unpack_stencil_span(ctx, srcWidth,

View File

@ -583,11 +583,6 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
return;
}
if (type == GL_UNSIGNED_BYTE && size != 4) {
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(size!=4)");
return;
}
/* check for valid 'type' and compute StrideB right away */
/* NOTE: more types are supported here than in the NV extension */
switch (type) {

View File

@ -33,12 +33,214 @@
#include "arbprogram.h"
#include "arbprogparse.h"
#include "context.h"
#include "hash.h"
#include "imports.h"
#include "macros.h"
#include "mtypes.h"
#include "program.h"
/**
* Mixing ARB and NV vertex/fragment programs can be tricky.
* Note: GL_VERTEX_PROGRAM_ARB == GL_VERTEX_PROGRAM_NV
* but, GL_FRAGMENT_PROGRAM_ARB != GL_FRAGMENT_PROGRAM_NV
* The two different fragment program targets are supposed to be compatible
* to some extent (see GL_ARB_fragment_program spec).
* This function does the compatibility check.
*/
static GLboolean
compatible_program_targets(GLenum t1, GLenum t2)
{
if (t1 == t2)
return GL_TRUE;
if (t1 == GL_FRAGMENT_PROGRAM_ARB && t2 == GL_FRAGMENT_PROGRAM_NV)
return GL_TRUE;
if (t1 == GL_FRAGMENT_PROGRAM_NV && t2 == GL_FRAGMENT_PROGRAM_ARB)
return GL_TRUE;
return GL_FALSE;
}
/**
* Bind a program (make it current)
* \note Called from the GL API dispatcher by both glBindProgramNV
* and glBindProgramARB.
*/
void GLAPIENTRY
_mesa_BindProgram(GLenum target, GLuint id)
{
struct gl_program *curProg, *newProg;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
/* Error-check target and get curProg */
if ((target == GL_VERTEX_PROGRAM_ARB) && /* == GL_VERTEX_PROGRAM_NV */
(ctx->Extensions.NV_vertex_program ||
ctx->Extensions.ARB_vertex_program)) {
curProg = &ctx->VertexProgram.Current->Base;
}
else if ((target == GL_FRAGMENT_PROGRAM_NV
&& ctx->Extensions.NV_fragment_program) ||
(target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program)) {
curProg = &ctx->FragmentProgram.Current->Base;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramNV/ARB(target)");
return;
}
/*
* Get pointer to new program to bind.
* NOTE: binding to a non-existant program is not an error.
* That's supposed to be caught in glBegin.
*/
if (id == 0) {
/* Bind a default program */
newProg = NULL;
if (target == GL_VERTEX_PROGRAM_ARB) /* == GL_VERTEX_PROGRAM_NV */
newProg = &ctx->Shared->DefaultVertexProgram->Base;
else
newProg = &ctx->Shared->DefaultFragmentProgram->Base;
}
else {
/* Bind a user program */
newProg = _mesa_lookup_program(ctx, id);
if (!newProg || newProg == &_mesa_DummyProgram) {
/* allocate a new program now */
newProg = ctx->Driver.NewProgram(ctx, target, id);
if (!newProg) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV/ARB");
return;
}
_mesa_HashInsert(ctx->Shared->Programs, id, newProg);
}
else if (!compatible_program_targets(newProg->Target, target)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBindProgramNV/ARB(target mismatch)");
return;
}
}
/** All error checking is complete now **/
if (curProg->Id == id) {
/* binding same program - no change */
return;
}
/* bind newProg */
if (target == GL_VERTEX_PROGRAM_ARB) { /* == GL_VERTEX_PROGRAM_NV */
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
(struct gl_vertex_program *) newProg);
}
else if (target == GL_FRAGMENT_PROGRAM_NV ||
target == GL_FRAGMENT_PROGRAM_ARB) {
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
(struct gl_fragment_program *) newProg);
}
/* Never null pointers */
ASSERT(ctx->VertexProgram.Current);
ASSERT(ctx->FragmentProgram.Current);
if (ctx->Driver.BindProgram)
ctx->Driver.BindProgram(ctx, target, newProg);
}
/**
* Delete a list of programs.
* \note Not compiled into display lists.
* \note Called by both glDeleteProgramsNV and glDeleteProgramsARB.
*/
void GLAPIENTRY
_mesa_DeletePrograms(GLsizei n, const GLuint *ids)
{
GLint i;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (n < 0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glDeleteProgramsNV" );
return;
}
for (i = 0; i < n; i++) {
if (ids[i] != 0) {
struct gl_program *prog = _mesa_lookup_program(ctx, ids[i]);
if (prog == &_mesa_DummyProgram) {
_mesa_HashRemove(ctx->Shared->Programs, ids[i]);
}
else if (prog) {
/* Unbind program if necessary */
if (prog->Target == GL_VERTEX_PROGRAM_ARB || /* == GL_VERTEX_PROGRAM_NV */
prog->Target == GL_VERTEX_STATE_PROGRAM_NV) {
if (ctx->VertexProgram.Current &&
ctx->VertexProgram.Current->Base.Id == ids[i]) {
/* unbind this currently bound program */
_mesa_BindProgram(prog->Target, 0);
}
}
else if (prog->Target == GL_FRAGMENT_PROGRAM_NV ||
prog->Target == GL_FRAGMENT_PROGRAM_ARB) {
if (ctx->FragmentProgram.Current &&
ctx->FragmentProgram.Current->Base.Id == ids[i]) {
/* unbind this currently bound program */
_mesa_BindProgram(prog->Target, 0);
}
}
else {
_mesa_problem(ctx, "bad target in glDeleteProgramsNV");
return;
}
/* The ID is immediately available for re-use now */
_mesa_HashRemove(ctx->Shared->Programs, ids[i]);
_mesa_reference_program(ctx, &prog, NULL);
}
}
}
}
/**
* Generate a list of new program identifiers.
* \note Not compiled into display lists.
* \note Called by both glGenProgramsNV and glGenProgramsARB.
*/
void GLAPIENTRY
_mesa_GenPrograms(GLsizei n, GLuint *ids)
{
GLuint first;
GLuint i;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGenPrograms");
return;
}
if (!ids)
return;
first = _mesa_HashFindFreeKeyBlock(ctx->Shared->Programs, n);
/* Insert pointer to dummy program as placeholder */
for (i = 0; i < (GLuint) n; i++) {
_mesa_HashInsert(ctx->Shared->Programs, first + i, &_mesa_DummyProgram);
}
/* Return the program names */
for (i = 0; i < (GLuint) n; i++) {
ids[i] = first + i;
}
}
void GLAPIENTRY
_mesa_EnableVertexAttribArrayARB(GLuint index)
{

View File

@ -27,6 +27,16 @@
#define ARBPROGRAM_H
extern void GLAPIENTRY
_mesa_BindProgram(GLenum target, GLuint id);
extern void GLAPIENTRY
_mesa_DeletePrograms(GLsizei n, const GLuint *ids);
extern void GLAPIENTRY
_mesa_GenPrograms(GLsizei n, GLuint *ids);
extern void GLAPIENTRY
_mesa_EnableVertexAttribArrayARB(GLuint index);

View File

@ -716,7 +716,7 @@ _mesa_execute_program(GLcontext * ctx,
* result.z = result.x * APPX(result.y)
* We do what the ARB extension says.
*/
q[2] = pow(2.0, t[0]);
q[2] = (GLfloat) pow(2.0, t[0]);
}
q[1] = t[0] - floor_t0;
q[3] = 1.0F;

View File

@ -62,29 +62,6 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList)
}
static GLint
_mesa_fit_type_in_vec4(GLenum type)
{
switch (type) {
case GL_FLOAT:
case GL_INT:
return 4;
break;
case GL_FLOAT_VEC2:
case GL_INT_VEC2:
return 2;
break;
case GL_FLOAT_VEC3:
case GL_INT_VEC3:
return 1;
break;
case GL_FLOAT_VEC4:
case GL_INT_VEC4:
default:
return 1;
}
}
/**
* Add a new parameter to a parameter list.
* Note that parameter values are usually 4-element GLfloat vectors.
@ -294,7 +271,7 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList,
}
else {
i = _mesa_add_parameter(paramList, PROGRAM_UNIFORM, name,
size * _mesa_fit_type_in_vec4(datatype), datatype, NULL, NULL);
size, datatype, NULL, NULL);
return i;
}
}
@ -319,6 +296,7 @@ _mesa_add_sampler(struct gl_program_parameter_list *paramList,
return (GLint) paramList->ParameterValues[i][0];
}
else {
GLuint i;
const GLint size = 1; /* a sampler is basically a texture unit number */
GLfloat value;
GLint numSamplers = 0;
@ -347,7 +325,7 @@ _mesa_add_varying(struct gl_program_parameter_list *paramList,
return i;
}
else {
assert(size == 4);
/*assert(size == 4);*/
i = _mesa_add_parameter(paramList, PROGRAM_VARYING, name,
size, GL_NONE, NULL, NULL);
return i;
@ -362,7 +340,7 @@ _mesa_add_varying(struct gl_program_parameter_list *paramList,
*/
GLint
_mesa_add_attribute(struct gl_program_parameter_list *paramList,
const char *name, GLint size, GLint attrib)
const char *name, GLint size, GLenum datatype, GLint attrib)
{
GLint i = _mesa_lookup_parameter_index(paramList, -1, name);
if (i >= 0) {
@ -378,7 +356,7 @@ _mesa_add_attribute(struct gl_program_parameter_list *paramList,
if (size < 0)
size = 4;
i = _mesa_add_parameter(paramList, PROGRAM_INPUT, name,
size, GL_NONE, NULL, state);
size, datatype, NULL, state);
}
return i;
}

View File

@ -122,7 +122,7 @@ _mesa_add_varying(struct gl_program_parameter_list *paramList,
extern GLint
_mesa_add_attribute(struct gl_program_parameter_list *paramList,
const char *name, GLint size, GLint attrib);
const char *name, GLint size, GLenum datatype, GLint attrib);
extern GLint
_mesa_add_state_reference(struct gl_program_parameter_list *paramList,

View File

@ -313,7 +313,7 @@ reg_string(enum register_file f, GLint index, gl_prog_print_mode mode,
const char *
_mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended)
{
static const char swz[] = "xyzw01?!";
static const char swz[] = "xyzw01!?"; /* See SWIZZLE_x definitions */
static char s[20];
GLuint i = 0;
@ -363,7 +363,7 @@ _mesa_print_swizzle(GLuint swizzle)
_mesa_printf(".xyzw\n");
}
else {
char *s = _mesa_swizzle_string(swizzle, 0, 0);
const char *s = _mesa_swizzle_string(swizzle, 0, 0);
_mesa_printf("%s\n", s);
}
}

View File

@ -249,7 +249,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
value[1] = ctx->Fog.Start;
value[2] = ctx->Fog.End;
value[3] = (ctx->Fog.End == ctx->Fog.Start)
? 1.0 : (GLfloat)(1.0 / (ctx->Fog.End - ctx->Fog.Start));
? 1.0f : (GLfloat)(1.0 / (ctx->Fog.End - ctx->Fog.Start));
return;
case STATE_CLIPPLANE:
{
@ -409,9 +409,9 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
= ctx->Texture.Unit[unit]._Current;
if (texObj) {
struct gl_texture_image *texImage = texObj->Image[0][0];
ASSIGN_4V(value, 1.0 / texImage->Width,
ASSIGN_4V(value, (GLfloat) (1.0 / texImage->Width),
(GLfloat)(1.0 / texImage->Height),
0.0, 1.0);
0.0f, 1.0f);
}
}
return;
@ -425,7 +425,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
* exp2: 2^-((density/(ln(2)^2) * fogcoord)^2)
*/
value[0] = (ctx->Fog.End == ctx->Fog.Start)
? 1.0 : (GLfloat)(-1.0F / (ctx->Fog.End - ctx->Fog.Start));
? 1.0f : (GLfloat)(-1.0F / (ctx->Fog.End - ctx->Fog.Start));
value[1] = ctx->Fog.End * -value[0];
value[2] = (GLfloat)(ctx->Fog.Density * ONE_DIV_LN2);
value[3] = (GLfloat)(ctx->Fog.Density * ONE_DIV_SQRT_LN2);

View File

@ -82,7 +82,7 @@ _mesa_init_program(GLcontext *ctx)
/* XXX probably move this stuff */
#if FEATURE_ATI_fragment_shader
ctx->ATIFragmentShader.Enabled = GL_FALSE;
ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader;
ctx->ATIFragmentShader.Current = ctx->Shared->DefaultFragmentShader;
assert(ctx->ATIFragmentShader.Current);
ctx->ATIFragmentShader.Current->RefCount++;
#endif
@ -679,210 +679,3 @@ _mesa_find_free_register(const struct gl_program *prog, GLuint regFile)
return -1;
}
/**
* Mixing ARB and NV vertex/fragment programs can be tricky.
* Note: GL_VERTEX_PROGRAM_ARB == GL_VERTEX_PROGRAM_NV
* but, GL_FRAGMENT_PROGRAM_ARB != GL_FRAGMENT_PROGRAM_NV
* The two different fragment program targets are supposed to be compatible
* to some extent (see GL_ARB_fragment_program spec).
* This function does the compatibility check.
*/
static GLboolean
compatible_program_targets(GLenum t1, GLenum t2)
{
if (t1 == t2)
return GL_TRUE;
if (t1 == GL_FRAGMENT_PROGRAM_ARB && t2 == GL_FRAGMENT_PROGRAM_NV)
return GL_TRUE;
if (t1 == GL_FRAGMENT_PROGRAM_NV && t2 == GL_FRAGMENT_PROGRAM_ARB)
return GL_TRUE;
return GL_FALSE;
}
/**********************************************************************/
/* API functions */
/**********************************************************************/
/**
* Bind a program (make it current)
* \note Called from the GL API dispatcher by both glBindProgramNV
* and glBindProgramARB.
*/
void GLAPIENTRY
_mesa_BindProgram(GLenum target, GLuint id)
{
struct gl_program *curProg, *newProg;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
/* Error-check target and get curProg */
if ((target == GL_VERTEX_PROGRAM_ARB) && /* == GL_VERTEX_PROGRAM_NV */
(ctx->Extensions.NV_vertex_program ||
ctx->Extensions.ARB_vertex_program)) {
curProg = &ctx->VertexProgram.Current->Base;
}
else if ((target == GL_FRAGMENT_PROGRAM_NV
&& ctx->Extensions.NV_fragment_program) ||
(target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program)) {
curProg = &ctx->FragmentProgram.Current->Base;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramNV/ARB(target)");
return;
}
/*
* Get pointer to new program to bind.
* NOTE: binding to a non-existant program is not an error.
* That's supposed to be caught in glBegin.
*/
if (id == 0) {
/* Bind a default program */
newProg = NULL;
if (target == GL_VERTEX_PROGRAM_ARB) /* == GL_VERTEX_PROGRAM_NV */
newProg = &ctx->Shared->DefaultVertexProgram->Base;
else
newProg = &ctx->Shared->DefaultFragmentProgram->Base;
}
else {
/* Bind a user program */
newProg = _mesa_lookup_program(ctx, id);
if (!newProg || newProg == &_mesa_DummyProgram) {
/* allocate a new program now */
newProg = ctx->Driver.NewProgram(ctx, target, id);
if (!newProg) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV/ARB");
return;
}
_mesa_HashInsert(ctx->Shared->Programs, id, newProg);
}
else if (!compatible_program_targets(newProg->Target, target)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBindProgramNV/ARB(target mismatch)");
return;
}
}
/** All error checking is complete now **/
if (curProg->Id == id) {
/* binding same program - no change */
return;
}
/* bind newProg */
if (target == GL_VERTEX_PROGRAM_ARB) { /* == GL_VERTEX_PROGRAM_NV */
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
(struct gl_vertex_program *) newProg);
}
else if (target == GL_FRAGMENT_PROGRAM_NV ||
target == GL_FRAGMENT_PROGRAM_ARB) {
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
(struct gl_fragment_program *) newProg);
}
/* Never null pointers */
ASSERT(ctx->VertexProgram.Current);
ASSERT(ctx->FragmentProgram.Current);
if (ctx->Driver.BindProgram)
ctx->Driver.BindProgram(ctx, target, newProg);
}
/**
* Delete a list of programs.
* \note Not compiled into display lists.
* \note Called by both glDeleteProgramsNV and glDeleteProgramsARB.
*/
void GLAPIENTRY
_mesa_DeletePrograms(GLsizei n, const GLuint *ids)
{
GLint i;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (n < 0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glDeleteProgramsNV" );
return;
}
for (i = 0; i < n; i++) {
if (ids[i] != 0) {
struct gl_program *prog = _mesa_lookup_program(ctx, ids[i]);
if (prog == &_mesa_DummyProgram) {
_mesa_HashRemove(ctx->Shared->Programs, ids[i]);
}
else if (prog) {
/* Unbind program if necessary */
if (prog->Target == GL_VERTEX_PROGRAM_ARB || /* == GL_VERTEX_PROGRAM_NV */
prog->Target == GL_VERTEX_STATE_PROGRAM_NV) {
if (ctx->VertexProgram.Current &&
ctx->VertexProgram.Current->Base.Id == ids[i]) {
/* unbind this currently bound program */
_mesa_BindProgram(prog->Target, 0);
}
}
else if (prog->Target == GL_FRAGMENT_PROGRAM_NV ||
prog->Target == GL_FRAGMENT_PROGRAM_ARB) {
if (ctx->FragmentProgram.Current &&
ctx->FragmentProgram.Current->Base.Id == ids[i]) {
/* unbind this currently bound program */
_mesa_BindProgram(prog->Target, 0);
}
}
else {
_mesa_problem(ctx, "bad target in glDeleteProgramsNV");
return;
}
/* The ID is immediately available for re-use now */
_mesa_HashRemove(ctx->Shared->Programs, ids[i]);
_mesa_reference_program(ctx, &prog, NULL);
}
}
}
}
/**
* Generate a list of new program identifiers.
* \note Not compiled into display lists.
* \note Called by both glGenProgramsNV and glGenProgramsARB.
*/
void GLAPIENTRY
_mesa_GenPrograms(GLsizei n, GLuint *ids)
{
GLuint first;
GLuint i;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGenPrograms");
return;
}
if (!ids)
return;
first = _mesa_HashFindFreeKeyBlock(ctx->Shared->Programs, n);
/* Insert pointer to dummy program as placeholder */
for (i = 0; i < (GLuint) n; i++) {
_mesa_HashInsert(ctx->Shared->Programs, first + i, &_mesa_DummyProgram);
}
/* Return the program names */
for (i = 0; i < (GLuint) n; i++) {
ids[i] = first + i;
}
}

View File

@ -46,10 +46,6 @@
extern struct gl_program _mesa_DummyProgram;
/*
* Internal functions
*/
extern void
_mesa_init_program(GLcontext *ctx);
@ -121,19 +117,5 @@ extern GLint
_mesa_find_free_register(const struct gl_program *prog, GLuint regFile);
/*
* API functions common to ARB/NV_vertex/fragment_program
*/
extern void GLAPIENTRY
_mesa_BindProgram(GLenum target, GLuint id);
extern void GLAPIENTRY
_mesa_DeletePrograms(GLsizei n, const GLuint *ids);
extern void GLAPIENTRY
_mesa_GenPrograms(GLsizei n, GLuint *ids);
#endif /* PROGRAM_H */

View File

@ -513,6 +513,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;
shProg = _mesa_lookup_shader_program_err(ctx, program,
"glBindAttribLocation");
@ -543,7 +544,7 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
}
/* this will replace the current value if it's already in the list */
i = _mesa_add_attribute(shProg->Attributes, name, size, index);
i = _mesa_add_attribute(shProg->Attributes, name, size, datatype, index);
if (i < 0) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindAttribLocation");
}
@ -710,16 +711,51 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
}
static GLint
sizeof_glsl_type(GLenum type)
{
switch (type) {
case GL_FLOAT:
case GL_INT:
case GL_BOOL:
return 1;
case GL_FLOAT_VEC2:
case GL_INT_VEC2:
case GL_BOOL_VEC2:
return 2;
case GL_FLOAT_VEC3:
case GL_INT_VEC3:
case GL_BOOL_VEC3:
return 3;
case GL_FLOAT_VEC4:
case GL_INT_VEC4:
case GL_BOOL_VEC4:
return 4;
case GL_FLOAT_MAT2:
case GL_FLOAT_MAT2x3:
case GL_FLOAT_MAT2x4:
return 8; /* two float[4] vectors */
case GL_FLOAT_MAT3:
case GL_FLOAT_MAT3x2:
case GL_FLOAT_MAT3x4:
return 12; /* three float[4] vectors */
case GL_FLOAT_MAT4:
case GL_FLOAT_MAT4x2:
case GL_FLOAT_MAT4x3:
return 16; /* four float[4] vectors */
default:
_mesa_problem(NULL, "Invalid type in sizeof_glsl_type()");
return 1;
}
}
static void
_mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
GLsizei maxLength, GLsizei *length, GLint *size,
GLenum *type, GLchar *nameOut)
{
static const GLenum vec_types[] = {
GL_FLOAT, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4
};
struct gl_shader_program *shProg;
GLint sz;
shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib");
if (!shProg)
@ -732,11 +768,11 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
copy_string(nameOut, maxLength, length,
shProg->Attributes->Parameters[index].Name);
sz = shProg->Attributes->Parameters[index].Size;
if (size)
*size = sz;
*size = shProg->Attributes->Parameters[index].Size
/ sizeof_glsl_type(shProg->Attributes->Parameters[index].DataType);
if (type)
*type = vec_types[sz]; /* XXX this is a temporary hack */
*type = shProg->Attributes->Parameters[index].DataType;
}
@ -779,8 +815,8 @@ _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
copy_string(nameOut, maxLength, length,
prog->Parameters->Parameters[progPos].Name);
if (size)
*size = prog->Parameters->Parameters[progPos].Size;
*size = prog->Parameters->Parameters[progPos].Size
/ sizeof_glsl_type(prog->Parameters->Parameters[progPos].DataType);
if (type)
*type = prog->Parameters->Parameters[progPos].DataType;
}
@ -969,7 +1005,7 @@ get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
= _mesa_lookup_shader_program(ctx, program);
if (shProg) {
if (shProg->Uniforms &&
location >= 0 && location < shProg->Uniforms->NumUniforms) {
location >= 0 && location < (GLint) shProg->Uniforms->NumUniforms) {
GLint progPos;
GLuint i;
const struct gl_program *prog = NULL;
@ -1172,6 +1208,60 @@ update_textures_used(struct gl_program *prog)
}
static GLboolean
is_sampler_type(GLenum type)
{
switch (type) {
case GL_SAMPLER_1D:
case GL_SAMPLER_2D:
case GL_SAMPLER_3D:
case GL_SAMPLER_CUBE:
case GL_SAMPLER_1D_SHADOW:
case GL_SAMPLER_2D_SHADOW:
case GL_SAMPLER_2D_RECT_ARB:
case GL_SAMPLER_2D_RECT_SHADOW_ARB:
case GL_SAMPLER_1D_ARRAY_EXT:
case GL_SAMPLER_2D_ARRAY_EXT:
return GL_TRUE;
default:
return GL_FALSE;
}
}
/**
* Check if the type given by userType is allowed to set a uniform of the
* target type. Generally, equivalence is required, but setting Boolean
* uniforms can be done with glUniformiv or glUniformfv.
*/
static GLboolean
compatible_types(GLenum userType, GLenum targetType)
{
if (userType == targetType)
return GL_TRUE;
if (targetType == GL_BOOL && (userType == GL_FLOAT || userType == GL_INT))
return GL_TRUE;
if (targetType == GL_BOOL_VEC2 && (userType == GL_FLOAT_VEC2 ||
userType == GL_INT_VEC2))
return GL_TRUE;
if (targetType == GL_BOOL_VEC3 && (userType == GL_FLOAT_VEC3 ||
userType == GL_INT_VEC3))
return GL_TRUE;
if (targetType == GL_BOOL_VEC4 && (userType == GL_FLOAT_VEC4 ||
userType == GL_INT_VEC4))
return GL_TRUE;
if (is_sampler_type(targetType) && userType == GL_INT)
return GL_TRUE;
return GL_FALSE;
}
/**
* Set the value of a program's uniform variable.
* \param program the program whose uniform to update
@ -1185,6 +1275,12 @@ static void
set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location,
GLenum type, GLsizei count, GLint elems, const void *values)
{
if (!compatible_types(type,
program->Parameters->Parameters[location].DataType)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(type mismatch)");
return;
}
if (program->Parameters->Parameters[location].Type == PROGRAM_SAMPLER) {
/* This controls which texture unit which is used by a sampler */
GLuint texUnit, sampler;
@ -1217,7 +1313,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location,
/* ordinary uniform variable */
GLsizei k, i;
if (count * elems > program->Parameters->Parameters[location].Size) {
if (count * elems > (GLint) program->Parameters->Parameters[location].Size) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)");
return;
}
@ -1317,39 +1413,100 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
}
static void
get_matrix_dims(GLenum type, GLint *rows, GLint *cols)
{
switch (type) {
case GL_FLOAT_MAT2:
*rows = *cols = 2;
break;
case GL_FLOAT_MAT2x3:
*rows = 3;
*cols = 2;
break;
case GL_FLOAT_MAT2x4:
*rows = 4;
*cols = 2;
break;
case GL_FLOAT_MAT3:
*rows = 3;
*cols = 3;
break;
case GL_FLOAT_MAT3x2:
*rows = 2;
*cols = 3;
break;
case GL_FLOAT_MAT3x4:
*rows = 4;
*cols = 3;
break;
case GL_FLOAT_MAT4:
*rows = 4;
*cols = 4;
break;
case GL_FLOAT_MAT4x2:
*rows = 2;
*cols = 4;
break;
case GL_FLOAT_MAT4x3:
*rows = 3;
*cols = 4;
break;
default:
*rows = *cols = 0;
}
}
static void
set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program,
GLuint location, GLuint rows, GLuint cols,
GLuint location, GLuint count,
GLuint rows, GLuint cols,
GLboolean transpose, const GLfloat *values)
{
GLuint mat, row, col;
GLuint dst = location, src = 0;
GLint nr, nc;
/* check that the number of rows, columns is correct */
get_matrix_dims(program->Parameters->Parameters[location].DataType, &nr, &nc);
if (rows != nr || cols != nc) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glUniformMatrix(matrix size mismatch");
return;
}
/*
* Note: the _columns_ of a matrix are stored in program registers, not
* the rows.
* the rows. So, the loops below look a little funny.
* XXX could optimize this a bit...
*/
/* XXXX need to test 3x3 and 2x2 matrices... */
if (transpose) {
GLuint row, col;
/* loop over matrices */
for (mat = 0; mat < count; mat++) {
/* each matrix: */
for (col = 0; col < cols; col++) {
GLfloat *v = program->Parameters->ParameterValues[location + col];
GLfloat *v = program->Parameters->ParameterValues[dst];
for (row = 0; row < rows; row++) {
v[row] = values[row * cols + col];
}
}
}
else {
GLuint row, col;
for (col = 0; col < cols; col++) {
GLfloat *v = program->Parameters->ParameterValues[location + col];
for (row = 0; row < rows; row++) {
v[row] = values[col * rows + row];
if (transpose) {
v[row] = values[src + row * cols + col];
}
else {
v[row] = values[src + col * rows + row];
}
}
dst++;
}
src += rows * cols; /* next matrix */
}
}
/**
* Called by ctx->Driver.UniformMatrix().
* Note: cols=2, rows=4 ==> array[2] of vec4
*/
static void
_mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
@ -1367,7 +1524,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
if (location == -1)
return; /* The standard specifies this as a no-op */
if (location < 0 || location >= shProg->Uniforms->NumUniforms) {
if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) {
_mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(location)");
return;
}
@ -1382,7 +1539,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
GLint loc = shProg->Uniforms->Uniforms[location].VertPos;
if (loc >= 0) {
set_program_uniform_matrix(ctx, &shProg->VertexProgram->Base,
loc, rows, cols, transpose, values);
loc, count, rows, cols, transpose, values);
}
}
@ -1390,7 +1547,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
GLint loc = shProg->Uniforms->Uniforms[location].FragPos;
if (loc >= 0) {
set_program_uniform_matrix(ctx, &shProg->FragmentProgram->Base,
loc, rows, cols, transpose, values);
loc, count, rows, cols, transpose, values);
}
}
}
@ -1400,15 +1557,19 @@ static void
_mesa_validate_program(GLcontext *ctx, GLuint program)
{
struct gl_shader_program *shProg;
shProg = _mesa_lookup_shader_program(ctx, program);
shProg = _mesa_lookup_shader_program_err(ctx, program, "glValidateProgram");
if (!shProg) {
_mesa_error(ctx, GL_INVALID_VALUE, "glValidateProgram(program)");
return;
}
/* XXX temporary */
shProg->Validated = GL_TRUE;
/* From the GL spec:
if (!shProg->LinkStatus) {
shProg->Validated = GL_FALSE;
return;
}
/* From the GL spec, a program is invalid if any of these are true:
any two active samplers in the current program object are of
different types, but refer to the same texture image unit,
@ -1421,6 +1582,8 @@ _mesa_validate_program(GLcontext *ctx, GLuint program)
processing exceeds the combined limit on the total number of texture
image units allowed.
*/
shProg->Validated = GL_TRUE;
}

View File

@ -203,19 +203,19 @@ float degrees(const float rad)
vec2 degrees(const vec2 rad)
{
const float c = 3.1415926 / 180.0;
const float c = 180.0 / 3.1415926;
__asm vec4_multiply __retVal.xy, rad.xy, c.xx;
}
vec3 degrees(const vec3 rad)
{
const float c = 3.1415926 / 180.0;
const float c = 180.0 / 3.1415926;
__asm vec4_multiply __retVal.xyz, rad.xyz, c.xxx;
}
vec4 degrees(const vec4 rad)
{
const float c = 3.1415926 / 180.0;
const float c = 180.0 / 3.1415926;
__asm vec4_multiply __retVal, rad, c.xxxx;
}
@ -401,16 +401,17 @@ vec4 atan(const vec4 y_over_x)
float atan(const float y, const float x)
{
if (x == 0.0)
return 0.0;
float z = atan(y / x);
if (x < 0.0)
{
if (y < 0.0)
return z - 3.141593;
return z + 3.141593;
}
return z;
float r;
if (abs(x) > 1.0e-4) {
r = atan(y / x);
if (x < 0.0) {
r = r + sign(y) * 3.141593;
}
}
else {
r = sign(y) * 1.5707965; // pi/2
}
return r;
}
vec2 atan(const vec2 u, const vec2 v)

File diff suppressed because it is too large Load Diff

View File

@ -113,13 +113,13 @@ int __constructor(const float f)
bool __constructor(const int i)
{
const float zero = 0.0;
__asm vec4_seq __retVal, i, zero;
__asm vec4_sne __retVal, i, zero;
}
bool __constructor(const float f)
{
const float zero = 0.0;
__asm vec4_seq __retVal, i, zero;
__asm vec4_sne __retVal, f, zero;
}
int __constructor(const bool b)
@ -176,6 +176,11 @@ vec2 __constructor(const bool b)
__retVal.xy = b.xx;
}
vec2 __constructor(const bvec2 b)
{
__retVal = b;
}
vec2 __constructor(const vec3 v)
{
__retVal.xy = v.xy;
@ -211,6 +216,11 @@ vec3 __constructor(const bool b)
__retVal.xyz = b.xxx;
}
vec3 __constructor(const bvec3 b)
{
__retVal = b;
}
vec3 __constructor(const vec4 v)
{
__retVal.xyz = v.xyz;
@ -242,6 +252,11 @@ vec4 __constructor(const bool b)
__retVal = b.xxxx;
}
vec4 __constructor(const bvec4 b)
{
__retVal = b;
}
vec4 __constructor(const vec3 v3, const float f)
{
// XXX this constructor shouldn't be needed anymore
@ -349,25 +364,24 @@ bvec2 __constructor(const bool b)
bvec2 __constructor(const float f)
{
const vec2 zero = vec2(0.0, 0.0);
__asm vec4_seq __retVal.xy, f.xx, zero;
__asm vec4_sne __retVal.xy, f.xx, zero;
}
bvec2 __constructor(const int i)
{
const ivec2 zero = ivec2(0, 0);
__asm vec4_seq __retVal.xy, i.xx, zero;
__asm vec4_sne __retVal.xy, i.xx, zero;
}
bvec2 __constructor(const vec2 v)
{
const vec2 zero = vec2(0.0, 0.0);
__asm vec4_seq __retVal.xy, v, zero;
__asm vec4_sne __retVal.xy, v, 0.0;
}
bvec2 __constructor(const ivec2 v)
{
const ivec2 zero = ivec2(0, 0);
__asm vec4_seq __retVal.xy, v, zero;
__asm vec4_sne __retVal.xy, v, zero;
}
@ -389,25 +403,25 @@ bvec3 __constructor(const bool b)
bvec3 __constructor(const float f)
{
const vec3 zero = vec3(0.0, 0.0, 0.0);
__asm vec4_seq __retVal.xyz, f.xxx, zero;
__asm vec4_sne __retVal.xyz, f.xxx, zero;
}
bvec3 __constructor(const int i)
{
const ivec3 zero = ivec3(0, 0, 0);
__asm vec4_seq __retVal.xyz, i.xxx, zero;
__asm vec4_sne __retVal.xyz, i.xxx, zero;
}
bvec3 __constructor(const vec3 v)
{
const vec3 zero = vec3(0.0, 0.0, 0.0);
__asm vec4_seq __retVal.xyz, v, zero;
__asm vec4_sne __retVal.xyz, v, zero;
}
bvec3 __constructor(const ivec3 v)
{
const ivec3 zero = ivec3(0, 0, 0);
__asm vec4_seq __retVal.xyz, v, zero;
__asm vec4_sne __retVal.xyz, v, zero;
}
@ -430,25 +444,25 @@ bvec4 __constructor(const bool b)
bvec4 __constructor(const float f)
{
const vec4 zero = vec4(0.0, 0.0, 0.0, 0.0);
__asm vec4_seq __retVal, f.xxxx, zero;
__asm vec4_sne __retVal, f.xxxx, zero;
}
bvec4 __constructor(const int i)
{
const ivec4 zero = ivec4(0, 0, 0, 0);
__asm vec4_seq __retVal, i.xxxx, zero;
__asm vec4_sne __retVal, i.xxxx, zero;
}
bvec4 __constructor(const vec4 v)
{
const vec4 zero = vec4(0.0, 0.0, 0.0, 0.0);
__asm vec4_seq __retVal, v, zero;
__asm vec4_sne __retVal, v, zero;
}
bvec4 __constructor(const ivec4 v)
{
const ivec4 zero = ivec4(0, 0, 0, 0);
__asm vec4_seq __retVal, v, zero;
__asm vec4_sne __retVal, v, zero;
}
@ -1226,6 +1240,7 @@ void __operator /= (inout int a, const int b)
float invB;
__asm float_rcp invB, b;
__asm vec4_multiply a, a, invB;
__asm float_to_int a, a;
}
@ -1252,7 +1267,7 @@ void __operator /= (inout ivec2 v, const ivec2 u)
__asm float_rcp inv.x, u.x;
__asm float_rcp inv.y, u.y;
__asm vec4_multiply z, v, inv;
__asm float_to_int __retVal, z;
__asm float_to_int v, z;
}
@ -1279,7 +1294,7 @@ void __operator /= (inout ivec3 v, const ivec3 u)
__asm float_rcp inv.x, u.x;
__asm float_rcp inv.y, u.y;
__asm vec4_multiply z, v, inv;
__asm float_to_int __retVal, z;
__asm float_to_int v, z;
}
@ -1306,7 +1321,7 @@ void __operator /= (inout ivec4 v, const ivec4 u)
__asm float_rcp inv.x, u.x;
__asm float_rcp inv.y, u.y;
__asm vec4_multiply z, v, inv;
__asm float_to_int __retVal, z;
__asm float_to_int v, z;
}
@ -1314,7 +1329,7 @@ void __operator /= (inout ivec4 v, const ivec4 u)
void __operator += (inout float a, const float b)
{
__asm vec4_add a.x, a.x, b;
__asm vec4_add a.x, a.x, b.x;
}
void __operator -= (inout float a, const float b)
@ -1518,7 +1533,7 @@ void __operator /= (inout vec2 v, const float a)
{
float invA;
__asm float_rcp invA, a;
__asm vec4_multiply v.xy, v.xy, a.xx;
__asm vec4_multiply v.xy, v.xy, invA.xx;
}
@ -1543,7 +1558,7 @@ void __operator /= (inout vec3 v, const float a)
{
float invA;
__asm float_rcp invA, a;
__asm vec4_multiply v.xyz, v.xyz, a.xxx;
__asm vec4_multiply v.xyz, v.xyz, invA.xxx;
}
@ -1568,7 +1583,7 @@ void __operator /= (inout vec4 v, const float a)
{
float invA;
__asm float_rcp invA, a;
__asm vec4_multiply v, v, a.xxxx;
__asm vec4_multiply v, v, invA.xxxx;
}

View File

@ -4,9 +4,9 @@
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,101,113,0,18,95,95,114,101,116,86,97,108,0,0,18,105,0,0,18,122,
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,101,113,0,18,95,95,114,101,116,86,97,108,0,0,18,105,0,0,18,122,101,114,111,0,
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,
@ -17,471 +17,473 @@
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,
20,0,0,1,0,10,1,1,1,0,5,105,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,0,18,105,0,59,
120,120,0,20,0,0,1,0,10,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,0,18,98,
0,59,120,120,0,20,0,0,1,0,10,1,1,1,0,11,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,
0,18,118,0,59,120,121,0,20,0,0,1,0,10,1,1,1,0,12,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,
115,116,0,18,118,0,59,120,121,0,20,0,0,1,0,11,1,1,1,0,9,120,0,0,1,1,0,9,121,0,0,1,1,0,9,122,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,9,18,95,95,114,101,116,86,97,108,0,59,122,0,18,122,0,20,0,0,1,0,11,1,1,1,0,9,
102,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,18,102,0,59,120,120,120,0,20,0,0,1,
0,11,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,59,120,121,122,0,0,18,105,0,59,120,120,120,0,0,0,0,1,0,11,1,1,1,0,1,98,0,0,0,1,9,18,95,
95,114,101,116,86,97,108,0,59,120,121,122,0,18,98,0,59,120,120,120,0,20,0,0,1,0,11,1,1,1,0,12,118,
0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,18,118,0,59,120,121,122,0,20,0,0,1,0,
12,1,1,1,0,9,120,0,0,1,1,0,9,121,0,0,1,1,0,9,122,0,0,1,1,0,9,119,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,9,18,95,
95,114,101,116,86,97,108,0,59,122,0,18,122,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,18,
119,0,20,0,0,1,0,12,1,1,1,0,9,102,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,102,0,59,120,120,
120,120,0,20,0,0,1,0,12,1,1,1,0,5,105,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,105,0,59,120,
120,120,120,0,20,0,0,1,0,12,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,98,0,59,120,
120,120,120,0,20,0,0,1,0,12,1,1,1,0,11,118,51,0,0,1,1,0,9,102,0,0,0,1,9,18,95,95,114,101,116,86,97,
108,0,59,120,121,122,0,18,118,51,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,18,102,0,20,0,
0,1,0,12,1,1,1,0,10,118,50,0,0,1,1,0,9,102,49,0,0,1,1,0,9,102,50,0,0,0,1,9,18,95,95,114,101,116,86,
97,108,0,59,120,121,0,18,118,50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,18,102,49,0,20,
0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,18,102,50,0,20,0,0,1,0,6,1,1,1,0,5,105,0,0,1,1,0,5,
106,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,18,105,0,20,0,9,18,95,95,114,101,116,86,97,
108,0,59,121,0,18,106,0,20,0,0,1,0,6,1,1,1,0,5,105,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,
120,121,0,18,105,0,59,120,120,0,20,0,0,1,0,6,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,59,120,121,0,0,18,102,0,59,120,120,0,0,0,0,1,0,6,
1,1,1,0,1,98,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,59,120,121,0,0,18,98,0,59,120,120,0,0,0,0,1,0,7,1,1,1,0,5,105,0,0,1,1,0,5,106,0,0,1,1,0,5,
107,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,18,105,0,20,0,9,18,95,95,114,101,116,86,97,
108,0,59,121,0,18,106,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,18,107,0,20,0,0,1,0,7,1,1,
1,0,5,105,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,18,105,0,59,120,120,120,0,20,
0,0,1,0,7,1,1,1,0,9,102,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,18,102,0,59,
120,120,120,0,20,0,0,1,0,7,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,122,
0,18,98,0,59,120,120,120,0,20,0,0,1,0,8,1,1,1,0,5,120,0,0,1,1,0,5,121,0,0,1,1,0,5,122,0,0,1,1,0,5,
119,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,9,18,95,95,114,101,116,86,97,108,0,59,122,0,18,122,0,20,0,9,18,95,95,
114,101,116,86,97,108,0,59,119,0,18,119,0,20,0,0,1,0,8,1,1,1,0,5,105,0,0,0,1,9,18,95,95,114,101,
116,86,97,108,0,18,105,0,59,120,120,120,120,0,20,0,0,1,0,8,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,59,120,120,120,120,0,0,
0,0,1,0,8,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,98,0,59,120,120,120,120,0,20,
0,0,1,0,2,1,1,1,0,1,98,49,0,0,1,1,0,1,98,50,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,18,
98,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,18,98,50,0,20,0,0,1,0,2,1,1,1,0,1,98,0,0,
0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,0,18,98,0,59,120,120,0,20,0,0,1,0,2,1,1,1,0,9,
102,0,0,0,1,3,2,1,10,1,122,101,114,111,0,2,58,118,101,99,50,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,0,
0,0,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,102,0,59,
120,120,0,0,18,122,101,114,111,0,0,0,0,1,0,2,1,1,1,0,5,105,0,0,0,1,3,2,1,6,1,122,101,114,111,0,2,
58,105,118,101,99,50,0,16,8,48,0,0,16,8,48,0,0,0,0,0,4,118,101,99,52,95,115,101,113,0,18,95,95,114,
101,116,86,97,108,0,59,120,121,0,0,18,105,0,59,120,120,0,0,18,122,101,114,111,0,0,0,0,1,0,2,1,1,1,
0,10,118,0,0,0,1,3,2,1,10,1,122,101,114,111,0,2,58,118,101,99,50,0,17,48,0,48,0,0,0,17,48,0,48,0,0,
0,0,0,0,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,
0,18,122,101,114,111,0,0,0,0,1,0,2,1,1,1,0,6,118,0,0,0,1,3,2,1,6,1,122,101,114,111,0,2,58,105,118,
101,99,50,0,16,8,48,0,0,16,8,48,0,0,0,0,0,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,
97,108,0,59,120,121,0,0,18,118,0,0,18,122,101,114,111,0,0,0,0,1,0,3,1,1,1,0,1,98,49,0,0,1,1,0,1,98,
50,0,0,1,1,0,1,98,51,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,18,98,49,0,20,0,9,18,95,
95,114,101,116,86,97,108,0,59,121,0,18,98,50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,18,
98,51,0,20,0,0,1,0,3,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,18,
98,0,59,120,120,120,0,20,0,0,1,0,3,1,1,1,0,9,102,0,0,0,1,3,2,1,11,1,122,101,114,111,0,2,58,118,101,
99,51,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,0,0,0,4,118,101,99,52,95,115,101,113,0,
18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,102,0,59,120,120,120,0,0,18,122,101,114,111,
0,0,0,0,1,0,3,1,1,1,0,5,105,0,0,0,1,3,2,1,7,1,122,101,114,111,0,2,58,105,118,101,99,51,0,16,8,48,0,
0,16,8,48,0,0,16,8,48,0,0,0,0,0,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,
59,120,121,122,0,0,18,105,0,59,120,120,120,0,0,18,122,101,114,111,0,0,0,0,1,0,3,1,1,1,0,11,118,0,0,
0,1,3,2,1,11,1,122,101,114,111,0,2,58,118,101,99,51,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,17,48,0,48,
0,0,0,0,0,0,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,
18,118,0,0,18,122,101,114,111,0,0,0,0,1,0,3,1,1,1,0,7,118,0,0,0,1,3,2,1,7,1,122,101,114,111,0,2,58,
105,118,101,99,51,0,16,8,48,0,0,16,8,48,0,0,16,8,48,0,0,0,0,0,4,118,101,99,52,95,115,101,113,0,18,
95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0,18,122,101,114,111,0,0,0,0,1,0,4,1,1,1,
0,1,98,49,0,0,1,1,0,1,98,50,0,0,1,1,0,1,98,51,0,0,1,1,0,1,98,52,0,0,0,1,9,18,95,95,114,101,116,86,
97,108,0,59,120,0,18,98,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,18,98,50,0,20,0,9,18,
95,95,114,101,116,86,97,108,0,59,122,0,18,98,51,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,
18,98,52,0,20,0,0,1,0,4,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,122,119,
0,18,98,0,59,120,120,120,120,0,20,0,0,1,0,4,1,1,1,0,9,102,0,0,0,1,3,2,1,12,1,122,101,114,111,0,2,
58,118,101,99,52,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,0,0,0,4,118,
101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,0,18,102,0,59,120,120,120,120,0,0,18,
122,101,114,111,0,0,0,0,1,0,4,1,1,1,0,5,105,0,0,0,1,3,2,1,8,1,122,101,114,111,0,2,58,105,118,101,
99,52,0,16,8,48,0,0,16,8,48,0,0,16,8,48,0,0,16,8,48,0,0,0,0,0,4,118,101,99,52,95,115,101,113,0,18,
95,95,114,101,116,86,97,108,0,0,18,105,0,59,120,120,120,120,0,0,18,122,101,114,111,0,0,0,0,1,0,4,1,
1,1,0,12,118,0,0,0,1,3,2,1,12,1,122,101,114,111,0,2,58,118,101,99,52,0,17,48,0,48,0,0,0,17,48,0,48,
0,0,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,0,0,0,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,
116,86,97,108,0,0,18,118,0,0,18,122,101,114,111,0,0,0,0,1,0,4,1,1,1,0,8,118,0,0,0,1,3,2,1,8,1,122,
101,114,111,0,2,58,105,118,101,99,52,0,16,8,48,0,0,16,8,48,0,0,16,8,48,0,0,16,8,48,0,0,0,0,0,4,118,
101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,122,101,114,111,0,0,0,
0,1,0,13,1,1,1,0,9,109,48,48,0,0,1,1,0,9,109,49,48,0,0,1,1,0,9,109,48,49,0,0,1,1,0,9,109,49,49,0,0,
0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,120,0,18,109,48,48,0,20,0,9,18,95,95,114,
101,116,86,97,108,0,16,8,48,0,57,59,121,0,18,109,49,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,
16,10,49,0,57,59,120,0,18,109,48,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,121,
0,18,109,49,49,0,20,0,0,1,0,13,1,1,1,0,9,102,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,
57,59,120,0,18,102,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,121,0,17,48,0,48,0,0,
20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,120,0,17,48,0,48,0,0,20,0,9,18,95,95,114,
101,116,86,97,108,0,16,10,49,0,57,59,121,0,18,102,0,20,0,0,1,0,13,1,1,1,0,5,105,0,0,0,1,8,58,109,
97,116,50,0,58,102,108,111,97,116,0,18,105,0,0,0,0,0,0,0,1,0,13,1,1,1,0,1,98,0,0,0,1,8,58,109,97,
116,50,0,58,102,108,111,97,116,0,18,98,0,0,0,0,0,0,0,1,0,13,1,1,1,0,10,99,48,0,0,1,1,0,10,99,49,0,
0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,99,48,0,20,0,9,18,95,95,114,101,116,86,97,
108,0,16,10,49,0,57,18,99,49,0,20,0,0,1,0,14,1,1,1,0,9,109,48,48,0,0,1,1,0,9,109,49,48,0,0,1,1,0,9,
109,50,48,0,0,1,1,0,9,109,48,49,0,0,1,1,0,9,109,49,49,0,0,1,1,0,9,109,50,49,0,0,1,1,0,9,109,48,50,
0,0,1,1,0,9,109,49,50,0,0,1,1,0,9,109,50,50,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,
57,59,120,0,18,109,48,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,121,0,18,109,49,
48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,122,0,18,109,50,48,0,20,0,9,18,95,95,
114,101,116,86,97,108,0,16,10,49,0,57,59,120,0,18,109,48,49,0,20,0,9,18,95,95,114,101,116,86,97,
108,0,16,10,49,0,57,59,121,0,18,109,49,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,
59,122,0,18,109,50,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59,120,0,18,109,48,
50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59,121,0,18,109,49,50,0,20,0,9,18,95,95,
114,101,116,86,97,108,0,16,10,50,0,57,59,122,0,18,109,50,50,0,20,0,0,1,0,14,1,1,1,0,9,102,0,0,0,1,
3,2,0,10,1,118,0,2,58,118,101,99,50,0,18,102,0,0,17,48,0,48,0,0,0,0,0,0,9,18,95,95,114,101,116,86,
97,108,0,16,8,48,0,57,18,118,0,59,120,121,121,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,
57,18,118,0,59,121,120,121,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,118,0,59,121,
121,120,0,20,0,0,1,0,14,1,1,1,0,5,105,0,0,0,1,8,58,109,97,116,51,0,58,102,108,111,97,116,0,18,105,
0,0,0,0,0,0,0,1,0,14,1,1,1,0,1,98,0,0,0,1,8,58,109,97,116,51,0,58,102,108,111,97,116,0,18,98,0,0,0,
0,0,0,0,1,0,14,1,1,1,0,11,99,48,0,0,1,1,0,11,99,49,0,0,1,1,0,11,99,50,0,0,0,1,9,18,95,95,114,101,
116,86,97,108,0,16,8,48,0,57,18,99,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,
99,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,99,50,0,20,0,0,1,0,15,1,1,1,0,9,
109,48,48,0,0,1,1,0,9,109,49,48,0,0,1,1,0,9,109,50,48,0,0,1,1,0,9,109,51,48,0,0,1,1,0,9,109,48,49,
0,0,1,1,0,9,109,49,49,0,0,1,1,0,9,109,50,49,0,0,1,1,0,9,109,51,49,0,0,1,1,0,9,109,48,50,0,0,1,1,0,
9,109,49,50,0,0,1,1,0,9,109,50,50,0,0,1,1,0,9,109,51,50,0,0,1,1,0,9,109,48,51,0,0,1,1,0,9,109,49,
51,0,0,1,1,0,9,109,50,51,0,0,1,1,0,9,109,51,51,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,
0,57,59,120,0,18,109,48,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,121,0,18,109,
49,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,122,0,18,109,50,48,0,20,0,9,18,95,
95,114,101,116,86,97,108,0,16,8,48,0,57,59,119,0,18,109,51,48,0,20,0,9,18,95,95,114,101,116,86,97,
108,0,16,10,49,0,57,59,120,0,18,109,48,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,
59,121,0,18,109,49,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,122,0,18,109,50,
49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,119,0,18,109,51,49,0,20,0,9,18,95,95,
114,101,116,86,97,108,0,16,10,50,0,57,59,120,0,18,109,48,50,0,20,0,9,18,95,95,114,101,116,86,97,
108,0,16,10,50,0,57,59,121,0,18,109,49,50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,
59,122,0,18,109,50,50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59,119,0,18,109,51,
50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,59,120,0,18,109,48,51,0,20,0,9,18,95,95,
114,101,116,86,97,108,0,16,10,51,0,57,59,121,0,18,109,49,51,0,20,0,9,18,95,95,114,101,116,86,97,
108,0,16,10,51,0,57,59,122,0,18,109,50,51,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,
59,119,0,18,109,51,51,0,20,0,0,1,0,15,1,1,1,0,9,102,0,0,0,1,3,2,0,10,1,118,0,2,58,118,101,99,50,0,
18,102,0,0,17,48,0,48,0,0,0,0,0,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,118,0,59,120,
121,121,121,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,118,0,59,121,120,121,121,0,
20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,118,0,59,121,121,120,121,0,20,0,9,18,95,
95,114,101,116,86,97,108,0,16,10,51,0,57,18,118,0,59,121,121,121,120,0,20,0,0,1,0,15,1,1,1,0,5,105,
0,0,0,1,8,58,109,97,116,52,0,58,102,108,111,97,116,0,18,105,0,0,0,0,0,0,0,1,0,15,1,1,1,0,1,98,0,0,
0,1,8,58,109,97,116,52,0,58,102,108,111,97,116,0,18,98,0,0,0,0,0,0,0,1,0,15,1,1,1,0,12,99,48,0,0,1,
1,0,12,99,49,0,0,1,1,0,12,99,50,0,0,1,1,0,12,99,51,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,
48,0,57,18,99,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,99,49,0,20,0,9,18,95,
95,114,101,116,86,97,108,0,16,10,50,0,57,18,99,50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,
51,0,57,18,99,51,0,20,0,0,1,0,5,2,26,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,9,1,120,0,0,0,4,118,
101,99,52,95,97,100,100,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,5,2,27,1,1,0,5,97,0,0,1,1,0,5,98,0,
0,0,1,3,2,0,9,1,120,0,0,0,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,120,0,0,18,97,0,0,
0,59,120,120,0,20,0,0,1,0,10,1,1,1,0,2,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,98,0,20,0,
0,1,0,10,1,1,1,0,11,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,0,18,118,0,59,120,
121,0,20,0,0,1,0,10,1,1,1,0,12,118,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,115,116,0,18,118,
0,59,120,121,0,20,0,0,1,0,11,1,1,1,0,9,120,0,0,1,1,0,9,121,0,0,1,1,0,9,122,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,9,18,95,95,114,101,116,86,97,108,0,59,122,0,18,122,0,20,0,0,1,0,11,1,1,1,0,9,102,0,0,0,1,9,18,95,
95,114,101,116,86,97,108,0,59,120,121,122,0,18,102,0,59,120,120,120,0,20,0,0,1,0,11,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,59,120,
121,122,0,0,18,105,0,59,120,120,120,0,0,0,0,1,0,11,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,
97,108,0,59,120,121,122,0,18,98,0,59,120,120,120,0,20,0,0,1,0,11,1,1,1,0,3,98,0,0,0,1,9,18,95,95,
114,101,116,86,97,108,0,18,98,0,20,0,0,1,0,11,1,1,1,0,12,118,0,0,0,1,9,18,95,95,114,101,116,86,97,
108,0,59,120,121,122,0,18,118,0,59,120,121,122,0,20,0,0,1,0,12,1,1,1,0,9,120,0,0,1,1,0,9,121,0,0,1,
1,0,9,122,0,0,1,1,0,9,119,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,9,18,95,95,114,101,116,86,97,108,0,59,122,0,
18,122,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,18,119,0,20,0,0,1,0,12,1,1,1,0,9,102,0,0,
0,1,9,18,95,95,114,101,116,86,97,108,0,18,102,0,59,120,120,120,120,0,20,0,0,1,0,12,1,1,1,0,5,105,0,
0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,105,0,59,120,120,120,120,0,20,0,0,1,0,12,1,1,1,0,1,98,
0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,98,0,59,120,120,120,120,0,20,0,0,1,0,12,1,1,1,0,4,98,
0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,98,0,20,0,0,1,0,12,1,1,1,0,11,118,51,0,0,1,1,0,9,102,
0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,18,118,51,0,20,0,9,18,95,95,114,101,
116,86,97,108,0,59,119,0,18,102,0,20,0,0,1,0,12,1,1,1,0,10,118,50,0,0,1,1,0,9,102,49,0,0,1,1,0,9,
102,50,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,0,18,118,50,0,20,0,9,18,95,95,114,101,
116,86,97,108,0,59,122,0,18,102,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,18,102,50,0,
20,0,0,1,0,6,1,1,1,0,5,105,0,0,1,1,0,5,106,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,18,
105,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,18,106,0,20,0,0,1,0,6,1,1,1,0,5,105,0,0,0,1,
9,18,95,95,114,101,116,86,97,108,0,59,120,121,0,18,105,0,59,120,120,0,20,0,0,1,0,6,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,59,120,121,
0,0,18,102,0,59,120,120,0,0,0,0,1,0,6,1,1,1,0,1,98,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,59,120,121,0,0,18,98,0,59,120,120,0,0,0,0,1,0,7,1,1,1,0,
5,105,0,0,1,1,0,5,106,0,0,1,1,0,5,107,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,18,105,0,
20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,18,106,0,20,0,9,18,95,95,114,101,116,86,97,108,0,
59,122,0,18,107,0,20,0,0,1,0,7,1,1,1,0,5,105,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,
122,0,18,105,0,59,120,120,120,0,20,0,0,1,0,7,1,1,1,0,9,102,0,0,0,1,9,18,95,95,114,101,116,86,97,
108,0,59,120,121,122,0,18,102,0,59,120,120,120,0,20,0,0,1,0,7,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,
101,116,86,97,108,0,59,120,121,122,0,18,98,0,59,120,120,120,0,20,0,0,1,0,8,1,1,1,0,5,120,0,0,1,1,0,
5,121,0,0,1,1,0,5,122,0,0,1,1,0,5,119,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,9,18,95,95,114,101,116,86,97,108,0,
59,122,0,18,122,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,18,119,0,20,0,0,1,0,8,1,1,1,0,5,
105,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,105,0,59,120,120,120,120,0,20,0,0,1,0,8,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,59,120,120,120,120,0,0,0,0,1,0,8,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,
18,98,0,59,120,120,120,120,0,20,0,0,1,0,2,1,1,1,0,1,98,49,0,0,1,1,0,1,98,50,0,0,0,1,9,18,95,95,114,
101,116,86,97,108,0,59,120,0,18,98,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,18,98,50,
0,20,0,0,1,0,2,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,121,0,18,98,0,59,120,
120,0,20,0,0,1,0,2,1,1,1,0,9,102,0,0,0,1,3,2,1,10,1,122,101,114,111,0,2,58,118,101,99,50,0,17,48,0,
48,0,0,0,17,48,0,48,0,0,0,0,0,0,4,118,101,99,52,95,115,110,101,0,18,95,95,114,101,116,86,97,108,0,
59,120,121,0,0,18,102,0,59,120,120,0,0,18,122,101,114,111,0,0,0,0,1,0,2,1,1,1,0,5,105,0,0,0,1,3,2,
1,6,1,122,101,114,111,0,2,58,105,118,101,99,50,0,16,8,48,0,0,16,8,48,0,0,0,0,0,4,118,101,99,52,95,
115,110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,105,0,59,120,120,0,0,18,122,101,
114,111,0,0,0,0,1,0,2,1,1,1,0,10,118,0,0,0,1,4,118,101,99,52,95,115,110,101,0,18,95,95,114,101,116,
86,97,108,0,59,120,121,0,0,18,118,0,0,17,48,0,48,0,0,0,0,0,1,0,2,1,1,1,0,6,118,0,0,0,1,3,2,1,6,1,
122,101,114,111,0,2,58,105,118,101,99,50,0,16,8,48,0,0,16,8,48,0,0,0,0,0,4,118,101,99,52,95,115,
110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,122,101,114,111,0,0,0,0,1,
0,3,1,1,1,0,1,98,49,0,0,1,1,0,1,98,50,0,0,1,1,0,1,98,51,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,
59,120,0,18,98,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,18,98,50,0,20,0,9,18,95,95,
114,101,116,86,97,108,0,59,122,0,18,98,51,0,20,0,0,1,0,3,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,101,
116,86,97,108,0,59,120,121,122,0,18,98,0,59,120,120,120,0,20,0,0,1,0,3,1,1,1,0,9,102,0,0,0,1,3,2,1,
11,1,122,101,114,111,0,2,58,118,101,99,51,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,0,0,
0,4,118,101,99,52,95,115,110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,102,0,59,
120,120,120,0,0,18,122,101,114,111,0,0,0,0,1,0,3,1,1,1,0,5,105,0,0,0,1,3,2,1,7,1,122,101,114,111,0,
2,58,105,118,101,99,51,0,16,8,48,0,0,16,8,48,0,0,16,8,48,0,0,0,0,0,4,118,101,99,52,95,115,110,101,
0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,105,0,59,120,120,120,0,0,18,122,101,114,
111,0,0,0,0,1,0,3,1,1,1,0,11,118,0,0,0,1,3,2,1,11,1,122,101,114,111,0,2,58,118,101,99,51,0,17,48,0,
48,0,0,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,0,0,0,4,118,101,99,52,95,115,110,101,0,18,95,95,114,101,
116,86,97,108,0,59,120,121,122,0,0,18,118,0,0,18,122,101,114,111,0,0,0,0,1,0,3,1,1,1,0,7,118,0,0,0,
1,3,2,1,7,1,122,101,114,111,0,2,58,105,118,101,99,51,0,16,8,48,0,0,16,8,48,0,0,16,8,48,0,0,0,0,0,4,
118,101,99,52,95,115,110,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0,18,
122,101,114,111,0,0,0,0,1,0,4,1,1,1,0,1,98,49,0,0,1,1,0,1,98,50,0,0,1,1,0,1,98,51,0,0,1,1,0,1,98,
52,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,18,98,49,0,20,0,9,18,95,95,114,101,116,86,
97,108,0,59,121,0,18,98,50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,18,98,51,0,20,0,9,18,
95,95,114,101,116,86,97,108,0,59,119,0,18,98,52,0,20,0,0,1,0,4,1,1,1,0,1,98,0,0,0,1,9,18,95,95,114,
101,116,86,97,108,0,59,120,121,122,119,0,18,98,0,59,120,120,120,120,0,20,0,0,1,0,4,1,1,1,0,9,102,0,
0,0,1,3,2,1,12,1,122,101,114,111,0,2,58,118,101,99,52,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,17,48,0,
48,0,0,0,17,48,0,48,0,0,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,59,120,120,120,120,0,0,18,122,101,114,111,0,0,0,0,1,0,4,1,1,1,0,5,105,0,0,0,1,3,2,1,8,1,
122,101,114,111,0,2,58,105,118,101,99,52,0,16,8,48,0,0,16,8,48,0,0,16,8,48,0,0,16,8,48,0,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,59,120,120,120,120,0,0,
18,122,101,114,111,0,0,0,0,1,0,4,1,1,1,0,12,118,0,0,0,1,3,2,1,12,1,122,101,114,111,0,2,58,118,101,
99,52,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,17,48,0,48,0,0,0,17,48,0,48,0,0,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,118,0,0,18,122,101,114,111,0,0,0,0,1,0,4,1,
1,1,0,8,118,0,0,0,1,3,2,1,8,1,122,101,114,111,0,2,58,105,118,101,99,52,0,16,8,48,0,0,16,8,48,0,0,
16,8,48,0,0,16,8,48,0,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,118,0,0,18,122,101,114,111,0,0,0,0,1,0,13,1,1,1,0,9,109,48,48,0,0,1,1,0,9,109,49,48,0,0,1,1,0,9,
109,48,49,0,0,1,1,0,9,109,49,49,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,120,0,
18,109,48,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,121,0,18,109,49,48,0,20,0,9,
18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,120,0,18,109,48,49,0,20,0,9,18,95,95,114,101,116,
86,97,108,0,16,10,49,0,57,59,121,0,18,109,49,49,0,20,0,0,1,0,13,1,1,1,0,9,102,0,0,0,1,9,18,95,95,
114,101,116,86,97,108,0,16,8,48,0,57,59,120,0,18,102,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,
8,48,0,57,59,121,0,17,48,0,48,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,120,0,
17,48,0,48,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,121,0,18,102,0,20,0,0,1,0,
13,1,1,1,0,5,105,0,0,0,1,8,58,109,97,116,50,0,58,102,108,111,97,116,0,18,105,0,0,0,0,0,0,0,1,0,13,
1,1,1,0,1,98,0,0,0,1,8,58,109,97,116,50,0,58,102,108,111,97,116,0,18,98,0,0,0,0,0,0,0,1,0,13,1,1,1,
0,10,99,48,0,0,1,1,0,10,99,49,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,99,48,0,
20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,99,49,0,20,0,0,1,0,14,1,1,1,0,9,109,48,48,
0,0,1,1,0,9,109,49,48,0,0,1,1,0,9,109,50,48,0,0,1,1,0,9,109,48,49,0,0,1,1,0,9,109,49,49,0,0,1,1,0,
9,109,50,49,0,0,1,1,0,9,109,48,50,0,0,1,1,0,9,109,49,50,0,0,1,1,0,9,109,50,50,0,0,0,1,9,18,95,95,
114,101,116,86,97,108,0,16,8,48,0,57,59,120,0,18,109,48,48,0,20,0,9,18,95,95,114,101,116,86,97,108,
0,16,8,48,0,57,59,121,0,18,109,49,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,122,
0,18,109,50,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,120,0,18,109,48,49,0,20,
0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,121,0,18,109,49,49,0,20,0,9,18,95,95,114,101,
116,86,97,108,0,16,10,49,0,57,59,122,0,18,109,50,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,
10,50,0,57,59,120,0,18,109,48,50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59,121,0,
18,109,49,50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59,122,0,18,109,50,50,0,20,0,
0,1,0,14,1,1,1,0,9,102,0,0,0,1,3,2,0,10,1,118,0,2,58,118,101,99,50,0,18,102,0,0,17,48,0,48,0,0,0,0,
0,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,118,0,59,120,121,121,0,20,0,9,18,95,95,114,
101,116,86,97,108,0,16,10,49,0,57,18,118,0,59,121,120,121,0,20,0,9,18,95,95,114,101,116,86,97,108,
0,16,10,50,0,57,18,118,0,59,121,121,120,0,20,0,0,1,0,14,1,1,1,0,5,105,0,0,0,1,8,58,109,97,116,51,0,
58,102,108,111,97,116,0,18,105,0,0,0,0,0,0,0,1,0,14,1,1,1,0,1,98,0,0,0,1,8,58,109,97,116,51,0,58,
102,108,111,97,116,0,18,98,0,0,0,0,0,0,0,1,0,14,1,1,1,0,11,99,48,0,0,1,1,0,11,99,49,0,0,1,1,0,11,
99,50,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,99,48,0,20,0,9,18,95,95,114,101,
116,86,97,108,0,16,10,49,0,57,18,99,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,
99,50,0,20,0,0,1,0,15,1,1,1,0,9,109,48,48,0,0,1,1,0,9,109,49,48,0,0,1,1,0,9,109,50,48,0,0,1,1,0,9,
109,51,48,0,0,1,1,0,9,109,48,49,0,0,1,1,0,9,109,49,49,0,0,1,1,0,9,109,50,49,0,0,1,1,0,9,109,51,49,
0,0,1,1,0,9,109,48,50,0,0,1,1,0,9,109,49,50,0,0,1,1,0,9,109,50,50,0,0,1,1,0,9,109,51,50,0,0,1,1,0,
9,109,48,51,0,0,1,1,0,9,109,49,51,0,0,1,1,0,9,109,50,51,0,0,1,1,0,9,109,51,51,0,0,0,1,9,18,95,95,
114,101,116,86,97,108,0,16,8,48,0,57,59,120,0,18,109,48,48,0,20,0,9,18,95,95,114,101,116,86,97,108,
0,16,8,48,0,57,59,121,0,18,109,49,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,122,
0,18,109,50,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,59,119,0,18,109,51,48,0,20,0,
9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,120,0,18,109,48,49,0,20,0,9,18,95,95,114,101,
116,86,97,108,0,16,10,49,0,57,59,121,0,18,109,49,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,
10,49,0,57,59,122,0,18,109,50,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,59,119,0,
18,109,51,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59,120,0,18,109,48,50,0,20,0,
9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,59,121,0,18,109,49,50,0,20,0,9,18,95,95,114,101,
116,86,97,108,0,16,10,50,0,57,59,122,0,18,109,50,50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,
10,50,0,57,59,119,0,18,109,51,50,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,59,120,0,
18,109,48,51,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,59,121,0,18,109,49,51,0,20,0,
9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,59,122,0,18,109,50,51,0,20,0,9,18,95,95,114,101,
116,86,97,108,0,16,10,51,0,57,59,119,0,18,109,51,51,0,20,0,0,1,0,15,1,1,1,0,9,102,0,0,0,1,3,2,0,10,
1,118,0,2,58,118,101,99,50,0,18,102,0,0,17,48,0,48,0,0,0,0,0,0,9,18,95,95,114,101,116,86,97,108,0,
16,8,48,0,57,18,118,0,59,120,121,121,121,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,
18,118,0,59,121,120,121,121,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,118,0,59,
121,121,120,121,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,18,118,0,59,121,121,121,
120,0,20,0,0,1,0,15,1,1,1,0,5,105,0,0,0,1,8,58,109,97,116,52,0,58,102,108,111,97,116,0,18,105,0,0,
0,0,0,0,0,1,0,15,1,1,1,0,1,98,0,0,0,1,8,58,109,97,116,52,0,58,102,108,111,97,116,0,18,98,0,0,0,0,0,
0,0,1,0,15,1,1,1,0,12,99,48,0,0,1,1,0,12,99,49,0,0,1,1,0,12,99,50,0,0,1,1,0,12,99,51,0,0,0,1,9,18,
95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,99,48,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,
10,49,0,57,18,99,49,0,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,99,50,0,20,0,9,18,
95,95,114,101,116,86,97,108,0,16,10,51,0,57,18,99,51,0,20,0,0,1,0,5,2,26,1,1,0,5,97,0,0,1,1,0,5,98,
0,0,0,1,3,2,0,9,1,120,0,0,0,4,118,101,99,52,95,97,100,100,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,5,
2,27,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,9,1,120,0,0,0,4,118,101,99,52,95,115,117,98,116,114,
97,99,116,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,5,2,21,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,
9,1,120,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,120,0,0,18,97,0,0,18,98,0,0,
0,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,120,0,0,0,
0,1,0,5,2,22,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,9,1,98,73,110,118,0,0,1,1,120,0,0,0,4,102,108,
111,97,116,95,114,99,112,0,18,98,73,110,118,0,0,18,98,0,0,0,4,118,101,99,52,95,109,117,108,116,105,
112,108,121,0,18,120,0,0,18,97,0,0,18,98,73,110,118,0,0,0,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,120,0,0,0,0,1,0,6,2,26,1,1,0,6,97,0,0,1,1,0,6,98,0,
0,0,1,3,2,0,10,1,120,0,0,0,4,118,101,99,52,95,97,100,100,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,6,
2,27,1,1,0,6,97,0,0,1,1,0,6,98,0,0,0,1,3,2,0,10,1,120,0,0,0,4,118,101,99,52,95,115,117,98,116,114,
97,99,116,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,6,2,21,1,1,0,6,97,0,0,1,1,0,6,98,0,0,0,1,3,2,0,
10,1,120,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,120,0,0,18,97,0,0,18,98,0,0,
0,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,120,0,0,0,
0,1,0,6,2,22,1,1,0,6,97,0,0,1,1,0,6,98,0,0,0,1,3,2,0,10,1,98,73,110,118,0,0,1,1,120,0,0,0,4,102,
108,111,97,116,95,114,99,112,0,18,98,73,110,118,0,59,120,0,0,18,98,0,59,120,0,0,0,4,102,108,111,97,
116,95,114,99,112,0,18,98,73,110,118,0,59,121,0,0,18,98,0,59,121,0,0,0,4,118,101,99,52,95,109,117,
108,116,105,112,108,121,0,18,120,0,0,18,97,0,0,18,98,73,110,118,0,0,0,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,120,0,0,0,0,1,0,7,2,26,1,1,0,7,97,0,0,1,
1,0,7,98,0,0,0,1,3,2,0,11,1,120,0,0,0,4,118,101,99,52,95,97,100,100,0,18,120,0,0,18,97,0,0,18,98,0,
0,0,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,120,0,0,
0,0,1,0,7,2,27,1,1,0,7,97,0,0,1,1,0,7,98,0,0,0,1,3,2,0,11,1,120,0,0,0,4,118,101,99,52,95,115,117,
98,116,114,97,99,116,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,7,2,21,1,1,0,7,97,0,0,1,1,0,7,98,0,0,0,
1,3,2,0,11,1,120,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,120,0,0,18,97,0,0,
18,98,0,0,0,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,
120,0,0,0,0,1,0,5,2,21,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,9,1,120,0,0,0,4,118,101,99,52,95,
109,117,108,116,105,112,108,121,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,5,2,22,1,1,0,5,97,0,0,1,1,0,
5,98,0,0,0,1,3,2,0,9,1,98,73,110,118,0,0,1,1,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,98,
73,110,118,0,0,18,98,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,120,0,0,18,97,0,
0,18,98,73,110,118,0,0,0,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,120,0,0,0,0,1,0,6,2,26,1,1,0,6,97,0,0,1,1,0,6,98,0,0,0,1,3,2,0,10,1,120,0,0,0,4,118,
101,99,52,95,97,100,100,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,6,2,27,1,1,0,6,97,0,0,1,1,0,6,98,0,
0,0,1,3,2,0,10,1,120,0,0,0,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,120,0,0,18,97,0,0,
120,0,0,0,0,1,0,7,2,22,1,1,0,7,97,0,0,1,1,0,7,98,0,0,0,1,3,2,0,11,1,98,73,110,118,0,0,1,1,120,0,0,
0,4,102,108,111,97,116,95,114,99,112,0,18,98,73,110,118,0,59,120,0,0,18,98,0,59,120,0,0,0,4,102,
108,111,97,116,95,114,99,112,0,18,98,73,110,118,0,59,121,0,0,18,98,0,59,121,0,0,0,4,102,108,111,97,
116,95,114,99,112,0,18,98,73,110,118,0,59,122,0,0,18,98,0,59,122,0,0,0,4,118,101,99,52,95,109,117,
108,116,105,112,108,121,0,18,120,0,0,18,97,0,0,18,98,73,110,118,0,0,0,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,120,0,0,0,0,1,0,8,2,26,1,1,0,8,97,0,0,1,
1,0,8,98,0,0,0,1,3,2,0,11,1,120,0,0,0,4,118,101,99,52,95,97,100,100,0,18,120,0,0,18,97,0,0,18,98,0,
0,0,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,120,0,0,
0,0,1,0,8,2,27,1,1,0,8,97,0,0,1,1,0,8,98,0,0,0,1,3,2,0,12,1,120,0,0,0,4,118,101,99,52,95,115,117,
98,116,114,97,99,116,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,8,2,21,1,1,0,8,97,0,0,1,1,0,8,98,0,0,0,
1,3,2,0,12,1,120,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,120,0,0,18,97,0,0,
18,98,0,0,0,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,
120,0,0,0,0,1,0,6,2,21,1,1,0,6,97,0,0,1,1,0,6,98,0,0,0,1,3,2,0,10,1,120,0,0,0,4,118,101,99,52,95,
109,117,108,116,105,112,108,121,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,6,2,22,1,1,0,6,97,0,0,1,1,0,
6,98,0,0,0,1,3,2,0,10,1,98,73,110,118,0,0,1,1,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,98,
73,110,118,0,59,120,0,0,18,98,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,98,73,110,118,
0,59,121,0,0,18,98,0,59,121,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,120,0,0,
18,97,0,0,18,98,73,110,118,0,0,0,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,120,0,0,0,0,1,0,7,2,26,1,1,0,7,97,0,0,1,1,0,7,98,0,0,0,1,3,2,0,11,1,120,0,0,0,
4,118,101,99,52,95,97,100,100,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,7,2,27,1,1,0,7,97,0,0,1,1,0,
7,98,0,0,0,1,3,2,0,11,1,120,0,0,0,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,120,0,0,18,
97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,7,2,21,1,1,0,7,97,0,0,1,1,0,7,98,0,0,0,1,3,2,0,11,1,120,0,0,0,4,118,101,99,
52,95,109,117,108,116,105,112,108,121,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,7,2,22,1,1,0,7,97,0,
0,1,1,0,7,98,0,0,0,1,3,2,0,11,1,98,73,110,118,0,0,1,1,120,0,0,0,4,102,108,111,97,116,95,114,99,112,
0,18,98,73,110,118,0,59,120,0,0,18,98,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,98,73,
110,118,0,59,121,0,0,18,98,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,98,73,110,118,0,
59,122,0,0,18,98,0,59,122,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,120,0,0,18,
97,0,0,18,98,73,110,118,0,0,0,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,120,0,0,0,0,1,0,8,2,26,1,1,0,8,97,0,0,1,1,0,8,98,0,0,0,1,3,2,0,11,1,120,0,0,0,
4,118,101,99,52,95,97,100,100,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,8,2,27,1,1,0,8,97,0,0,1,1,0,
8,98,0,0,0,1,3,2,0,12,1,120,0,0,0,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,120,0,0,18,
97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,8,2,21,1,1,0,8,97,0,0,1,1,0,8,98,0,0,0,1,3,2,0,12,1,120,0,0,0,4,118,101,99,
52,95,109,117,108,116,105,112,108,121,0,18,120,0,0,18,97,0,0,18,98,0,0,0,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,120,0,0,0,0,1,0,8,2,22,1,1,0,8,97,0,
0,1,1,0,8,98,0,0,0,1,3,2,0,12,1,98,73,110,118,0,0,1,1,120,0,0,0,4,102,108,111,97,116,95,114,99,112,
0,18,98,73,110,118,0,59,120,0,0,18,98,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,98,73,
110,118,0,59,121,0,0,18,98,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,98,73,110,118,0,
59,122,0,0,18,98,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,98,73,110,118,0,59,119,0,0,
18,98,0,59,119,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,120,0,0,18,97,0,0,18,
98,73,110,118,0,0,0,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,120,0,0,0,0,1,0,9,2,26,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,97,100,100,
0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,0,18,98,0,0,0,0,1,0,9,2,27,1,1,0,9,97,0,0,1,
1,0,9,98,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,
0,59,120,0,0,18,97,0,0,18,98,0,0,0,0,1,0,9,2,21,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,
95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,0,18,98,0,
0,0,0,1,0,9,2,22,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,98,73,110,118,0,0,0,4,102,108,111,97,
116,95,114,99,112,0,18,98,73,110,118,0,59,120,0,0,18,98,0,59,120,0,0,0,4,118,101,99,52,95,109,117,
108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,0,18,98,73,110,118,0,
0,0,0,1,0,10,2,26,1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,
114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,117,0,0,0,0,1,0,10,2,27,1,1,0,10,118,0,0,1,1,
0,10,117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,
0,59,120,121,0,0,18,118,0,0,18,117,0,0,0,0,1,0,10,2,21,1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,4,118,
120,0,0,0,0,1,0,8,2,22,1,1,0,8,97,0,0,1,1,0,8,98,0,0,0,1,3,2,0,12,1,98,73,110,118,0,0,1,1,120,0,0,
0,4,102,108,111,97,116,95,114,99,112,0,18,98,73,110,118,0,59,120,0,0,18,98,0,59,120,0,0,0,4,102,
108,111,97,116,95,114,99,112,0,18,98,73,110,118,0,59,121,0,0,18,98,0,59,121,0,0,0,4,102,108,111,97,
116,95,114,99,112,0,18,98,73,110,118,0,59,122,0,0,18,98,0,59,122,0,0,0,4,102,108,111,97,116,95,114,
99,112,0,18,98,73,110,118,0,59,119,0,0,18,98,0,59,119,0,0,0,4,118,101,99,52,95,109,117,108,116,105,
112,108,121,0,18,120,0,0,18,97,0,0,18,98,73,110,118,0,0,0,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,120,0,0,0,0,1,0,9,2,26,1,1,0,9,97,0,0,1,1,0,9,98,0,
0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,0,18,98,
0,0,0,0,1,0,9,2,27,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,
116,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,0,18,98,0,0,0,0,1,0,9,2,21,1,1,0,9,97,0,
0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,
97,108,0,59,120,0,0,18,97,0,0,18,98,0,0,0,0,1,0,9,2,22,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,
98,73,110,118,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,98,73,110,118,0,59,120,0,0,18,98,0,59,
120,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,
120,0,0,18,97,0,0,18,98,73,110,118,0,0,0,0,1,0,10,2,26,1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,4,118,
101,99,52,95,97,100,100,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,117,0,0,0,
0,1,0,10,2,27,1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,
116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,117,0,0,0,0,1,0,10,2,21,1,1,0,
10,118,0,0,1,1,0,10,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,
101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,117,0,0,0,0,1,0,10,2,22,1,1,0,10,118,0,0,1,1,0,10,
117,0,0,0,1,3,2,0,10,1,119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,120,0,0,18,117,0,
59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,121,0,0,18,117,0,59,121,0,0,0,4,118,
101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,
118,0,0,18,117,0,0,0,0,1,0,10,2,22,1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,3,2,0,10,1,119,0,0,0,4,
102,108,111,97,116,95,114,99,112,0,18,119,0,59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,111,97,116,
95,114,99,112,0,18,119,0,59,121,0,0,18,117,0,59,121,0,0,0,4,118,101,99,52,95,109,117,108,116,105,
112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,119,0,0,0,0,1,0,11,2,
26,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,114,101,116,86,
97,108,0,59,120,121,122,0,0,18,118,0,0,18,117,0,0,0,0,1,0,11,2,27,1,1,0,11,118,0,0,1,1,0,11,117,0,
0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,59,120,
121,122,0,0,18,118,0,0,18,117,0,0,0,0,1,0,11,2,21,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,4,118,101,
99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,
118,0,0,18,117,0,0,0,0,1,0,11,2,22,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,3,2,0,11,1,119,0,0,0,4,
102,108,111,97,116,95,114,99,112,0,18,119,0,59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,111,97,116,
95,114,99,112,0,18,119,0,59,121,0,0,18,117,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,
119,0,59,122,0,0,18,117,0,59,122,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,
95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0,18,119,0,0,0,0,1,0,12,2,26,1,1,0,12,118,0,
0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,
0,18,117,0,0,0,0,1,0,12,2,27,1,1,0,12,118,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,115,117,98,
116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,117,0,0,0,0,1,0,12,2,21,1,1,0,
12,118,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,
101,116,86,97,108,0,0,18,118,0,0,18,117,0,0,0,0,1,0,12,2,22,1,1,0,12,118,0,0,1,1,0,12,117,0,0,0,1,
3,2,0,12,1,119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,120,0,0,18,117,0,59,120,0,0,
0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,121,0,0,18,117,0,59,121,0,0,0,4,102,108,111,97,
116,95,114,99,112,0,18,119,0,59,122,0,0,18,117,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,
18,119,0,59,119,0,0,18,117,0,59,119,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,
95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,119,0,0,0,0,1,0,10,2,26,1,1,0,9,97,0,0,1,1,0,10,117,
0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,97,0,59,
120,120,0,0,18,117,0,59,120,121,0,0,0,0,1,0,10,2,26,1,1,0,10,118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,
99,52,95,97,100,100,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,59,120,121,0,0,18,
98,0,59,120,120,0,0,0,0,1,0,10,2,27,1,1,0,9,97,0,0,1,1,0,10,117,0,0,0,1,4,118,101,99,52,95,115,117,
98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,97,0,59,120,120,0,0,18,
117,0,59,120,121,0,0,0,0,1,0,10,2,27,1,1,0,10,118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,115,
117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,59,120,121,0,0,
18,98,0,59,120,120,0,0,0,0,1,0,10,2,21,1,1,0,9,97,0,0,1,1,0,10,117,0,0,0,1,4,118,101,99,52,95,109,
117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,97,0,59,120,120,0,
0,18,117,0,59,120,121,0,0,0,0,1,0,10,2,21,1,1,0,10,118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,
109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,59,120,
121,0,0,18,98,0,59,120,120,0,0,0,0,1,0,10,2,22,1,1,0,9,97,0,0,1,1,0,10,117,0,0,0,1,3,2,0,10,1,105,
110,118,85,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,85,0,59,120,0,0,18,117,0,59,
120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,85,0,59,121,0,0,18,117,0,59,121,0,0,
0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,
0,0,18,97,0,59,120,120,0,0,18,105,110,118,85,0,59,120,121,0,0,0,0,1,0,10,2,22,1,1,0,10,118,0,0,1,1,
0,9,98,0,0,0,1,3,2,0,9,1,105,110,118,66,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,
66,0,0,18,98,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,
108,0,59,120,121,0,0,18,118,0,59,120,121,0,0,18,105,110,118,66,0,59,120,120,0,0,0,0,1,0,11,2,26,1,
1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,114,101,116,86,97,108,0,
59,120,121,122,0,0,18,97,0,59,120,120,120,0,0,18,117,0,59,120,121,122,0,0,0,0,1,0,11,2,26,1,1,0,11,
118,0,0,18,119,0,0,0,0,1,0,11,2,26,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,97,100,
100,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0,18,117,0,0,0,0,1,0,11,2,27,1,
1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,
101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0,18,117,0,0,0,0,1,0,11,2,21,1,1,0,11,118,0,0,1,1,
0,11,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,
108,0,59,120,121,122,0,0,18,118,0,0,18,117,0,0,0,0,1,0,11,2,22,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,
1,3,2,0,11,1,119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,120,0,0,18,117,0,59,120,0,
0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,121,0,0,18,117,0,59,121,0,0,0,4,102,108,111,
97,116,95,114,99,112,0,18,119,0,59,122,0,0,18,117,0,59,122,0,0,0,4,118,101,99,52,95,109,117,108,
116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0,18,119,0,0,0,
0,1,0,12,2,26,1,1,0,12,118,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,114,
101,116,86,97,108,0,0,18,118,0,0,18,117,0,0,0,0,1,0,12,2,27,1,1,0,12,118,0,0,1,1,0,12,117,0,0,0,1,
4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,
117,0,0,0,0,1,0,12,2,21,1,1,0,12,118,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,
105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,117,0,0,0,0,1,0,12,2,22,1,1,0,
12,118,0,0,1,1,0,12,117,0,0,0,1,3,2,0,12,1,119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,
59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,121,0,0,18,117,0,
59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,122,0,0,18,117,0,59,122,0,0,0,4,102,
108,111,97,116,95,114,99,112,0,18,119,0,59,119,0,0,18,117,0,59,119,0,0,0,4,118,101,99,52,95,109,
117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,119,0,0,0,0,1,0,10,
2,26,1,1,0,9,97,0,0,1,1,0,10,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,114,101,116,86,
97,108,0,59,120,121,0,0,18,97,0,59,120,120,0,0,18,117,0,59,120,121,0,0,0,0,1,0,10,2,26,1,1,0,10,
118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,114,101,116,86,97,108,0,59,120,
121,122,0,0,18,118,0,59,120,121,122,0,0,18,98,0,59,120,120,120,0,0,0,0,1,0,11,2,27,1,1,0,9,97,0,0,
1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,
108,0,59,120,121,122,0,0,18,97,0,59,120,120,120,0,0,18,117,0,59,120,121,122,0,0,0,0,1,0,11,2,27,1,
1,0,11,118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,
101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,18,98,0,59,120,120,120,0,0,0,0,
1,0,11,2,21,1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,
0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,97,0,59,120,120,120,0,0,18,117,0,59,120,
121,122,0,0,0,0,1,0,11,2,21,1,1,0,11,118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,109,117,108,116,
105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,
18,98,0,59,120,120,120,0,0,0,0,1,0,11,2,22,1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,3,2,0,11,1,105,110,
118,85,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,85,0,59,120,0,0,18,117,0,59,120,0,
0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,85,0,59,121,0,0,18,117,0,59,121,0,0,0,4,
102,108,111,97,116,95,114,99,112,0,18,105,110,118,85,0,59,122,0,0,18,117,0,59,122,0,0,0,4,118,101,
99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,
97,0,59,120,120,120,0,0,18,105,110,118,85,0,59,120,121,122,0,0,0,0,1,0,11,2,22,1,1,0,11,118,0,0,1,
1,0,9,98,0,0,0,1,3,2,0,9,1,105,110,118,66,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,
118,66,0,0,18,98,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,
86,97,108,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,18,105,110,118,66,0,59,120,120,120,0,0,
0,0,1,0,12,2,26,1,1,0,9,97,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,114,
101,116,86,97,108,0,0,18,97,0,59,120,120,120,120,0,0,18,117,0,0,0,0,1,0,12,2,26,1,1,0,12,118,0,0,1,
1,0,9,98,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,
98,0,59,120,120,120,120,0,0,0,0,1,0,12,2,27,1,1,0,9,97,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,
115,117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,59,120,120,120,120,0,0,
18,117,0,0,0,0,1,0,12,2,27,1,1,0,12,118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,115,117,98,116,
114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,98,0,59,120,120,120,120,0,0,0,0,1,
0,12,2,21,1,1,0,9,97,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,
18,95,95,114,101,116,86,97,108,0,0,18,97,0,59,120,120,120,120,0,0,18,117,0,0,0,0,1,0,12,2,21,1,1,0,
12,118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,
101,116,86,97,108,0,0,18,118,0,0,18,98,0,59,120,120,120,120,0,0,0,0,1,0,12,2,22,1,1,0,9,97,0,0,1,1,
0,12,117,0,0,0,1,3,2,0,12,1,105,110,118,85,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,
121,0,0,18,118,0,59,120,121,0,0,18,98,0,59,120,120,0,0,0,0,1,0,10,2,27,1,1,0,9,97,0,0,1,1,0,10,117,
0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,59,120,
121,0,0,18,97,0,59,120,120,0,0,18,117,0,59,120,121,0,0,0,0,1,0,10,2,27,1,1,0,10,118,0,0,1,1,0,9,98,
0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,59,120,
121,0,0,18,118,0,59,120,121,0,0,18,98,0,59,120,120,0,0,0,0,1,0,10,2,21,1,1,0,9,97,0,0,1,1,0,10,117,
0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,
120,121,0,0,18,97,0,59,120,120,0,0,18,117,0,59,120,121,0,0,0,0,1,0,10,2,21,1,1,0,10,118,0,0,1,1,0,
9,98,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,
59,120,121,0,0,18,118,0,59,120,121,0,0,18,98,0,59,120,120,0,0,0,0,1,0,10,2,22,1,1,0,9,97,0,0,1,1,0,
10,117,0,0,0,1,3,2,0,10,1,105,110,118,85,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,
85,0,59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,85,0,59,
121,0,0,18,117,0,59,121,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,
101,116,86,97,108,0,59,120,121,0,0,18,97,0,59,120,120,0,0,18,105,110,118,85,0,59,120,121,0,0,0,0,1,
0,10,2,22,1,1,0,10,118,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,105,110,118,66,0,0,0,4,102,108,111,97,116,
95,114,99,112,0,18,105,110,118,66,0,0,18,98,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,
121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,59,120,121,0,0,18,105,110,118,66,0,
59,120,120,0,0,0,0,1,0,11,2,26,1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,
18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,97,0,59,120,120,120,0,0,18,117,0,59,120,121,
122,0,0,0,0,1,0,11,2,26,1,1,0,11,118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,
95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,18,98,0,59,120,120,120,0,
0,0,0,1,0,11,2,27,1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,
116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,97,0,59,120,120,120,0,0,18,117,0,59,
120,121,122,0,0,0,0,1,0,11,2,27,1,1,0,11,118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,115,117,98,
116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,
0,18,98,0,59,120,120,120,0,0,0,0,1,0,11,2,21,1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,
95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,97,0,
59,120,120,120,0,0,18,117,0,59,120,121,122,0,0,0,0,1,0,11,2,21,1,1,0,11,118,0,0,1,1,0,9,98,0,0,0,1,
4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,
122,0,0,18,118,0,59,120,121,122,0,0,18,98,0,59,120,120,120,0,0,0,0,1,0,11,2,22,1,1,0,9,97,0,0,1,1,
0,11,117,0,0,0,1,3,2,0,11,1,105,110,118,85,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,
118,85,0,59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,85,0,
59,121,0,0,18,117,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,85,0,59,122,0,
0,18,117,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,85,0,59,119,0,0,18,117,
0,59,119,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,
0,0,18,97,0,59,120,120,120,120,0,0,18,105,110,118,85,0,0,0,0,1,0,12,2,22,1,1,0,12,118,0,0,1,1,0,9,
98,0,0,0,1,3,2,0,9,1,105,110,118,66,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,66,0,
0,18,98,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,
0,0,18,118,0,0,18,105,110,118,66,0,59,120,120,120,120,0,0,0,0,1,0,6,2,26,1,1,0,5,97,0,0,1,1,0,6,
117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,50,0,18,97,0,0,0,18,117,0,46,20,0,
0,1,0,6,2,26,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,
118,101,99,50,0,18,98,0,0,0,46,20,0,0,1,0,6,2,27,1,1,0,5,97,0,0,1,1,0,6,117,0,0,0,1,9,18,95,95,114,
101,116,86,97,108,0,58,105,118,101,99,50,0,18,97,0,0,0,18,117,0,47,20,0,0,1,0,6,2,27,1,1,0,6,118,0,
0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,50,0,18,98,0,0,
0,47,20,0,0,1,0,6,2,21,1,1,0,5,97,0,0,1,1,0,6,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,
105,118,101,99,50,0,18,97,0,0,0,18,117,0,48,20,0,0,1,0,6,2,21,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1,9,
18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,50,0,18,98,0,0,0,48,20,0,0,1,0,6,2,22,
1,1,0,5,97,0,0,1,1,0,6,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,50,0,18,97,
0,0,0,18,117,0,49,20,0,0,1,0,6,2,22,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,
97,108,0,18,118,0,58,105,118,101,99,50,0,18,98,0,0,0,49,20,0,0,1,0,7,2,26,1,1,0,5,97,0,0,1,1,0,7,
117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,51,0,18,97,0,0,0,18,117,0,46,20,0,
0,1,0,7,2,26,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,
118,101,99,51,0,18,98,0,0,0,46,20,0,0,1,0,7,2,27,1,1,0,5,97,0,0,1,1,0,7,117,0,0,0,1,9,18,95,95,114,
101,116,86,97,108,0,58,105,118,101,99,51,0,18,97,0,0,0,18,117,0,47,20,0,0,1,0,7,2,27,1,1,0,7,118,0,
0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,51,0,18,98,0,0,
0,47,20,0,0,1,0,7,2,21,1,1,0,5,97,0,0,1,1,0,7,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,
105,118,101,99,51,0,18,97,0,0,0,18,117,0,48,20,0,0,1,0,7,2,21,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,9,
18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,51,0,18,98,0,0,0,48,20,0,0,1,0,7,2,22,
1,1,0,5,97,0,0,1,1,0,7,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,51,0,18,97,
0,0,0,18,117,0,49,20,0,0,1,0,7,2,22,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,
97,108,0,18,118,0,58,105,118,101,99,51,0,18,98,0,0,0,49,20,0,0,1,0,8,2,26,1,1,0,5,97,0,0,1,1,0,8,
117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,52,0,18,97,0,0,0,18,117,0,46,20,0,
0,1,0,8,2,26,1,1,0,8,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,
118,101,99,52,0,18,98,0,0,0,46,20,0,0,1,0,8,2,27,1,1,0,5,97,0,0,1,1,0,8,117,0,0,0,1,9,18,95,95,114,
101,116,86,97,108,0,58,105,118,101,99,52,0,18,97,0,0,0,18,117,0,47,20,0,0,1,0,8,2,27,1,1,0,8,118,0,
0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,52,0,18,98,0,0,
0,47,20,0,0,1,0,8,2,21,1,1,0,5,97,0,0,1,1,0,8,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,
105,118,101,99,52,0,18,97,0,0,0,18,117,0,48,20,0,0,1,0,8,2,21,1,1,0,8,118,0,0,1,1,0,5,98,0,0,0,1,9,
18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,52,0,18,98,0,0,0,48,20,0,0,1,0,8,2,22,
1,1,0,5,97,0,0,1,1,0,8,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,52,0,18,97,
0,0,0,18,117,0,49,20,0,0,1,0,8,2,22,1,1,0,8,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,
97,108,0,18,118,0,58,105,118,101,99,52,0,18,98,0,0,0,49,20,0,0,1,0,5,2,27,1,1,0,5,97,0,0,0,1,4,118,
101,99,52,95,110,101,103,97,116,101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,0,0,0,1,
0,6,2,27,1,1,0,6,118,0,0,0,1,4,118,101,99,52,95,110,101,103,97,116,101,0,18,95,95,114,101,116,86,
97,108,0,0,18,118,0,0,0,0,1,0,7,2,27,1,1,0,7,118,0,0,0,1,4,118,101,99,52,95,110,101,103,97,116,101,
0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,0,0,1,0,8,2,27,1,1,0,8,118,0,0,0,1,4,118,101,99,52,
95,110,101,103,97,116,101,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,0,0,1,0,9,2,27,1,1,0,9,
97,0,0,0,1,4,118,101,99,52,95,110,101,103,97,116,101,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,
18,97,0,0,0,0,1,0,10,2,27,1,1,0,10,118,0,0,0,1,4,118,101,99,52,95,110,101,103,97,116,101,0,18,95,
95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,59,120,121,0,0,0,0,1,0,11,2,27,1,1,0,11,118,0,0,
0,1,4,118,101,99,52,95,110,101,103,97,116,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,
0,18,118,0,59,120,121,122,0,0,0,0,1,0,12,2,27,1,1,0,12,118,0,0,0,1,4,118,101,99,52,95,110,101,103,
97,116,101,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,0,0,1,0,13,2,27,1,1,0,13,109,0,0,0,1,9,
18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,54,20,0,9,18,95,95,114,101,116,
86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,54,20,0,0,1,0,14,2,27,1,1,0,14,109,0,0,0,1,9,18,
95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,54,20,0,9,18,95,95,114,101,116,86,
97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,54,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,
0,57,18,109,0,16,10,50,0,57,54,20,0,0,1,0,15,2,27,1,1,0,15,109,0,0,0,1,9,18,95,95,114,101,116,86,
97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,54,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,
57,18,109,0,16,10,49,0,57,54,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,
50,0,57,54,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,51,0,57,18,109,0,16,10,51,0,57,54,20,0,0,
1,0,9,0,100,111,116,0,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,97,0,
18,98,0,48,20,0,0,1,0,9,0,100,111,116,0,1,1,0,10,97,0,0,1,1,0,10,98,0,0,0,1,9,18,95,95,114,101,116,
86,97,108,0,18,97,0,59,120,0,18,98,0,59,120,0,48,18,97,0,59,121,0,18,98,0,59,121,0,48,46,20,0,0,1,
0,9,0,100,111,116,0,1,1,0,11,97,0,0,1,1,0,11,98,0,0,0,1,4,118,101,99,51,95,100,111,116,0,18,95,95,
114,101,116,86,97,108,0,0,18,97,0,0,18,98,0,0,0,0,1,0,9,0,100,111,116,0,1,1,0,12,97,0,0,1,1,0,12,
98,0,0,0,1,4,118,101,99,52,95,100,111,116,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,18,98,0,0,
0,0,1,0,0,2,1,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,97,0,0,18,97,0,
0,18,98,0,0,0,0,1,0,0,2,2,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,
97,99,116,0,18,97,0,0,18,97,0,0,18,98,0,0,0,0,1,0,0,2,3,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0,1,4,118,
101,99,52,95,109,117,108,116,105,112,108,121,0,18,97,0,0,18,97,0,0,18,98,0,0,0,0,1,0,0,2,4,1,0,2,5,
97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,9,1,105,110,118,66,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,
105,110,118,66,0,0,18,98,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,97,0,0,18,
97,0,0,18,105,110,118,66,0,0,0,0,1,0,0,2,1,1,0,2,6,118,0,0,1,1,0,6,117,0,0,0,1,4,118,101,99,52,95,
97,100,100,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,2,1,0,2,6,118,0,0,1,1,0,6,117,0,0,0,1,4,
118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,3,1,0,
2,6,118,0,0,1,1,0,6,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,0,18,
118,0,0,18,117,0,0,0,0,1,0,0,2,4,1,0,2,6,118,0,0,1,1,0,6,117,0,0,0,1,3,2,0,6,1,105,110,118,0,0,1,1,
122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,0,59,120,0,0,18,117,0,59,120,0,0,0,4,
102,108,111,97,116,95,114,99,112,0,18,105,110,118,0,59,121,0,0,18,117,0,59,121,0,0,0,4,118,101,99,
52,95,109,117,108,116,105,112,108,121,0,18,122,0,0,18,118,0,0,18,105,110,118,0,0,0,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,122,0,0,0,0,1,0,0,2,1,1,0,
2,7,118,0,0,1,1,0,7,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,0,18,118,0,0,18,117,0,0,0,
0,1,0,0,2,2,1,0,2,7,118,0,0,1,1,0,7,117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,
18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,3,1,0,2,7,118,0,0,1,1,0,7,117,0,0,0,1,4,118,101,99,52,
95,109,117,108,116,105,112,108,121,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,4,1,0,2,7,118,0,
0,1,1,0,7,117,0,0,0,1,3,2,0,7,1,105,110,118,0,0,1,1,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,
18,105,110,118,0,59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,
118,0,59,121,0,0,18,117,0,59,121,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,122,
0,0,18,118,0,0,18,105,110,118,0,0,0,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,122,0,0,0,0,1,0,0,2,1,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,4,118,101,99,52,
95,97,100,100,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,2,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,
4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,3,1,
0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,0,
18,118,0,0,18,117,0,0,0,0,1,0,0,2,4,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,3,2,0,8,1,105,110,118,0,0,
1,1,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,0,59,120,0,0,18,117,0,59,120,0,0,
0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,0,59,121,0,0,18,117,0,59,121,0,0,0,4,118,101,
99,52,95,109,117,108,116,105,112,108,121,0,18,122,0,0,18,118,0,0,18,105,110,118,0,0,0,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,122,0,0,0,0,1,0,0,2,1,
1,0,2,9,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,97,0,59,120,0,0,18,97,0,59,
120,0,0,18,98,0,0,0,0,1,0,0,2,2,1,0,2,9,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,115,117,98,
116,114,97,99,116,0,18,97,0,59,120,0,0,18,97,0,0,18,98,0,0,0,0,1,0,0,2,3,1,0,2,9,97,0,0,1,1,0,9,98,
0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,97,0,59,120,0,0,18,97,0,0,18,98,0,
0,0,0,1,0,0,2,4,1,0,2,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,119,0,0,0,4,102,108,111,97,116,95,114,
99,112,0,18,119,0,59,120,0,0,18,98,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,
97,0,59,120,0,0,18,97,0,0,18,119,0,0,0,0,1,0,0,2,1,1,0,2,10,118,0,0,1,1,0,10,117,0,0,0,1,4,118,101,
99,52,95,97,100,100,0,18,118,0,59,120,121,0,0,18,118,0,59,120,121,0,0,18,117,0,59,120,121,0,0,0,0,
1,0,0,2,2,1,0,2,10,118,0,0,1,1,0,10,117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,
18,118,0,59,120,121,0,0,18,118,0,59,120,121,0,0,18,117,0,59,120,121,0,0,0,0,1,0,0,2,3,1,0,2,10,118,
0,0,1,1,0,10,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,59,120,121,
0,0,18,118,0,59,120,121,0,0,18,117,0,59,120,121,0,0,0,0,1,0,0,2,4,1,0,2,10,118,0,0,1,1,0,10,117,0,
0,0,1,3,2,0,10,1,119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,120,0,0,18,117,0,59,
120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,121,0,0,18,117,0,59,121,0,0,0,4,118,101,
99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,59,120,121,0,0,18,118,0,59,120,121,0,0,18,119,
0,59,120,121,0,0,0,0,1,0,0,2,1,1,0,2,11,118,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,97,100,100,
0,18,118,0,59,120,121,122,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,2,1,0,2,11,118,0,0,1,1,0,11,117,0,
0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,59,120,121,122,0,0,18,118,0,0,18,
117,0,0,0,0,1,0,0,2,3,1,0,2,11,118,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,
112,108,121,0,18,118,0,59,120,121,122,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,4,1,0,2,11,118,0,0,1,1,
0,11,117,0,0,0,1,3,2,0,11,1,119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,120,0,0,18,
117,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,121,0,0,18,117,0,59,121,0,0,0,
4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,122,0,0,18,117,0,59,122,0,0,0,4,118,101,99,52,95,
109,117,108,116,105,112,108,121,0,18,118,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,18,119,0,
59,120,121,122,0,0,0,0,1,0,0,2,1,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,97,100,
100,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,2,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,4,118,
101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,3,1,0,2,
12,118,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,0,18,
118,0,0,18,117,0,0,0,0,1,0,0,2,4,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,3,2,0,12,1,119,0,0,0,4,102,
0,18,117,0,59,122,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,
86,97,108,0,59,120,121,122,0,0,18,97,0,59,120,120,120,0,0,18,105,110,118,85,0,59,120,121,122,0,0,0,
0,1,0,11,2,22,1,1,0,11,118,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,105,110,118,66,0,0,0,4,102,108,111,97,
116,95,114,99,112,0,18,105,110,118,66,0,0,18,98,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,
108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,18,105,
110,118,66,0,59,120,120,120,0,0,0,0,1,0,12,2,26,1,1,0,9,97,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,
52,95,97,100,100,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,59,120,120,120,120,0,0,18,117,0,0,0,
0,1,0,12,2,26,1,1,0,12,118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,95,95,114,101,
116,86,97,108,0,0,18,118,0,0,18,98,0,59,120,120,120,120,0,0,0,0,1,0,12,2,27,1,1,0,9,97,0,0,1,1,0,
12,117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,
0,18,97,0,59,120,120,120,120,0,0,18,117,0,0,0,0,1,0,12,2,27,1,1,0,12,118,0,0,1,1,0,9,98,0,0,0,1,4,
118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,
98,0,59,120,120,120,120,0,0,0,0,1,0,12,2,21,1,1,0,9,97,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,
109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,59,120,120,120,120,0,
0,18,117,0,0,0,0,1,0,12,2,21,1,1,0,12,118,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,109,117,108,
116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,98,0,59,120,120,120,120,0,0,
0,0,1,0,12,2,22,1,1,0,9,97,0,0,1,1,0,12,117,0,0,0,1,3,2,0,12,1,105,110,118,85,0,0,0,4,102,108,111,
97,116,95,114,99,112,0,18,105,110,118,85,0,59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,111,97,116,
95,114,99,112,0,18,105,110,118,85,0,59,121,0,0,18,117,0,59,121,0,0,0,4,102,108,111,97,116,95,114,
99,112,0,18,105,110,118,85,0,59,122,0,0,18,117,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,
18,105,110,118,85,0,59,119,0,0,18,117,0,59,119,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,
108,121,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,59,120,120,120,120,0,0,18,105,110,118,85,0,0,
0,0,1,0,12,2,22,1,1,0,12,118,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,105,110,118,66,0,0,0,4,102,108,111,
97,116,95,114,99,112,0,18,105,110,118,66,0,0,18,98,0,0,0,4,118,101,99,52,95,109,117,108,116,105,
112,108,121,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,18,105,110,118,66,0,59,120,120,120,120,
0,0,0,0,1,0,6,2,26,1,1,0,5,97,0,0,1,1,0,6,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,
118,101,99,50,0,18,97,0,0,0,18,117,0,46,20,0,0,1,0,6,2,26,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1,9,18,
95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,50,0,18,98,0,0,0,46,20,0,0,1,0,6,2,27,1,1,
0,5,97,0,0,1,1,0,6,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,50,0,18,97,0,0,
0,18,117,0,47,20,0,0,1,0,6,2,27,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,
108,0,18,118,0,58,105,118,101,99,50,0,18,98,0,0,0,47,20,0,0,1,0,6,2,21,1,1,0,5,97,0,0,1,1,0,6,117,
0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,50,0,18,97,0,0,0,18,117,0,48,20,0,0,1,
0,6,2,21,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,
101,99,50,0,18,98,0,0,0,48,20,0,0,1,0,6,2,22,1,1,0,5,97,0,0,1,1,0,6,117,0,0,0,1,9,18,95,95,114,101,
116,86,97,108,0,58,105,118,101,99,50,0,18,97,0,0,0,18,117,0,49,20,0,0,1,0,6,2,22,1,1,0,6,118,0,0,1,
1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,50,0,18,98,0,0,0,49,
20,0,0,1,0,7,2,26,1,1,0,5,97,0,0,1,1,0,7,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,
101,99,51,0,18,97,0,0,0,18,117,0,46,20,0,0,1,0,7,2,26,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,
95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,51,0,18,98,0,0,0,46,20,0,0,1,0,7,2,27,1,1,0,
5,97,0,0,1,1,0,7,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,51,0,18,97,0,0,0,
18,117,0,47,20,0,0,1,0,7,2,27,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,
0,18,118,0,58,105,118,101,99,51,0,18,98,0,0,0,47,20,0,0,1,0,7,2,21,1,1,0,5,97,0,0,1,1,0,7,117,0,0,
0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,51,0,18,97,0,0,0,18,117,0,48,20,0,0,1,0,7,
2,21,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,
99,51,0,18,98,0,0,0,48,20,0,0,1,0,7,2,22,1,1,0,5,97,0,0,1,1,0,7,117,0,0,0,1,9,18,95,95,114,101,116,
86,97,108,0,58,105,118,101,99,51,0,18,97,0,0,0,18,117,0,49,20,0,0,1,0,7,2,22,1,1,0,7,118,0,0,1,1,0,
5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,51,0,18,98,0,0,0,49,20,
0,0,1,0,8,2,26,1,1,0,5,97,0,0,1,1,0,8,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,
101,99,52,0,18,97,0,0,0,18,117,0,46,20,0,0,1,0,8,2,26,1,1,0,8,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,
95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,52,0,18,98,0,0,0,46,20,0,0,1,0,8,2,27,1,1,0,
5,97,0,0,1,1,0,8,117,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,52,0,18,97,0,0,0,
18,117,0,47,20,0,0,1,0,8,2,27,1,1,0,8,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,
0,18,118,0,58,105,118,101,99,52,0,18,98,0,0,0,47,20,0,0,1,0,8,2,21,1,1,0,5,97,0,0,1,1,0,8,117,0,0,
0,1,9,18,95,95,114,101,116,86,97,108,0,58,105,118,101,99,52,0,18,97,0,0,0,18,117,0,48,20,0,0,1,0,8,
2,21,1,1,0,8,118,0,0,1,1,0,5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,
99,52,0,18,98,0,0,0,48,20,0,0,1,0,8,2,22,1,1,0,5,97,0,0,1,1,0,8,117,0,0,0,1,9,18,95,95,114,101,116,
86,97,108,0,58,105,118,101,99,52,0,18,97,0,0,0,18,117,0,49,20,0,0,1,0,8,2,22,1,1,0,8,118,0,0,1,1,0,
5,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,118,0,58,105,118,101,99,52,0,18,98,0,0,0,49,20,
0,0,1,0,5,2,27,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,110,101,103,97,116,101,0,18,95,95,114,101,116,
86,97,108,0,59,120,0,0,18,97,0,0,0,0,1,0,6,2,27,1,1,0,6,118,0,0,0,1,4,118,101,99,52,95,110,101,103,
97,116,101,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,0,0,1,0,7,2,27,1,1,0,7,118,0,0,0,1,4,
118,101,99,52,95,110,101,103,97,116,101,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,0,0,1,0,8,
2,27,1,1,0,8,118,0,0,0,1,4,118,101,99,52,95,110,101,103,97,116,101,0,18,95,95,114,101,116,86,97,
108,0,0,18,118,0,0,0,0,1,0,9,2,27,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,110,101,103,97,116,101,0,
18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,97,0,0,0,0,1,0,10,2,27,1,1,0,10,118,0,0,0,1,4,118,
101,99,52,95,110,101,103,97,116,101,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,59,
120,121,0,0,0,0,1,0,11,2,27,1,1,0,11,118,0,0,0,1,4,118,101,99,52,95,110,101,103,97,116,101,0,18,95,
95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,0,0,1,0,12,2,27,1,1,0,12,
118,0,0,0,1,4,118,101,99,52,95,110,101,103,97,116,101,0,18,95,95,114,101,116,86,97,108,0,0,18,118,
0,0,0,0,1,0,13,2,27,1,1,0,13,109,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,
16,8,48,0,57,54,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,54,20,
0,0,1,0,14,2,27,1,1,0,14,109,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,
48,0,57,54,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,54,20,0,9,
18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,54,20,0,0,1,0,15,2,27,1,1,0,
15,109,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,54,20,0,9,18,
95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,54,20,0,9,18,95,95,114,101,116,
86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,54,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,
51,0,57,18,109,0,16,10,51,0,57,54,20,0,0,1,0,9,0,100,111,116,0,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,9,
18,95,95,114,101,116,86,97,108,0,18,97,0,18,98,0,48,20,0,0,1,0,9,0,100,111,116,0,1,1,0,10,97,0,0,1,
1,0,10,98,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,18,97,0,59,120,0,18,98,0,59,120,0,48,18,97,0,
59,121,0,18,98,0,59,121,0,48,46,20,0,0,1,0,9,0,100,111,116,0,1,1,0,11,97,0,0,1,1,0,11,98,0,0,0,1,4,
118,101,99,51,95,100,111,116,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,18,98,0,0,0,0,1,0,9,0,
100,111,116,0,1,1,0,12,97,0,0,1,1,0,12,98,0,0,0,1,4,118,101,99,52,95,100,111,116,0,18,95,95,114,
101,116,86,97,108,0,0,18,97,0,0,18,98,0,0,0,0,1,0,0,2,1,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0,1,4,118,
101,99,52,95,97,100,100,0,18,97,0,0,18,97,0,0,18,98,0,0,0,0,1,0,0,2,2,1,0,2,5,97,0,0,1,1,0,5,98,0,
0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,97,0,0,18,97,0,0,18,98,0,0,0,0,1,0,0,2,
3,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,97,0,0,
18,97,0,0,18,98,0,0,0,0,1,0,0,2,4,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,9,1,105,110,118,66,0,0,0,
4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,66,0,0,18,98,0,0,0,4,118,101,99,52,95,109,117,
108,116,105,112,108,121,0,18,97,0,0,18,97,0,0,18,105,110,118,66,0,0,0,4,102,108,111,97,116,95,116,
111,95,105,110,116,0,18,97,0,0,18,97,0,0,0,0,1,0,0,2,1,1,0,2,6,118,0,0,1,1,0,6,117,0,0,0,1,4,118,
101,99,52,95,97,100,100,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,2,1,0,2,6,118,0,0,1,1,0,6,
117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,
1,0,0,2,3,1,0,2,6,118,0,0,1,1,0,6,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,
18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,4,1,0,2,6,118,0,0,1,1,0,6,117,0,0,0,1,3,2,0,6,1,105,
110,118,0,0,1,1,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,0,59,120,0,0,18,117,
0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,0,59,121,0,0,18,117,0,59,121,0,
0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,122,0,0,18,118,0,0,18,105,110,118,0,0,
0,4,102,108,111,97,116,95,116,111,95,105,110,116,0,18,118,0,0,18,122,0,0,0,0,1,0,0,2,1,1,0,2,7,118,
0,0,1,1,0,7,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,
2,2,1,0,2,7,118,0,0,1,1,0,7,117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,
0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,3,1,0,2,7,118,0,0,1,1,0,7,117,0,0,0,1,4,118,101,99,52,95,109,
117,108,116,105,112,108,121,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,4,1,0,2,7,118,0,0,1,1,0,
7,117,0,0,0,1,3,2,0,7,1,105,110,118,0,0,1,1,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,
110,118,0,59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,0,
59,121,0,0,18,117,0,59,121,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,122,0,0,
18,118,0,0,18,105,110,118,0,0,0,4,102,108,111,97,116,95,116,111,95,105,110,116,0,18,118,0,0,18,122,
0,0,0,0,1,0,0,2,1,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,0,
18,118,0,0,18,117,0,0,0,0,1,0,0,2,2,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,4,118,101,99,52,95,115,117,
98,116,114,97,99,116,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,3,1,0,2,8,118,0,0,1,1,0,8,117,
0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,
1,0,0,2,4,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,3,2,0,8,1,105,110,118,0,0,1,1,122,0,0,0,4,102,108,
111,97,116,95,114,99,112,0,18,105,110,118,0,59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,111,97,116,
95,114,99,112,0,18,105,110,118,0,59,121,0,0,18,117,0,59,121,0,0,0,4,118,101,99,52,95,109,117,108,
116,105,112,108,121,0,18,122,0,0,18,118,0,0,18,105,110,118,0,0,0,4,102,108,111,97,116,95,116,111,
95,105,110,116,0,18,118,0,0,18,122,0,0,0,0,1,0,0,2,1,1,0,2,9,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,
99,52,95,97,100,100,0,18,97,0,59,120,0,0,18,97,0,59,120,0,0,18,98,0,59,120,0,0,0,0,1,0,0,2,2,1,0,2,
9,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,97,0,59,120,0,0,
18,97,0,0,18,98,0,0,0,0,1,0,0,2,3,1,0,2,9,97,0,0,1,1,0,9,98,0,0,0,1,4,118,101,99,52,95,109,117,108,
116,105,112,108,121,0,18,97,0,59,120,0,0,18,97,0,0,18,98,0,0,0,0,1,0,0,2,4,1,0,2,9,97,0,0,1,1,0,9,
98,0,0,0,1,3,2,0,9,1,119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,120,0,0,18,98,0,0,
0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,97,0,59,120,0,0,18,97,0,0,18,119,0,0,0,0,
1,0,0,2,1,1,0,2,10,118,0,0,1,1,0,10,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,59,120,
121,0,0,18,118,0,59,120,121,0,0,18,117,0,59,120,121,0,0,0,0,1,0,0,2,2,1,0,2,10,118,0,0,1,1,0,10,
117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,59,120,121,0,0,18,118,0,59,
120,121,0,0,18,117,0,59,120,121,0,0,0,0,1,0,0,2,3,1,0,2,10,118,0,0,1,1,0,10,117,0,0,0,1,4,118,101,
99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,59,120,121,0,0,18,118,0,59,120,121,0,0,18,117,
0,59,120,121,0,0,0,0,1,0,0,2,4,1,0,2,10,118,0,0,1,1,0,10,117,0,0,0,1,3,2,0,10,1,119,0,0,0,4,102,
108,111,97,116,95,114,99,112,0,18,119,0,59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,111,97,116,95,
114,99,112,0,18,119,0,59,121,0,0,18,117,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,
0,59,122,0,0,18,117,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,119,0,0,18,117,
0,59,119,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,0,18,118,0,0,18,119,0,
0,0,0,1,0,0,2,1,1,0,2,6,118,0,0,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,59,120,
121,0,0,18,118,0,59,120,121,0,0,18,97,0,59,120,120,0,0,0,0,1,0,0,2,2,1,0,2,6,118,0,0,1,1,0,5,97,0,
0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,59,120,121,0,0,18,118,0,59,120,
121,0,0,18,97,0,59,120,120,0,0,0,0,1,0,0,2,3,1,0,2,6,118,0,0,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,
109,117,108,116,105,112,108,121,0,18,118,0,59,120,121,0,0,18,118,0,59,120,121,0,0,18,97,0,59,120,
120,0,0,0,9,18,118,0,59,120,0,18,97,0,23,0,9,18,118,0,59,121,0,18,97,0,23,0,0,1,0,0,2,4,1,0,2,6,
118,0,0,1,1,0,5,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,24,0,9,18,118,0,59,121,0,18,97,0,24,0,0,1,0,
0,2,1,1,0,2,7,118,0,0,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,59,120,121,122,0,
0,18,118,0,59,120,121,122,0,0,18,97,0,59,120,120,120,0,0,0,0,1,0,0,2,2,1,0,2,7,118,0,0,1,1,0,5,97,
0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,59,120,121,122,0,0,18,118,0,59,
120,121,122,0,0,18,97,0,59,120,120,120,0,0,0,0,1,0,0,2,3,1,0,2,7,118,0,0,1,1,0,5,97,0,0,0,1,4,118,
101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,59,120,121,122,0,0,18,118,0,59,120,121,122,
0,0,18,97,0,59,120,120,120,0,0,0,0,1,0,0,2,4,1,0,2,7,118,0,0,1,1,0,5,97,0,0,0,1,9,18,118,0,59,120,
0,18,97,0,24,0,9,18,118,0,59,121,0,18,97,0,24,0,9,18,118,0,59,122,0,18,97,0,24,0,0,1,0,0,2,1,1,0,2,
8,118,0,0,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,0,18,118,0,0,18,97,0,59,120,
120,120,120,0,0,0,0,1,0,0,2,2,1,0,2,8,118,0,0,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,115,117,98,116,
114,97,99,116,0,18,118,0,0,18,118,0,0,18,97,0,59,120,120,120,120,0,0,0,0,1,0,0,2,3,1,0,2,8,118,0,0,
1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,0,18,118,0,0,18,
97,0,59,120,120,120,120,0,0,0,0,1,0,0,2,4,1,0,2,8,118,0,0,1,1,0,5,97,0,0,0,1,9,18,118,0,59,120,0,
18,97,0,24,0,9,18,118,0,59,121,0,18,97,0,24,0,9,18,118,0,59,122,0,18,97,0,24,0,9,18,118,0,59,119,0,
18,97,0,24,0,0,1,0,0,2,1,1,0,2,10,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,
118,0,59,120,121,0,0,18,118,0,0,18,97,0,59,120,120,0,0,0,0,1,0,0,2,2,1,0,2,10,118,0,0,1,1,0,9,97,0,
0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,59,120,121,0,0,18,118,0,0,18,97,0,
59,120,120,0,0,0,0,1,0,0,2,3,1,0,2,10,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,109,117,108,
116,105,112,108,121,0,18,118,0,59,120,121,0,0,18,118,0,0,18,97,0,59,120,120,0,0,0,0,1,0,0,2,4,1,0,
2,10,118,0,0,1,1,0,9,97,0,0,0,1,3,2,0,9,1,105,110,118,65,0,0,0,4,102,108,111,97,116,95,114,99,112,
0,18,105,110,118,65,0,0,18,97,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,
59,120,121,0,0,18,118,0,59,120,121,0,0,18,97,0,59,120,120,0,0,0,0,1,0,0,2,1,1,0,2,11,118,0,0,1,1,0,
9,97,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,59,120,121,122,0,0,18,118,0,0,18,97,0,59,120,
120,120,0,0,0,0,1,0,0,2,2,1,0,2,11,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,115,117,98,116,
114,97,99,116,0,18,118,0,59,120,121,122,0,0,18,118,0,0,18,97,0,59,120,120,120,0,0,0,0,1,0,0,2,3,1,
0,2,11,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,59,
120,121,122,0,0,18,118,0,0,18,97,0,59,120,120,120,0,0,0,0,1,0,0,2,4,1,0,2,11,118,0,0,1,1,0,9,97,0,
0,0,1,3,2,0,9,1,105,110,118,65,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,65,0,0,18,
97,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,59,120,121,122,0,0,18,118,0,
59,120,121,122,0,0,18,97,0,59,120,120,120,0,0,0,0,1,0,0,2,1,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,4,
118,101,99,52,95,97,100,100,0,18,118,0,0,18,118,0,0,18,97,0,59,120,120,120,120,0,0,0,0,1,0,0,2,2,1,
0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,0,18,
118,0,0,18,97,0,59,120,120,120,120,0,0,0,0,1,0,0,2,3,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,
114,99,112,0,18,119,0,59,121,0,0,18,117,0,59,121,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,
108,121,0,18,118,0,59,120,121,0,0,18,118,0,59,120,121,0,0,18,119,0,59,120,121,0,0,0,0,1,0,0,2,1,1,
0,2,11,118,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,59,120,121,122,0,0,18,
118,0,0,18,117,0,0,0,0,1,0,0,2,2,1,0,2,11,118,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,115,117,
98,116,114,97,99,116,0,18,118,0,59,120,121,122,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,3,1,0,2,11,
118,0,0,1,1,0,11,117,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,59,120,
121,122,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,4,1,0,2,11,118,0,0,1,1,0,11,117,0,0,0,1,3,2,0,11,1,
119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,
111,97,116,95,114,99,112,0,18,119,0,59,121,0,0,18,117,0,59,121,0,0,0,4,102,108,111,97,116,95,114,
99,112,0,18,119,0,59,122,0,0,18,117,0,59,122,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,
121,0,18,118,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,18,119,0,59,120,121,122,0,0,0,0,1,0,
0,2,1,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,0,18,118,0,0,
18,117,0,0,0,0,1,0,0,2,2,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,4,118,101,99,52,95,115,117,98,116,
114,97,99,116,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,2,3,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,
1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,0,18,118,0,0,18,117,0,0,0,0,1,0,0,
2,4,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,3,2,0,12,1,119,0,0,0,4,102,108,111,97,116,95,114,99,112,
0,18,119,0,59,120,0,0,18,117,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,121,0,
0,18,117,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,122,0,0,18,117,0,59,122,0,
0,0,4,102,108,111,97,116,95,114,99,112,0,18,119,0,59,119,0,0,18,117,0,59,119,0,0,0,4,118,101,99,52,
95,109,117,108,116,105,112,108,121,0,18,118,0,0,18,118,0,0,18,119,0,0,0,0,1,0,0,2,1,1,0,2,6,118,0,
0,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,59,120,121,0,0,18,118,0,59,120,121,0,
0,18,97,0,59,120,120,0,0,0,0,1,0,0,2,2,1,0,2,6,118,0,0,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,115,
117,98,116,114,97,99,116,0,18,118,0,59,120,121,0,0,18,118,0,59,120,121,0,0,18,97,0,59,120,120,0,0,
0,0,1,0,0,2,3,1,0,2,6,118,0,0,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,
121,0,18,118,0,59,120,121,0,0,18,118,0,59,120,121,0,0,18,97,0,59,120,120,0,0,0,9,18,118,0,59,120,0,
18,97,0,23,0,9,18,118,0,59,121,0,18,97,0,23,0,0,1,0,0,2,4,1,0,2,6,118,0,0,1,1,0,5,97,0,0,0,1,9,18,
118,0,59,120,0,18,97,0,24,0,9,18,118,0,59,121,0,18,97,0,24,0,0,1,0,0,2,1,1,0,2,7,118,0,0,1,1,0,5,
97,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,
18,97,0,59,120,120,120,0,0,0,0,1,0,0,2,2,1,0,2,7,118,0,0,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,115,
117,98,116,114,97,99,116,0,18,118,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,18,97,0,59,120,
120,120,0,0,0,0,1,0,0,2,3,1,0,2,7,118,0,0,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,109,117,108,116,
105,112,108,121,0,18,118,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,18,97,0,59,120,120,120,0,
0,0,0,1,0,0,2,4,1,0,2,7,118,0,0,1,1,0,5,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,24,0,9,18,118,0,59,
121,0,18,97,0,24,0,9,18,118,0,59,122,0,18,97,0,24,0,0,1,0,0,2,1,1,0,2,8,118,0,0,1,1,0,5,97,0,0,0,1,
4,118,101,99,52,95,97,100,100,0,18,118,0,0,18,118,0,0,18,97,0,59,120,120,120,120,0,0,0,0,1,0,0,2,2,
1,0,2,8,118,0,0,1,1,0,5,97,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,0,18,
118,0,0,18,97,0,59,120,120,120,120,0,0,0,0,1,0,0,2,3,1,0,2,8,118,0,0,1,1,0,5,97,0,0,0,1,4,118,101,
99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,0,18,118,0,0,18,97,0,59,120,120,120,120,0,0,0,
0,1,0,0,2,4,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,3,2,0,9,1,105,110,118,65,0,0,0,4,102,108,111,97,
116,95,114,99,112,0,18,105,110,118,65,0,0,18,97,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,
108,121,0,18,118,0,0,18,118,0,0,18,97,0,59,120,120,120,120,0,0,0,0,1,0,13,2,26,1,1,0,13,109,0,0,1,
1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,
16,8,48,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,
110,0,16,10,49,0,57,46,20,0,0,1,0,13,2,27,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,
116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,47,20,0,9,18,95,95,114,
101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,20,0,0,1,0,13,2,
21,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,
16,8,48,0,57,18,110,0,16,8,48,0,57,59,120,120,0,48,18,109,0,16,10,49,0,57,18,110,0,16,8,48,0,57,59,
121,121,0,48,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,8,48,0,57,18,110,
0,16,10,49,0,57,59,120,120,0,48,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,59,121,121,0,48,46,
20,0,0,1,0,13,2,22,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,
48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,49,20,0,9,18,95,95,114,101,116,86,97,108,0,16,
10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,49,20,0,0,1,0,14,2,26,1,1,0,14,109,0,0,1,
1,0,14,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,
16,8,48,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,
110,0,16,10,49,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,
57,18,110,0,16,10,50,0,57,46,20,0,0,1,0,14,2,27,1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,
0,1,0,0,2,4,1,0,2,8,118,0,0,1,1,0,5,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,24,0,9,18,118,0,59,121,
0,18,97,0,24,0,9,18,118,0,59,122,0,18,97,0,24,0,9,18,118,0,59,119,0,18,97,0,24,0,0,1,0,0,2,1,1,0,2,
10,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,97,100,100,0,18,118,0,59,120,121,0,0,18,118,0,0,
18,97,0,59,120,120,0,0,0,0,1,0,0,2,2,1,0,2,10,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,115,
117,98,116,114,97,99,116,0,18,118,0,59,120,121,0,0,18,118,0,0,18,97,0,59,120,120,0,0,0,0,1,0,0,2,3,
1,0,2,10,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,
59,120,121,0,0,18,118,0,0,18,97,0,59,120,120,0,0,0,0,1,0,0,2,4,1,0,2,10,118,0,0,1,1,0,9,97,0,0,0,1,
3,2,0,9,1,105,110,118,65,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,65,0,0,18,97,0,
0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,59,120,121,0,0,18,118,0,59,120,
121,0,0,18,105,110,118,65,0,59,120,120,0,0,0,0,1,0,0,2,1,1,0,2,11,118,0,0,1,1,0,9,97,0,0,0,1,4,118,
101,99,52,95,97,100,100,0,18,118,0,59,120,121,122,0,0,18,118,0,0,18,97,0,59,120,120,120,0,0,0,0,1,
0,0,2,2,1,0,2,11,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,
118,0,59,120,121,122,0,0,18,118,0,0,18,97,0,59,120,120,120,0,0,0,0,1,0,0,2,3,1,0,2,11,118,0,0,1,1,
0,9,97,0,0,0,1,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,59,120,121,122,0,0,18,
118,0,0,18,97,0,59,120,120,120,0,0,0,0,1,0,0,2,4,1,0,2,11,118,0,0,1,1,0,9,97,0,0,0,1,3,2,0,9,1,105,
110,118,65,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,105,110,118,65,0,0,18,97,0,0,0,4,118,101,
99,52,95,109,117,108,116,105,112,108,121,0,18,118,0,59,120,121,122,0,0,18,118,0,59,120,121,122,0,0,
18,105,110,118,65,0,59,120,120,120,0,0,0,0,1,0,0,2,1,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,
99,52,95,97,100,100,0,18,118,0,0,18,118,0,0,18,97,0,59,120,120,120,120,0,0,0,0,1,0,0,2,2,1,0,2,12,
118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,95,115,117,98,116,114,97,99,116,0,18,118,0,0,18,118,0,0,
18,97,0,59,120,120,120,120,0,0,0,0,1,0,0,2,3,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,4,118,101,99,52,
95,109,117,108,116,105,112,108,121,0,18,118,0,0,18,118,0,0,18,97,0,59,120,120,120,120,0,0,0,0,1,0,
0,2,4,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,3,2,0,9,1,105,110,118,65,0,0,0,4,102,108,111,97,116,95,
114,99,112,0,18,105,110,118,65,0,0,18,97,0,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,
0,18,118,0,0,18,118,0,0,18,105,110,118,65,0,59,120,120,120,120,0,0,0,0,1,0,13,2,26,1,1,0,13,109,0,
0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,
110,0,16,8,48,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,
18,110,0,16,10,49,0,57,46,20,0,0,1,0,13,2,27,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,
101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,47,20,0,9,18,95,95,
114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,20,0,0,1,0,
13,2,21,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,
109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,59,120,120,0,48,18,109,0,16,10,49,0,57,18,110,0,16,8,48,0,
57,59,121,121,0,48,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,8,48,0,57,
18,110,0,16,10,49,0,57,59,120,120,0,48,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,59,121,121,0,
48,46,20,0,0,1,0,13,2,22,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,
16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,49,20,0,9,18,95,95,114,101,116,86,97,108,
0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,49,20,0,0,1,0,14,2,26,1,1,0,14,109,0,
0,1,1,0,14,110,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,
110,0,16,8,48,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,
18,110,0,16,10,49,0,57,46,20,0,9,18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,
0,57,18,110,0,16,10,50,0,57,46,20,0,0,1,0,14,2,27,1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,95,95,
114,101,116,86,97,108,0,16,8,48,0,57,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,47,20,0,9,18,95,
95,114,101,116,86,97,108,0,16,10,49,0,57,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,20,0,9,
18,95,95,114,101,116,86,97,108,0,16,10,50,0,57,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,47,20,

View File

@ -51,10 +51,17 @@
/* revision number - increment after each change affecting emitted output */
.emtcode REVISION 3
/* external declaration */
/* external declaration (or precision or invariant stmt) */
.emtcode EXTERNAL_NULL 0
.emtcode EXTERNAL_FUNCTION_DEFINITION 1
.emtcode EXTERNAL_DECLARATION 2
.emtcode DEFAULT_PRECISION 3
.emtcode INVARIANT_STMT 4
/* precision */
.emtcode PRECISION_LOW 0
.emtcode PRECISION_MEDIUM 1
.emtcode PRECISION_HIGH 2
/* declaration */
.emtcode DECLARATION_FUNCTION_PROTOTYPE 1
@ -240,6 +247,9 @@
.errtext LBRACE_EXPECTED "2003: '{' expected but '$err_token$' found."
.errtext LPAREN_EXPECTED "2004: '(' expected but '$err_token$' found."
.errtext RPAREN_EXPECTED "2005: ')' expected but '$err_token$' found."
.errtext INVALID_PRECISION "2006: Invalid precision specifier '$err_token$'."
.errtext INVALID_PRECISION_TYPE "2007: Invalid precision type '$err_token$'."
/* tells whether the shader that is being parsed is a built-in shader or not */
/* 0 - normal behaviour */
@ -1226,23 +1236,70 @@ asm_argument
var_with_field
variable_identifier .and dot .and field_selection .emit OP_FIELD;
/*
<translation_unit> ::= <external_declaration>
| <translation_unit> <external_declaration>
*/
* <translation_unit> ::= <external_declaration>
* | <translation_unit> <external_declaration>
*/
translation_unit
optional_space .emit REVISION .and external_declaration .error INVALID_EXTERNAL_DECLARATION .and
.loop external_declaration .and optional_space .and
'\0' .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;
/*
<external_declaration> ::= <function_definition>
| <declaration>
*/
* <external_declaration> ::= <function_definition>
* | <declaration>
*/
external_declaration
precision_stmt .emit DEFAULT_PRECISION .or
invariant_stmt .emit INVARIANT_STMT .or
function_definition .emit EXTERNAL_FUNCTION_DEFINITION .or
declaration .emit EXTERNAL_DECLARATION;
/*
* <precision_stmt> ::= "precision" <precision> <prectype>
*/
precision_stmt
"precision" .and space .and precision .error INVALID_PRECISION .and space .and prectype .error INVALID_PRECISION_TYPE .and semicolon;
/*
* <precision> ::= "lowp"
* | "mediump"
* | "highp"
*/
precision
"lowp" .emit PRECISION_LOW .or
"mediump" .emit PRECISION_MEDIUM .or
"highp" .emit PRECISION_HIGH;
/*
* <prectype> ::= "int"
* | "float"
* | "a sampler type"
*/
prectype
"int" .emit TYPE_SPECIFIER_INT .or
"float" .emit TYPE_SPECIFIER_FLOAT .or
"sampler1D" .emit TYPE_SPECIFIER_SAMPLER1D .or
"sampler2D" .emit TYPE_SPECIFIER_SAMPLER2D .or
"sampler3D" .emit TYPE_SPECIFIER_SAMPLER3D .or
"samplerCube" .emit TYPE_SPECIFIER_SAMPLERCUBE .or
"sampler1DShadow" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or
"sampler2DShadow" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or
"sampler2DRect" .emit TYPE_SPECIFIER_SAMPLER2DRECT .or
"sampler2DRectShadow" .emit TYPE_SPECIFIER_SAMPLER2DRECTSHADOW;
/*
* <invariant_stmt> ::= "invariant" identifier;
*/
invariant_stmt
"invariant" .and space .and identifier .and semicolon;
/*
<function_definition> :: <function_prototype> <compound_statement_no_new_scope>
*/

View File

@ -6,6 +6,11 @@
".emtcode EXTERNAL_NULL 0\n"
".emtcode EXTERNAL_FUNCTION_DEFINITION 1\n"
".emtcode EXTERNAL_DECLARATION 2\n"
".emtcode DEFAULT_PRECISION 3\n"
".emtcode INVARIANT_STMT 4\n"
".emtcode PRECISION_LOW 0\n"
".emtcode PRECISION_MEDIUM 1\n"
".emtcode PRECISION_HIGH 2\n"
".emtcode DECLARATION_FUNCTION_PROTOTYPE 1\n"
".emtcode DECLARATION_INIT_DECLARATOR_LIST 2\n"
".emtcode FUNCTION_ORDINARY 0\n"
@ -137,6 +142,8 @@
".errtext LBRACE_EXPECTED \"2003: '{' expected but '$err_token$' found.\"\n"
".errtext LPAREN_EXPECTED \"2004: '(' expected but '$err_token$' found.\"\n"
".errtext RPAREN_EXPECTED \"2005: ')' expected but '$err_token$' found.\"\n"
".errtext INVALID_PRECISION \"2006: Invalid precision specifier '$err_token$'.\"\n"
".errtext INVALID_PRECISION_TYPE \"2007: Invalid precision type '$err_token$'.\"\n"
".regbyte parsing_builtin 0\n"
".regbyte shader_type 0\n"
"variable_identifier\n"
@ -597,8 +604,29 @@
" .loop external_declaration .and optional_space .and\n"
" '\\0' .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;\n"
"external_declaration\n"
" precision_stmt .emit DEFAULT_PRECISION .or\n"
" invariant_stmt .emit INVARIANT_STMT .or\n"
" function_definition .emit EXTERNAL_FUNCTION_DEFINITION .or\n"
" declaration .emit EXTERNAL_DECLARATION;\n"
"precision_stmt\n"
" \"precision\" .and space .and precision .error INVALID_PRECISION .and space .and prectype .error INVALID_PRECISION_TYPE .and semicolon;\n"
"precision\n"
" \"lowp\" .emit PRECISION_LOW .or\n"
" \"mediump\" .emit PRECISION_MEDIUM .or\n"
" \"highp\" .emit PRECISION_HIGH;\n"
"prectype\n"
" \"int\" .emit TYPE_SPECIFIER_INT .or\n"
" \"float\" .emit TYPE_SPECIFIER_FLOAT .or\n"
" \"sampler1D\" .emit TYPE_SPECIFIER_SAMPLER1D .or\n"
" \"sampler2D\" .emit TYPE_SPECIFIER_SAMPLER2D .or\n"
" \"sampler3D\" .emit TYPE_SPECIFIER_SAMPLER3D .or\n"
" \"samplerCube\" .emit TYPE_SPECIFIER_SAMPLERCUBE .or\n"
" \"sampler1DShadow\" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or\n"
" \"sampler2DShadow\" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or\n"
" \"sampler2DRect\" .emit TYPE_SPECIFIER_SAMPLER2DRECT .or\n"
" \"sampler2DRectShadow\" .emit TYPE_SPECIFIER_SAMPLER2DRECTSHADOW;\n"
"invariant_stmt\n"
" \"invariant\" .and space .and identifier .and semicolon;\n"
"function_definition\n"
" function_prototype .and compound_statement_no_new_scope;\n"
"digit_oct\n"

View File

@ -35,6 +35,7 @@
#include "shader/prog_parameter.h"
#include "shader/prog_statevars.h"
#include "shader/slang/slang_ir.h"
#include "shader/slang/slang_emit.h"
#include "shader/slang/slang_builtin.h"
@ -438,8 +439,11 @@ _slang_alloc_statevar(slang_ir_node *n,
pos = lookup_statevar(var, index1, index2, field, &swizzle, paramList);
assert(pos >= 0);
if (pos >= 0) {
/* newly resolved storage for the statevar/constant/uniform */
n0->Store->File = PROGRAM_STATE_VAR;
n0->Store->Index = pos;
n0->Store->Swizzle = swizzle;
n0->Store->Parent = NULL;
}
return pos;
}

View File

@ -43,6 +43,7 @@
#include "shader/program.h"
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "shader/prog_statevars.h"
#include "slang_typeinfo.h"
#include "slang_codegen.h"
@ -243,7 +244,12 @@ _slang_attach_storage(slang_ir_node *n, slang_variable *var)
}
else {
/* alloc new storage info */
n->Store = _slang_new_ir_storage(PROGRAM_UNDEFINED, -1, -5);
n->Store = _slang_new_ir_storage(PROGRAM_UNDEFINED, -7, -5);
#if 0
printf("%s var=%s Store=%p Size=%d\n", __FUNCTION__,
(char*) var->a_name,
(void*) n->Store, n->Store->Size);
#endif
if (n->Var)
n->Var->aux = n->Store;
assert(n->Var->aux);
@ -651,11 +657,16 @@ new_var(slang_assemble_ctx *A, slang_operation *oper, slang_atom name)
if (!var)
return NULL;
assert(var->declared);
assert(!oper->var || oper->var == var);
n = new_node0(IR_VAR);
if (n) {
_slang_attach_storage(n, var);
/*
printf("new_var %s store=%p\n", (char*)name, (void*) n->Store);
*/
}
return n;
}
@ -924,31 +935,6 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
}
/**
* Recursively traverse 'oper', replacing occurances of 'oldScope' with
* 'newScope' in the oper->locals->outer_scope filed.
*
* This is used after function inlining to update the scoping of
* the newly copied/inlined code so that vars are found in the new,
* inlined scope and not in the original function code.
*/
static void
slang_replace_scope(slang_operation *oper,
slang_variable_scope *oldScope,
slang_variable_scope *newScope)
{
GLuint i;
if (oper->locals != newScope &&
oper->locals->outer_scope == oldScope) {
oper->locals->outer_scope = newScope;
}
for (i = 0; i < oper->num_children; i++) {
slang_replace_scope(&oper->children[i], oldScope, newScope);
}
}
/**
* Produce inline code for a call to an assembly instruction.
* This is typically used to compile a call to a built-in function like this:
@ -958,6 +944,18 @@ slang_replace_scope(slang_operation *oper,
* __asm vec4_lrp __retVal, a, y, x;
* }
*
*
* A call to
* r = mix(p1, p2, p3);
*
* Becomes:
*
* mov
* / \
* r vec4_lrp
* / | \
* p3 p2 p1
*
* We basically translate a SLANG_OPER_CALL into a SLANG_OPER_ASM.
*/
static slang_operation *
@ -997,10 +995,10 @@ slang_inline_asm_function(slang_assemble_ctx *A,
slang_operation_copy(inlined, &fun->body->children[0]);
if (haveRetValue) {
/* get rid of the __retVal child */
for (i = 0; i < numArgs; i++) {
inlined->num_children--;
for (i = 0; i < inlined->num_children; i++) {
inlined->children[i] = inlined->children[i + 1];
}
inlined->num_children--;
}
/* now do formal->actual substitutions */
@ -1235,6 +1233,16 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
}
}
/* Now add copies of the function's local vars to the new variable scope */
for (i = totalArgs; i < fun->parameters->num_variables; i++) {
slang_variable *p = fun->parameters->variables[i];
slang_variable *pCopy = slang_variable_scope_grow(inlined->locals);
pCopy->type = p->type;
pCopy->a_name = p->a_name;
pCopy->array_len = p->array_len;
}
/* New epilog statements:
* 1. Create end of function label to jump to from return statements.
* 2. Copy the 'out' parameter vars
@ -1401,6 +1409,27 @@ slang_find_asm_info(const char *name)
}
/**
* Return the default swizzle mask for accessing a variable of the
* given size (in floats). If size = 1, comp is used to identify
* which component [0..3] of the register holds the variable.
*/
static GLuint
_slang_var_swizzle(GLint size, GLint comp)
{
switch (size) {
case 1:
return MAKE_SWIZZLE4(comp, comp, comp, comp);
case 2:
return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_NIL, SWIZZLE_NIL);
case 3:
return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_NIL);
default:
return SWIZZLE_XYZW;
}
}
/**
* Some write-masked assignments are simple, but others are hard.
* Simple example:
@ -1606,13 +1635,13 @@ _slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper,
if (info->NumParams == oper->num_children) {
/* Storage for result is not specified.
* Children[0], [1] are the operands.
* Children[0], [1], [2] are the operands.
*/
firstOperand = 0;
}
else {
/* Storage for result (child[0]) is specified.
* Children[1], [2] are the operands.
* Children[1], [2], [3] are the operands.
*/
firstOperand = 1;
}
@ -1647,7 +1676,8 @@ _slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper,
n->Store = get_store(n0);
n->Writemask = writemask;
assert(n->Store->File != PROGRAM_UNDEFINED);
assert(n->Store->File != PROGRAM_UNDEFINED ||
n->Store->Parent);
_slang_free(n0);
}
@ -1694,6 +1724,167 @@ _slang_first_function(struct slang_function_scope_ *scope, const char *name)
}
/**
* Generate a new slang_function which is a constructor for a user-defined
* struct type.
*/
static slang_function *
_slang_make_constructor(slang_assemble_ctx *A, slang_struct *str)
{
const GLint numFields = str->fields->num_variables;
slang_function *fun = (slang_function *) _mesa_malloc(sizeof(slang_function));
if (!fun)
return NULL;
slang_function_construct(fun);
/* function header (name, return type) */
fun->kind = SLANG_FUNC_CONSTRUCTOR;
fun->header.a_name = str->a_name;
fun->header.type.qualifier = SLANG_QUAL_NONE;
fun->header.type.specifier.type = SLANG_SPEC_STRUCT;
fun->header.type.specifier._struct = str;
/* function parameters (= struct's fields) */
{
GLint i;
for (i = 0; i < numFields; i++) {
/*
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];
}
fun->param_count = fun->parameters->num_variables;
}
/* Add __retVal to params */
{
slang_variable *p = slang_variable_scope_grow(fun->parameters);
slang_atom a_retVal = slang_atom_pool_atom(A->atoms, "__retVal");
assert(a_retVal);
p->a_name = a_retVal;
p->type = fun->header.type;
p->type.qualifier = SLANG_QUAL_OUT;
fun->param_count++;
}
/* function body is:
* block:
* declare T;
* T.f1 = p1;
* T.f2 = p2;
* ...
* T.fn = pn;
* return T;
*/
{
slang_variable *var;
GLint i;
fun->body = slang_operation_new(1);
fun->body->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE;
fun->body->num_children = numFields + 2;
fun->body->children = slang_operation_new(numFields + 2);
/* create local var 't' */
var = slang_variable_scope_grow(fun->parameters);
var->a_name = slang_atom_pool_atom(A->atoms, "t");
var->type = fun->header.type;
/* declare t */
{
slang_operation *decl;
decl = &fun->body->children[0];
decl->type = SLANG_OPER_VARIABLE_DECL;
decl->locals = _slang_variable_scope_new(fun->parameters);
decl->a_id = var->a_name;
}
/* assign params to fields of t */
for (i = 0; i < numFields; i++) {
slang_operation *assign = &fun->body->children[1 + i];
assign->type = SLANG_OPER_ASSIGN;
assign->locals = _slang_variable_scope_new(fun->parameters);
assign->num_children = 2;
assign->children = slang_operation_new(2);
{
slang_operation *lhs = &assign->children[0];
lhs->type = SLANG_OPER_FIELD;
lhs->locals = _slang_variable_scope_new(fun->parameters);
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);
#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);
#endif
}
{
slang_operation *rhs = &assign->children[1];
rhs->type = SLANG_OPER_IDENTIFIER;
rhs->locals = _slang_variable_scope_new(fun->parameters);
rhs->a_id = str->fields->variables[i]->a_name;
}
}
/* return t; */
{
slang_operation *ret = &fun->body->children[numFields + 1];
ret->type = SLANG_OPER_RETURN;
ret->locals = _slang_variable_scope_new(fun->parameters);
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);
}
}
/*
slang_print_function(fun, 1);
*/
return fun;
}
/**
* Find/create a function (constructor) for the given structure name.
*/
static slang_function *
_slang_locate_struct_constructor(slang_assemble_ctx *A, const char *name)
{
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) {
/* found a structure type that matches the function name */
if (!str->constructor) {
/* create the constructor function now */
str->constructor = _slang_make_constructor(A, str);
}
return str->constructor;
}
}
return NULL;
}
/**
* Assemble a function call, given a particular function name.
@ -1717,6 +1908,11 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name,
*/
fun = _slang_locate_function(A->space.funcs, atom, params, param_count,
&A->space, A->atoms, A->log);
if (!fun) {
fun = _slang_locate_struct_constructor(A, name);
}
if (!fun) {
/* A function with exactly the right parameters/types was not found.
* Try adapting the parameters.
@ -2084,7 +2280,7 @@ _slang_gen_temporary(GLint size)
slang_ir_storage *store;
slang_ir_node *n = NULL;
store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, size);
store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -2, size);
if (store) {
n = new_node0(IR_VAR_DECL);
if (n) {
@ -2105,15 +2301,15 @@ static slang_ir_node *
_slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var)
{
slang_ir_node *n;
/*assert(!var->declared);*/
var->declared = GL_TRUE;
assert(!is_sampler_type(&var->type));
n = new_node0(IR_VAR_DECL);
if (n) {
_slang_attach_storage(n, var);
#if 0
printf("%s var %p %s store=%p\n",
__FUNCTION__, (void *) var, (char *) var->a_name,
(void *) n->Store);
#endif
assert(var->aux);
assert(n->Store == var->aux);
assert(n->Store);
@ -2121,6 +2317,13 @@ _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 0
printf("%s var %p %s store=%p index=%d size=%d\n",
__FUNCTION__, (void *) var, (char *) var->a_name,
(void *) n->Store, n->Store->Index, n->Store->Size);
#endif
if (var->array_len > 0) {
/* this is an array */
/* round up element size to mult of 4 */
@ -2129,8 +2332,27 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var)
sz *= var->array_len;
n->Store->Size = sz;
}
A->program->NumTemporaries++;
assert(n->Store->Size > 0);
/* setup default swizzle for storing the variable */
switch (n->Store->Size) {
case 2:
n->Store->Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y,
SWIZZLE_NIL, SWIZZLE_NIL);
break;
case 3:
n->Store->Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y,
SWIZZLE_Z, SWIZZLE_NIL);
break;
default:
/* Note that float-sized vars may be allocated in any x/y/z/w
* slot, but that won't be determined until code emit time.
*/
n->Store->Swizzle = SWIZZLE_NOOP;
}
A->program->NumTemporaries++; /* an approximation */
}
return n;
}
@ -2408,13 +2630,33 @@ _slang_gen_variable(slang_assemble_ctx * A, slang_operation *oper)
}
/**
* Return the number of components actually named by the swizzle.
* Recall that swizzles may have undefined/don't-care values.
*/
static GLuint
swizzle_size(GLuint swizzle)
{
GLuint size = 0, i;
for (i = 0; i < 4; i++) {
GLuint swz = GET_SWZ(swizzle, i);
size += (swz >= 0 && swz <= 3);
}
return size;
}
static slang_ir_node *
_slang_gen_swizzle(slang_ir_node *child, GLuint swizzle)
{
slang_ir_node *n = new_node1(IR_SWIZZLE, child);
assert(child);
if (n) {
n->Store = _slang_new_ir_storage(PROGRAM_UNDEFINED, -1, -1);
assert(!n->Store);
n->Store = _slang_new_ir_storage_relative(0,
swizzle_size(swizzle),
child->Store);
n->Store->Swizzle = swizzle;
}
return n;
@ -2506,7 +2748,7 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
* Generate IR tree for referencing a field in a struct (or basic vector type)
*/
static slang_ir_node *
_slang_gen_field(slang_assemble_ctx * A, slang_operation *oper)
_slang_gen_struct_field(slang_assemble_ctx * A, slang_operation *oper)
{
slang_typeinfo ti;
@ -2559,7 +2801,8 @@ _slang_gen_field(slang_assemble_ctx * A, slang_operation *oper)
/* oper->a_id is the field name */
slang_ir_node *base, *n;
slang_typeinfo field_ti;
GLint fieldSize, fieldOffset = -1;
GLint fieldSize, fieldOffset = -1, swz;
/* type of field */
slang_typeinfo_construct(&field_ti);
_slang_typeof_operation(A, oper, &field_ti);
@ -2584,20 +2827,27 @@ _slang_gen_field(slang_assemble_ctx * A, slang_operation *oper)
}
n = new_node1(IR_FIELD, base);
if (n) {
n->Field = (char *) oper->a_id;
n->FieldOffset = fieldOffset;
assert(n->FieldOffset >= 0);
n->Store = _slang_new_ir_storage(base->Store->File,
base->Store->Index,
fieldSize);
}
return n;
if (!n)
return NULL;
#if 0
_mesa_problem(NULL, "glsl structs/fields not supported yet");
return NULL;
#endif
/* setup the storage info for this node */
swz = fieldOffset % 4;
n->Field = (char *) oper->a_id;
n->Store = _slang_new_ir_storage_relative(fieldOffset / 4,
fieldSize,
base->Store);
if (fieldSize == 1)
n->Store->Swizzle = MAKE_SWIZZLE4(swz, swz, swz, swz);
else if (fieldSize == 2)
n->Store->Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y,
SWIZZLE_NIL, SWIZZLE_NIL);
else if (fieldSize == 3)
n->Store->Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y,
SWIZZLE_Z, SWIZZLE_NIL);
return n;
}
}
@ -2606,7 +2856,7 @@ _slang_gen_field(slang_assemble_ctx * A, slang_operation *oper)
* Gen code for array indexing.
*/
static slang_ir_node *
_slang_gen_subscript(slang_assemble_ctx * A, slang_operation *oper)
_slang_gen_array_element(slang_assemble_ctx * A, slang_operation *oper)
{
slang_typeinfo array_ti;
@ -2623,7 +2873,7 @@ _slang_gen_subscript(slang_assemble_ctx * A, slang_operation *oper)
index = (GLint) oper->children[1].literal[0];
if (oper->children[1].type != SLANG_OPER_LITERAL_INT ||
index >= max) {
index >= (GLint) max) {
slang_info_log_error(A->log, "Invalid array index for vector type");
return NULL;
}
@ -2670,21 +2920,24 @@ _slang_gen_subscript(slang_assemble_ctx * A, slang_operation *oper)
index = _slang_gen_operation(A, &oper->children[1]);
if (array && index) {
/* bounds check */
if (index->Opcode == IR_FLOAT &&
((int) index->Value[0] < 0 ||
(int) index->Value[0] >= arrayLen)) {
slang_info_log_error(A->log,
GLint constIndex = 0;
if (index->Opcode == IR_FLOAT) {
constIndex = (int) index->Value[0];
if (constIndex < 0 || constIndex >= arrayLen) {
slang_info_log_error(A->log,
"Array index out of bounds (index=%d size=%d)",
(int) index->Value[0], arrayLen);
_slang_free_ir_tree(array);
_slang_free_ir_tree(index);
return NULL;
constIndex, arrayLen);
_slang_free_ir_tree(array);
_slang_free_ir_tree(index);
return NULL;
}
}
elem = new_node2(IR_ELEMENT, array, index);
elem->Store = _slang_new_ir_storage(array->Store->File,
array->Store->Index,
elemSize);
elem->Store = _slang_new_ir_storage_relative(constIndex,
elemSize,
array->Store);
/* XXX try to do some array bounds checking here */
return elem;
}
@ -2858,14 +3111,14 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "+=", oper, &oper->children[0]);
n = _slang_gen_function_call_name(A, "+=", oper, NULL);
return n;
}
case SLANG_OPER_SUBASSIGN:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "-=", oper, &oper->children[0]);
n = _slang_gen_function_call_name(A, "-=", oper, NULL);
return n;
}
break;
@ -2873,14 +3126,14 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "*=", oper, &oper->children[0]);
n = _slang_gen_function_call_name(A, "*=", oper, NULL);
return n;
}
case SLANG_OPER_DIVASSIGN:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "/=", oper, &oper->children[0]);
n = _slang_gen_function_call_name(A, "/=", oper, NULL);
return n;
}
case SLANG_OPER_LOGICALAND:
@ -2923,9 +3176,9 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
case SLANG_OPER_IF:
return _slang_gen_if(A, oper);
case SLANG_OPER_FIELD:
return _slang_gen_field(A, oper);
return _slang_gen_struct_field(A, oper);
case SLANG_OPER_SUBSCRIPT:
return _slang_gen_subscript(A, oper);
return _slang_gen_array_element(A, oper);
case SLANG_OPER_LITERAL_FLOAT:
/* fall-through */
case SLANG_OPER_LITERAL_INT:
@ -2992,6 +3245,23 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
}
/**
* Compute total size of array give size of element, number of elements.
*/
static GLint
array_size(GLint baseSize, GLint arrayLen)
{
GLint total;
if (arrayLen > 1) {
/* round up base type to multiple of 4 */
total = ((baseSize + 3) & ~0x3) * MAX2(arrayLen, 1);
}
else {
total = baseSize;
}
return total;
}
/**
* Called by compiler when a global variable has been parsed/compiled.
@ -3017,6 +3287,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
int dbg = 0;
const GLenum datatype = _slang_gltype_from_specifier(&var->type.specifier);
const GLint texIndex = sampler_to_texture_index(var->type.specifier.type);
const GLint size = _slang_sizeof_type_specifier(&var->type.specifier);
if (texIndex != -1) {
/* This is a texture sampler variable...
@ -3030,8 +3301,8 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
}
else if (var->type.qualifier == SLANG_QUAL_UNIFORM) {
/* Uniform variable */
const GLint size = _slang_sizeof_type_specifier(&var->type.specifier)
* MAX2(var->array_len, 1);
const GLint totalSize = array_size(size, var->array_len);
const GLuint swizzle = _slang_var_swizzle(totalSize, 0);
if (prog) {
/* user-defined uniform */
if (datatype == GL_NONE) {
@ -3060,8 +3331,9 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
}
else {
GLint uniformLoc = _mesa_add_uniform(prog->Parameters, varName,
size, datatype);
store = _slang_new_ir_storage(PROGRAM_UNIFORM, uniformLoc, size);
totalSize, datatype);
store = _slang_new_ir_storage_swz(PROGRAM_UNIFORM, uniformLoc,
totalSize, swizzle);
}
}
else {
@ -3069,34 +3341,40 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
/* We know it's a uniform, but don't allocate storage unless
* it's really used.
*/
store = _slang_new_ir_storage(PROGRAM_STATE_VAR, -1, size);
store = _slang_new_ir_storage_swz(PROGRAM_STATE_VAR, -1,
totalSize, swizzle);
}
if (dbg) printf("UNIFORM (sz %d) ", size);
if (dbg) printf("UNIFORM (sz %d) ", totalSize);
}
else if (var->type.qualifier == SLANG_QUAL_VARYING) {
const GLint size = 4; /* XXX fix */
if (prog) {
/* user-defined varying */
GLint varyingLoc = _mesa_add_varying(prog->Varying, varName, size);
store = _slang_new_ir_storage(PROGRAM_VARYING, varyingLoc, size);
GLuint swizzle = _slang_var_swizzle(size, 0);
store = _slang_new_ir_storage_swz(PROGRAM_VARYING, varyingLoc,
size, swizzle);
}
else {
/* pre-defined varying, like gl_Color or gl_TexCoord */
if (type == SLANG_UNIT_FRAGMENT_BUILTIN) {
/* fragment program input */
GLuint swizzle;
GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB,
&swizzle);
assert(index >= 0);
store = _slang_new_ir_storage(PROGRAM_INPUT, index, size);
store->Swizzle = swizzle;
assert(index < FRAG_ATTRIB_MAX);
store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index,
size, swizzle);
}
else {
/* vertex program output */
GLint index = _slang_output_index(varName, GL_VERTEX_PROGRAM_ARB);
GLuint swizzle = _slang_var_swizzle(size, 0);
assert(index >= 0);
assert(type == SLANG_UNIT_VERTEX_BUILTIN);
store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, size);
assert(index < VERT_RESULT_MAX);
assert(type == SLANG_UNIT_VERTEX_BUILTIN);
store = _slang_new_ir_storage_swz(PROGRAM_OUTPUT, index,
size, swizzle);
}
if (dbg) printf("V/F ");
}
@ -3105,10 +3383,9 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
else if (var->type.qualifier == SLANG_QUAL_ATTRIBUTE) {
if (prog) {
/* user-defined vertex attribute */
const GLint size = _slang_sizeof_type_specifier(&var->type.specifier);
const GLint attr = -1; /* unknown */
GLint index = _mesa_add_attribute(prog->Attributes, varName,
size, attr);
size, datatype, attr);
assert(index >= 0);
store = _slang_new_ir_storage(PROGRAM_INPUT,
VERT_ATTRIB_GENERIC0 + index, size);
@ -3118,10 +3395,8 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
GLuint swizzle;
GLint index = _slang_input_index(varName, GL_VERTEX_PROGRAM_ARB,
&swizzle);
GLint size = 4; /* XXX? */
assert(index >= 0);
store = _slang_new_ir_storage(PROGRAM_INPUT, index, size);
store->Swizzle = swizzle;
store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle);
}
if (dbg) printf("ATTRIB ");
}
@ -3129,28 +3404,24 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
GLuint swizzle = SWIZZLE_XYZW; /* silence compiler warning */
GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB,
&swizzle);
GLint size = 4; /* XXX? */
store = _slang_new_ir_storage(PROGRAM_INPUT, index, size);
store->Swizzle = swizzle;
store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle);
if (dbg) printf("INPUT ");
}
else if (var->type.qualifier == SLANG_QUAL_FIXEDOUTPUT) {
if (type == SLANG_UNIT_VERTEX_BUILTIN) {
GLint index = _slang_output_index(varName, GL_VERTEX_PROGRAM_ARB);
GLint size = 4; /* XXX? */
store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, size);
}
else {
GLint index = _slang_output_index(varName, GL_FRAGMENT_PROGRAM_ARB);
GLint size = 4; /* XXX? */
GLint specialSize = 4; /* treat all fragment outputs as float[4] */
assert(type == SLANG_UNIT_FRAGMENT_BUILTIN);
store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, size);
store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, specialSize);
}
if (dbg) printf("OUTPUT ");
}
else if (var->type.qualifier == SLANG_QUAL_CONST && !prog) {
/* pre-defined global constant, like gl_MaxLights */
const GLint size = _slang_sizeof_type_specifier(&var->type.specifier);
store = _slang_new_ir_storage(PROGRAM_CONSTANT, -1, size);
if (dbg) printf("CONST ");
}
@ -3190,6 +3461,8 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
if (store)
var->aux = store; /* save var's storage info */
var->declared = GL_TRUE;
return success;
}

View File

@ -56,6 +56,9 @@
*/
/** re-defined below, should be the same though */
#define TYPE_SPECIFIER_COUNT 32
/**
* Allocate storage for a variable of 'size' bytes from given pool.
@ -129,6 +132,7 @@ typedef struct slang_parse_ctx_
GLboolean global_scope; /**< Is object being declared a global? */
slang_atom_pool *atoms;
slang_unit_type type; /**< Vertex vs. Fragment */
GLuint version; /**< user-specified (or default) #version */
} slang_parse_ctx;
/* slang_output_ctx */
@ -141,6 +145,7 @@ typedef struct slang_output_ctx_
slang_var_pool *global_pool;
struct gl_program *program;
slang_var_table *vartable;
GLuint default_precision[TYPE_SPECIFIER_COUNT];
} slang_output_ctx;
/* _slang_compile() */
@ -525,7 +530,7 @@ parse_type_qualifier(slang_parse_ctx * C, slang_type_qualifier * qual)
#define TYPE_SPECIFIER_MAT42 29
#define TYPE_SPECIFIER_MAT34 30
#define TYPE_SPECIFIER_MAT43 31
#define TYPE_SPECIFIER_COUNT 32
static int
parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O,
@ -1788,20 +1793,6 @@ parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition,
*parsed_func_ret = found_func;
}
/* assemble the parsed function */
{
slang_assemble_ctx A;
A.atoms = C->atoms;
A.space.funcs = O->funs;
A.space.structs = O->structs;
A.space.vars = O->vars;
A.program = O->program;
A.vartable = O->vartable;
A.log = C->L;
_slang_codegen_function(&A, *parsed_func_ret);
}
return GL_TRUE;
}
@ -1831,10 +1822,111 @@ parse_declaration(slang_parse_ctx * C, slang_output_ctx * O)
return 1;
}
/* external declaration */
#define PRECISION_LOW 0
#define PRECISION_MEDIUM 1
#define PRECISION_HIGH 2
static int
parse_default_precision(slang_parse_ctx * C, slang_output_ctx * O)
{
#if FEATURE_es2_glsl
int precision, type;
precision = *C->I++;
switch (precision) {
case PRECISION_LOW:
case PRECISION_MEDIUM:
case PRECISION_HIGH:
/* OK */
break;
default:
_mesa_problem(NULL, "unexpected precision %d at %s:%d\n",
precision, __FILE__, __LINE__);
return 0;
}
type = *C->I++;
switch (type) {
case TYPE_SPECIFIER_FLOAT:
case TYPE_SPECIFIER_INT:
case TYPE_SPECIFIER_SAMPLER1D:
case TYPE_SPECIFIER_SAMPLER2D:
case TYPE_SPECIFIER_SAMPLER3D:
case TYPE_SPECIFIER_SAMPLERCUBE:
case TYPE_SPECIFIER_SAMPLER1DSHADOW:
case TYPE_SPECIFIER_SAMPLER2DSHADOW:
case TYPE_SPECIFIER_SAMPLER2DRECT:
case TYPE_SPECIFIER_SAMPLER2DRECTSHADOW:
/* OK */
break;
default:
_mesa_problem(NULL, "unexpected type %d at %s:%d\n",
type, __FILE__, __LINE__);
return 0;
}
assert(type < TYPE_SPECIFIER_COUNT);
O->default_precision[type] = precision;
return 1;
#else
slang_info_log_error(C->L, "syntax error at \"precision\"");
return 0;
#endif
}
/**
* Initialize the default precision for all types.
* XXX this info isn't used yet.
*/
static void
init_default_precision(slang_output_ctx *O, slang_unit_type type)
{
GLuint i;
for (i = 0; i < TYPE_SPECIFIER_COUNT; i++) {
#if FEATURE_es2_glsl
O->default_precision[i] = PRECISION_LOW;
#else
O->default_precision[i] = PRECISION_HIGH;
#endif
}
#if FEATURE_es2_glsl
if (type == SLANG_UNIT_VERTEX_SHADER) {
O->default_precision[TYPE_SPECIFIER_FLOAT] = PRECISION_HIGH;
O->default_precision[TYPE_SPECIFIER_INT] = PRECISION_HIGH;
}
else {
O->default_precision[TYPE_SPECIFIER_INT] = PRECISION_MEDIUM;
}
#endif
}
static int
parse_invariant(slang_parse_ctx * C, slang_output_ctx * O)
{
if (C->version >= 120 || FEATURE_es2_glsl) {
slang_atom *a = parse_identifier(C);
/* XXX not doing anything with this var yet */
/*printf("ID: %s\n", (char*) a);*/
return a ? 1 : 0;
}
else {
slang_info_log_error(C->L, "syntax error at \"invariant\"");
return 0;
}
}
/* external declaration or default precision specifier */
#define EXTERNAL_NULL 0
#define EXTERNAL_FUNCTION_DEFINITION 1
#define EXTERNAL_DECLARATION 2
#define DEFAULT_PRECISION 3
#define INVARIANT_STMT 4
static GLboolean
parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
@ -1844,6 +1936,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
slang_output_ctx o;
GLboolean success;
GLuint maxRegs;
slang_function *mainFunc = NULL;
if (unit->type == SLANG_UNIT_FRAGMENT_BUILTIN ||
unit->type == SLANG_UNIT_FRAGMENT_SHADER) {
@ -1856,6 +1949,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
}
/* setup output context */
init_default_precision(&o, unit->type);
o.funs = &unit->funs;
o.structs = &unit->structs;
o.vars = &unit->vars;
@ -1871,11 +1965,22 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
{
slang_function *func;
success = parse_function(C, &o, 1, &func);
if (success &&
_mesa_strcmp((char *) func->header.a_name, "main") == 0) {
/* found main() */
mainFunc = func;
}
}
break;
case EXTERNAL_DECLARATION:
success = parse_declaration(C, &o);
break;
case DEFAULT_PRECISION:
success = parse_default_precision(C, &o);
break;
case INVARIANT_STMT:
success = parse_invariant(C, &o);
break;
default:
success = GL_FALSE;
}
@ -1888,6 +1993,22 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
}
C->I++;
if (mainFunc) {
/* assemble (generate code) for main() */
slang_assemble_ctx A;
A.atoms = C->atoms;
A.space.funcs = o.funs;
A.space.structs = o.structs;
A.space.vars = o.vars;
A.program = o.program;
A.vartable = o.vartable;
A.log = C->L;
_slang_codegen_function(&A, mainFunc);
}
_slang_pop_var_table(o.vartable);
_slang_delete_var_table(o.vartable);
@ -1896,6 +2017,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
static GLboolean
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)
@ -1911,6 +2033,7 @@ compile_binary(const byte * prod, slang_code_unit * unit,
C.global_scope = GL_TRUE;
C.atoms = &unit->object->atompool;
C.type = type;
C.version = version;
if (!check_revision(&C))
return GL_FALSE;
@ -1938,6 +2061,8 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit,
#if FEATURE_ARB_shading_language_120
maxVersion = 120;
#elif FEATURE_es2_glsl
maxVersion = 100;
#else
maxVersion = 110;
#endif
@ -1987,7 +2112,7 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit,
slang_string_free(&preprocessed);
/* Syntax is okay - translate it to internal representation. */
if (!compile_binary(prod, unit, type, infolog, builtin,
if (!compile_binary(prod, unit, version, type, infolog, builtin,
&builtin[SLANG_BUILTIN_TOTAL - 1],
program)) {
grammar_alloc_free(prod);
@ -2031,6 +2156,7 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
struct gl_program *program)
{
slang_code_unit *builtins = NULL;
GLuint base_version = 110;
/* load GLSL grammar */
*id = grammar_load_from_text((const byte *) (slang_shader_syn));
@ -2058,6 +2184,7 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
/* compile core functionality first */
if (!compile_binary(slang_core_gc,
&object->builtin[SLANG_BUILTIN_CORE],
base_version,
SLANG_UNIT_FRAGMENT_BUILTIN, infolog,
NULL, NULL, NULL))
return GL_FALSE;
@ -2065,6 +2192,7 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
#if FEATURE_ARB_shading_language_120
if (!compile_binary(slang_120_core_gc,
&object->builtin[SLANG_BUILTIN_120_CORE],
120,
SLANG_UNIT_FRAGMENT_BUILTIN, infolog,
NULL, &object->builtin[SLANG_BUILTIN_CORE], NULL))
return GL_FALSE;
@ -2073,6 +2201,11 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
/* compile common functions and variables, link to core */
if (!compile_binary(slang_common_builtin_gc,
&object->builtin[SLANG_BUILTIN_COMMON],
#if FEATURE_ARB_shading_language_120
120,
#else
base_version,
#endif
SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL,
#if FEATURE_ARB_shading_language_120
&object->builtin[SLANG_BUILTIN_120_CORE],
@ -2086,12 +2219,14 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
if (type == SLANG_UNIT_FRAGMENT_SHADER) {
if (!compile_binary(slang_fragment_builtin_gc,
&object->builtin[SLANG_BUILTIN_TARGET],
base_version,
SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL,
&object->builtin[SLANG_BUILTIN_COMMON], NULL))
return GL_FALSE;
#if FEATURE_ARB_shading_language_120
if (!compile_binary(slang_120_fragment_gc,
&object->builtin[SLANG_BUILTIN_TARGET],
120,
SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL,
&object->builtin[SLANG_BUILTIN_COMMON], NULL))
return GL_FALSE;
@ -2100,6 +2235,7 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
else if (type == SLANG_UNIT_VERTEX_SHADER) {
if (!compile_binary(slang_vertex_builtin_gc,
&object->builtin[SLANG_BUILTIN_TARGET],
base_version,
SLANG_UNIT_VERTEX_BUILTIN, infolog, NULL,
&object->builtin[SLANG_BUILTIN_COMMON], NULL))
return GL_FALSE;

View File

@ -69,8 +69,31 @@ slang_operation_destruct(slang_operation * oper)
oper->locals = NULL;
}
/**
* Recursively traverse 'oper', replacing occurances of 'oldScope' with
* 'newScope' in the oper->locals->outer_scope field.
*/
void
slang_replace_scope(slang_operation *oper,
slang_variable_scope *oldScope,
slang_variable_scope *newScope)
{
GLuint i;
if (oper->locals != newScope &&
oper->locals->outer_scope == oldScope) {
oper->locals->outer_scope = newScope;
}
for (i = 0; i < oper->num_children; i++) {
slang_replace_scope(&oper->children[i], oldScope, newScope);
}
}
/**
* Recursively copy a slang_operation node.
* \param x copy target
* \param y copy source
* \return GL_TRUE for success, GL_FALSE if failure
*/
GLboolean
@ -121,6 +144,14 @@ slang_operation_copy(slang_operation * x, const slang_operation * y)
#endif
slang_operation_destruct(x);
*x = z;
/* If this operation declares a new scope, we need to make sure
* all children point to it, not the original operation's scope!
*/
if (x->type == SLANG_OPER_BLOCK_NEW_SCOPE) {
slang_replace_scope(x, y->locals, x->locals);
}
return GL_TRUE;
}

View File

@ -128,6 +128,11 @@ slang_operation_construct(slang_operation *);
extern void
slang_operation_destruct(slang_operation *);
extern void
slang_replace_scope(slang_operation *oper,
slang_variable_scope *oldScope,
slang_variable_scope *newScope);
extern GLboolean
slang_operation_copy(slang_operation *, const slang_operation *);

View File

@ -115,6 +115,7 @@ slang_struct_construct(slang_struct * stru)
return 0;
}
_slang_struct_scope_ctr(stru->structs);
stru->constructor = NULL;
return 1;
}

View File

@ -29,11 +29,13 @@
extern "C" {
#endif
struct slang_function_;
typedef struct slang_struct_scope_
{
struct slang_struct_ *structs;
struct slang_struct_ *structs;
GLuint num_structs;
struct slang_struct_scope_ *outer_scope;
struct slang_struct_scope_ *outer_scope;
} slang_struct_scope;
extern GLvoid
@ -45,9 +47,10 @@ struct slang_struct_ *slang_struct_scope_find (slang_struct_scope *, slang_atom,
typedef struct slang_struct_
{
slang_atom a_name;
struct slang_variable_scope_ *fields;
slang_struct_scope *structs;
slang_atom a_name;
struct slang_variable_scope_ *fields;
slang_struct_scope *structs;
struct slang_function_ *constructor;
} slang_struct;
int slang_struct_construct (slang_struct *);

View File

@ -80,6 +80,7 @@ typedef struct slang_variable_
GLuint address; /**< Storage location */
GLuint size; /**< Variable's size in bytes */
GLboolean isTemp; /**< a named temporary (__resultTmp) */
GLboolean declared; /**< for debug */
void *aux; /**< Used during code gen */
} slang_variable;

View File

@ -126,21 +126,6 @@ _slang_swizzle_swizzle(GLuint swz1, GLuint swz2)
}
slang_ir_storage *
_slang_new_ir_storage(enum register_file file, GLint index, GLint size)
{
slang_ir_storage *st;
st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage));
if (st) {
st->File = file;
st->Index = index;
st->Size = size;
st->Swizzle = SWIZZLE_NOOP;
}
return st;
}
/**
* Allocate temporary storage for an intermediate result (such as for
* a multiply or add, etc.
@ -184,6 +169,39 @@ free_temp_storage(slang_var_table *vt, slang_ir_node *n)
}
/**
* Remove any SWIZZLE_NIL terms from given swizzle mask.
* For a swizzle like .z??? generate .zzzz (replicate single component).
* Else, for .wx?? generate .wxzw (insert default component for the position).
*/
static GLuint
fix_swizzle(GLuint swizzle)
{
GLuint c0 = GET_SWZ(swizzle, 0),
c1 = GET_SWZ(swizzle, 1),
c2 = GET_SWZ(swizzle, 2),
c3 = GET_SWZ(swizzle, 3);
if (c1 == SWIZZLE_NIL && c2 == SWIZZLE_NIL && c3 == SWIZZLE_NIL) {
/* smear first component across all positions */
c1 = c2 = c3 = c0;
}
else {
/* insert default swizzle components */
if (c0 == SWIZZLE_NIL)
c0 = SWIZZLE_X;
if (c1 == SWIZZLE_NIL)
c1 = SWIZZLE_Y;
if (c2 == SWIZZLE_NIL)
c2 = SWIZZLE_Z;
if (c3 == SWIZZLE_NIL)
c3 = SWIZZLE_W;
}
return MAKE_SWIZZLE4(c0, c1, c2, c3);
}
/**
* Convert IR storage to an instruction dst register.
*/
@ -191,14 +209,28 @@ static void
storage_to_dst_reg(struct prog_dst_register *dst, const slang_ir_storage *st,
GLuint writemask)
{
assert(st->Index >= 0);
dst->File = st->File;
dst->Index = st->Index;
const GLint size = st->Size;
GLint index = st->Index;
GLuint swizzle = st->Swizzle;
/* if this is storage relative to some parent storage, walk up the tree */
while (st->Parent) {
st = st->Parent;
index += st->Index;
swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle);
}
assert(st->File != PROGRAM_UNDEFINED);
assert(st->Size >= 1);
assert(st->Size <= 4);
if (st->Size == 1) {
GLuint comp = GET_SWZ(st->Swizzle, 0);
dst->File = st->File;
assert(index >= 0);
dst->Index = index;
assert(size >= 1);
assert(size <= 4);
if (size == 1) {
GLuint comp = GET_SWZ(swizzle, 0);
assert(comp < 4);
dst->WriteMask = WRITEMASK_X << comp;
}
@ -214,28 +246,32 @@ storage_to_dst_reg(struct prog_dst_register *dst, const slang_ir_storage *st,
static void
storage_to_src_reg(struct prog_src_register *src, const slang_ir_storage *st)
{
static const GLuint defaultSwizzle[4] = {
MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X),
MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W),
MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W),
MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W)
};
const GLboolean relAddr = st->RelAddr;
GLint index = st->Index;
GLuint swizzle = st->Swizzle;
/* if this is storage relative to some parent storage, walk up the tree */
while (st->Parent) {
st = st->Parent;
index += st->Index;
swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle);
}
assert(st->File >= 0);
assert(st->File < PROGRAM_UNDEFINED);
assert(st->Size >= 1);
assert(st->Size <= 4);
src->File = st->File;
src->Index = st->Index;
src->RelAddr = st->RelAddr;
if (st->Swizzle != SWIZZLE_NOOP)
src->Swizzle = st->Swizzle;
else
src->Swizzle = defaultSwizzle[st->Size - 1]; /*XXX really need this?*/
assert(GET_SWZ(src->Swizzle, 0) <= 3);
assert(GET_SWZ(src->Swizzle, 1) <= 3);
assert(GET_SWZ(src->Swizzle, 2) <= 3);
assert(GET_SWZ(src->Swizzle, 3) <= 3);
assert(index >= 0);
src->Index = index;
swizzle = fix_swizzle(swizzle);
assert(GET_SWZ(swizzle, 0) <= SWIZZLE_W);
assert(GET_SWZ(swizzle, 1) <= SWIZZLE_W);
assert(GET_SWZ(swizzle, 2) <= SWIZZLE_W);
assert(GET_SWZ(swizzle, 3) <= SWIZZLE_W);
src->Swizzle = swizzle;
src->RelAddr = relAddr;
}
@ -469,6 +505,12 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n)
const slang_ir_info *info = _slang_ir_info(n->Opcode);
char *srcAnnot[3], *dstAnnot;
GLuint i;
slang_ir_node *temps[3];
/* we'll save pointers to nodes/storage to free in temps[] until
* the very end.
*/
temps[0] = temps[1] = temps[2] = NULL;
assert(info);
assert(info->InstOpcode != OPCODE_NOP);
@ -489,9 +531,9 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n)
storage_to_src_reg(&inst->SrcReg[0], n->Children[0]->Children[0]->Store);
storage_to_src_reg(&inst->SrcReg[1], n->Children[0]->Children[1]->Store);
storage_to_src_reg(&inst->SrcReg[2], n->Children[1]->Store);
free_temp_storage(emitInfo->vt, n->Children[0]->Children[0]);
free_temp_storage(emitInfo->vt, n->Children[0]->Children[1]);
free_temp_storage(emitInfo->vt, n->Children[1]);
temps[0] = n->Children[0]->Children[0];
temps[1] = n->Children[0]->Children[1];
temps[2] = n->Children[1];
}
else if (info->NumParams == 2 &&
n->Opcode == IR_ADD && n->Children[1]->Opcode == IR_MUL) {
@ -505,9 +547,9 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n)
storage_to_src_reg(&inst->SrcReg[0], n->Children[1]->Children[0]->Store);
storage_to_src_reg(&inst->SrcReg[1], n->Children[1]->Children[1]->Store);
storage_to_src_reg(&inst->SrcReg[2], n->Children[0]->Store);
free_temp_storage(emitInfo->vt, n->Children[1]->Children[0]);
free_temp_storage(emitInfo->vt, n->Children[1]->Children[1]);
free_temp_storage(emitInfo->vt, n->Children[0]);
temps[0] = n->Children[1]->Children[0];
temps[1] = n->Children[1]->Children[1];
temps[2] = n->Children[0];
}
else
#endif
@ -532,17 +574,26 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n)
for (i = 0; i < info->NumParams; i++)
srcAnnot[i] = storage_annotation(n->Children[i], emitInfo->prog);
/* free temps */
/* record (potential) temps to free */
for (i = 0; i < info->NumParams; i++)
free_temp_storage(emitInfo->vt, n->Children[i]);
temps[i] = n->Children[i];
}
/* result storage */
if (!n->Store) {
/* XXX this size isn't correct, it depends on the operands */
if (!alloc_temp_storage(emitInfo, n, info->ResultSize))
GLint size = info->ResultSize;
if (!alloc_temp_storage(emitInfo, n, size))
return NULL;
#if 0000 /* this should work, but doesn't yet */
if (size == 2)
n->Writemask = WRITEMASK_XY;
else if (size == 3)
n->Writemask = WRITEMASK_XYZ;
else if (size == 1)
n->Writemask = WRITEMASK_X << GET_SWZ(n->Store->Swizzle,0);
#endif
}
storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask);
dstAnnot = storage_annotation(n, emitInfo->prog);
@ -550,6 +601,11 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n)
inst->Comment = instruction_annotation(inst->Opcode, dstAnnot, srcAnnot[0],
srcAnnot[1], srcAnnot[2]);
/* really free temps now */
for (i = 0; i < 3; i++)
if (temps[i])
free_temp_storage(emitInfo->vt, temps[i]);
/*_mesa_print_instruction(inst);*/
return inst;
}
@ -640,29 +696,72 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
}
}
else {
/* size > 4, struct compare */
#if 0
/* size > 4, struct or array compare.
* XXX this won't work reliably for structs with padding!!
*/
GLint i, num = (n->Children[0]->Store->Size + 3) / 4;
/*printf("BEGIN COMPARE size %d\n", num);*/
slang_ir_storage accTemp;
if (!n->Store) {
if (!alloc_temp_storage(emitInfo, n, 4))
return NULL;
}
accTemp.Size = 4;
accTemp.File = PROGRAM_TEMPORARY;
if (!_slang_alloc_temp(emitInfo->vt, &accTemp)) {
return NULL;
/* out of temps */
}
for (i = 0; i < num; i++) {
inst = new_instruction(emitInfo, opcode);
/* 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;
inst->DstReg.File = n->Store->File;
inst->DstReg.Index = n->Store->Index;
inst->CondUpdate = 1; /* update cond code */
if (i > 0) {
inst->DstReg.CondMask = COND_NE; /* update if !=0 */
if (i == 0) {
inst->DstReg.File = accTemp.File;
inst->DstReg.Index = accTemp.Index;
inst->Comment = _mesa_strdup("Begin struct/array comparison");
}
else {
inst->DstReg.File = n->Store->File;
inst->DstReg.Index = n->Store->Index;
}
if (i > 0) {
/* ADD accTemp, accTemp, temp; # like logical-OR */
inst = new_instruction(emitInfo, OPCODE_ADD);
inst->SrcReg[0].File = accTemp.File;
inst->SrcReg[0].Index = accTemp.Index;
inst->SrcReg[1].File = n->Store->File;
inst->SrcReg[1].Index = n->Store->Index;
inst->DstReg.File = accTemp.File;
inst->DstReg.Index = accTemp.Index;
}
/*_mesa_print_instruction(inst);*/
}
storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask);
#endif
_mesa_problem(NULL, "struct comparison not implemented yet");
inst = NULL;
/* compute accTemp.x || accTemp.y || accTemp.z || accTemp.w with DOT4 */
inst = new_instruction(emitInfo, OPCODE_DP4);
inst->SrcReg[0].File = accTemp.File;
inst->SrcReg[0].Index = accTemp.Index;
inst->SrcReg[1].File = accTemp.File;
inst->SrcReg[1].Index = accTemp.Index;
inst->DstReg.File = n->Store->File;
inst->DstReg.Index = n->Store->Index;
inst->Comment = _mesa_strdup("End struct/array comparison");
if (n->Opcode == IR_EQUAL) {
/* compute tmp.x = !tmp.x via tmp.x = (tmp.x == 0) */
inst = new_instruction(emitInfo, OPCODE_SEQ);
storage_to_src_reg(&inst->SrcReg[0], n->Store);
constant_to_src_reg(&inst->SrcReg[1], 0.0, emitInfo);
storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask);
inst->Comment = _mesa_strdup("Invert true/false");
}
_slang_free_temp(emitInfo->vt, &accTemp);
}
/* free temps */
@ -944,6 +1043,8 @@ emit_move(slang_emit_info *emitInfo, slang_ir_node *n)
{
struct prog_instruction *inst;
assert(n->Opcode == IR_MOVE);
/* lhs */
emit(emitInfo, n->Children[0]);
if (!n->Children[0]->Store || n->Children[0]->Store->Index < 0) {
@ -982,8 +1083,14 @@ emit_move(slang_emit_info *emitInfo, slang_ir_node *n)
if (n->Children[1]->Opcode != IR_SWIZZLE)
_slang_free_temp(emitInfo->vt, n->Children[1]->Store);
*n->Children[1]->Store = *n->Children[0]->Store;
/* fixup the previous instruction (which stored the RHS result) */
assert(n->Children[0]->Store->Index >= 0);
/* use tighter writemask when possible */
if (n->Writemask == WRITEMASK_XYZW)
n->Writemask = inst->DstReg.WriteMask;
storage_to_dst_reg(&inst->DstReg, n->Children[0]->Store, n->Writemask);
return inst;
}
@ -1161,6 +1268,9 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n)
}
}
if (!n->Children[0]->Store)
return NULL;
#if 0
assert(n->Children[0]->Store->Size == 1); /* a bool! */
#endif
@ -1395,75 +1505,18 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n)
}
/**
* Remove any SWIZZLE_NIL terms from given swizzle mask (smear prev term).
* Ex: fix_swizzle("zyNN") -> "zyyy"
*/
static GLuint
fix_swizzle(GLuint swizzle)
{
GLuint swz[4], i;
for (i = 0; i < 4; i++) {
swz[i] = GET_SWZ(swizzle, i);
if (swz[i] == SWIZZLE_NIL) {
swz[i] = swz[i - 1];
}
}
return MAKE_SWIZZLE4(swz[0], swz[1], swz[2], swz[3]);
}
/**
* Return the number of components actually named by the swizzle.
* Recall that swizzles may have undefined/don't-care values.
*/
static GLuint
swizzle_size(GLuint swizzle)
{
GLuint size = 0, i;
for (i = 0; i < 4; i++) {
GLuint swz = GET_SWZ(swizzle, i);
size += (swz >= 0 && swz <= 3);
}
return size;
}
static struct prog_instruction *
emit_swizzle(slang_emit_info *emitInfo, slang_ir_node *n)
{
GLuint swizzle;
struct prog_instruction *inst;
inst = emit(emitInfo, n->Children[0]);
#ifdef DEBUG
{
GLuint s = n->Children[0]->Store->Swizzle;
assert(GET_SWZ(s, 0) != SWIZZLE_NIL);
assert(GET_SWZ(s, 1) != SWIZZLE_NIL);
assert(GET_SWZ(s, 2) != SWIZZLE_NIL);
assert(GET_SWZ(s, 3) != SWIZZLE_NIL);
}
#endif
/* For debug: n->Var = n->Children[0]->Var; */
/* setup storage info, if needed */
if (!n->Store->Parent)
n->Store->Parent = n->Children[0]->Store;
/* "pull-up" the child's storage info, applying our swizzle info */
n->Store->File = n->Children[0]->Store->File;
n->Store->Index = n->Children[0]->Store->Index;
n->Store->Size = swizzle_size(n->Store->Swizzle);
#if 0
printf("Emit Swizzle %s reg %d chSize %d mySize %d\n",
_mesa_swizzle_string(n->Store->Swizzle, 0, 0),
n->Store->Index, n->Children[0]->Store->Size,
n->Store->Size);
#endif
/* apply this swizzle to child's swizzle to get composed swizzle */
swizzle = fix_swizzle(n->Store->Swizzle); /* remove the don't care terms */
n->Store->Swizzle = _slang_swizzle_swizzle(n->Children[0]->Store->Swizzle,
swizzle);
assert(n->Store->Parent);
return inst;
}
@ -1476,33 +1529,85 @@ emit_swizzle(slang_emit_info *emitInfo, slang_ir_node *n)
static struct prog_instruction *
emit_array_element(slang_emit_info *emitInfo, slang_ir_node *n)
{
slang_ir_storage *root;
assert(n->Opcode == IR_ELEMENT);
assert(n->Store);
assert(n->Store->File != PROGRAM_UNDEFINED);
assert(n->Store->File == PROGRAM_UNDEFINED);
assert(n->Store->Parent);
assert(n->Store->Size > 0);
if (n->Store->File == PROGRAM_STATE_VAR) {
n->Store->Index = _slang_alloc_statevar(n, emitInfo->prog->Parameters);
root = n->Store;
while (root->Parent)
root = root->Parent;
if (root->File == PROGRAM_STATE_VAR) {
GLint index = _slang_alloc_statevar(n, emitInfo->prog->Parameters);
assert(n->Store->Index == index);
return NULL;
}
if (n->Children[1]->Opcode == IR_FLOAT) {
/* Constant index */
/* 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];
n->Store->Index = arrayAddr + index;
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);
/* 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;
}
else {
/* Variable index*/
/* 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]);
inst = new_instruction(emitInfo, OPCODE_ARL);
storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask);
storage_to_src_reg(&inst->SrcReg[0], n->Children[1]->Store);
inst->DstReg.File = PROGRAM_ADDRESS;
inst->DstReg.Index = 0; /* always address register [0] */
inst->Comment = _mesa_strdup("ARL ADDR");
n->Store->RelAddr = GL_TRUE;
n->Store->Index = inst->DstReg.Index;/*index of the array*/
inst->DstReg.Index = 0; /*addr index is always 0*/
}
/* if array element size is one, make sure we only access X */
if (n->Store->Size == 1)
n->Store->Swizzle = SWIZZLE_XXXX;
return NULL; /* no instruction */
}
@ -1513,25 +1618,27 @@ emit_array_element(slang_emit_info *emitInfo, slang_ir_node *n)
static struct prog_instruction *
emit_struct_field(slang_emit_info *emitInfo, slang_ir_node *n)
{
if (n->Store->File == PROGRAM_STATE_VAR) {
n->Store->Index = _slang_alloc_statevar(n, emitInfo->prog->Parameters);
if (n->Store->Index < 0) {
slang_ir_storage *root = n->Store;
assert(n->Opcode == IR_FIELD);
while (root->Parent)
root = root->Parent;
/* If this is the field of a state var, allocate constant/uniform
* storage for it now if we haven't already.
* Note that we allocate storage (uniform/constant slots) for state
* variables here rather than at declaration time so we only allocate
* space for the ones that we actually use!
*/
if (root->File == PROGRAM_STATE_VAR) {
root->Index = _slang_alloc_statevar(n, emitInfo->prog->Parameters);
if (root->Index < 0) {
slang_info_log_error(emitInfo->log, "Error parsing state variable");
return NULL;
}
}
else {
GLint offset = n->FieldOffset / 4;
assert(n->Children[0]->Store->Index >= 0);
n->Store->Index = n->Children[0]->Store->Index + offset;
if (n->Store->Size == 1) {
GLint swz = n->FieldOffset % 4;
n->Store->Swizzle = MAKE_SWIZZLE4(swz, swz, swz, swz);
}
else {
n->Store->Swizzle = SWIZZLE_XYZW;
}
}
return NULL; /* no instruction */
}
@ -1657,6 +1764,9 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
case IR_COS:
case IR_DDX:
case IR_DDY:
case IR_EXP:
case IR_EXP2:
case IR_LOG2:
case IR_NOISE1:
case IR_NOISE2:
case IR_NOISE3:
@ -1677,8 +1787,6 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
case IR_SLE:
case IR_SLT:
case IR_POW:
case IR_EXP:
case IR_EXP2:
/* trinary operators */
case IR_LRP:
return emit_arith(emitInfo, n);

View File

@ -40,10 +40,6 @@ extern GLuint
_slang_swizzle_swizzle(GLuint swz1, GLuint swz2);
extern slang_ir_storage *
_slang_new_ir_storage(enum register_file file, GLint index, GLint size);
extern GLboolean
_slang_emit_code(slang_ir_node *n, slang_var_table *vartable,
struct gl_program *prog, GLboolean withEnd,

View File

@ -51,6 +51,8 @@ static const slang_ir_info IrInfo[] = {
{ IR_SLT, "IR_SLT", OPCODE_SLT, 4, 2 },
{ IR_POW, "IR_POW", OPCODE_POW, 1, 2 },
{ IR_EQUAL, "IR_EQUAL", OPCODE_NOP, 1, 2 },
{ IR_NOTEQUAL, "IR_NOTEQUAL", OPCODE_NOP, 1, 2 },
/* unary ops */
{ IR_I_TO_F, "IR_I_TO_F", OPCODE_NOP, 1, 1 },
{ IR_F_TO_I, "IR_F_TO_I", OPCODE_INT, 4, 1 }, /* 4 floats to 4 ints */
@ -109,6 +111,66 @@ _slang_ir_info(slang_ir_opcode opcode)
}
/**
* Return a new slang_ir_storage object.
*/
slang_ir_storage *
_slang_new_ir_storage(enum register_file file, GLint index, GLint size)
{
slang_ir_storage *st;
st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage));
if (st) {
st->File = file;
st->Index = index;
st->Size = size;
st->Swizzle = SWIZZLE_NOOP;
st->Parent = NULL;
}
return st;
}
/**
* Return a new slang_ir_storage object.
*/
slang_ir_storage *
_slang_new_ir_storage_swz(enum register_file file, GLint index, GLint size,
GLuint swizzle)
{
slang_ir_storage *st;
st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage));
if (st) {
st->File = file;
st->Index = index;
st->Size = size;
st->Swizzle = swizzle;
st->Parent = NULL;
}
return st;
}
/**
* Return a new slang_ir_storage object.
*/
slang_ir_storage *
_slang_new_ir_storage_relative(GLint index, GLint size,
slang_ir_storage *parent)
{
slang_ir_storage *st;
st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage));
if (st) {
st->File = PROGRAM_UNDEFINED;
st->Index = index;
st->Size = size;
st->Swizzle = SWIZZLE_NOOP;
st->Parent = parent;
}
return st;
}
static const char *
_slang_ir_name(slang_ir_opcode opcode)
{
@ -116,6 +178,7 @@ _slang_ir_name(slang_ir_opcode opcode)
}
#if 0 /* no longer needed with mempool */
/**
* Since many IR nodes might point to the same IR storage info, we need
@ -176,20 +239,6 @@ _slang_free_ir_tree(slang_ir_node *n)
static const char *
swizzle_string(GLuint swizzle)
{
static char s[6];
GLuint i;
s[0] = '.';
for (i = 1; i < 5; i++) {
s[i] = "xyzw"[GET_SWZ(swizzle, i-1)];
}
s[i] = 0;
return s;
}
static const char *
writemask_string(GLuint writemask)
{
@ -347,7 +396,7 @@ _slang_print_ir_tree(const slang_ir_node *n, int indent)
case IR_VAR:
printf("VAR %s%s at %s store %p\n",
(n->Var ? (char *) n->Var->a_name : "TEMP"),
swizzle_string(n->Store->Swizzle),
_mesa_swizzle_string(n->Store->Swizzle, 0, 0),
storage_string(n->Store), (void*) n->Store);
break;
case IR_VAR_DECL:
@ -374,7 +423,7 @@ _slang_print_ir_tree(const slang_ir_node *n, int indent)
break;
case IR_SWIZZLE:
printf("SWIZZLE %s of (store %p) \n",
swizzle_string(n->Store->Swizzle), (void*) n->Store);
_mesa_swizzle_string(n->Store->Swizzle, 0, 0), (void*) n->Store);
_slang_print_ir_tree(n->Children[0], indent + 3);
break;
default:

View File

@ -147,6 +147,11 @@ struct _slang_ir_storage
GLuint Swizzle;
GLint RefCount; /**< Used during IR tree delete */
GLboolean RelAddr;
/** If Parent is non-null, Index is relative to parent.
* The other fields are ignored.
*/
struct _slang_ir_storage *Parent;
};
typedef struct _slang_ir_storage slang_ir_storage;
@ -165,7 +170,6 @@ typedef struct slang_ir_node_
/** special fields depending on Opcode: */
const char *Field; /**< If Opcode == IR_FIELD */
int FieldOffset; /**< If Opcode == IR_FIELD */
GLuint Writemask; /**< If Opcode == IR_MOVE */
GLfloat Value[4]; /**< If Opcode == IR_FLOAT */
slang_variable *Var; /**< If Opcode == IR_VAR or IR_VAR_DECL */
@ -193,6 +197,20 @@ extern const slang_ir_info *
_slang_ir_info(slang_ir_opcode opcode);
extern slang_ir_storage *
_slang_new_ir_storage(enum register_file file, GLint index, GLint size);
extern slang_ir_storage *
_slang_new_ir_storage_swz(enum register_file file, GLint index, GLint size,
GLuint swizzle);
extern slang_ir_storage *
_slang_new_ir_storage_relative(GLint index, GLint size,
slang_ir_storage *parent);
extern void
_slang_free_ir_tree(slang_ir_node *n);

View File

@ -211,7 +211,6 @@ _slang_resolve_attributes(struct gl_shader_program *shProg,
{
GLuint i, j;
GLbitfield usedAttributes;
GLint size = 4; /* XXX fix */
assert(prog->Target == GL_VERTEX_PROGRAM_ARB);
@ -253,6 +252,8 @@ _slang_resolve_attributes(struct gl_shader_program *shProg,
* Start at 1 since generic attribute 0 always aliases
* glVertex/position.
*/
GLint size = prog->Attributes->Parameters[k].Size;
GLenum datatype = prog->Attributes->Parameters[k].DataType;
for (attr = 1; attr < MAX_VERTEX_ATTRIBS; attr++) {
if (((1 << attr) & usedAttributes) == 0)
break;
@ -261,7 +262,7 @@ _slang_resolve_attributes(struct gl_shader_program *shProg,
/* too many! XXX record error log */
return GL_FALSE;
}
_mesa_add_attribute(shProg->Attributes, name, size, attr);
_mesa_add_attribute(shProg->Attributes, name, size, datatype,attr);
/* set the attribute as used */
usedAttributes |= 1<<attr;

View File

@ -729,6 +729,14 @@ expand (expand_state *e, pp_symbols *symbols)
slang_string_pushi (e->output, e->state->version);
slang_string_pushc (e->output, ' ');
}
#if FEATURE_es2_glsl
else if (_mesa_strcmp (id, "GL_ES") == 0 ||
_mesa_strcmp (id, "GL_FRAGMENT_PRECISION_HIGH") == 0) {
slang_string_pushc (e->output, ' ');
slang_string_pushi (e->output, '1');
slang_string_pushc (e->output, ' ');
}
#endif
else {
pp_symbol *symbol;
@ -829,6 +837,16 @@ static GLboolean
preprocess_source (slang_string *output, const char *source, grammar pid, grammar eid,
slang_info_log *elog)
{
static const char *predefined[] = {
"__FILE__",
"__LINE__",
"__VERSION__",
#if FEATURE_es2_glsl
"GL_ES",
"GL_FRAGMENT_PRECISION_HIGH",
#endif
NULL
};
byte *prod;
GLuint size, i;
pp_state state;
@ -840,6 +858,15 @@ preprocess_source (slang_string *output, const char *source, grammar pid, gramma
pp_state_init (&state, elog);
/* add the predefined symbols to the symbol table */
for (i = 0; predefined[i]; i++) {
pp_symbol *symbol = NULL;
symbol = pp_symbols_push(&state.symbols);
assert(symbol);
slang_string_pushs(&symbol->name,
predefined[i], _mesa_strlen(predefined[i]));
}
i = 0;
while (i < size) {
if (prod[i] != ESCAPE_TOKEN) {

View File

@ -156,7 +156,7 @@ print_variable(const slang_variable *v, int indent)
spaces(indent);
printf("VAR ");
print_type(&v->type);
printf(" %s", (char *) v->a_name);
printf(" %s (at %p)", (char *) v->a_name, (void *) v);
if (v->initializer) {
printf(" :=\n");
slang_print_tree(v->initializer, indent + 3);
@ -171,10 +171,12 @@ static void
print_binary(const slang_operation *op, const char *oper, int indent)
{
assert(op->num_children == 2);
#if 0
printf("binary at %p locals=%p outer=%p\n",
(void *) op,
(void *) op->locals,
(void *) op->locals->outer_scope);
#endif
slang_print_tree(&op->children[0], indent + 3);
spaces(indent);
printf("%s at %p locals=%p outer=%p\n",
@ -241,7 +243,7 @@ find_var(const slang_variable_scope *s, slang_atom name)
void
slang_print_tree(const slang_operation *op, int indent)
{
int i;
GLuint i;
switch (op->type) {
@ -260,14 +262,13 @@ slang_print_tree(const slang_operation *op, int indent)
case SLANG_OPER_BLOCK_NEW_SCOPE:
spaces(indent);
printf("{{ // new scope locals=%p: ", (void*)op->locals);
{
int i;
for (i = 0; i < op->locals->num_variables; i++) {
printf("%s ", (char *) op->locals->variables[i]->a_name);
}
printf("\n");
printf("{{ // new scope locals=%p outer=%p: ",
(void *) op->locals,
(void *) op->locals->outer_scope);
for (i = 0; i < op->locals->num_variables; i++) {
printf("%s ", (char *) op->locals->variables[i]->a_name);
}
printf("\n");
print_generic(op, NULL, indent+3);
spaces(indent);
printf("}}\n");
@ -665,15 +666,15 @@ slang_print_tree(const slang_operation *op, int indent)
void
slang_print_function(const slang_function *f, GLboolean body)
{
int i;
GLuint i;
#if 0
if (_mesa_strcmp((char *) f->header.a_name, "main") != 0)
return;
#endif
printf("FUNCTION %s (\n",
(char *) f->header.a_name);
printf("FUNCTION %s ( scope=%p\n",
(char *) f->header.a_name, (void *) f->parameters);
for (i = 0; i < f->param_count; i++) {
print_variable(f->parameters->variables[i], 3);

View File

@ -76,7 +76,7 @@ _slang_lookup_constant(const char *name)
for (i = 0; info[i].Name; i++) {
if (strcmp(info[i].Name, name) == 0) {
/* found */
GLint value = -1.0;
GLint value = -1;
_mesa_GetIntegerv(info[i].Token, &value);
ASSERT(value >= 0); /* sanity check that glGetFloatv worked */
return value / info[i].Divisor;
@ -110,7 +110,7 @@ _slang_simplify(slang_operation *oper,
oper->literal[0] =
oper->literal[1] =
oper->literal[2] =
oper->literal[3] = value;
oper->literal[3] = (GLfloat) value;
oper->type = SLANG_OPER_LITERAL_INT;
return;
}
@ -380,7 +380,7 @@ _slang_adapt_call(slang_operation *callOper, const slang_function *fun,
&origArg);
callOper->children[i + j].children[1].type
= SLANG_OPER_LITERAL_INT;
callOper->children[i + j].children[1].literal[0] = j;
callOper->children[i + j].children[1].literal[0] = (GLfloat) j;
}
}
@ -394,11 +394,11 @@ _slang_adapt_call(slang_operation *callOper, const slang_function *fun,
}
}
if (callOper->num_children < numParams) {
if (callOper->num_children < (GLuint) numParams) {
/* still not enough args for all params */
return GL_FALSE;
}
else if (callOper->num_children > numParams) {
else if (callOper->num_children > (GLuint) numParams) {
/* now too many arguments */
/* XXX this isn't always an error, see spec */
return GL_FALSE;

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