[Mesa-dev] [PATCH] i965: Add assertion for src_stencil payload size
Kenneth Graunke
kenneth at whitecape.org
Tue Nov 17 17:54:35 PST 2015
On Monday, November 16, 2015 06:20:57 PM Ben Widawsky wrote:
> This helps address a coverity warning and prevents future questions about this
> code.
>
> Reported-by: Coverity (via Ilia)
> Cc: Matt Turner <mattst88 at gmail.com>
> Cc: Ilia Mirkin <imirkin at alum.mit.edu>
> Signed-off-by: Ben Widawsky <benjamin.widawsky at intel.com>
> ---
> src/mesa/drivers/dri/i965/brw_fs.cpp | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 84b5920..995ab22 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -3603,6 +3603,12 @@ lower_fb_write_logical_send(const fs_builder &bld, fs_inst *inst,
> assert(devinfo->gen >= 9);
> assert(bld.dispatch_width() != 16);
>
> + /* XXX: src_stencil is only available on gen9+. dst_depth is never
> + * available on gen9+. As such it's impossible to have both enabled at the
> + * same time and therefore length cannot overrun the array.
> + */
> + assert(length < 15);
> +
> sources[length] = bld.vgrf(BRW_REGISTER_TYPE_UD);
> bld.exec_all().annotate("FB write OS")
> .emit(FS_OPCODE_PACK_STENCIL_REF, sources[length],
>
I'd drop the XXX, personally, as this is an explanation of why the code
is okay, not a comment meaning "I need to come back and fix this later".
Up to you though.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151117/020e593e/attachment.sig>
More information about the mesa-dev
mailing list