mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 20:00:10 +01:00
pvr, pco: Add new compiler framework and shader gen stubs
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/32258>
This commit is contained in:
parent
ab1298e926
commit
e90c851b8c
26 changed files with 449 additions and 28 deletions
|
|
@ -1,12 +1,14 @@
|
||||||
# Copyright © 2024 Imagination Technologies Ltd.
|
# Copyright © 2024 Imagination Technologies Ltd.
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
inc_powervr_compiler = include_directories([
|
inc_powervr_compiler = include_directories(['.'])
|
||||||
'.',
|
|
||||||
])
|
|
||||||
|
|
||||||
libpowervr_compiler_files = files(
|
libpowervr_compiler_files = files(
|
||||||
'pco.c',
|
'pco.c',
|
||||||
|
'pco_binary.c',
|
||||||
|
'pco_ir.c',
|
||||||
|
'pco_nir.c',
|
||||||
|
'pco_trans_nir.c',
|
||||||
)
|
)
|
||||||
|
|
||||||
libpowervr_compiler = static_library(
|
libpowervr_compiler = static_library(
|
||||||
|
|
|
||||||
|
|
@ -9,3 +9,50 @@
|
||||||
*
|
*
|
||||||
* \brief Main compiler interface.
|
* \brief Main compiler interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "pco.h"
|
||||||
|
#include "pco_internal.h"
|
||||||
|
#include "util/macros.h"
|
||||||
|
#include "util/ralloc.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Allocates and sets up a PCO compiler context.
|
||||||
|
*
|
||||||
|
* \param[in] dev_info Device info.
|
||||||
|
* \param[in] mem_ctx Ralloc memory allocation context.
|
||||||
|
* \return The PCO compiler context, or NULL on failure.
|
||||||
|
*/
|
||||||
|
pco_ctx *pco_ctx_create(const struct pvr_device_info *dev_info, void *mem_ctx)
|
||||||
|
{
|
||||||
|
pco_ctx *ctx = rzalloc_size(mem_ctx, sizeof(*ctx));
|
||||||
|
|
||||||
|
ctx->dev_info = dev_info;
|
||||||
|
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Returns the device/core-specific SPIR-V to NIR options for a PCO
|
||||||
|
* compiler context.
|
||||||
|
*
|
||||||
|
* \param[in] ctx PCO compiler context.
|
||||||
|
* \return The device/core-specific SPIR-V to NIR options.
|
||||||
|
*/
|
||||||
|
const struct spirv_to_nir_options *pco_spirv_options(pco_ctx *ctx)
|
||||||
|
{
|
||||||
|
unreachable("finishme: pco_spirv_options");
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
unreachable("finishme: pco_nir_options");
|
||||||
|
return &ctx->nir_options;
|
||||||
|
}
|
||||||
|
|
|
||||||
45
src/imagination/pco/pco.h
Normal file
45
src/imagination/pco/pco.h
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2024 Imagination Technologies Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PCO_H
|
||||||
|
#define PCO_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file pco.h
|
||||||
|
*
|
||||||
|
* \brief Main compiler interface header.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "compiler/nir/nir.h"
|
||||||
|
|
||||||
|
/* Defines. */
|
||||||
|
#define PCO_REG_UNUSED (~0U)
|
||||||
|
|
||||||
|
/* Driver-specific forward-declarations. */
|
||||||
|
struct pvr_device_info;
|
||||||
|
|
||||||
|
/* Compiler-specific forward-declarations. */
|
||||||
|
typedef struct _pco_shader pco_shader;
|
||||||
|
typedef struct _pco_ctx pco_ctx;
|
||||||
|
|
||||||
|
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_preprocess_nir(pco_ctx *ctx, nir_shader *nir);
|
||||||
|
void pco_link_nir(pco_ctx *ctx, nir_shader *producer, nir_shader *consumer);
|
||||||
|
void pco_lower_nir(pco_ctx *ctx, nir_shader *nir);
|
||||||
|
void pco_postprocess_nir(pco_ctx *ctx, nir_shader *nir);
|
||||||
|
|
||||||
|
pco_shader *pco_trans_nir(pco_ctx *ctx, nir_shader *nir, void *mem_ctx);
|
||||||
|
void pco_process_ir(pco_ctx *ctx, pco_shader *shader);
|
||||||
|
|
||||||
|
void pco_encode_ir(pco_ctx *ctx, pco_shader *shader);
|
||||||
|
void pco_shader_finalize(pco_ctx *ctx, pco_shader *shader);
|
||||||
|
|
||||||
|
unsigned pco_shader_binary_size(pco_shader *shader);
|
||||||
|
const void *pco_shader_binary_data(pco_shader *shader);
|
||||||
|
#endif /* PCO_H */
|
||||||
62
src/imagination/pco/pco_binary.c
Normal file
62
src/imagination/pco/pco_binary.c
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2024 Imagination Technologies Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file pco_binary.c
|
||||||
|
*
|
||||||
|
* \brief PCO binary-specific functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pco.h"
|
||||||
|
#include "pco_internal.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Encodes a PCO shader into binary.
|
||||||
|
*
|
||||||
|
* \param[in] ctx PCO compiler context.
|
||||||
|
* \param[in,out] shader PCO shader.
|
||||||
|
*/
|
||||||
|
void pco_encode_ir(pco_ctx *ctx, pco_shader *shader)
|
||||||
|
{
|
||||||
|
puts("finishme: pco_encode_ir");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Finalizes a PCO shader binary.
|
||||||
|
*
|
||||||
|
* \param[in] ctx PCO compiler context.
|
||||||
|
* \param[in,out] shader PCO shader.
|
||||||
|
*/
|
||||||
|
void pco_shader_finalize(pco_ctx *ctx, pco_shader *shader)
|
||||||
|
{
|
||||||
|
puts("finishme: pco_shader_finalize");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Returns the size in bytes of a PCO shader binary.
|
||||||
|
*
|
||||||
|
* \param[in] shader PCO shader.
|
||||||
|
* \return The size in bytes of the PCO shader binary.
|
||||||
|
*/
|
||||||
|
unsigned pco_shader_binary_size(pco_shader *shader)
|
||||||
|
{
|
||||||
|
puts("finishme: pco_binary_size");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Returns the PCO shader binary data.
|
||||||
|
*
|
||||||
|
* \param[in] shader PCO shader.
|
||||||
|
* \return The PCO shader binary data.
|
||||||
|
*/
|
||||||
|
const void *pco_shader_binary_data(pco_shader *shader)
|
||||||
|
{
|
||||||
|
puts("finishme: pco_binary_data");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
31
src/imagination/pco/pco_internal.h
Normal file
31
src/imagination/pco/pco_internal.h
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2024 Imagination Technologies Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PCO_INTERNAL_H
|
||||||
|
#define PCO_INTERNAL_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file pco_internal.h
|
||||||
|
*
|
||||||
|
* \brief PCO internal header.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pco.h"
|
||||||
|
#include "spirv/nir_spirv.h"
|
||||||
|
|
||||||
|
/** PCO compiler context. */
|
||||||
|
typedef struct _pco_ctx {
|
||||||
|
/** Device information. */
|
||||||
|
const struct pvr_device_info *dev_info;
|
||||||
|
|
||||||
|
/** Device-specific NIR options. */
|
||||||
|
nir_shader_compiler_options nir_options;
|
||||||
|
|
||||||
|
/** Device-specific SPIR-V to NIR options. */
|
||||||
|
struct spirv_to_nir_options spirv_options;
|
||||||
|
} pco_ctx;
|
||||||
|
|
||||||
|
#endif /* PCO_INTERNAL_H */
|
||||||
27
src/imagination/pco/pco_ir.c
Normal file
27
src/imagination/pco/pco_ir.c
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2024 Imagination Technologies Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file pco_ir.c
|
||||||
|
*
|
||||||
|
* \brief PCO IR-specific functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pco.h"
|
||||||
|
#include "pco_internal.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Runs passes on a PCO shader.
|
||||||
|
*
|
||||||
|
* \param[in] ctx PCO compiler context.
|
||||||
|
* \param[in,out] shader PCO shader.
|
||||||
|
*/
|
||||||
|
void pco_process_ir(pco_ctx *ctx, pco_shader *shader)
|
||||||
|
{
|
||||||
|
puts("finishme: pco_process_ir");
|
||||||
|
}
|
||||||
61
src/imagination/pco/pco_nir.c
Normal file
61
src/imagination/pco/pco_nir.c
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2024 Imagination Technologies Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file pco_nir.c
|
||||||
|
*
|
||||||
|
* \brief NIR-specific functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pco.h"
|
||||||
|
#include "pco_internal.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Runs pre-processing passes on a NIR shader.
|
||||||
|
*
|
||||||
|
* \param[in] ctx PCO compiler context.
|
||||||
|
* \param[in,out] nir NIR shader.
|
||||||
|
*/
|
||||||
|
void pco_preprocess_nir(pco_ctx *ctx, nir_shader *nir)
|
||||||
|
{
|
||||||
|
puts("finishme: pco_preprocess_nir");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Lowers a NIR shader.
|
||||||
|
*
|
||||||
|
* \param[in] ctx PCO compiler context.
|
||||||
|
* \param[in,out] nir NIR shader.
|
||||||
|
*/
|
||||||
|
void pco_lower_nir(pco_ctx *ctx, nir_shader *nir)
|
||||||
|
{
|
||||||
|
puts("finishme: pco_lower_nir");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Runs post-processing passes on a NIR shader.
|
||||||
|
*
|
||||||
|
* \param[in] ctx PCO compiler context.
|
||||||
|
* \param[in,out] nir NIR shader.
|
||||||
|
*/
|
||||||
|
void pco_postprocess_nir(pco_ctx *ctx, nir_shader *nir)
|
||||||
|
{
|
||||||
|
puts("finishme: pco_postprocess_nir");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Performs linking optimizations on consecutive NIR shader stages.
|
||||||
|
*
|
||||||
|
* \param[in] ctx PCO compiler context.
|
||||||
|
* \param[in,out] producer NIR producer shader.
|
||||||
|
* \param[in,out] consumer NIR consumer shader.
|
||||||
|
*/
|
||||||
|
void pco_link_nir(pco_ctx *ctx, nir_shader *producer, nir_shader *consumer)
|
||||||
|
{
|
||||||
|
puts("finishme: pco_link_nir");
|
||||||
|
}
|
||||||
30
src/imagination/pco/pco_trans_nir.c
Normal file
30
src/imagination/pco/pco_trans_nir.c
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2024 Imagination Technologies Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file pco_trans_nir.c
|
||||||
|
*
|
||||||
|
* \brief NIR translation functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pco.h"
|
||||||
|
#include "pco_internal.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Translates a NIR shader into a PCO shader.
|
||||||
|
*
|
||||||
|
* \param[in] ctx PCO compiler context.
|
||||||
|
* \param[in] nir NIR shader.
|
||||||
|
* \param[in] mem_ctx Ralloc memory allocation context.
|
||||||
|
* \return The PCO shader.
|
||||||
|
*/
|
||||||
|
pco_shader *pco_trans_nir(pco_ctx *ctx, nir_shader *nir, void *mem_ctx)
|
||||||
|
{
|
||||||
|
puts("finishme: pco_trans_nir");
|
||||||
|
return ralloc_context(mem_ctx);
|
||||||
|
}
|
||||||
|
|
@ -60,8 +60,6 @@ pvr_files = files(
|
||||||
)
|
)
|
||||||
|
|
||||||
pvr_includes = [
|
pvr_includes = [
|
||||||
include_directories('usc/programs'),
|
|
||||||
include_directories('usc'),
|
|
||||||
include_directories('winsys'),
|
include_directories('winsys'),
|
||||||
libpowervr_pds_includes,
|
libpowervr_pds_includes,
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
#include "pvr_formats.h"
|
#include "pvr_formats.h"
|
||||||
#include "pvr_job_transfer.h"
|
#include "pvr_job_transfer.h"
|
||||||
#include "pvr_private.h"
|
#include "pvr_private.h"
|
||||||
#include "pvr_shader_factory.h"
|
#include "usc/programs/pvr_shader_factory.h"
|
||||||
#include "pvr_static_shaders.h"
|
#include "usc/programs/pvr_static_shaders.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "util/bitscan.h"
|
#include "util/bitscan.h"
|
||||||
#include "util/list.h"
|
#include "util/list.h"
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@
|
||||||
#include "pvr_hardcode.h"
|
#include "pvr_hardcode.h"
|
||||||
#include "pvr_pds.h"
|
#include "pvr_pds.h"
|
||||||
#include "pvr_private.h"
|
#include "pvr_private.h"
|
||||||
#include "pvr_shader_factory.h"
|
#include "usc/programs/pvr_shader_factory.h"
|
||||||
#include "pvr_static_shaders.h"
|
#include "usc/programs/pvr_static_shaders.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "vk_alloc.h"
|
#include "vk_alloc.h"
|
||||||
#include "vk_log.h"
|
#include "vk_log.h"
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
#include "pvr_private.h"
|
#include "pvr_private.h"
|
||||||
#include "pvr_tex_state.h"
|
#include "pvr_tex_state.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "pvr_uscgen.h"
|
#include "usc/pvr_uscgen.h"
|
||||||
#include "pvr_winsys.h"
|
#include "pvr_winsys.h"
|
||||||
#include "util/bitscan.h"
|
#include "util/bitscan.h"
|
||||||
#include "util/bitset.h"
|
#include "util/bitset.h"
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
#include "pvr_robustness.h"
|
#include "pvr_robustness.h"
|
||||||
#include "pvr_tex_state.h"
|
#include "pvr_tex_state.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "pvr_uscgen.h"
|
#include "usc/pvr_uscgen.h"
|
||||||
#include "pvr_util.h"
|
#include "pvr_util.h"
|
||||||
#include "pvr_winsys.h"
|
#include "pvr_winsys.h"
|
||||||
#include "rogue/rogue.h"
|
#include "rogue/rogue.h"
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include "hwdef/rogue_hw_utils.h"
|
#include "hwdef/rogue_hw_utils.h"
|
||||||
#include "pvr_bo.h"
|
#include "pvr_bo.h"
|
||||||
#include "pvr_cdm_load_sr.h"
|
#include "usc/programs/pvr_cdm_load_sr.h"
|
||||||
#include "pvr_common.h"
|
#include "pvr_common.h"
|
||||||
#include "pvr_csb.h"
|
#include "pvr_csb.h"
|
||||||
#include "pvr_job_context.h"
|
#include "pvr_job_context.h"
|
||||||
|
|
@ -38,9 +38,9 @@
|
||||||
#include "pvr_private.h"
|
#include "pvr_private.h"
|
||||||
#include "pvr_transfer_frag_store.h"
|
#include "pvr_transfer_frag_store.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "pvr_uscgen.h"
|
#include "usc/pvr_uscgen.h"
|
||||||
#include "pvr_vdm_load_sr.h"
|
#include "usc/programs/pvr_vdm_load_sr.h"
|
||||||
#include "pvr_vdm_store_sr.h"
|
#include "usc/programs/pvr_vdm_store_sr.h"
|
||||||
#include "pvr_winsys.h"
|
#include "pvr_winsys.h"
|
||||||
#include "util/macros.h"
|
#include "util/macros.h"
|
||||||
#include "util/os_file.h"
|
#include "util/os_file.h"
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include "pvr_private.h"
|
#include "pvr_private.h"
|
||||||
#include "pvr_transfer_frag_store.h"
|
#include "pvr_transfer_frag_store.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "pvr_uscgen.h"
|
#include "usc/pvr_uscgen.h"
|
||||||
#include "pvr_winsys.h"
|
#include "pvr_winsys.h"
|
||||||
|
|
||||||
/* Support PDS code/data loading/storing to the 'B' shared register state
|
/* Support PDS code/data loading/storing to the 'B' shared register state
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
#include "pvr_tex_state.h"
|
#include "pvr_tex_state.h"
|
||||||
#include "pvr_transfer_frag_store.h"
|
#include "pvr_transfer_frag_store.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "pvr_uscgen.h"
|
#include "usc/pvr_uscgen.h"
|
||||||
#include "pvr_util.h"
|
#include "pvr_util.h"
|
||||||
#include "pvr_winsys.h"
|
#include "pvr_winsys.h"
|
||||||
#include "util/bitscan.h"
|
#include "util/bitscan.h"
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
#include "pvr_pds.h"
|
#include "pvr_pds.h"
|
||||||
#include "pvr_private.h"
|
#include "pvr_private.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "pvr_usc_fragment_shader.h"
|
#include "usc/programs/pvr_usc_fragment_shader.h"
|
||||||
#include "util/macros.h"
|
#include "util/macros.h"
|
||||||
#include "rogue/rogue.h"
|
#include "rogue/rogue.h"
|
||||||
#include "vk_alloc.h"
|
#include "vk_alloc.h"
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
#include "pvr_job_render.h"
|
#include "pvr_job_render.h"
|
||||||
#include "pvr_limits.h"
|
#include "pvr_limits.h"
|
||||||
#include "pvr_pds.h"
|
#include "pvr_pds.h"
|
||||||
#include "pvr_shader_factory.h"
|
#include "usc/programs/pvr_shader_factory.h"
|
||||||
#include "pvr_spm.h"
|
#include "pvr_spm.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "pvr_winsys.h"
|
#include "pvr_winsys.h"
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
#include "pvr_formats.h"
|
#include "pvr_formats.h"
|
||||||
#include "pvr_pds.h"
|
#include "pvr_pds.h"
|
||||||
#include "pvr_private.h"
|
#include "pvr_private.h"
|
||||||
#include "pvr_shader_factory.h"
|
#include "usc/programs/pvr_shader_factory.h"
|
||||||
#include "pvr_static_shaders.h"
|
#include "usc/programs/pvr_static_shaders.h"
|
||||||
#include "pvr_tex_state.h"
|
#include "pvr_tex_state.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "vk_alloc.h"
|
#include "vk_alloc.h"
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,12 @@
|
||||||
#include "pvr_job_common.h"
|
#include "pvr_job_common.h"
|
||||||
#include "pvr_pds.h"
|
#include "pvr_pds.h"
|
||||||
#include "pvr_private.h"
|
#include "pvr_private.h"
|
||||||
#include "pvr_shader_factory.h"
|
#include "usc/programs/pvr_shader_factory.h"
|
||||||
#include "pvr_spm.h"
|
#include "pvr_spm.h"
|
||||||
#include "pvr_static_shaders.h"
|
#include "usc/programs/pvr_static_shaders.h"
|
||||||
#include "pvr_tex_state.h"
|
#include "pvr_tex_state.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "pvr_uscgen.h"
|
#include "usc/pvr_uscgen.h"
|
||||||
#include "util/bitscan.h"
|
#include "util/bitscan.h"
|
||||||
#include "util/macros.h"
|
#include "util/macros.h"
|
||||||
#include "util/simple_mtx.h"
|
#include "util/simple_mtx.h"
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
#include "pvr_private.h"
|
#include "pvr_private.h"
|
||||||
#include "pvr_transfer_frag_store.h"
|
#include "pvr_transfer_frag_store.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "pvr_uscgen.h"
|
#include "usc/pvr_uscgen.h"
|
||||||
#include "util/hash_table.h"
|
#include "util/hash_table.h"
|
||||||
#include "util/macros.h"
|
#include "util/macros.h"
|
||||||
#include "util/ralloc.h"
|
#include "util/ralloc.h"
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <vulkan/vulkan_core.h>
|
#include <vulkan/vulkan_core.h>
|
||||||
|
|
||||||
#include "pvr_device_info.h"
|
#include "pvr_device_info.h"
|
||||||
#include "pvr_uscgen.h"
|
#include "usc/pvr_uscgen.h"
|
||||||
#include "pvr_types.h"
|
#include "pvr_types.h"
|
||||||
#include "util/hash_table.h"
|
#include "util/hash_table.h"
|
||||||
|
|
||||||
|
|
|
||||||
80
src/imagination/vulkan/pvr_uscgen.c
Normal file
80
src/imagination/vulkan/pvr_uscgen.c
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2024 Imagination Technologies Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file pvr_uscgen.c
|
||||||
|
*
|
||||||
|
* \brief USC shader generation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "nir/nir.h"
|
||||||
|
#include "nir/nir_builder.h"
|
||||||
|
#include "pco/pco.h"
|
||||||
|
#include "pvr_uscgen.h"
|
||||||
|
#include "util/macros.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common function to build a NIR shader and export the binary.
|
||||||
|
*
|
||||||
|
* \param ctx PCO context.
|
||||||
|
* \param nir NIR shader.
|
||||||
|
* \param binary Output shader binary.
|
||||||
|
*/
|
||||||
|
static void build_shader(pco_ctx *ctx, nir_shader *nir, pco_binary **binary)
|
||||||
|
{
|
||||||
|
pco_preprocess_nir(ctx, nir);
|
||||||
|
pco_lower_nir(ctx, nir);
|
||||||
|
pco_postprocess_nir(ctx, nir);
|
||||||
|
|
||||||
|
pco_shader *shader = pco_trans_nir(ctx, nir);
|
||||||
|
pco_process_ir(ctx, shader);
|
||||||
|
|
||||||
|
pco_binary *bin = pco_encode_ir(ctx, shader);
|
||||||
|
ralloc_free(shader);
|
||||||
|
|
||||||
|
pco_binary_finalize(ctx, bin);
|
||||||
|
*binary = bin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a nop (empty) shader.
|
||||||
|
*
|
||||||
|
* \param ctx PCO context.
|
||||||
|
* \param stage Shader stage.
|
||||||
|
* \param binary Output shader binary.
|
||||||
|
*/
|
||||||
|
void pvr_uscgen_nop(pco_ctx *ctx, gl_shader_stage stage, pco_binary **binary)
|
||||||
|
{
|
||||||
|
unreachable("finishme: pvr_uscgen_nop");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate an end-of-tile shader.
|
||||||
|
*
|
||||||
|
* \param ctx PCO context.
|
||||||
|
* \param props End of tile shader properties.
|
||||||
|
* \param binary Output shader binary.
|
||||||
|
*/
|
||||||
|
void pvr_uscgen_eot(pco_ctx *ctx,
|
||||||
|
struct pvr_eot_props *props,
|
||||||
|
pco_binary **binary)
|
||||||
|
{
|
||||||
|
unreachable("finishme: pvr_uscgen_eot");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a transfer queue shader.
|
||||||
|
*
|
||||||
|
* \param ctx PCO context.
|
||||||
|
* \param props Transfer queue shader properties.
|
||||||
|
* \param binary Output shader binary.
|
||||||
|
*/
|
||||||
|
void pvr_uscgen_tq(pco_ctx *ctx,
|
||||||
|
struct pvr_tq_props *props,
|
||||||
|
pco_binary **binary)
|
||||||
|
{
|
||||||
|
unreachable("finishme: pvr_uscgen_tq");
|
||||||
|
}
|
||||||
38
src/imagination/vulkan/pvr_uscgen.h
Normal file
38
src/imagination/vulkan/pvr_uscgen.h
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2024 Imagination Technologies Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PVR_USCGEN_H
|
||||||
|
#define PVR_USCGEN_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file pvr_uscgen.h
|
||||||
|
*
|
||||||
|
* \brief USC shader generation header.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "compiler/shader_enums.h"
|
||||||
|
#include "pco/pco.h"
|
||||||
|
|
||||||
|
/* NOP shader generation. */
|
||||||
|
void pvr_uscgen_nop(pco_ctx *ctx, gl_shader_stage stage, pco_binary **binary);
|
||||||
|
|
||||||
|
/* EOT shader generation. */
|
||||||
|
struct pvr_eot_props {
|
||||||
|
};
|
||||||
|
|
||||||
|
void pvr_uscgen_eot(pco_ctx *ctx,
|
||||||
|
struct pvr_eot_props *props,
|
||||||
|
pco_binary **binary);
|
||||||
|
|
||||||
|
/* Transfer queue shader generation. */
|
||||||
|
struct pvr_tq_props {
|
||||||
|
};
|
||||||
|
|
||||||
|
void pvr_uscgen_tq(pco_ctx *ctx,
|
||||||
|
struct pvr_tq_props *props,
|
||||||
|
pco_binary **binary);
|
||||||
|
|
||||||
|
#endif /* PVR_USCGEN_H */
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pvr_job_transfer.h"
|
#include "pvr_job_transfer.h"
|
||||||
#include "pvr_uscgen.h"
|
#include "usc/pvr_uscgen.h"
|
||||||
#include "rogue/rogue.h"
|
#include "rogue/rogue.h"
|
||||||
#include "rogue/rogue_builder.h"
|
#include "rogue/rogue_builder.h"
|
||||||
#include "util/u_dynarray.h"
|
#include "util/u_dynarray.h"
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "pvr_uscgen.h"
|
#include "usc/pvr_uscgen.h"
|
||||||
#include "rogue/rogue.h"
|
#include "rogue/rogue.h"
|
||||||
#include "rogue/rogue_builder.h"
|
#include "rogue/rogue_builder.h"
|
||||||
#include "util/u_dynarray.h"
|
#include "util/u_dynarray.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue