mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-11-01 04:47:53 +00:00
commit
8fb064cd62
9 changed files with 26 additions and 26 deletions
|
@ -27,7 +27,7 @@ u64 g_last_frame_ticks = 0; ///< CPU tick count from last frame
|
|||
template <typename T>
|
||||
inline void Read(T &var, const u32 raw_addr) {
|
||||
u32 addr = raw_addr - 0x1EF00000;
|
||||
int index = addr / 4;
|
||||
u32 index = addr / 4;
|
||||
|
||||
// Reads other than u32 are untested, so I'd rather have them abort than silently fail
|
||||
if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) {
|
||||
|
@ -41,7 +41,7 @@ inline void Read(T &var, const u32 raw_addr) {
|
|||
template <typename T>
|
||||
inline void Write(u32 addr, const T data) {
|
||||
addr -= 0x1EF00000;
|
||||
int index = addr / 4;
|
||||
u32 index = addr / 4;
|
||||
|
||||
// Writes other than u32 are untested, so I'd rather have them abort than silently fail
|
||||
if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) {
|
||||
|
|
|
@ -201,7 +201,7 @@ struct Regs {
|
|||
#undef INSERT_PADDING_WORDS_HELPER2
|
||||
#undef INSERT_PADDING_WORDS
|
||||
|
||||
static inline int NumIds() {
|
||||
static inline size_t NumIds() {
|
||||
return sizeof(Regs) / sizeof(u32);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,8 +86,8 @@ static void InitScreenCoordinates(OutputVertex& vtx)
|
|||
|
||||
viewport.halfsize_x = float24::FromRawFloat24(registers.viewport_size_x);
|
||||
viewport.halfsize_y = float24::FromRawFloat24(registers.viewport_size_y);
|
||||
viewport.offset_x = float24::FromFloat32(registers.viewport_corner.x);
|
||||
viewport.offset_y = float24::FromFloat32(registers.viewport_corner.y);
|
||||
viewport.offset_x = float24::FromFloat32(static_cast<float>(registers.viewport_corner.x));
|
||||
viewport.offset_y = float24::FromFloat32(static_cast<float>(registers.viewport_corner.y));
|
||||
viewport.zscale = float24::FromRawFloat24(registers.viewport_depth_range);
|
||||
viewport.offset_z = float24::FromRawFloat24(registers.viewport_depth_far_plane);
|
||||
|
||||
|
@ -150,7 +150,7 @@ void ProcessTriangle(OutputVertex &v0, OutputVertex &v1, OutputVertex &v2) {
|
|||
InitScreenCoordinates(*(output_list[0]));
|
||||
InitScreenCoordinates(*(output_list[1]));
|
||||
|
||||
for (int i = 0; i < output_list.size() - 2; i ++) {
|
||||
for (size_t i = 0; i < output_list.size() - 2; i ++) {
|
||||
OutputVertex& vtx0 = *(output_list[0]);
|
||||
OutputVertex& vtx1 = *(output_list[i+1]);
|
||||
OutputVertex& vtx2 = *(output_list[i+2]);
|
||||
|
@ -158,7 +158,7 @@ void ProcessTriangle(OutputVertex &v0, OutputVertex &v1, OutputVertex &v2) {
|
|||
InitScreenCoordinates(vtx2);
|
||||
|
||||
DEBUG_LOG(GPU,
|
||||
"Triangle %d/%d (%d buffer vertices) at position (%.3f, %.3f, %.3f, %.3f), "
|
||||
"Triangle %u/%u (%u buffer vertices) at position (%.3f, %.3f, %.3f, %.3f), "
|
||||
"(%.3f, %.3f, %.3f, %.3f), (%.3f, %.3f, %.3f, %.3f) and "
|
||||
"screen position (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f)",
|
||||
i,output_list.size(), buffer_vertices.size(),
|
||||
|
|
|
@ -63,8 +63,8 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
|
|||
for (int component = 0; component < loader_config.component_count; ++component) {
|
||||
u32 attribute_index = loader_config.GetComponent(component);
|
||||
vertex_attribute_sources[attribute_index] = load_address;
|
||||
vertex_attribute_strides[attribute_index] = loader_config.byte_count;
|
||||
vertex_attribute_formats[attribute_index] = (u32)attribute_config.GetFormat(attribute_index);
|
||||
vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count);
|
||||
vertex_attribute_formats[attribute_index] = static_cast<u32>(attribute_config.GetFormat(attribute_index));
|
||||
vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index);
|
||||
vertex_attribute_element_size[attribute_index] = attribute_config.GetElementSizeInBytes(attribute_index);
|
||||
load_address += attribute_config.GetStride(attribute_index);
|
||||
|
@ -83,9 +83,9 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
|
|||
PrimitiveAssembler<VertexShader::OutputVertex> clipper_primitive_assembler(registers.triangle_topology.Value());
|
||||
PrimitiveAssembler<DebugUtils::GeometryDumper::Vertex> dumping_primitive_assembler(registers.triangle_topology.Value());
|
||||
|
||||
for (int index = 0; index < registers.num_vertices; ++index)
|
||||
for (unsigned int index = 0; index < registers.num_vertices; ++index)
|
||||
{
|
||||
int vertex = is_indexed ? (index_u16 ? index_address_16[index] : index_address_8[index]) : index;
|
||||
unsigned int vertex = is_indexed ? (index_u16 ? index_address_16[index] : index_address_8[index]) : index;
|
||||
|
||||
if (is_indexed) {
|
||||
// TODO: Implement some sort of vertex cache!
|
||||
|
@ -95,7 +95,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
|
|||
VertexShader::InputVertex input;
|
||||
|
||||
for (int i = 0; i < attribute_config.GetNumTotalAttributes(); ++i) {
|
||||
for (int comp = 0; comp < vertex_attribute_elements[i]; ++comp) {
|
||||
for (unsigned int comp = 0; comp < vertex_attribute_elements[i]; ++comp) {
|
||||
const u8* srcdata = vertex_attribute_sources[i] + vertex_attribute_strides[i] * vertex + comp * vertex_attribute_element_size[i];
|
||||
const float srcval = (vertex_attribute_formats[i] == 0) ? *(s8*)srcdata :
|
||||
(vertex_attribute_formats[i] == 1) ? *(u8*)srcdata :
|
||||
|
@ -244,7 +244,7 @@ static std::ptrdiff_t ExecuteCommandBlock(const u32* first_command_word) {
|
|||
WritePicaReg(header.cmd_id, *read_pointer, write_mask);
|
||||
read_pointer += 2;
|
||||
|
||||
for (int i = 1; i < 1+header.extra_data_length; ++i) {
|
||||
for (unsigned int i = 1; i < 1+header.extra_data_length; ++i) {
|
||||
u32 cmd = header.cmd_id + ((header.group_commands) ? i : 0);
|
||||
WritePicaReg(cmd, *read_pointer, write_mask);
|
||||
++read_pointer;
|
||||
|
|
|
@ -203,7 +203,7 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data
|
|||
} else {
|
||||
it->component_mask = it->component_mask | component_mask;
|
||||
}
|
||||
} catch (const std::out_of_range& oor) {
|
||||
} catch (const std::out_of_range& ) {
|
||||
_dbg_assert_msg_(GPU, 0, "Unknown output attribute mapping");
|
||||
ERROR_LOG(GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x",
|
||||
(int)output_attributes[i].map_x.Value(),
|
||||
|
@ -235,7 +235,7 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data
|
|||
dvlp.swizzle_patterns_offset = write_offset - dvlp_offset;
|
||||
dvlp.swizzle_patterns_num_entries = swizzle_size;
|
||||
u32 dummy = 0;
|
||||
for (int i = 0; i < swizzle_size; ++i) {
|
||||
for (unsigned int i = 0; i < swizzle_size; ++i) {
|
||||
QueueForWriting((u8*)&swizzle_data[i], sizeof(swizzle_data[i]));
|
||||
QueueForWriting((u8*)&dummy, sizeof(dummy));
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ void StartPicaTracing()
|
|||
|
||||
bool IsPicaTracing()
|
||||
{
|
||||
return is_pica_tracing;
|
||||
return is_pica_tracing != 0;
|
||||
}
|
||||
|
||||
void OnPicaRegWrite(u32 id, u32 value)
|
||||
|
@ -428,7 +428,7 @@ void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages)
|
|||
using Operation = Pica::Regs::TevStageConfig::Operation;
|
||||
|
||||
std::string stage_info = "Tev setup:\n";
|
||||
for (int index = 0; index < stages.size(); ++index) {
|
||||
for (size_t index = 0; index < stages.size(); ++index) {
|
||||
const auto& tev_stage = stages[index];
|
||||
|
||||
const std::map<Source, std::string> source_map = {
|
||||
|
|
|
@ -563,7 +563,7 @@ struct Regs {
|
|||
return map[index];
|
||||
}
|
||||
|
||||
static inline int NumIds() {
|
||||
static inline size_t NumIds() {
|
||||
return sizeof(Regs) / sizeof(u32);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
|
|||
|
||||
// vertex positions in rasterizer coordinates
|
||||
auto FloatToFix = [](float24 flt) {
|
||||
return Fix12P4(flt.ToFloat32() * 16.0f);
|
||||
return Fix12P4(static_cast<unsigned short>(flt.ToFloat32() * 16.0f));
|
||||
};
|
||||
auto ScreenToRasterizerCoordinates = [FloatToFix](const Math::Vec3<float24> vec) {
|
||||
return Math::Vec3<Fix12P4>{FloatToFix(vec.x), FloatToFix(vec.y), FloatToFix(vec.z)};
|
||||
|
@ -151,9 +151,9 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
|
|||
auto w_inverse = Math::MakeVec(float24::FromFloat32(1.f) / v0.pos.w,
|
||||
float24::FromFloat32(1.f) / v1.pos.w,
|
||||
float24::FromFloat32(1.f) / v2.pos.w);
|
||||
auto baricentric_coordinates = Math::MakeVec(float24::FromFloat32(w0),
|
||||
float24::FromFloat32(w1),
|
||||
float24::FromFloat32(w2));
|
||||
auto baricentric_coordinates = Math::MakeVec(float24::FromFloat32(static_cast<float>(w0)),
|
||||
float24::FromFloat32(static_cast<float>(w1)),
|
||||
float24::FromFloat32(static_cast<float>(w2)));
|
||||
|
||||
float24 interpolated_attr_over_w = Math::Dot(attr_over_w, baricentric_coordinates);
|
||||
float24 interpolated_w_inverse = Math::Dot(w_inverse, baricentric_coordinates);
|
||||
|
@ -195,8 +195,8 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
|
|||
// TODO(neobrain): Not sure if this swizzling pattern is used for all textures.
|
||||
// To be flexible in case different but similar patterns are used, we keep this
|
||||
// somewhat inefficient code around for now.
|
||||
int s = (int)(u * float24::FromFloat32(registers.texture0.width)).ToFloat32();
|
||||
int t = (int)(v * float24::FromFloat32(registers.texture0.height)).ToFloat32();
|
||||
int s = (int)(u * float24::FromFloat32(static_cast<float>(registers.texture0.width))).ToFloat32();
|
||||
int t = (int)(v * float24::FromFloat32(static_cast<float>(registers.texture0.height))).ToFloat32();
|
||||
int texel_index_within_tile = 0;
|
||||
for (int block_size_index = 0; block_size_index < 3; ++block_size_index) {
|
||||
int sub_tile_width = 1 << block_size_index;
|
||||
|
|
|
@ -77,7 +77,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
|
|||
: nullptr;
|
||||
|
||||
const SwizzlePattern& swizzle = *(SwizzlePattern*)&swizzle_data[instr.common.operand_desc_id];
|
||||
const bool negate_src1 = swizzle.negate;
|
||||
const bool negate_src1 = (swizzle.negate != 0);
|
||||
|
||||
float24 src1[4] = {
|
||||
src1_[(int)swizzle.GetSelectorSrc1(0)],
|
||||
|
|
|
@ -225,7 +225,7 @@ union SwizzlePattern {
|
|||
}
|
||||
|
||||
bool DestComponentEnabled(int i) const {
|
||||
return (dest_mask & (0x8 >> i));
|
||||
return (dest_mask & (0x8 >> i)) != 0;
|
||||
}
|
||||
|
||||
std::string SelectorToString(bool src2) const {
|
||||
|
|
Loading…
Reference in a new issue