Initial commit

Added combine script.  Created initial Emscripten example.
This commit is contained in:
Carl Woffenden
2019-09-20 15:00:02 -04:00
parent a6bd48a16c
commit bd8feea6d9
8 changed files with 836 additions and 0 deletions

2
contrib/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# Mac finder
.DS_Store

View File

@@ -0,0 +1,2 @@
# Don't commit the generated lib
basisutranslib.cpp

View File

@@ -0,0 +1,12 @@
/**
* Basis Universal single file library. Generated using:
* \code
* ./combine.sh -r ../../transcoder -o basisutranslib.cpp basisutranslib-in.cpp
* \endcode
* We can add any build options here, e.g.:
* \code
* #define BASISD_SUPPORT_BC7 0
* \endcode
*/
#include "basisu_transcoder.cpp"

View File

@@ -0,0 +1,124 @@
#!/bin/sh -e
# Tool to bundle multiple C/C++ source files, inlining any includes.
#
# Note: this POSIX-compliant script is many times slower than the original bash
# implementation (due to the grep calls) but it runs and works everywhere.
#
# TODO: ROOTS and FOUND as arrays (since they fail on paths with spaces)
#
# Released under a CC0 license.
# Common file roots
ROOTS="./"
# Files previously visited
FOUND=""
# Optional destination file (empty string to write to stdout)
DESTN=""
# Prints the script usage then exits
usage() {
echo "Usage: $0 [-r <path>] [-o <outfile>] infile"
echo " -r file root search paths"
echo " -o output file (otherwise stdout)"
echo "Example: $0 -r ../my/path - r ../other/path -o out.c in.c"
exit 1
}
# Tests that the grep implementation works as expected (older OSX grep fails)
test_grep() {
if ! echo '#include "foo"' | grep -Eq '^\s*#\s*include\s*".+"'; then
echo "Aborting: the grep implementation fails to parse include lines"
exit 1
fi
}
# Tests if list $1 has item $2 (returning zero on a match)
list_has_item() {
if echo "$1" | grep -Eq "(^|\s*)$2(\$|\s*)"; then
return 0
else
return 1
fi
}
# Adds a new line with the supplied arguments to $DESTN (or stdout)
write_line() {
if [ -n "$DESTN" ]; then
printf '%s\n' "$@" >> "$DESTN"
else
printf '%s\n' "$@"
fi
}
# Adds the contents of $1 with any of its includes inlined
add_file() {
# Match the path
local file=
if [ -f "$1" ]; then
file="$1"
else
for root in $ROOTS; do
if test -f "$root/$1"; then
file="$root/$1"
fi
done
fi
if [ -n "$file" ]; then
# Read the file
local line=
while IFS= read -r line; do
if echo "$line" | grep -Eq '^\s*#\s*include\s*".+"'; then
# We have an include directive so strip the (first) file
local inc=$(echo "$line" | grep -Eo '".*"' | grep -Eo '\w*(\.?\w+)+' | head -1)
if ! list_has_item "$FOUND" "$inc"; then
# And we've not previously encountered it
FOUND="$FOUND $inc"
write_line "/**** start inlining $inc ****/"
add_file "$inc"
write_line "/**** ended inlining $inc ****/"
else
write_line "/**** skipping file: $inc ****/"
fi
else
# Otherwise write the source line
write_line "$line"
fi
done < "$file"
else
write_line "#error Unable to find \"$1\""
fi
}
while getopts ":r:o:" opts; do
case $opts in
r)
ROOTS="$OPTARG $ROOTS"
;;
o)
DESTN="$OPTARG"
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -n "$1" ]; then
if [ -f "$1" ]; then
if [ -n "$DESTN" ]; then
printf "" > "$DESTN"
fi
test_grep
add_file $1
else
echo "Input file not found: \"$1\""
exit 1
fi
else
usage
fi
exit 0

View File

@@ -0,0 +1,10 @@
#!/bin/sh
echo "Amalgamating files... this can take a while"
./combine.sh -r "../../transcoder" -o basisutranslib.cpp basisutranslib-in.cpp
# Did combining work?
if [ $? -ne 0 ]; then
echo "Combine script: FAILED"
exit 1
fi
echo "Combine script: PASSED"

View File

@@ -0,0 +1,668 @@
/**
* \file emscripten.c
* Emscripten example of using the single-file \c zstddeclib. Draws a rotating
* textured quad with data from the in-line Zstd compressed DXT1 texture (DXT1
* being hardware compression, further compressed with Zstd).
* \n
* Compile using:
* \code
* export CC_FLAGS="-Wall -Wextra -Werror -Os -g0 -flto --llvm-lto 3 -fno-exceptions -fno-rtti -lGL -DNDEBUG=1"
* export EM_FLAGS="-s ENVIRONMENT=web -s WASM=1 --shell-file shell.html --closure 1"
* emcc $CC_FLAGS $EM_FLAGS -o out.html emscripten.cpp
* \endcode
*/
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <emscripten/emscripten.h>
#include <emscripten/html5.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include "../basisutranslib.cpp"
using namespace basist;
static etc1_global_selector_codebook* globalCodebook = NULL;
//************************* Test Data (DXT texture) **************************/
/**
* Basis Universal compressed 256x256 texture source.
* \n
* See \c testcard.png for the original.
*/
static uint8_t const srcBasis[] = {
0x73, 0x42, 0x13, 0x00, 0x4d, 0x00, 0x66, 0xbb, 0x6c, 0x0d, 0x00, 0x00,
0x1f, 0x4f, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x84, 0x00, 0x64, 0x00, 0x00, 0x00, 0x35, 0x01, 0x00,
0x01, 0x01, 0x99, 0x01, 0x00, 0x00, 0x94, 0x02, 0x00, 0x2d, 0x04, 0x00,
0x00, 0xb8, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x01, 0x40, 0x00, 0x40, 0x00, 0xe5, 0x04, 0x00, 0x00, 0xd4, 0x08,
0x00, 0x00, 0x06, 0xda, 0x20, 0x40, 0x2c, 0x80, 0x41, 0x10, 0x04, 0xa0,
0xe0, 0x3d, 0xd2, 0x45, 0x5b, 0x53, 0x26, 0x35, 0xe1, 0x43, 0x0e, 0x04,
0x78, 0x04, 0x30, 0x0c, 0x82, 0x30, 0xf0, 0x4a, 0xa1, 0x08, 0xb5, 0x91,
0x2c, 0xd3, 0x3d, 0x86, 0x3d, 0x10, 0xe0, 0x01, 0x00, 0x31, 0x08, 0x82,
0xc0, 0x67, 0xe6, 0x46, 0xe7, 0x6e, 0xab, 0x4e, 0x0a, 0x11, 0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, 0x8c, 0x2a, 0xe0,
0x24, 0x20, 0x02, 0x11, 0x41, 0x45, 0xa4, 0x8a, 0x2a, 0x15, 0x50, 0x35,
0x68, 0x34, 0x68, 0x9a, 0xa6, 0x81, 0x06, 0x9a, 0x10, 0xea, 0x95, 0x94,
0x52, 0x9a, 0x4f, 0xca, 0x97, 0x1a, 0x73, 0x6e, 0x14, 0xca, 0x33, 0x85,
0x3b, 0x18, 0x15, 0x0a, 0x29, 0x06, 0x42, 0x8c, 0x89, 0x00, 0x01, 0x31,
0x22, 0x40, 0x20, 0xc5, 0x18, 0x08, 0x31, 0x51, 0xba, 0xa2, 0x74, 0xa5,
0x74, 0x78, 0x81, 0x3b, 0x14, 0xb5, 0x40, 0xa8, 0xfc, 0x14, 0x83, 0x9f,
0x11, 0x14, 0x18, 0x33, 0x9e, 0x12, 0xc6, 0x3c, 0x0b, 0x4a, 0xbe, 0x50,
0xba, 0x4c, 0x29, 0xb9, 0xcd, 0xb9, 0xcd, 0xa5, 0x90, 0xbb, 0x32, 0x2f,
0x85, 0x9e, 0x0c, 0x85, 0x5e, 0xe9, 0x91, 0xe9, 0x9d, 0xe8, 0xca, 0x75,
0x60, 0xa6, 0x08, 0x63, 0x4c, 0xc7, 0x8c, 0x03, 0xe1, 0x19, 0xb3, 0x49,
0x41, 0x37, 0x55, 0x4c, 0x64, 0xd4, 0x18, 0x22, 0x08, 0x3b, 0x84, 0xb3,
0x81, 0x18, 0xec, 0x70, 0x1e, 0x5b, 0x2b, 0x2c, 0xad, 0x13, 0x04, 0x04,
0x19, 0x35, 0xce, 0xec, 0x10, 0xce, 0xee, 0x08, 0xd1, 0x79, 0x56, 0xb6,
0x58, 0xaf, 0xab, 0xe8, 0x9a, 0xf1, 0x3d, 0xa5, 0x6f, 0x73, 0x6e, 0xfb,
0xe2, 0xde, 0xd8, 0x35, 0xeb, 0xbb, 0xd1, 0xde, 0xe9, 0x96, 0xf9, 0xc2,
0x42, 0x67, 0xda, 0x71, 0x30, 0x3c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
0x74, 0xea, 0x0b, 0x7a, 0x7b, 0x7b, 0xc8, 0x58, 0xfa, 0x0f, 0x0a, 0x4d,
0x70, 0x0a, 0x3e, 0xa5, 0xb8, 0x75, 0x7d, 0x79, 0xa7, 0x70, 0xc6, 0xae,
0x4a, 0x5a, 0xec, 0x96, 0xa5, 0x63, 0x7e, 0x4e, 0xc5, 0xd1, 0x03, 0xf9,
0x36, 0x85, 0xf4, 0x31, 0x64, 0x94, 0x8c, 0x5d, 0x05, 0x0d, 0x59, 0x22,
0xdf, 0x21, 0x04, 0xe2, 0x50, 0x68, 0x14, 0x51, 0x14, 0x40, 0x73, 0xee,
0x7b, 0x93, 0x5d, 0x77, 0x35, 0x18, 0x25, 0x4a, 0x2c, 0xec, 0xd4, 0xce,
0x42, 0x10, 0x41, 0xc4, 0x52, 0x48, 0x61, 0x10, 0xb1, 0x54, 0x41, 0x0b,
0x21, 0x61, 0x43, 0x50, 0x97, 0x38, 0x91, 0xf9, 0xbd, 0x7b, 0x84, 0x82,
0x58, 0x98, 0xab, 0xef, 0x35, 0x86, 0xf1, 0x18, 0x42, 0x7d, 0x15, 0x89,
0x03, 0x07, 0x62, 0x08, 0xad, 0x39, 0xd4, 0x14, 0xe2, 0xb3, 0x06, 0x50,
0x33, 0xa8, 0x79, 0x14, 0x31, 0xe8, 0xe0, 0xc8, 0xf5, 0xbb, 0xee, 0xb5,
0xd6, 0x5e, 0xcf, 0xfb, 0x3c, 0x62, 0xaf, 0x2d, 0xde, 0x66, 0x3b, 0x90,
0xa2, 0x95, 0x88, 0x72, 0xf0, 0xdf, 0x0e, 0x2b, 0xb9, 0x45, 0x80, 0x49,
0x00, 0x84, 0x20, 0x08, 0x00, 0x01, 0x70, 0x4f, 0x23, 0x31, 0xb0, 0xf8,
0xc1, 0x2b, 0x47, 0x20, 0x00, 0x7e, 0x27, 0xd9, 0xd3, 0x1e, 0xc0, 0x66,
0x37, 0x19, 0x6c, 0x31, 0xc8, 0x90, 0xb0, 0x24, 0x0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
0x0c, 0x09, 0x4b, 0xc2, 0x90, 0xb0, 0x24, 0x0c, 0x09, 0x4b, 0xc2, 0x90,
0xb0, 0x24, 0x0c, 0x09, 0x4b, 0xc2, 0x90, 0x48, 0x24, 0x12, 0x89, 0x44,
0x22, 0x91, 0x48, 0x24, 0x12, 0x89, 0x44, 0x22, 0x21
};
//*************************** Program and Shaders ***************************/
/**
* Program object ID.
*/
static GLuint progId = 0;
/**
* Vertex shader ID.
*/
static GLuint vertId = 0;
/**
* Fragment shader ID.
*/
static GLuint fragId = 0;
//********************************* Uniforms *********************************/
/**
* Quad rotation angle ID.
*/
static GLint uRotId = -1;
/**
* Draw colour ID.
*/
static GLint uTx0Id = -1;
//******************************* Shader Source ******************************/
/**
* Vertex shader to draw texture mapped polys with an applied rotation.
*/
static GLchar const vertShader2D[] =
#if GL_ES_VERSION_2_0
"#version 100\n"
"precision mediump float;\n"
#else
"#version 120\n"
#endif
"uniform float uRot;" // rotation
"attribute vec2 aPos;" // vertex position coords
"attribute vec2 aUV0;" // vertex texture UV0
"varying vec2 vUV0;" // (passed to fragment shader)
"void main() {"
" float cosA = cos(radians(uRot));"
" float sinA = sin(radians(uRot));"
" mat3 rot = mat3(cosA, -sinA, 0.0,"
" sinA, cosA, 0.0,"
" 0.0, 0.0, 1.0);"
" gl_Position = vec4(rot * vec3(aPos, 1.0), 1.0);"
" vUV0 = aUV0;"
"}";
/**
* Fragment shader for the above polys.
*/
static GLchar const fragShader2D[] =
#if GL_ES_VERSION_2_0
"#version 100\n"
"precision mediump float;\n"
#else
"#version 120\n"
#endif
"uniform sampler2D uTx0;"
"varying vec2 vUV0;" // (passed from fragment shader)
"void main() {"
" gl_FragColor = texture2D(uTx0, vUV0);"
"}";
/**
* Helper to compile a shader.
*
* \param type shader type
* \param text shader source
* \return the shader ID (or zero if compilation failed)
*/
static GLuint compileShader(GLenum const type, const GLchar* text) {
GLuint shader = glCreateShader(type);
if (shader) {
glShaderSource (shader, 1, &text, NULL);
glCompileShader(shader);
GLint compiled;
glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
if (compiled) {
return shader;
} else {
GLint logLen;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLen);
if (logLen > 1) {
GLchar* logStr = static_cast<GLchar*>(malloc(logLen));
glGetShaderInfoLog(shader, logLen, NULL, logStr);
#ifndef NDEBUG
printf("Shader compilation error: %s\n", logStr);
#endif
free(logStr);
}
glDeleteShader(shader);
}
}
return 0;
}
//********************************** Helpers *********************************/
/**
* Vertex position index.
*/
#define GL_VERT_POSXY_ID 0
/**
* Vertex UV0 index.
*/
#define GL_VERT_TXUV0_ID 1
/**
* \c GL vec2 storage type.
*/
struct vec2 {
float x;
float y;
};
/**
* Combined 2D vertex and 2D texture coordinates.
*/
struct posTex2d {
struct vec2 pos;
struct vec2 uv0;
};
//****************************************************************************/
/**
* Current quad rotation angle (in degrees, updated per frame).
*/
static float rotDeg = 0.0f;
/**
* Emscripten (single) GL context.
*/
static EMSCRIPTEN_WEBGL_CONTEXT_HANDLE glCtx = 0;
/**
* Emscripten resize handler.
*/
static EM_BOOL resize(int type, const EmscriptenUiEvent* e, void* data) {
double surfaceW;
double surfaceH;
if (emscripten_get_element_css_size ("#canvas", &surfaceW, &surfaceH) == EMSCRIPTEN_RESULT_SUCCESS) {
emscripten_set_canvas_element_size("#canvas", surfaceW, surfaceH);
if (glCtx) {
glViewport(0, 0, (int) surfaceW, (int) surfaceH);
}
}
(void) type;
(void) data;
(void) e;
return EM_FALSE;
}
/**
* Boilerplate to create a WebGL context.
*/
static EM_BOOL initContext() {
// Default attributes
EmscriptenWebGLContextAttributes attr;
emscripten_webgl_init_context_attributes(&attr);
if ((glCtx = emscripten_webgl_create_context("#canvas", &attr))) {
// Bind the context and fire a resize to get the initial size
emscripten_webgl_make_context_current(glCtx);
emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, EM_FALSE, resize);
resize(0, NULL, NULL);
return EM_TRUE;
}
return EM_FALSE;
}
/**
* Called once per frame (clears the screen and draws the rotating quad).
*/
static void tick() {
glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (uRotId >= 0) {
glUniform1f(uRotId, rotDeg);
rotDeg += 0.1f;
if (rotDeg >= 360.0f) {
rotDeg -= 360.0f;
}
}
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
glFlush();
}
/**
* Creates the texture.
*/
bool upload(GLuint name, const uint8_t * data, size_t size, transcoder_texture_format type = cTFBC1) {
basisu_transcoder_init();
if (!globalCodebook) {
globalCodebook = new etc1_global_selector_codebook(g_global_selector_cb_size, g_global_selector_cb);
}
basisu_transcoder transcoder(globalCodebook);
if (transcoder.validate_header(data, size)) {
basisu_image_info info;
if (transcoder.get_image_info(data, size, info, 0)) {
uint32_t descW, descH, blocks;
if (transcoder.get_image_level_desc(data, size, 0, 0, descW, descH, blocks)) {
basisu_file_info fileInfo;
transcoder.get_file_info(data, size, fileInfo);
if (transcoder.start_transcoding(data, size)) {
uint32_t decSize = basis_get_bytes_per_block(type) * blocks;
if (void* decBuf = malloc(decSize)) {
if (transcoder.transcode_image_level(data, size, 0, 0, decBuf, blocks, type)) {
GLenum glType;
switch (type) {
case cTFBC1:
glType = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
break;
case cTFPVRTC1_4_RGB:
glType = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
break;
default:
glType = GL_FALSE;
}
if (glType != GL_FALSE) {
glBindTexture(GL_TEXTURE_2D, name);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glCompressedTexImage2D(GL_TEXTURE_2D, 0,
glType, descW, descH, 0, decSize, decBuf);
}
free(decBuf);
return glType != GL_FALSE;
}
}
}
}
}
}
return false;
}
/**
* Creates the GL context, shaders and quad data, decompresses the Zstd data
* and 'uploads' the resulting texture.
*
* As a (naive) comparison, removing Zstd and building with "-Os -g0 s WASM=1
* -lGL emscripten.c" results in a 15kB WebAssembly file; re-adding Zstd
* increases the Wasm by 26kB.
*/
int main() {
if (initContext()) {
// Compile shaders and set the initial GL state
if ((progId = glCreateProgram())) {
vertId = compileShader(GL_VERTEX_SHADER, vertShader2D);
fragId = compileShader(GL_FRAGMENT_SHADER, fragShader2D);
glBindAttribLocation(progId, GL_VERT_POSXY_ID, "aPos");
glBindAttribLocation(progId, GL_VERT_TXUV0_ID, "aUV0");
glAttachShader(progId, vertId);
glAttachShader(progId, fragId);
glLinkProgram (progId);
glUseProgram (progId);
uRotId = glGetUniformLocation(progId, "uRot");
uTx0Id = glGetUniformLocation(progId, "uTx0");
if (uTx0Id >= 0) {
glUniform1i(uTx0Id, 0);
}
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glDisable(GL_DITHER);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
}
GLuint vertsBuf = 0;
GLuint indexBuf = 0;
GLuint txName = 0;
// Create the textured quad (vert positions then UVs)
struct posTex2d verts2d[] = {
{{-0.85f, -0.85f}, {0.0f, 0.0f}}, // BL
{{ 0.85f, -0.85f}, {1.0f, 0.0f}}, // BR
{{-0.85f, 0.85f}, {0.0f, 1.0f}}, // TL
{{ 0.85f, 0.85f}, {1.0f, 1.0f}}, // TR
};
uint16_t index2d[] = {
0, 1, 2,
2, 1, 3,
};
glGenBuffers(1, &vertsBuf);
glBindBuffer(GL_ARRAY_BUFFER, vertsBuf);
glBufferData(GL_ARRAY_BUFFER,
sizeof(verts2d), verts2d, GL_STATIC_DRAW);
glVertexAttribPointer(GL_VERT_POSXY_ID, 2,
GL_FLOAT, GL_FALSE, sizeof(struct posTex2d), 0);
glVertexAttribPointer(GL_VERT_TXUV0_ID, 2,
GL_FLOAT, GL_FALSE, sizeof(struct posTex2d),
(void*) offsetof(struct posTex2d, uv0));
glGenBuffers(1, &indexBuf);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuf);
glBufferData(GL_ELEMENT_ARRAY_BUFFER,
sizeof(index2d), index2d, GL_STATIC_DRAW);
glEnableVertexAttribArray(GL_VERT_POSXY_ID);
glEnableVertexAttribArray(GL_VERT_TXUV0_ID);
transcoder_texture_format type = cTFRGB565;
if (emscripten_webgl_enable_extension(glCtx, "WEBKIT_WEBGL_compressed_texture_pvrtc")) {
printf("Has PVRTC!\n");
type = cTFPVRTC1_4_RGB;
} else {
if (emscripten_webgl_enable_extension(glCtx, "WEBGL_compressed_texture_s3tc")) {
printf("Has BC1!\n");
type = cTFBC1;
}
}
glGenTextures(1, &txName);
if (upload(txName, srcBasis, sizeof srcBasis, type)) {
printf("Decoded!\n");
}
emscripten_set_main_loop(tick, 0, EM_FALSE);
emscripten_exit_with_live_runtime();
} else {
printf("Failed to init WebGL!\n");
}
return EXIT_FAILURE;
}

View File

@@ -0,0 +1,18 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<title>Emscripten Shell</title>
<style>
body {background:#333; font-family:"Verdana","Helvetica Neue","Helvetica","Arial",sans-serif; margin:1em 0;}
#canvas{position:absolute; top:0px; left:0px; border:none; margin:0; width: 100%; height: 100%; overflow: hidden; display: block;}
</style>
</head>
<body>
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
{{{ SCRIPT }}}
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB