Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primitive storage and static model improvements #171

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d28f882
Replaced the SoA storage of world and instanced primitives with unifi…
apanteleev Nov 25, 2021
0d6d22b
Fixed the tangents upload code.
apanteleev Nov 25, 2021
2b19383
Switched to writing the primitive data in bsp_mesh directly. Massive …
apanteleev Nov 25, 2021
9d1e47c
Switched the data formats for frame-based and IQM models to the same …
apanteleev Dec 9, 2021
318e641
Removed the sky and dynamic flags from ray payload, added buffer index.
apanteleev Dec 10, 2021
02e2a56
Replaced the single instanceCustomIndex field storing a dynamic flag …
apanteleev Dec 11, 2021
9b652f9
Break up long line (no functional changes).
apanteleev Dec 11, 2021
6b358e6
Build static BLAS for models without animations.
apanteleev Dec 11, 2021
d6bf89a
Replaced the macro-driven declaration of instance buffer structure co…
apanteleev Dec 13, 2021
0eaa588
Fixed the flickering lights on bsp models.
apanteleev Dec 13, 2021
87fc76f
Use static BLAS of eligible models instead of passing them through in…
apanteleev Dec 13, 2021
cc60f1d
Unified the BSP models and regular models into the same representatio…
apanteleev Dec 14, 2021
38ec7ed
Added support for multiple meshes/geometries in static models.
apanteleev Dec 15, 2021
d2b944c
Switched from a statically sized world primitive buffer to a dynamic …
apanteleev Dec 15, 2021
73bf198
Place the world BLAS into the same vertex buffer, create BLAS for BSP…
apanteleev Dec 16, 2021
82d9ac2
Removed the MAX_MODEL_MESHES limit.
apanteleev Dec 16, 2021
b814ed6
Added calculation of model tangents on load.
apanteleev Dec 16, 2021
a41502f
Removed a stale comment.
apanteleev Dec 16, 2021
bba1bb5
Implemented shadow map rendering for instanced static meshes - both b…
apanteleev Dec 16, 2021
1ded7f7
Refactoring the fill_model_instance function.
apanteleev Dec 16, 2021
c2ada48
That was unnecessary.
apanteleev Dec 16, 2021
66e75a1
Disabled culling on transparent materials.
apanteleev Dec 16, 2021
a5e136c
Removed the unnecessary use_prim_offset parameter.
apanteleev Dec 16, 2021
5f0cab4
Increased the max instance count.
apanteleev Dec 16, 2021
29b16eb
Track primitives, not vertices.
apanteleev Dec 17, 2021
4b25324
Replaced MAX_PRIM_INSTANCED with a dynamically sized buffer.
apanteleev Dec 17, 2021
01b314d
Added the missing VERTEX_BUFFER bit to the model VBOs.
apanteleev Dec 17, 2021
58bad6d
Clang compat and cleanup.
apanteleev Dec 18, 2021
e3bcb45
Fixed the masked materials on static models.
apanteleev Dec 18, 2021
25b232d
Re-create the static model VBOs when their materials change.
apanteleev Dec 18, 2021
6404801
Renamed the motion fields in VboPrimitive for clarity.
apanteleev Dec 18, 2021
835de32
Expanded the V-buffer to have enough bits for many instances with mil…
apanteleev Dec 18, 2021
4746ce7
Merge branch 'master' into vbo
apanteleev Dec 18, 2021
21c7277
Addressing PR feedback.
apanteleev Dec 18, 2021
74c3c60
Replaced the uses of mat3 for positions of a triangle with prim_posit…
apanteleev Dec 18, 2021
762d608
Rollback the TRIANGLE_FACING_CULL_DISABLE_BIT change on transparent g…
apanteleev Dec 18, 2021
5944201
Merge branch 'master' into vbo
apanteleev Dec 18, 2021
a34e8c9
Merge branch 'master' into vbo
apanteleev Dec 20, 2021
03972d6
Fixed the model resource leaks on map change.
apanteleev Dec 20, 2021
0ae6d78
Fixed the BSP resource leak on map change.
apanteleev Dec 20, 2021
57e2a49
Added debug names to model and world objects.
apanteleev Dec 20, 2021
ed2ad93
Fixed the excessive destruction of model VBOs on map or material chan…
apanteleev Dec 20, 2021
cb04989
Fixed the memory leak in the static environment maps on map changes.
apanteleev Dec 20, 2021
a161674
Fixed the primitive indexing for explosions.
apanteleev Dec 20, 2021
e1b2a22
Added support for generic translucent geometry specified using the SU…
apanteleev Dec 20, 2021
53a5af3
Fixed the player setup screen rendering.
apanteleev Dec 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmake/compileShaders.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ set(SHADER_SOURCE_DEPENDENCIES
${CMAKE_SOURCE_DIR}/src/refresh/vkpt/shader/precomputed_sky.glsl
${CMAKE_SOURCE_DIR}/src/refresh/vkpt/shader/precomputed_sky_params.h
${CMAKE_SOURCE_DIR}/src/refresh/vkpt/shader/projection.glsl
${CMAKE_SOURCE_DIR}/src/refresh/vkpt/shader/read_visbuf.glsl
${CMAKE_SOURCE_DIR}/src/refresh/vkpt/shader/sky.h
${CMAKE_SOURCE_DIR}/src/refresh/vkpt/shader/tiny_encryption_algorithm.h
${CMAKE_SOURCE_DIR}/src/refresh/vkpt/shader/tone_mapping_utils.glsl
Expand Down
2 changes: 1 addition & 1 deletion inc/common/bsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void BSP_TransformedLightPoint(lightpoint_t *point, vec3_t start, vec3_t end,
#endif

byte *BSP_ClusterVis(bsp_t *bsp, byte *mask, int cluster, int vis);
mleaf_t *BSP_PointLeaf(mnode_t *node, vec3_t p);
mleaf_t *BSP_PointLeaf(mnode_t *node, const vec3_t p);
mmodel_t *BSP_InlineModel(bsp_t *bsp, const char *name);

byte* BSP_GetPvs(bsp_t *bsp, int cluster);
Expand Down
2 changes: 1 addition & 1 deletion inc/common/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static inline int BoxOnPlaneSideFast(vec3_t emins, vec3_t emaxs, cplane_t *p)
return BoxOnPlaneSide(emins, emaxs, p);
}

static inline vec_t PlaneDiffFast(vec3_t v, cplane_t *p)
static inline vec_t PlaneDiffFast(const vec3_t v, cplane_t *p)
{
// fast axial cases
if (p->type < 3) {
Expand Down
2 changes: 1 addition & 1 deletion inc/refresh/models.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ typedef struct
float* tangents;
byte* colors;
byte* blend_indices; // byte4 per vertex
float* blend_weights; // float4 per vertex
byte* blend_weights; // byte4 per vertex

char* jointNames;
int* jointParents;
Expand Down
2 changes: 1 addition & 1 deletion src/common/bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1923,7 +1923,7 @@ byte *BSP_ClusterVis(bsp_t *bsp, byte *mask, int cluster, int vis)
return mask;
}

mleaf_t *BSP_PointLeaf(mnode_t *node, vec3_t p)
mleaf_t *BSP_PointLeaf(mnode_t *node, const vec3_t p)
{
float d;

Expand Down
23 changes: 16 additions & 7 deletions src/refresh/model_iqm.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ qerror_t MOD_LoadIQM_Base(model_t* model, const void* rawdata, size_t length, co

if (vertexArrayFormat[IQM_BLENDWEIGHTS] != -1)
{
iqmData->blend_weights = (float*)MOD_Malloc(header->num_vertexes * 4 * sizeof(float));
iqmData->blend_weights = MOD_Malloc(header->num_vertexes * 4 * sizeof(byte));
}
}

Expand Down Expand Up @@ -574,20 +574,29 @@ qerror_t MOD_LoadIQM_Base(model_t* model, const void* rawdata, size_t length, co
n * sizeof(float));
break;
case IQM_BLENDWEIGHTS:
if (vertexArrayFormat[IQM_BLENDWEIGHTS] == IQM_FLOAT)
if (vertexArrayFormat[IQM_BLENDWEIGHTS] == IQM_UBYTE)
{
memcpy(iqmData->blend_weights,
(const byte*)header + vertexarray->offset,
n * sizeof(float));
n * sizeof(byte));
}
else
else if(vertexArrayFormat[IQM_BLENDWEIGHTS] == IQM_FLOAT)
{
// convert blend weights from byte to float
for (uint32_t vertex_idx = 0; vertex_idx < 4 * header->num_vertexes; vertex_idx++)
const float* weights = (const float*)((const byte*)header + vertexarray->offset);

// convert blend weights from float to byte
for (uint32_t weight_idx = 0; weight_idx < 4 * header->num_vertexes; weight_idx++)
{
iqmData->blend_weights[vertex_idx] = (float)((const byte*)header + vertexarray->offset)[vertex_idx] / 255.f;
float integer_weight = weights[weight_idx] * 255.f;
clamp(integer_weight, 0.f, 255.f);
iqmData->blend_weights[weight_idx] = (byte)integer_weight;
}
}
else
{
Com_WPrintf("R_LoadIQM: unsupported format for blend weights (%d)\n", vertexArrayFormat[IQM_BLENDWEIGHTS]);
memset(iqmData->blend_weights, 0, n * sizeof(byte));
}
break;
case IQM_COLOR:
memcpy(iqmData->colors,
Expand Down
Loading