diff --git a/util/test/demos/demos.vcxproj b/util/test/demos/demos.vcxproj index cf73b055f..3c438e96a 100644 --- a/util/test/demos/demos.vcxproj +++ b/util/test/demos/demos.vcxproj @@ -104,30 +104,6 @@ true - - 1 - - - 1 - - - - 3rdparty/shaderc/x64/include;%(AdditionalIncludeDirectories) - HAVE_SHADERC=1;%(PreprocessorDefinitions) - - - 3rdparty/shaderc/x64/lib/shaderc_combined.lib;%(AdditionalDependencies) - - - - - 3rdparty/shaderc/x86/include;%(AdditionalIncludeDirectories) - HAVE_SHADERC=1;%(PreprocessorDefinitions) - - - 3rdparty/shaderc/x86/lib/shaderc_combined.lib;%(AdditionalDependencies) - - @@ -465,7 +441,6 @@ - @@ -554,8 +529,6 @@ namespace DXCEnumerateAndCheck { - - $(DXCDLLFolder) diff --git a/util/test/demos/demos.vcxproj.filters b/util/test/demos/demos.vcxproj.filters index bf44ae5ff..0496c145d 100644 --- a/util/test/demos/demos.vcxproj.filters +++ b/util/test/demos/demos.vcxproj.filters @@ -816,9 +816,6 @@ {06e64450-43b4-42d5-bbf3-290c721ae555} - - {e641fa6b-a639-49af-9bc3-387b87bdb066} - {526cfb18-bd0f-41b7-ac73-30a2fc90f449} @@ -972,9 +969,6 @@ 3rdparty\nuklear - - 3rdparty\shaderc - 3rdparty\glad diff --git a/util/test/demos/gl/gl_shader_debug_zoo.cpp b/util/test/demos/gl/gl_shader_debug_zoo.cpp index 57db893f0..3d9a368bd 100644 --- a/util/test/demos/gl/gl_shader_debug_zoo.cpp +++ b/util/test/demos/gl/gl_shader_debug_zoo.cpp @@ -289,9 +289,9 @@ void main() return; if(!SpvCompilationSupported()) - Avail = InternalSpvCompiler() ? "Internal SPIR-V compiler did not initialise" - : "Couldn't find 'glslc' or 'glslangValidator' in PATH - " - "required for SPIR-V compilation"; + Avail = + "Couldn't find 'glslc' or 'glslangValidator' in PATH - " + "required for SPIR-V compilation"; } int main() diff --git a/util/test/demos/gl/gl_spirv_shader.cpp b/util/test/demos/gl/gl_spirv_shader.cpp index 4ec3c1744..5b34c47e4 100644 --- a/util/test/demos/gl/gl_spirv_shader.cpp +++ b/util/test/demos/gl/gl_spirv_shader.cpp @@ -79,9 +79,9 @@ void main() return; if(!SpvCompilationSupported()) - Avail = InternalSpvCompiler() ? "Internal SPIR-V compiler did not initialise" - : "Couldn't find 'glslc' or 'glslangValidator' in PATH - " - "required for SPIR-V compilation"; + Avail = + "Couldn't find 'glslc' or 'glslangValidator' in PATH - " + "required for SPIR-V compilation"; } int main() diff --git a/util/test/demos/test_common.cpp b/util/test/demos/test_common.cpp index ef0102dfb..a2b6b6bd3 100644 --- a/util/test/demos/test_common.cpp +++ b/util/test/demos/test_common.cpp @@ -252,44 +252,10 @@ void LoadXPM(const char **XPM, Texture &tex) } } -#ifndef HAVE_SHADERC -#define HAVE_SHADERC 0 -#endif - -// this define toggles on/off using the linked shaderc. This can be useful for quick testing without -// having to remove the built shaderc files -#define USE_LINKED_SHADERC (1 && HAVE_SHADERC) - -#if !USE_LINKED_SHADERC && defined(ANDROID) -#error "can't execute shaderc on android" -#endif - -#if USE_LINKED_SHADERC -#include -#else -typedef void *shaderc_compiler_t; -#endif - -static shaderc_compiler_t shaderc = NULL; static std::string externalCompiler; -bool InternalSpvCompiler() -{ - return bool(USE_LINKED_SHADERC); -} - bool SpvCompilationSupported() { - if(shaderc) - return true; - -#if USE_LINKED_SHADERC - shaderc = shaderc_compiler_initialize(); -#endif - - if(shaderc) - return true; - for(std::string compiler : {"glslc", "glslangValidator"}) { FILE *pipe = popen((compiler + EXECUTABLE_SUFFIX " --version 2>&1").c_str(), "r"); @@ -322,90 +288,6 @@ std::vector CompileShaderToSpv(const char *demo_name, const std::strin { std::vector ret; - if(shaderc) - { -#if USE_LINKED_SHADERC - static bool logged = false; - - if(!logged) - { - logged = true; - TEST_LOG("Compiling using built-in shaderc"); - } - shaderc_compile_options_t opts = shaderc_compile_options_initialize(); - - if(lang == ShaderLang::glsl) - shaderc_compile_options_set_source_language(opts, shaderc_source_language_glsl); - else if(lang == ShaderLang::hlsl) - shaderc_compile_options_set_source_language(opts, shaderc_source_language_hlsl); - - shaderc_compile_options_set_generate_debug_info(opts); - shaderc_compile_options_set_optimization_level(opts, shaderc_optimization_level_zero); - - shaderc_shader_kind shader_kind = shaderc_glsl_vertex_shader; - - switch(stage) - { - case ShaderStage::vert: shader_kind = shaderc_vertex_shader; break; - case ShaderStage::frag: shader_kind = shaderc_fragment_shader; break; - case ShaderStage::tesscontrol: shader_kind = shaderc_tess_control_shader; break; - case ShaderStage::tesseval: shader_kind = shaderc_tess_evaluation_shader; break; - case ShaderStage::geom: shader_kind = shaderc_geometry_shader; break; - case ShaderStage::comp: shader_kind = shaderc_compute_shader; break; - case ShaderStage::mesh: shader_kind = shaderc_mesh_shader; break; - case ShaderStage::task: shader_kind = shaderc_task_shader; break; - } - - if(target == SPIRVTarget::opengl) - shaderc_compile_options_set_target_env(opts, shaderc_target_env_opengl, 0); - else if(target == SPIRVTarget::vulkan11) - shaderc_compile_options_set_target_env(opts, shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_1); - else if(target == SPIRVTarget::vulkan12) - shaderc_compile_options_set_target_env(opts, shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_2); - - for(auto it : macros) - shaderc_compile_options_add_macro_definition(opts, it.first.c_str(), it.first.length(), - it.second.c_str(), it.second.length()); - - shaderc_compilation_result_t res; - - if(lang == ShaderLang::spvasm) - res = shaderc_assemble_into_spv(shaderc, source_text.c_str(), source_text.size(), opts); - else - res = shaderc_compile_into_spv(shaderc, source_text.c_str(), source_text.size(), shader_kind, - "inshader", entry_point, opts); - - shaderc_compilation_status status = shaderc_result_get_compilation_status(res); - - if(status != shaderc_compilation_status_success) - { - TEST_ERROR("Couldn't compile shader with built-in shaderc: %s", - shaderc_result_get_error_message(res)); - - if(res) - shaderc_result_release(res); - - return ret; - } - - size_t sz = shaderc_result_get_length(res); - - TEST_ASSERT((sz % 4) == 0, "shaderc result isn't 4-byte aligned"); - - ret.resize(sz / 4); - - memcpy(&ret[0], shaderc_result_get_bytes(res), sz); - - shaderc_result_release(res); - - shaderc_compile_options_release(opts); - - return ret; -#endif - } - std::string command_line; std::string path = GetExecutableName(); @@ -567,11 +449,7 @@ void GraphicsTest::Prepare(int argc, char **argv) if(prepared) return; -#if USE_LINKED_SHADERC - TEST_LOG("Using linked shaderc"); -#else TEST_LOG("Requires glslc/shaderc for Vulkan tests"); -#endif prepared = true; diff --git a/util/test/demos/test_common.h b/util/test/demos/test_common.h index 703bfb23c..684e255b7 100644 --- a/util/test/demos/test_common.h +++ b/util/test/demos/test_common.h @@ -83,7 +83,6 @@ enum class ShaderStage task, }; -bool InternalSpvCompiler(); bool SpvCompilationSupported(); std::vector CompileShaderToSpv(const char *demo_name, const std::string &source_text, SPIRVTarget target, ShaderLang lang, ShaderStage stage, diff --git a/util/test/demos/vk/vk_test.cpp b/util/test/demos/vk/vk_test.cpp index 9288e1027..d758baedf 100644 --- a/util/test/demos/vk/vk_test.cpp +++ b/util/test/demos/vk/vk_test.cpp @@ -406,9 +406,9 @@ void VulkanGraphicsTest::Prepare(int argc, char **argv) if(!volk) Avail = "volk did not initialise - vulkan library is not available"; else if(!spv) - Avail = InternalSpvCompiler() ? "Internal SPIR-V compiler did not initialise" - : "Couldn't find 'glslc' or 'glslangValidator' in PATH - " - "required for SPIR-V compilation"; + Avail = + "Couldn't find 'glslc' or 'glslangValidator' in PATH - " + "required for SPIR-V compilation"; else if(instance == VK_NULL_HANDLE) Avail = "Vulkan instance did not initialise"; else if(phys == VK_NULL_HANDLE)