unsigned col_format = (ctx->options->key.ps.col_format >> (4 * index)) & 0xf;
bool is_int8 = (ctx->options->key.ps.is_int8 >> index) & 1;
bool is_int10 = (ctx->options->key.ps.is_int10 >> index) & 1;
+ bool enable_mrt_output_nan_fixup = (ctx->options->key.ps.enable_mrt_output_nan_fixup >> index) & 1;
LLVMValueRef (*packf)(struct ac_llvm_context * ctx, LLVMValueRef args[2]) = NULL;
LLVMValueRef (*packi)(struct ac_llvm_context * ctx, LLVMValueRef args[2], unsigned bits,
break;
}
- /* Replace NaN by zero (only 32-bit) to fix game bugs if
- * requested.
- */
- if (ctx->options->enable_mrt_output_nan_fixup && !is_16bit &&
- (col_format == V_028714_SPI_SHADER_32_R || col_format == V_028714_SPI_SHADER_32_GR ||
- col_format == V_028714_SPI_SHADER_32_AR || col_format == V_028714_SPI_SHADER_32_ABGR ||
- col_format == V_028714_SPI_SHADER_FP16_ABGR)) {
+ /* Replace NaN by zero (for 32-bit float formats) to fix game bugs if requested. */
+ if (enable_mrt_output_nan_fixup && !is_16bit) {
for (unsigned i = 0; i < 4; i++) {
LLVMValueRef class_args[2] = {values[i],
LLVMConstInt(ctx->ac.i32, S_NAN | Q_NAN, false)};
uint32_t spi_shader_col_format;
uint32_t col_format_is_int8;
uint32_t col_format_is_int10;
+ uint32_t col_format_is_float32;
uint32_t cb_shader_mask;
uint32_t db_alpha_to_mask;
return false;
}
+static bool
+format_is_float32(VkFormat format)
+{
+ const struct util_format_description *desc = vk_format_description(format);
+ int channel = vk_format_get_first_non_void_channel(format);
+
+ return channel >= 0 &&
+ desc->channel[channel].type == UTIL_FORMAT_TYPE_FLOAT && desc->channel[channel].size == 32;
+}
+
static void
radv_pipeline_compute_spi_color_formats(const struct radv_pipeline *pipeline,
const VkGraphicsPipelineCreateInfo *pCreateInfo,
{
const VkPipelineRenderingCreateInfo *render_create_info =
vk_find_struct_const(pCreateInfo->pNext, PIPELINE_RENDERING_CREATE_INFO);
- unsigned col_format = 0, is_int8 = 0, is_int10 = 0;
+ unsigned col_format = 0, is_int8 = 0, is_int10 = 0, is_float32 = 0;
unsigned num_targets;
for (unsigned i = 0; i < render_create_info->colorAttachmentCount; ++i) {
is_int8 |= 1 << i;
if (format_is_int10(fmt))
is_int10 |= 1 << i;
+ if (format_is_float32(fmt))
+ is_float32 |= 1 << i;
}
col_format |= cf << (4 * i);
blend->spi_shader_col_format = col_format;
blend->col_format_is_int8 = is_int8;
blend->col_format_is_int10 = is_int10;
+ blend->col_format_is_float32 = is_float32;
}
/*
key.ps.lower_discard_to_demote = true;
if (pipeline->device->instance->enable_mrt_output_nan_fixup)
- key.ps.enable_mrt_output_nan_fixup = true;
+ key.ps.enable_mrt_output_nan_fixup = blend->col_format_is_float32;
key.ps.force_vrs_enabled = pipeline->device->force_vrs_enabled;
unsigned col_format = (pipeline_key->ps.col_format >> (4 * slot)) & 0xf;
bool is_int8 = (pipeline_key->ps.is_int8 >> slot) & 1;
bool is_int10 = (pipeline_key->ps.is_int10 >> slot) & 1;
+ bool enable_mrt_output_nan_fixup = (pipeline_key->ps.enable_mrt_output_nan_fixup >> slot) & 1;
bool is_16bit = intrin->src[0].ssa->bit_size == 16;
if (col_format == V_028714_SPI_SHADER_ZERO)
}
}
- /* Replace NaN by zero (only 32-bit) to fix game bugs if requested. */
- if (pipeline_key->ps.enable_mrt_output_nan_fixup && !nir->info.internal && !is_16bit &&
- (col_format == V_028714_SPI_SHADER_32_R ||
- col_format == V_028714_SPI_SHADER_32_GR ||
- col_format == V_028714_SPI_SHADER_32_AR ||
- col_format == V_028714_SPI_SHADER_32_ABGR ||
- col_format == V_028714_SPI_SHADER_FP16_ABGR)) {
+ /* Replace NaN by zero (for 32-bit float formats) to fix game bugs if requested. */
+ if (enable_mrt_output_nan_fixup && !nir->info.internal && !is_16bit) {
u_foreach_bit(i, write_mask) {
const bool save_exact = b.exact;