Common Vertex Formats

Reporter: RobertBColton  |  Status: open  |  Last Modified: November 17, 2018, 01:17:46 AM

This pull request was originally optimization related since defining vertex formats was performing poorly until #1372 was merged. Now the pull request is just being left open as a proposed API. The idea behind this is to make it easy to define a simple vertex format and is inspired by Direct3D's now-deprecated Flexible Vertex Formats.

The pull request adds the vertex_format_define function which accepts a combination of cvf_* constants and returns an id to a vertex format created from the flags. The function is generic and also has a redundant cache to make it even faster to create a common vertex format (e.g, just position and color or other formats I consider "simple" or "common").

The pull request also overloads the 2D and 3D primitive drawing functions to accept an id of a vertex format describing the primitive about to be drawn. This would theoretically be quicker when the format is known ahead of time so the d3d_model_* class won't have to "guess" the format of the primitive. These changes could also be separated out from the rest of this pull request as they are not closely related.

codecov[bot]  
>Codecov Report

Merging #1369 into master will increase coverage by 0.42%.
The diff coverage is 13.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1369      +/-   ##
==========================================
+ Coverage   16.74%   17.16%   +0.42%     
==========================================
  Files         164      164              
  Lines       17095    17121      +26     
==========================================
+ Hits         2862     2939      +77     
+ Misses      14233    14182      -51
Impacted Files Coverage Δ
...system/SHELL/Graphics_Systems/General/GSvertex.cpp 47.22% <0%> (-4.52%) ⬇️
...em/SHELL/Graphics_Systems/General/GSprimitives.cpp 60.19% <50%> (ø) ⬆️
...Asystem/SHELL/Universal_System/instance_system.cpp 53.19% <0%> (+2.12%) ⬆️
ENIGMAsystem/SHELL/Platforms/General/PFwindow.cpp 34.06% <0%> (+3.29%) ⬆️
ENIGMAsystem/SHELL/Universal_System/var4.cpp 20.38% <0%> (+4.14%) ⬆️
ENIGMAsystem/SHELL/Universal_System/roomsystem.cpp 27.71% <0%> (+5.03%) ⬆️
...system/SHELL/Graphics_Systems/OpenGL1/GLscreen.cpp 59.15% <0%> (+9.85%) ⬆️
...system/SHELL/Graphics_Systems/General/GSscreen.cpp 53.22% <0%> (+15.72%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 950036a...e0ff6f5. Read the comment docs.

Please sign in to post comments, or you can view this issue on GitHub.