Merge pull request #1030 from devnexen/toconstexpr

Use `if constexpr` to enforce the static (compile-time) branching by
`SWFeatureLevel` in inner rendering loops of the software renderer
master
yvt 2022-07-19 00:24:14 +09:00 committed by GitHub
commit f47c997fd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -533,7 +533,7 @@ namespace spades {
LinePixel px;
px.depth = dist;
#if ENABLE_SSE
if (flevel == SWFeatureLevel::SSE2) {
if constexpr (flevel == SWFeatureLevel::SSE2) {
__m128i m;
uint32_t col = map.GetColorWrapped(x, y, z);
m = _mm_setr_epi32(col, 0, 0, 0);
@ -887,7 +887,7 @@ namespace spades {
// though this isn't a problem as long as the color comes
// in the LSB's
#if ENABLE_SSE
if (flevel == SWFeatureLevel::SSE2) {
if constexpr (flevel == SWFeatureLevel::SSE2) {
__m128i m;
if (under == 1) {
@ -985,7 +985,7 @@ namespace spades {
// though this isn't a problem as long as the color comes
// in the LSB's
#if ENABLE_SSE
if (flevel == SWFeatureLevel::SSE2) {
if constexpr (flevel == SWFeatureLevel::SSE2) {
__m128i m;
if (under == 1) {

View File

@ -234,7 +234,7 @@ namespace spades {
SPAssert(normal < 28);
int bright = brights[normal];
#if ENABLE_SSE2
if (lvl == SWFeatureLevel::SSE2) {
if constexpr (lvl == SWFeatureLevel::SSE2) {
auto m = _mm_setr_epi32(color, 0, 0, 0);
auto f = _mm_set1_epi16(bright << 8);