Path: blob/21.2-virgl/src/gallium/drivers/freedreno/ir3/ir3_gallium.h
4574 views
/*1* Copyright (C) 2014 Rob Clark <[email protected]>2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE20* SOFTWARE.21*22* Authors:23* Rob Clark <[email protected]>24*/2526#ifndef IR3_GALLIUM_H_27#define IR3_GALLIUM_H_2829#include "ir3/ir3_shader.h"30#include "pipe/p_screen.h"31#include "pipe/p_state.h"3233#include "freedreno_util.h"3435/**36* The ir3 hwcso type, use ir3_get_shader() to dereference the37* underlying ir3_shader38*/39struct ir3_shader_state;4041struct ir3_shader_variant *42ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key,43bool binning_pass, struct pipe_debug_callback *debug);4445void *ir3_shader_compute_state_create(struct pipe_context *pctx,46const struct pipe_compute_state *cso);47void *ir3_shader_state_create(struct pipe_context *pctx,48const struct pipe_shader_state *cso);49void ir3_shader_state_delete(struct pipe_context *pctx, void *hwcso);5051struct ir3_shader *ir3_get_shader(struct ir3_shader_state *hwcso);52struct shader_info *ir3_get_shader_info(struct ir3_shader_state *hwcso);5354void ir3_fixup_shader_state(struct pipe_context *pctx,55struct ir3_shader_key *key) assert_dt;5657void ir3_prog_init(struct pipe_context *pctx);58void ir3_screen_init(struct pipe_screen *pscreen);59void ir3_screen_fini(struct pipe_screen *pscreen);6061/**62* A helper to determine if a fs input 'i' is point/sprite coord, given63* the specified sprite_coord_enable mask64*/65static inline bool66ir3_point_sprite(const struct ir3_shader_variant *fs, int i,67uint32_t sprite_coord_enable, bool *coord_mode)68{69gl_varying_slot slot = fs->inputs[i].slot;70switch (slot) {71case VARYING_SLOT_PNTC:72*coord_mode = true;73return true;74case VARYING_SLOT_TEX0 ... VARYING_SLOT_TEX7:75return !!(sprite_coord_enable & BITFIELD_BIT(slot - VARYING_SLOT_TEX0));76default:77return false;78}79}8081void ir3_update_max_tf_vtx(struct fd_context *ctx,82const struct ir3_shader_variant *v) assert_dt;8384#endif /* IR3_GALLIUM_H_ */858687