fix effect parser to properly parse and output uniform variables
This commit is contained in:
parent
d67354f53e
commit
20490010e9
@ -819,7 +819,7 @@ static void ep_parse_param(struct effect_parser *ep,
|
||||
bool is_property, bool is_const, bool is_uniform)
|
||||
{
|
||||
struct ep_param param;
|
||||
ep_param_init(¶m, type, name, is_property, is_const);
|
||||
ep_param_init(¶m, type, name, is_property, is_const, is_uniform);
|
||||
|
||||
if (token_is(&ep->cfp, ";"))
|
||||
goto complete;
|
||||
@ -967,10 +967,12 @@ static inline void ep_write_param(struct dstr *shader, struct ep_param *param,
|
||||
|
||||
if (param->is_const) {
|
||||
dstr_cat(shader, "const ");
|
||||
} else {
|
||||
} else if (param->is_uniform) {
|
||||
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);
|
||||
@ -1310,6 +1312,7 @@ static inline void ep_compile_pass_shaderparams(struct effect_parser *ep,
|
||||
for (i = 0; i < pass_params->num; i++) {
|
||||
struct dstr *param_name;
|
||||
struct pass_shaderparam *param;
|
||||
int test;
|
||||
|
||||
param_name = darray_item(sizeof(struct dstr), used_params, i);
|
||||
param = darray_item(sizeof(struct pass_shaderparam),
|
||||
|
@ -63,7 +63,7 @@ struct ep_param {
|
||||
DARRAY(uint8_t) default_val;
|
||||
DARRAY(char*) properties;
|
||||
struct effect_param *param;
|
||||
bool is_const, is_property, is_texture, written;
|
||||
bool is_const, is_property, is_uniform, is_texture, written;
|
||||
int writeorder, array_count;
|
||||
};
|
||||
|
||||
@ -71,12 +71,13 @@ extern void ep_param_writevar(struct dstr *dst, struct darray *use_params);
|
||||
|
||||
static inline void ep_param_init(struct ep_param *epp,
|
||||
char *type, char *name,
|
||||
bool is_property, bool is_const)
|
||||
bool is_property, bool is_const, bool is_uniform)
|
||||
{
|
||||
epp->type = type;
|
||||
epp->name = name;
|
||||
epp->is_property = is_property;
|
||||
epp->is_const = is_const;
|
||||
epp->is_uniform = is_uniform;
|
||||
epp->is_texture = (astrcmp_n(epp->type, "texture", 7) == 0);
|
||||
epp->written = false;
|
||||
epp->writeorder = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user