From ab08c2c3f29b425d99d349bdb6218f955da73545 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Tue, 29 Oct 2013 06:01:19 -0700 Subject: [PATCH] fixed a minor bug in the gl shader parser --- libobs-d3d11/makefile | 51 ------------------------- libobs-opengl/gl-shaderparser.c | 25 +++++++----- libobs-opengl/makefile | 48 ----------------------- libobs/makefile | 68 --------------------------------- libobs/obs.c | 2 +- test/makefile | 13 ------- test/test-input/makefile | 33 ---------------- test/win/makefile | 35 ----------------- test/win/test.cpp | 4 +- 9 files changed, 19 insertions(+), 260 deletions(-) delete mode 100644 libobs-d3d11/makefile delete mode 100644 libobs-opengl/makefile delete mode 100644 libobs/makefile delete mode 100644 test/makefile delete mode 100644 test/test-input/makefile delete mode 100644 test/win/makefile diff --git a/libobs-d3d11/makefile b/libobs-d3d11/makefile deleted file mode 100644 index a11fd1af7..000000000 --- a/libobs-d3d11/makefile +++ /dev/null @@ -1,51 +0,0 @@ -include ../config.mak - -all: default - -SRCFILES=GS_D3D11SubSystem.cpp \ - GS_D3D11IndexBuffer.cpp \ - GS_D3D11Shader.cpp \ - GS_D3D11ShaderProcessor.cpp \ - GS_D3D11StageSurf.cpp \ - GS_D3D11Texture2D.cpp \ - GS_D3D11VertexBuffer.cpp \ - GS_D3D11ZStencilBuffer.cpp - -SONAME=../build/libobs-d3d11.$(SOEXT) - -LD=g++ -o - -CPPFLAGS += -iquote $(BASEINC) -CPPFLAGS += -iquote ../libobs-graphics/ -CPPFLAGS += -isystem ./mingw/ - -LDFLAGS += -L../build/ - -ifdef monolithic -LDFLAGS += -lobs -else -LDFLAGS += -lobs-util -lobs-graphics -endif - -.PHONY: all monolithic default clean - -OBJS += $(SRCFILES:%.cpp=%.$(OBJ)) - -default: $(SONAME) - -$(SONAME): .depend $(OBJS) - $(LD)$@ $(LDFLAGS) $(OBJS) - -.depend: - @rm -f .depend - @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCFILES)), $(CCDEP) \ - -std=c++11 $(CPPFLAGS) $(SRC) -I$(BASEINC) \ - -MT $(SRC:$(SRCPATH)/%.cpp=%.$(OBJ)) -MM 1>> .depend;) - -depend: .depend -ifneq ($(wildcard .depend),) -include .depend -endif - -clean: - rm -f $(OBJS) $(SONAME) *.a *.lib *.exp *.pdb .depend diff --git a/libobs-opengl/gl-shaderparser.c b/libobs-opengl/gl-shaderparser.c index 84712131d..8625c309c 100644 --- a/libobs-opengl/gl-shaderparser.c +++ b/libobs-opengl/gl-shaderparser.c @@ -47,26 +47,33 @@ static inline size_t sp_getsampler(struct gl_shader_parser *glsp, return -1; } +static inline int cmp_type(const char *name, const size_t name_len, + const char *type, const size_t type_len) +{ + size_t min_len = (name_len < type_len) ? type_len : name_len; + return astrcmp_n(name, type, min_len); +} + static bool gl_write_type_n(struct gl_shader_parser *glsp, const char *type, size_t len) { - if (astrcmp_n(type, "float2", len) == 0) + if (cmp_type(type, len, "float2", 6) == 0) dstr_cat(&glsp->gl_string, "vec2"); - else if (astrcmp_n(type, "float3", len) == 0) + else if (cmp_type(type, len, "float3", 6) == 0) dstr_cat(&glsp->gl_string, "vec3"); - else if (astrcmp_n(type, "float4", len) == 0) + else if (cmp_type(type, len, "float4", 6) == 0) dstr_cat(&glsp->gl_string, "vec4"); - else if (astrcmp_n(type, "float3x3", len) == 0) + else if (cmp_type(type, len, "float3x3", 8) == 0) dstr_cat(&glsp->gl_string, "mat3x3"); - else if (astrcmp_n(type, "float3x4", len) == 0) + else if (cmp_type(type, len, "float3x4", 8) == 0) dstr_cat(&glsp->gl_string, "mat3x4"); - else if (astrcmp_n(type, "float4x4", len) == 0) + else if (cmp_type(type, len, "float4x4", 8) == 0) dstr_cat(&glsp->gl_string, "mat4x4"); - else if (astrcmp_n(type, "texture2d", len) == 0) + else if (cmp_type(type, len, "texture2d", 9) == 0) dstr_cat(&glsp->gl_string, "sampler2D"); - else if (astrcmp_n(type, "texture3d", len) == 0) + else if (cmp_type(type, len, "texture3d", 9) == 0) dstr_cat(&glsp->gl_string, "sampler3D"); - else if (astrcmp_n(type, "texture_cube", len) == 0) + else if (cmp_type(type, len, "texture_cube", 12) == 0) dstr_cat(&glsp->gl_string, "samplerCube"); else return false; diff --git a/libobs-opengl/makefile b/libobs-opengl/makefile deleted file mode 100644 index d99866be1..000000000 --- a/libobs-opengl/makefile +++ /dev/null @@ -1,48 +0,0 @@ -include ../config.mak - -.PHONY: all default clean - -all: default - -SRCFILES=gl-subsystem.c \ - gl-windows.c \ - gl-vertexbuffer.c \ - gl-texturecube.c \ - gl-texture2d.c \ - gl-stagesurf.c \ - gl-shaderparser.c \ - gl-shader.c \ - gl-indexbuffer.c \ - gl-zstencil.c \ - gl-helpers.c - -SONAME=../build/libobs-opengl.$(SOEXT) - -OBJS += $(SRCFILES:%.c=%.$(OBJ)) - -CPPFLAGS += -iquote../libobs -DGLEW_STATIC -LDFLAGS += -Lglew/lib -Wl,-Bstatic -lglew32 -Wl,-Bdynamic -lopengl32 \ - -Wl,--subsystem,windows -mwindows -L../build -lobs -lpthread - -default: makeglew $(SONAME) - -makeglew: glew - make -C glew glew.lib - -.depend: - @rm -f .depend - @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCFILES)), $(CCDEP) \ - $(CPPFLAGS) $(SRC) \ - -MT $(SRC:$(SRCPATH)/%.c=%.$(OBJ)) -MM 1>> .depend;) - -$(SONAME): .depend $(OBJS) - $(LD)$@ $(OBJS) $(LDFLAGS) - -depend: .depend -ifneq ($(wildcard .depend),) -include .depend -endif - -clean: - rm -f $(OBJS) $(SONAME) *.a *.lib *.exp *.pdb .depend - make clean -C glew diff --git a/libobs/makefile b/libobs/makefile deleted file mode 100644 index 6ac9dd272..000000000 --- a/libobs/makefile +++ /dev/null @@ -1,68 +0,0 @@ -include ../config.mak - -.PHONY: all default clean - -all: default - -SRCFILES=util/bmem.c \ - util/base.c \ - util/dstr.c \ - util/lexer.c \ - util/utf8.c \ - util/text-lookup.c \ - util/platform.c \ - util/platform-windows.c \ - util/config-file.c \ - util/cf-lexer.c \ - util/cf-parser.c \ - graphics/axisang.c \ - graphics/bounds.c \ - graphics/effect.c \ - graphics/effect-parser.c \ - graphics/graphics.c \ - graphics/graphics-imports.c \ - graphics/math-extra.c \ - graphics/matrix3.c \ - graphics/matrix4.c \ - graphics/plane.c \ - graphics/quat.c \ - graphics/shader-parser.c \ - graphics/texture-render.c \ - graphics/vec2.c \ - graphics/vec3.c \ - graphics/vec4.c \ - media-io/video-io.c \ - media-io/audio-io.c \ - media-io/media-io.c \ - media-io/format-conversion.c \ - obs-module.c \ - obs-output.c \ - obs-source.c \ - obs-scene.c \ - obs-display.c \ - obs-video.c \ - obs.c - -SONAME=../build/libobs.$(SOEXT) - -OBJS += $(SRCFILES:%.c=%.$(OBJ)) -LDFLAGS += -lpthread - -default: $(SONAME) - -.depend: - @rm -f .depend - @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCFILES)), $(CCDEP) \ - $(CPPFLAGS) $(SRC) \ - -MT $(SRC:$(SRCPATH)/%.c=%.$(OBJ)) -MM 1>> .depend;) - -$(SONAME): .depend $(OBJS) - $(LD)$@ $(LDFLAGS) $(OBJS) - -depend: .depend -ifneq ($(wildcard .depend),) -include .depend -endif - -clean: - rm -f $(OBJS) $(SONAME) *.a *.lib *.exp *.pdb .depend diff --git a/libobs/obs.c b/libobs/obs.c index 27b1007bd..d5f4de821 100644 --- a/libobs/obs.c +++ b/libobs/obs.c @@ -47,7 +47,7 @@ static bool obs_init_graphics(const char *graphics_module, if (success) { obs->default_effect = gs_create_effect_from_file( - "build/data/default.effect", NULL); + "data/effects/default.effect", NULL); if (!obs->default_effect) success = false; } diff --git a/test/makefile b/test/makefile deleted file mode 100644 index e89894583..000000000 --- a/test/makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../config.mak - -all: default - -PROJECTS=test-input win - -.PHONY: all default clean - -default: $(PROJECTS) - @$(foreach PROJECT, $(PROJECTS), $(MAKE) -C $(PROJECT);) - -clean: $(PROJECTS) - @$(foreach PROJECT, $(PROJECTS), $(MAKE) clean -C $(PROJECT);) diff --git a/test/test-input/makefile b/test/test-input/makefile deleted file mode 100644 index d23faaeb4..000000000 --- a/test/test-input/makefile +++ /dev/null @@ -1,33 +0,0 @@ -include ../../config.mak - -.PHONY: all default clean - -all: default - -SRCFILES=test-filter.c test-input.c test-random.c - -SONAME=../../build/test-input.$(SOEXT) - -OBJS += $(SRCFILES:%.c=%.$(OBJ)) - -CPPFLAGS += -iquote../../libobs -LDFLAGS += -L../../build -lobs - -default: $(SONAME) - -.depend: - @rm -f .depend - @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCFILES)), $(CCDEP) \ - $(CPPFLAGS) $(SRC) \ - -MT $(SRC:$(SRCPATH)/%.c=%.$(OBJ)) -MM 1>> .depend;) - -$(SONAME): .depend $(OBJS) - $(LD)$@ $(LDFLAGS) $(OBJS) - -depend: .depend -ifneq ($(wildcard .depend),) -include .depend -endif - -clean: - rm -f $(OBJS) $(SONAME) *.a *.lib *.exp *.pdb .depend diff --git a/test/win/makefile b/test/win/makefile deleted file mode 100644 index a1ac2ec3d..000000000 --- a/test/win/makefile +++ /dev/null @@ -1,35 +0,0 @@ -include ../../config.mak - -.PHONY: all default clean - -all: default - -SRCFILES=test.cpp - -NAME=../../build/wintest$(EXT) - -OBJS += $(SRCFILES:%.cpp=%.$(OBJ)) - -LD=g++ -o -LDFLAGS=-L../../build -lobs -Wl,--subsystem,windows - -CPPFLAGS += -I../../libobs -DUNICODE -D_UNICODE - -default: $(NAME) - -.depend: - @rm -f .depend - @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCFILES)), $(CCDEP) \ - $(CPPFLAGS) $(SRC) \ - -MT $(SRC:$(SRCPATH)/%.c=%.$(OBJ)) -MM 1>> .depend;) - -$(NAME): .depend $(OBJS) - $(LD)$@ $(LDFLAGS) $(OBJS) - -depend: .depend -ifneq ($(wildcard .depend),) -include .depend -endif - -clean: - rm -f $(OBJS) $(NAME) *.a *.lib *.exp *.pdb .depend diff --git a/test/win/test.cpp b/test/win/test.cpp index 10cf60567..600715760 100644 --- a/test/win/test.cpp +++ b/test/win/test.cpp @@ -58,8 +58,8 @@ static void do_log(enum log_type type, const char *msg, va_list args) OutputDebugStringA(bla); OutputDebugStringA("\n"); - /*if (type >= LOG_WARNING) - __debugbreak();*/ + if (type >= LOG_WARNING) + __debugbreak(); } static void CreateOBS(HWND hwnd) -- GitLab