mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
nouveau/parser: Better dump float data
For now, we only do something with floats when we dump. You still need to use fui() when setting them. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
parent
bbdd35f155
commit
68403e5742
1 changed files with 23 additions and 1 deletions
|
|
@ -47,6 +47,17 @@ METHOD_ARRAY_SIZES = {
|
|||
'BIND_GROUP_CONSTANT_BUFFER': 16,
|
||||
}
|
||||
|
||||
METHOD_IS_FLOAT = [
|
||||
'SET_BLEND_CONST_*',
|
||||
'SET_DEPTH_BIAS',
|
||||
'SET_LINE_WIDTH_FLOAT',
|
||||
'SET_ALIASED_LINE_WIDTH_FLOAT',
|
||||
'SET_VIEWPORT_SCALE_*',
|
||||
'SET_VIEWPORT_OFFSET_*',
|
||||
'SET_VIEWPORT_CLIP_MIN_Z',
|
||||
'SET_VIEWPORT_CLIP_MAX_Z',
|
||||
]
|
||||
|
||||
def glob_match(glob, name):
|
||||
if glob.endswith('*'):
|
||||
return name.startswith(glob[:-1])
|
||||
|
|
@ -62,6 +73,14 @@ class method(object):
|
|||
return value
|
||||
return 0
|
||||
|
||||
@property
|
||||
def is_float(self):
|
||||
for glob in METHOD_IS_FLOAT:
|
||||
if glob_match(glob, self.name):
|
||||
assert len(self.field_defs) == 1
|
||||
return True
|
||||
return False
|
||||
|
||||
# Simple state machine
|
||||
# state 0 looking for a new method define
|
||||
# state 1 looking for new fields in a method
|
||||
|
|
@ -237,7 +256,10 @@ for mthd in mthddict:
|
|||
print("\t\t\tbreak;")
|
||||
print("\t\t}")
|
||||
else:
|
||||
print("\t\tprintf(\"0x%x\\n\", parsed);")
|
||||
if mthddict[mthd].is_float:
|
||||
print("\t\t\tprintf(\"%ff (0x%x)\\n\", *(float *)&parsed, parsed);")
|
||||
else:
|
||||
print("\t\tprintf(\"0x%x\\n\", parsed);")
|
||||
print("\t\tbreak;")
|
||||
|
||||
print("\tdefault:")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue