mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 02:20:11 +01:00
intel/isl/format: Dedent the template in gen_format_layout.py
This makes it much easier to edit the template and doesn't really dirty the python all that much. Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
parent
dd75edb429
commit
44e9d65757
1 changed files with 53 additions and 54 deletions
|
|
@ -32,64 +32,63 @@ from mako import template
|
|||
# Load the template, ensure that __future__.division is imported, and set the
|
||||
# bytes encoding to be utf-8. This last bit is important to getting simple
|
||||
# consistent behavior for python 3 when we get there.
|
||||
TEMPLATE = template.Template(
|
||||
text=textwrap.dedent("""\
|
||||
/* This file is autogenerated by gen_format_layout.py. DO NOT EDIT! */
|
||||
TEMPLATE = template.Template(future_imports=['division'],
|
||||
output_encoding='utf-8',
|
||||
text="""\
|
||||
/* This file is autogenerated by gen_format_layout.py. DO NOT EDIT! */
|
||||
|
||||
/*
|
||||
* Copyright 2015 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2015 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "isl/isl.h"
|
||||
#include "isl/isl.h"
|
||||
|
||||
const struct isl_format_layout
|
||||
isl_format_layouts[] = {
|
||||
% for format in formats:
|
||||
[ISL_FORMAT_${format.name}] = {
|
||||
.format = ISL_FORMAT_${format.name},
|
||||
.name = "ISL_FORMAT_${format.name}",
|
||||
.bpb = ${format.bpb},
|
||||
.bw = ${format.bw},
|
||||
.bh = ${format.bh},
|
||||
.bd = ${format.bd},
|
||||
.channels = {
|
||||
% for mask in ['r', 'g', 'b', 'a', 'l', 'i', 'p']:
|
||||
<% channel = getattr(format, mask, None) %>\\
|
||||
% if channel.type is not None:
|
||||
.${mask} = { ISL_${channel.type}, ${channel.size} },
|
||||
% else:
|
||||
.${mask} = {},
|
||||
% endif
|
||||
% endfor
|
||||
},
|
||||
.colorspace = ISL_COLORSPACE_${format.colorspace},
|
||||
.txc = ISL_TXC_${format.txc},
|
||||
},
|
||||
const struct isl_format_layout
|
||||
isl_format_layouts[] = {
|
||||
% for format in formats:
|
||||
[ISL_FORMAT_${format.name}] = {
|
||||
.format = ISL_FORMAT_${format.name},
|
||||
.name = "ISL_FORMAT_${format.name}",
|
||||
.bpb = ${format.bpb},
|
||||
.bw = ${format.bw},
|
||||
.bh = ${format.bh},
|
||||
.bd = ${format.bd},
|
||||
.channels = {
|
||||
% for mask in ['r', 'g', 'b', 'a', 'l', 'i', 'p']:
|
||||
<% channel = getattr(format, mask, None) %>\\
|
||||
% if channel.type is not None:
|
||||
.${mask} = { ISL_${channel.type}, ${channel.size} },
|
||||
% else:
|
||||
.${mask} = {},
|
||||
% endif
|
||||
% endfor
|
||||
},
|
||||
.colorspace = ISL_COLORSPACE_${format.colorspace},
|
||||
.txc = ISL_TXC_${format.txc},
|
||||
},
|
||||
|
||||
% endfor
|
||||
};
|
||||
"""),
|
||||
future_imports=['division'],
|
||||
output_encoding='utf-8')
|
||||
% endfor
|
||||
};
|
||||
""")
|
||||
|
||||
|
||||
class Channel(object):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue