-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add basic test pipeline for shader builders
- Loading branch information
1 parent
b04593c
commit 388d35b
Showing
26 changed files
with
525 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
set -uo pipefail | ||
|
||
echo "Running Python checks for builder system" | ||
pytest ./tests/python_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
import sys | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
CWD = Path(__file__).parent | ||
ROOT = CWD.parent.parent | ||
# append directory with build files to sys.path to import them | ||
sys.path.append(str(ROOT)) | ||
|
||
|
||
@pytest.fixture | ||
def shader_files(request): | ||
shader_path = request.param | ||
|
||
res = { | ||
"path_input": str(CWD / "fixtures" / f"{shader_path}.glsl"), | ||
"path_output": str(CWD / "fixtures" / f"{shader_path}.glsl.gen.h"), | ||
"path_expected_full": str(CWD / "fixtures" / f"{shader_path}_expected_full.glsl"), | ||
"path_expected_parts": str(CWD / "fixtures" / f"{shader_path}_expected_parts.json"), | ||
} | ||
yield res | ||
|
||
if not os.getenv("PYTEST_KEEP_GENERATED_FILES"): | ||
os.remove(res["path_output"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#define M_PI 3.14159265359 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "_included.glsl" | ||
|
||
#[modes] | ||
|
||
mode_ninepatch = #define USE_NINEPATCH | ||
|
||
#[specializations] | ||
|
||
DISABLE_LIGHTING = false | ||
|
||
#[vertex] | ||
|
||
precision highp float; | ||
precision highp int; | ||
|
||
layout(location = 0) in highp vec3 vertex; | ||
|
||
out highp vec4 position_interp; | ||
|
||
void main() { | ||
position_interp = vec4(vertex.x,1,0,1); | ||
} | ||
|
||
#[fragment] | ||
|
||
precision highp float; | ||
precision highp int; | ||
|
||
in highp vec4 position_interp; | ||
|
||
void main() { | ||
highp float depth = ((position_interp.z / position_interp.w) + 1.0); | ||
frag_color = vec4(depth); | ||
} |
50 changes: 50 additions & 0 deletions
50
tests/python_build/fixtures/gles3/vertex_fragment_expected_full.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */ | ||
#ifndef VERTEX_FRAGMENT_GLSL_GEN_HGLES3_GLES3 | ||
#define VERTEX_FRAGMENT_GLSL_GEN_HGLES3_GLES3 | ||
|
||
|
||
#include "drivers/gles3/shader_gles3.h" | ||
|
||
|
||
class VertexFragmentShaderGLES3 : public ShaderGLES3 { | ||
|
||
public: | ||
|
||
enum ShaderVariant { | ||
MODE_NINEPATCH, | ||
}; | ||
|
||
enum Specializations { | ||
DISABLE_LIGHTING=1, | ||
}; | ||
|
||
_FORCE_INLINE_ void version_bind_shader(RID p_version,ShaderVariant p_variant,uint64_t p_specialization=0) { _version_bind_shader(p_version,p_variant,p_specialization); } | ||
|
||
protected: | ||
|
||
virtual void _init() override { | ||
|
||
static const char **_uniform_strings=nullptr; | ||
static const char* _variant_defines[]={ | ||
"#define USE_NINEPATCH", | ||
}; | ||
|
||
static TexUnitPair *_texunit_pairs=nullptr; | ||
static UBOPair *_ubo_pairs=nullptr; | ||
static Specialization _spec_pairs[]={ | ||
{"DISABLE_LIGHTING",false}, | ||
}; | ||
|
||
static const char _vertex_code[]={ | ||
10,112,114,101,99,105,115,105,111,110,32,104,105,103,104,112,32,102,108,111,97,116,59,10,112,114,101,99,105,115,105,111,110,32,104,105,103,104,112,32,105,110,116,59,10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,32,61,32,48,41,32,105,110,32,104,105,103,104,112,32,118,101,99,51,32,118,101,114,116,101,120,59,10,10,111,117,116,32,104,105,103,104,112,32,118,101,99,52,32,112,111,115,105,116,105,111,110,95,105,110,116,101,114,112,59,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,9,112,111,115,105,116,105,111,110,95,105,110,116,101,114,112,32,61,32,118,101,99,52,40,118,101,114,116,101,120,46,120,44,49,44,48,44,49,41,59,10,125,10,10, 0}; | ||
|
||
static const char _fragment_code[]={ | ||
10,112,114,101,99,105,115,105,111,110,32,104,105,103,104,112,32,102,108,111,97,116,59,10,112,114,101,99,105,115,105,111,110,32,104,105,103,104,112,32,105,110,116,59,10,10,105,110,32,104,105,103,104,112,32,118,101,99,52,32,112,111,115,105,116,105,111,110,95,105,110,116,101,114,112,59,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,9,104,105,103,104,112,32,102,108,111,97,116,32,100,101,112,116,104,32,61,32,40,40,112,111,115,105,116,105,111,110,95,105,110,116,101,114,112,46,122,32,47,32,112,111,115,105,116,105,111,110,95,105,110,116,101,114,112,46,119,41,32,43,32,49,46,48,41,59,10,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,100,101,112,116,104,41,59,10,125,10, 0}; | ||
|
||
_setup(_vertex_code,_fragment_code,"VertexFragmentShaderGLES3",0,_uniform_strings,0,_ubo_pairs,0,_texunit_pairs,1,_spec_pairs,1,_variant_defines); | ||
} | ||
|
||
}; | ||
|
||
#endif | ||
|
Oops, something went wrong.