101e04c3fSmrg/*
201e04c3fSmrg * Copyright 2017 Advanced Micro Devices, Inc.
301e04c3fSmrg * All Rights Reserved.
401e04c3fSmrg *
501e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
601e04c3fSmrg * copy of this software and associated documentation files (the "Software"),
701e04c3fSmrg * to deal in the Software without restriction, including without limitation
801e04c3fSmrg * on the rights to use, copy, modify, merge, publish, distribute, sub
901e04c3fSmrg * license, and/or sell copies of the Software, and to permit persons to whom
1001e04c3fSmrg * the Software is furnished to do so, subject to the following conditions:
1101e04c3fSmrg *
1201e04c3fSmrg * The above copyright notice and this permission notice (including the next
1301e04c3fSmrg * paragraph) shall be included in all copies or substantial portions of the
1401e04c3fSmrg * Software.
1501e04c3fSmrg *
1601e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1701e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1801e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
1901e04c3fSmrg * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
2001e04c3fSmrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2101e04c3fSmrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2201e04c3fSmrg * USE OR OTHER DEALINGS IN THE SOFTWARE.
2301e04c3fSmrg */
2401e04c3fSmrg
2501e04c3fSmrg#ifndef SI_COMPUTE_H
2601e04c3fSmrg#define SI_COMPUTE_H
2701e04c3fSmrg
2801e04c3fSmrg#include "si_shader.h"
297ec681f3Smrg#include "util/u_inlines.h"
3001e04c3fSmrg
3101e04c3fSmrgstruct si_compute {
327ec681f3Smrg   struct si_shader_selector sel;
337ec681f3Smrg   struct si_shader shader;
3401e04c3fSmrg
357ec681f3Smrg   unsigned ir_type;
367ec681f3Smrg   unsigned private_size;
377ec681f3Smrg   unsigned input_size;
3801e04c3fSmrg
397ec681f3Smrg   int max_global_buffers;
407ec681f3Smrg   struct pipe_resource **global_buffers;
4101e04c3fSmrg};
4201e04c3fSmrg
4301e04c3fSmrgvoid si_destroy_compute(struct si_compute *program);
4401e04c3fSmrg
457ec681f3Smrgstatic inline void si_compute_reference(struct si_compute **dst, struct si_compute *src)
4601e04c3fSmrg{
477ec681f3Smrg   if (pipe_reference(&(*dst)->sel.base.reference, &src->sel.base.reference))
487ec681f3Smrg      si_destroy_compute(*dst);
4901e04c3fSmrg
507ec681f3Smrg   *dst = src;
5101e04c3fSmrg}
5201e04c3fSmrg
5301e04c3fSmrg#endif /* SI_COMPUTE_H */
54