From fa5dc43b443f41c6438766036fc8b58aa3bfadcc Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Sat, 6 Mar 2021 12:02:08 +0000 Subject: [PATCH] Updated compile_shader to compileShader --- examples/array_multiplication/src/Main.cpp | 2 +- .../kompute_summator/KomputeSummatorNode.cpp | 2 +- .../gdnative_shared/src/KomputeSummator.cpp | 2 +- single_include/kompute/Kompute.hpp | 4 ++-- src/Shader.cpp | 6 +++--- src/include/kompute/Shader.hpp | 4 ++-- test/TestAsyncOperations.cpp | 4 ++-- test/TestDestroy.cpp | 6 +++--- test/TestMultipleAlgoExecutions.cpp | 12 ++++++------ test/TestOpShadersFromStringAndFile.cpp | 2 +- test/TestPushConstant.cpp | 6 +++--- test/TestSequence.cpp | 2 +- test/TestShaderResources.cpp | 2 +- test/TestSpecializationConstant.cpp | 2 +- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/examples/array_multiplication/src/Main.cpp b/examples/array_multiplication/src/Main.cpp index fd823bca8..acb76898c 100755 --- a/examples/array_multiplication/src/Main.cpp +++ b/examples/array_multiplication/src/Main.cpp @@ -39,7 +39,7 @@ int main() std::vector> params = { tensorInA, tensorInB, tensorOut }; - std::shared_ptr algo = mgr.algorithm(params, kp::Shader::compile_source(shader)); + std::shared_ptr algo = mgr.algorithm(params, kp::Shader::compileSource(shader)); mgr.sequence() ->record(params) diff --git a/examples/godot_examples/custom_module/kompute_summator/KomputeSummatorNode.cpp b/examples/godot_examples/custom_module/kompute_summator/KomputeSummatorNode.cpp index f50c56d5c..e901ef816 100644 --- a/examples/godot_examples/custom_module/kompute_summator/KomputeSummatorNode.cpp +++ b/examples/godot_examples/custom_module/kompute_summator/KomputeSummatorNode.cpp @@ -54,7 +54,7 @@ void KomputeSummatorNode::_init() { std::shared_ptr algo = mgr.algorithm( { this->mPrimaryTensor, this->mSecondaryTensor }, - kp::Shader::compile_source(shader)); + kp::Shader::compileSource(shader)); // First we ensure secondary tensor loads to GPU diff --git a/examples/godot_examples/gdnative_shared/src/KomputeSummator.cpp b/examples/godot_examples/gdnative_shared/src/KomputeSummator.cpp index ece095c8e..99aabb338 100644 --- a/examples/godot_examples/gdnative_shared/src/KomputeSummator.cpp +++ b/examples/godot_examples/gdnative_shared/src/KomputeSummator.cpp @@ -58,7 +58,7 @@ void KomputeSummator::_init() { // Then we run the operation with both tensors this->mSequence->record( { this->mPrimaryTensor, this->mSecondaryTensor }, - kp::Shader::compile_source(shader)); + kp::Shader::compileSource(shader)); // We map the result back to local this->mSequence->record( diff --git a/single_include/kompute/Kompute.hpp b/single_include/kompute/Kompute.hpp index 38213bb6e..593390dbe 100755 --- a/single_include/kompute/Kompute.hpp +++ b/single_include/kompute/Kompute.hpp @@ -762,7 +762,7 @@ class Shader * GLSL compiler * @return The compiled SPIR-V binary in unsigned int32 format */ - static std::vector compile_sources( + static std::vector compileSources( const std::vector& sources, const std::vector& files = {}, const std::string& entryPoint = "main", @@ -783,7 +783,7 @@ class Shader * GLSL compiler * @return The compiled SPIR-V binary in unsigned int32 format */ - static std::vector compile_source( + static std::vector compileSource( const std::string& source, const std::string& entryPoint = "main", std::vector> definitions = {}, diff --git a/src/Shader.cpp b/src/Shader.cpp index 968e53234..bedac0165 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -5,7 +5,7 @@ namespace kp { std::vector -Shader::compile_sources( +Shader::compileSources( const std::vector& sources, const std::vector& files, const std::string& entryPoint, @@ -92,13 +92,13 @@ Shader::compile_sources( } std::vector -Shader::compile_source( +Shader::compileSource( const std::string& source, const std::string& entryPoint, std::vector> definitions, const TBuiltInResource& resource) { - return compile_sources({ source }, + return compileSources({ source }, std::vector({}), entryPoint, definitions, diff --git a/src/include/kompute/Shader.hpp b/src/include/kompute/Shader.hpp index 9fd1709be..9ecab24cd 100644 --- a/src/include/kompute/Shader.hpp +++ b/src/include/kompute/Shader.hpp @@ -39,7 +39,7 @@ class Shader * GLSL compiler * @return The compiled SPIR-V binary in unsigned int32 format */ - static std::vector compile_sources( + static std::vector compileSources( const std::vector& sources, const std::vector& files = {}, const std::string& entryPoint = "main", @@ -60,7 +60,7 @@ class Shader * GLSL compiler * @return The compiled SPIR-V binary in unsigned int32 format */ - static std::vector compile_source( + static std::vector compileSource( const std::string& source, const std::string& entryPoint = "main", std::vector> definitions = {}, diff --git a/test/TestAsyncOperations.cpp b/test/TestAsyncOperations.cpp index b1919ce52..2f8c7d819 100644 --- a/test/TestAsyncOperations.cpp +++ b/test/TestAsyncOperations.cpp @@ -37,7 +37,7 @@ TEST(TestAsyncOperations, TestManagerParallelExecution) } )"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); std::vector data(size, 0.0); std::vector resultSync(size, 100000000); @@ -145,7 +145,7 @@ TEST(TestAsyncOperations, TestManagerAsyncExecution) } )"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); std::vector data(size, 0.0); std::vector resultAsync(size, 100000000); diff --git a/test/TestDestroy.cpp b/test/TestDestroy.cpp index fee3854c4..0b948d64f 100644 --- a/test/TestDestroy.cpp +++ b/test/TestDestroy.cpp @@ -16,7 +16,7 @@ TEST(TestDestroy, TestDestroyTensorSingle) pa[index] = pa[index] + 1; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); { std::shared_ptr sq = nullptr; @@ -57,7 +57,7 @@ TEST(TestDestroy, TestDestroyTensorVector) pa[index] = pa[index] + 1; pb[index] = pb[index] + 2; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); { std::shared_ptr sq = nullptr; @@ -101,7 +101,7 @@ TEST(TestDestroy, TestDestroySequenceSingle) pa[index] = pa[index] + 1; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); { std::shared_ptr sq = nullptr; diff --git a/test/TestMultipleAlgoExecutions.cpp b/test/TestMultipleAlgoExecutions.cpp index b94591308..63dd5f7fe 100644 --- a/test/TestMultipleAlgoExecutions.cpp +++ b/test/TestMultipleAlgoExecutions.cpp @@ -49,7 +49,7 @@ TEST(TestMultipleAlgoExecutions, TestEndToEndFunctionality) kp::Constants pushConstsB({ 3.0 }); auto algorithm = mgr.algorithm( - params, kp::Shader::compile_source(shader), workgroup, specConsts, pushConstsA); + params, kp::Shader::compileSource(shader), workgroup, specConsts, pushConstsA); // 3. Run operation with string shader synchronously mgr.sequence() @@ -84,7 +84,7 @@ TEST(TestMultipleAlgoExecutions, SingleSequenceRecord) pa[index] = pa[index] + 1; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); { mgr.sequence() @@ -114,7 +114,7 @@ TEST(TestMultipleAlgoExecutions, MultipleCmdBufRecords) pa[index] = pa[index] + 1; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); std::shared_ptr algorithm = mgr.algorithm({ tensorA }, spirv); @@ -150,7 +150,7 @@ TEST(TestMultipleAlgoExecutions, MultipleSequences) pa[index] = pa[index] + 1; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); std::shared_ptr algorithm = mgr.algorithm({ tensorA }, spirv); @@ -185,7 +185,7 @@ TEST(TestMultipleAlgoExecutions, SingleRecordMultipleEval) pa[index] = pa[index] + 1; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); std::shared_ptr algorithm = mgr.algorithm({ tensorA }, spirv); @@ -221,7 +221,7 @@ TEST(TestMultipleAlgoExecutions, SequenceAlgoDestroyOutsideManagerScope) pa[index] = pa[index] + 1; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); std::shared_ptr algorithm = mgr.algorithm({ tensorA }, spirv); diff --git a/test/TestOpShadersFromStringAndFile.cpp b/test/TestOpShadersFromStringAndFile.cpp index 3e6856a21..e766c8efb 100644 --- a/test/TestOpShadersFromStringAndFile.cpp +++ b/test/TestOpShadersFromStringAndFile.cpp @@ -27,7 +27,7 @@ TEST(TestOpAlgoCreate, ShaderRawDataFromConstructor) } )"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); std::vector> params = { tensorA, tensorB }; diff --git a/test/TestPushConstant.cpp b/test/TestPushConstant.cpp index f51f8cc42..b37fe4d72 100644 --- a/test/TestPushConstant.cpp +++ b/test/TestPushConstant.cpp @@ -22,7 +22,7 @@ TEST(TestPushConstants, TestConstantsAlgoDispatchOverride) pa[2] += pcs.z; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); std::shared_ptr sq = nullptr; @@ -65,7 +65,7 @@ TEST(TestPushConstants, TestConstantsAlgoDispatchNoOverride) pa[2] += pcs.z; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); std::shared_ptr sq = nullptr; @@ -108,7 +108,7 @@ TEST(TestPushConstants, TestConstantsWrongSize) pa[2] += pcs.z; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); std::shared_ptr sq = nullptr; diff --git a/test/TestSequence.cpp b/test/TestSequence.cpp index b8afd1ad6..7d70a477b 100644 --- a/test/TestSequence.cpp +++ b/test/TestSequence.cpp @@ -66,7 +66,7 @@ TEST(TestSequence, RerecordSequence) sq->eval({ tensorA, tensorB, tensorOut }); - std::vector spirv = kp::Shader::compile_source(R"( + std::vector spirv = kp::Shader::compileSource(R"( #version 450 layout (local_size_x = 1) in; diff --git a/test/TestShaderResources.cpp b/test/TestShaderResources.cpp index b0013ef80..536f4ca0c 100644 --- a/test/TestShaderResources.cpp +++ b/test/TestShaderResources.cpp @@ -25,7 +25,7 @@ static const std::string shaderString = (R"( )"); void compileShaderWithGivenResources(const std::string shaderString, const TBuiltInResource resources) { - kp::Shader::compile_source(shaderString, std::string("main"), std::vector>({}), resources); + kp::Shader::compileSource(shaderString, std::string("main"), std::vector>({}), resources); } diff --git a/test/TestSpecializationConstant.cpp b/test/TestSpecializationConstant.cpp index e66f9d52e..2c6e284d2 100644 --- a/test/TestSpecializationConstant.cpp +++ b/test/TestSpecializationConstant.cpp @@ -18,7 +18,7 @@ TEST(TestSpecializationConstants, TestTwoConstants) pb[index] = cTwo; })"); - std::vector spirv = kp::Shader::compile_source(shader); + std::vector spirv = kp::Shader::compileSource(shader); std::shared_ptr sq = nullptr;