summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/file_util.cpp6
-rw-r--r--src/common/file_util.h14
-rw-r--r--src/video_core/engines/maxwell_3d.cpp10
-rw-r--r--src/video_core/engines/shader_bytecode.h2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp6
-rw-r--r--src/video_core/renderer_opengl/maxwell_to_gl.h12
6 files changed, 42 insertions, 8 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index cd852bfd8..2d0b81c6e 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -809,16 +809,16 @@ IOFile::~IOFile() {
809 Close(); 809 Close();
810} 810}
811 811
812IOFile::IOFile(IOFile&& other) { 812IOFile::IOFile(IOFile&& other) noexcept {
813 Swap(other); 813 Swap(other);
814} 814}
815 815
816IOFile& IOFile::operator=(IOFile&& other) { 816IOFile& IOFile::operator=(IOFile&& other) noexcept {
817 Swap(other); 817 Swap(other);
818 return *this; 818 return *this;
819} 819}
820 820
821void IOFile::Swap(IOFile& other) { 821void IOFile::Swap(IOFile& other) noexcept {
822 std::swap(m_file, other.m_file); 822 std::swap(m_file, other.m_file);
823 std::swap(m_good, other.m_good); 823 std::swap(m_good, other.m_good);
824} 824}
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 4c11849ee..fc6b3ea46 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -160,10 +160,10 @@ public:
160 160
161 ~IOFile(); 161 ~IOFile();
162 162
163 IOFile(IOFile&& other); 163 IOFile(IOFile&& other) noexcept;
164 IOFile& operator=(IOFile&& other); 164 IOFile& operator=(IOFile&& other) noexcept;
165 165
166 void Swap(IOFile& other); 166 void Swap(IOFile& other) noexcept;
167 167
168 bool Open(const std::string& filename, const char openmode[]); 168 bool Open(const std::string& filename, const char openmode[]);
169 bool Close(); 169 bool Close();
@@ -202,11 +202,15 @@ public:
202 return items_written; 202 return items_written;
203 } 203 }
204 204
205 size_t ReadBytes(void* data, size_t length) { 205 template <typename T>
206 size_t ReadBytes(T* data, size_t length) {
207 static_assert(std::is_trivially_copyable<T>(), "T must be trivially copyable");
206 return ReadArray(reinterpret_cast<char*>(data), length); 208 return ReadArray(reinterpret_cast<char*>(data), length);
207 } 209 }
208 210
209 size_t WriteBytes(const void* data, size_t length) { 211 template <typename T>
212 size_t WriteBytes(const T* data, size_t length) {
213 static_assert(std::is_trivially_copyable<T>(), "T must be trivially copyable");
210 return WriteArray(reinterpret_cast<const char*>(data), length); 214 return WriteArray(reinterpret_cast<const char*>(data), length);
211 } 215 }
212 216
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 835e5fe78..23e70cd8a 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -208,6 +208,16 @@ void Maxwell3D::DrawArrays() {
208 208
209 const bool is_indexed{regs.index_array.count && !regs.vertex_buffer.count}; 209 const bool is_indexed{regs.index_array.count && !regs.vertex_buffer.count};
210 VideoCore::g_renderer->Rasterizer()->AccelerateDrawBatch(is_indexed); 210 VideoCore::g_renderer->Rasterizer()->AccelerateDrawBatch(is_indexed);
211
212 // TODO(bunnei): Below, we reset vertex count so that we can use these registers to determine if
213 // the game is trying to draw indexed or direct mode. This needs to be verified on HW still -
214 // it's possible that it is incorrect and that there is some other register used to specify the
215 // drawing mode.
216 if (is_indexed) {
217 regs.index_array.count = 0;
218 } else {
219 regs.vertex_buffer.count = 0;
220 }
211} 221}
212 222
213void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) { 223void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) {
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index f20c2cd41..e1ceec268 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -310,6 +310,7 @@ public:
310 SHR_C, 310 SHR_C,
311 SHR_R, 311 SHR_R,
312 SHR_IMM, 312 SHR_IMM,
313 FMNMX,
313 FSETP_C, // Set Predicate 314 FSETP_C, // Set Predicate
314 FSETP_R, 315 FSETP_R,
315 FSETP_IMM, 316 FSETP_IMM,
@@ -460,6 +461,7 @@ private:
460 INST("0100110000101---", Id::SHR_C, Type::Arithmetic, "SHR_C"), 461 INST("0100110000101---", Id::SHR_C, Type::Arithmetic, "SHR_C"),
461 INST("0101110000101---", Id::SHR_R, Type::Arithmetic, "SHR_R"), 462 INST("0101110000101---", Id::SHR_R, Type::Arithmetic, "SHR_R"),
462 INST("0011100-00101---", Id::SHR_IMM, Type::Arithmetic, "SHR_IMM"), 463 INST("0011100-00101---", Id::SHR_IMM, Type::Arithmetic, "SHR_IMM"),
464 INST("0101110001100---", Id::FMNMX, Type::Arithmetic, "FMNMX"),
463 INST("0100110011100---", Id::I2I_C, Type::Conversion, "I2I_C"), 465 INST("0100110011100---", Id::I2I_C, Type::Conversion, "I2I_C"),
464 INST("0101110011100---", Id::I2I_R, Type::Conversion, "I2I_R"), 466 INST("0101110011100---", Id::I2I_R, Type::Conversion, "I2I_R"),
465 INST("01110001-1000---", Id::I2I_IMM, Type::Conversion, "I2I_IMM"), 467 INST("01110001-1000---", Id::I2I_IMM, Type::Conversion, "I2I_IMM"),
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 96d39c5c7..abbf0893d 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -664,6 +664,12 @@ private:
664 } 664 }
665 665
666 switch (opcode->GetId()) { 666 switch (opcode->GetId()) {
667 case OpCode::Id::MOV_C:
668 case OpCode::Id::MOV_R: {
669 regs.SetRegisterToFloat(instr.gpr0, 0, op_b, 1, 1);
670 break;
671 }
672
667 case OpCode::Id::MOV32_IMM: { 673 case OpCode::Id::MOV32_IMM: {
668 // mov32i doesn't have abs or neg bits. 674 // mov32i doesn't have abs or neg bits.
669 regs.SetRegisterToFloat(instr.gpr0, 0, GetImmediate32(instr), 1, 1); 675 regs.SetRegisterToFloat(instr.gpr0, 0, GetImmediate32(instr), 1, 1);
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h
index a49265b38..a630610d8 100644
--- a/src/video_core/renderer_opengl/maxwell_to_gl.h
+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h
@@ -36,6 +36,18 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
36 return {}; 36 return {};
37 } 37 }
38 38
39 case Maxwell::VertexAttribute::Type::SignedNorm: {
40
41 switch (attrib.size) {
42 case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
43 return GL_BYTE;
44 }
45
46 NGLOG_CRITICAL(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
47 UNREACHABLE();
48 return {};
49 }
50
39 case Maxwell::VertexAttribute::Type::Float: 51 case Maxwell::VertexAttribute::Type::Float:
40 return GL_FLOAT; 52 return GL_FLOAT;
41 } 53 }