Merge pull request #3044 from Dragios/wnarrowing
Get rid of narrowing conversion warning (-Wnarrowing)
This commit is contained in:
commit
edfc8d133a
6 changed files with 30 additions and 34 deletions
|
@ -20,7 +20,6 @@
|
||||||
using Pica::Rasterizer::Vertex;
|
using Pica::Rasterizer::Vertex;
|
||||||
|
|
||||||
namespace Pica {
|
namespace Pica {
|
||||||
|
|
||||||
namespace Clipper {
|
namespace Clipper {
|
||||||
|
|
||||||
struct ClippingEdge {
|
struct ClippingEdge {
|
||||||
|
@ -192,6 +191,5 @@ void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const Outpu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace Clipper
|
||||||
|
} // namespace Pica
|
||||||
} // namespace
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace Pica {
|
namespace Pica {
|
||||||
|
|
||||||
namespace Shader {
|
namespace Shader {
|
||||||
struct OutputVertex;
|
struct OutputVertex;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +15,5 @@ using Shader::OutputVertex;
|
||||||
|
|
||||||
void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const OutputVertex& v2);
|
void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const OutputVertex& v2);
|
||||||
|
|
||||||
} // namespace
|
} // namespace Clipper
|
||||||
|
} // namespace Pica
|
||||||
} // namespace
|
|
||||||
|
|
|
@ -376,8 +376,9 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve
|
||||||
|
|
||||||
if (use_border_s || use_border_t) {
|
if (use_border_s || use_border_t) {
|
||||||
auto border_color = texture.config.border_color;
|
auto border_color = texture.config.border_color;
|
||||||
texture_color[i] = {border_color.r, border_color.g, border_color.b,
|
texture_color[i] = Math::MakeVec(border_color.r.Value(), border_color.g.Value(),
|
||||||
border_color.a};
|
border_color.b.Value(), border_color.a.Value())
|
||||||
|
.Cast<u8>();
|
||||||
} else {
|
} else {
|
||||||
// Textures are laid out from bottom to top, hence we invert the t coordinate.
|
// Textures are laid out from bottom to top, hence we invert the t coordinate.
|
||||||
// NOTE: This may not be the right place for the inversion.
|
// NOTE: This may not be the right place for the inversion.
|
||||||
|
@ -414,12 +415,12 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve
|
||||||
// analogously.
|
// analogously.
|
||||||
Math::Vec4<u8> combiner_output;
|
Math::Vec4<u8> combiner_output;
|
||||||
Math::Vec4<u8> combiner_buffer = {0, 0, 0, 0};
|
Math::Vec4<u8> combiner_buffer = {0, 0, 0, 0};
|
||||||
Math::Vec4<u8> next_combiner_buffer = {
|
Math::Vec4<u8> next_combiner_buffer =
|
||||||
regs.texturing.tev_combiner_buffer_color.r,
|
Math::MakeVec(regs.texturing.tev_combiner_buffer_color.r.Value(),
|
||||||
regs.texturing.tev_combiner_buffer_color.g,
|
regs.texturing.tev_combiner_buffer_color.g.Value(),
|
||||||
regs.texturing.tev_combiner_buffer_color.b,
|
regs.texturing.tev_combiner_buffer_color.b.Value(),
|
||||||
regs.texturing.tev_combiner_buffer_color.a,
|
regs.texturing.tev_combiner_buffer_color.a.Value())
|
||||||
};
|
.Cast<u8>();
|
||||||
|
|
||||||
Math::Vec4<u8> primary_fragment_color = {0, 0, 0, 0};
|
Math::Vec4<u8> primary_fragment_color = {0, 0, 0, 0};
|
||||||
Math::Vec4<u8> secondary_fragment_color = {0, 0, 0, 0};
|
Math::Vec4<u8> secondary_fragment_color = {0, 0, 0, 0};
|
||||||
|
@ -473,8 +474,9 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve
|
||||||
return combiner_buffer;
|
return combiner_buffer;
|
||||||
|
|
||||||
case Source::Constant:
|
case Source::Constant:
|
||||||
return {tev_stage.const_r, tev_stage.const_g, tev_stage.const_b,
|
return Math::MakeVec(tev_stage.const_r.Value(), tev_stage.const_g.Value(),
|
||||||
tev_stage.const_a};
|
tev_stage.const_b.Value(), tev_stage.const_a.Value())
|
||||||
|
.Cast<u8>();
|
||||||
|
|
||||||
case Source::Previous:
|
case Source::Previous:
|
||||||
return combiner_output;
|
return combiner_output;
|
||||||
|
@ -587,11 +589,10 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve
|
||||||
// store the depth etc. Using float for now until we know more
|
// store the depth etc. Using float for now until we know more
|
||||||
// about Pica datatypes
|
// about Pica datatypes
|
||||||
if (regs.texturing.fog_mode == TexturingRegs::FogMode::Fog) {
|
if (regs.texturing.fog_mode == TexturingRegs::FogMode::Fog) {
|
||||||
const Math::Vec3<u8> fog_color = {
|
const Math::Vec3<u8> fog_color = Math::MakeVec(regs.texturing.fog_color.r.Value(),
|
||||||
static_cast<u8>(regs.texturing.fog_color.r.Value()),
|
regs.texturing.fog_color.g.Value(),
|
||||||
static_cast<u8>(regs.texturing.fog_color.g.Value()),
|
regs.texturing.fog_color.b.Value())
|
||||||
static_cast<u8>(regs.texturing.fog_color.b.Value()),
|
.Cast<u8>();
|
||||||
};
|
|
||||||
|
|
||||||
// Get index into fog LUT
|
// Get index into fog LUT
|
||||||
float fog_index;
|
float fog_index;
|
||||||
|
@ -743,12 +744,12 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve
|
||||||
FramebufferRegs::BlendFactor factor) -> u8 {
|
FramebufferRegs::BlendFactor factor) -> u8 {
|
||||||
DEBUG_ASSERT(channel < 4);
|
DEBUG_ASSERT(channel < 4);
|
||||||
|
|
||||||
const Math::Vec4<u8> blend_const = {
|
const Math::Vec4<u8> blend_const =
|
||||||
static_cast<u8>(output_merger.blend_const.r),
|
Math::MakeVec(output_merger.blend_const.r.Value(),
|
||||||
static_cast<u8>(output_merger.blend_const.g),
|
output_merger.blend_const.g.Value(),
|
||||||
static_cast<u8>(output_merger.blend_const.b),
|
output_merger.blend_const.b.Value(),
|
||||||
static_cast<u8>(output_merger.blend_const.a),
|
output_merger.blend_const.a.Value())
|
||||||
};
|
.Cast<u8>();
|
||||||
|
|
||||||
switch (factor) {
|
switch (factor) {
|
||||||
case FramebufferRegs::BlendFactor::Zero:
|
case FramebufferRegs::BlendFactor::Zero:
|
||||||
|
@ -849,5 +850,4 @@ void ProcessTriangle(const Vertex& v0, const Vertex& v1, const Vertex& v2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Rasterizer
|
} // namespace Rasterizer
|
||||||
|
|
||||||
} // namespace Pica
|
} // namespace Pica
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "video_core/shader/shader.h"
|
#include "video_core/shader/shader.h"
|
||||||
|
|
||||||
namespace Pica {
|
namespace Pica {
|
||||||
|
|
||||||
namespace Rasterizer {
|
namespace Rasterizer {
|
||||||
|
|
||||||
struct Vertex : Shader::OutputVertex {
|
struct Vertex : Shader::OutputVertex {
|
||||||
|
@ -44,5 +43,4 @@ struct Vertex : Shader::OutputVertex {
|
||||||
void ProcessTriangle(const Vertex& v0, const Vertex& v1, const Vertex& v2);
|
void ProcessTriangle(const Vertex& v0, const Vertex& v1, const Vertex& v2);
|
||||||
|
|
||||||
} // namespace Rasterizer
|
} // namespace Rasterizer
|
||||||
|
|
||||||
} // namespace Pica
|
} // namespace Pica
|
||||||
|
|
|
@ -12,4 +12,5 @@ void SWRasterizer::AddTriangle(const Pica::Shader::OutputVertex& v0,
|
||||||
const Pica::Shader::OutputVertex& v2) {
|
const Pica::Shader::OutputVertex& v2) {
|
||||||
Pica::Clipper::ProcessTriangle(v0, v1, v2);
|
Pica::Clipper::ProcessTriangle(v0, v1, v2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
} // namespace VideoCore
|
||||||
|
|
|
@ -24,4 +24,5 @@ class SWRasterizer : public RasterizerInterface {
|
||||||
void FlushRegion(PAddr addr, u32 size) override {}
|
void FlushRegion(PAddr addr, u32 size) override {}
|
||||||
void FlushAndInvalidateRegion(PAddr addr, u32 size) override {}
|
void FlushAndInvalidateRegion(PAddr addr, u32 size) override {}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
} // namespace VideoCore
|
||||||
|
|
Loading…
Reference in a new issue