mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-09 04:38:30 +09:00
[Chore] (MG_Test/Program): rename previous ProgramTest to ProgramUtilTest
This commit is contained in:
@@ -53,8 +53,8 @@ endif()
|
||||
|
||||
|
||||
add_executable(
|
||||
ProgramTest
|
||||
ProgramTest.cpp
|
||||
ProgramUtilTest
|
||||
ProgramUtilTest.cpp
|
||||
|
||||
${MGL_ROOT}/MobileGL/MG_Util/Converters/GLToStr/GLEnumConverter.cpp
|
||||
${MGL_ROOT}/MobileGL/MG_Util/Converters/GLToGlslang/GLShaderLangConverter.cpp
|
||||
@@ -62,16 +62,16 @@ add_executable(
|
||||
${MGL_ROOT}/MobileGL/MG_Util/ShaderTranspiler/SpvcSession.cpp
|
||||
)
|
||||
|
||||
target_include_directories(ProgramTest PRIVATE
|
||||
target_include_directories(ProgramUtilTest PRIVATE
|
||||
${MGL_ROOT}/include
|
||||
${MGL_ROOT}/MobileGL
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
ProgramTest
|
||||
ProgramUtilTest
|
||||
GTest::gtest_main
|
||||
${LINK_LIBRARIES}
|
||||
)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(ProgramTest)
|
||||
gtest_discover_tests(ProgramUtilTest)
|
||||
+7
-7
@@ -6,11 +6,11 @@
|
||||
#include "Includes.h"
|
||||
using namespace MobileGL;
|
||||
|
||||
class ProgramTest : public ::testing::Test {
|
||||
class ProgramUtilTest : public ::testing::Test {
|
||||
protected:
|
||||
};
|
||||
|
||||
TEST_F(ProgramTest, Sanity) {
|
||||
TEST_F(ProgramUtilTest, Sanity) {
|
||||
ASSERT_TRUE(true);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void main(){
|
||||
texCoord = Position.xy / OutSize;
|
||||
})";
|
||||
|
||||
TEST_F(ProgramTest, CompileSimpleVertexShader) {
|
||||
TEST_F(ProgramUtilTest, CompileSimpleVertexShader) {
|
||||
using namespace MG_Util::ShaderTranspiler;
|
||||
ShaderAttrib attrib {
|
||||
.shaderType = GL_VERTEX_SHADER,
|
||||
@@ -86,7 +86,7 @@ void main() {
|
||||
fragColor = vec4(OutColor, 1.0);
|
||||
})";
|
||||
|
||||
TEST_F(ProgramTest, CompileSimpleFragmentShader) {
|
||||
TEST_F(ProgramUtilTest, CompileSimpleFragmentShader) {
|
||||
using namespace MG_Util::ShaderTranspiler;
|
||||
ShaderAttrib attrib {
|
||||
.shaderType = GL_FRAGMENT_SHADER,
|
||||
@@ -115,7 +115,7 @@ void main() {
|
||||
fragColor = color * ColorModulator;
|
||||
})";
|
||||
|
||||
TEST_F(ProgramTest, CompileFragmentShaderWithDiscard) {
|
||||
TEST_F(ProgramUtilTest, CompileFragmentShaderWithDiscard) {
|
||||
using namespace MG_Util::ShaderTranspiler;
|
||||
ShaderAttrib attrib {
|
||||
.shaderType = GL_FRAGMENT_SHADER,
|
||||
@@ -162,7 +162,7 @@ TEST_F(ProgramTest, CompileFragmentShaderWithDiscard) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProgramTest, CompileAndLinkProgram) {
|
||||
TEST_F(ProgramUtilTest, CompileAndLinkProgram) {
|
||||
using namespace MG_Util::ShaderTranspiler;
|
||||
ShaderAttrib vs_attrib {
|
||||
.shaderType = GL_VERTEX_SHADER,
|
||||
@@ -196,7 +196,7 @@ TEST_F(ProgramTest, CompileAndLinkProgram) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProgramTest, DecompProgram) {
|
||||
TEST_F(ProgramUtilTest, DecompProgram) {
|
||||
using namespace MG_Util::ShaderTranspiler;
|
||||
ShaderAttrib vs_attrib {
|
||||
.shaderType = GL_VERTEX_SHADER,
|
||||
@@ -114,7 +114,7 @@ namespace MobileGL {
|
||||
|
||||
Result<SharedPtr<glslang::TShader>> ShaderCompiler::CompileShader(const ShaderAttrib& attrib) {
|
||||
auto shaderType = attrib.shaderType;
|
||||
auto sourceStr = attrib.sourceStr;
|
||||
auto& sourceStr = attrib.sourceStr;
|
||||
|
||||
auto lang = GetEShLanguageByShaderType(shaderType);
|
||||
if (lang == EShLanguage::EShLangCount) {
|
||||
@@ -128,7 +128,7 @@ namespace MobileGL {
|
||||
SharedPtr<glslang::TShader> res;
|
||||
auto& tshader = res;
|
||||
tshader = MakeShared<glslang::TShader>(lang);
|
||||
const char* src[] = { sourceStr.c_str() };
|
||||
const char* src[] = { sourceStr.data() };
|
||||
tshader->setStrings(src, 1);
|
||||
tshader->setInvertY(true);
|
||||
tshader->setEnvInput(glslang::EShSourceGlsl, lang, glslang::EShClientVulkan, 450);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace MobileGL {
|
||||
|
||||
struct ShaderAttrib {
|
||||
GLenum shaderType;
|
||||
String sourceStr;
|
||||
StringView sourceStr;
|
||||
Flags<ShaderCompileBits> flags;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
#define GL_UNKNOWN_MGL 0
|
||||
|
||||
#define THROW_EXCEPTION(msg) \
|
||||
throw std::runtime_error(msg);
|
||||
|
||||
#define THROW_UNIMPL_EXCEPTION \
|
||||
THROW_EXCEPTION("Unimplemented function called!")
|
||||
|
||||
namespace MobileGL {
|
||||
using String = std::string;
|
||||
using StringStream = std::stringstream;
|
||||
@@ -18,6 +24,7 @@ namespace MobileGL {
|
||||
using Bool = bool;
|
||||
using Float = float;
|
||||
using Double = double;
|
||||
using StringView = std::string_view;
|
||||
template <typename T>
|
||||
using Vector = std::vector<T>;
|
||||
template <typename T, typename N>
|
||||
|
||||
Reference in New Issue
Block a user