diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/file_sys/partition_filesystem.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/ipc_helpers.h | 34 | ||||
-rw-r--r-- | src/core/hle/kernel/hle_ipc.h | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/mutex.cpp | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 9 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 5 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/maxwell_to_gl.h | 5 | ||||
-rw-r--r-- | src/video_core/textures/texture.h | 8 |
8 files changed, 39 insertions, 32 deletions
diff --git a/src/core/file_sys/partition_filesystem.cpp b/src/core/file_sys/partition_filesystem.cpp index 8d2bd9f6b..521e21078 100644 --- a/src/core/file_sys/partition_filesystem.cpp +++ b/src/core/file_sys/partition_filesystem.cpp @@ -65,8 +65,8 @@ PartitionFilesystem::PartitionFilesystem(std::shared_ptr<VfsFile> file) { std::string name( reinterpret_cast<const char*>(&file_data[strtab_offset + entry.strtab_offset])); - pfs_files.emplace_back( - std::make_shared<OffsetVfsFile>(file, entry.size, content_offset + entry.offset, name)); + pfs_files.emplace_back(std::make_shared<OffsetVfsFile>( + file, entry.size, content_offset + entry.offset, std::move(name))); } status = Loader::ResultStatus::Success; @@ -109,7 +109,7 @@ bool PartitionFilesystem::ReplaceFileWithSubdirectory(VirtualFile file, VirtualD return false; const std::ptrdiff_t offset = std::distance(pfs_files.begin(), iter); - pfs_files[offset] = pfs_files.back(); + pfs_files[offset] = std::move(pfs_files.back()); pfs_files.pop_back(); pfs_dirs.emplace_back(std::move(dir)); diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index 8b5b06f31..f5bd27a75 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h @@ -25,9 +25,9 @@ protected: ptrdiff_t index = 0; public: - RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {} + explicit RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {} - RequestHelperBase(Kernel::HLERequestContext& context) + explicit RequestHelperBase(Kernel::HLERequestContext& context) : context(&context), cmdbuf(context.CommandBuffer()) {} void Skip(unsigned size_in_words, bool set_to_null) { @@ -56,13 +56,6 @@ public: class ResponseBuilder : public RequestHelperBase { public: - ResponseBuilder(u32* command_buffer) : RequestHelperBase(command_buffer) {} - - u32 normal_params_size{}; - u32 num_handles_to_copy{}; - u32 num_objects_to_move{}; ///< Domain objects or move handles, context dependent - std::ptrdiff_t datapayload_index{}; - /// Flags used for customizing the behavior of ResponseBuilder enum class Flags : u32 { None = 0, @@ -71,9 +64,11 @@ public: AlwaysMoveHandles = 1, }; - ResponseBuilder(Kernel::HLERequestContext& context, u32 normal_params_size, - u32 num_handles_to_copy = 0, u32 num_objects_to_move = 0, - Flags flags = Flags::None) + explicit ResponseBuilder(u32* command_buffer) : RequestHelperBase(command_buffer) {} + + explicit ResponseBuilder(Kernel::HLERequestContext& context, u32 normal_params_size, + u32 num_handles_to_copy = 0, u32 num_objects_to_move = 0, + Flags flags = Flags::None) : RequestHelperBase(context), normal_params_size(normal_params_size), num_handles_to_copy(num_handles_to_copy), num_objects_to_move(num_objects_to_move) { @@ -206,6 +201,12 @@ public: template <typename... O> void PushCopyObjects(Kernel::SharedPtr<O>... pointers); + +private: + u32 normal_params_size{}; + u32 num_handles_to_copy{}; + u32 num_objects_to_move{}; ///< Domain objects or move handles, context dependent + std::ptrdiff_t datapayload_index{}; }; /// Push /// @@ -273,9 +274,9 @@ inline void ResponseBuilder::PushMoveObjects(Kernel::SharedPtr<O>... pointers) { class RequestParser : public RequestHelperBase { public: - RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {} + explicit RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {} - RequestParser(Kernel::HLERequestContext& context) : RequestHelperBase(context) { + explicit RequestParser(Kernel::HLERequestContext& context) : RequestHelperBase(context) { ASSERT_MSG(context.GetDataPayloadOffset(), "context is incomplete"); Skip(context.GetDataPayloadOffset(), false); // Skip the u64 command id, it's already stored in the context @@ -285,8 +286,9 @@ public: ResponseBuilder MakeBuilder(u32 normal_params_size, u32 num_handles_to_copy, u32 num_handles_to_move, - ResponseBuilder::Flags flags = ResponseBuilder::Flags::None) { - return {*context, normal_params_size, num_handles_to_copy, num_handles_to_move, flags}; + ResponseBuilder::Flags flags = ResponseBuilder::Flags::None) const { + return ResponseBuilder{*context, normal_params_size, num_handles_to_copy, + num_handles_to_move, flags}; } template <typename T> diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 01b805df8..84727f748 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -91,7 +91,7 @@ protected: */ class HLERequestContext { public: - HLERequestContext(SharedPtr<Kernel::ServerSession> session); + explicit HLERequestContext(SharedPtr<ServerSession> session); ~HLERequestContext(); /// Returns a pointer to the IPC command buffer for this request. diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 3f1de3258..feb7b88d2 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -19,7 +19,7 @@ namespace Kernel { /// Returns the number of threads that are waiting for a mutex, and the highest priority one among /// those. static std::pair<SharedPtr<Thread>, u32> GetHighestPriorityMutexWaitingThread( - SharedPtr<Thread> current_thread, VAddr mutex_addr) { + const SharedPtr<Thread>& current_thread, VAddr mutex_addr) { SharedPtr<Thread> highest_priority_thread; u32 num_waiters = 0; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 56d9c575b..5d5ad84b7 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -601,7 +601,6 @@ void RasterizerOpenGL::SamplerInfo::Create() { sampler.Create(); mag_filter = min_filter = Tegra::Texture::TextureFilter::Linear; wrap_u = wrap_v = Tegra::Texture::WrapMode::Wrap; - border_color_r = border_color_g = border_color_b = border_color_a = 0; // default is GL_LINEAR_MIPMAP_LINEAR glSamplerParameteri(sampler.handle, GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -630,8 +629,12 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntr } if (wrap_u == Tegra::Texture::WrapMode::Border || wrap_v == Tegra::Texture::WrapMode::Border) { - // TODO(Subv): Implement border color - ASSERT(false); + const GLvec4 new_border_color = {{config.border_color_r, config.border_color_g, + config.border_color_b, config.border_color_a}}; + if (border_color != new_border_color) { + border_color = new_border_color; + glSamplerParameterfv(s, GL_TEXTURE_BORDER_COLOR, border_color.data()); + } } } diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index c406142e4..ab06e2d95 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -77,10 +77,7 @@ private: Tegra::Texture::TextureFilter min_filter; Tegra::Texture::WrapMode wrap_u; Tegra::Texture::WrapMode wrap_v; - u32 border_color_r; - u32 border_color_g; - u32 border_color_b; - u32 border_color_a; + GLvec4 border_color; }; /// Configures the color and depth framebuffer states and returns the dirty <Color, Depth> diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index e19c3b280..16b1bd606 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -56,6 +56,9 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) { return {}; } + case Maxwell::VertexAttribute::Type::UnsignedInt: + return GL_UNSIGNED_INT; + case Maxwell::VertexAttribute::Type::Float: return GL_FLOAT; } @@ -112,6 +115,8 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) { return GL_MIRRORED_REPEAT; case Tegra::Texture::WrapMode::ClampToEdge: return GL_CLAMP_TO_EDGE; + case Tegra::Texture::WrapMode::Border: + return GL_CLAMP_TO_BORDER; case Tegra::Texture::WrapMode::ClampOGL: // TODO(Subv): GL_CLAMP was removed as of OpenGL 3.1, to implement GL_CLAMP, we can use // GL_CLAMP_TO_BORDER to get the border color of the texture, and then sample the edge to diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index d1c755033..c6bd2f4b9 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h @@ -242,10 +242,10 @@ struct TSCEntry { BitField<6, 2, TextureMipmapFilter> mip_filter; }; INSERT_PADDING_BYTES(8); - u32 border_color_r; - u32 border_color_g; - u32 border_color_b; - u32 border_color_a; + float border_color_r; + float border_color_g; + float border_color_b; + float border_color_a; }; static_assert(sizeof(TSCEntry) == 0x20, "TSCEntry has wrong size"); |