summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp60
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp4
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp62
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp5
4 files changed, 74 insertions, 57 deletions
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index 25bab0e97a..935cb32fda 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -449,7 +449,9 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
SL::VariableDeclarationNode *var_dec_node = (SL::VariableDeclarationNode *)p_node;
StringBuffer<> declaration;
-
+ if (var_dec_node->is_const) {
+ declaration += "const ";
+ }
declaration += _prestr(var_dec_node->precision);
declaration += _typestr(var_dec_node->datatype);
@@ -512,14 +514,16 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
} break;
case SL::Node::TYPE_ARRAY_DECLARATION: {
- SL::ArrayDeclarationNode *var_dec_node = (SL::ArrayDeclarationNode *)p_node;
+ SL::ArrayDeclarationNode *arr_dec_node = (SL::ArrayDeclarationNode *)p_node;
StringBuffer<> declaration;
+ if (arr_dec_node->is_const) {
+ declaration += "const ";
+ }
+ declaration += _prestr(arr_dec_node->precision);
+ declaration += _typestr(arr_dec_node->datatype);
- declaration += _prestr(var_dec_node->precision);
- declaration += _typestr(var_dec_node->datatype);
-
- for (int i = 0; i < var_dec_node->declarations.size(); i++) {
+ for (int i = 0; i < arr_dec_node->declarations.size(); i++) {
if (i > 0) {
declaration += ",";
@@ -527,20 +531,20 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
declaration += " ";
- declaration += _mkid(var_dec_node->declarations[i].name);
+ declaration += _mkid(arr_dec_node->declarations[i].name);
declaration += "[";
- declaration += itos(var_dec_node->declarations[i].size);
+ declaration += itos(arr_dec_node->declarations[i].size);
declaration += "]";
- int sz = var_dec_node->declarations[i].initializer.size();
+ int sz = arr_dec_node->declarations[i].initializer.size();
if (sz > 0) {
declaration += "=";
- declaration += _typestr(var_dec_node->datatype);
+ declaration += _typestr(arr_dec_node->datatype);
declaration += "[";
declaration += itos(sz);
declaration += "]";
declaration += "(";
for (int j = 0; j < sz; j++) {
- declaration += _dump_node_code(var_dec_node->declarations[i].initializer[j], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ declaration += _dump_node_code(arr_dec_node->declarations[i].initializer[j], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
if (j != sz - 1) {
declaration += ", ";
}
@@ -552,46 +556,46 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
code += declaration.as_string();
} break;
case SL::Node::TYPE_ARRAY: {
- SL::ArrayNode *var_node = (SL::ArrayNode *)p_node;
+ SL::ArrayNode *arr_node = (SL::ArrayNode *)p_node;
- if (p_assigning && p_actions.write_flag_pointers.has(var_node->name)) {
- *p_actions.write_flag_pointers[var_node->name] = true;
+ if (p_assigning && p_actions.write_flag_pointers.has(arr_node->name)) {
+ *p_actions.write_flag_pointers[arr_node->name] = true;
}
- if (p_default_actions.usage_defines.has(var_node->name) && !used_name_defines.has(var_node->name)) {
- String define = p_default_actions.usage_defines[var_node->name];
+ if (p_default_actions.usage_defines.has(arr_node->name) && !used_name_defines.has(arr_node->name)) {
+ String define = p_default_actions.usage_defines[arr_node->name];
if (define.begins_with("@")) {
define = p_default_actions.usage_defines[define.substr(1, define.length())];
}
r_gen_code.custom_defines.push_back(define.utf8());
- used_name_defines.insert(var_node->name);
+ used_name_defines.insert(arr_node->name);
}
- if (p_actions.usage_flag_pointers.has(var_node->name) && !used_flag_pointers.has(var_node->name)) {
- *p_actions.usage_flag_pointers[var_node->name] = true;
- used_flag_pointers.insert(var_node->name);
+ if (p_actions.usage_flag_pointers.has(arr_node->name) && !used_flag_pointers.has(arr_node->name)) {
+ *p_actions.usage_flag_pointers[arr_node->name] = true;
+ used_flag_pointers.insert(arr_node->name);
}
- if (p_default_actions.renames.has(var_node->name)) {
- code += p_default_actions.renames[var_node->name];
+ if (p_default_actions.renames.has(arr_node->name)) {
+ code += p_default_actions.renames[arr_node->name];
} else {
- code += _mkid(var_node->name);
+ code += _mkid(arr_node->name);
}
- if (var_node->call_expression != NULL) {
+ if (arr_node->call_expression != NULL) {
code += ".";
- code += _dump_node_code(var_node->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += _dump_node_code(arr_node->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
}
- if (var_node->index_expression != NULL) {
+ if (arr_node->index_expression != NULL) {
code += "[";
- code += _dump_node_code(var_node->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += _dump_node_code(arr_node->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += "]";
}
- if (var_node->name == time_name) {
+ if (arr_node->name == time_name) {
if (current_func_name == vertex_name) {
r_gen_code.uses_vertex_time = true;
}
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index e0ca388da9..c7040c232b 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -2522,8 +2522,8 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
int v = value;
GLuint *gui = (GLuint *)data;
- gui[0] = v & 1 ? GL_TRUE : GL_FALSE;
- gui[1] = v & 2 ? GL_TRUE : GL_FALSE;
+ gui[0] = (v & 1) ? GL_TRUE : GL_FALSE;
+ gui[1] = (v & 2) ? GL_TRUE : GL_FALSE;
} break;
case ShaderLanguage::TYPE_BVEC3: {
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index f826bdf5a2..d48ee7709c 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -555,7 +555,12 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
case SL::Node::TYPE_VARIABLE_DECLARATION: {
SL::VariableDeclarationNode *vdnode = (SL::VariableDeclarationNode *)p_node;
- String declaration = _prestr(vdnode->precision) + _typestr(vdnode->datatype);
+ String declaration;
+ if (vdnode->is_const) {
+ declaration += "const ";
+ }
+ declaration += _prestr(vdnode->precision);
+ declaration += _typestr(vdnode->datatype);
for (int i = 0; i < vdnode->declarations.size(); i++) {
if (i > 0) {
declaration += ",";
@@ -609,29 +614,34 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
} break;
case SL::Node::TYPE_ARRAY_DECLARATION: {
- SL::ArrayDeclarationNode *vdnode = (SL::ArrayDeclarationNode *)p_node;
+ SL::ArrayDeclarationNode *adnode = (SL::ArrayDeclarationNode *)p_node;
- String declaration = _prestr(vdnode->precision) + _typestr(vdnode->datatype);
- for (int i = 0; i < vdnode->declarations.size(); i++) {
+ String declaration;
+ if (adnode->is_const) {
+ declaration += "const ";
+ }
+ declaration += _prestr(adnode->precision);
+ declaration += _typestr(adnode->datatype);
+ for (int i = 0; i < adnode->declarations.size(); i++) {
if (i > 0) {
declaration += ",";
} else {
declaration += " ";
}
- declaration += _mkid(vdnode->declarations[i].name);
+ declaration += _mkid(adnode->declarations[i].name);
declaration += "[";
- declaration += itos(vdnode->declarations[i].size);
+ declaration += itos(adnode->declarations[i].size);
declaration += "]";
- int sz = vdnode->declarations[i].initializer.size();
+ int sz = adnode->declarations[i].initializer.size();
if (sz > 0) {
declaration += "=";
- declaration += _typestr(vdnode->datatype);
+ declaration += _typestr(adnode->datatype);
declaration += "[";
declaration += itos(sz);
declaration += "]";
declaration += "(";
for (int j = 0; j < sz; j++) {
- declaration += _dump_node_code(vdnode->declarations[i].initializer[j], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ declaration += _dump_node_code(adnode->declarations[i].initializer[j], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
if (j != sz - 1) {
declaration += ", ";
}
@@ -643,43 +653,43 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
code += declaration;
} break;
case SL::Node::TYPE_ARRAY: {
- SL::ArrayNode *vnode = (SL::ArrayNode *)p_node;
+ SL::ArrayNode *anode = (SL::ArrayNode *)p_node;
- if (p_assigning && p_actions.write_flag_pointers.has(vnode->name)) {
- *p_actions.write_flag_pointers[vnode->name] = true;
+ if (p_assigning && p_actions.write_flag_pointers.has(anode->name)) {
+ *p_actions.write_flag_pointers[anode->name] = true;
}
- if (p_default_actions.usage_defines.has(vnode->name) && !used_name_defines.has(vnode->name)) {
- String define = p_default_actions.usage_defines[vnode->name];
+ if (p_default_actions.usage_defines.has(anode->name) && !used_name_defines.has(anode->name)) {
+ String define = p_default_actions.usage_defines[anode->name];
if (define.begins_with("@")) {
define = p_default_actions.usage_defines[define.substr(1, define.length())];
}
r_gen_code.defines.push_back(define.utf8());
- used_name_defines.insert(vnode->name);
+ used_name_defines.insert(anode->name);
}
- if (p_actions.usage_flag_pointers.has(vnode->name) && !used_flag_pointers.has(vnode->name)) {
- *p_actions.usage_flag_pointers[vnode->name] = true;
- used_flag_pointers.insert(vnode->name);
+ if (p_actions.usage_flag_pointers.has(anode->name) && !used_flag_pointers.has(anode->name)) {
+ *p_actions.usage_flag_pointers[anode->name] = true;
+ used_flag_pointers.insert(anode->name);
}
- if (p_default_actions.renames.has(vnode->name))
- code = p_default_actions.renames[vnode->name];
+ if (p_default_actions.renames.has(anode->name))
+ code = p_default_actions.renames[anode->name];
else
- code = _mkid(vnode->name);
+ code = _mkid(anode->name);
- if (vnode->call_expression != NULL) {
+ if (anode->call_expression != NULL) {
code += ".";
- code += _dump_node_code(vnode->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += _dump_node_code(anode->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
}
- if (vnode->index_expression != NULL) {
+ if (anode->index_expression != NULL) {
code += "[";
- code += _dump_node_code(vnode->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += _dump_node_code(anode->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += "]";
}
- if (vnode->name == time_name) {
+ if (anode->name == time_name) {
if (current_func_name == vertex_name) {
r_gen_code.uses_vertex_time = true;
}
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index e4daa1cc88..7ba2175652 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -266,7 +266,10 @@ Error AudioDriverPulseAudio::init() {
}
while (pa_ready == 0) {
- pa_mainloop_iterate(pa_ml, 1, NULL);
+ ret = pa_mainloop_iterate(pa_ml, 1, NULL);
+ if (ret < 0) {
+ ERR_PRINT("pa_mainloop_iterate error");
+ }
}
if (pa_ready < 0) {