Skip to content

Commit

Permalink
Revert "tools/glsl_preproc: add support for const char variables"
Browse files Browse the repository at this point in the history
This reverts commit fa811a4.
  • Loading branch information
haasn committed Aug 24, 2023
1 parent f7fb586 commit 9826640
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions tools/glsl_preproc/statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
\${ (?:\s*(?P<type>(?: # optional type prefix
ident # identifiers (always dynamic)
| (?:(?:const|dynamic)\s+)? # optional const/dynamic modifiers
(?:float|u?int|char) # base type
(?:float|u?int) # base type
| swizzle # swizzle mask
| (?:i|u)?vecType # vector type (for mask)
)):)?
Expand Down Expand Up @@ -39,9 +39,8 @@ def wrap_fn(fn):
return lambda name: f'{fn}({name})'

VAR_TYPES = {
# identifiers and strings: get mapped as-is
# identifiers: get mapped as-is
'ident': FmtSpec(),
'const char': FmtSpec(ctype='const char *', fmtstr='%s'),

# normal variables: get mapped as shader constants
'int': FmtSpec(wrap_expr=FmtSpec.wrap_var('int')),
Expand Down
13 changes: 6 additions & 7 deletions tools/glsl_preproc/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ class Var(object):
CSIZES = {
# This array doesn't have to be exact, it's only used for sorting
# struct members to save a few bytes of memory here and there
'const char *': 8,
'int': 4,
'unsigned': 4,
'float': 4,
'ident_t': 2,
'uint8_t': 1,
'bool': 1,
'int': 4,
'unsigned': 4,
'float': 4,
'ident_t': 2,
'uint8_t': 1,
'bool': 1,
}

def __init__(self, ctype, expr, name, csize=0, linenr=0):
Expand Down

0 comments on commit 9826640

Please sign in to comment.