mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 18:01:15 +00:00
[vulkan] Get wall rendering partially working
Many surfaces are missing (I suspect it's due to transform stage management in the index emitter), and currently only the light maps are rendered (still not binding the correct textures), but the basics are working.
This commit is contained in:
parent
7e7b82086c
commit
c75568c1cf
7 changed files with 33 additions and 11 deletions
|
@ -195,7 +195,7 @@
|
|||
location = 1;
|
||||
binding = 0;
|
||||
format = r32g32b32a32_sfloat;
|
||||
offset = 8;
|
||||
offset = 16;
|
||||
},
|
||||
);
|
||||
};
|
||||
|
|
|
@ -115,10 +115,11 @@ main (void)
|
|||
} else {
|
||||
c = texture (Texture, t_st);
|
||||
}*/
|
||||
c = texture (Texture, t_st);
|
||||
if (doLight) {
|
||||
c *= texture (Lightmap, l_st);
|
||||
}
|
||||
c += texture (Glowmap, t_st);
|
||||
|
||||
frag_color = vec4(t_st, 1, 1);//fogBlend (c);
|
||||
c = texture (Lightmap, l_st);
|
||||
frag_color = c;//fogBlend (c);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,6 @@ void
|
|||
main (void)
|
||||
{
|
||||
gl_Position = Projection * (View * (Model * vertex));
|
||||
direction = (Sky * vertex).xyz;
|
||||
direction = vertex.xyz;//(Sky * vertex).xyz;
|
||||
tl_st = tl_uv;
|
||||
}
|
||||
|
|
|
@ -270,7 +270,7 @@ QFV_SubpicBatch (subpic_t *subpic, qfv_stagebuf_t *stage)
|
|||
dest = QFV_PacketExtend (scrap->packet, size);
|
||||
}
|
||||
if (!dest) {
|
||||
printf ("could not get space for update\n");
|
||||
printf ("scrap: could not get space for update\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "QF/Vulkan/command.h"
|
||||
#include "QF/Vulkan/descriptor.h"
|
||||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/scrap.h"
|
||||
#include "QF/Vulkan/staging.h"
|
||||
|
||||
|
@ -450,9 +451,13 @@ Vulkan_BuildDisplayLists (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
size_t atom = device->physDev->properties.limits.nonCoherentAtomSize;
|
||||
size_t atom_mask = atom - 1;
|
||||
size_t frames = bctx->frames.size;
|
||||
size_t index_buffer_size = index_count * frames * sizeof (uint32_t);
|
||||
size_t vertex_buffer_size = vertex_count * sizeof (bspvert_t);
|
||||
|
||||
index_buffer_size = (index_buffer_size + atom_mask) & ~atom_mask;
|
||||
stage = QFV_CreateStagingBuffer (device, vertex_buffer_size, 1,
|
||||
ctx->cmdpool);
|
||||
qfv_packet_t *packet = QFV_PacketAcquire (stage);
|
||||
|
@ -1144,6 +1149,21 @@ Vulkan_DrawWorld (vulkan_ctx_t *ctx)
|
|||
tex->elechain_tail = &tex->elechain;
|
||||
}
|
||||
bsp_end (ctx);
|
||||
|
||||
size_t atom = device->physDev->properties.limits.nonCoherentAtomSize;
|
||||
size_t atom_mask = atom - 1;
|
||||
size_t offset = bframe->index_offset;
|
||||
size_t size = bframe->index_count * sizeof (uint32_t);
|
||||
|
||||
offset &= ~atom_mask;
|
||||
size = (size + atom_mask) & ~atom_mask;
|
||||
|
||||
//FIXME this needs to come at the end of the frame after all passes
|
||||
VkMappedMemoryRange range = {
|
||||
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, 0,
|
||||
bctx->index_memory, offset, size
|
||||
};
|
||||
dfunc->vkFlushMappedMemoryRanges (device->dev, 1, &range);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -78,7 +78,8 @@ setup_frame (vulkan_ctx_t *ctx)
|
|||
static void
|
||||
setup_view (vulkan_ctx_t *ctx)
|
||||
{
|
||||
float *mat = ctx->matrices.view_3d;
|
||||
mat4_t mat;
|
||||
float *view = ctx->matrices.view_3d;
|
||||
static mat4_t z_up = {
|
||||
0, 0, -1, 0,
|
||||
-1, 0, 0, 0,
|
||||
|
@ -98,11 +99,11 @@ setup_view (vulkan_ctx_t *ctx)
|
|||
VectorCopy (vup, mat + 8);
|
||||
mat[15] = 1;
|
||||
Mat4Transpose (mat, mat);//AngleVectors gives the transpose of what we want
|
||||
Mat4Mult (z_up, mat, glsl_view);
|
||||
Mat4Mult (z_up, mat, view);
|
||||
|
||||
Mat4Identity (mat);
|
||||
VectorNegate (r_refdef.vieworg, mat + 12);
|
||||
Mat4Mult (glsl_view, mat, glsl_view);
|
||||
Mat4Mult (view, mat, view);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -96,14 +96,14 @@ persp_mat (float *proj, float xmin, float xmax, float ymin, float ymax,
|
|||
proj[12] = 0;
|
||||
|
||||
proj[1] = 0;
|
||||
proj[5] = (2 * neard) / (ymax - ymin);
|
||||
proj[5] = -(2 * neard) / (ymax - ymin);
|
||||
proj[9] = (ymax + ymin) / (ymax - ymin);
|
||||
proj[13] = 0;
|
||||
|
||||
proj[2] = 0;
|
||||
proj[6] = 0;
|
||||
proj[10] = (fard + neard) / (neard - fard);
|
||||
proj[14] = (2 * fard * neard) / (neard - fard);
|
||||
proj[10] = (fard) / (neard - fard);
|
||||
proj[14] = (fard * neard) / (neard - fard);
|
||||
|
||||
proj[3] = 0;
|
||||
proj[7] = 0;
|
||||
|
|
Loading…
Reference in a new issue