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
This commit is contained in:
commit
f47c997fd7
@ -533,7 +533,7 @@ namespace spades {
|
|||||||
LinePixel px;
|
LinePixel px;
|
||||||
px.depth = dist;
|
px.depth = dist;
|
||||||
#if ENABLE_SSE
|
#if ENABLE_SSE
|
||||||
if (flevel == SWFeatureLevel::SSE2) {
|
if constexpr (flevel == SWFeatureLevel::SSE2) {
|
||||||
__m128i m;
|
__m128i m;
|
||||||
uint32_t col = map.GetColorWrapped(x, y, z);
|
uint32_t col = map.GetColorWrapped(x, y, z);
|
||||||
m = _mm_setr_epi32(col, 0, 0, 0);
|
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
|
// though this isn't a problem as long as the color comes
|
||||||
// in the LSB's
|
// in the LSB's
|
||||||
#if ENABLE_SSE
|
#if ENABLE_SSE
|
||||||
if (flevel == SWFeatureLevel::SSE2) {
|
if constexpr (flevel == SWFeatureLevel::SSE2) {
|
||||||
__m128i m;
|
__m128i m;
|
||||||
|
|
||||||
if (under == 1) {
|
if (under == 1) {
|
||||||
@ -985,7 +985,7 @@ namespace spades {
|
|||||||
// though this isn't a problem as long as the color comes
|
// though this isn't a problem as long as the color comes
|
||||||
// in the LSB's
|
// in the LSB's
|
||||||
#if ENABLE_SSE
|
#if ENABLE_SSE
|
||||||
if (flevel == SWFeatureLevel::SSE2) {
|
if constexpr (flevel == SWFeatureLevel::SSE2) {
|
||||||
__m128i m;
|
__m128i m;
|
||||||
|
|
||||||
if (under == 1) {
|
if (under == 1) {
|
||||||
|
@ -234,7 +234,7 @@ namespace spades {
|
|||||||
SPAssert(normal < 28);
|
SPAssert(normal < 28);
|
||||||
int bright = brights[normal];
|
int bright = brights[normal];
|
||||||
#if ENABLE_SSE2
|
#if ENABLE_SSE2
|
||||||
if (lvl == SWFeatureLevel::SSE2) {
|
if constexpr (lvl == SWFeatureLevel::SSE2) {
|
||||||
auto m = _mm_setr_epi32(color, 0, 0, 0);
|
auto m = _mm_setr_epi32(color, 0, 0, 0);
|
||||||
auto f = _mm_set1_epi16(bright << 8);
|
auto f = _mm_set1_epi16(bright << 8);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user