We need to keep some context for the compilation of the tessellation shaders.
This is required in the case where the domain is specified in the
tessellation control shader instead of the tessellation evaluation
shader, as codegen needs the domain information when compiling the
tessellation evaluation shader.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
nvk_lower_nir(device, nir, &robustness, false, pipeline_layout);
+ struct nvk_pipeline_compilation_ctx ctx = { 0 };
result = nvk_compile_nir(pdevice, nir, NULL,
- &pipeline->base.shaders[MESA_SHADER_COMPUTE]);
+ &pipeline->base.shaders[MESA_SHADER_COMPUTE], &ctx);
ralloc_free(nir);
if (result != VK_SUCCESS)
goto fail;
state.rp->view_mask != 0, pipeline_layout);
}
+ struct nvk_pipeline_compilation_ctx ctx = {
+ .tesc_domain = MESA_PRIM_POINTS,
+ };
+
for (gl_shader_stage stage = 0; stage < MESA_SHADER_STAGES; stage++) {
if (nir[stage] == NULL)
continue;
}
result = nvk_compile_nir(pdevice, nir[stage], fs_key,
- &pipeline->base.shaders[stage]);
+ &pipeline->base.shaders[stage], &ctx);
ralloc_free(nir[stage]);
if (result != VK_SUCCESS)
goto fail;
const VkAllocationCallbacks *pAllocator,
VkPipeline *pPipeline);
+struct nvk_pipeline_compilation_ctx {
+ uint8_t tesc_domain; // MESA_PRIM_{POINTS, QUADS, TRIANGLES, LINES}
+};
+
+
#endif
#include "nvk_device.h"
#include "nvk_shader.h"
#include "nvk_physical_device.h"
+#include "nvk_pipeline.h"
#include "nouveau_bo.h"
#include "nouveau_context.h"
VkResult
nvk_compile_nir(struct nvk_physical_device *device, nir_shader *nir,
const struct nvk_fs_key *fs_key,
- struct nvk_shader *shader)
+ struct nvk_shader *shader,
+ struct nvk_pipeline_compilation_ctx *ctx)
{
struct nv50_ir_prog_info *info;
struct nv50_ir_prog_info_out info_out = {};
info->io.auxCBSlot = 1;
info->io.uboInfoBase = 0;
info->io.drawInfoBase = 0;
+ if (nir->info.stage == MESA_SHADER_TESS_EVAL) {
+ info->prop.tese.prespecified_domain = ctx->tesc_domain;
+ }
if (nir->info.stage == MESA_SHADER_COMPUTE) {
info->prop.cp.gridInfoBase = 0;
} else {
}
}
+ if (info->type == PIPE_SHADER_TESS_CTRL) {
+ ctx->tesc_domain = info_out.prop.tp.domain;
+ }
+
return VK_SUCCESS;
}
struct vk_pipeline_robustness_state;
struct nvk_device;
struct nvk_physical_device;
+struct nvk_pipeline_compilation_ctx;
#define GF100_SHADER_HEADER_SIZE (20 * 4)
#define TU102_SHADER_HEADER_SIZE (32 * 4)
VkResult
nvk_compile_nir(struct nvk_physical_device *device, nir_shader *nir,
const struct nvk_fs_key *fs_key,
- struct nvk_shader *shader);
+ struct nvk_shader *shader,
+ struct nvk_pipeline_compilation_ctx *ctx);
VkResult
nvk_shader_upload(struct nvk_device *dev, struct nvk_shader *shader);