A Python library for unit testing GLSL functions
Project description
shadertest
A Python library for unit testing GLSL functions
Example
Below we have a very simple fragment shader called add.frag.
#version 330
out vec4 outColor;
float add(float a, float b) {
return a + b;
}
void main() {
outColor = vec4(add(0.5, 0.5));
}
To test using shadertest, we just need to create a ShaderContext, and start calling functions from the shader.
import pytest
import shadertest
@pytest.fixture(scope='module')
def basic_shader():
with shadertest.ShaderContext.from_file('add.frag') as funcs:
yield funcs
def test_add(basic_shader):
assert basic_shader.add(4, 2) == 6
Supported data types
The following data types are supported for return values and function arguments:
- bool
- int
- uint
- float
- bvecn
- ivecn
- vecn
For more information about GLSL data types, checkout the Khronos wiki page on them.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shadertest-0.2.1.tar.gz.
File metadata
- Download URL: shadertest-0.2.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37a31872ab39dc751e51f4bfca306d999b41622841352a7f34c20ff8182240ab
|
|
| MD5 |
6fbc0e30906493e5a8b6603affc00313
|
|
| BLAKE2b-256 |
6029f10479de8693834f053520eca61f03972588c743345af9deb88785fd1d09
|
File details
Details for the file shadertest-0.2.1-py3-none-any.whl.
File metadata
- Download URL: shadertest-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46fa227e1fb97308f2e960d0449e3bd6f4bc969ae9f4816b4e612852f95fb9d8
|
|
| MD5 |
2df8a05fd49afe2671a955a0a0f40e83
|
|
| BLAKE2b-256 |
7963bf20be15f741faa843249a35d7b762903b7203ced13077bd8acb2d08984f
|