From 8a0c63cc64e07b08361a5ae96b1c47255d726d2a Mon Sep 17 00:00:00 2001 From: 0x0f0f0f Date: Mon, 9 Nov 2020 09:42:39 +0100 Subject: [PATCH] replaced "static unsigned const" to "static const unsigned" so that SWIG can generate wrappers without a syntax error --- scripts/convert_shaders.py | 4 +- single_include/kompute/Kompute.hpp | 8 +-- .../shaders/shaderlogisticregression.hpp | 60 +++++++++---------- src/include/kompute/shaders/shaderopmult.hpp | 60 +++++++++---------- .../shadertest_logistic_regression.hpp | 60 +++++++++---------- .../shaders/shadertest_op_custom_shader.hpp | 60 +++++++++---------- 6 files changed, 126 insertions(+), 126 deletions(-) diff --git a/scripts/convert_shaders.py b/scripts/convert_shaders.py index 0c26e862..9375b670 100644 --- a/scripts/convert_shaders.py +++ b/scripts/convert_shaders.py @@ -122,8 +122,8 @@ def run_cli( for file in spirv_files: print(xxd_cmd) header_data = str(run_cmd(xxd_cmd, "-i", file)) - # Ensuring the variable is a static unsigned const - header_data = header_data.replace("unsigned", "static unsigned const") + # Ensuring the variable is a static const unsigned + header_data = header_data.replace("unsigned", "static const unsigned") if is_windows: raw_file_name = file.split("\\")[-1] else: diff --git a/single_include/kompute/Kompute.hpp b/single_include/kompute/Kompute.hpp index 9674d44c..1eb00a6d 100755 --- a/single_include/kompute/Kompute.hpp +++ b/single_include/kompute/Kompute.hpp @@ -108,7 +108,7 @@ static const char* KOMPUTE_LOG_TAG = "KomputeLog"; namespace kp { namespace shader_data { -static unsigned const char shaders_glsl_opmult_comp_spv[] = { +static const unsigned char shaders_glsl_opmult_comp_spv[] = { 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x08, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, @@ -232,7 +232,7 @@ static unsigned const char shaders_glsl_opmult_comp_spv[] = { 0x17, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00 }; -static unsigned const int shaders_glsl_opmult_comp_spv_len = 1464; +static const unsigned int shaders_glsl_opmult_comp_spv_len = 1464; } } #endif // define SHADEROP_SHADEROPMULT_HPP @@ -262,7 +262,7 @@ static unsigned const int shaders_glsl_opmult_comp_spv_len = 1464; namespace kp { namespace shader_data { -static unsigned const char shaders_glsl_logisticregression_comp_spv[] = { +static const unsigned char shaders_glsl_logisticregression_comp_spv[] = { 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x08, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, @@ -674,7 +674,7 @@ static unsigned const char shaders_glsl_logisticregression_comp_spv[] = { 0x06, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00 }; -static unsigned const int shaders_glsl_logisticregression_comp_spv_len = 4920; +static const unsigned int shaders_glsl_logisticregression_comp_spv_len = 4920; } } #endif // define SHADEROP_SHADERLOGISTICREGRESSION_HPP diff --git a/src/include/kompute/shaders/shaderlogisticregression.hpp b/src/include/kompute/shaders/shaderlogisticregression.hpp index 7b7e5f2d..37896eef 100755 --- a/src/include/kompute/shaders/shaderlogisticregression.hpp +++ b/src/include/kompute/shaders/shaderlogisticregression.hpp @@ -1,29 +1,29 @@ -/* - THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT - - --- - - Copyright 2020 The Institute for Ethical AI & Machine Learning - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef SHADEROP_SHADERLOGISTICREGRESSION_HPP -#define SHADEROP_SHADERLOGISTICREGRESSION_HPP - -namespace kp { -namespace shader_data { -static unsigned const char shaders_glsl_logisticregression_comp_spv[] = { +/* + THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT + + --- + + Copyright 2020 The Institute for Ethical AI & Machine Learning + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef SHADEROP_SHADERLOGISTICREGRESSION_HPP +#define SHADEROP_SHADERLOGISTICREGRESSION_HPP + +namespace kp { +namespace shader_data { +static const unsigned char shaders_glsl_logisticregression_comp_spv[] = { 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x08, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, @@ -435,7 +435,7 @@ static unsigned const char shaders_glsl_logisticregression_comp_spv[] = { 0x06, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00 }; -static unsigned const int shaders_glsl_logisticregression_comp_spv_len = 4920; -} -} -#endif // define SHADEROP_SHADERLOGISTICREGRESSION_HPP +static const unsigned int shaders_glsl_logisticregression_comp_spv_len = 4920; +} +} +#endif // define SHADEROP_SHADERLOGISTICREGRESSION_HPP diff --git a/src/include/kompute/shaders/shaderopmult.hpp b/src/include/kompute/shaders/shaderopmult.hpp index 4900dd4f..239439a2 100755 --- a/src/include/kompute/shaders/shaderopmult.hpp +++ b/src/include/kompute/shaders/shaderopmult.hpp @@ -1,29 +1,29 @@ -/* - THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT - - --- - - Copyright 2020 The Institute for Ethical AI & Machine Learning - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef SHADEROP_SHADEROPMULT_HPP -#define SHADEROP_SHADEROPMULT_HPP - -namespace kp { -namespace shader_data { -static unsigned const char shaders_glsl_opmult_comp_spv[] = { +/* + THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT + + --- + + Copyright 2020 The Institute for Ethical AI & Machine Learning + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef SHADEROP_SHADEROPMULT_HPP +#define SHADEROP_SHADEROPMULT_HPP + +namespace kp { +namespace shader_data { +static const unsigned char shaders_glsl_opmult_comp_spv[] = { 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x08, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, @@ -147,7 +147,7 @@ static unsigned const char shaders_glsl_opmult_comp_spv[] = { 0x17, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00 }; -static unsigned const int shaders_glsl_opmult_comp_spv_len = 1464; -} -} -#endif // define SHADEROP_SHADEROPMULT_HPP +static const unsigned int shaders_glsl_opmult_comp_spv_len = 1464; +} +} +#endif // define SHADEROP_SHADEROPMULT_HPP diff --git a/test/compiled_shaders_include/kompute_test/shaders/shadertest_logistic_regression.hpp b/test/compiled_shaders_include/kompute_test/shaders/shadertest_logistic_regression.hpp index f72e08e2..5f5fa715 100755 --- a/test/compiled_shaders_include/kompute_test/shaders/shadertest_logistic_regression.hpp +++ b/test/compiled_shaders_include/kompute_test/shaders/shadertest_logistic_regression.hpp @@ -1,29 +1,29 @@ -/* - THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT - - --- - - Copyright 2020 The Institute for Ethical AI & Machine Learning - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef SHADEROP_SHADERTEST_LOGISTIC_REGRESSION_HPP -#define SHADEROP_SHADERTEST_LOGISTIC_REGRESSION_HPP - -namespace kp { -namespace shader_data { -static unsigned const char test_shaders_glsl_test_logistic_regression_comp_spv[] = { +/* + THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT + + --- + + Copyright 2020 The Institute for Ethical AI & Machine Learning + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef SHADEROP_SHADERTEST_LOGISTIC_REGRESSION_HPP +#define SHADEROP_SHADERTEST_LOGISTIC_REGRESSION_HPP + +namespace kp { +namespace shader_data { +static const unsigned char test_shaders_glsl_test_logistic_regression_comp_spv[] = { 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x08, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, @@ -435,7 +435,7 @@ static unsigned const char test_shaders_glsl_test_logistic_regression_comp_spv[] 0x06, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00 }; -static unsigned const int test_shaders_glsl_test_logistic_regression_comp_spv_len = 4920; -} -} -#endif // define SHADEROP_SHADERTEST_LOGISTIC_REGRESSION_HPP +static const unsigned int test_shaders_glsl_test_logistic_regression_comp_spv_len = 4920; +} +} +#endif // define SHADEROP_SHADERTEST_LOGISTIC_REGRESSION_HPP diff --git a/test/compiled_shaders_include/kompute_test/shaders/shadertest_op_custom_shader.hpp b/test/compiled_shaders_include/kompute_test/shaders/shadertest_op_custom_shader.hpp index 1fba35c0..a904e061 100755 --- a/test/compiled_shaders_include/kompute_test/shaders/shadertest_op_custom_shader.hpp +++ b/test/compiled_shaders_include/kompute_test/shaders/shadertest_op_custom_shader.hpp @@ -1,29 +1,29 @@ -/* - THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT - - --- - - Copyright 2020 The Institute for Ethical AI & Machine Learning - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef SHADEROP_SHADERTEST_OP_CUSTOM_SHADER_HPP -#define SHADEROP_SHADERTEST_OP_CUSTOM_SHADER_HPP - -namespace kp { -namespace shader_data { -static unsigned const char test_shaders_glsl_test_op_custom_shader_comp_spv[] = { +/* + THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT + + --- + + Copyright 2020 The Institute for Ethical AI & Machine Learning + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef SHADEROP_SHADERTEST_OP_CUSTOM_SHADER_HPP +#define SHADEROP_SHADERTEST_OP_CUSTOM_SHADER_HPP + +namespace kp { +namespace shader_data { +static const unsigned char test_shaders_glsl_test_op_custom_shader_comp_spv[] = { 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x08, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, @@ -117,7 +117,7 @@ static unsigned const char test_shaders_glsl_test_op_custom_shader_comp_spv[] = 0x24, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00 }; -static unsigned const int test_shaders_glsl_test_op_custom_shader_comp_spv_len = 1096; -} -} -#endif // define SHADEROP_SHADERTEST_OP_CUSTOM_SHADER_HPP +static const unsigned int test_shaders_glsl_test_op_custom_shader_comp_spv_len = 1096; +} +} +#endif // define SHADEROP_SHADERTEST_OP_CUSTOM_SHADER_HPP