1cc_library(
2    name = "gles1_dec",
3    srcs = [
4        "gles1_dec/GLESv1Decoder.cpp",
5        "gles1_dec/gles1_dec.cpp",
6        "gles1_dec/gles1_server_context.cpp",
7    ] + glob(["gles1_dec/*.h"]),
8    copts = ["-fno-exceptions"],
9    defines = ["EMUGL_BUILD"],
10    visibility = ["//visibility:public"],
11    deps = [
12        ":GLSnapshot",
13        "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
14        "//hardware/google/gfxstream/host/apigen-codec-common",
15    ],
16)
17
18objc_library(
19    name = "gfxstream-gl-host-common-darwin",
20    srcs = [
21        "gl-host-common/opengl/macTouchOpenGL.m",
22    ],
23    hdrs = ["gl-host-common/include/host-common/opengl/macTouchOpenGL.h"],
24    defines = ["EMUGL_BUILD"],
25    includes = ["gl-host-common/include"],
26    deps = [
27        "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
28    ],
29)
30
31cc_library(
32    name = "gl-common-headers",
33    hdrs = glob(["glestranslator/include/**/*.h"]),
34    copts = ["-fno-exceptions"],
35    includes = ["glestranslator/include"],
36    visibility = ["//visibility:public"],
37    deps = ["//hardware/google/gfxstream/host/apigen-codec-common"],
38)
39
40objc_library(
41    name = "egl_translator-darwin",
42    srcs = [
43        "glestranslator/EGL/MacNative.m",
44        "glestranslator/EGL/MacPixelFormatsAttribs.m",
45    ] + glob(["glestranslator/EGL/*.h"]),
46    copts = ["-Wno-deprecated-declarations"],
47    defines = ["EMUGL_BUILD"],
48    sdk_frameworks = [
49        "IOSurface",
50        "AppKit",
51        "CoreGraphics",
52        "OpenGL",
53    ],
54    visibility = ["//visibility:public"],
55    deps = [
56        "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
57    ],
58    alwayslink = True,
59)
60
61cc_library(
62    name = "EGL_translator_static",
63    srcs = [
64        "glestranslator/EGL/ClientAPIExts.cpp",
65        "glestranslator/EGL/EglConfig.cpp",
66        "glestranslator/EGL/EglContext.cpp",
67        "glestranslator/EGL/EglDisplay.cpp",
68        "glestranslator/EGL/EglGlobalInfo.cpp",
69        "glestranslator/EGL/EglImp.cpp",
70        "glestranslator/EGL/EglOsApi_egl.cpp",
71        "glestranslator/EGL/EglPbufferSurface.cpp",
72        "glestranslator/EGL/EglSurface.cpp",
73        "glestranslator/EGL/EglThreadInfo.cpp",
74        "glestranslator/EGL/EglValidate.cpp",
75        "glestranslator/EGL/EglWindowSurface.cpp",
76        "glestranslator/EGL/ShaderCache.cpp",
77        "glestranslator/EGL/ThreadInfo.cpp",
78    ] + glob([
79        "glestranslator/EGL/*.h",
80    ]) + select({
81        "@platforms//os:macos": ["glestranslator/EGL/EglOsApi_darwin.cpp"],
82        "@platforms//os:windows": [
83            "glestranslator/EGL/CoreProfileConfigs_windows.cpp",
84            "glestranslator/EGL/EglOsApi_wgl.cpp",
85        ],
86        "@platforms//os:linux": [
87            "glestranslator/EGL/CoreProfileConfigs_linux.cpp",
88            "glestranslator/EGL/EglOsApi_glx.cpp",
89            "glestranslator/EGL/X11ErrorHandler.cpp",
90        ],
91        "//conditions:default": [],
92    }),
93    hdrs =
94        ["glestranslator/EGL/ClientAPIExts.in"],
95    copts = [
96        "-fno-exceptions",
97        "-Wno-extern-c-compat",
98        "-Wno-inconsistent-missing-override",
99        "-Wno-return-type-c-linkage",
100    ],
101    defines = ["EMUGL_BUILD"],
102    visibility = ["//visibility:public"],
103    deps =
104        [
105            ":gl-common-headers",
106            "//hardware/google/aemu/host-common:aemu-host-common-headers",
107            "//hardware/google/aemu/snapshot:aemu-snapshot",
108            "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
109            "//hardware/google/gfxstream/common/etc:gfxstream_etc",
110            "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
111            "//hardware/google/gfxstream/host/apigen-codec-common",
112            "//hardware/google/gfxstream/host/gl:gfxstream-gl-host-common",
113            "//hardware/google/gfxstream/host/gl/glestranslator/GLES_CM:GLES_CM_translator_static",
114            "//hardware/google/gfxstream/host/gl/glestranslator/GLES_V2:GLES_V2_translator_static",
115        ] + select({
116            "@platforms//os:macos": [":egl_translator-darwin"],
117            "//conditions:default": [],
118        }),
119    alwayslink = True,
120)
121
122cc_library(
123    name = "gl_common",
124    srcs = [
125        "glestranslator/GLcommon/FramebufferData.cpp",
126        "glestranslator/GLcommon/GLBackgroundLoader.cpp",
127        "glestranslator/GLcommon/GLDispatch.cpp",
128        "glestranslator/GLcommon/GLESbuffer.cpp",
129        "glestranslator/GLcommon/GLEScontext.cpp",
130        "glestranslator/GLcommon/GLESpointer.cpp",
131        "glestranslator/GLcommon/GLESvalidate.cpp",
132        "glestranslator/GLcommon/GLutils.cpp",
133        "glestranslator/GLcommon/NamedObject.cpp",
134        "glestranslator/GLcommon/ObjectData.cpp",
135        "glestranslator/GLcommon/ObjectNameSpace.cpp",
136        "glestranslator/GLcommon/PaletteTexture.cpp",
137        "glestranslator/GLcommon/RangeManip.cpp",
138        "glestranslator/GLcommon/SaveableTexture.cpp",
139        "glestranslator/GLcommon/ScopedGLState.cpp",
140        "glestranslator/GLcommon/ShareGroup.cpp",
141        "glestranslator/GLcommon/TextureData.cpp",
142        "glestranslator/GLcommon/TextureUtils.cpp",
143        "glestranslator/GLcommon/rgtc.cpp",
144    ],
145    copts = [
146        "-Wno-extern-c-compat",
147        "-fno-exceptions",
148    ],
149    defines = [
150        "EMUGL_BUILD",
151        "BUILDING_EMUGL_COMMON_SHARED",
152    ],
153    visibility = ["//visibility:public"],
154    deps = [
155        ":gl-common-headers",
156        # "//external/angle:angle-headers",
157        "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
158        "//hardware/google/aemu/snapshot:aemu-snapshot",
159        "//hardware/google/gfxstream/common/etc:gfxstream_etc",
160        "//hardware/google/gfxstream/host:gfxstream-compressedTextures",
161    ],
162)
163
164cc_library(
165    name = "gfxstream-gl-host-common",
166    srcs = [
167        "gl-host-common/opengl/EmuglBackendList.cpp",
168        "gl-host-common/opengl/GLProcessPipe.cpp",
169        "gl-host-common/opengl/GpuFrameBridge.cpp",
170        "gl-host-common/opengl/OpenglEsPipe.cpp",
171        "gl-host-common/opengl/emugl_config.cpp",
172        "gl-host-common/opengl/gpuinfo.cpp",
173        "gl-host-common/opengl/logger.cpp",
174        "gl-host-common/opengl/misc.cpp",
175        "gl-host-common/opengles.cpp",
176    ] + select({
177        "@platforms//os:macos": [
178            "gl-host-common/opengl/NativeGpuInfo_darwin.cpp",
179        ],
180        "@platforms//os:windows": ["gl-host-common/opengl/NativeGpuInfo_windows.cpp"],
181        "@platforms//os:linux": ["gl-host-common/opengl/NativeGpuInfo_linux.cpp"],
182        "//conditions:default": [],
183    }) + glob(["gl-host-common/include/**/*.h"]),
184    copts = [
185        "-Wno-return-type-c-linkage",
186        "-fno-exceptions",
187        "-Wno-extern-c-compat",
188    ],
189    defines = ["EMUGL_BUILD"],
190    includes = ["gl-host-common/include"],
191    linkopts = select({
192        "@platforms//os:windows": [
193            "-DEFAULTLIB:D3d9.lib",
194            "-DEFAULTLIB:Advapi32.lib",
195        ],
196        "//conditions:default": [],
197    }),
198    visibility = ["//visibility:public"],
199    deps = [
200        "//hardware/google/aemu/snapshot:aemu-snapshot",
201        "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
202        "//hardware/google/gfxstream/host/apigen-codec-common",
203        "//hardware/google/gfxstream/host/features:gfxstream_features",
204    ] + select({
205        "@platforms//os:macos": ["gfxstream-gl-host-common-darwin"],
206        "//conditions:default": [],
207    }),
208)
209
210cc_library(
211    name = "gles2_dec",
212    srcs = [
213        "gles2_dec/GLESv2Decoder.cpp",
214        "gles2_dec/gles2_dec.cpp",
215        "gles2_dec/gles2_server_context.cpp",
216    ] + glob(["gles2_dec/*.h"]),
217    copts = ["-fno-exceptions"],
218    defines = ["EMUGL_BUILD"],
219    visibility = ["//visibility:public"],
220    deps = [
221        ":GLSnapshot",
222        "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
223        "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
224        "//hardware/google/gfxstream/host/apigen-codec-common",
225    ],
226)
227
228cc_library(
229    name = "GLSnapshot",
230    srcs = ["glsnapshot/GLSnapshot.cpp"],
231    hdrs = ["glsnapshot/GLSnapshot.h"],
232    copts = [
233        "-fno-exceptions",
234        "-Wno-extern-c-compat",
235    ],
236    defines = ["EMUGL_BUILD"],
237    includes = ["glsnapshot"],
238    visibility = ["//visibility:public"],
239    deps = ["//hardware/google/gfxstream/host/apigen-codec-common"],
240)
241
242cc_library(
243    name = "OpenGLESDispatch",
244    srcs = [
245        "OpenGLESDispatch/EGLDispatch.cpp",
246        "OpenGLESDispatch/GLESv1Dispatch.cpp",
247        "OpenGLESDispatch/GLESv2Dispatch.cpp",
248        "OpenGLESDispatch/OpenGLDispatchLoader.cpp",
249        "OpenGLESDispatch/StaticDispatch.cpp",
250        "OpenGLESDispatch/gles1_stubbed_in_translator_namespace.cpp",
251        "OpenGLESDispatch/gles2_stubbed_in_translator_namespace.cpp",
252    ] + glob(["OpenGLESDispatch/*.h"]),
253    copts = [
254        "-fno-exceptions",
255        "-Wno-extern-c-compat",
256    ],
257    defines = ["EMUGL_BUILD"],
258    visibility = ["//visibility:public"],
259    deps = [
260        ":EGL_translator_static",
261        ":gles1_dec",
262        ":gles2_dec",
263        "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
264        "//hardware/google/gfxstream/common/opengl:gfxstream_opengl_headers",
265        "//hardware/google/gfxstream/host/apigen-codec-common",
266    ],
267)
268
269cc_library(
270    name = "gfxstream-gl-server",
271    srcs = [
272        "BufferGl.cpp",
273        "ColorBufferGl.cpp",
274        "CompositorGl.cpp",
275        "DebugGl.cpp",
276        "DisplayGl.cpp",
277        "DisplaySurfaceGl.cpp",
278        "EmulatedEglConfig.cpp",
279        "EmulatedEglContext.cpp",
280        "EmulatedEglFenceSync.cpp",
281        "EmulatedEglImage.cpp",
282        "EmulatedEglWindowSurface.cpp",
283        "EmulationGl.cpp",
284        "GLESVersionDetector.cpp",
285        "ReadbackWorkerGl.cpp",
286        "TextureDraw.cpp",
287        "TextureResize.cpp",
288        "YUVConverter.cpp",
289    ] + glob([
290        "*.h",
291        "glestranslator/include/**/*.h",
292    ]),
293    hdrs = [],
294    copts = [
295        "-fno-exceptions",
296        "-Wno-extern-c-compat",
297    ],
298    defines = [
299        "GFXSTREAM_ENABLE_HOST_GLES=1",
300        "EMUGL_BUILD",
301    ],
302    visibility = ["//visibility:public"],
303    deps = [
304        ":OpenGLESDispatch",
305        ":gfxstream-gl-host-common",
306        ":gles1_dec",
307        ":gles2_dec",
308        "//hardware/google/gfxstream:gfxstream-gl-host-common-headers",
309        "//hardware/google/gfxstream/host:gfxstream_host_headers",
310        "//hardware/google/gfxstream/host/apigen-codec-common",
311        "//hardware/google/gfxstream/host/gl:GLSnapshot",
312    ],
313)
314
315cc_library(
316    name = "gl_headers",
317    hdrs = glob(["*.h"]),
318    visibility = ["//visibility:public"],
319    # visibility = ["//a:__pkg__"],
320)
321