summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hw/gpu.cpp4
-rw-r--r--src/core/hw/gpu.h2
-rw-r--r--src/video_core/clipper.cpp8
-rw-r--r--src/video_core/command_processor.cpp12
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp8
-rw-r--r--src/video_core/pica.h2
-rw-r--r--src/video_core/rasterizer.cpp12
-rw-r--r--src/video_core/vertex_shader.cpp2
-rw-r--r--src/video_core/vertex_shader.h2
9 files changed, 26 insertions, 26 deletions
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index 7afb00d6c..9c7192313 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -27,7 +27,7 @@ u64 g_last_frame_ticks = 0; ///< CPU tick count from last frame
27template <typename T> 27template <typename T>
28inline void Read(T &var, const u32 raw_addr) { 28inline void Read(T &var, const u32 raw_addr) {
29 u32 addr = raw_addr - 0x1EF00000; 29 u32 addr = raw_addr - 0x1EF00000;
30 int index = addr / 4; 30 u32 index = addr / 4;
31 31
32 // Reads other than u32 are untested, so I'd rather have them abort than silently fail 32 // Reads other than u32 are untested, so I'd rather have them abort than silently fail
33 if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) { 33 if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) {
@@ -41,7 +41,7 @@ inline void Read(T &var, const u32 raw_addr) {
41template <typename T> 41template <typename T>
42inline void Write(u32 addr, const T data) { 42inline void Write(u32 addr, const T data) {
43 addr -= 0x1EF00000; 43 addr -= 0x1EF00000;
44 int index = addr / 4; 44 u32 index = addr / 4;
45 45
46 // Writes other than u32 are untested, so I'd rather have them abort than silently fail 46 // Writes other than u32 are untested, so I'd rather have them abort than silently fail
47 if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) { 47 if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) {
diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h
index 7186bfa84..c853429a0 100644
--- a/src/core/hw/gpu.h
+++ b/src/core/hw/gpu.h
@@ -201,7 +201,7 @@ struct Regs {
201#undef INSERT_PADDING_WORDS_HELPER2 201#undef INSERT_PADDING_WORDS_HELPER2
202#undef INSERT_PADDING_WORDS 202#undef INSERT_PADDING_WORDS
203 203
204 static inline int NumIds() { 204 static inline size_t NumIds() {
205 return sizeof(Regs) / sizeof(u32); 205 return sizeof(Regs) / sizeof(u32);
206 } 206 }
207 207
diff --git a/src/video_core/clipper.cpp b/src/video_core/clipper.cpp
index 592f2f476..2cf166afd 100644
--- a/src/video_core/clipper.cpp
+++ b/src/video_core/clipper.cpp
@@ -86,8 +86,8 @@ static void InitScreenCoordinates(OutputVertex& vtx)
86 86
87 viewport.halfsize_x = float24::FromRawFloat24(registers.viewport_size_x); 87 viewport.halfsize_x = float24::FromRawFloat24(registers.viewport_size_x);
88 viewport.halfsize_y = float24::FromRawFloat24(registers.viewport_size_y); 88 viewport.halfsize_y = float24::FromRawFloat24(registers.viewport_size_y);
89 viewport.offset_x = float24::FromFloat32(registers.viewport_corner.x); 89 viewport.offset_x = float24::FromFloat32(static_cast<float>(registers.viewport_corner.x));
90 viewport.offset_y = float24::FromFloat32(registers.viewport_corner.y); 90 viewport.offset_y = float24::FromFloat32(static_cast<float>(registers.viewport_corner.y));
91 viewport.zscale = float24::FromRawFloat24(registers.viewport_depth_range); 91 viewport.zscale = float24::FromRawFloat24(registers.viewport_depth_range);
92 viewport.offset_z = float24::FromRawFloat24(registers.viewport_depth_far_plane); 92 viewport.offset_z = float24::FromRawFloat24(registers.viewport_depth_far_plane);
93 93
@@ -150,7 +150,7 @@ void ProcessTriangle(OutputVertex &v0, OutputVertex &v1, OutputVertex &v2) {
150 InitScreenCoordinates(*(output_list[0])); 150 InitScreenCoordinates(*(output_list[0]));
151 InitScreenCoordinates(*(output_list[1])); 151 InitScreenCoordinates(*(output_list[1]));
152 152
153 for (int i = 0; i < output_list.size() - 2; i ++) { 153 for (size_t i = 0; i < output_list.size() - 2; i ++) {
154 OutputVertex& vtx0 = *(output_list[0]); 154 OutputVertex& vtx0 = *(output_list[0]);
155 OutputVertex& vtx1 = *(output_list[i+1]); 155 OutputVertex& vtx1 = *(output_list[i+1]);
156 OutputVertex& vtx2 = *(output_list[i+2]); 156 OutputVertex& vtx2 = *(output_list[i+2]);
@@ -158,7 +158,7 @@ void ProcessTriangle(OutputVertex &v0, OutputVertex &v1, OutputVertex &v2) {
158 InitScreenCoordinates(vtx2); 158 InitScreenCoordinates(vtx2);
159 159
160 DEBUG_LOG(GPU, 160 DEBUG_LOG(GPU,
161 "Triangle %d/%d (%d buffer vertices) at position (%.3f, %.3f, %.3f, %.3f), " 161 "Triangle %u/%u (%u buffer vertices) at position (%.3f, %.3f, %.3f, %.3f), "
162 "(%.3f, %.3f, %.3f, %.3f), (%.3f, %.3f, %.3f, %.3f) and " 162 "(%.3f, %.3f, %.3f, %.3f), (%.3f, %.3f, %.3f, %.3f) and "
163 "screen position (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f)", 163 "screen position (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f)",
164 i,output_list.size(), buffer_vertices.size(), 164 i,output_list.size(), buffer_vertices.size(),
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 9567a9849..a9510fa2e 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -63,8 +63,8 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
63 for (int component = 0; component < loader_config.component_count; ++component) { 63 for (int component = 0; component < loader_config.component_count; ++component) {
64 u32 attribute_index = loader_config.GetComponent(component); 64 u32 attribute_index = loader_config.GetComponent(component);
65 vertex_attribute_sources[attribute_index] = load_address; 65 vertex_attribute_sources[attribute_index] = load_address;
66 vertex_attribute_strides[attribute_index] = loader_config.byte_count; 66 vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count);
67 vertex_attribute_formats[attribute_index] = (u32)attribute_config.GetFormat(attribute_index); 67 vertex_attribute_formats[attribute_index] = static_cast<u32>(attribute_config.GetFormat(attribute_index));
68 vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index); 68 vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index);
69 vertex_attribute_element_size[attribute_index] = attribute_config.GetElementSizeInBytes(attribute_index); 69 vertex_attribute_element_size[attribute_index] = attribute_config.GetElementSizeInBytes(attribute_index);
70 load_address += attribute_config.GetStride(attribute_index); 70 load_address += attribute_config.GetStride(attribute_index);
@@ -83,9 +83,9 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
83 PrimitiveAssembler<VertexShader::OutputVertex> clipper_primitive_assembler(registers.triangle_topology.Value()); 83 PrimitiveAssembler<VertexShader::OutputVertex> clipper_primitive_assembler(registers.triangle_topology.Value());
84 PrimitiveAssembler<DebugUtils::GeometryDumper::Vertex> dumping_primitive_assembler(registers.triangle_topology.Value()); 84 PrimitiveAssembler<DebugUtils::GeometryDumper::Vertex> dumping_primitive_assembler(registers.triangle_topology.Value());
85 85
86 for (int index = 0; index < registers.num_vertices; ++index) 86 for (unsigned int index = 0; index < registers.num_vertices; ++index)
87 { 87 {
88 int vertex = is_indexed ? (index_u16 ? index_address_16[index] : index_address_8[index]) : index; 88 unsigned int vertex = is_indexed ? (index_u16 ? index_address_16[index] : index_address_8[index]) : index;
89 89
90 if (is_indexed) { 90 if (is_indexed) {
91 // TODO: Implement some sort of vertex cache! 91 // TODO: Implement some sort of vertex cache!
@@ -95,7 +95,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
95 VertexShader::InputVertex input; 95 VertexShader::InputVertex input;
96 96
97 for (int i = 0; i < attribute_config.GetNumTotalAttributes(); ++i) { 97 for (int i = 0; i < attribute_config.GetNumTotalAttributes(); ++i) {
98 for (int comp = 0; comp < vertex_attribute_elements[i]; ++comp) { 98 for (unsigned int comp = 0; comp < vertex_attribute_elements[i]; ++comp) {
99 const u8* srcdata = vertex_attribute_sources[i] + vertex_attribute_strides[i] * vertex + comp * vertex_attribute_element_size[i]; 99 const u8* srcdata = vertex_attribute_sources[i] + vertex_attribute_strides[i] * vertex + comp * vertex_attribute_element_size[i];
100 const float srcval = (vertex_attribute_formats[i] == 0) ? *(s8*)srcdata : 100 const float srcval = (vertex_attribute_formats[i] == 0) ? *(s8*)srcdata :
101 (vertex_attribute_formats[i] == 1) ? *(u8*)srcdata : 101 (vertex_attribute_formats[i] == 1) ? *(u8*)srcdata :
@@ -244,7 +244,7 @@ static std::ptrdiff_t ExecuteCommandBlock(const u32* first_command_word) {
244 WritePicaReg(header.cmd_id, *read_pointer, write_mask); 244 WritePicaReg(header.cmd_id, *read_pointer, write_mask);
245 read_pointer += 2; 245 read_pointer += 2;
246 246
247 for (int i = 1; i < 1+header.extra_data_length; ++i) { 247 for (unsigned int i = 1; i < 1+header.extra_data_length; ++i) {
248 u32 cmd = header.cmd_id + ((header.group_commands) ? i : 0); 248 u32 cmd = header.cmd_id + ((header.group_commands) ? i : 0);
249 WritePicaReg(cmd, *read_pointer, write_mask); 249 WritePicaReg(cmd, *read_pointer, write_mask);
250 ++read_pointer; 250 ++read_pointer;
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp
index 8f4aa0ad0..22b8e9950 100644
--- a/src/video_core/debug_utils/debug_utils.cpp
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -203,7 +203,7 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data
203 } else { 203 } else {
204 it->component_mask = it->component_mask | component_mask; 204 it->component_mask = it->component_mask | component_mask;
205 } 205 }
206 } catch (const std::out_of_range& oor) { 206 } catch (const std::out_of_range& ) {
207 _dbg_assert_msg_(GPU, 0, "Unknown output attribute mapping"); 207 _dbg_assert_msg_(GPU, 0, "Unknown output attribute mapping");
208 ERROR_LOG(GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x", 208 ERROR_LOG(GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x",
209 (int)output_attributes[i].map_x.Value(), 209 (int)output_attributes[i].map_x.Value(),
@@ -235,7 +235,7 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data
235 dvlp.swizzle_patterns_offset = write_offset - dvlp_offset; 235 dvlp.swizzle_patterns_offset = write_offset - dvlp_offset;
236 dvlp.swizzle_patterns_num_entries = swizzle_size; 236 dvlp.swizzle_patterns_num_entries = swizzle_size;
237 u32 dummy = 0; 237 u32 dummy = 0;
238 for (int i = 0; i < swizzle_size; ++i) { 238 for (unsigned int i = 0; i < swizzle_size; ++i) {
239 QueueForWriting((u8*)&swizzle_data[i], sizeof(swizzle_data[i])); 239 QueueForWriting((u8*)&swizzle_data[i], sizeof(swizzle_data[i]));
240 QueueForWriting((u8*)&dummy, sizeof(dummy)); 240 QueueForWriting((u8*)&dummy, sizeof(dummy));
241 } 241 }
@@ -278,7 +278,7 @@ void StartPicaTracing()
278 278
279bool IsPicaTracing() 279bool IsPicaTracing()
280{ 280{
281 return is_pica_tracing; 281 return is_pica_tracing != 0;
282} 282}
283 283
284void OnPicaRegWrite(u32 id, u32 value) 284void OnPicaRegWrite(u32 id, u32 value)
@@ -428,7 +428,7 @@ void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages)
428 using Operation = Pica::Regs::TevStageConfig::Operation; 428 using Operation = Pica::Regs::TevStageConfig::Operation;
429 429
430 std::string stage_info = "Tev setup:\n"; 430 std::string stage_info = "Tev setup:\n";
431 for (int index = 0; index < stages.size(); ++index) { 431 for (size_t index = 0; index < stages.size(); ++index) {
432 const auto& tev_stage = stages[index]; 432 const auto& tev_stage = stages[index];
433 433
434 const std::map<Source, std::string> source_map = { 434 const std::map<Source, std::string> source_map = {
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 374cd83c1..5fe15a218 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -563,7 +563,7 @@ struct Regs {
563 return map[index]; 563 return map[index];
564 } 564 }
565 565
566 static inline int NumIds() { 566 static inline size_t NumIds() {
567 return sizeof(Regs) / sizeof(u32); 567 return sizeof(Regs) / sizeof(u32);
568 } 568 }
569 569
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index b55391e5e..a35f0c0d8 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -65,7 +65,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
65 65
66 // vertex positions in rasterizer coordinates 66 // vertex positions in rasterizer coordinates
67 auto FloatToFix = [](float24 flt) { 67 auto FloatToFix = [](float24 flt) {
68 return Fix12P4(flt.ToFloat32() * 16.0f); 68 return Fix12P4(static_cast<unsigned short>(flt.ToFloat32() * 16.0f));
69 }; 69 };
70 auto ScreenToRasterizerCoordinates = [FloatToFix](const Math::Vec3<float24> vec) { 70 auto ScreenToRasterizerCoordinates = [FloatToFix](const Math::Vec3<float24> vec) {
71 return Math::Vec3<Fix12P4>{FloatToFix(vec.x), FloatToFix(vec.y), FloatToFix(vec.z)}; 71 return Math::Vec3<Fix12P4>{FloatToFix(vec.x), FloatToFix(vec.y), FloatToFix(vec.z)};
@@ -151,9 +151,9 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
151 auto w_inverse = Math::MakeVec(float24::FromFloat32(1.f) / v0.pos.w, 151 auto w_inverse = Math::MakeVec(float24::FromFloat32(1.f) / v0.pos.w,
152 float24::FromFloat32(1.f) / v1.pos.w, 152 float24::FromFloat32(1.f) / v1.pos.w,
153 float24::FromFloat32(1.f) / v2.pos.w); 153 float24::FromFloat32(1.f) / v2.pos.w);
154 auto baricentric_coordinates = Math::MakeVec(float24::FromFloat32(w0), 154 auto baricentric_coordinates = Math::MakeVec(float24::FromFloat32(static_cast<float>(w0)),
155 float24::FromFloat32(w1), 155 float24::FromFloat32(static_cast<float>(w1)),
156 float24::FromFloat32(w2)); 156 float24::FromFloat32(static_cast<float>(w2)));
157 157
158 float24 interpolated_attr_over_w = Math::Dot(attr_over_w, baricentric_coordinates); 158 float24 interpolated_attr_over_w = Math::Dot(attr_over_w, baricentric_coordinates);
159 float24 interpolated_w_inverse = Math::Dot(w_inverse, baricentric_coordinates); 159 float24 interpolated_w_inverse = Math::Dot(w_inverse, baricentric_coordinates);
@@ -195,8 +195,8 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
195 // TODO(neobrain): Not sure if this swizzling pattern is used for all textures. 195 // TODO(neobrain): Not sure if this swizzling pattern is used for all textures.
196 // To be flexible in case different but similar patterns are used, we keep this 196 // To be flexible in case different but similar patterns are used, we keep this
197 // somewhat inefficient code around for now. 197 // somewhat inefficient code around for now.
198 int s = (int)(u * float24::FromFloat32(registers.texture0.width)).ToFloat32(); 198 int s = (int)(u * float24::FromFloat32(static_cast<float>(registers.texture0.width))).ToFloat32();
199 int t = (int)(v * float24::FromFloat32(registers.texture0.height)).ToFloat32(); 199 int t = (int)(v * float24::FromFloat32(static_cast<float>(registers.texture0.height))).ToFloat32();
200 int texel_index_within_tile = 0; 200 int texel_index_within_tile = 0;
201 for (int block_size_index = 0; block_size_index < 3; ++block_size_index) { 201 for (int block_size_index = 0; block_size_index < 3; ++block_size_index) {
202 int sub_tile_width = 1 << block_size_index; 202 int sub_tile_width = 1 << block_size_index;
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp
index db8244317..96625791c 100644
--- a/src/video_core/vertex_shader.cpp
+++ b/src/video_core/vertex_shader.cpp
@@ -77,7 +77,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
77 : nullptr; 77 : nullptr;
78 78
79 const SwizzlePattern& swizzle = *(SwizzlePattern*)&swizzle_data[instr.common.operand_desc_id]; 79 const SwizzlePattern& swizzle = *(SwizzlePattern*)&swizzle_data[instr.common.operand_desc_id];
80 const bool negate_src1 = swizzle.negate; 80 const bool negate_src1 = (swizzle.negate != 0);
81 81
82 float24 src1[4] = { 82 float24 src1[4] = {
83 src1_[(int)swizzle.GetSelectorSrc1(0)], 83 src1_[(int)swizzle.GetSelectorSrc1(0)],
diff --git a/src/video_core/vertex_shader.h b/src/video_core/vertex_shader.h
index 847fdc450..607a8e803 100644
--- a/src/video_core/vertex_shader.h
+++ b/src/video_core/vertex_shader.h
@@ -225,7 +225,7 @@ union SwizzlePattern {
225 } 225 }
226 226
227 bool DestComponentEnabled(int i) const { 227 bool DestComponentEnabled(int i) const {
228 return (dest_mask & (0x8 >> i)); 228 return (dest_mask & (0x8 >> i)) != 0;
229 } 229 }
230 230
231 std::string SelectorToString(bool src2) const { 231 std::string SelectorToString(bool src2) const {