Skip to content

Commit

Permalink
Slight cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
stegu committed Mar 25, 2011
1 parent 0d6dedf commit 7591d77
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
2 changes: 2 additions & 0 deletions benchmark/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ default:
@echo "make [ Linux | MacOSX | Win32 | clean | clean-Win32]"

clean:
cd common ; make clean
cd Linux ; make clean
cd MacOSX ; make clean

Expand All @@ -23,4 +24,5 @@ Win32:
cd $@ && $(WINMAKE) && $(WINMAKE)

clean-Win32:
cd common && $(WINMAKE) clean
cd Win32 && $(WINMAKE) clean
17 changes: 7 additions & 10 deletions benchmark/Win32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,28 @@ LINKOBJ = noisebench.o
LIBS = -L$(MINGW32)/lib -mwindows -lglfw -lopengl32 -lglu32 -mconsole -g3
INCS = -I. -I$(MINGW32)/include
CFLAGS = $(INCS) -Wall -O3 -ffast-math -g3
RM = del
CP = copy
CAT = type
EXECNAME = noisebench.exe
OUTPUTFILE = ashimanoise.log

all: $(EXECNAME)

clean:
${RM} $(OBJ) $(EXECNAME) $(SHADERS) $(OUTPUTFILE) $(SRC)
del $(OBJ) $(EXECNAME) $(SHADERS) $(OUTPUTFILE) $(SRC)

GLSL-ashimanoise.vert:
${CP} ..\common\GLSL-ashimanoise.vert .
copy ..\common\GLSL-ashimanoise.vert .

GLSL-ashimanoise2D.frag:
${CP} ..\common\GLSL-ashimanoise2D.frag .
copy ..\common\GLSL-ashimanoise2D.frag .

GLSL-ashimanoise3D.frag:
${CP} ..\common\GLSL-ashimanoise3D.frag .
copy ..\common\GLSL-ashimanoise3D.frag .

GLSL-ashimanoise4D.frag:
${CP} ..\common\GLSL-ashimanoise4D.frag .
copy ..\common\GLSL-ashimanoise4D.frag .

$(SRC):
${CP} ..\common\$(SRC) .
copy ..\common\$(SRC) .

$(OBJ): $(SRC)
$(CC) -c $(SRC) -o $(OBJ) $(CFLAGS)
Expand All @@ -43,4 +40,4 @@ $(EXECNAME): $(OBJ) $(SHADERS)

run: $(EXECNAME)
./$(EXECNAME)
$(CAT) $(OUTPUTFILE)
type $(OUTPUTFILE)
17 changes: 8 additions & 9 deletions src/noise4D.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,17 @@ float simplexNoise(vec4 v)
i0.x = dot( isX, vec3( 1.0 ) );
i0.yzw = 1.0 - isX;

vec2 isY = step( x0.zw, x0.yy );
i0.y += dot( isY, vec2( 1.0 ) );
i0.zw += 1.0 - isY;
vec3 isYZ = step( x0.zww, x0.yyz );
i0.y += dot( isYZ.xy, vec2( 1.0 ) );
i0.zw += 1.0 - isYZ.xy;

float isZ = step( x0.w, x0.z ); // Could be folded into the vec2 step() above
i0.z += isZ;
i0.w += 1.0 - isZ;
i0.z += isYZ.z;
i0.w += 1.0 - isYZ.z;

// i0 now contains the unique values 0,1,2,3 in each channel
vec4 i1 = clamp( i0, 0.0, 1.0 );
vec4 i2 = clamp( --i0, 0.0, 1.0 );
vec4 i3 = clamp( --i0, 0.0, 1.0 );
vec4 i3 = clamp( i0, 0.0, 1.0 );
vec4 i2 = clamp( i0-1.0, 0.0, 1.0 );
vec4 i1 = clamp( i0-2.0, 0.0, 1.0 );
#else
// Force existance of strict total ordering in sort.
vec4 q0 = floor(x0 * 1024.0) + vec4( 0.0, 1.0/4.0, 2.0/4.0 , 3.0/4.0);
Expand Down

0 comments on commit 7591d77

Please sign in to comment.