uint32_t spill_offset, int count);
void emit_nir_code();
- void nir_setup_inputs(nir_shader *shader);
- void nir_setup_outputs(nir_shader *shader);
- void nir_setup_uniforms(nir_shader *shader);
- void nir_emit_system_values(nir_shader *shader);
+ void nir_setup_inputs();
+ void nir_setup_outputs();
+ void nir_setup_uniforms();
+ void nir_emit_system_values();
void nir_emit_impl(nir_function_impl *impl);
void nir_emit_cf_list(exec_list *list);
void nir_emit_if(nir_if *if_stmt);
void
fs_visitor::emit_nir_code()
{
- nir_shader *nir = prog->nir;
-
/* emit the arrays used for inputs and outputs - load/store intrinsics will
* be converted to reads/writes of these arrays
*/
- nir_setup_inputs(nir);
- nir_setup_outputs(nir);
- nir_setup_uniforms(nir);
- nir_emit_system_values(nir);
+ nir_setup_inputs();
+ nir_setup_outputs();
+ nir_setup_uniforms();
+ nir_emit_system_values();
/* get the main function and emit it */
nir_foreach_overload(nir, overload) {
}
void
-fs_visitor::nir_setup_inputs(nir_shader *shader)
+fs_visitor::nir_setup_inputs()
{
- nir_inputs = bld.vgrf(BRW_REGISTER_TYPE_F, shader->num_inputs);
+ nir_inputs = bld.vgrf(BRW_REGISTER_TYPE_F, nir->num_inputs);
- foreach_list_typed(nir_variable, var, node, &shader->inputs) {
+ foreach_list_typed(nir_variable, var, node, &nir->inputs) {
enum brw_reg_type type = brw_type_for_base_type(var->type);
fs_reg input = offset(nir_inputs, bld, var->data.driver_location);
}
void
-fs_visitor::nir_setup_outputs(nir_shader *shader)
+fs_visitor::nir_setup_outputs()
{
brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
- nir_outputs = bld.vgrf(BRW_REGISTER_TYPE_F, shader->num_outputs);
+ nir_outputs = bld.vgrf(BRW_REGISTER_TYPE_F, nir->num_outputs);
- foreach_list_typed(nir_variable, var, node, &shader->outputs) {
+ foreach_list_typed(nir_variable, var, node, &nir->outputs) {
fs_reg reg = offset(nir_outputs, bld, var->data.driver_location);
int vector_elements =
}
void
-fs_visitor::nir_setup_uniforms(nir_shader *shader)
+fs_visitor::nir_setup_uniforms()
{
if (dispatch_width != 8)
return;
- uniforms = shader->num_uniforms;
+ uniforms = nir->num_uniforms;
- foreach_list_typed(nir_variable, var, node, &shader->uniforms) {
+ foreach_list_typed(nir_variable, var, node, &nir->uniforms) {
/* UBO's and atomics don't take up space in the uniform file */
if (var->interface_type != NULL || var->type->contains_atomic())
continue;
}
void
-fs_visitor::nir_emit_system_values(nir_shader *shader)
+fs_visitor::nir_emit_system_values()
{
nir_system_values = ralloc_array(mem_ctx, fs_reg, SYSTEM_VALUE_MAX);
- nir_foreach_overload(shader, overload) {
+ nir_foreach_overload(nir, overload) {
assert(strcmp(overload->function->name, "main") == 0);
assert(overload->impl);
nir_foreach_block(overload->impl, emit_system_values_block, this);
: compiler(compiler),
log_data(log_data),
devinfo(compiler->devinfo),
+ nir(prog->nir),
shader(shader_prog ?
(struct brw_shader *)shader_prog->_LinkedShaders[stage] : NULL),
shader_prog(shader_prog),
void *log_data; /* Passed to compiler->*_log functions */
const struct brw_device_info * const devinfo;
+ nir_shader *nir;
struct brw_shader * const shader;
struct gl_shader_program * const shader_prog;
struct gl_program * const prog;
bool is_high_sampler(src_reg sampler);
virtual void emit_nir_code();
- virtual void nir_setup_inputs(nir_shader *shader);
- virtual void nir_setup_uniforms(nir_shader *shader);
+ virtual void nir_setup_inputs();
+ virtual void nir_setup_uniforms();
virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
- virtual void nir_setup_system_values(nir_shader *shader);
+ virtual void nir_setup_system_values();
virtual void nir_emit_impl(nir_function_impl *impl);
virtual void nir_emit_cf_list(exec_list *list);
virtual void nir_emit_if(nir_if *if_stmt);
namespace brw {
void
-vec4_gs_visitor::nir_setup_inputs(nir_shader *shader)
+vec4_gs_visitor::nir_setup_inputs()
{
- nir_inputs = ralloc_array(mem_ctx, src_reg, shader->num_inputs);
+ nir_inputs = ralloc_array(mem_ctx, src_reg, nir->num_inputs);
- foreach_list_typed(nir_variable, var, node, &shader->inputs) {
+ foreach_list_typed(nir_variable, var, node, &nir->inputs) {
int offset = var->data.driver_location;
if (var->type->base_type == GLSL_TYPE_ARRAY) {
/* Geometry shader inputs are arrays, but they use an unusual array
bool no_spills,
int shader_time_index);
- virtual void nir_setup_inputs(nir_shader *shader);
+ virtual void nir_setup_inputs();
virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
protected:
void
vec4_visitor::emit_nir_code()
{
- nir_shader *nir = prog->nir;
-
if (nir->num_inputs > 0)
- nir_setup_inputs(nir);
+ nir_setup_inputs();
if (nir->num_uniforms > 0)
- nir_setup_uniforms(nir);
+ nir_setup_uniforms();
- nir_setup_system_values(nir);
+ nir_setup_system_values();
/* get the main function and emit it */
nir_foreach_overload(nir, overload) {
}
void
-vec4_visitor::nir_setup_system_values(nir_shader *shader)
+vec4_visitor::nir_setup_system_values()
{
nir_system_values = ralloc_array(mem_ctx, dst_reg, SYSTEM_VALUE_MAX);
- nir_foreach_overload(shader, overload) {
+ nir_foreach_overload(nir, overload) {
assert(strcmp(overload->function->name, "main") == 0);
assert(overload->impl);
nir_foreach_block(overload->impl, setup_system_values_block, this);
}
void
-vec4_visitor::nir_setup_inputs(nir_shader *shader)
+vec4_visitor::nir_setup_inputs()
{
- nir_inputs = ralloc_array(mem_ctx, src_reg, shader->num_inputs);
+ nir_inputs = ralloc_array(mem_ctx, src_reg, nir->num_inputs);
- foreach_list_typed(nir_variable, var, node, &shader->inputs) {
+ foreach_list_typed(nir_variable, var, node, &nir->inputs) {
int offset = var->data.driver_location;
unsigned size = type_size_vec4(var->type);
for (unsigned i = 0; i < size; i++) {
}
void
-vec4_visitor::nir_setup_uniforms(nir_shader *shader)
+vec4_visitor::nir_setup_uniforms()
{
- uniforms = shader->num_uniforms;
+ uniforms = nir->num_uniforms;
- foreach_list_typed(nir_variable, var, node, &shader->uniforms) {
+ foreach_list_typed(nir_variable, var, node, &nir->uniforms) {
/* UBO's and atomics don't take up space in the uniform file */
if (var->interface_type != NULL || var->type->contains_atomic())
continue;