fixed a minor bug in the gl shader parser
This commit is contained in:
@@ -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;
|
||||
|
@@ -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
|
Reference in New Issue
Block a user