summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/sockets/bsd.cpp48
-rw-r--r--src/core/hle/service/sockets/bsd.h4
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp31
3 files changed, 75 insertions, 8 deletions
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp
index 884ad173b..f67fab2f9 100644
--- a/src/core/hle/service/sockets/bsd.cpp
+++ b/src/core/hle/service/sockets/bsd.cpp
@@ -42,6 +42,26 @@ void BSD::Socket(Kernel::HLERequestContext& ctx) {
42 rb.Push<u32>(0); // bsd errno 42 rb.Push<u32>(0); // bsd errno
43} 43}
44 44
45void BSD::Select(Kernel::HLERequestContext& ctx) {
46 LOG_WARNING(Service, "(STUBBED) called");
47
48 IPC::ResponseBuilder rb{ctx, 4};
49
50 rb.Push(RESULT_SUCCESS);
51 rb.Push<u32>(0); // ret
52 rb.Push<u32>(0); // bsd errno
53}
54
55void BSD::Bind(Kernel::HLERequestContext& ctx) {
56 LOG_WARNING(Service, "(STUBBED) called");
57
58 IPC::ResponseBuilder rb{ctx, 4};
59
60 rb.Push(RESULT_SUCCESS);
61 rb.Push<u32>(0); // ret
62 rb.Push<u32>(0); // bsd errno
63}
64
45void BSD::Connect(Kernel::HLERequestContext& ctx) { 65void BSD::Connect(Kernel::HLERequestContext& ctx) {
46 LOG_WARNING(Service, "(STUBBED) called"); 66 LOG_WARNING(Service, "(STUBBED) called");
47 67
@@ -52,6 +72,26 @@ void BSD::Connect(Kernel::HLERequestContext& ctx) {
52 rb.Push<u32>(0); // bsd errno 72 rb.Push<u32>(0); // bsd errno
53} 73}
54 74
75void BSD::Listen(Kernel::HLERequestContext& ctx) {
76 LOG_WARNING(Service, "(STUBBED) called");
77
78 IPC::ResponseBuilder rb{ctx, 4};
79
80 rb.Push(RESULT_SUCCESS);
81 rb.Push<u32>(0); // ret
82 rb.Push<u32>(0); // bsd errno
83}
84
85void BSD::SetSockOpt(Kernel::HLERequestContext& ctx) {
86 LOG_WARNING(Service, "(STUBBED) called");
87
88 IPC::ResponseBuilder rb{ctx, 4};
89
90 rb.Push(RESULT_SUCCESS);
91 rb.Push<u32>(0); // ret
92 rb.Push<u32>(0); // bsd errno
93}
94
55void BSD::SendTo(Kernel::HLERequestContext& ctx) { 95void BSD::SendTo(Kernel::HLERequestContext& ctx) {
56 LOG_WARNING(Service, "(STUBBED) called"); 96 LOG_WARNING(Service, "(STUBBED) called");
57 97
@@ -80,7 +120,7 @@ BSD::BSD(const char* name) : ServiceFramework(name) {
80 {2, &BSD::Socket, "Socket"}, 120 {2, &BSD::Socket, "Socket"},
81 {3, nullptr, "SocketExempt"}, 121 {3, nullptr, "SocketExempt"},
82 {4, nullptr, "Open"}, 122 {4, nullptr, "Open"},
83 {5, nullptr, "Select"}, 123 {5, &BSD::Select, "Select"},
84 {6, nullptr, "Poll"}, 124 {6, nullptr, "Poll"},
85 {7, nullptr, "Sysctl"}, 125 {7, nullptr, "Sysctl"},
86 {8, nullptr, "Recv"}, 126 {8, nullptr, "Recv"},
@@ -88,15 +128,15 @@ BSD::BSD(const char* name) : ServiceFramework(name) {
88 {10, nullptr, "Send"}, 128 {10, nullptr, "Send"},
89 {11, &BSD::SendTo, "SendTo"}, 129 {11, &BSD::SendTo, "SendTo"},
90 {12, nullptr, "Accept"}, 130 {12, nullptr, "Accept"},
91 {13, nullptr, "Bind"}, 131 {13, &BSD::Bind, "Bind"},
92 {14, &BSD::Connect, "Connect"}, 132 {14, &BSD::Connect, "Connect"},
93 {15, nullptr, "GetPeerName"}, 133 {15, nullptr, "GetPeerName"},
94 {16, nullptr, "GetSockName"}, 134 {16, nullptr, "GetSockName"},
95 {17, nullptr, "GetSockOpt"}, 135 {17, nullptr, "GetSockOpt"},
96 {18, nullptr, "Listen"}, 136 {18, &BSD::Listen, "Listen"},
97 {19, nullptr, "Ioctl"}, 137 {19, nullptr, "Ioctl"},
98 {20, nullptr, "Fcntl"}, 138 {20, nullptr, "Fcntl"},
99 {21, nullptr, "SetSockOpt"}, 139 {21, &BSD::SetSockOpt, "SetSockOpt"},
100 {22, nullptr, "Shutdown"}, 140 {22, nullptr, "Shutdown"},
101 {23, nullptr, "ShutdownAllSockets"}, 141 {23, nullptr, "ShutdownAllSockets"},
102 {24, nullptr, "Write"}, 142 {24, nullptr, "Write"},
diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h
index 0fe0e65c6..3098e3baf 100644
--- a/src/core/hle/service/sockets/bsd.h
+++ b/src/core/hle/service/sockets/bsd.h
@@ -18,7 +18,11 @@ private:
18 void RegisterClient(Kernel::HLERequestContext& ctx); 18 void RegisterClient(Kernel::HLERequestContext& ctx);
19 void StartMonitoring(Kernel::HLERequestContext& ctx); 19 void StartMonitoring(Kernel::HLERequestContext& ctx);
20 void Socket(Kernel::HLERequestContext& ctx); 20 void Socket(Kernel::HLERequestContext& ctx);
21 void Select(Kernel::HLERequestContext& ctx);
22 void Bind(Kernel::HLERequestContext& ctx);
21 void Connect(Kernel::HLERequestContext& ctx); 23 void Connect(Kernel::HLERequestContext& ctx);
24 void Listen(Kernel::HLERequestContext& ctx);
25 void SetSockOpt(Kernel::HLERequestContext& ctx);
22 void SendTo(Kernel::HLERequestContext& ctx); 26 void SendTo(Kernel::HLERequestContext& ctx);
23 void Close(Kernel::HLERequestContext& ctx); 27 void Close(Kernel::HLERequestContext& ctx);
24 28
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index e95eb069e..d9aae6dff 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -176,6 +176,19 @@ GLint GetSwizzleSource(SwizzleSource source) {
176 return GL_NONE; 176 return GL_NONE;
177} 177}
178 178
179GLenum GetComponent(PixelFormat format, bool is_first) {
180 switch (format) {
181 case PixelFormat::Z24S8:
182 case PixelFormat::Z32FS8:
183 return is_first ? GL_DEPTH_COMPONENT : GL_STENCIL_INDEX;
184 case PixelFormat::S8Z24:
185 return is_first ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT;
186 default:
187 UNREACHABLE();
188 return GL_DEPTH_COMPONENT;
189 }
190}
191
179void ApplyTextureDefaults(const SurfaceParams& params, GLuint texture) { 192void ApplyTextureDefaults(const SurfaceParams& params, GLuint texture) {
180 if (params.IsBuffer()) { 193 if (params.IsBuffer()) {
181 return; 194 return;
@@ -416,11 +429,21 @@ void CachedSurfaceView::ApplySwizzle(SwizzleSource x_source, SwizzleSource y_sou
416 if (new_swizzle == swizzle) 429 if (new_swizzle == swizzle)
417 return; 430 return;
418 swizzle = new_swizzle; 431 swizzle = new_swizzle;
419 const std::array<GLint, 4> gl_swizzle = {GetSwizzleSource(x_source), GetSwizzleSource(y_source), 432 const std::array gl_swizzle = {GetSwizzleSource(x_source), GetSwizzleSource(y_source),
420 GetSwizzleSource(z_source), 433 GetSwizzleSource(z_source), GetSwizzleSource(w_source)};
421 GetSwizzleSource(w_source)};
422 const GLuint handle = GetTexture(); 434 const GLuint handle = GetTexture();
423 glTextureParameteriv(handle, GL_TEXTURE_SWIZZLE_RGBA, gl_swizzle.data()); 435 const PixelFormat format = surface.GetSurfaceParams().pixel_format;
436 switch (format) {
437 case PixelFormat::Z24S8:
438 case PixelFormat::Z32FS8:
439 case PixelFormat::S8Z24:
440 glTextureParameteri(handle, GL_DEPTH_STENCIL_TEXTURE_MODE,
441 GetComponent(format, x_source == SwizzleSource::R));
442 break;
443 default:
444 glTextureParameteriv(handle, GL_TEXTURE_SWIZZLE_RGBA, gl_swizzle.data());
445 break;
446 }
424} 447}
425 448
426OGLTextureView CachedSurfaceView::CreateTextureView() const { 449OGLTextureView CachedSurfaceView::CreateTextureView() const {