Path: blob/21.2-virgl/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.h
4574 views
/*1* Copyright (C) 2016 Rob Clark <[email protected]>2* Copyright © 2018 Google, Inc.3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* the rights to use, copy, modify, merge, publish, distribute, sublicense,8* and/or sell copies of the Software, and to permit persons to whom the9* Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice (including the next12* paragraph) shall be included in all copies or substantial portions of the13* Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL18* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER19* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,20* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE21* SOFTWARE.22*23* Authors:24* Rob Clark <[email protected]>25*/2627#ifndef FD6_RASTERIZER_H_28#define FD6_RASTERIZER_H_2930#include "pipe/p_context.h"31#include "pipe/p_state.h"3233#include "freedreno_context.h"3435struct fd6_rasterizer_stateobj {36struct pipe_rasterizer_state base;3738struct fd_ringbuffer *stateobjs[2];39};4041static inline struct fd6_rasterizer_stateobj *42fd6_rasterizer_stateobj(struct pipe_rasterizer_state *rast)43{44return (struct fd6_rasterizer_stateobj *)rast;45}4647void *fd6_rasterizer_state_create(struct pipe_context *pctx,48const struct pipe_rasterizer_state *cso);49void fd6_rasterizer_state_delete(struct pipe_context *, void *hwcso);5051struct fd_ringbuffer *52__fd6_setup_rasterizer_stateobj(struct fd_context *ctx,53const struct pipe_rasterizer_state *cso,54bool primitive_restart);5556static inline struct fd_ringbuffer *57fd6_rasterizer_state(struct fd_context *ctx, bool primitive_restart) assert_dt58{59struct fd6_rasterizer_stateobj *rasterizer =60fd6_rasterizer_stateobj(ctx->rasterizer);61unsigned variant = primitive_restart;6263if (unlikely(!rasterizer->stateobjs[variant])) {64rasterizer->stateobjs[variant] = __fd6_setup_rasterizer_stateobj(65ctx, ctx->rasterizer, primitive_restart);66}6768return rasterizer->stateobjs[variant];69}7071#endif /* FD6_RASTERIZER_H_ */727374