Path: blob/21.2-virgl/src/gallium/drivers/r300/compiler/radeon_compiler_util.h
4574 views
/*1* Copyright 2010 Tom Stellard <[email protected]>2*3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining6* a copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sublicense, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial15* portions of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,18* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.20* IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE21* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION22* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION23* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25*/2627#include "radeon_program_constants.h"2829#ifndef RADEON_PROGRAM_UTIL_H30#define RADEON_PROGRAM_UTIL_H3132#include "radeon_opcodes.h"3334struct radeon_compiler;35struct rc_instruction;36struct rc_pair_instruction;37struct rc_pair_sub_instruction;38struct rc_src_register;3940unsigned int rc_swizzle_to_writemask(unsigned int swz);4142rc_swizzle get_swz(unsigned int swz, rc_swizzle idx);4344unsigned int rc_init_swizzle(unsigned int initial_value, unsigned int channels);4546unsigned int combine_swizzles4(unsigned int src,47rc_swizzle swz_x, rc_swizzle swz_y,48rc_swizzle swz_z, rc_swizzle swz_w);4950unsigned int combine_swizzles(unsigned int src, unsigned int swz);5152rc_swizzle rc_mask_to_swizzle(unsigned int mask);5354unsigned swizzle_mask(unsigned swizzle, unsigned mask);5556unsigned int rc_adjust_channels(57unsigned int old_swizzle,58unsigned int conversion_swizzle);5960void rc_pair_rewrite_writemask(61struct rc_pair_sub_instruction * sub,62unsigned int conversion_swizzle);6364void rc_normal_rewrite_writemask(65struct rc_instruction * inst,66unsigned int conversion_swizzle);6768unsigned int rc_rewrite_swizzle(69unsigned int swizzle,70unsigned int new_mask);7172struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register srcreg);7374void reset_srcreg(struct rc_src_register* reg);7576unsigned int rc_src_reads_dst_mask(77rc_register_file src_file,78unsigned int src_idx,79unsigned int src_swz,80rc_register_file dst_file,81unsigned int dst_idx,82unsigned int dst_mask);8384unsigned int rc_source_type_swz(unsigned int swizzle);8586unsigned int rc_source_type_mask(unsigned int mask);8788unsigned int rc_inst_can_use_presub(89struct rc_instruction * inst,90rc_presubtract_op presub_op,91unsigned int presub_writemask,92const struct rc_src_register * replace_reg,93const struct rc_src_register * presub_src0,94const struct rc_src_register * presub_src1);9596int rc_get_max_index(97struct radeon_compiler * c,98rc_register_file file);99100unsigned int rc_pair_remove_src(101struct rc_instruction * inst,102unsigned int src_type,103unsigned int source,104unsigned int new_readmask);105106rc_opcode rc_get_flow_control_inst(struct rc_instruction * inst);107108struct rc_instruction * rc_match_endloop(struct rc_instruction * endloop);109struct rc_instruction * rc_match_bgnloop(struct rc_instruction * bgnloop);110111unsigned int rc_make_conversion_swizzle(112unsigned int old_mask,113unsigned int new_mask);114115unsigned int rc_src_reg_is_immediate(116struct radeon_compiler * c,117unsigned int file,118unsigned int index);119120float rc_get_constant_value(121struct radeon_compiler * c,122unsigned int index,123unsigned int swizzle,124unsigned int negate,125unsigned int chan);126127unsigned int rc_get_scalar_src_swz(unsigned int swizzle);128129#endif /* RADEON_PROGRAM_UTIL_H */130131132