2013-07-16 11:28:28 +00:00
|
|
|
from waflib.Build import BuildContext
|
cocoa-cb: initial implementation via opengl-cb API
this is meant to replace the old and not properly working vo_gpu/opengl
cocoa backend in the future. the problems are various shortcomings of
Apple's opengl implementation and buggy behaviour in certain
circumstances that couldn't be properly worked around. there are also
certain regressions on newer macOS versions from 10.11 onwards.
- awful opengl performance with a none layer backed context
- huge amount of dropped frames with an early context flush
- flickering of system elements like the dock or volume indicator
- double buffering not properly working with a none layer backed context
- bad performance in fullscreen because of system optimisations
all the problems were caused by using a normal opengl context, that
seems somewhat abandoned by apple, and are fixed by using a layer backed
opengl context instead. problems that couldn't be fixed could be
properly worked around.
this has all features our old backend has sans the wid embedding,
the possibility to disable the automatic GPU switching and taking
screenshots of the window content. the first was deemed unnecessary by
me for now, since i just use the libmpv API that others can use anyway.
second is technically not possible atm because we have to pre-allocate
our opengl context at a time the config isn't read yet, so we can't get
the needed property. third one is a bit tricky because of deadlocking
and it needed to be in sync, hopefully i can work around that in the
future.
this also has at least one additional feature or eye-candy. a properly
working fullscreen animation with the native fs. also since this is a
direct port of the old backend of the parts that could be used, though
with adaptions and improvements, this looks a lot cleaner and easier to
understand.
some credit goes to @pigoz for the initial swift build support which
i could improve upon.
Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739,
#2392, #2217
2018-02-12 11:28:19 +00:00
|
|
|
from waflib import TaskGen, Utils
|
2016-12-17 16:12:56 +00:00
|
|
|
from io import StringIO
|
|
|
|
from TOOLS.matroska import generate_C_header, generate_C_definitions
|
|
|
|
from TOOLS.file2string import file2string
|
2013-07-16 11:28:28 +00:00
|
|
|
import os
|
|
|
|
|
2018-04-15 00:16:36 +00:00
|
|
|
def __wayland_scanner_cmd__(ctx, mode, dir, src, vendored_file):
|
|
|
|
return "${{WAYSCAN}} {0} < {1} > ${{TGT}}".format(
|
|
|
|
mode,
|
|
|
|
"${SRC}" if vendored_file else "{}/{}".format(dir, src)
|
|
|
|
)
|
2017-10-01 20:16:49 +00:00
|
|
|
|
2013-07-16 11:28:28 +00:00
|
|
|
def __file2string__(ctx, **kwargs):
|
|
|
|
ctx(
|
|
|
|
rule = __file2string_cmd__(ctx),
|
|
|
|
before = ("c",),
|
|
|
|
name = os.path.basename(kwargs['target']),
|
|
|
|
**kwargs
|
|
|
|
)
|
|
|
|
|
2016-12-17 16:12:56 +00:00
|
|
|
def execf(self, fn):
|
2017-01-07 13:59:30 +00:00
|
|
|
setattr(self, 'before', ['c'])
|
2016-12-17 16:12:56 +00:00
|
|
|
setattr(self, 'rule', ' ') # waf doesn't print the task with no rule
|
|
|
|
target = getattr(self, 'target', None)
|
|
|
|
out = self.path.find_or_declare(target)
|
|
|
|
tmp = StringIO()
|
|
|
|
fn(tmp)
|
|
|
|
out.write(tmp.getvalue())
|
|
|
|
tmp.close()
|
|
|
|
|
|
|
|
@TaskGen.feature('file2string')
|
|
|
|
def f2s(self):
|
|
|
|
def fn(out):
|
|
|
|
source = getattr(self, 'source', None)
|
|
|
|
src = self.path.find_resource(source)
|
2020-11-22 14:27:02 +00:00
|
|
|
file2string(source, iter(src.read('rb').splitlines(True)), out)
|
2016-12-17 16:12:56 +00:00
|
|
|
execf(self, fn)
|
|
|
|
|
|
|
|
@TaskGen.feature('ebml_header')
|
|
|
|
def ebml_header(self):
|
|
|
|
execf(self, generate_C_header)
|
|
|
|
|
|
|
|
@TaskGen.feature('ebml_definitions')
|
|
|
|
def ebml_definitions(self):
|
|
|
|
execf(self, generate_C_definitions)
|
2013-07-16 11:28:28 +00:00
|
|
|
|
2017-10-01 20:16:49 +00:00
|
|
|
def __wayland_protocol_code__(ctx, **kwargs):
|
2018-04-15 00:16:36 +00:00
|
|
|
protocol_is_vendored = kwargs.get("vendored_protocol", False)
|
|
|
|
file_name = kwargs['protocol'] + '.xml'
|
|
|
|
|
|
|
|
if protocol_is_vendored:
|
|
|
|
del kwargs['vendored_protocol']
|
|
|
|
kwargs['source'] = '{}/{}'.format(kwargs['proto_dir'], file_name)
|
|
|
|
|
2017-10-01 20:16:49 +00:00
|
|
|
ctx(
|
2019-09-19 20:37:00 +00:00
|
|
|
rule = __wayland_scanner_cmd__(ctx, 'private-code', kwargs['proto_dir'],
|
2018-04-15 00:16:36 +00:00
|
|
|
file_name,
|
|
|
|
protocol_is_vendored),
|
2017-10-01 20:16:49 +00:00
|
|
|
name = os.path.basename(kwargs['target']),
|
|
|
|
**kwargs
|
|
|
|
)
|
|
|
|
|
|
|
|
def __wayland_protocol_header__(ctx, **kwargs):
|
2018-04-15 00:16:36 +00:00
|
|
|
protocol_is_vendored = kwargs.get("vendored_protocol", False)
|
|
|
|
file_name = kwargs['protocol'] + '.xml'
|
|
|
|
|
|
|
|
if protocol_is_vendored:
|
|
|
|
del kwargs['vendored_protocol']
|
|
|
|
kwargs['source'] = '{}/{}'.format(kwargs['proto_dir'], file_name)
|
|
|
|
|
2017-10-01 20:16:49 +00:00
|
|
|
ctx(
|
|
|
|
rule = __wayland_scanner_cmd__(ctx, 'client-header', kwargs['proto_dir'],
|
2018-04-15 00:16:36 +00:00
|
|
|
file_name,
|
|
|
|
protocol_is_vendored),
|
2017-10-01 20:16:49 +00:00
|
|
|
before = ('c',),
|
|
|
|
name = os.path.basename(kwargs['target']),
|
|
|
|
**kwargs
|
|
|
|
)
|
|
|
|
|
cocoa-cb: initial implementation via opengl-cb API
this is meant to replace the old and not properly working vo_gpu/opengl
cocoa backend in the future. the problems are various shortcomings of
Apple's opengl implementation and buggy behaviour in certain
circumstances that couldn't be properly worked around. there are also
certain regressions on newer macOS versions from 10.11 onwards.
- awful opengl performance with a none layer backed context
- huge amount of dropped frames with an early context flush
- flickering of system elements like the dock or volume indicator
- double buffering not properly working with a none layer backed context
- bad performance in fullscreen because of system optimisations
all the problems were caused by using a normal opengl context, that
seems somewhat abandoned by apple, and are fixed by using a layer backed
opengl context instead. problems that couldn't be fixed could be
properly worked around.
this has all features our old backend has sans the wid embedding,
the possibility to disable the automatic GPU switching and taking
screenshots of the window content. the first was deemed unnecessary by
me for now, since i just use the libmpv API that others can use anyway.
second is technically not possible atm because we have to pre-allocate
our opengl context at a time the config isn't read yet, so we can't get
the needed property. third one is a bit tricky because of deadlocking
and it needed to be in sync, hopefully i can work around that in the
future.
this also has at least one additional feature or eye-candy. a properly
working fullscreen animation with the native fs. also since this is a
direct port of the old backend of the parts that could be used, though
with adaptions and improvements, this looks a lot cleaner and easier to
understand.
some credit goes to @pigoz for the initial swift build support which
i could improve upon.
Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739,
#2392, #2217
2018-02-12 11:28:19 +00:00
|
|
|
@TaskGen.feature('cprogram')
|
2018-02-13 17:37:38 +00:00
|
|
|
@TaskGen.feature('cshlib')
|
|
|
|
@TaskGen.feature('cstlib')
|
cocoa-cb: initial implementation via opengl-cb API
this is meant to replace the old and not properly working vo_gpu/opengl
cocoa backend in the future. the problems are various shortcomings of
Apple's opengl implementation and buggy behaviour in certain
circumstances that couldn't be properly worked around. there are also
certain regressions on newer macOS versions from 10.11 onwards.
- awful opengl performance with a none layer backed context
- huge amount of dropped frames with an early context flush
- flickering of system elements like the dock or volume indicator
- double buffering not properly working with a none layer backed context
- bad performance in fullscreen because of system optimisations
all the problems were caused by using a normal opengl context, that
seems somewhat abandoned by apple, and are fixed by using a layer backed
opengl context instead. problems that couldn't be fixed could be
properly worked around.
this has all features our old backend has sans the wid embedding,
the possibility to disable the automatic GPU switching and taking
screenshots of the window content. the first was deemed unnecessary by
me for now, since i just use the libmpv API that others can use anyway.
second is technically not possible atm because we have to pre-allocate
our opengl context at a time the config isn't read yet, so we can't get
the needed property. third one is a bit tricky because of deadlocking
and it needed to be in sync, hopefully i can work around that in the
future.
this also has at least one additional feature or eye-candy. a properly
working fullscreen animation with the native fs. also since this is a
direct port of the old backend of the parts that could be used, though
with adaptions and improvements, this looks a lot cleaner and easier to
understand.
some credit goes to @pigoz for the initial swift build support which
i could improve upon.
Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739,
#2392, #2217
2018-02-12 11:28:19 +00:00
|
|
|
@TaskGen.feature('apply_link')
|
2018-07-28 12:48:07 +00:00
|
|
|
@TaskGen.after_method('process_source', 'process_use', 'apply_link', 'process_uselib_local', 'propagate_uselib_vars', 'do_the_symbol_stuff')
|
cocoa-cb: initial implementation via opengl-cb API
this is meant to replace the old and not properly working vo_gpu/opengl
cocoa backend in the future. the problems are various shortcomings of
Apple's opengl implementation and buggy behaviour in certain
circumstances that couldn't be properly worked around. there are also
certain regressions on newer macOS versions from 10.11 onwards.
- awful opengl performance with a none layer backed context
- huge amount of dropped frames with an early context flush
- flickering of system elements like the dock or volume indicator
- double buffering not properly working with a none layer backed context
- bad performance in fullscreen because of system optimisations
all the problems were caused by using a normal opengl context, that
seems somewhat abandoned by apple, and are fixed by using a layer backed
opengl context instead. problems that couldn't be fixed could be
properly worked around.
this has all features our old backend has sans the wid embedding,
the possibility to disable the automatic GPU switching and taking
screenshots of the window content. the first was deemed unnecessary by
me for now, since i just use the libmpv API that others can use anyway.
second is technically not possible atm because we have to pre-allocate
our opengl context at a time the config isn't read yet, so we can't get
the needed property. third one is a bit tricky because of deadlocking
and it needed to be in sync, hopefully i can work around that in the
future.
this also has at least one additional feature or eye-candy. a properly
working fullscreen animation with the native fs. also since this is a
direct port of the old backend of the parts that could be used, though
with adaptions and improvements, this looks a lot cleaner and easier to
understand.
some credit goes to @pigoz for the initial swift build support which
i could improve upon.
Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739,
#2392, #2217
2018-02-12 11:28:19 +00:00
|
|
|
def handle_add_object(tgen):
|
2019-09-21 21:33:07 +00:00
|
|
|
if getattr(tgen, 'add_objects', None):
|
|
|
|
for input in tgen.add_objects:
|
cocoa-cb: initial implementation via opengl-cb API
this is meant to replace the old and not properly working vo_gpu/opengl
cocoa backend in the future. the problems are various shortcomings of
Apple's opengl implementation and buggy behaviour in certain
circumstances that couldn't be properly worked around. there are also
certain regressions on newer macOS versions from 10.11 onwards.
- awful opengl performance with a none layer backed context
- huge amount of dropped frames with an early context flush
- flickering of system elements like the dock or volume indicator
- double buffering not properly working with a none layer backed context
- bad performance in fullscreen because of system optimisations
all the problems were caused by using a normal opengl context, that
seems somewhat abandoned by apple, and are fixed by using a layer backed
opengl context instead. problems that couldn't be fixed could be
properly worked around.
this has all features our old backend has sans the wid embedding,
the possibility to disable the automatic GPU switching and taking
screenshots of the window content. the first was deemed unnecessary by
me for now, since i just use the libmpv API that others can use anyway.
second is technically not possible atm because we have to pre-allocate
our opengl context at a time the config isn't read yet, so we can't get
the needed property. third one is a bit tricky because of deadlocking
and it needed to be in sync, hopefully i can work around that in the
future.
this also has at least one additional feature or eye-candy. a properly
working fullscreen animation with the native fs. also since this is a
direct port of the old backend of the parts that could be used, though
with adaptions and improvements, this looks a lot cleaner and easier to
understand.
some credit goes to @pigoz for the initial swift build support which
i could improve upon.
Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739,
#2392, #2217
2018-02-12 11:28:19 +00:00
|
|
|
input_node = tgen.path.find_resource(input)
|
|
|
|
if input_node is not None:
|
|
|
|
tgen.link_task.inputs.append(input_node)
|
|
|
|
|
2017-10-01 20:16:49 +00:00
|
|
|
BuildContext.file2string = __file2string__
|
|
|
|
BuildContext.wayland_protocol_code = __wayland_protocol_code__
|
|
|
|
BuildContext.wayland_protocol_header = __wayland_protocol_header__
|