diff options
-rw-r--r-- | src/core/hle/ipc.h | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/result.h | 46 | ||||
-rw-r--r-- | src/core/hle/service/nfp/nfp.cpp | 48 | ||||
-rw-r--r-- | src/core/hle/service/service.cpp | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 8 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 8 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_util.h | 27 |
8 files changed, 101 insertions, 44 deletions
diff --git a/src/core/hle/ipc.h b/src/core/hle/ipc.h index ef6595550..c9257de77 100644 --- a/src/core/hle/ipc.h +++ b/src/core/hle/ipc.h @@ -32,6 +32,8 @@ enum class CommandType : u32 { Close = 2, Request = 4, Control = 5, + RequestWithContext = 6, + ControlWithContext = 7, Unspecified, }; diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 349bc11df..01904467e 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -110,7 +110,9 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) { // Padding to align to 16 bytes rp.AlignWithPadding(); - if (Session()->IsDomain() && (command_header->type == IPC::CommandType::Request || !incoming)) { + if (Session()->IsDomain() && ((command_header->type == IPC::CommandType::Request || + command_header->type == IPC::CommandType::RequestWithContext) || + !incoming)) { // If this is an incoming message, only CommandType "Request" has a domain header // All outgoing domain messages have the domain header, if only incoming has it if (incoming || domain_message_header) { diff --git a/src/core/hle/result.h b/src/core/hle/result.h index 052f49979..e3eda4f54 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -42,41 +42,75 @@ enum class ErrorModule : u32 { PM = 15, NS = 16, HTC = 18, + NCMContent = 20, SM = 21, RO = 22, SDMMC = 24, + OVLN = 25, SPL = 26, ETHC = 100, I2C = 101, + GPIO = 102, + UART = 103, Settings = 105, + WLAN = 107, + XCD = 108, NIFM = 110, - Display = 114, - NTC = 116, + Hwopus = 111, + Bluetooth = 113, + VI = 114, + NFP = 115, + Time = 116, FGM = 117, - PCIE = 120, + PCIe = 120, Friends = 121, + BCAT = 122, SSL = 123, Account = 124, + News = 125, Mii = 126, + NFC = 127, AM = 128, PlayReport = 129, + AHID = 130, + Qlaunch = 132, PCV = 133, OMM = 134, + BPC = 135, + PSM = 136, NIM = 137, PSC = 138, + TC = 139, USB = 140, + NSD = 141, + PCTL = 142, BTM = 143, + ETicket = 145, + NGC = 146, ERPT = 147, APM = 148, + ErrorUpload = 151, + Audio = 153, NPNS = 154, + NPNSHTTPSTREAM = 155, ARP = 157, BOOT = 158, - NFC = 161, + NFCMifare = 161, UserlandAssert = 162, + Fatal = 163, + NIMShop = 164, + SPSM = 165, + BGTC = 167, UserlandCrash = 168, - HID = 203, + SREPO = 180, + HID = 202, + LDN = 203, + Irsensor = 205, Capture = 206, - TC = 651, + Manu = 208, + GRC = 212, + Migration = 216, + MigrationLdcServ = 217, GeneralWebApplet = 800, WifiWebAuthApplet = 809, WhitelistedApplet = 810, diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index cc0247881..2af4465de 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp @@ -17,30 +17,30 @@ public: IUser() : ServiceFramework("IUser") { static const FunctionInfo functions[] = { {0, &IUser::Initialize, "Initialize"}, - {1, nullptr, "Unknown1"}, - {2, nullptr, "Unknown2"}, - {3, nullptr, "Unknown3"}, - {4, nullptr, "Unknown4"}, - {5, nullptr, "Unknown5"}, - {6, nullptr, "Unknown6"}, - {7, nullptr, "Unknown7"}, - {8, nullptr, "Unknown8"}, - {9, nullptr, "Unknown9"}, - {10, nullptr, "Unknown10"}, - {11, nullptr, "Unknown11"}, - {12, nullptr, "Unknown12"}, - {13, nullptr, "Unknown13"}, - {14, nullptr, "Unknown14"}, - {15, nullptr, "Unknown15"}, - {16, nullptr, "Unknown16"}, - {17, nullptr, "Unknown17"}, - {18, nullptr, "Unknown18"}, - {19, nullptr, "Unknown19"}, - {20, nullptr, "Unknown20"}, - {21, nullptr, "Unknown21"}, - {22, nullptr, "Unknown22"}, - {23, nullptr, "Unknown23"}, - {24, nullptr, "Unknown24"}, + {1, nullptr, "Finalize"}, + {2, nullptr, "ListDevices"}, + {3, nullptr, "StartDetection"}, + {4, nullptr, "StopDetection"}, + {5, nullptr, "Mount"}, + {6, nullptr, "Unmount"}, + {7, nullptr, "OpenApplicationArea"}, + {8, nullptr, "GetApplicationArea"}, + {9, nullptr, "SetApplicationArea"}, + {10, nullptr, "Flush"}, + {11, nullptr, "Restore"}, + {12, nullptr, "CreateApplicationArea"}, + {13, nullptr, "GetTagInfo"}, + {14, nullptr, "GetRegisterInfo"}, + {15, nullptr, "GetCommonInfo"}, + {16, nullptr, "GetModelInfo"}, + {17, nullptr, "AttachActivateEvent"}, + {18, nullptr, "AttachDeactivateEvent"}, + {19, nullptr, "GetState"}, + {20, nullptr, "GetDeviceState"}, + {21, nullptr, "GetNpadId"}, + {22, nullptr, "GetApplicationArea2"}, + {23, nullptr, "AttachAvailabilityChangeEvent"}, + {24, nullptr, "RecreateApplicationArea"}, }; RegisterHandlers(functions); } diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index dc30702c6..5b91089cf 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -144,10 +144,12 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co rb.Push(RESULT_SUCCESS); return ResultCode(ErrorModule::HIPC, ErrorDescription::RemoteProcessDead); } + case IPC::CommandType::ControlWithContext: case IPC::CommandType::Control: { Core::System::GetInstance().ServiceManager().InvokeControlRequest(context); break; } + case IPC::CommandType::RequestWithContext: case IPC::CommandType::Request: { InvokeRequest(context); break; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 907236136..35c1b1890 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -75,14 +75,11 @@ RasterizerOpenGL::RasterizerOpenGL() { // Clipping plane 0 is always enabled for PICA fixed clip plane z <= 0 state.clip_distance[0] = true; - // Generate VBO, VAO and UBO - vertex_buffer = OGLStreamBuffer::MakeBuffer(GLAD_GL_ARB_buffer_storage, GL_ARRAY_BUFFER); - vertex_buffer->Create(VERTEX_BUFFER_SIZE, VERTEX_BUFFER_SIZE / 2); + // Generate VAO and UBO sw_vao.Create(); uniform_buffer.Create(); state.draw.vertex_array = sw_vao.handle; - state.draw.vertex_buffer = vertex_buffer->GetHandle(); state.draw.uniform_buffer = uniform_buffer.handle; state.Apply(); @@ -90,7 +87,6 @@ RasterizerOpenGL::RasterizerOpenGL() { framebuffer.Create(); hw_vao.Create(); - hw_vao_enabled_attributes.fill(false); stream_buffer = OGLStreamBuffer::MakeBuffer(has_ARB_buffer_storage, GL_ARRAY_BUFFER); stream_buffer->Create(STREAM_BUFFER_SIZE, STREAM_BUFFER_SIZE / 2); @@ -181,8 +177,6 @@ std::pair<u8*, GLintptr> RasterizerOpenGL::SetupVertexArrays(u8* array_ptr, glVertexAttribFormat(index, attrib.ComponentCount(), MaxwellToGL::VertexType(attrib), attrib.IsNormalized() ? GL_TRUE : GL_FALSE, attrib.offset); glVertexAttribBinding(index, attrib.buffer); - - hw_vao_enabled_attributes[index] = true; } return {array_ptr, buffer_offset}; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 9709e595e..4b915c76a 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -134,21 +134,17 @@ private: std::unique_ptr<GLShader::ProgramManager> shader_program_manager; OGLVertexArray sw_vao; OGLVertexArray hw_vao; - std::array<bool, 16> hw_vao_enabled_attributes; std::array<SamplerInfo, GLShader::NumTextureSamplers> texture_samplers; std::array<std::array<OGLBuffer, Tegra::Engines::Maxwell3D::Regs::MaxConstBuffers>, Tegra::Engines::Maxwell3D::Regs::MaxShaderStage> ssbos; - static constexpr size_t VERTEX_BUFFER_SIZE = 128 * 1024 * 1024; - std::unique_ptr<OGLStreamBuffer> vertex_buffer; + static constexpr size_t STREAM_BUFFER_SIZE = 128 * 1024 * 1024; + std::unique_ptr<OGLStreamBuffer> stream_buffer; OGLBuffer uniform_buffer; OGLFramebuffer framebuffer; - static constexpr size_t STREAM_BUFFER_SIZE = 4 * 1024 * 1024; - std::unique_ptr<OGLStreamBuffer> stream_buffer; - size_t CalculateVertexArraysSize() const; std::pair<u8*, GLintptr> SetupVertexArrays(u8* array_ptr, GLintptr buffer_offset); diff --git a/src/video_core/renderer_opengl/gl_shader_util.h b/src/video_core/renderer_opengl/gl_shader_util.h index a1fa9e814..2036a06a9 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.h +++ b/src/video_core/renderer_opengl/gl_shader_util.h @@ -4,6 +4,7 @@ #pragma once +#include <string> #include <vector> #include <glad/glad.h> #include "common/assert.h" @@ -12,6 +13,27 @@ namespace GLShader { /** + * Utility function to log the source code of a list of shaders. + * @param shaders The OpenGL shaders whose source we will print. + */ +template <typename... T> +void LogShaderSource(T... shaders) { + auto shader_list = {shaders...}; + + for (const auto& shader : shader_list) { + if (shader == 0) + continue; + + GLint source_length; + glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &source_length); + + std::string source(source_length, ' '); + glGetShaderSource(shader, source_length, nullptr, &source[0]); + NGLOG_INFO(Render_OpenGL, "Shader source {}", source); + } +} + +/** * Utility function to create and compile an OpenGL GLSL shader * @param source String of the GLSL shader program * @param type Type of the shader (GL_VERTEX_SHADER, GL_GEOMETRY_SHADER or GL_FRAGMENT_SHADER) @@ -55,6 +77,11 @@ GLuint LoadProgram(bool separable_program, T... shaders) { } } + if (result == GL_FALSE) { + // There was a problem linking the shader, print the source for debugging purposes. + LogShaderSource(shaders...); + } + ASSERT_MSG(result == GL_TRUE, "Shader not linked"); ((shaders == 0 ? (void)0 : glDetachShader(program_id, shaders)), ...); |