mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
[vulkan] Clean up the sampler config loading
Samplers have no direct relation to render passes or pipelines, so should not necessarily be in the same config file. This makes all the old config files obsolete, and quite a bit of support code in vkparse.c.
This commit is contained in:
parent
f2d2db9ef3
commit
17ee6911f9
20 changed files with 380 additions and 33 deletions
|
@ -95,6 +95,7 @@ void Vulkan_AliasAddSkin (struct vulkan_ctx_s *ctx, qfv_alias_skin_t *skin);
|
|||
void Vulkan_AliasRemoveSkin (struct vulkan_ctx_s *ctx, qfv_alias_skin_t *skin);
|
||||
|
||||
void Vulkan_Alias_Init (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Alias_Setup (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Alias_Shutdown (struct vulkan_ctx_s *ctx);
|
||||
|
||||
#endif//__QF_Vulkan_qf_alias_h
|
||||
|
|
|
@ -107,6 +107,7 @@ void Vulkan_IQMAddSkin (struct vulkan_ctx_s *ctx, qfv_iqm_skin_t *skin);
|
|||
void Vulkan_IQMRemoveSkin (struct vulkan_ctx_s *ctx, qfv_iqm_skin_t *skin);
|
||||
|
||||
void Vulkan_IQM_Init (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_IQM_Setup (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_IQM_Shutdown (struct vulkan_ctx_s *ctx);
|
||||
|
||||
#endif//__QF_Vulkan_qf_iqm_h
|
||||
|
|
|
@ -76,6 +76,7 @@ void Vulkan_Mod_SpriteLoadFrames (struct mod_sprite_ctx_s *sprite_ctx,
|
|||
struct vulkan_ctx_s *ctx);
|
||||
|
||||
void Vulkan_Sprite_Init (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Sprite_Setup (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Sprite_Shutdown (struct vulkan_ctx_s *ctx);
|
||||
|
||||
#endif//__QF_Vulkan_qf_sprite_h
|
||||
|
|
|
@ -272,6 +272,35 @@ typedef struct qfv_jobinfo_s {
|
|||
qfv_descriptorsetlayoutinfo_t *dslayouts;
|
||||
} qfv_jobinfo_t;
|
||||
|
||||
typedef struct qfv_samplercreateinfo_s {
|
||||
const char *name;
|
||||
VkSamplerCreateFlags flags;
|
||||
VkFilter magFilter;
|
||||
VkFilter minFilter;
|
||||
VkSamplerMipmapMode mipmapMode;
|
||||
VkSamplerAddressMode addressModeU;
|
||||
VkSamplerAddressMode addressModeV;
|
||||
VkSamplerAddressMode addressModeW;
|
||||
float mipLodBias;
|
||||
VkBool32 anisotropyEnable;
|
||||
float maxAnisotropy;
|
||||
VkBool32 compareEnable;
|
||||
VkCompareOp compareOp;
|
||||
float minLod;
|
||||
float maxLod;
|
||||
VkBorderColor borderColor;
|
||||
VkBool32 unnormalizedCoordinates;
|
||||
VkSampler sampler;
|
||||
} qfv_samplercreateinfo_t;
|
||||
|
||||
typedef struct qfv_samplerinfo_s {
|
||||
struct memsuper_s *memsuper;
|
||||
|
||||
struct plitem_s *plitem;
|
||||
qfv_samplercreateinfo_t *samplers;
|
||||
uint32_t num_samplers;
|
||||
} qfv_samplerinfo_t;
|
||||
|
||||
#ifndef __QFCC__
|
||||
typedef struct qfv_label_s {
|
||||
vec4f_t color;
|
||||
|
@ -386,6 +415,7 @@ typedef struct qfv_renderctx_s {
|
|||
struct hashctx_s *hashctx;
|
||||
exprtab_t task_functions;
|
||||
qfv_jobinfo_t *jobinfo;
|
||||
qfv_samplerinfo_t *samplerinfo;
|
||||
qfv_job_t *job;
|
||||
qfv_renderframeset_t frames;
|
||||
} qfv_renderctx_t;
|
||||
|
@ -401,7 +431,8 @@ VkCommandBuffer QFV_GetCmdBuffer (struct vulkan_ctx_s *ctx, bool secondary);
|
|||
void QFV_AppendCmdBuffer (struct vulkan_ctx_s *ctx, VkCommandBuffer cmd);
|
||||
|
||||
void QFV_RunRenderJob (struct vulkan_ctx_s *ctx);
|
||||
void QFV_LoadRenderInfo (struct vulkan_ctx_s *ctx);
|
||||
void QFV_LoadRenderInfo (struct vulkan_ctx_s *ctx, const char *name);
|
||||
void QFV_LoadSamplerInfo (struct vulkan_ctx_s *ctx, const char *name);
|
||||
void QFV_BuildRender (struct vulkan_ctx_s *ctx);
|
||||
void QFV_Render_Init (struct vulkan_ctx_s *ctx);
|
||||
void QFV_Render_Shutdown (struct vulkan_ctx_s *ctx);
|
||||
|
@ -412,6 +443,7 @@ void QFV_CreateFramebuffer (struct vulkan_ctx_s *ctx, qfv_renderpass_t *rp);
|
|||
struct qfv_dsmanager_s *
|
||||
QFV_Render_DSManager (struct vulkan_ctx_s *ctx,
|
||||
const char *setName) __attribute__((pure));
|
||||
VkSampler QFV_Render_Sampler (struct vulkan_ctx_s *ctx, const char *name);
|
||||
|
||||
qfv_step_t *QFV_GetStep (const exprval_t *param, qfv_job_t *job);
|
||||
qfv_step_t *QFV_FindStep (const char *step, qfv_job_t *job) __attribute__((pure));
|
||||
|
|
|
@ -203,6 +203,8 @@ rp_forward_src = libs/video/renderer/vulkan/rp_forward.plist
|
|||
rp_forward_gen = libs/video/renderer/vulkan/rp_forward.plc
|
||||
rp_main_def_src = libs/video/renderer/vulkan/rp_main_def.plist
|
||||
rp_main_def_gen = libs/video/renderer/vulkan/rp_main_def.plc
|
||||
smp_quake_src = libs/video/renderer/vulkan/smp_quake.plist
|
||||
smp_quake_gen = libs/video/renderer/vulkan/smp_quake.plc
|
||||
rp_output_src = libs/video/renderer/vulkan/rp_output.plist
|
||||
rp_output_gen = libs/video/renderer/vulkan/rp_output.plc
|
||||
rp_shadow_src = libs/video/renderer/vulkan/rp_shadow.plist
|
||||
|
@ -270,6 +272,7 @@ libs/video/renderer/vulkan/vkparse.lo: \
|
|||
${rp_deferred_gen} \
|
||||
$(rp_forward_gen) \
|
||||
$(rp_main_def_gen) \
|
||||
$(smp_quake_gen)
|
||||
$(rp_output_gen) \
|
||||
${rp_shadow_gen}
|
||||
|
||||
|
@ -530,6 +533,7 @@ EXTRA_DIST += \
|
|||
$(rp_deferred_src) \
|
||||
$(rp_forward_src) \
|
||||
$(rp_main_def_src) \
|
||||
$(smp_quake_src) \
|
||||
$(rp_output_src) \
|
||||
$(rp_shadow_src) \
|
||||
$(pl_quake_def_src) \
|
||||
|
|
|
@ -112,14 +112,18 @@ vulkan_R_Init (void)
|
|||
Vulkan_Translucent_Init (vulkan_ctx);
|
||||
Vulkan_Compose_Init (vulkan_ctx);
|
||||
|
||||
QFV_LoadRenderInfo (vulkan_ctx);
|
||||
QFV_LoadRenderInfo (vulkan_ctx, "main_def");
|
||||
QFV_LoadSamplerInfo (vulkan_ctx, "smp_quake");
|
||||
QFV_BuildRender (vulkan_ctx);
|
||||
|
||||
Vulkan_Texture_Setup (vulkan_ctx);
|
||||
Vulkan_Palette_Init (vulkan_ctx, vid.palette);
|
||||
Vulkan_Alias_Setup (vulkan_ctx);
|
||||
Vulkan_Bsp_Setup (vulkan_ctx);
|
||||
Vulkan_IQM_Setup (vulkan_ctx);
|
||||
Vulkan_Matrix_Setup (vulkan_ctx);
|
||||
Vulkan_Scene_Setup (vulkan_ctx);
|
||||
Vulkan_Sprite_Setup (vulkan_ctx);
|
||||
Vulkan_Output_Setup (vulkan_ctx);
|
||||
Vulkan_Compose_Setup (vulkan_ctx);
|
||||
Vulkan_Draw_Setup (vulkan_ctx);
|
||||
|
|
|
@ -508,6 +508,15 @@ QFV_Render_Shutdown (vulkan_ctx_t *ctx)
|
|||
if (rctx->task_functions.tab) {
|
||||
Hash_DelTable (rctx->task_functions.tab);
|
||||
}
|
||||
if (rctx->samplerinfo) {
|
||||
auto si = rctx->samplerinfo;
|
||||
for (uint32_t i = 0; i < si->num_samplers; i++) {
|
||||
auto sci = &si->samplers[i];
|
||||
if (sci->sampler) {
|
||||
dfunc->vkDestroySampler (device->dev, sci->sampler, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Hash_DelContext (rctx->hashctx);
|
||||
}
|
||||
|
||||
|
@ -562,7 +571,7 @@ QFV_GetStep (const exprval_t *param, qfv_job_t *job)
|
|||
}
|
||||
|
||||
qfv_dsmanager_t *
|
||||
QFV_Render_DSManager (struct vulkan_ctx_s *ctx, const char *setName)
|
||||
QFV_Render_DSManager (vulkan_ctx_t *ctx, const char *setName)
|
||||
{
|
||||
auto job = ctx->render_context->job;
|
||||
for (uint32_t i = 0; i < job->num_dsmanagers; i++) {
|
||||
|
@ -573,3 +582,52 @@ QFV_Render_DSManager (struct vulkan_ctx_s *ctx, const char *setName)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
create_sampler (vulkan_ctx_t *ctx, qfv_samplercreateinfo_t *sampler)
|
||||
{
|
||||
VkSamplerCreateInfo create = {
|
||||
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
||||
.flags = sampler->flags,
|
||||
.magFilter = sampler->magFilter,
|
||||
.minFilter = sampler->minFilter,
|
||||
.mipmapMode = sampler->mipmapMode,
|
||||
.addressModeU = sampler->addressModeU,
|
||||
.addressModeV = sampler->addressModeV,
|
||||
.addressModeW = sampler->addressModeW,
|
||||
.mipLodBias = sampler->mipLodBias,
|
||||
.anisotropyEnable = sampler->anisotropyEnable,
|
||||
.maxAnisotropy = sampler->maxAnisotropy,
|
||||
.compareEnable = sampler->compareEnable,
|
||||
.compareOp = sampler->compareOp,
|
||||
.minLod = sampler->minLod,
|
||||
.maxLod = sampler->maxLod,
|
||||
.borderColor = sampler->borderColor,
|
||||
.unnormalizedCoordinates = sampler->unnormalizedCoordinates,
|
||||
};
|
||||
auto device = ctx->device;
|
||||
auto dfunc = device->funcs;
|
||||
dfunc->vkCreateSampler (device->dev, &create, 0, &sampler->sampler);
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_SAMPLER, sampler->sampler,
|
||||
va (ctx->va_ctx, "sampler:%s", sampler->name));
|
||||
}
|
||||
|
||||
VkSampler
|
||||
QFV_Render_Sampler (vulkan_ctx_t *ctx, const char *name)
|
||||
{
|
||||
auto si = ctx->render_context->samplerinfo;
|
||||
if (!si) {
|
||||
return 0;
|
||||
}
|
||||
for (uint32_t i = 0; i < si->num_samplers; i++) {
|
||||
auto sci = &si->samplers[i];
|
||||
if (!strcmp (sci->name, name)) {
|
||||
if (!sci->sampler) {
|
||||
create_sampler (ctx, sci);
|
||||
}
|
||||
return sci->sampler;
|
||||
}
|
||||
}
|
||||
printf ("sampler %s not found\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -72,12 +72,11 @@ get_output (vulkan_ctx_t *ctx, plitem_t *item)
|
|||
}
|
||||
|
||||
void
|
||||
QFV_LoadRenderInfo (vulkan_ctx_t *ctx)
|
||||
QFV_LoadRenderInfo (vulkan_ctx_t *ctx, const char *name)
|
||||
{
|
||||
__auto_type rctx = ctx->render_context;
|
||||
|
||||
plitem_t *item = Vulkan_GetConfig (ctx, "main_def");
|
||||
__auto_type output = get_output (ctx, item);
|
||||
auto rctx = ctx->render_context;
|
||||
auto item = Vulkan_GetConfig (ctx, name);
|
||||
auto output = get_output (ctx, item);
|
||||
Vulkan_Script_SetOutput (ctx, &output);
|
||||
rctx->jobinfo = QFV_ParseJobInfo (ctx, item, rctx);
|
||||
if (rctx->jobinfo) {
|
||||
|
@ -85,6 +84,17 @@ QFV_LoadRenderInfo (vulkan_ctx_t *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
QFV_LoadSamplerInfo (vulkan_ctx_t *ctx, const char *name)
|
||||
{
|
||||
auto rctx = ctx->render_context;
|
||||
auto item = Vulkan_GetConfig (ctx, name);
|
||||
rctx->samplerinfo = QFV_ParseSamplerInfo (ctx, item, rctx);
|
||||
if (rctx->samplerinfo) {
|
||||
rctx->samplerinfo->plitem = item;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint32_t num_images;
|
||||
uint32_t num_imageviews;
|
||||
|
|
138
libs/video/renderer/vulkan/smp_quake.plist
Normal file
138
libs/video/renderer/vulkan/smp_quake.plist
Normal file
|
@ -0,0 +1,138 @@
|
|||
samplers = {
|
||||
quakepic = {
|
||||
magFilter = nearest;
|
||||
minFilter = nearest;
|
||||
mipmapMode = nearest;
|
||||
addressModeU = clamp_to_edge;
|
||||
addressModeV = clamp_to_edge;
|
||||
addressModeW = clamp_to_edge;
|
||||
mipLodBias = 0;
|
||||
anisotropyEnable = false;
|
||||
maxAnisotropy = 0;
|
||||
compareEnable = false;
|
||||
compareOp = always;
|
||||
minLod = 0;
|
||||
maxLod = 0;
|
||||
borderColor = float_transparent_black;
|
||||
unnormalizedCoordinates = false;
|
||||
};
|
||||
glyph = {
|
||||
magFilter = linear;
|
||||
minFilter = linear;
|
||||
mipmapMode = linear;
|
||||
addressModeU = clamp_to_edge;
|
||||
addressModeV = clamp_to_edge;
|
||||
addressModeW = clamp_to_edge;
|
||||
mipLodBias = 0;
|
||||
anisotropyEnable = false;
|
||||
maxAnisotropy = 0;
|
||||
compareEnable = false;
|
||||
compareOp = always;
|
||||
minLod = 0;
|
||||
maxLod = 0;
|
||||
borderColor = float_transparent_black;
|
||||
unnormalizedCoordinates = false;
|
||||
};
|
||||
palette_sampler = {
|
||||
magFilter = nearest;
|
||||
minFilter = nearest;
|
||||
mipmapMode = nearest;
|
||||
addressModeU = clamp_to_edge;
|
||||
addressModeV = clamp_to_edge;
|
||||
addressModeW = clamp_to_edge;
|
||||
mipLodBias = 0;
|
||||
anisotropyEnable = false;
|
||||
maxAnisotropy = 0;
|
||||
compareEnable = false;
|
||||
compareOp = always;
|
||||
minLod = 0;
|
||||
maxLod = 4;
|
||||
borderColor = float_transparent_black;
|
||||
unnormalizedCoordinates = false;
|
||||
};
|
||||
quakebsp_sampler = {
|
||||
magFilter = linear;
|
||||
minFilter = linear;
|
||||
mipmapMode = linear;
|
||||
addressModeU = repeat;
|
||||
addressModeV = repeat;
|
||||
addressModeW = repeat;
|
||||
mipLodBias = 0;
|
||||
anisotropyEnable = false;
|
||||
maxAnisotropy = 0;
|
||||
compareEnable = false;
|
||||
compareOp = always;
|
||||
minLod = 0;
|
||||
maxLod = 4;
|
||||
borderColor = float_transparent_black;
|
||||
unnormalizedCoordinates = false;
|
||||
};
|
||||
alias_sampler = {
|
||||
magFilter = linear;
|
||||
minFilter = linear;
|
||||
mipmapMode = linear;
|
||||
addressModeU = clamp_to_edge;
|
||||
addressModeV = clamp_to_edge;
|
||||
addressModeW = clamp_to_edge;
|
||||
mipLodBias = 0;
|
||||
anisotropyEnable = false;
|
||||
maxAnisotropy = 0;
|
||||
compareEnable = false;
|
||||
compareOp = always;
|
||||
minLod = 0;
|
||||
maxLod = 1000;
|
||||
borderColor = float_transparent_black;
|
||||
unnormalizedCoordinates = false;
|
||||
};
|
||||
sprite_sampler = {
|
||||
magFilter = linear;
|
||||
minFilter = linear;
|
||||
mipmapMode = linear;
|
||||
addressModeU = clamp_to_edge;
|
||||
addressModeV = clamp_to_edge;
|
||||
addressModeW = clamp_to_edge;
|
||||
mipLodBias = 0;
|
||||
anisotropyEnable = false;
|
||||
maxAnisotropy = 0;
|
||||
compareEnable = false;
|
||||
compareOp = always;
|
||||
minLod = 0;
|
||||
maxLod = 1000;
|
||||
borderColor = float_transparent_black;
|
||||
unnormalizedCoordinates = false;
|
||||
};
|
||||
shadow_sampler = {
|
||||
magFilter = linear;
|
||||
minFilter = linear;
|
||||
mipmapMode = linear;
|
||||
addressModeU = clamp_to_edge;
|
||||
addressModeV = clamp_to_edge;
|
||||
addressModeW = clamp_to_edge;
|
||||
mipLodBias = 0;
|
||||
anisotropyEnable = false;
|
||||
maxAnisotropy = 0;
|
||||
compareEnable = true;
|
||||
compareOp = greater_or_equal;
|
||||
minLod = 0;
|
||||
maxLod = 1000;
|
||||
borderColor = float_transparent_black;
|
||||
unnormalizedCoordinates = false;
|
||||
};
|
||||
linear = {
|
||||
magFilter = linear;
|
||||
minFilter = linear;
|
||||
mipmapMode = linear;
|
||||
addressModeU = clamp_to_edge;
|
||||
addressModeV = clamp_to_edge;
|
||||
addressModeW = clamp_to_edge;
|
||||
mipLodBias = 0;
|
||||
anisotropyEnable = false;
|
||||
maxAnisotropy = 0;
|
||||
compareEnable = false;
|
||||
compareOp = always;
|
||||
minLod = 0;
|
||||
maxLod = 0;
|
||||
borderColor = float_transparent_black;
|
||||
unnormalizedCoordinates = false;
|
||||
};
|
||||
};
|
|
@ -1866,6 +1866,10 @@ static exprsym_t builtin_plist_syms[] = {
|
|||
.value = (void *)
|
||||
#include "libs/video/renderer/vulkan/rp_main_def.plc"
|
||||
},
|
||||
{ .name = "smp_quake",
|
||||
.value = (void *)
|
||||
#include "libs/video/renderer/vulkan/smp_quake.plc"
|
||||
},
|
||||
{ .name = "output",
|
||||
.value = (void *)
|
||||
#include "libs/video/renderer/vulkan/rp_output.plc"
|
||||
|
@ -2118,8 +2122,8 @@ struct qfv_jobinfo_s *
|
|||
QFV_ParseJobInfo (vulkan_ctx_t *ctx, plitem_t *item, qfv_renderctx_t *rctx)
|
||||
{
|
||||
memsuper_t *memsuper = new_memsuper ();
|
||||
qfv_jobinfo_t *ri = cmemalloc (memsuper, sizeof (qfv_jobinfo_t));
|
||||
*ri = (qfv_jobinfo_t) { .memsuper = memsuper };
|
||||
qfv_jobinfo_t *ji = cmemalloc (memsuper, sizeof (qfv_jobinfo_t));
|
||||
*ji = (qfv_jobinfo_t) { .memsuper = memsuper };
|
||||
|
||||
scriptctx_t *sctx = ctx->script_context;
|
||||
plitem_t *messages = PL_NewArray ();
|
||||
|
@ -2155,7 +2159,7 @@ QFV_ParseJobInfo (vulkan_ctx_t *ctx, plitem_t *item, qfv_renderctx_t *rctx)
|
|||
&exprctx);
|
||||
|
||||
int ret;
|
||||
if (!(ret = parse_qfv_jobinfo_t (0, item, ri, messages, &parsectx))) {
|
||||
if (!(ret = parse_qfv_jobinfo_t (0, item, ji, messages, &parsectx))) {
|
||||
for (int i = 0; i < PL_A_NumObjects (messages); i++) {
|
||||
Sys_Printf ("%s\n", PL_String (PL_ObjectAtIndex (messages, i)));
|
||||
}
|
||||
|
@ -2164,10 +2168,56 @@ QFV_ParseJobInfo (vulkan_ctx_t *ctx, plitem_t *item, qfv_renderctx_t *rctx)
|
|||
PL_Release (messages);
|
||||
if (!ret) {
|
||||
delete_memsuper (memsuper);
|
||||
ri = 0;
|
||||
ji = 0;
|
||||
}
|
||||
|
||||
return ri;
|
||||
return ji;
|
||||
}
|
||||
|
||||
struct qfv_samplerinfo_s *
|
||||
QFV_ParseSamplerInfo (vulkan_ctx_t *ctx, plitem_t *item, qfv_renderctx_t *rctx)
|
||||
{
|
||||
memsuper_t *memsuper = new_memsuper ();
|
||||
qfv_samplerinfo_t *si = cmemalloc (memsuper, sizeof (qfv_samplerinfo_t));
|
||||
*si = (qfv_samplerinfo_t) { .memsuper = memsuper };
|
||||
|
||||
scriptctx_t *sctx = ctx->script_context;
|
||||
plitem_t *messages = PL_NewArray ();
|
||||
|
||||
exprctx_t exprctx = {
|
||||
.symtab = &root_symtab,
|
||||
.messages = messages,
|
||||
.hashctx = &sctx->hashctx,
|
||||
.memsuper = memsuper,
|
||||
};
|
||||
parsectx_t parsectx = {
|
||||
.ectx = &exprctx,
|
||||
.vctx = ctx,
|
||||
.data = rctx,
|
||||
};
|
||||
|
||||
exprsym_t var_syms[] = {
|
||||
{"physDevLimits", &VkPhysicalDeviceLimits_type,
|
||||
&ctx->device->physDev->properties->limits },
|
||||
{}
|
||||
};
|
||||
exprctx.external_variables = QFV_CreateSymtab (item, "properties",
|
||||
0, var_syms, &exprctx);
|
||||
|
||||
int ret;
|
||||
if (!(ret = parse_qfv_samplerinfo_t (0, item, si, messages, &parsectx))) {
|
||||
for (int i = 0; i < PL_A_NumObjects (messages); i++) {
|
||||
Sys_Printf ("%s\n", PL_String (PL_ObjectAtIndex (messages, i)));
|
||||
}
|
||||
}
|
||||
QFV_DestroySymtab (exprctx.external_variables);
|
||||
PL_Release (messages);
|
||||
if (!ret) {
|
||||
delete_memsuper (memsuper);
|
||||
si = 0;
|
||||
}
|
||||
|
||||
return si;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -88,4 +88,7 @@ int QFV_ParseLayoutInfo (vulkan_ctx_t *ctx, struct memsuper_s *memsuper,
|
|||
qfv_layoutinfo_t *layout);
|
||||
struct qfv_jobinfo_s *QFV_ParseJobInfo (vulkan_ctx_t *ctx, plitem_t *item,
|
||||
struct qfv_renderctx_s *rctx);
|
||||
struct qfv_samplerinfo_s *QFV_ParseSamplerInfo (vulkan_ctx_t *ctx,
|
||||
plitem_t *item,
|
||||
struct qfv_renderctx_s *rctx);
|
||||
#endif//__vkparse_h
|
||||
|
|
|
@ -54,6 +54,8 @@ search = (
|
|||
qfv_processinfo_t,
|
||||
qfv_stepinfo_t,
|
||||
qfv_jobinfo_t,
|
||||
qfv_samplercreateinfo_t,
|
||||
qfv_samplerinfo_t,
|
||||
);
|
||||
parse = {
|
||||
VkSubpassDescription = {
|
||||
|
@ -779,5 +781,35 @@ parse = {
|
|||
size = num_dslayouts;
|
||||
values = dslayouts;
|
||||
};
|
||||
plitem = ignore;
|
||||
};
|
||||
qfv_samplercreateinfo_s = {
|
||||
.name = qfv_samplercreateinfo_t;
|
||||
flags = auto;
|
||||
magFilter = auto;
|
||||
minFilter = auto;
|
||||
mipmapMode = auto;
|
||||
addressModeU = auto;
|
||||
addressModeV = auto;
|
||||
addressModeW = auto;
|
||||
mipLodBias = auto;
|
||||
anisotropyEnable = auto;
|
||||
maxAnisotropy = auto;
|
||||
compareEnable = auto;
|
||||
compareOp = auto;
|
||||
minLod = auto;
|
||||
maxLod = auto;
|
||||
borderColor = auto;
|
||||
unnormalizedCoordinates = auto;
|
||||
sampler = ignore;
|
||||
};
|
||||
qfv_samplerinfo_s = {
|
||||
.name = qfv_samplerinfo_t;
|
||||
samplers = {
|
||||
type = (labeledarray, qfv_samplercreateinfo_t, name);
|
||||
size = num_samplers;
|
||||
values = samplers;
|
||||
};
|
||||
plitem = ignore;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -246,10 +246,16 @@ Vulkan_Alias_Init (vulkan_ctx_t *ctx)
|
|||
aliasctx_t *actx = calloc (1, sizeof (aliasctx_t));
|
||||
ctx->alias_context = actx;
|
||||
|
||||
actx->sampler = Vulkan_CreateSampler (ctx, "alias_sampler");
|
||||
qfvPopDebug (ctx);
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_Alias_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
auto actx = ctx->alias_context;
|
||||
actx->sampler = QFV_Render_Sampler (ctx, "alias_sampler");
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_Alias_Shutdown (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
|
|
@ -1284,6 +1284,8 @@ Vulkan_Bsp_Setup (vulkan_ctx_t *ctx)
|
|||
|
||||
auto bctx = ctx->bsp_context;
|
||||
|
||||
bctx->sampler = QFV_Render_Sampler (ctx, "quakebsp_sampler");
|
||||
|
||||
bctx->light_scrap = QFV_CreateScrap (device, "lightmap_atlas", 2048,
|
||||
tex_frgba, ctx->staging);
|
||||
size_t size = QFV_ScrapSize (bctx->light_scrap);
|
||||
|
@ -1308,8 +1310,6 @@ Vulkan_Bsp_Setup (vulkan_ctx_t *ctx)
|
|||
DARRAY_RESIZE (&bctx->frames, frames);
|
||||
bctx->frames.grow = 0;
|
||||
|
||||
bctx->sampler = Vulkan_CreateSampler (ctx, "quakebsp_sampler");
|
||||
|
||||
size_t entid_count = Vulkan_Scene_MaxEntities (ctx);
|
||||
size_t entid_size = entid_count * sizeof (uint32_t);
|
||||
size_t atom = device->physDev->properties->limits.nonCoherentAtomSize;
|
||||
|
|
|
@ -1046,6 +1046,9 @@ Vulkan_Draw_Setup (vulkan_ctx_t *ctx)
|
|||
auto dfunc = device->funcs;
|
||||
auto dctx = ctx->draw_context;
|
||||
|
||||
dctx->pic_sampler = QFV_Render_Sampler (ctx, "quakepic");
|
||||
dctx->glyph_sampler = QFV_Render_Sampler (ctx, "glyph");
|
||||
|
||||
dctx->dsmanager = QFV_Render_DSManager (ctx, "quad_data_set");
|
||||
|
||||
auto rctx = ctx->render_context;
|
||||
|
@ -1069,8 +1072,6 @@ Vulkan_Draw_Setup (vulkan_ctx_t *ctx)
|
|||
ctx->cmdpool);
|
||||
dctx->scrap = QFV_CreateScrap (device, "draw_atlas", 2048, tex_rgba,
|
||||
dctx->stage);
|
||||
dctx->pic_sampler = Vulkan_CreateSampler (ctx, "quakepic");
|
||||
dctx->glyph_sampler = Vulkan_CreateSampler (ctx, "glyph");
|
||||
|
||||
load_conchars (ctx);
|
||||
load_crosshairs (ctx);
|
||||
|
|
|
@ -313,11 +313,16 @@ Vulkan_IQM_Init (vulkan_ctx_t *ctx)
|
|||
DARRAY_RESIZE (&ictx->frames, frames);
|
||||
ictx->frames.grow = 0;
|
||||
|
||||
ictx->sampler = Vulkan_CreateSampler (ctx, "alias_sampler");
|
||||
|
||||
qfvPopDebug (ctx);
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_IQM_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
auto ictx = ctx->iqm_context;
|
||||
ictx->sampler = QFV_Render_Sampler (ctx, "alias_sampler");
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_IQM_Shutdown (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
|
|
@ -313,6 +313,8 @@ Vulkan_Lighting_Setup (vulkan_ctx_t *ctx)
|
|||
auto dfunc = device->funcs;
|
||||
auto lctx = ctx->lighting_context;
|
||||
|
||||
lctx->sampler = QFV_Render_Sampler (ctx, "shadow_sampler");
|
||||
|
||||
Vulkan_Script_SetOutput (ctx,
|
||||
&(qfv_output_t) { .format = VK_FORMAT_X8_D24_UNORM_PACK32 });
|
||||
#if 0
|
||||
|
@ -335,8 +337,6 @@ Vulkan_Lighting_Setup (vulkan_ctx_t *ctx)
|
|||
DARRAY_RESIZE (&lctx->frames, frames);
|
||||
lctx->frames.grow = 0;
|
||||
|
||||
lctx->sampler = Vulkan_CreateSampler (ctx, "shadow_sampler");
|
||||
|
||||
__auto_type lbuffers = QFV_AllocBufferSet (frames, alloca);
|
||||
for (size_t i = 0; i < frames; i++) {
|
||||
lbuffers->a[i] = QFV_CreateBuffer (device, sizeof (qfv_light_buffer_t),
|
||||
|
|
|
@ -240,14 +240,6 @@ Vulkan_Output_Init (vulkan_ctx_t *ctx)
|
|||
ctx->output_context = octx;
|
||||
|
||||
QFV_Render_AddTasks (ctx, output_task_syms);
|
||||
|
||||
__auto_type pld = ctx->script_context->pipelineDef;//FIXME
|
||||
ctx->script_context->pipelineDef = Vulkan_GetConfig (ctx, "qf_output");
|
||||
|
||||
qfvPushDebug (ctx, "output init");
|
||||
octx->sampler = Vulkan_CreateSampler (ctx, "linear");
|
||||
ctx->script_context->pipelineDef = pld;
|
||||
qfvPopDebug (ctx);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -263,6 +255,8 @@ Vulkan_Output_Setup (vulkan_ctx_t *ctx)
|
|||
DARRAY_RESIZE (&octx->frames, frames);
|
||||
octx->frames.grow = 0;
|
||||
|
||||
octx->sampler = QFV_Render_Sampler (ctx, "linear");
|
||||
|
||||
auto dsmanager = QFV_Render_DSManager (ctx, "output_set");
|
||||
|
||||
for (size_t i = 0; i < frames; i++) {
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
#include "QF/Vulkan/qf_palette.h"
|
||||
#include "QF/Vulkan/qf_texture.h"
|
||||
|
||||
|
@ -69,7 +70,8 @@ Vulkan_Palette_Init (vulkan_ctx_t *ctx, const byte *palette)
|
|||
palettectx_t *pctx = calloc (1, sizeof (palettectx_t));
|
||||
ctx->palette_context = pctx;
|
||||
|
||||
pctx->sampler = Vulkan_CreateSampler (ctx, "palette_sampler");
|
||||
pctx->sampler = QFV_Render_Sampler (ctx, "palette_sampler");
|
||||
|
||||
tex_t tex = {
|
||||
.width = 16,
|
||||
.height = 16,
|
||||
|
|
|
@ -220,11 +220,16 @@ Vulkan_Sprite_Init (vulkan_ctx_t *ctx)
|
|||
spritectx_t *sctx = calloc (1, sizeof (spritectx_t));
|
||||
ctx->sprite_context = sctx;
|
||||
|
||||
sctx->sampler = Vulkan_CreateSampler (ctx, "sprite_sampler");
|
||||
|
||||
qfvPopDebug (ctx);
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_Sprite_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
auto sctx = ctx->sprite_context;
|
||||
sctx->sampler = QFV_Render_Sampler (ctx, "sprite_sampler");
|
||||
}
|
||||
|
||||
void
|
||||
Vulkan_Sprite_Shutdown (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue