brw_vec4.h revision 483f5b348b0f3c0ca7082fd2047c354e8af285e7
1af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt/* 2af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Copyright © 2011 Intel Corporation 3af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * 4af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Permission is hereby granted, free of charge, to any person obtaining a 5af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * copy of this software and associated documentation files (the "Software"), 6af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * to deal in the Software without restriction, including without limitation 7af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * and/or sell copies of the Software, and to permit persons to whom the 9af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Software is furnished to do so, subject to the following conditions: 10af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * 11af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * The above copyright notice and this permission notice (including the next 12af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * paragraph) shall be included in all copies or substantial portions of the 13af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Software. 14af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * 15af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * IN THE SOFTWARE. 22af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 23af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 24af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#ifndef BRW_VEC4_H 25af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#define BRW_VEC4_H 26af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 27af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include <stdint.h> 28af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "brw_shader.h" 29af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "main/compiler.h" 30af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "program/hash_table.h" 31af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 32af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtextern "C" { 33af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "brw_vs.h" 34af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "brw_context.h" 35af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#include "brw_eu.h" 36af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 37af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 382f0edc60f4bd2ae5999a6afa656e3bb3f181bf0fChad Versace#include "glsl/ir.h" 39af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 40af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtnamespace brw { 41af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 42af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass dst_reg; 43af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 44af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt/** 45af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Common helper for constructing swizzles. When only a subset of 46af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * channels of a vec4 are used, we don't want to reference the other 47af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * channels, as that will tell optimization passes that those other 48af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * channels are used. 49af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 50af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtstatic int 51af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtswizzle_for_size(int size) 52af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt{ 53af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int size_swizzles[4] = { 54af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt BRW_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), 55af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt BRW_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y), 56af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt BRW_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_Z), 57af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt BRW_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W), 58af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt }; 59af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 60af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt assert((size >= 1) && (size <= 4)); 61af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return size_swizzles[size - 1]; 62af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt} 63af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 64af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtenum register_file { 65af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt ARF = BRW_ARCHITECTURE_REGISTER_FILE, 66af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt GRF = BRW_GENERAL_REGISTER_FILE, 67af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt MRF = BRW_MESSAGE_REGISTER_FILE, 68af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt IMM = BRW_IMMEDIATE_VALUE, 69af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt HW_REG, /* a struct brw_reg */ 70af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt ATTR, 71af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt UNIFORM, /* prog_data->params[hw_reg] */ 72af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt BAD_FILE 73af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 74af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 75af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass reg 76af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt{ 77af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtpublic: 78af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** Register file: ARF, GRF, MRF, IMM. */ 79af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt enum register_file file; 80af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** virtual register number. 0 = fixed hw reg */ 81af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int reg; 82af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** Offset within the virtual register. */ 83af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int reg_offset; 84af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** Register type. BRW_REGISTER_TYPE_* */ 85af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int type; 86af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool sechalf; 87af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg fixed_hw_reg; 88af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int smear; /* -1, or a channel of the reg to smear to all channels. */ 89af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 90af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** Value for file == BRW_IMMMEDIATE_FILE */ 91af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt union { 92af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int32_t i; 93af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt uint32_t u; 94af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt float f; 95af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } imm; 96af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 97af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 98af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass src_reg : public reg 99af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt{ 100af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtpublic: 101af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /* Callers of this ralloc-based new need not call delete. It's 102af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * easier to just ralloc_free 'ctx' (or any of its ancestors). */ 103af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt static void* operator new(size_t size, void *ctx) 104af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 105af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void *node; 106af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 107af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt node = ralloc_size(ctx, size); 108af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt assert(node != NULL); 109af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 110af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return node; 111af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 112af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 113af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void init() 114af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 115af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt memset(this, 0, sizeof(*this)); 116af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 117af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->file = BAD_FILE; 118af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 119af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 120af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg(register_file file, int reg, const glsl_type *type) 121af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 122af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt init(); 123af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 124af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->file = file; 125af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->reg = reg; 126af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt if (type && (type->is_scalar() || type->is_vector() || type->is_matrix())) 127af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->swizzle = swizzle_for_size(type->vector_elements); 128af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt else 129af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->swizzle = SWIZZLE_XYZW; 130af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 131af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 132af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** Generic unset register constructor. */ 133af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg() 134af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 135af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt init(); 136af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 137af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 138af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg(float f) 139af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 140af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt init(); 141af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 142af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->file = IMM; 143af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->type = BRW_REGISTER_TYPE_F; 144af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->imm.f = f; 145af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 146af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 147af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg(uint32_t u) 148af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 149af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt init(); 150af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 151af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->file = IMM; 152af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->type = BRW_REGISTER_TYPE_UD; 153af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->imm.f = u; 154af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 155af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 156af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg(int32_t i) 157af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 158af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt init(); 159af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 160af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->file = IMM; 161af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->type = BRW_REGISTER_TYPE_D; 162af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->imm.i = i; 163af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 164af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 165af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg(class vec4_visitor *v, const struct glsl_type *type); 166af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 167af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt explicit src_reg(dst_reg reg); 168af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 169af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt GLuint swizzle; /**< SWIZZLE_XYZW swizzles from Mesa. */ 170af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool negate; 171af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool abs; 1721ff4f11dd94711a498cde0330101c58636ef2741Eric Anholt 1731ff4f11dd94711a498cde0330101c58636ef2741Eric Anholt src_reg *reladdr; 174af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 175af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 176af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass dst_reg : public reg 177af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt{ 178af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtpublic: 179af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /* Callers of this ralloc-based new need not call delete. It's 180af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * easier to just ralloc_free 'ctx' (or any of its ancestors). */ 181af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt static void* operator new(size_t size, void *ctx) 182af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 183af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void *node; 184af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 185af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt node = ralloc_size(ctx, size); 186af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt assert(node != NULL); 187af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 188af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return node; 189af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 190af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 191af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void init() 192af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 193af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt memset(this, 0, sizeof(*this)); 194af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->file = BAD_FILE; 195af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->writemask = WRITEMASK_XYZW; 196af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 197af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 198af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg() 199af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 200af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt init(); 201af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 202af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 203af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg(register_file file, int reg) 204af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 205af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt init(); 206af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 207af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->file = file; 208af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->reg = reg; 209af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 210af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 211af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg(struct brw_reg reg) 212af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 213af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt init(); 214af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 215af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->file = HW_REG; 216af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt this->fixed_hw_reg = reg; 217af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 218af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 219af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg(class vec4_visitor *v, const struct glsl_type *type); 220af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 221af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt explicit dst_reg(src_reg reg); 222af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 223af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ 2241ff4f11dd94711a498cde0330101c58636ef2741Eric Anholt 2251ff4f11dd94711a498cde0330101c58636ef2741Eric Anholt src_reg *reladdr; 226af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 227af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 228af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass vec4_instruction : public exec_node { 229af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtpublic: 230af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /* Callers of this ralloc-based new need not call delete. It's 231af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * easier to just ralloc_free 'ctx' (or any of its ancestors). */ 232af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt static void* operator new(size_t size, void *ctx) 233af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 234af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void *node; 235af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 236af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt node = rzalloc_size(ctx, size); 237af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt assert(node != NULL); 238af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 239af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return node; 240af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 241af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 24288e08de8017b69591b37dafde9afd15f796fb404Eric Anholt vec4_instruction(vec4_visitor *v, enum opcode opcode, 24388e08de8017b69591b37dafde9afd15f796fb404Eric Anholt dst_reg dst = dst_reg(), 24488e08de8017b69591b37dafde9afd15f796fb404Eric Anholt src_reg src0 = src_reg(), 24588e08de8017b69591b37dafde9afd15f796fb404Eric Anholt src_reg src1 = src_reg(), 24688e08de8017b69591b37dafde9afd15f796fb404Eric Anholt src_reg src2 = src_reg()); 24788e08de8017b69591b37dafde9afd15f796fb404Eric Anholt 248af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg get_dst(void); 249af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg get_src(int i); 250af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 251af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt enum opcode opcode; /* BRW_OPCODE_* or FS_OPCODE_* */ 252af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst; 253af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg src[3]; 254af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 255af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool saturate; 256af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool predicate_inverse; 257af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt uint32_t predicate; 258af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 259af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int conditional_mod; /**< BRW_CONDITIONAL_* */ 260af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 261af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int sampler; 262af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int target; /**< MRT target. */ 263af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool shadow_compare; 264af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 265af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool eot; 266af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool header_present; 267af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int mlen; /**< SEND message length */ 268af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int base_mrf; /**< First MRF in the SEND message, if mlen is nonzero. */ 269af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 270af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt uint32_t offset; /* spill/unspill offset */ 271af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** @{ 272af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Annotation for the generated IR. One of the two can be set. 273af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 274af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt ir_instruction *ir; 275af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt const char *annotation; 276af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 277af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 278af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtclass vec4_visitor : public ir_visitor 279af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt{ 280af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtpublic: 281af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt vec4_visitor(struct brw_vs_compile *c, 282af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct gl_shader_program *prog, struct brw_shader *shader); 283af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt ~vec4_visitor(); 284af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 285af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst_null_f() 286af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 287af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return dst_reg(brw_null_reg()); 288af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 289af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 290af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst_null_d() 291af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 292af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return dst_reg(retype(brw_null_reg(), BRW_REGISTER_TYPE_D)); 293af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 294af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 295af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst_null_cmp() 296af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt { 297af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt if (intel->gen > 4) 298af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return dst_null_d(); 299af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt else 300af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt return dst_null_f(); 301af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt } 302af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 303af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_context *brw; 304af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt const struct gl_vertex_program *vp; 305af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct intel_context *intel; 306af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct gl_context *ctx; 307af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_vs_compile *c; 308af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_vs_prog_data *prog_data; 309af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_compile *p; 310af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_shader *shader; 311af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct gl_shader_program *prog; 312af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void *mem_ctx; 313af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt exec_list instructions; 314af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 315af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt char *fail_msg; 316af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool failed; 317af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 318af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** 319af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * GLSL IR currently being processed, which is associated with our 320af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * driver IR instructions for debugging purposes. 321af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 322af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt ir_instruction *base_ir; 323af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt const char *current_annotation; 324af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 325af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int *virtual_grf_sizes; 326af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int virtual_grf_count; 327af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int virtual_grf_array_size; 328af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int first_non_payload_grf; 3293dadc1e3cceac80a1b63cad2e10f0e0f8904531bEric Anholt int *virtual_grf_def; 3303dadc1e3cceac80a1b63cad2e10f0e0f8904531bEric Anholt int *virtual_grf_use; 3313dadc1e3cceac80a1b63cad2e10f0e0f8904531bEric Anholt bool live_intervals_valid; 332af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 333af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg *variable_storage(ir_variable *var); 334af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 335af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void reladdr_to_temp(ir_instruction *ir, src_reg *reg, int *num_reladdr); 336af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 337af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg src_reg_for_float(float val); 338af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 339af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** 340af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * \name Visit methods 341af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * 342af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * As typical for the visitor pattern, there must be one \c visit method for 343af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * each concrete subclass of \c ir_instruction. Virtual base classes within 344af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * the hierarchy should not have \c visit methods. 345af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 346af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /*@{*/ 347af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_variable *); 348af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_loop *); 349af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_loop_jump *); 350af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_function_signature *); 351af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_function *); 352af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_expression *); 353af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_swizzle *); 354af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_dereference_variable *); 355af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_dereference_array *); 356af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_dereference_record *); 357af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_assignment *); 358af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_constant *); 359af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_call *); 360af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_return *); 361af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_discard *); 362af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_texture *); 363af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt virtual void visit(ir_if *); 364af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /*@}*/ 365af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 366af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg result; 367af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 368af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /* Regs for vertex results. Generated at ir_variable visiting time 369af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * for the ir->location's used. 370af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 371af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg output_reg[VERT_RESULT_MAX]; 372a070d5f363e99b0f846d555e9ca3a74ec807fdc0Eric Anholt int uniform_size[MAX_UNIFORMS]; 373483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt int uniform_vector_size[MAX_UNIFORMS]; 374a070d5f363e99b0f846d555e9ca3a74ec807fdc0Eric Anholt int uniforms; 375af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 376af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct hash_table *variable_ht; 377af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 378af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool run(void); 379af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void fail(const char *msg, ...); 380af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 381af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int virtual_grf_alloc(int size); 382a070d5f363e99b0f846d555e9ca3a74ec807fdc0Eric Anholt int setup_uniform_values(int loc, const glsl_type *type); 383a070d5f363e99b0f846d555e9ca3a74ec807fdc0Eric Anholt void setup_builtin_uniform_values(ir_variable *ir); 384af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int setup_attributes(int payload_reg); 385a070d5f363e99b0f846d555e9ca3a74ec807fdc0Eric Anholt int setup_uniforms(int payload_reg); 386af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void setup_payload(); 387af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void reg_allocate_trivial(); 388af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void reg_allocate(); 389d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt void move_grf_array_access_to_scratch(); 390483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt void move_uniform_array_access_to_pull_constants(); 3913dadc1e3cceac80a1b63cad2e10f0e0f8904531bEric Anholt void calculate_live_intervals(); 3928174945d3346dc049ae56dcb4bf1eab39f5c88aaEric Anholt bool dead_code_eliminate(); 3933dadc1e3cceac80a1b63cad2e10f0e0f8904531bEric Anholt bool virtual_grf_interferes(int a, int b); 394af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 39588e08de8017b69591b37dafde9afd15f796fb404Eric Anholt vec4_instruction *emit(vec4_instruction *inst); 39688e08de8017b69591b37dafde9afd15f796fb404Eric Anholt 397af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt vec4_instruction *emit(enum opcode opcode); 398af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 399af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt vec4_instruction *emit(enum opcode opcode, dst_reg dst, src_reg src0); 400af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 401af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt vec4_instruction *emit(enum opcode opcode, dst_reg dst, 402af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg src0, src_reg src1); 403af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 404af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt vec4_instruction *emit(enum opcode opcode, dst_reg dst, 405af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt src_reg src0, src_reg src1, src_reg src2); 406af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 4077642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt bool try_rewrite_rhs_to_dst(ir_assignment *ir, 4087642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt dst_reg dst, 4097642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt src_reg src, 4107642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt vec4_instruction *pre_rhs_inst, 4117642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt vec4_instruction *last_rhs_inst); 4127642c1de6b65b7dfd9e39904291cc9737cd54b56Eric Anholt 413af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** Walks an exec_list of ir_instruction and sends it through this visitor. */ 414af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void visit_instructions(const exec_list *list); 415af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 416af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_bool_to_cond_code(ir_rvalue *ir); 417af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_bool_comparison(unsigned int op, dst_reg dst, src_reg src0, src_reg src1); 418af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_if_gen6(ir_if *ir); 419af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 420979072613139870f12e329e4b483c7f688b40560Eric Anholt void emit_block_move(dst_reg *dst, src_reg *src, 421979072613139870f12e329e4b483c7f688b40560Eric Anholt const struct glsl_type *type, bool predicated); 422af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 42331ef2e3ec2f5837eea0899b4bda5ea15e335a6a2Eric Anholt void emit_constant_values(dst_reg *dst, ir_constant *value); 42431ef2e3ec2f5837eea0899b4bda5ea15e335a6a2Eric Anholt 425af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt /** 426af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt * Emit the correct dot-product instruction for the type of arguments 427af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt */ 428af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_dp(dst_reg dst, src_reg src0, src_reg src1, unsigned elements); 429af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 430af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_scalar(ir_instruction *ir, enum prog_opcode op, 431af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst, src_reg src0); 432af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 433af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_scalar(ir_instruction *ir, enum prog_opcode op, 434af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst, src_reg src0, src_reg src1); 435af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 436af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_scs(ir_instruction *ir, enum prog_opcode op, 437af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt dst_reg dst, const src_reg &src); 438af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 439af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math1_gen6(enum opcode opcode, dst_reg dst, src_reg src); 440af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math1_gen4(enum opcode opcode, dst_reg dst, src_reg src); 441af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math(enum opcode opcode, dst_reg dst, src_reg src); 442af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math2_gen6(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1); 443af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math2_gen4(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1); 444af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_math(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1); 445af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 446af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int emit_vue_header_gen6(int header_mrf); 447af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt int emit_vue_header_gen4(int header_mrf); 448af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void emit_urb_writes(void); 449af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 450d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt src_reg get_scratch_offset(vec4_instruction *inst, 451d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt src_reg *reladdr, int reg_offset); 452483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt src_reg get_pull_constant_offset(vec4_instruction *inst, 453483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt src_reg *reladdr, int reg_offset); 454d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt void emit_scratch_read(vec4_instruction *inst, 455d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt dst_reg dst, 456d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt src_reg orig_src, 457d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt int base_offset); 458d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt void emit_scratch_write(vec4_instruction *inst, 459d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt src_reg temp, 460d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt dst_reg orig_dst, 461d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt int base_offset); 462483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt void emit_pull_constant_load(vec4_instruction *inst, 463483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt dst_reg dst, 464483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt src_reg orig_src, 465483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt int base_offset); 466d0e4d71070cd7fa197ed98612782484ec1f27123Eric Anholt 467af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt GLboolean try_emit_sat(ir_expression *ir); 468af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 469af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt bool process_move_condition(ir_rvalue *ir); 470af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 471af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void generate_code(); 472af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void generate_vs_instruction(vec4_instruction *inst, 473af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg dst, 474af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg *src); 475abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt 476af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void generate_math1_gen4(vec4_instruction *inst, 477af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg dst, 478af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg src); 479af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void generate_math1_gen6(vec4_instruction *inst, 480af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg dst, 481af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt struct brw_reg src); 482abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt void generate_math2_gen4(vec4_instruction *inst, 483abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg dst, 484abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg src0, 485abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg src1); 486abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt void generate_math2_gen6(vec4_instruction *inst, 487abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg dst, 488abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg src0, 489abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt struct brw_reg src1); 490abf843a797876b5e3c5c91dbec25b6553d2cc281Eric Anholt 491af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt void generate_urb_write(vec4_instruction *inst); 492584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt void generate_oword_dual_block_offsets(struct brw_reg m1, 493584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg index); 494584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt void generate_scratch_write(vec4_instruction *inst, 495584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg dst, 496584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg src, 497584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg index); 498584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt void generate_scratch_read(vec4_instruction *inst, 499584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg dst, 500584ff407482fd3baf5ce081dbbf9653eb76c40f1Eric Anholt struct brw_reg index); 501483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt void generate_pull_constant_load(vec4_instruction *inst, 502483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt struct brw_reg dst, 503483f5b348b0f3c0ca7082fd2047c354e8af285e7Eric Anholt struct brw_reg index); 504af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt}; 505af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 506af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt} /* namespace brw */ 507af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt 508af3c9803d818fd33139f1247a387d64b967b8992Eric Anholt#endif /* BRW_VEC4_H */ 509