cc4614e9792d910f104af3fe165374e152184271
2 * Copyright (c) 2015 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
25 * \file lower_buffer_access.h
27 * Helper for IR lowering pass to replace dereferences of buffer object based
28 * shader variables with intrinsic function calls.
30 * This helper is used by lowering passes for UBOs, SSBOs and compute shader
35 #ifndef LOWER_BUFFER_ACCESS_H
36 #define LOWER_BUFFER_ACCESS_H
39 #include "ir_rvalue_visitor.h"
41 namespace lower_buffer_access
{
43 class lower_buffer_access
: public ir_rvalue_enter_visitor
{
46 insert_buffer_access(void *mem_ctx
, ir_dereference
*deref
,
47 const glsl_type
*type
, ir_rvalue
*offset
,
48 unsigned mask
, int channel
) = 0;
50 void emit_access(void *mem_ctx
, bool is_write
, ir_dereference
*deref
,
51 ir_variable
*base_offset
, unsigned int deref_offset
,
52 bool row_major
, int matrix_columns
,
53 unsigned int packing
, unsigned int write_mask
);
55 bool is_dereferenced_thing_row_major(const ir_rvalue
*deref
);
57 void setup_buffer_access(void *mem_ctx
, ir_variable
*var
, ir_rvalue
*deref
,
58 ir_rvalue
**offset
, unsigned *const_offset
,
59 bool *row_major
, int *matrix_columns
,
63 } /* namespace lower_buffer_access */
65 #endif /* LOWER_BUFFER_ACCESS_H */