diff options
| author | 2016-03-17 01:51:09 -0400 | |
|---|---|---|
| committer | 2016-03-17 02:01:38 -0400 | |
| commit | 63e956cc7a57fe05aa2e422762349bee253715fb (patch) | |
| tree | bf10e1db6d2232dd0584b70f342dc173dd730bb1 /src/video_core/debug_utils | |
| parent | Merge pull request #1537 from lioncash/const (diff) | |
| download | yuzu-63e956cc7a57fe05aa2e422762349bee253715fb.tar.gz yuzu-63e956cc7a57fe05aa2e422762349bee253715fb.tar.xz yuzu-63e956cc7a57fe05aa2e422762349bee253715fb.zip | |
video_core: Don't cast away const
Diffstat (limited to 'src/video_core/debug_utils')
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 271e81ca1..bac6d69c7 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp | |||
| @@ -117,13 +117,13 @@ void GeometryDumper::Dump() { | |||
| 117 | void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, const Shader::ShaderSetup& setup, const Regs::VSOutputAttributes* output_attributes) | 117 | void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, const Shader::ShaderSetup& setup, const Regs::VSOutputAttributes* output_attributes) |
| 118 | { | 118 | { |
| 119 | struct StuffToWrite { | 119 | struct StuffToWrite { |
| 120 | u8* pointer; | 120 | const u8* pointer; |
| 121 | u32 size; | 121 | u32 size; |
| 122 | }; | 122 | }; |
| 123 | std::vector<StuffToWrite> writing_queue; | 123 | std::vector<StuffToWrite> writing_queue; |
| 124 | u32 write_offset = 0; | 124 | u32 write_offset = 0; |
| 125 | 125 | ||
| 126 | auto QueueForWriting = [&writing_queue,&write_offset](u8* pointer, u32 size) { | 126 | auto QueueForWriting = [&writing_queue,&write_offset](const u8* pointer, u32 size) { |
| 127 | writing_queue.push_back({pointer, size}); | 127 | writing_queue.push_back({pointer, size}); |
| 128 | u32 old_write_offset = write_offset; | 128 | u32 old_write_offset = write_offset; |
| 129 | write_offset += size; | 129 | write_offset += size; |
| @@ -228,27 +228,27 @@ void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, c | |||
| 228 | DVLPHeader dvlp{ DVLPHeader::MAGIC_WORD }; | 228 | DVLPHeader dvlp{ DVLPHeader::MAGIC_WORD }; |
| 229 | DVLEHeader dvle{ DVLEHeader::MAGIC_WORD }; | 229 | DVLEHeader dvle{ DVLEHeader::MAGIC_WORD }; |
| 230 | 230 | ||
| 231 | QueueForWriting((u8*)&dvlb, sizeof(dvlb)); | 231 | QueueForWriting(reinterpret_cast<const u8*>(&dvlb), sizeof(dvlb)); |
| 232 | u32 dvlp_offset = QueueForWriting((u8*)&dvlp, sizeof(dvlp)); | 232 | u32 dvlp_offset = QueueForWriting(reinterpret_cast<const u8*>(&dvlp), sizeof(dvlp)); |
| 233 | dvlb.dvle_offset = QueueForWriting((u8*)&dvle, sizeof(dvle)); | 233 | dvlb.dvle_offset = QueueForWriting(reinterpret_cast<const u8*>(&dvle), sizeof(dvle)); |
| 234 | 234 | ||
| 235 | // TODO: Reduce the amount of binary code written to relevant portions | 235 | // TODO: Reduce the amount of binary code written to relevant portions |
| 236 | dvlp.binary_offset = write_offset - dvlp_offset; | 236 | dvlp.binary_offset = write_offset - dvlp_offset; |
| 237 | dvlp.binary_size_words = setup.program_code.size(); | 237 | dvlp.binary_size_words = setup.program_code.size(); |
| 238 | QueueForWriting((u8*)setup.program_code.data(), setup.program_code.size() * sizeof(u32)); | 238 | QueueForWriting(reinterpret_cast<const u8*>(setup.program_code.data()), setup.program_code.size() * sizeof(u32)); |
| 239 | 239 | ||
| 240 | dvlp.swizzle_info_offset = write_offset - dvlp_offset; | 240 | dvlp.swizzle_info_offset = write_offset - dvlp_offset; |
| 241 | dvlp.swizzle_info_num_entries = setup.swizzle_data.size(); | 241 | dvlp.swizzle_info_num_entries = setup.swizzle_data.size(); |
| 242 | u32 dummy = 0; | 242 | u32 dummy = 0; |
| 243 | for (unsigned int i = 0; i < setup.swizzle_data.size(); ++i) { | 243 | for (unsigned int i = 0; i < setup.swizzle_data.size(); ++i) { |
| 244 | QueueForWriting((u8*)&setup.swizzle_data[i], sizeof(setup.swizzle_data[i])); | 244 | QueueForWriting(reinterpret_cast<const u8*>(&setup.swizzle_data[i]), sizeof(setup.swizzle_data[i])); |
| 245 | QueueForWriting((u8*)&dummy, sizeof(dummy)); | 245 | QueueForWriting(reinterpret_cast<const u8*>(&dummy), sizeof(dummy)); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | dvle.main_offset_words = config.main_offset; | 248 | dvle.main_offset_words = config.main_offset; |
| 249 | dvle.output_register_table_offset = write_offset - dvlb.dvle_offset; | 249 | dvle.output_register_table_offset = write_offset - dvlb.dvle_offset; |
| 250 | dvle.output_register_table_size = static_cast<u32>(output_info_table.size()); | 250 | dvle.output_register_table_size = static_cast<u32>(output_info_table.size()); |
| 251 | QueueForWriting((u8*)output_info_table.data(), static_cast<u32>(output_info_table.size() * sizeof(OutputRegisterInfo))); | 251 | QueueForWriting(reinterpret_cast<const u8*>(output_info_table.data()), static_cast<u32>(output_info_table.size() * sizeof(OutputRegisterInfo))); |
| 252 | 252 | ||
| 253 | // TODO: Create a label table for "main" | 253 | // TODO: Create a label table for "main" |
| 254 | 254 | ||
| @@ -292,14 +292,14 @@ void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, c | |||
| 292 | dvle.constant_table_offset = write_offset - dvlb.dvle_offset; | 292 | dvle.constant_table_offset = write_offset - dvlb.dvle_offset; |
| 293 | dvle.constant_table_size = constant_table.size(); | 293 | dvle.constant_table_size = constant_table.size(); |
| 294 | for (const auto& constant : constant_table) { | 294 | for (const auto& constant : constant_table) { |
| 295 | QueueForWriting((uint8_t*)&constant, sizeof(constant)); | 295 | QueueForWriting(reinterpret_cast<const u8*>(&constant), sizeof(constant)); |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | // Write data to file | 298 | // Write data to file |
| 299 | std::ofstream file(filename, std::ios_base::out | std::ios_base::binary); | 299 | std::ofstream file(filename, std::ios_base::out | std::ios_base::binary); |
| 300 | 300 | ||
| 301 | for (auto& chunk : writing_queue) { | 301 | for (const auto& chunk : writing_queue) { |
| 302 | file.write((char*)chunk.pointer, chunk.size); | 302 | file.write(reinterpret_cast<const char*>(chunk.pointer), chunk.size); |
| 303 | } | 303 | } |
| 304 | } | 304 | } |
| 305 | 305 | ||