A Python library for unit testing GLSL functions
Project description
shadertest
A pyhton 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
shadertest-0.2.0.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for shadertest-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a0c49b32013c84a08185cd757620dd5bdd9fda1bdbccf4b05e891bd250449ba |
|
MD5 | a5c9d15df247d6f8cb1d38e0298797d2 |
|
BLAKE2b-256 | 002c9a010edb6c40a0cc4272659a4dedbd80691fe467fc711232cd7ea2231666 |