pco: remove per-device specialization of SPIR-V/NIR options
Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33998>
This commit is contained in:
committed by
Marge Bot
parent
6ff964dd03
commit
d17d97a867
@@ -51,9 +51,6 @@ pco_ctx *pco_ctx_create(const struct pvr_device_info *dev_info, void *mem_ctx)
|
||||
nir_process_debug_variable();
|
||||
#endif /* NDEBUG */
|
||||
|
||||
pco_setup_spirv_options(dev_info, &ctx->spirv_options);
|
||||
pco_setup_nir_options(dev_info, &ctx->nir_options);
|
||||
|
||||
glsl_type_singleton_init_or_ref();
|
||||
ralloc_set_destructor(ctx, pco_ctx_destructor);
|
||||
|
||||
@@ -61,27 +58,15 @@ pco_ctx *pco_ctx_create(const struct pvr_device_info *dev_info, void *mem_ctx)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns the device/core-specific SPIR-V to NIR options for a PCO
|
||||
* compiler context.
|
||||
* \brief Updates the device info for a PCO compiler context.
|
||||
*
|
||||
* \param[in] ctx PCO compiler context.
|
||||
* \return The device/core-specific SPIR-V to NIR options.
|
||||
* \param[in,out] ctx PCO compiler context.
|
||||
* \param[in] dev_info Device info.
|
||||
*/
|
||||
const struct spirv_to_nir_options *pco_spirv_options(pco_ctx *ctx)
|
||||
void pco_ctx_update_dev_info(pco_ctx *ctx,
|
||||
const struct pvr_device_info *dev_info)
|
||||
{
|
||||
return &ctx->spirv_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns the device/core-specific NIR options for a PCO compiler
|
||||
* context.
|
||||
*
|
||||
* \param[in] ctx PCO compiler context.
|
||||
* \return The device/core-specific NIR options.
|
||||
*/
|
||||
const nir_shader_compiler_options *pco_nir_options(pco_ctx *ctx)
|
||||
{
|
||||
return &ctx->nir_options;
|
||||
ctx->dev_info = dev_info;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,8 +27,10 @@ typedef struct _pco_ctx pco_ctx;
|
||||
typedef struct _pco_data pco_data;
|
||||
|
||||
pco_ctx *pco_ctx_create(const struct pvr_device_info *dev_info, void *mem_ctx);
|
||||
const struct spirv_to_nir_options *pco_spirv_options(pco_ctx *ctx);
|
||||
const nir_shader_compiler_options *pco_nir_options(pco_ctx *ctx);
|
||||
void pco_ctx_update_dev_info(pco_ctx *ctx,
|
||||
const struct pvr_device_info *dev_info);
|
||||
const struct spirv_to_nir_options *pco_spirv_options(void);
|
||||
const nir_shader_compiler_options *pco_nir_options(void);
|
||||
|
||||
void pco_preprocess_nir(pco_ctx *ctx, nir_shader *nir);
|
||||
void pco_link_nir(pco_ctx *ctx, nir_shader *producer, nir_shader *consumer);
|
||||
|
||||
@@ -17,16 +17,16 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/** Base/common SPIR-V to NIR options. */
|
||||
static const struct spirv_to_nir_options pco_base_spirv_options = {
|
||||
/** SPIR-V to NIR options. */
|
||||
static const struct spirv_to_nir_options spirv_options = {
|
||||
.environment = NIR_SPIRV_VULKAN,
|
||||
|
||||
.min_ubo_alignment = PVR_UNIFORM_BUFFER_OFFSET_ALIGNMENT,
|
||||
.min_ssbo_alignment = PVR_STORAGE_BUFFER_OFFSET_ALIGNMENT,
|
||||
};
|
||||
|
||||
/** Base/common NIR options. */
|
||||
static const nir_shader_compiler_options pco_base_nir_options = {
|
||||
/** NIR options. */
|
||||
static const nir_shader_compiler_options nir_options = {
|
||||
.fuse_ffma32 = true,
|
||||
|
||||
.has_fused_comp_and_csel = true,
|
||||
@@ -38,33 +38,24 @@ static const nir_shader_compiler_options pco_base_nir_options = {
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Sets up device/core-specific SPIR-V to NIR options.
|
||||
* \brief Returns the SPIR-V to NIR options.
|
||||
*
|
||||
* \param[in] dev_info Device info.
|
||||
* \param[out] spirv_options SPIR-V to NIR options.
|
||||
* \return The SPIR-V to NIR options.
|
||||
*/
|
||||
void pco_setup_spirv_options(const struct pvr_device_info *dev_info,
|
||||
struct spirv_to_nir_options *spirv_options)
|
||||
const struct spirv_to_nir_options *pco_spirv_options(void)
|
||||
{
|
||||
memcpy(spirv_options, &pco_base_spirv_options, sizeof(*spirv_options));
|
||||
|
||||
/* TODO: Device/core-dependent options. */
|
||||
puts("finishme: pco_setup_spirv_options");
|
||||
return &spirv_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Sets up device/core-specific NIR options.
|
||||
* \brief Returns the NIR options for a PCO compiler
|
||||
* context.
|
||||
*
|
||||
* \param[in] dev_info Device info.
|
||||
* \param[out] nir_options NIR options.
|
||||
* \return The NIR options.
|
||||
*/
|
||||
void pco_setup_nir_options(const struct pvr_device_info *dev_info,
|
||||
nir_shader_compiler_options *nir_options)
|
||||
const nir_shader_compiler_options *pco_nir_options(void)
|
||||
{
|
||||
memcpy(nir_options, &pco_base_nir_options, sizeof(*nir_options));
|
||||
|
||||
/* TODO: Device/core-dependent options. */
|
||||
puts("finishme: pco_setup_nir_options");
|
||||
return &nir_options;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2090,9 +2090,6 @@ pvr_graphics_pipeline_compile(struct pvr_device *const device,
|
||||
&gfx_pipeline->shader_state.fragment;
|
||||
|
||||
pco_ctx *pco_ctx = device->pdevice->pco_ctx;
|
||||
const struct spirv_to_nir_options *spirv_options =
|
||||
pco_spirv_options(pco_ctx);
|
||||
const nir_shader_compiler_options *nir_options = pco_nir_options(pco_ctx);
|
||||
|
||||
nir_shader *producer = NULL;
|
||||
nir_shader *consumer = NULL;
|
||||
@@ -2119,8 +2116,8 @@ pvr_graphics_pipeline_compile(struct pvr_device *const device,
|
||||
vk_pipeline_shader_stage_to_nir(&device->vk,
|
||||
gfx_pipeline->base.pipeline_flags,
|
||||
&pCreateInfo->pStages[stage_index],
|
||||
spirv_options,
|
||||
nir_options,
|
||||
pco_spirv_options(),
|
||||
pco_nir_options(),
|
||||
shader_mem_ctx,
|
||||
&nir_shaders[stage]);
|
||||
if (result != VK_SUCCESS)
|
||||
|
||||
Reference in New Issue
Block a user