mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 05:00:09 +01:00
nir: pack nir_variable::data::xfb_*
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
This commit is contained in:
parent
08dc541b66
commit
4319cc8c0f
4 changed files with 35 additions and 28 deletions
|
|
@ -600,14 +600,17 @@ nir_visitor::visit(ir_variable *ir)
|
||||||
var->data.bindless = ir->data.bindless;
|
var->data.bindless = ir->data.bindless;
|
||||||
var->data.offset = ir->data.offset;
|
var->data.offset = ir->data.offset;
|
||||||
|
|
||||||
var->data.image.access = (gl_access_qualifier)image_access;
|
if (var->type->is_image()) {
|
||||||
var->data.image.format = ir->data.image_format;
|
var->data.image.access = (gl_access_qualifier)image_access;
|
||||||
|
var->data.image.format = ir->data.image_format;
|
||||||
|
} else {
|
||||||
|
var->data.xfb.buffer = ir->data.xfb_buffer;
|
||||||
|
var->data.xfb.stride = ir->data.xfb_stride;
|
||||||
|
}
|
||||||
|
|
||||||
var->data.fb_fetch_output = ir->data.fb_fetch_output;
|
var->data.fb_fetch_output = ir->data.fb_fetch_output;
|
||||||
var->data.explicit_xfb_buffer = ir->data.explicit_xfb_buffer;
|
var->data.explicit_xfb_buffer = ir->data.explicit_xfb_buffer;
|
||||||
var->data.explicit_xfb_stride = ir->data.explicit_xfb_stride;
|
var->data.explicit_xfb_stride = ir->data.explicit_xfb_stride;
|
||||||
var->data.xfb_buffer = ir->data.xfb_buffer;
|
|
||||||
var->data.xfb_stride = ir->data.xfb_stride;
|
|
||||||
|
|
||||||
var->num_state_slots = ir->get_num_state_slots();
|
var->num_state_slots = ir->get_num_state_slots();
|
||||||
if (var->num_state_slots > 0) {
|
if (var->num_state_slots > 0) {
|
||||||
|
|
|
||||||
|
|
@ -478,25 +478,29 @@ typedef struct nir_variable {
|
||||||
*/
|
*/
|
||||||
unsigned offset;
|
unsigned offset;
|
||||||
|
|
||||||
/**
|
union {
|
||||||
* Transform feedback buffer.
|
/**
|
||||||
*/
|
* ARB_shader_image_load_store qualifiers.
|
||||||
unsigned xfb_buffer;
|
*/
|
||||||
|
struct {
|
||||||
|
enum gl_access_qualifier access;
|
||||||
|
|
||||||
/**
|
/** Image internal format if specified explicitly, otherwise GL_NONE. */
|
||||||
* Transform feedback stride.
|
GLenum format;
|
||||||
*/
|
} image;
|
||||||
unsigned xfb_stride;
|
|
||||||
|
|
||||||
/**
|
struct {
|
||||||
* ARB_shader_image_load_store qualifiers.
|
/**
|
||||||
*/
|
* Transform feedback buffer.
|
||||||
struct {
|
*/
|
||||||
enum gl_access_qualifier access;
|
uint16_t buffer:2;
|
||||||
|
|
||||||
/** Image internal format if specified explicitly, otherwise GL_NONE. */
|
/**
|
||||||
GLenum format;
|
* Transform feedback stride.
|
||||||
} image;
|
*/
|
||||||
|
uint16_t stride;
|
||||||
|
} xfb;
|
||||||
|
};
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
/* Number of nir_variable_data members */
|
/* Number of nir_variable_data members */
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ add_var_xfb_varying(nir_xfb_info *xfb,
|
||||||
nir_xfb_varying_info *varying = &varyings->varyings[varyings->varying_count++];
|
nir_xfb_varying_info *varying = &varyings->varyings[varyings->varying_count++];
|
||||||
|
|
||||||
varying->type = type;
|
varying->type = type;
|
||||||
varying->buffer = var->data.xfb_buffer;
|
varying->buffer = var->data.xfb.buffer;
|
||||||
varying->offset = offset;
|
varying->offset = offset;
|
||||||
xfb->buffers[var->data.xfb_buffer].varying_count++;
|
xfb->buffers[var->data.xfb.buffer].varying_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -100,11 +100,11 @@ add_var_xfb_outputs(nir_xfb_info *xfb,
|
||||||
} else {
|
} else {
|
||||||
assert(buffer < NIR_MAX_XFB_BUFFERS);
|
assert(buffer < NIR_MAX_XFB_BUFFERS);
|
||||||
if (xfb->buffers_written & (1 << buffer)) {
|
if (xfb->buffers_written & (1 << buffer)) {
|
||||||
assert(xfb->buffers[buffer].stride == var->data.xfb_stride);
|
assert(xfb->buffers[buffer].stride == var->data.xfb.stride);
|
||||||
assert(xfb->buffer_to_stream[buffer] == var->data.stream);
|
assert(xfb->buffer_to_stream[buffer] == var->data.stream);
|
||||||
} else {
|
} else {
|
||||||
xfb->buffers_written |= (1 << buffer);
|
xfb->buffers_written |= (1 << buffer);
|
||||||
xfb->buffers[buffer].stride = var->data.xfb_stride;
|
xfb->buffers[buffer].stride = var->data.xfb.stride;
|
||||||
xfb->buffer_to_stream[buffer] = var->data.stream;
|
xfb->buffer_to_stream[buffer] = var->data.stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ nir_gather_xfb_info_with_varyings(const nir_shader *shader,
|
||||||
|
|
||||||
if (var->data.explicit_offset && !is_array_block) {
|
if (var->data.explicit_offset && !is_array_block) {
|
||||||
unsigned offset = var->data.offset;
|
unsigned offset = var->data.offset;
|
||||||
add_var_xfb_outputs(xfb, varyings_info, var, var->data.xfb_buffer,
|
add_var_xfb_outputs(xfb, varyings_info, var, var->data.xfb.buffer,
|
||||||
&location, &offset, var->type, false);
|
&location, &offset, var->type, false);
|
||||||
} else if (is_array_block) {
|
} else if (is_array_block) {
|
||||||
assert(glsl_type_is_struct_or_ifc(var->interface_type));
|
assert(glsl_type_is_struct_or_ifc(var->interface_type));
|
||||||
|
|
@ -253,7 +253,7 @@ nir_gather_xfb_info_with_varyings(const nir_shader *shader,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned offset = foffset;
|
unsigned offset = foffset;
|
||||||
add_var_xfb_outputs(xfb, varyings_info, var, var->data.xfb_buffer + b,
|
add_var_xfb_outputs(xfb, varyings_info, var, var->data.xfb.buffer + b,
|
||||||
&location, &offset, ftype, false);
|
&location, &offset, ftype, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1586,12 +1586,12 @@ apply_var_decoration(struct vtn_builder *b,
|
||||||
|
|
||||||
case SpvDecorationXfbBuffer:
|
case SpvDecorationXfbBuffer:
|
||||||
var_data->explicit_xfb_buffer = true;
|
var_data->explicit_xfb_buffer = true;
|
||||||
var_data->xfb_buffer = dec->operands[0];
|
var_data->xfb.buffer = dec->operands[0];
|
||||||
var_data->always_active_io = true;
|
var_data->always_active_io = true;
|
||||||
break;
|
break;
|
||||||
case SpvDecorationXfbStride:
|
case SpvDecorationXfbStride:
|
||||||
var_data->explicit_xfb_stride = true;
|
var_data->explicit_xfb_stride = true;
|
||||||
var_data->xfb_stride = dec->operands[0];
|
var_data->xfb.stride = dec->operands[0];
|
||||||
break;
|
break;
|
||||||
case SpvDecorationOffset:
|
case SpvDecorationOffset:
|
||||||
var_data->explicit_offset = true;
|
var_data->explicit_offset = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue