[Mesa-dev] [PATCH v3 20/34] intel/compiler: Add functions to get prog_data and prog_key sizes for a stage
Kenneth Graunke
kenneth at whitecape.org
Tue Oct 24 06:27:47 UTC 2017
On Sunday, October 22, 2017 1:01:28 PM PDT Jordan Justen wrote:
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
> src/intel/compiler/brw_compiler.c | 36 ++++++++++++++++++++++++++++++++++++
> src/intel/compiler/brw_compiler.h | 6 ++++++
> 2 files changed, 42 insertions(+)
>
> diff --git a/src/intel/compiler/brw_compiler.c b/src/intel/compiler/brw_compiler.c
> index 2f6af7d2c3f..33046dc906c 100644
> --- a/src/intel/compiler/brw_compiler.c
> +++ b/src/intel/compiler/brw_compiler.c
> @@ -168,3 +168,39 @@ brw_compiler_create(void *mem_ctx, const struct gen_device_info *devinfo)
>
> return compiler;
> }
> +
> +size_t
Can we just use "unsigned" here instead of size_t? size_t can be either
4 bytes (x86) or 8 bytes (amd64), and you have to use the semi-standard
%zu to print it...generally a pain to deal with, and not useful here.
Otherwise,
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> +brw_prog_data_size(gl_shader_stage stage)
> +{
> + STATIC_ASSERT(MESA_SHADER_VERTEX == 0);
> + STATIC_ASSERT(MESA_SHADER_TESS_CTRL == 1);
> + STATIC_ASSERT(MESA_SHADER_TESS_EVAL == 2);
> + STATIC_ASSERT(MESA_SHADER_GEOMETRY == 3);
> + STATIC_ASSERT(MESA_SHADER_FRAGMENT == 4);
> + STATIC_ASSERT(MESA_SHADER_COMPUTE == 5);
> + static const size_t stage_sizes[] = {
> + sizeof(struct brw_vs_prog_data),
> + sizeof(struct brw_tcs_prog_data),
> + sizeof(struct brw_tes_prog_data),
> + sizeof(struct brw_gs_prog_data),
> + sizeof(struct brw_wm_prog_data),
> + sizeof(struct brw_cs_prog_data),
> + };
> + assert((int)stage >= 0 && stage < ARRAY_SIZE(stage_sizes));
> + return stage_sizes[stage];
> +}
> +
> +size_t
> +brw_prog_key_size(gl_shader_stage stage)
> +{
> + static const size_t stage_sizes[] = {
> + sizeof(struct brw_vs_prog_key),
> + sizeof(struct brw_tcs_prog_key),
> + sizeof(struct brw_tes_prog_key),
> + sizeof(struct brw_gs_prog_key),
> + sizeof(struct brw_wm_prog_key),
> + sizeof(struct brw_cs_prog_key),
> + };
> + assert((int)stage >= 0 && stage < ARRAY_SIZE(stage_sizes));
> + return stage_sizes[stage];
> +}
> diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h
> index 9359b767e35..68a12a43370 100644
> --- a/src/intel/compiler/brw_compiler.h
> +++ b/src/intel/compiler/brw_compiler.h
> @@ -1107,6 +1107,12 @@ DEFINE_PROG_DATA_DOWNCAST(sf)
> struct brw_compiler *
> brw_compiler_create(void *mem_ctx, const struct gen_device_info *devinfo);
>
> +size_t
> +brw_prog_data_size(gl_shader_stage stage);
> +
> +size_t
> +brw_prog_key_size(gl_shader_stage stage);
> +
> /**
> * Compile a vertex shader.
> *
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171023/440389c8/attachment.sig>
More information about the mesa-dev
mailing list