finish up GLSL conversion stuff and make some minor tweaks to shader parser

This commit is contained in:
jp9000
2013-10-08 13:36:15 -07:00
parent f9d1a4b9ed
commit 34357f00fb
6 changed files with 305 additions and 38 deletions

View File

@@ -971,8 +971,6 @@ static inline void ep_write_param(struct dstr *shader, struct ep_param *param,
struct dstr new;
dstr_init_copy(&new, param->name);
darray_push_back(sizeof(struct dstr), used_params, &new);
dstr_cat(shader, "uniform ");
}
dstr_cat(shader, param->type);

View File

@@ -304,8 +304,7 @@ error:
static inline int sp_check_for_keyword(struct shader_parser *sp,
const char *keyword, bool *val)
{
bool new_val;
new_val = token_is(&sp->cfp, keyword);
bool new_val = token_is(&sp->cfp, keyword);
if (new_val) {
if (!next_valid_token(&sp->cfp))
return PARSE_EOF;
@@ -325,7 +324,7 @@ static inline int sp_parse_func_param(struct shader_parser *sp,
struct shader_func *func, struct shader_var *var)
{
int errcode;
bool is_uniform;
bool is_uniform = false;
if (!next_valid_token(&sp->cfp))
return PARSE_EOF;
@@ -418,7 +417,7 @@ static void sp_parse_function(struct shader_parser *sp, char *type, char *name)
if (errorcode != PARSE_SUCCESS)
goto error;
func.return_mapping = mapping;
func.mapping = mapping;
if (!next_valid_token(&sp->cfp))
goto error;

View File

@@ -141,10 +141,10 @@ static inline void shader_struct_free(struct shader_struct *ss)
struct shader_func {
char *name;
char *return_type;
char *return_mapping;
char *mapping;
DARRAY(struct shader_var) params;
const struct cf_token *start, *end;
struct cf_token *start, *end;
};
static inline void shader_func_init(struct shader_func *sf,
@@ -153,7 +153,7 @@ static inline void shader_func_init(struct shader_func *sf,
da_init(sf->params);
sf->return_type = return_type;
sf->return_mapping = NULL;
sf->mapping = NULL;
sf->name = name;
sf->start = NULL;
sf->end = NULL;
@@ -168,7 +168,7 @@ static inline void shader_func_free(struct shader_func *sf)
bfree(sf->name);
bfree(sf->return_type);
bfree(sf->return_mapping);
bfree(sf->mapping);
da_free(sf->params);
}