}
}
-static VkShaderModule
+static struct zink_shader_object
zink_shader_spirv_compile(struct zink_screen *screen, struct zink_shader *zs, struct spirv_shader *spirv)
{
- VkShaderModule mod;
VkShaderModuleCreateInfo smci = {0};
if (!spirv)
}
#endif
- VkResult ret = VKSCR(CreateShaderModule)(screen->dev, &smci, NULL, &mod);
+ struct zink_shader_object obj;
+ VkResult ret = VKSCR(CreateShaderModule)(screen->dev, &smci, NULL, &obj.mod);
bool success = zink_screen_handle_vkresult(screen, ret);
assert(success);
- return success ? mod : VK_NULL_HANDLE;
+ return obj;
}
static void
static struct zink_shader_object
compile_module(struct zink_screen *screen, struct zink_shader *zs, nir_shader *nir)
{
- VkShaderModule mod = VK_NULL_HANDLE;
struct zink_shader_info *sinfo = &zs->sinfo;
prune_io(nir);
NIR_PASS_V(nir, nir_convert_from_ssa, true);
+ struct zink_shader_object obj;
struct spirv_shader *spirv = nir_to_spirv(nir, sinfo, screen->spirv_version);
if (spirv)
- mod = zink_shader_spirv_compile(screen, zs, spirv);
+ obj = zink_shader_spirv_compile(screen, zs, spirv);
/* TODO: determine if there's any reason to cache spirv output? */
if (zs->info.stage == MESA_SHADER_TESS_CTRL && zs->non_fs.is_generated)
zs->spirv = spirv;
else
ralloc_free(spirv);
- struct zink_shader_object obj = {.mod = mod};
return obj;
}
}
-VkShaderModule
+struct zink_shader_object
zink_shader_tcs_compile(struct zink_screen *screen, struct zink_shader *zs, unsigned patch_vertices)
{
assert(zs->info.stage == MESA_SHADER_TESS_CTRL);
void
zink_gfx_shader_free(struct zink_screen *screen, struct zink_shader *shader);
-VkShaderModule
+struct zink_shader_object
zink_shader_tcs_compile(struct zink_screen *screen, struct zink_shader *zs, unsigned patch_vertices);
struct zink_shader *
zink_shader_tcs_create(struct zink_screen *screen, nir_shader *tes, unsigned vertices_per_patch, nir_shader **nir_ret);
unsigned patch_vertices = state->shader_keys.key[MESA_SHADER_TESS_CTRL ].key.tcs.patch_vertices;
if (stage == MESA_SHADER_TESS_CTRL && zs->non_fs.is_generated && zs->spirv) {
assert(ctx); //TODO async
- mod = zink_shader_tcs_compile(screen, zs, patch_vertices);
+ struct zink_shader_object obj = zink_shader_tcs_compile(screen, zs, patch_vertices);
+ mod = obj.mod;
} else {
mod = zink_shader_compile(screen, zs, zink_shader_blob_deserialize(screen, &prog->blobs[stage]), key, &ctx->di.zs_swizzle[stage]);
}
if (stage == MESA_SHADER_TESS_CTRL && zs->non_fs.is_generated && zs->spirv) {
assert(ctx); //TODO async
struct zink_tcs_key *tcs = (struct zink_tcs_key*)key;
- mod = zink_shader_tcs_compile(screen, zs, tcs->patch_vertices);
+ struct zink_shader_object obj = zink_shader_tcs_compile(screen, zs, tcs->patch_vertices);
+ mod = obj.mod;
} else {
mod = zink_shader_compile(screen, zs, zink_shader_blob_deserialize(screen, &prog->blobs[stage]), (struct zink_shader_key*)key, shadow_needs_shader_swizzle ? &ctx->di.zs_swizzle[stage] : NULL);
}