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