Merge branch 'master' of git://github.com/techtonik/regal
make export - Export.py command-line has changed. Makefile defaults to MODE=release Texture parameter logging improvements. boost::string_list support for splitting glShaderSource string arrays, with optional delimiter Optional logging of pointers - REGAL_LOG_POINTERS=1 by default Optional logging of thread, per line of log output - REGAL_LOG_THREAD=0 by default In Init::context, avoid assertion if thread was previously associated with the context Optional writing to shader cache - REGAL_CACHE_SHADER_WRITE=1 by default in debug mode Initial test coverage added for boost::string_list Add makePath utility function for joining a directory and filename.
This commit is contained in:
parent
61849537d6
commit
eeca54dea1
41 changed files with 1035 additions and 418 deletions
61
Makefile
61
Makefile
|
|
@ -14,7 +14,14 @@ REGAL_DEST ?= /usr
|
|||
BINDIR ?= $(REGAL_DEST)/bin
|
||||
LIBDIR ?= $(REGAL_DEST)/lib
|
||||
|
||||
# To build in debug mode:
|
||||
# - use MODE=debug on gmake command-line
|
||||
#
|
||||
# To build using ccache (http://ccache.samba.org/)
|
||||
# - use CCACHE=ccache on gmake command-line
|
||||
#
|
||||
# To disable stripping of binaries either:
|
||||
# - use MODE=debug on gmake command-line
|
||||
# - use STRIP= on gmake command-line
|
||||
# - edit this makefile to set STRIP to the empty string
|
||||
#
|
||||
|
|
@ -23,6 +30,7 @@ LIBDIR ?= $(REGAL_DEST)/lib
|
|||
#
|
||||
# To specify additional compiler flags:
|
||||
# - use CFLAGS= on gmake command-line
|
||||
#
|
||||
|
||||
AR ?= ar
|
||||
INSTALL ?= install
|
||||
|
|
@ -30,6 +38,12 @@ STRIP ?= strip
|
|||
RM ?= rm -f
|
||||
LN ?= ln -sf
|
||||
|
||||
# Release mode is the default
|
||||
|
||||
ifeq ($(MODE),)
|
||||
MODE := release
|
||||
endif
|
||||
|
||||
ifeq ($(MODE),debug)
|
||||
OPT = $(CFLAGS.DEBUG)
|
||||
STRIP :=
|
||||
|
|
@ -41,7 +55,7 @@ endif
|
|||
|
||||
INCLUDE = -Iinclude
|
||||
|
||||
override CFLAGS := $(CFLAGS) $(OPT) $(WARN) $(INCLUDE) $(CFLAGS.EXTRA)
|
||||
override CFLAGS := $(OPT) $(CFLAGS) $(WARN) $(INCLUDE) $(CFLAGS.EXTRA)
|
||||
|
||||
all: regal.lib glew.lib glu.lib glut.lib regal.bin
|
||||
|
||||
|
|
@ -96,7 +110,7 @@ zlib.lib: lib/$(ZLIB.STATIC)
|
|||
|
||||
tmp/$(SYSTEM)/zlib/static/%.o: src/zlib/src/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(ZLIB.CFLAGS) $(PICFLAG) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(ZLIB.CFLAGS) $(CFLAGS) $(PICFLAG) -o $@ -c $<
|
||||
|
||||
lib/$(ZLIB.STATIC): lib $(ZLIB.OBJS)
|
||||
$(CCACHE) $(AR) cr $@ $(ZLIB.OBJS)
|
||||
|
|
@ -146,7 +160,7 @@ libpng.lib: zlib.lib lib/$(LIBPNG.STATIC)
|
|||
|
||||
tmp/$(SYSTEM)/libpng/static/%.o: src/libpng/src/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(LIBPNG.CFLAGS) $(PICFLAG) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(LIBPNG.CFLAGS) $(CFLAGS) $(PICFLAG) -o $@ -c $<
|
||||
|
||||
lib/$(LIBPNG.STATIC): lib $(LIBPNG.OBJS)
|
||||
$(CCACHE) $(AR) cr $@ $(LIBPNG.OBJS)
|
||||
|
|
@ -290,27 +304,27 @@ endif
|
|||
|
||||
tmp/$(SYSTEM)/regal/static/%.o: src/regal/%.cpp $(LIB.DEPS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(LIB.CFLAGS) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(LIB.CFLAGS) $(CFLAGS) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/regal/shared/%.o: src/regal/%.cpp $(LIB.DEPS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(LIB.CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(LIB.CFLAGS) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/regal/static/%.o: src/mongoose/%.c $(LIB.DEPS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(LIB.CFLAGS) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(LIB.CFLAGS) $(CFLAGS) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/regal/shared/%.o: src/mongoose/%.c $(LIB.DEPS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(LIB.CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(LIB.CFLAGS) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/regal/static/%.o: src/md5/src/%.c $(LIB.DEPS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(LIB.CFLAGS) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(LIB.CFLAGS) $(CFLAGS) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/regal/shared/%.o: src/md5/src/%.c $(LIB.DEPS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(LIB.CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(LIB.CFLAGS) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
|
||||
|
||||
#
|
||||
# RegalGLEW
|
||||
|
|
@ -329,7 +343,7 @@ glew.lib: lib/$(GLEW.SHARED)
|
|||
|
||||
tmp/$(SYSTEM)/glew/shared/%.o: src/glew/src/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(PICFLAG) $(GLEW.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(PICFLAG) $(GLEW.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
lib/$(GLEW.SHARED): lib $(GLEW.OBJS) lib/$(LIB.SHARED)
|
||||
$(CCACHE) $(LD) $(LDFLAGS.EXTRA) $(LDFLAGS.DYNAMIC) -o $@ $(GLEW.OBJS) $(LIB.LDFLAGS) $(GLEW.LIBS) -lpthread
|
||||
|
|
@ -354,7 +368,7 @@ endif
|
|||
|
||||
tmp/$(SYSTEM)/glewinfo/static/%.o: src/glew/src/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(GLEWINFO.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(GLEWINFO.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
bin/glewinfo: bin $(GLEWINFO.OBJS) lib/$(LIB.SHARED) lib/$(GLEW.SHARED)
|
||||
$(CCACHE) $(LD) $(LDFLAGS.EXTRA) -o $@ $(GLEWINFO.OBJS) $(LIB.LDFLAGS) $(GLEWINFO.LIBS)
|
||||
|
|
@ -478,23 +492,23 @@ glu.lib: lib/$(GLU.SHARED)
|
|||
|
||||
tmp/$(SYSTEM)/glu/shared/%.o: src/glu/libtess/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(PICFLAG) $(GLU.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(PICFLAG) $(GLU.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/glu/shared/%.o: src/glu/libutil/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(PICFLAG) $(GLU.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(PICFLAG) $(GLU.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/glu/shared/%.o: src/glu/libnurbs/interface/%.cc
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(PICFLAG) $(GLU.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(PICFLAG) $(GLU.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/glu/shared/%.o: src/glu/libnurbs/internals/%.cc
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(PICFLAG) $(GLU.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(PICFLAG) $(GLU.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/glu/shared/%.o: src/glu/libnurbs/nurbtess/%.cc
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(PICFLAG) $(GLU.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(PICFLAG) $(GLU.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
lib/$(GLU.SHARED): lib $(GLU.OBJS)
|
||||
$(CCACHE) $(LD) $(LDFLAGS.EXTRA) $(LDFLAGS.DYNAMIC) $(GLU.LIBS) $(LIB.LDFLAGS) -o $@ $(GLU.OBJS)
|
||||
|
|
@ -586,7 +600,7 @@ glut.lib: lib/$(GLUT.SHARED)
|
|||
|
||||
tmp/$(SYSTEM)/glut/shared/%.o: src/glut/src/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(PICFLAG) $(GLUT.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(GLUT.CFLAGS) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
lib/$(GLUT.SHARED): lib $(GLUT.OBJS) lib/$(GLU.SHARED) lib/$(LIB.SHARED)
|
||||
$(CCACHE) $(LD) $(LDFLAGS.EXTRA) $(LDFLAGS.DYNAMIC) -o $@ $(GLUT.OBJS) $(GLUT.LIBS)
|
||||
|
|
@ -623,11 +637,11 @@ DREAMTORUS.LIBS += -lm -lpthread
|
|||
|
||||
tmp/$(SYSTEM)/dreamtorus/static/%.o: examples/dreamtorus/src/%.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(DREAMTORUS.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(DREAMTORUS.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/dreamtorus/static/%.o: examples/dreamtorus/glut/code/%.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(DREAMTORUS.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(DREAMTORUS.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
bin/dreamtorus: bin $(DREAMTORUS.OBJS) lib/$(LIB.SHARED)
|
||||
$(CCACHE) $(LD) $(LDFLAGS.EXTRA) -o $@ $(DREAMTORUS.OBJS) $(LIB.LDFLAGS) $(DREAMTORUS.LIBS)
|
||||
|
|
@ -645,7 +659,7 @@ NACL.LIBS += -lpng -lz -lm -lpthread -lppapi -lppapi_gles2 -lstdc++
|
|||
|
||||
tmp/$(SYSTEM)/nacl/static/%.o: examples/nacl/%.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) $(NACL.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CC) $(NACL.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
bin/nacl$(BIN_EXTENSION): bin lib/$(LIB.STATIC) $(NACL.OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(NACL.OBJS) $(NACL.LIBS)
|
||||
|
|
@ -683,7 +697,7 @@ TIGER.LIBS += -lm -lpthread
|
|||
|
||||
tmp/$(SYSTEM)/tiger/static/%.o: examples/tiger/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(TIGER.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(TIGER.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
bin/tiger: bin $(TIGER.OBJS) lib/$(GLEW.SHARED) lib/$(LIB.SHARED)
|
||||
$(CCACHE) $(LD) $(LDFLAGS.EXTRA) -o $@ $(TIGER.OBJS) $(TIGER.LIBS)
|
||||
|
|
@ -721,7 +735,7 @@ GTEST.STATIC := libgtest.a
|
|||
|
||||
tmp/$(SYSTEM)/gtest/static/%.o: src/googletest/src/%.cc
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(GTEST.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(GTEST.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
lib/$(GTEST.STATIC): lib $(GTEST.OBJS)
|
||||
$(CCACHE) $(AR) cr $@ $(GTEST.OBJS)
|
||||
|
|
@ -736,6 +750,7 @@ endif
|
|||
REGALTESTS.SRCS += tests/test_main.cpp
|
||||
REGALTESTS.SRCS += tests/testRegalTexC.cpp
|
||||
REGALTESTS.SRCS += tests/testRegalPixelConversions.cpp
|
||||
REGALTESTS.SRCS += tests/testStringList.cpp
|
||||
REGALTESTS.SRCS.NAMES := $(notdir $(REGALTESTS.SRCS))
|
||||
REGALTESTS.OBJS := $(addprefix tmp/$(SYSTEM)/regal_tests/static/,$(REGALTESTS.SRCS.NAMES))
|
||||
REGALTESTS.OBJS := $(REGALTESTS.OBJS:.cpp=.o)
|
||||
|
|
@ -744,7 +759,7 @@ REGALTESTS.LIBS := -Llib -lgtest -lRegal -lm -ldl
|
|||
|
||||
tmp/$(SYSTEM)/regal_tests/static/%.o: tests/%.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CCACHE) $(CC) $(CFLAGS) $(REGALTESTS.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
$(CCACHE) $(CC) $(LIB.CFLAGS) $(REGALTESTS.CFLAGS) $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
bin/RegalTests: bin $(REGALTESTS.OBJS) lib/$(GTEST.STATIC) lib/$(LIB.STATIC)
|
||||
$(CCACHE) $(LD) $(LDFLAGS.EXTRA) -o $@ $(REGALTESTS.OBJS) $(LIB.LDFLAGS) $(REGALTESTS.LIBS)
|
||||
|
|
|
|||
|
|
@ -276,6 +276,8 @@
|
|||
<ClCompile Include="..\..\..\..\src\regal\RegalMarker.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalMarker.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalObj.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalPixelConversions.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPixelConversions.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPpa.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPpc.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPrecompile.h" />
|
||||
|
|
@ -289,6 +291,8 @@
|
|||
<ClInclude Include="..\..\..\..\src\regal\RegalSo.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalState.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalSystem.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalTexC.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalTexC.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalThread.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalTimer.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalToken.cpp" />
|
||||
|
|
|
|||
|
|
@ -276,6 +276,8 @@
|
|||
<ClCompile Include="..\..\..\..\src\regal\RegalMarker.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalMarker.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalObj.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalPixelConversions.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPixelConversions.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPpa.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPpc.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPrecompile.h" />
|
||||
|
|
@ -289,6 +291,8 @@
|
|||
<ClInclude Include="..\..\..\..\src\regal\RegalSo.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalState.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalSystem.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalTexC.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalTexC.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalThread.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalTimer.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalToken.cpp" />
|
||||
|
|
|
|||
|
|
@ -276,6 +276,8 @@
|
|||
<ClCompile Include="..\..\..\..\src\regal\RegalMarker.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalMarker.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalObj.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalPixelConversions.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPixelConversions.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPpa.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPpc.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPrecompile.h" />
|
||||
|
|
@ -289,6 +291,8 @@
|
|||
<ClInclude Include="..\..\..\..\src\regal\RegalSo.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalState.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalSystem.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalTexC.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalTexC.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalThread.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalTimer.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalToken.cpp" />
|
||||
|
|
|
|||
|
|
@ -276,6 +276,8 @@
|
|||
<ClCompile Include="..\..\..\..\src\regal\RegalMarker.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalMarker.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalObj.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalPixelConversions.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPixelConversions.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPpa.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPpc.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalPrecompile.h" />
|
||||
|
|
@ -289,6 +291,8 @@
|
|||
<ClInclude Include="..\..\..\..\src\regal\RegalSo.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalState.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalSystem.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalTexC.cpp" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalTexC.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalThread.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalTimer.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalToken.cpp" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@ def logParameter(function, parameter):
|
|||
elif n=='data' and (function.name=='glBufferSubData' or function.name=='glBufferSubDataARB'):
|
||||
return 'boost::print::raw(data,Logging::rawLimit(data ? size : 0))'
|
||||
elif t in [ 'void *', 'const void *', 'GLvoid *', 'const GLvoid *', 'GLubyte *', 'const GLubyte *'] or \
|
||||
t in [ 'XID', 'Pixmap', 'Font', 'Display *', 'GLXDrawble', 'GLXPixmap', 'GLXContext', 'GLXVideoDeviceNV', 'GLXWindow', 'GLXPbuffer', 'GLXFBConfigID'] or \
|
||||
t in [ 'int *', 'const int *', 'GLint *', 'const GLint *' ] or \
|
||||
t in [ 'XID', 'XVisualInfo *', 'Pixmap', 'Font', 'Display *', 'GLXDrawble', 'GLXPixmap', 'GLXContext', 'GLXVideoDeviceNV', 'GLXWindow', 'GLXPbuffer', 'GLXFBConfigID'] or \
|
||||
t in [ 'EGLNativeWindowType', 'EGLNativePixmapType', 'EGLNativeDisplayType', 'EGLConfig', 'EGLContext', 'EGLDisplay', 'EGLSurface', 'EGLClientBuffer', 'EGLSyncKHR', 'EGLImageKHR', 'EGLStreamKHR', 'EGLSyncNV']:
|
||||
return 'boost::print::optional(%s,Logging::pointers)'%n
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ REGAL_GLOBAL_BEGIN
|
|||
#include "RegalToken.h"
|
||||
|
||||
#include <boost/print/string_list.hpp>
|
||||
#include <boost/print/print_string.hpp>
|
||||
|
||||
using namespace ::boost::print;
|
||||
|
||||
REGAL_GLOBAL_END
|
||||
|
||||
|
|
@ -41,7 +44,7 @@ namespace Token {
|
|||
{
|
||||
const GLbitfield other = v & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
boost::print::string_list<std::string> tmp;
|
||||
string_list<std::string> tmp;
|
||||
if (v & GL_COLOR_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_COLOR_BUFFER_BIT"; }
|
||||
if (v & GL_DEPTH_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_DEPTH_BUFFER_BIT"; }
|
||||
if (v & GL_STENCIL_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_STENCIL_BUFFER_BIT"; }
|
||||
|
|
@ -50,6 +53,142 @@ namespace Token {
|
|||
return tmp.str();
|
||||
}
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLfloat param)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
return GLenumToString(static_cast<GLenum>(param));
|
||||
|
||||
default:
|
||||
return print_string(param);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLint param)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
return GLenumToString(static_cast<GLenum>(param));
|
||||
|
||||
default:
|
||||
return print_string(param);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLfloat *params)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
return GLenumToString(static_cast<GLenum>(params[0]));
|
||||
|
||||
case GL_TEXTURE_SWIZZLE_RGBA:
|
||||
return print_string(
|
||||
GLenumToString(static_cast<GLenum>(params[0])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[1])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[2])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[3])));
|
||||
|
||||
default:
|
||||
return print_string(params[0]);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLint *params)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
return GLenumToString(static_cast<GLenum>(params[0]));
|
||||
|
||||
case GL_TEXTURE_SWIZZLE_RGBA:
|
||||
return print_string(
|
||||
GLenumToString(static_cast<GLenum>(params[0])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[1])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[2])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[3])));
|
||||
|
||||
default:
|
||||
return print_string(params[0]);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLuint *params)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
return GLenumToString(static_cast<GLenum>(params[0]));
|
||||
|
||||
case GL_TEXTURE_SWIZZLE_RGBA:
|
||||
return print_string(
|
||||
GLenumToString(static_cast<GLenum>(params[0])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[1])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[2])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[3])));
|
||||
|
||||
default:
|
||||
return print_string(params[0]);
|
||||
}
|
||||
}
|
||||
|
||||
${CODE}
|
||||
|
||||
}
|
||||
|
|
@ -307,6 +446,12 @@ namespace Token {
|
|||
|
||||
std::string GLclearToString (GLbitfield v);
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLfloat param );
|
||||
std::string GLTexParameterToString(GLenum pname, const GLint param );
|
||||
std::string GLTexParameterToString(GLenum pname, const GLfloat *params);
|
||||
std::string GLTexParameterToString(GLenum pname, const GLint *params);
|
||||
std::string GLTexParameterToString(GLenum pname, const GLuint *params);
|
||||
|
||||
#if REGAL_SYS_GLX
|
||||
const char * GLXenumToString (int v);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -46,24 +46,26 @@ public:
|
|||
string_list();
|
||||
string_list(const string_list &other);
|
||||
string_list(const T &input, const char_type delim = ' ');
|
||||
string_list(const size_t count, const char_type * const *string, const int *length = NULL);
|
||||
string_list(const size_t count, const char_type * const *string, const int *length = NULL, const typename string_list<T>::char_type delim = 0);
|
||||
~string_list();
|
||||
|
||||
string_list &operator=(const string_list &other);
|
||||
|
||||
void clear();
|
||||
|
||||
void push_front (const char *string);
|
||||
void push_front (const T &string);
|
||||
void push_front_swap( T &string);
|
||||
void push_front (const string_list &other );
|
||||
void push_front (const typename string_list<T>::char_type *string);
|
||||
void push_front (const typename string_list<T>::char_type *string, const size_t n);
|
||||
void push_front (const T &string);
|
||||
void push_front_swap( T &string);
|
||||
void push_front (const string_list &other );
|
||||
|
||||
void push_back (const char *string);
|
||||
void push_back (const T &string);
|
||||
void push_back_swap ( T &string);
|
||||
void push_back (const string_list &other );
|
||||
void push_back (const typename string_list<T>::char_type *string);
|
||||
void push_back (const typename string_list<T>::char_type *string, const size_t n);
|
||||
void push_back (const T &string);
|
||||
void push_back_swap ( T &string);
|
||||
void push_back (const string_list &other );
|
||||
|
||||
void push_back(const size_t count, const char_type * const *string, const int *length = NULL);
|
||||
void push_back(const size_t count, const char_type * const *string, const int *length = NULL, const typename string_list<T>::char_type delim = 0);
|
||||
|
||||
void insert(const size_type i, const value_type &x);
|
||||
void insert(const size_type i, const string_list &other);
|
||||
|
|
@ -88,7 +90,10 @@ public:
|
|||
}
|
||||
|
||||
void sort();
|
||||
void split(const T &input, const char_type delim = ' ');
|
||||
|
||||
void split(const T &input, const char_type delim = ' ');
|
||||
void split(const typename string_list<T>::char_type *input, const char_type delim = ' ');
|
||||
void split(const typename string_list<T>::char_type *input, const size_t n, const char_type delim = ' ');
|
||||
|
||||
T join(const char_type *delim = NULL) const;
|
||||
T join(const T &delim ) const;
|
||||
|
|
@ -115,7 +120,6 @@ public:
|
|||
{
|
||||
if (T::length())
|
||||
{
|
||||
_list._count += T::length();
|
||||
_list._list.push_front(T());
|
||||
_list._list.front().swap(*this);
|
||||
}
|
||||
|
|
@ -138,7 +142,6 @@ public:
|
|||
{
|
||||
if (T::length())
|
||||
{
|
||||
_list._count += T::length();
|
||||
_list._list.push_back(T());
|
||||
_list._list.back().swap(*this);
|
||||
}
|
||||
|
|
@ -153,11 +156,11 @@ public:
|
|||
|
||||
static const char_type endl = '\n';
|
||||
|
||||
friend struct string_list<T>::PushFront;
|
||||
friend struct string_list<T>::PushBack;
|
||||
|
||||
private:
|
||||
::std::deque<T> _list;
|
||||
::std::size_t _count;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
|
@ -206,42 +209,51 @@ join(const C &container, const T &delim)
|
|||
|
||||
}
|
||||
|
||||
template<typename T> string_list<T>::string_list() : _count(0) { }
|
||||
template<typename T> string_list<T>::string_list(const string_list<T> &other) : _list(other._list), _count(other._count) { }
|
||||
template<typename T> string_list<T>::string_list() { }
|
||||
template<typename T> string_list<T>::string_list(const string_list<T> &other) : _list(other._list) { }
|
||||
|
||||
template<typename T> string_list<T>::string_list(const T &input, const char_type delim)
|
||||
: _count(0)
|
||||
{
|
||||
split(input,delim);
|
||||
}
|
||||
|
||||
template<typename T> string_list<T>::string_list(const size_t count, const char_type * const *string, const int *length)
|
||||
: _count(0)
|
||||
template<typename T> string_list<T>::string_list(const size_t count, const char_type * const *string, const int *length, const typename string_list<T>::char_type delim)
|
||||
{
|
||||
push_back(count,string,length);
|
||||
push_back(count,string,length,delim);
|
||||
}
|
||||
|
||||
template<typename T> string_list<T>::~string_list() { _list.clear(); _count = 0; }
|
||||
template<typename T> string_list<T>::~string_list() { _list.clear(); }
|
||||
|
||||
template<typename T> string_list<T> &
|
||||
string_list<T>::operator=(const string_list<T> &other)
|
||||
{
|
||||
if (this!=&other)
|
||||
{
|
||||
_list = other._list;
|
||||
_count = other._count;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T> void string_list<T>::clear() { _list.clear(); _count = 0; }
|
||||
template<typename T> void string_list<T>::clear() { _list.clear(); }
|
||||
|
||||
template<typename T> void string_list<T>::push_front(const typename string_list<T>::char_type *string)
|
||||
template<typename T> void
|
||||
string_list<T>::push_front(const typename string_list<T>::char_type *string)
|
||||
{
|
||||
PushFront(*this).assign(string ? string : T(NULL));
|
||||
}
|
||||
|
||||
template<typename T> void
|
||||
string_list<T>::push_front(const typename string_list<T>::char_type *string, const size_t n)
|
||||
{
|
||||
if (string && n)
|
||||
{
|
||||
PushFront(*this).assign(string,n);
|
||||
}
|
||||
else
|
||||
{
|
||||
PushBack(*this);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> void string_list<T>::push_front(const T &string)
|
||||
{
|
||||
PushFront(*this).assign(string);
|
||||
|
|
@ -260,11 +272,25 @@ template<typename T> void string_list<T>::push_front(const string_list &other)
|
|||
}
|
||||
}
|
||||
|
||||
template<typename T> void string_list<T>::push_back(const typename string_list<T>::char_type *string)
|
||||
template<typename T> void
|
||||
string_list<T>::push_back(const typename string_list<T>::char_type *string)
|
||||
{
|
||||
PushBack(*this).assign(string ? string : T(NULL));
|
||||
}
|
||||
|
||||
template<typename T> void
|
||||
string_list<T>::push_back(const typename string_list<T>::char_type *string, const size_t n)
|
||||
{
|
||||
if (string && n)
|
||||
{
|
||||
PushBack(*this).assign(string,n);
|
||||
}
|
||||
else
|
||||
{
|
||||
PushBack(*this);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> void string_list<T>::push_back(const T &string)
|
||||
{
|
||||
PushBack(*this).assign(string);
|
||||
|
|
@ -283,24 +309,34 @@ template<typename T> void string_list<T>::push_back(const string_list &other)
|
|||
}
|
||||
}
|
||||
|
||||
template<typename T> void string_list<T>::push_back(const size_t count, const char_type * const *string, const int *length)
|
||||
template<typename T> void string_list<T>::push_back(const size_t count, const char_type * const *string, const int *length, const typename string_list<T>::char_type delim)
|
||||
{
|
||||
for (size_t i=0; i<count; ++i)
|
||||
if (length && length[i]>=0)
|
||||
{
|
||||
PushBack(*this).assign(string[i] ? T(string[i],length[i]) : T());
|
||||
}
|
||||
else
|
||||
{
|
||||
PushBack(*this).assign(string[i] ? T(string[i]) : T());
|
||||
}
|
||||
if (delim)
|
||||
{
|
||||
for (size_t i=0; i<count; ++i)
|
||||
if (length && length[i]>=0)
|
||||
split(string[i],length[i], delim);
|
||||
else
|
||||
split(string[i], delim);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i=0; i<count; ++i)
|
||||
if (length && length[i]>=0)
|
||||
{
|
||||
PushBack(*this).assign(string[i] ? T(string[i],length[i]) : T());
|
||||
}
|
||||
else
|
||||
{
|
||||
PushBack(*this).assign(string[i] ? T(string[i]) : T());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> void string_list<T>::insert(const size_type i, const value_type &x)
|
||||
{
|
||||
if (i>=0 && i<=_list.size())
|
||||
{
|
||||
_count += x.length();
|
||||
_list.push_back(x); // Append to the end
|
||||
|
||||
const size_type m = _list.size()-i-1;
|
||||
|
|
@ -319,8 +355,6 @@ template<typename T> void string_list<T>::insert(const size_type i, const string
|
|||
|
||||
if (this!=&other && i>=0 && i<=_list.size() && n>0)
|
||||
{
|
||||
_count += other.count();
|
||||
|
||||
const size_type m = _list.size()-i;
|
||||
for (size_type k=0; k<n; ++k)
|
||||
_list.push_back(T()); // Append to the end
|
||||
|
|
@ -343,8 +377,6 @@ template<typename T> void string_list<T>::insert(const size_type i, const size_t
|
|||
{
|
||||
if (i>=0 && i<=_list.size() && n>0)
|
||||
{
|
||||
_count += x.length()*n;
|
||||
|
||||
const size_type m = _list.size()-i;
|
||||
for (size_type k=0; k<n; ++k)
|
||||
_list.push_back(x); // Append to the end
|
||||
|
|
@ -388,7 +420,8 @@ template<typename T> void string_list<T>::sort()
|
|||
i->swap(*j);
|
||||
}
|
||||
|
||||
template<typename T> void string_list<T>::split(const T &input, const typename string_list<T>::char_type delim)
|
||||
template<typename T> void
|
||||
string_list<T>::split(const T &input, const typename string_list<T>::char_type delim)
|
||||
{
|
||||
// Skip past any delims at the beginning of the string
|
||||
typename T::size_type start = input.find_first_not_of( delim, 0 );
|
||||
|
|
@ -402,8 +435,8 @@ template<typename T> void string_list<T>::split(const T &input, const typename s
|
|||
{
|
||||
end = input.find(delim, start);
|
||||
|
||||
_list.push_back(input.substr(start,end - start));
|
||||
_count += (end - start);
|
||||
std::string tmp = input.substr(start,end - start);
|
||||
PushBack(*this).swap(tmp);
|
||||
|
||||
// Last token if there were no trailing delims
|
||||
if (end==T::npos)
|
||||
|
|
@ -418,6 +451,78 @@ template<typename T> void string_list<T>::split(const T &input, const typename s
|
|||
}
|
||||
}
|
||||
|
||||
template<typename T> void
|
||||
string_list<T>::split(const typename string_list<T>::char_type *input, const char_type delim)
|
||||
{
|
||||
// input was a null string
|
||||
if (!input || !(*input))
|
||||
return;
|
||||
|
||||
// Skip past any delims at the beginning of the string
|
||||
|
||||
const typename string_list<T>::char_type *i = input;
|
||||
while (*i && (*i)==delim)
|
||||
++i;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
const typename string_list<T>::char_type *j = i;
|
||||
while (*j && (*j)!=delim)
|
||||
++j;
|
||||
|
||||
PushBack(*this).assign(i,j-i);
|
||||
|
||||
// Last token if there were no trailing delims
|
||||
if (!(*j))
|
||||
break;
|
||||
|
||||
// Skip past any extra delims
|
||||
i = j+1;
|
||||
while (*i && (*i)==delim)
|
||||
++i;
|
||||
|
||||
// We had trailing delims and we're now at the end of the string
|
||||
if (!(*i))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> void
|
||||
string_list<T>::split(const typename string_list<T>::char_type *input, const size_t n, const char_type delim)
|
||||
{
|
||||
// input was a null string
|
||||
if (!input || !(*input) || !n)
|
||||
return;
|
||||
|
||||
// Skip past any delims at the beginning of the string
|
||||
|
||||
size_t i = 0;
|
||||
while (i<n && input[i]==delim)
|
||||
++i;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
size_t j = i;
|
||||
while (j<n && input[j]!=delim)
|
||||
++j;
|
||||
|
||||
PushBack(*this).assign(i,j-i);
|
||||
|
||||
// Last token if there were no trailing delims
|
||||
if (j==n)
|
||||
break;
|
||||
|
||||
// Skip past any extra delims
|
||||
i = j+1;
|
||||
while (i<n && input[i]==delim)
|
||||
++i;
|
||||
|
||||
// We had trailing delims and we're now at the end of the string
|
||||
if (i==n)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> T string_list<T>::join(const typename string_list<T>::char_type *delim) const
|
||||
{
|
||||
return boost::print::detail::join(_list,delim ? T(delim) : T());
|
||||
|
|
@ -434,7 +539,15 @@ template<typename T> T string_list<T>::str() const
|
|||
}
|
||||
|
||||
template<typename T> typename string_list<T>::size_type string_list<T>::size() const { return _list.size(); }
|
||||
template<typename T> typename string_list<T>::size_type string_list<T>::count() const { return _count; }
|
||||
|
||||
template<typename T> typename string_list<T>::size_type
|
||||
string_list<T>::count() const
|
||||
{
|
||||
typename string_list<T>::size_type tmp = 0;
|
||||
for (typename ::std::deque<T>::const_iterator i=_list.begin(); i!=_list.end(); ++i)
|
||||
tmp += i->length();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template<typename T> typename string_list<T>::const_iterator string_list<T>::begin() const { return _list.begin(); }
|
||||
template<typename T> typename string_list<T>::const_iterator string_list<T>::end() const { return _list.end(); }
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -80,9 +80,10 @@ bool frameSaveColor = false;
|
|||
bool frameSaveStencil = false;
|
||||
bool frameSaveDepth = false;
|
||||
|
||||
bool cache = REGAL_CACHE;
|
||||
bool cacheShader = false;
|
||||
bool cacheShaderRead = false;
|
||||
bool cache = REGAL_CACHE;
|
||||
bool cacheShader = false;
|
||||
bool cacheShaderRead = false;
|
||||
bool cacheShaderWrite = false;
|
||||
std::string cacheDirectory("./");
|
||||
|
||||
void Init()
|
||||
|
|
@ -234,6 +235,11 @@ void Init()
|
|||
if (tmp) cacheShader = atoi(tmp)!=0;
|
||||
#endif
|
||||
|
||||
#if REGAL_CACHE_SHADER_WRITE
|
||||
tmp = GetEnv( "REGAL_CACHE_SHADER_WRITE" );
|
||||
if (tmp) cacheShaderWrite = atoi(tmp)!=0;
|
||||
#endif
|
||||
|
||||
#if REGAL_CACHE_SHADER_READ
|
||||
tmp = GetEnv( "REGAL_CACHE_SHADER_READ" );
|
||||
if (tmp) cacheShaderRead = atoi(tmp)!=0;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ namespace Config
|
|||
extern bool cache;
|
||||
extern bool cacheShader;
|
||||
extern bool cacheShaderRead;
|
||||
extern bool cacheShaderWrite;
|
||||
extern std::string cacheDirectory;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ void Frame::capture(RegalContext &context)
|
|||
if (Logging::frameTime)
|
||||
{
|
||||
Timer::Value elapsed = frameTimer.restart();
|
||||
UNUSED_PARAMETER(elapsed); // Unused if info logging disabled at compile-time
|
||||
Info("Frame ",frame,' ',elapsed/1000," msec, ",1000000.0/elapsed," FPS.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,13 +129,12 @@ Init::getContext(RegalSystemContext sysCtx)
|
|||
SC2RC::iterator i = sc2rc.find(sysCtx);
|
||||
if (i!=sc2rc.end())
|
||||
{
|
||||
Internal("Init::context lookup for ",sysCtx);
|
||||
Internal("Init::context", "lookup for sysCtx=",sysCtx);
|
||||
return i->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
Internal("Init::context factory for ",sysCtx);
|
||||
|
||||
Internal("Init::context", "factory for sysCtx=",sysCtx);
|
||||
RegalContext *context = new RegalContext();
|
||||
RegalAssert(context);
|
||||
sc2rc[sysCtx] = context;
|
||||
|
|
@ -149,43 +148,44 @@ Init::setContext(RegalContext *context)
|
|||
{
|
||||
Thread::Thread thread = Thread::Self();
|
||||
|
||||
Internal("Init::setContext ",thread," to ",context," ",context ? context->info->version : "");
|
||||
Internal("Init::setContext","thread=",::boost::print::hex(Thread::threadId())," context=",context," ",context ? context->info->version : "");
|
||||
|
||||
// First do the lookup
|
||||
// std::map lookup
|
||||
|
||||
TH2RC::iterator i = th2rc.find(thread);
|
||||
|
||||
// Associate this thread with the Regal context
|
||||
|
||||
if (i!=th2rc.end())
|
||||
{
|
||||
// Early out if this context and thread are
|
||||
// already associated.
|
||||
|
||||
if (i->second==context)
|
||||
{
|
||||
RegalAssert(!context || context->thread==thread);
|
||||
return;
|
||||
}
|
||||
|
||||
// If some other context is associated
|
||||
// with this thread, disassociate it.
|
||||
|
||||
if (i->second)
|
||||
if (i->second!=context)
|
||||
{
|
||||
RegalAssert(i->second->thread==thread);
|
||||
i->second->thread = 0;
|
||||
if (i->second)
|
||||
{
|
||||
RegalAssert(i->second->thread==thread);
|
||||
i->second->thread = 0;
|
||||
}
|
||||
|
||||
i->second = context;
|
||||
}
|
||||
|
||||
i->second = context;
|
||||
if (context)
|
||||
context->thread = thread;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Associate this thread with the Regal context
|
||||
th2rc[thread] = context;
|
||||
}
|
||||
|
||||
if (context)
|
||||
{
|
||||
// If some other thread is associated
|
||||
// with this context, disassociate it.
|
||||
|
||||
th2rc.erase(context->thread);
|
||||
|
||||
// Associate the context with this thread.
|
||||
|
||||
context->thread = thread;
|
||||
}
|
||||
|
||||
setContextTLS(context);
|
||||
}
|
||||
|
|
@ -244,7 +244,7 @@ TlsInit tlsInit;
|
|||
void
|
||||
Init::setContextTLS(RegalContext *context)
|
||||
{
|
||||
Internal("Init::setContextTLS ",context);
|
||||
Internal("Init::setContextTLS","thread=",::boost::print::hex(Thread::threadId())," context=",context);
|
||||
|
||||
// Without thread local storage, simply set the
|
||||
// current Regal context
|
||||
|
|
@ -342,6 +342,8 @@ Init::makeCurrent(RegalSystemContext sysCtx)
|
|||
{
|
||||
init();
|
||||
|
||||
Internal("Init::makeCurrent","thread=",::boost::print::hex(Thread::threadId())," sysCtx=",sysCtx);
|
||||
|
||||
if (sysCtx)
|
||||
{
|
||||
RegalContext *context = getContext(sysCtx);
|
||||
|
|
@ -370,8 +372,6 @@ Init::makeCurrent(RegalSystemContext sysCtx)
|
|||
}
|
||||
|
||||
setContext(context);
|
||||
|
||||
Internal("Init::makeCurrent ",context," ",context->info->version);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ namespace Logging {
|
|||
int maxBytes = (REGAL_LOG_MAX_BYTES);
|
||||
bool frameTime = false;
|
||||
bool pointers = (REGAL_LOG_POINTERS);
|
||||
bool thread = false;
|
||||
bool callback = (REGAL_LOG_CALLBACK);
|
||||
|
||||
bool log = (REGAL_LOG);
|
||||
|
|
@ -161,6 +162,11 @@ namespace Logging {
|
|||
if (p) pointers = atoi(p)!=0;
|
||||
#endif
|
||||
|
||||
#if REGAL_LOG_THREAD
|
||||
const char *t = GetEnv("REGAL_LOG_THREAD");
|
||||
if (t) thread = atoi(t)!=0;
|
||||
#endif
|
||||
|
||||
const char *cb = GetEnv("REGAL_LOG_CALLBACK");
|
||||
if (cb) callback = atoi(cb)!=0;
|
||||
|
||||
|
|
@ -256,6 +262,10 @@ namespace Logging {
|
|||
#if REGAL_LOG_POINTERS
|
||||
Info("REGAL_LOG_POINTERS ", pointers ? "enabled" : "disabled");
|
||||
#endif
|
||||
|
||||
#if REGAL_LOG_THREAD
|
||||
Info("REGAL_LOG_THREAD ", thread ? "enabled" : "disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
void Cleanup()
|
||||
|
|
@ -299,8 +309,12 @@ namespace Logging {
|
|||
inline string message(const char *prefix, const char *delim, const char *name, const string &str)
|
||||
{
|
||||
static const char *trimSuffix = " ...";
|
||||
std::string trimPrefix = print_string(prefix ? prefix : "", delim ? delim : "", string(indent(),' '), name ? name : "", ' ');
|
||||
return print_string(trim(str.c_str(),'\n',maxLines>0 ? maxLines : ~0,trimPrefix.c_str(),trimSuffix), '\n');
|
||||
string_list trimPrefix;
|
||||
trimPrefix << print_string(prefix ? prefix : "",delim ? delim : "");
|
||||
if (thread)
|
||||
trimPrefix << print_string(hex(Thread::threadId()),delim ? delim : "");
|
||||
trimPrefix << print_string(string(indent(),' '),name ? name : "",name ? " " : "");
|
||||
return print_string(trim(str.c_str(),'\n',maxLines>0 ? maxLines : ~0,trimPrefix.str().c_str(),trimSuffix), '\n');
|
||||
}
|
||||
|
||||
inline string jsonObject(const char *prefix, const char *name, const string &str)
|
||||
|
|
@ -416,7 +430,10 @@ namespace Logging {
|
|||
string m = message(prefix,delim,name,str);
|
||||
|
||||
// TODO - optional Regal source line numbers.
|
||||
#if 0
|
||||
#if 1
|
||||
UNUSED_PARAMETER(file);
|
||||
UNUSED_PARAMETER(line);
|
||||
#else
|
||||
m = print_string(file,":",line," ",m);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -108,6 +108,10 @@ REGAL_NAMESPACE_BEGIN
|
|||
# define REGAL_LOG_POINTERS 1
|
||||
#endif
|
||||
|
||||
#ifndef REGAL_LOG_THREAD
|
||||
# define REGAL_LOG_THREAD 1
|
||||
#endif
|
||||
|
||||
#ifndef REGAL_LOG_ONCE
|
||||
# define REGAL_LOG_ONCE 1
|
||||
#endif
|
||||
|
|
@ -177,6 +181,7 @@ namespace Logging
|
|||
extern bool frameTime; // Per-frame elapsed time to info log
|
||||
|
||||
extern bool pointers; // Enabled by default, otherwise empty
|
||||
extern bool thread; // Disabled by default
|
||||
|
||||
#if REGAL_LOG_ONCE
|
||||
extern bool once; // Warning and error message logged once only
|
||||
|
|
@ -209,9 +214,9 @@ namespace Logging
|
|||
// Internal housekeeping
|
||||
|
||||
extern bool initialized;
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
template<typename T>
|
||||
T rawLimit(const T size) { return maxBytes<0 ? size : ( size < maxBytes ? size : maxBytes ); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@ shaderSource(PFNGLSHADERSOURCEPROC proc, GLuint shader, GLsizei count, const GLc
|
|||
for (GLsizei i=0; i<count; ++i)
|
||||
hash = Lookup3::hashlittle(string[i], length ? length[i] : strlen(string[i]), hash);
|
||||
|
||||
::std::string filename = print_string(Config::cacheDirectory,boost::print::hex(hash),".txt");
|
||||
::std::string filename = makePath(Config::cacheDirectory,print_string(boost::print::hex(hash),".txt"));
|
||||
|
||||
// Cache it to disk, iff it's not there yet
|
||||
|
||||
if (!fileExists(filename.c_str()))
|
||||
if (REGAL_CACHE_SHADER_WRITE && Config::cacheShaderWrite && !fileExists(filename.c_str()))
|
||||
{
|
||||
FILE *f = fopen(filename.c_str(),"wt");
|
||||
if (!f)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
@ -48,6 +48,9 @@ REGAL_GLOBAL_BEGIN
|
|||
#include "RegalToken.h"
|
||||
|
||||
#include <boost/print/string_list.hpp>
|
||||
#include <boost/print/print_string.hpp>
|
||||
|
||||
using namespace ::boost::print;
|
||||
|
||||
REGAL_GLOBAL_END
|
||||
|
||||
|
|
@ -70,7 +73,7 @@ namespace Token {
|
|||
{
|
||||
const GLbitfield other = v & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
boost::print::string_list<std::string> tmp;
|
||||
string_list<std::string> tmp;
|
||||
if (v & GL_COLOR_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_COLOR_BUFFER_BIT"; }
|
||||
if (v & GL_DEPTH_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_DEPTH_BUFFER_BIT"; }
|
||||
if (v & GL_STENCIL_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_STENCIL_BUFFER_BIT"; }
|
||||
|
|
@ -79,6 +82,142 @@ namespace Token {
|
|||
return tmp.str();
|
||||
}
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLfloat param)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
return GLenumToString(static_cast<GLenum>(param));
|
||||
|
||||
default:
|
||||
return print_string(param);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLint param)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
return GLenumToString(static_cast<GLenum>(param));
|
||||
|
||||
default:
|
||||
return print_string(param);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLfloat *params)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
return GLenumToString(static_cast<GLenum>(params[0]));
|
||||
|
||||
case GL_TEXTURE_SWIZZLE_RGBA:
|
||||
return print_string(
|
||||
GLenumToString(static_cast<GLenum>(params[0])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[1])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[2])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[3])));
|
||||
|
||||
default:
|
||||
return print_string(params[0]);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLint *params)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
return GLenumToString(static_cast<GLenum>(params[0]));
|
||||
|
||||
case GL_TEXTURE_SWIZZLE_RGBA:
|
||||
return print_string(
|
||||
GLenumToString(static_cast<GLenum>(params[0])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[1])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[2])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[3])));
|
||||
|
||||
default:
|
||||
return print_string(params[0]);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLuint *params)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
return GLenumToString(static_cast<GLenum>(params[0]));
|
||||
|
||||
case GL_TEXTURE_SWIZZLE_RGBA:
|
||||
return print_string(
|
||||
GLenumToString(static_cast<GLenum>(params[0])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[1])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[2])), " ",
|
||||
GLenumToString(static_cast<GLenum>(params[3])));
|
||||
|
||||
default:
|
||||
return print_string(params[0]);
|
||||
}
|
||||
}
|
||||
|
||||
const char * GLenumToString( GLenum e ) {
|
||||
switch( e ) {
|
||||
case 0x00000000: return "GL_ZERO";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* NOTE: Do not edit this file, it is generated by a script:
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
|
||||
Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir .
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
@ -62,6 +62,12 @@ namespace Token {
|
|||
|
||||
std::string GLclearToString (GLbitfield v);
|
||||
|
||||
std::string GLTexParameterToString(GLenum pname, const GLfloat param );
|
||||
std::string GLTexParameterToString(GLenum pname, const GLint param );
|
||||
std::string GLTexParameterToString(GLenum pname, const GLfloat *params);
|
||||
std::string GLTexParameterToString(GLenum pname, const GLint *params);
|
||||
std::string GLTexParameterToString(GLenum pname, const GLuint *params);
|
||||
|
||||
#if REGAL_SYS_GLX
|
||||
const char * GLXenumToString (int v);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ const char *libraryLocation(const Library &library)
|
|||
|
||||
if (!ret)
|
||||
{
|
||||
#if REGAL_SYS_GLX
|
||||
#if REGAL_SYS_EGL || REGAL_SYS_GLX
|
||||
#if defined(__arm__)
|
||||
return "/usr/lib/libGLESv2.so";
|
||||
#elif defined(__x86_64__) || defined(__x86_64)
|
||||
|
|
@ -624,6 +624,17 @@ void fileClose(FILE **file)
|
|||
*file = NULL;
|
||||
}
|
||||
|
||||
string makePath(const string &dir, const string &filename)
|
||||
{
|
||||
string tmp(dir);
|
||||
const size_t len = tmp.length();
|
||||
const char last = len ? tmp[len-1] : '\0';
|
||||
if (len && last!='/' && last!='\\')
|
||||
tmp += "/";
|
||||
tmp += filename;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
REGAL_NAMESPACE_END
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -215,10 +215,16 @@
|
|||
#define REGAL_CACHE_SHADER REGAL_CACHE
|
||||
#endif
|
||||
|
||||
// Shader cache readback support by default
|
||||
// Cache writing supported by default
|
||||
|
||||
#ifndef REGAL_CACHE_SHADER_WRITE
|
||||
#define REGAL_CACHE_SHADER_WRITE REGAL_CACHE_SHADER
|
||||
#endif
|
||||
|
||||
// Cache reading supported by default
|
||||
|
||||
#ifndef REGAL_CACHE_SHADER_READ
|
||||
#define REGAL_CACHE_SHADER_READ REGAL_CACHE
|
||||
#define REGAL_CACHE_SHADER_READ REGAL_CACHE_SHADER
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
@ -348,6 +354,10 @@ extern bool fileExists(const char *filename);
|
|||
extern FILE *fileOpen (const char *filename, const char *mode);
|
||||
extern void fileClose (FILE **file);
|
||||
|
||||
//
|
||||
|
||||
std::string makePath(const std::string &dir, const std::string &filename);
|
||||
|
||||
// ToFloat for integer -> float
|
||||
|
||||
template <typename T> inline float ToFloat(const bool normalize, const T v ) {
|
||||
|
|
|
|||
131
tests/testStringList.cpp
Normal file
131
tests/testStringList.cpp
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
Copyright (c) 2011-2012 NVIDIA Corporation
|
||||
Copyright (c) 2011-2012 Cass Everitt
|
||||
Copyright (c) 2012 Scott Nations
|
||||
Copyright (c) 2012 Mathias Schott
|
||||
Copyright (c) 2012 Nigel Stewart
|
||||
Copyright (c) 2012 Google Inc
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "boost/print/string_list.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
typedef ::std::string string;
|
||||
typedef ::boost::print::string_list< ::std::string > string_list;
|
||||
|
||||
// ====================================
|
||||
// boost::print::string_list
|
||||
// ====================================
|
||||
|
||||
TEST( StringList, Constructor )
|
||||
{
|
||||
{
|
||||
string_list x;
|
||||
EXPECT_EQ(0u, x.size());
|
||||
EXPECT_EQ(0u, x.count());
|
||||
}
|
||||
|
||||
// space delimiter
|
||||
|
||||
{
|
||||
string_list x(string("a b c d e f"),' ');
|
||||
EXPECT_EQ(6u, x.size());
|
||||
EXPECT_EQ(6u, x.count());
|
||||
|
||||
string_list y(x);
|
||||
EXPECT_EQ(x.size(), y.size());
|
||||
EXPECT_EQ(x.count(), y.count());
|
||||
// EXPECT_EQ(x, y);
|
||||
}
|
||||
|
||||
// . delimiter
|
||||
|
||||
{
|
||||
string_list x(string("a.b.c.d.e.f"),'.');
|
||||
EXPECT_EQ(6u, x.size());
|
||||
EXPECT_EQ(6u, x.count());
|
||||
}
|
||||
|
||||
// TODO - There ought to be a c-string constructor with delimiter, too
|
||||
|
||||
{
|
||||
const char *s[5] = { "a", "b", "c", "d", "e" };
|
||||
const int l[5] = { 1, 1, 1, -1, -1 };
|
||||
string_list x(5,s,l);
|
||||
EXPECT_EQ(5u, x.size());
|
||||
EXPECT_EQ(5u, x.count());
|
||||
|
||||
EXPECT_EQ(string("abcde"), x.str());
|
||||
EXPECT_EQ(string("a b c d e"), x.join(" "));
|
||||
}
|
||||
|
||||
{
|
||||
const char *s[5] = { "A", "B", "C", "D", "E" };
|
||||
string_list x(5,s);
|
||||
EXPECT_EQ(5u, x.size());
|
||||
EXPECT_EQ(5u, x.count());
|
||||
|
||||
EXPECT_EQ(string("ABCDE"), x.str());
|
||||
EXPECT_EQ(string("A B C D E"), x.join(" "));
|
||||
}
|
||||
|
||||
{
|
||||
const char *s[5] = { "A\nB\n", "C", "D\nE\n" };
|
||||
string_list x(3,s,NULL,'\n');
|
||||
EXPECT_EQ(5u, x.size());
|
||||
EXPECT_EQ(5u, x.count());
|
||||
|
||||
EXPECT_EQ(string("ABCDE"), x.str());
|
||||
EXPECT_EQ(string("A B C D E"), x.join(" "));
|
||||
}
|
||||
}
|
||||
|
||||
TEST( StringList, Insert )
|
||||
{
|
||||
{
|
||||
string_list x(string("a b c d e f"),' ');
|
||||
EXPECT_EQ(string("a b c d e f"), x.join(" "));
|
||||
|
||||
x.insert(0,"0"); EXPECT_EQ(string("0 a b c d e f"), x.join(" "));
|
||||
x.insert(1,"1"); EXPECT_EQ(string("0 1 a b c d e f"), x.join(" "));
|
||||
x.insert(7,"7"); EXPECT_EQ(string("0 1 a b c d e 7 f"), x.join(" "));
|
||||
x.insert(9,"9"); EXPECT_EQ(string("0 1 a b c d e 7 f 9"), x.join(" "));
|
||||
x.insert(0,3,"x"); EXPECT_EQ(string("x x x 0 1 a b c d e 7 f 9"), x.join(" "));
|
||||
x.insert(2,3,"y"); EXPECT_EQ(string("x x y y y x 0 1 a b c d e 7 f 9"), x.join(" "));
|
||||
x.insert(6,3,"z"); EXPECT_EQ(string("x x y y y x z z z 0 1 a b c d e 7 f 9"), x.join(" "));
|
||||
x.insert(18,3,"-"); EXPECT_EQ(string("x x y y y x z z z 0 1 a b c d e 7 f - - - 9"), x.join(" "));
|
||||
x.insert(17,3,"+"); EXPECT_EQ(string("x x y y y x z z z 0 1 a b c d e 7 + + + f - - - 9"), x.join(" "));
|
||||
x.insert(16,3,"="); EXPECT_EQ(string("x x y y y x z z z 0 1 a b c d e = = = 7 + + + f - - - 9"), x.join(" "));
|
||||
x.insert(14,2,"<"); EXPECT_EQ(string("x x y y y x z z z 0 1 a b c < < d e = = = 7 + + + f - - - 9"), x.join(" "));
|
||||
x.insert(14,0,">"); EXPECT_EQ(string("x x y y y x z z z 0 1 a b c < < d e = = = 7 + + + f - - - 9"), x.join(" "));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue