summaryrefslogtreecommitdiff
path: root/drivers/gles2/shader_gles2.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /drivers/gles2/shader_gles2.cpp
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'drivers/gles2/shader_gles2.cpp')
-rw-r--r--drivers/gles2/shader_gles2.cpp24
1 files changed, 0 insertions, 24 deletions
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
index 2c335c6c5a..48b98435c4 100644
--- a/drivers/gles2/shader_gles2.cpp
+++ b/drivers/gles2/shader_gles2.cpp
@@ -70,14 +70,12 @@ ShaderGLES2 *ShaderGLES2::active = nullptr;
#endif
GLint ShaderGLES2::get_uniform_location(int p_index) const {
-
ERR_FAIL_COND_V(!version, -1);
return version->uniform_location[p_index];
}
bool ShaderGLES2::bind() {
-
if (active != this || !version || new_conditional_version.key != conditional_version.key) {
conditional_version = new_conditional_version;
version = get_current_version();
@@ -110,7 +108,6 @@ void ShaderGLES2::unbind() {
}
static void _display_error_with_code(const String &p_error, const Vector<const char *> &p_code) {
-
int line = 1;
String total_code;
@@ -121,7 +118,6 @@ static void _display_error_with_code(const String &p_error, const Vector<const c
Vector<String> lines = String(total_code).split("\n");
for (int j = 0; j < lines.size(); j++) {
-
print_line(itos(line) + ": " + lines[j]);
line++;
}
@@ -130,13 +126,11 @@ static void _display_error_with_code(const String &p_error, const Vector<const c
}
static String _mkid(const String &p_id) {
-
String id = "m_" + p_id;
return id.replace("__", "_dus_"); //doubleunderscore is reserved in glsl
}
ShaderGLES2::Version *ShaderGLES2::get_current_version() {
-
Version *_v = version_map.getptr(conditional_version);
if (_v) {
@@ -457,7 +451,6 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
}
GLint ShaderGLES2::get_uniform_location(const String &p_name) const {
-
ERR_FAIL_COND_V(!version, -1);
return glGetUniformLocation(version->id, p_name.ascii().get_data());
}
@@ -475,7 +468,6 @@ void ShaderGLES2::setup(
const char *p_fragment_code,
int p_vertex_code_start,
int p_fragment_code_start) {
-
ERR_FAIL_COND(version);
conditional_version.key = 0;
@@ -532,7 +524,6 @@ void ShaderGLES2::setup(
String code2;
if (cpos != -1) {
-
fragment_code1 = code.substr(0, cpos).ascii();
code2 = code.substr(cpos + light_code_tag.length(), code.length());
} else {
@@ -617,7 +608,6 @@ void ShaderGLES2::set_custom_shader(uint32_t p_code_id) {
}
void ShaderGLES2::free_custom_shader(uint32_t p_code_id) {
-
ERR_FAIL_COND(!custom_code_map.has(p_code_id));
if (conditional_version.code_version == p_code_id) {
conditional_version.code_version = 0; //do not keep using a version that is going away
@@ -658,7 +648,6 @@ void ShaderGLES2::use_material(void *p_material) {
// bind uniforms
for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = material->shader->uniforms.front(); E; E = E->next()) {
-
if (E->get().texture_order >= 0)
continue; // this is a texture, doesn't go here
@@ -673,7 +662,6 @@ void ShaderGLES2::use_material(void *p_material) {
if (V) {
switch (E->get().type) {
case ShaderLanguage::TYPE_BOOL: {
-
bool boolean = V->get();
glUniform1i(location, boolean ? 1 : 0);
} break;
@@ -684,7 +672,6 @@ void ShaderGLES2::use_material(void *p_material) {
} break;
case ShaderLanguage::TYPE_BVEC3: {
-
int flags = V->get();
glUniform3i(location, (flags & 1) ? 1 : 0, (flags & 2) ? 1 : 0, (flags & 4) ? 1 : 0);
@@ -704,7 +691,6 @@ void ShaderGLES2::use_material(void *p_material) {
case ShaderLanguage::TYPE_IVEC2:
case ShaderLanguage::TYPE_UVEC2: {
-
Array r = V->get();
const int count = 2;
if (r.size() == count) {
@@ -776,7 +762,6 @@ void ShaderGLES2::use_material(void *p_material) {
} break;
case ShaderLanguage::TYPE_MAT2: {
-
Transform2D tr = V->get();
GLfloat matrix[4] = {
/* build a 16x16 matrix */
@@ -809,7 +794,6 @@ void ShaderGLES2::use_material(void *p_material) {
} break;
case ShaderLanguage::TYPE_MAT4: {
-
Transform2D tr = V->get();
GLfloat matrix[16] = { /* build a 16x16 matrix */
tr.elements[0][0],
@@ -938,19 +922,15 @@ void ShaderGLES2::use_material(void *p_material) {
} break;
case ShaderLanguage::TYPE_SAMPLER2D: {
-
} break;
case ShaderLanguage::TYPE_ISAMPLER2D: {
-
} break;
case ShaderLanguage::TYPE_USAMPLER2D: {
-
} break;
case ShaderLanguage::TYPE_SAMPLERCUBE: {
-
} break;
case ShaderLanguage::TYPE_SAMPLER2DARRAY:
@@ -1057,19 +1037,15 @@ void ShaderGLES2::use_material(void *p_material) {
} break;
case ShaderLanguage::TYPE_SAMPLER2D: {
-
} break;
case ShaderLanguage::TYPE_ISAMPLER2D: {
-
} break;
case ShaderLanguage::TYPE_USAMPLER2D: {
-
} break;
case ShaderLanguage::TYPE_SAMPLERCUBE: {
-
} break;
case ShaderLanguage::TYPE_SAMPLER2DARRAY: