Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Texturing overhaul: GPU compression, sRGB sampling, swizzles, etc. #240

Merged
merged 48 commits into from
Aug 15, 2020
Merged
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0c1c23b
WIP compressed textures, swizzles, sRGB sampling, ...
Akaricchi Jul 19, 2020
1f98ac7
refactor texture type info & fix random bugs
Akaricchi Jul 22, 2020
ef9cb45
fix preprocessing of sRGB textures
Akaricchi Jul 22, 2020
f238d36
handle y-flipped basis textures
Akaricchi Jul 23, 2020
4259515
glcommon: better WebGL compat for compressed format detection
Akaricchi Jul 23, 2020
923466b
missed WEBGL_compressed_texture_pvrtc
Akaricchi Jul 23, 2020
49a173e
implement compressed texture xcoding and uploading
Akaricchi Jul 24, 2020
9bc48ad
Add basis_universal submodule
Akaricchi Jul 24, 2020
d3c7653
Reorganize texture loader code
Akaricchi Jul 25, 2020
b02c3d6
Add wrapper script for encoding .basis textures
Akaricchi Jul 27, 2020
913aabe
basisu: honor custom metadata written by the mkbasis.py script
Akaricchi Jul 27, 2020
b575a7e
mkbasis.py: add --incredibly-slow and --dry-run
Akaricchi Jul 27, 2020
9ab92d1
Move pixmap code from util/ to pixmap/
Akaricchi Jul 28, 2020
7a3548a
Add an on-disk transcode cache for basis textures to speed up loads
Akaricchi Jul 28, 2020
5e83045
Compress texture cache with zlib
Akaricchi Jul 28, 2020
c4b2cb0
Use readable format names for basisu cache filenames
Akaricchi Jul 28, 2020
5f9c505
basisu: mip bias test code
Akaricchi Jul 28, 2020
2204420
basisu: small caching cleanup
Akaricchi Jul 28, 2020
7e4265b
add TAISEI_BASISU_MIP_BIAS env variable
Akaricchi Jul 28, 2020
4a05626
Improve OpenGL format matching heuristics
Akaricchi Jul 29, 2020
c6029ac
Document considerations for compressed format priority
Akaricchi Jul 29, 2020
24d861a
Remove dead code
Akaricchi Jul 29, 2020
efd2e78
Enable two forgotten formats, BC3_RGBA and ATC_RGBA
Akaricchi Jul 29, 2020
9e4d5c7
Recognize GL_ANGLE_compressed_texture_etc for ETC2 textures
Akaricchi Jul 29, 2020
0694c86
Default depth buffers to 24-bit; remove ANGLE hack
Akaricchi Jul 29, 2020
565d462
Fix glcommon_check_extension for GLES2/legacy gl
Akaricchi Jul 29, 2020
7fd16be
Add renderer feature bit for texture swizzle masks
Akaricchi Aug 3, 2020
795f779
glcommon: Fixup internal formats for GLES2
Akaricchi Aug 4, 2020
f5c23a6
Fix emscripten compile errors
Akaricchi Aug 4, 2020
4c53705
Update basis_universal
Akaricchi Aug 5, 2020
dd0ae9c
remove more dead code
Akaricchi Aug 5, 2020
5737ba5
revert irrelevant stage4 change
Akaricchi Aug 5, 2020
a1c7162
shut up UBSan
Akaricchi Aug 5, 2020
06c3089
basisu: shut up some debug spam
Akaricchi Aug 5, 2020
d6118ec
Add normalmap sampling helper to util.glslh
Akaricchi Aug 5, 2020
d078d22
basisu: add a gray-alpha mode
Akaricchi Aug 5, 2020
bb6ee54
mkbasis.py: Abort if image dimansions aren't multiples of 4
Akaricchi Aug 6, 2020
ed3c5bd
Add basic Basis Universal encoding documentation (WIP)
Akaricchi Aug 6, 2020
58b5f33
doc/basisu: Add paragraph about modes; minor tweaks
Akaricchi Aug 6, 2020
9ba4328
basisu: workarounds for GL texture size requirements
Akaricchi Aug 9, 2020
719bc62
gles20: fix uncompressed sRGB formats
Akaricchi Aug 11, 2020
ea659c6
Partial workaround for missing swizzles in gles2 and webgl
Akaricchi Aug 11, 2020
98b9c47
remove invalid assertion
Akaricchi Aug 11, 2020
8c9d7ec
New renderer API to expose glDrawBuffers-like functionality
Akaricchi Aug 11, 2020
1bbbe1a
stagedraw: disable all color outputs for copy_depth pass
Akaricchi Aug 11, 2020
8ca003c
support GL_ANGLE_request_extension
Akaricchi Aug 11, 2020
1033858
emscripten: include *.basis in gfx package
Akaricchi Aug 13, 2020
7724e4c
Don't rely on emscripten runtime to enable webgl extensions
Akaricchi Aug 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
mkbasis.py: Abort if image dimansions aren't multiples of 4
Akaricchi committed Aug 14, 2020
commit bb6ee54704074e4651be92638dc0f893d18722d2
12 changes: 12 additions & 0 deletions scripts/mkbasis.py
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@

import argparse
import subprocess
import sys

BASISU_TAISEI_ID = 0x52656900
BASISU_TAISEI_CHANNELS = ('r', 'rg', 'rgb', 'rgba', 'gray-alpha')
@@ -40,6 +41,11 @@ def run(args, cmd):
subprocess.check_call(cmd)


def image_size(img_path):
o = subprocess.check_output(['convert', img_path, '-print', '%wx%h', 'null:'])
return tuple(int(d) for d in o.strip().decode('utf8').split('x'))


def preprocess(args, tempdir):
cmd = [
'convert',
@@ -97,6 +103,12 @@ def preprocess(args, tempdir):


def process(args):
width, height = image_size(args.input)

if width % 4 != 0 or height % 4 != 0:
print(f'{args.input}: image dimensions are not multiples of 4 ({width}x{height})', file=sys.stderr)
exit(1)

with TemporaryDirectory() as tempdir:
tempdir = Path(tempdir)
img = preprocess(args, tempdir)