Path: blob/21.2-virgl/src/gallium/drivers/freedreno/a6xx/fd6_zsa.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_ZSA_H_28#define FD6_ZSA_H_2930#include "pipe/p_context.h"31#include "pipe/p_state.h"3233#include "freedreno_util.h"3435#include "fd6_context.h"3637#define FD6_ZSA_NO_ALPHA (1 << 0)38#define FD6_ZSA_DEPTH_CLAMP (1 << 1)3940struct fd6_zsa_stateobj {41struct pipe_depth_stencil_alpha_state base;4243uint32_t rb_alpha_control;44uint32_t rb_depth_cntl;45uint32_t rb_stencil_control;46uint32_t rb_stencilmask;47uint32_t rb_stencilwrmask;4849struct fd6_lrz_state lrz;50bool writes_zs; /* writes depth and/or stencil */51bool invalidate_lrz;52bool alpha_test;5354struct fd_ringbuffer *stateobj[4];55};5657static inline struct fd6_zsa_stateobj *58fd6_zsa_stateobj(struct pipe_depth_stencil_alpha_state *zsa)59{60return (struct fd6_zsa_stateobj *)zsa;61}6263static inline struct fd_ringbuffer *64fd6_zsa_state(struct fd_context *ctx, bool no_alpha, bool depth_clamp) assert_dt65{66int variant = 0;67if (no_alpha)68variant |= FD6_ZSA_NO_ALPHA;69if (depth_clamp)70variant |= FD6_ZSA_DEPTH_CLAMP;71return fd6_zsa_stateobj(ctx->zsa)->stateobj[variant];72}7374void *fd6_zsa_state_create(struct pipe_context *pctx,75const struct pipe_depth_stencil_alpha_state *cso);7677void fd6_zsa_state_delete(struct pipe_context *pctx, void *hwcso);7879#endif /* FD6_ZSA_H_ */808182