compiler->dev = dev;
compiler->dev_id = dev_id;
compiler->gen = fd_dev_gen(dev_id);
- compiler->robust_buffer_access2 = options->robust_buffer_access2;
+ compiler->options = *options;
/* All known GPU's have 32k local memory (aka shared) */
compiler->local_mem_size = 32 * 1024;
compiler->bool_type = (compiler->gen >= 5) ? TYPE_U16 : TYPE_U32;
compiler->has_shared_regfile = compiler->gen >= 5;
- compiler->push_ubo_with_preamble = options->push_ubo_with_preamble;
-
/* The driver can't request this unless preambles are supported. */
if (options->push_ubo_with_preamble)
assert(compiler->has_preamble);
struct ir3_ra_reg_set;
struct ir3_shader;
+struct ir3_compiler_options {
+ /* If true, UBO/SSBO accesses are assumed to be bounds-checked as defined by
+ * VK_EXT_robustness2 and optimizations may have to be more conservative.
+ */
+ bool robust_buffer_access2;
+
+ /* If true, promote UBOs (except for constant data) to constants using ldc.k
+ * in the preamble. The driver should ignore everything in ubo_state except
+ * for the constant data UBO, which is excluded because the command pushing
+ * constants for it can be pre-baked when compiling the shader.
+ */
+ bool push_ubo_with_preamble;
+
+ /* If true, disable the shader cache. The driver is then responsible for
+ * caching.
+ */
+ bool disable_cache;
+};
+
struct ir3_compiler {
struct fd_device *dev;
const struct fd_dev_id *dev_id;
struct nir_shader_compiler_options nir_options;
- bool robust_buffer_access2;
+ /*
+ * Configuration options for things handled differently by turnip vs
+ * gallium
+ */
+ struct ir3_compiler_options options;
/*
* Configuration options for things that are handled differently on
/* True if preamble instructions (shps, shpe, etc.) are supported */
bool has_preamble;
- bool push_ubo_with_preamble;
-
/* Where the shared consts start in constants file, in vec4's. */
uint16_t shared_consts_base_offset;
uint64_t geom_shared_consts_size_quirk;
};
-struct ir3_compiler_options {
- /* If true, UBO/SSBO accesses are assumed to be bounds-checked as defined by
- * VK_EXT_robustness2 and optimizations may have to be more conservative.
- */
- bool robust_buffer_access2;
-
- /* If true, promote UBOs (except for constant data) to constants using ldc.k
- * in the preamble. The driver should ignore everything in ubo_state except
- * for the constant data UBO, which is excluded because the command pushing
- * constants for it can be pre-baked when compiling the shader.
- */
- bool push_ubo_with_preamble;
-
- /* If true, disable the shader cache. The driver is then responsible for
- * caching.
- */
- bool disable_cache;
-};
-
void ir3_compiler_destroy(struct ir3_compiler *compiler);
struct ir3_compiler *ir3_compiler_create(struct fd_device *dev,
const struct fd_dev_id *dev_id,
_mesa_sha1_format(timestamp, id_sha1);
uint64_t driver_flags = ir3_shader_debug;
- if (compiler->robust_buffer_access2)
+ if (compiler->options.robust_buffer_access2)
driver_flags |= IR3_DBG_ROBUST_UBO_ACCESS;
compiler->disk_cache = disk_cache_create(renderer, timestamp, driver_flags);
}
nir_load_store_vectorize_options vectorize_opts = {
.modes = nir_var_mem_ubo | nir_var_mem_ssbo,
.callback = ir3_nir_should_vectorize_mem,
- .robust_modes = compiler->robust_buffer_access2 ? nir_var_mem_ubo | nir_var_mem_ssbo: 0,
+ .robust_modes = compiler->options.robust_buffer_access2 ?
+ nir_var_mem_ubo | nir_var_mem_ssbo : 0,
};
progress |= OPT(s, nir_opt_load_store_vectorize, &vectorize_opts);
memset(state, 0, sizeof(*state));
uint32_t upload_remaining = max_upload;
- bool push_ubos = compiler->push_ubo_with_preamble;
+ bool push_ubos = compiler->options.push_ubo_with_preamble;
nir_foreach_function (function, nir) {
if (function->impl && (!push_ubos || !function->is_preamble)) {
nir_foreach_block (block, function->impl) {
int num_ubos = 0;
bool progress = false;
bool has_preamble = false;
- bool push_ubos = compiler->push_ubo_with_preamble;
+ bool push_ubos = compiler->options.push_ubo_with_preamble;
nir_foreach_function (function, nir) {
if (function->impl) {
if (function->is_preamble && push_ubos) {
static void
tu_hash_compiler(struct mesa_sha1 *ctx, const struct ir3_compiler *compiler)
{
- _mesa_sha1_update(ctx, &compiler->robust_buffer_access2,
- sizeof(compiler->robust_buffer_access2));
+ _mesa_sha1_update(ctx, &compiler->options.robust_buffer_access2,
+ sizeof(compiler->options.robust_buffer_access2));
_mesa_sha1_update(ctx, &ir3_shader_debug, sizeof(ir3_shader_debug));
}