diff
stringlengths 41
2.03M
| msg
stringlengths 1
1.5k
⌀ | repo
stringlengths 5
40
| sha
stringlengths 40
40
| time
stringlengths 20
20
|
---|---|---|---|---|
mmm a / script / create - dist . py <nl> ppp b / script / create - dist . py <nl> <nl> <nl> <nl> ATOM_SHELL_VRESION = get_atom_shell_version ( ) <nl> - NODE_VERSION = ' v0 . 10 . 18 ' <nl> + NODE_VERSION = ' v0 . 11 . 9 ' <nl> BASE_URL = ' https : / / gh - contractor - zcbenz . s3 . amazonaws . com / libchromiumcontent ' <nl> <nl> SOURCE_ROOT = os . path . abspath ( os . path . dirname ( os . path . dirname ( __file__ ) ) ) <nl> mmm a / script / upload . py <nl> ppp b / script / upload . py <nl> <nl> <nl> ATOM_SHELL_REPO = ' atom / atom - shell ' <nl> ATOM_SHELL_VRESION = get_atom_shell_version ( ) <nl> - NODE_VERSION = ' v0 . 10 . 18 ' <nl> + NODE_VERSION = ' v0 . 11 . 9 ' <nl> <nl> SOURCE_ROOT = os . path . abspath ( os . path . dirname ( os . path . dirname ( __file__ ) ) ) <nl> OUT_DIR = os . path . join ( SOURCE_ROOT , ' out ' , ' Release ' ) <nl>
|
Bump node version to v0 . 11 . 9 .
|
electron/electron
|
d3416e28735e81c78dc7d3fe048efbed96e71609
|
2013-12-16T06:52:15Z
|
mmm a / src / common / fiber . cpp <nl> ppp b / src / common / fiber . cpp <nl> <nl> <nl> # include " common / assert . h " <nl> # include " common / fiber . h " <nl> - # ifdef _MSC_VER <nl> + # if defined ( _WIN32 ) | | defined ( WIN32 ) <nl> # include < windows . h > <nl> # else <nl> # include < boost / context / detail / fcontext . hpp > <nl> <nl> <nl> namespace Common { <nl> <nl> - # ifdef _MSC_VER <nl> + # if defined ( _WIN32 ) | | defined ( WIN32 ) <nl> <nl> struct Fiber : : FiberImpl { <nl> LPVOID handle = nullptr ; <nl> mmm a / src / common / fiber . h <nl> ppp b / src / common / fiber . h <nl> <nl> # include " common / common_types . h " <nl> # include " common / spin_lock . h " <nl> <nl> - # ifndef _MSC_VER <nl> + # if ! defined ( _WIN32 ) & & ! defined ( WIN32 ) <nl> namespace boost : : context : : detail { <nl> struct transfer_t ; <nl> } <nl> class Fiber { <nl> private : <nl> Fiber ( ) ; <nl> <nl> - # ifdef _MSC_VER <nl> + # if defined ( _WIN32 ) | | defined ( WIN32 ) <nl> void start ( ) ; <nl> static void FiberStartFunc ( void * fiber_parameter ) ; <nl> # else <nl>
|
Common : Make MinGW build use Windows Fibers instead of fcontext_t
|
yuzu-emu/yuzu
|
3398f701eeac63f3cfcf193f3e9c1ee2f06edb08
|
2020-06-18T20:29:20Z
|
mmm a / dbms / src / Storages / Kafka / KafkaBlockInputStream . cpp <nl> ppp b / dbms / src / Storages / Kafka / KafkaBlockInputStream . cpp <nl> void KafkaBlockInputStream : : readPrefixImpl ( ) <nl> if ( ! buffer ) <nl> return ; <nl> <nl> - buffer - > subscribe ( storage . getTopics ( ) ) ; <nl> + buffer - > subscribe ( ) ; <nl> <nl> broken = true ; <nl> } <nl> <nl> Block KafkaBlockInputStream : : readImpl ( ) <nl> { <nl> - if ( ! buffer ) <nl> + if ( ! buffer | | finished ) <nl> return Block ( ) ; <nl> <nl> + finished = true ; <nl> + / / now it ' s one - time usage InputStream <nl> + / / one block of the needed size ( or with desired flush timeout ) is formed in one internal iteration <nl> + / / otherwise external iteration will reuse that and logic will became even more fuzzy <nl> + <nl> MutableColumns result_columns = non_virtual_header . cloneEmptyColumns ( ) ; <nl> MutableColumns virtual_columns = virtual_header . cloneEmptyColumns ( ) ; <nl> <nl> Block KafkaBlockInputStream : : readImpl ( ) <nl> <nl> auto new_rows = read_kafka_message ( ) ; <nl> <nl> + buffer - > storeLastReadMessageOffset ( ) ; <nl> + <nl> auto _topic = buffer - > currentTopic ( ) ; <nl> auto _key = buffer - > currentKey ( ) ; <nl> auto _offset = buffer - > currentOffset ( ) ; <nl> Block KafkaBlockInputStream : : readImpl ( ) <nl> <nl> total_rows = total_rows + new_rows ; <nl> buffer - > allowNext ( ) ; <nl> - if ( ! new_rows | | total_rows > = max_block_size | | ! checkTimeLimit ( ) ) <nl> + <nl> + if ( buffer - > hasMorePolledMessages ( ) ) <nl> + { <nl> + continue ; <nl> + } <nl> + if ( total_rows > = max_block_size | | ! checkTimeLimit ( ) ) <nl> + { <nl> break ; <nl> + } <nl> } <nl> <nl> - if ( total_rows = = 0 ) <nl> + if ( buffer - > rebalanceHappened ( ) | | total_rows = = 0 ) <nl> return Block ( ) ; <nl> <nl> / / / MATERIALIZED columns can be added here , but I think <nl> mmm a / dbms / src / Storages / Kafka / KafkaBlockInputStream . h <nl> ppp b / dbms / src / Storages / Kafka / KafkaBlockInputStream . h <nl> class KafkaBlockInputStream : public IBlockInputStream <nl> UInt64 max_block_size ; <nl> <nl> ConsumerBufferPtr buffer ; <nl> - bool broken = true , claimed = false , commit_in_suffix ; <nl> + bool broken = true , finished = false , claimed = false , commit_in_suffix ; <nl> + <nl> const Block non_virtual_header , virtual_header ; <nl> } ; <nl> <nl> mmm a / dbms / src / Storages / Kafka / ReadBufferFromKafkaConsumer . cpp <nl> ppp b / dbms / src / Storages / Kafka / ReadBufferFromKafkaConsumer . cpp <nl> <nl> # include < common / logger_useful . h > <nl> <nl> # include < cppkafka / cppkafka . h > <nl> + # include < boost / algorithm / string / join . hpp > <nl> <nl> namespace DB <nl> { <nl> <nl> using namespace std : : chrono_literals ; <nl> + const auto MAX_TIME_TO_WAIT_FOR_ASSIGNMENT_MS = 15000 ; <nl> + <nl> <nl> ReadBufferFromKafkaConsumer : : ReadBufferFromKafkaConsumer ( <nl> ConsumerPtr consumer_ , <nl> ReadBufferFromKafkaConsumer : : ReadBufferFromKafkaConsumer ( <nl> size_t max_batch_size , <nl> size_t poll_timeout_ , <nl> bool intermediate_commit_ , <nl> - const std : : atomic < bool > & stopped_ ) <nl> + const std : : atomic < bool > & stopped_ , <nl> + const Names & _topics ) <nl> : ReadBuffer ( nullptr , 0 ) <nl> , consumer ( consumer_ ) <nl> , log ( log_ ) <nl> ReadBufferFromKafkaConsumer : : ReadBufferFromKafkaConsumer ( <nl> , intermediate_commit ( intermediate_commit_ ) <nl> , stopped ( stopped_ ) <nl> , current ( messages . begin ( ) ) <nl> + , topics ( _topics ) <nl> { <nl> + / / called ( synchroniously , during poll ) when we enter the consumer group <nl> + consumer - > set_assignment_callback ( [ this ] ( const cppkafka : : TopicPartitionList & topic_partitions ) <nl> + { <nl> + LOG_TRACE ( log , " Topics / partitions assigned : " < < topic_partitions ) ; <nl> + assignment = topic_partitions ; <nl> + } ) ; <nl> + <nl> + / / called ( synchroniously , during poll ) when we leave the consumer group <nl> + consumer - > set_revocation_callback ( [ this ] ( const cppkafka : : TopicPartitionList & topic_partitions ) <nl> + { <nl> + / / Rebalance is happening now , and now we have a chance to finish the work <nl> + / / with topics / partitions we were working with before rebalance <nl> + LOG_TRACE ( log , " Rebalance initiated . Revoking partitions : " < < topic_partitions ) ; <nl> + <nl> + / / we can not flush data to target from that point ( it is pulled , not pushed ) <nl> + / / so the best we can now it to <nl> + / / 1 ) repeat last commit in sync mode ( async could be still in queue , we need to be sure is is properly committed before rebalance ) <nl> + / / 2 ) stop / brake the current reading : <nl> + / / * clean buffered non - commited messages <nl> + / / * set flag / flush <nl> + <nl> + messages . clear ( ) ; <nl> + current = messages . begin ( ) ; <nl> + BufferBase : : set ( nullptr , 0 , 0 ) ; <nl> + <nl> + rebalance_happened = true ; <nl> + assignment . clear ( ) ; <nl> + <nl> + / / for now we use slower ( but reliable ) sync commit in main loop , so no need to repeat <nl> + / / try <nl> + / / { <nl> + / / consumer - > commit ( ) ; <nl> + / / } <nl> + / / catch ( cppkafka : : HandleException & e ) <nl> + / / { <nl> + / / LOG_WARNING ( log , " Commit error : " < < e . what ( ) ) ; <nl> + / / } <nl> + } ) ; <nl> + <nl> + consumer - > set_rebalance_error_callback ( [ this ] ( cppkafka : : Error err ) <nl> + { <nl> + LOG_ERROR ( log , " Rebalance error : " < < err ) ; <nl> + } ) ; <nl> } <nl> <nl> ReadBufferFromKafkaConsumer : : ~ ReadBufferFromKafkaConsumer ( ) <nl> ReadBufferFromKafkaConsumer : : ~ ReadBufferFromKafkaConsumer ( ) <nl> / / / NOTE : see https : / / github . com / edenhill / librdkafka / issues / 2077 <nl> consumer - > unsubscribe ( ) ; <nl> consumer - > unassign ( ) ; <nl> - while ( consumer - > get_consumer_queue ( ) . next_event ( 1s ) ) ; <nl> + while ( consumer - > get_consumer_queue ( ) . next_event ( 100ms ) ) ; <nl> } <nl> <nl> void ReadBufferFromKafkaConsumer : : commit ( ) <nl> void ReadBufferFromKafkaConsumer : : commit ( ) <nl> <nl> PrintOffsets ( " Polled offset " , consumer - > get_offsets_position ( consumer - > get_assignment ( ) ) ) ; <nl> <nl> - consumer - > async_commit ( ) ; <nl> + if ( hasMorePolledMessages ( ) ) <nl> + { <nl> + LOG_WARNING ( log , " Logical error . Non all polled messages were processed . " ) ; <nl> + } <nl> + <nl> + if ( offsets_stored > 0 ) <nl> + { <nl> + / / if we will do async commit here ( which is faster ) <nl> + / / we may need to repeat commit in sync mode in revocation callback , <nl> + / / but it seems like existing API doesn ' t allow us to to that <nl> + / / in a controlled manner ( i . e . we don ' t know the offsets to commit then ) <nl> + consumer - > commit ( ) ; <nl> + } <nl> + else <nl> + { <nl> + LOG_TRACE ( log , " Nothing to commit . " ) ; <nl> + } <nl> <nl> PrintOffsets ( " Committed offset " , consumer - > get_offsets_committed ( consumer - > get_assignment ( ) ) ) ; <nl> + offsets_stored = 0 ; <nl> <nl> stalled = false ; <nl> } <nl> <nl> - void ReadBufferFromKafkaConsumer : : subscribe ( const Names & topics ) <nl> + void ReadBufferFromKafkaConsumer : : subscribe ( ) <nl> { <nl> - { <nl> - String message = " Already subscribed to topics : " ; <nl> - for ( const auto & topic : consumer - > get_subscription ( ) ) <nl> - message + = " " + topic ; <nl> - LOG_TRACE ( log , message ) ; <nl> - } <nl> + LOG_TRACE ( log , " Already subscribed to topics : [ " <nl> + < < boost : : algorithm : : join ( consumer - > get_subscription ( ) , " , " ) <nl> + < < " ] " ) ; <nl> <nl> - { <nl> - String message = " Already assigned to topics : " ; <nl> - for ( const auto & toppar : consumer - > get_assignment ( ) ) <nl> - message + = " " + toppar . get_topic ( ) ; <nl> - LOG_TRACE ( log , message ) ; <nl> - } <nl> + LOG_TRACE ( log , " Already assigned to : " < < assignment ) ; <nl> + <nl> + size_t max_retries = 5 ; <nl> <nl> - / / While we wait for an assignment after subscribtion , we ' ll poll zero messages anyway . <nl> - / / If we ' re doing a manual select then it ' s better to get something after a wait , then immediate nothing . <nl> - / / But due to the nature of async pause / resume / subscribe we can ' t guarantee any persistent state : <nl> - / / see https : / / github . com / edenhill / librdkafka / issues / 2455 <nl> while ( consumer - > get_subscription ( ) . empty ( ) ) <nl> { <nl> - stalled = false ; <nl> - <nl> + - - max_retries ; <nl> try <nl> { <nl> consumer - > subscribe ( topics ) ; <nl> - if ( nextImpl ( ) ) <nl> - break ; <nl> - <nl> / / FIXME : if we failed to receive " subscribe " response while polling and destroy consumer now , then we may hang up . <nl> / / see https : / / github . com / edenhill / librdkafka / issues / 2077 <nl> } <nl> catch ( cppkafka : : HandleException & e ) <nl> { <nl> - if ( e . get_error ( ) = = RD_KAFKA_RESP_ERR__TIMED_OUT ) <nl> + if ( max_retries > 0 & & e . get_error ( ) = = RD_KAFKA_RESP_ERR__TIMED_OUT ) <nl> continue ; <nl> throw ; <nl> } <nl> } <nl> <nl> stalled = false ; <nl> + rebalance_happened = false ; <nl> + offsets_stored = 0 ; <nl> } <nl> <nl> void ReadBufferFromKafkaConsumer : : unsubscribe ( ) <nl> void ReadBufferFromKafkaConsumer : : unsubscribe ( ) <nl> consumer - > unsubscribe ( ) ; <nl> } <nl> <nl> + <nl> + bool ReadBufferFromKafkaConsumer : : hasMorePolledMessages ( ) const <nl> + { <nl> + return ( ! stalled ) & & ( current ! = messages . end ( ) ) ; <nl> + } <nl> + <nl> + <nl> + void ReadBufferFromKafkaConsumer : : resetToLastCommitted ( const char * msg ) <nl> + { <nl> + if ( assignment . empty ( ) ) <nl> + { <nl> + LOG_TRACE ( log , " Not assignned . Can ' t reset to last committed position . " ) ; <nl> + return ; <nl> + } <nl> + auto committed_offset = consumer - > get_offsets_committed ( consumer - > get_assignment ( ) ) ; <nl> + consumer - > assign ( committed_offset ) ; <nl> + LOG_TRACE ( log , msg < < " Returned to committed position : " < < committed_offset ) ; <nl> + <nl> + } <nl> + <nl> / / / Do commit messages implicitly after we processed the previous batch . <nl> bool ReadBufferFromKafkaConsumer : : nextImpl ( ) <nl> { <nl> / / / NOTE : ReadBuffer was implemented with an immutable underlying contents in mind . <nl> / / / If we failed to poll any message once - don ' t try again . <nl> / / / Otherwise , the | poll_timeout | expectations get flawn . <nl> - if ( stalled | | stopped | | ! allowed ) <nl> + if ( stalled | | stopped | | ! allowed | | rebalance_happened ) <nl> return false ; <nl> <nl> if ( current = = messages . end ( ) ) <nl> bool ReadBufferFromKafkaConsumer : : nextImpl ( ) <nl> if ( intermediate_commit ) <nl> commit ( ) ; <nl> <nl> - / / / Don ' t drop old messages immediately , since we may need them for virtual columns . <nl> - auto new_messages = consumer - > poll_batch ( batch_size , std : : chrono : : milliseconds ( poll_timeout ) ) ; <nl> - if ( new_messages . empty ( ) ) <nl> + size_t waited_for_assignment = 0 ; <nl> + while ( 1 ) <nl> { <nl> - LOG_TRACE ( log , " Stalled " ) ; <nl> - stalled = true ; <nl> - return false ; <nl> - } <nl> - messages = std : : move ( new_messages ) ; <nl> - current = messages . begin ( ) ; <nl> + / / / Don ' t drop old messages immediately , since we may need them for virtual columns . <nl> + auto new_messages = consumer - > poll_batch ( batch_size , std : : chrono : : milliseconds ( poll_timeout ) ) ; <nl> <nl> - LOG_TRACE ( log , " Polled batch of " < < messages . size ( ) < < " messages " ) ; <nl> + if ( rebalance_happened ) <nl> + { <nl> + if ( ! new_messages . empty ( ) ) <nl> + { <nl> + / / we have polled something just after rebalance . <nl> + / / we will not use current batch , so we need to return to last commited position <nl> + / / otherwise we will continue polling from that position <nl> + resetToLastCommitted ( " Rewind last poll after rebalance . " ) ; <nl> + } <nl> + <nl> + offsets_stored = 0 ; <nl> + return false ; <nl> + } <nl> + <nl> + if ( new_messages . empty ( ) ) <nl> + { <nl> + / / While we wait for an assignment after subscription , we ' ll poll zero messages anyway . <nl> + / / If we ' re doing a manual select then it ' s better to get something after a wait , then immediate nothing . <nl> + if ( assignment . empty ( ) ) <nl> + { <nl> + waited_for_assignment + = poll_timeout ; / / slightly innaccurate , but rough calculation is ok . <nl> + if ( waited_for_assignment < MAX_TIME_TO_WAIT_FOR_ASSIGNMENT_MS ) <nl> + { <nl> + continue ; <nl> + } <nl> + else <nl> + { <nl> + LOG_TRACE ( log , " Can ' t get assignment " ) ; <nl> + stalled = true ; <nl> + return false ; <nl> + } <nl> + <nl> + } <nl> + else <nl> + { <nl> + LOG_TRACE ( log , " Stalled " ) ; <nl> + stalled = true ; <nl> + return false ; <nl> + } <nl> + } <nl> + else <nl> + { <nl> + messages = std : : move ( new_messages ) ; <nl> + current = messages . begin ( ) ; <nl> + LOG_TRACE ( log , " Polled batch of " < < messages . size ( ) < < " messages . Offset position : " < < consumer - > get_offsets_position ( consumer - > get_assignment ( ) ) ) ; <nl> + break ; <nl> + } <nl> + } <nl> } <nl> <nl> if ( auto err = current - > get_error ( ) ) <nl> bool ReadBufferFromKafkaConsumer : : nextImpl ( ) <nl> BufferBase : : set ( new_position , current - > get_payload ( ) . get_size ( ) , 0 ) ; <nl> allowed = false ; <nl> <nl> - / / / Since we can poll more messages than we already processed - commit only processed messages . <nl> - consumer - > store_offset ( * current ) ; <nl> - <nl> + + current ; <nl> <nl> return true ; <nl> } <nl> <nl> + void ReadBufferFromKafkaConsumer : : storeLastReadMessageOffset ( ) <nl> + { <nl> + if ( ! stalled & & ! rebalance_happened ) <nl> + { <nl> + consumer - > store_offset ( * ( current - 1 ) ) ; <nl> + + + offsets_stored ; <nl> + } <nl> + } <nl> + <nl> } <nl> mmm a / dbms / src / Storages / Kafka / ReadBufferFromKafkaConsumer . h <nl> ppp b / dbms / src / Storages / Kafka / ReadBufferFromKafkaConsumer . h <nl> class ReadBufferFromKafkaConsumer : public ReadBuffer <nl> size_t max_batch_size , <nl> size_t poll_timeout_ , <nl> bool intermediate_commit_ , <nl> - const std : : atomic < bool > & stopped_ ) ; <nl> + const std : : atomic < bool > & stopped_ , <nl> + const Names & _topics <nl> + ) ; <nl> ~ ReadBufferFromKafkaConsumer ( ) override ; <nl> <nl> void allowNext ( ) { allowed = true ; } / / Allow to read next message . <nl> void commit ( ) ; / / Commit all processed messages . <nl> - void subscribe ( const Names & topics ) ; / / Subscribe internal consumer to topics . <nl> + void subscribe ( ) ; / / Subscribe internal consumer to topics . <nl> void unsubscribe ( ) ; / / Unsubscribe internal consumer in case of failure . <nl> <nl> auto pollTimeout ( ) const { return poll_timeout ; } <nl> <nl> + bool hasMorePolledMessages ( ) const ; <nl> + auto rebalanceHappened ( ) const { return rebalance_happened ; } <nl> + <nl> + void storeLastReadMessageOffset ( ) ; <nl> + void resetToLastCommitted ( const char * msg ) ; <nl> + <nl> / / Return values for the message that ' s being read . <nl> String currentTopic ( ) const { return current [ - 1 ] . get_topic ( ) ; } <nl> String currentKey ( ) const { return current [ - 1 ] . get_key ( ) ; } <nl> class ReadBufferFromKafkaConsumer : public ReadBuffer <nl> Poco : : Logger * log ; <nl> const size_t batch_size = 1 ; <nl> const size_t poll_timeout = 0 ; <nl> + size_t offsets_stored = 0 ; <nl> bool stalled = false ; <nl> bool intermediate_commit = true ; <nl> bool allowed = true ; <nl> class ReadBufferFromKafkaConsumer : public ReadBuffer <nl> Messages messages ; <nl> Messages : : const_iterator current ; <nl> <nl> + bool rebalance_happened = false ; <nl> + cppkafka : : TopicPartitionList assignment ; <nl> + const Names topics ; <nl> + <nl> bool nextImpl ( ) override ; <nl> } ; <nl> <nl> mmm a / dbms / src / Storages / Kafka / StorageKafka . cpp <nl> ppp b / dbms / src / Storages / Kafka / StorageKafka . cpp <nl> ConsumerBufferPtr StorageKafka : : createReadBuffer ( ) <nl> size_t poll_timeout = settings . stream_poll_timeout_ms . totalMilliseconds ( ) ; <nl> <nl> / / / NOTE : we pass | stream_cancelled | by reference here , so the buffers should not outlive the storage . <nl> - return std : : make_shared < ReadBufferFromKafkaConsumer > ( consumer , log , batch_size , poll_timeout , intermediate_commit , stream_cancelled ) ; <nl> + return std : : make_shared < ReadBufferFromKafkaConsumer > ( consumer , log , batch_size , poll_timeout , intermediate_commit , stream_cancelled , getTopics ( ) ) ; <nl> } <nl> <nl> <nl> mmm a / dbms / tests / integration / test_storage_kafka / configs / users . xml <nl> ppp b / dbms / tests / integration / test_storage_kafka / configs / users . xml <nl> <nl> < yandex > <nl> < profiles > <nl> < default > <nl> - < stream_poll_timeout_ms > 30000 < / stream_poll_timeout_ms > <nl> + < ! - - stream_poll_timeout_ms > 1 < / stream_poll_timeout_ms > <nl> + < stream_flush_interval_ms > 100 < / stream_flush_interval_ms - - > <nl> < / default > <nl> < / profiles > <nl> <nl> mmm a / dbms / tests / integration / test_storage_kafka / test . py <nl> ppp b / dbms / tests / integration / test_storage_kafka / test . py <nl> <nl> import subprocess <nl> import kafka . errors <nl> from kafka import KafkaAdminClient , KafkaProducer , KafkaConsumer <nl> + from kafka . admin import NewTopic <nl> from google . protobuf . internal . encoder import _VarintBytes <nl> <nl> " " " <nl> def kafka_produce ( topic , messages , timestamp = None ) : <nl> for message in messages : <nl> producer . send ( topic = topic , value = message , timestamp_ms = timestamp ) <nl> producer . flush ( ) <nl> - print ( " Produced { } messages for topic { } " . format ( len ( messages ) , topic ) ) <nl> + # print ( " Produced { } messages for topic { } " . format ( len ( messages ) , topic ) ) <nl> <nl> <nl> def kafka_consume ( topic ) : <nl> def kafka_setup_teardown ( ) : <nl> wait_kafka_is_available ( ) <nl> print ( " kafka is available - running test " ) <nl> yield # run test <nl> - instance . query ( ' DROP TABLE test . kafka ' ) <nl> + instance . query ( ' DROP TABLE IF EXISTS test . kafka ' ) <nl> <nl> <nl> # Tests <nl> def produce ( ) : <nl> assert result = = 1 , ' Messages from kafka get duplicated ! ' <nl> <nl> <nl> + @ pytest . mark . timeout ( 180 ) <nl> + def test_kafka_virtual_columns2 ( kafka_cluster ) : <nl> + <nl> + admin_client = KafkaAdminClient ( bootstrap_servers = " localhost : 9092 " ) <nl> + topic_list = [ ] <nl> + topic_list . append ( NewTopic ( name = " virt2_0 " , num_partitions = 2 , replication_factor = 1 ) ) <nl> + topic_list . append ( NewTopic ( name = " virt2_1 " , num_partitions = 2 , replication_factor = 1 ) ) <nl> + <nl> + admin_client . create_topics ( new_topics = topic_list , validate_only = False ) <nl> + <nl> + instance . query ( ' ' ' <nl> + CREATE TABLE test . kafka ( value UInt64 ) <nl> + ENGINE = Kafka <nl> + SETTINGS kafka_broker_list = ' kafka1 : 19092 ' , <nl> + kafka_topic_list = ' virt2_0 , virt2_1 ' , <nl> + kafka_group_name = ' virt2 ' , <nl> + kafka_format = ' JSONEachRow ' ; <nl> + <nl> + CREATE MATERIALIZED VIEW test . view Engine = Log AS <nl> + SELECT value , _key , _topic , _partition , _offset , toUnixTimestamp ( _timestamp ) FROM test . kafka ; <nl> + ' ' ' ) <nl> + <nl> + producer = KafkaProducer ( bootstrap_servers = " localhost : 9092 " ) <nl> + <nl> + producer . send ( topic = ' virt2_0 ' , value = json . dumps ( { ' value ' : 1 } ) , partition = 0 , key = ' k1 ' , timestamp_ms = 1577836801000 ) <nl> + producer . send ( topic = ' virt2_0 ' , value = json . dumps ( { ' value ' : 2 } ) , partition = 0 , key = ' k2 ' , timestamp_ms = 1577836802000 ) <nl> + producer . flush ( ) <nl> + time . sleep ( 1 ) <nl> + <nl> + producer . send ( topic = ' virt2_0 ' , value = json . dumps ( { ' value ' : 3 } ) , partition = 1 , key = ' k3 ' , timestamp_ms = 1577836803000 ) <nl> + producer . send ( topic = ' virt2_0 ' , value = json . dumps ( { ' value ' : 4 } ) , partition = 1 , key = ' k4 ' , timestamp_ms = 1577836804000 ) <nl> + producer . flush ( ) <nl> + time . sleep ( 1 ) <nl> + <nl> + producer . send ( topic = ' virt2_1 ' , value = json . dumps ( { ' value ' : 5 } ) , partition = 0 , key = ' k5 ' , timestamp_ms = 1577836805000 ) <nl> + producer . send ( topic = ' virt2_1 ' , value = json . dumps ( { ' value ' : 6 } ) , partition = 0 , key = ' k6 ' , timestamp_ms = 1577836806000 ) <nl> + producer . flush ( ) <nl> + time . sleep ( 1 ) <nl> + <nl> + producer . send ( topic = ' virt2_1 ' , value = json . dumps ( { ' value ' : 7 } ) , partition = 1 , key = ' k7 ' , timestamp_ms = 1577836807000 ) <nl> + producer . send ( topic = ' virt2_1 ' , value = json . dumps ( { ' value ' : 8 } ) , partition = 1 , key = ' k8 ' , timestamp_ms = 1577836808000 ) <nl> + producer . flush ( ) <nl> + <nl> + time . sleep ( 10 ) <nl> + <nl> + result = instance . query ( " SELECT * FROM test . view ORDER BY value " , ignore_error = True ) <nl> + <nl> + expected = ' ' ' \ <nl> + 1 k1 virt2_0 0 0 1577836801 <nl> + 2 k2 virt2_0 0 1 1577836802 <nl> + 3 k3 virt2_0 1 0 1577836803 <nl> + 4 k4 virt2_0 1 1 1577836804 <nl> + 5 k5 virt2_1 0 0 1577836805 <nl> + 6 k6 virt2_1 0 1 1577836806 <nl> + 7 k7 virt2_1 1 0 1577836807 <nl> + 8 k8 virt2_1 1 1 1577836808 <nl> + ' ' ' <nl> + <nl> + assert TSV ( result ) = = TSV ( expected ) <nl> + <nl> + <nl> + @ pytest . mark . timeout ( 600 ) <nl> + def test_kafka_flush_by_time ( kafka_cluster ) : <nl> + instance . query ( ' ' ' <nl> + DROP TABLE IF EXISTS test . view ; <nl> + DROP TABLE IF EXISTS test . consumer ; <nl> + <nl> + CREATE TABLE test . kafka ( key UInt64 , value UInt64 ) <nl> + ENGINE = Kafka <nl> + SETTINGS kafka_broker_list = ' kafka1 : 19092 ' , <nl> + kafka_topic_list = ' flush_by_time ' , <nl> + kafka_group_name = ' flush_by_time ' , <nl> + kafka_format = ' JSONEachRow ' , <nl> + kafka_max_block_size = 100 , <nl> + kafka_row_delimiter = ' \ \ n ' ; <nl> + <nl> + CREATE TABLE test . view ( key UInt64 , value UInt64 ) <nl> + ENGINE = MergeTree ( ) <nl> + ORDER BY key ; <nl> + <nl> + CREATE MATERIALIZED VIEW test . consumer TO test . view AS <nl> + SELECT * FROM test . kafka ; <nl> + ' ' ' ) <nl> + <nl> + cancel = threading . Event ( ) <nl> + <nl> + def produce ( ) : <nl> + while not cancel . is_set ( ) : <nl> + messages = [ ] <nl> + messages . append ( json . dumps ( { ' key ' : 0 , ' value ' : 0 } ) ) <nl> + kafka_produce ( ' flush_by_time ' , messages ) <nl> + time . sleep ( 1 ) <nl> + <nl> + kafka_thread = threading . Thread ( target = produce ) <nl> + kafka_thread . start ( ) <nl> + <nl> + time . sleep ( 18 ) <nl> + <nl> + result = instance . query ( ' SELECT count ( ) FROM test . view ' ) <nl> + <nl> + print ( result ) <nl> + cancel . set ( ) <nl> + kafka_thread . join ( ) <nl> + <nl> + # kafka_cluster . open_bash_shell ( ' instance ' ) <nl> + <nl> + instance . query ( ' ' ' <nl> + DROP TABLE test . consumer ; <nl> + DROP TABLE test . view ; <nl> + ' ' ' ) <nl> + <nl> + # 40 = 2 flushes ( 7 . 5 sec ) , 15 polls each , about 1 mgs per 1 . 5 sec <nl> + assert int ( result ) > 12 , ' Messages from kafka should be flushed at least every stream_flush_interval_ms ! ' <nl> + <nl> + <nl> + @ pytest . mark . timeout ( 600 ) <nl> + def test_kafka_flush_by_block_size ( kafka_cluster ) : <nl> + instance . query ( ' ' ' <nl> + DROP TABLE IF EXISTS test . view ; <nl> + DROP TABLE IF EXISTS test . consumer ; <nl> + <nl> + CREATE TABLE test . kafka ( key UInt64 , value UInt64 ) <nl> + ENGINE = Kafka <nl> + SETTINGS kafka_broker_list = ' kafka1 : 19092 ' , <nl> + kafka_topic_list = ' flush_by_block_size ' , <nl> + kafka_group_name = ' flush_by_block_size ' , <nl> + kafka_format = ' JSONEachRow ' , <nl> + kafka_max_block_size = 100 , <nl> + kafka_row_delimiter = ' \ \ n ' ; <nl> + <nl> + SELECT * FROM test . kafka ; <nl> + <nl> + CREATE TABLE test . view ( key UInt64 , value UInt64 ) <nl> + ENGINE = MergeTree ( ) <nl> + ORDER BY key ; <nl> + <nl> + CREATE MATERIALIZED VIEW test . consumer TO test . view AS <nl> + SELECT * FROM test . kafka ; <nl> + ' ' ' ) <nl> + <nl> + messages = [ ] <nl> + for _ in range ( 101 ) : <nl> + messages . append ( json . dumps ( { ' key ' : 0 , ' value ' : 0 } ) ) <nl> + kafka_produce ( ' flush_by_block_size ' , messages ) <nl> + <nl> + time . sleep ( 1 ) <nl> + <nl> + result = instance . query ( ' SELECT count ( ) FROM test . view ' ) <nl> + print ( result ) <nl> + <nl> + # kafka_cluster . open_bash_shell ( ' instance ' ) <nl> + <nl> + instance . query ( ' ' ' <nl> + DROP TABLE test . consumer ; <nl> + DROP TABLE test . view ; <nl> + ' ' ' ) <nl> + <nl> + # 100 = first poll should return 100 messages ( and rows ) <nl> + # not waiting for stream_flush_interval_ms <nl> + assert int ( result ) = = 100 , ' Messages from kafka should be flushed at least every stream_flush_interval_ms ! ' <nl> + <nl> + <nl> + @ pytest . mark . timeout ( 600 ) <nl> + def test_kafka_lot_of_partitions_partial_commit_of_bulk ( kafka_cluster ) : <nl> + admin_client = KafkaAdminClient ( bootstrap_servers = " localhost : 9092 " ) <nl> + <nl> + topic_list = [ ] <nl> + topic_list . append ( NewTopic ( name = " topic_with_multiple_partitions2 " , num_partitions = 10 , replication_factor = 1 ) ) <nl> + admin_client . create_topics ( new_topics = topic_list , validate_only = False ) <nl> + <nl> + instance . query ( ' ' ' <nl> + DROP TABLE IF EXISTS test . view ; <nl> + DROP TABLE IF EXISTS test . consumer ; <nl> + CREATE TABLE test . kafka ( key UInt64 , value UInt64 ) <nl> + ENGINE = Kafka <nl> + SETTINGS kafka_broker_list = ' kafka1 : 19092 ' , <nl> + kafka_topic_list = ' topic_with_multiple_partitions2 ' , <nl> + kafka_group_name = ' topic_with_multiple_partitions2 ' , <nl> + kafka_format = ' JSONEachRow ' , <nl> + kafka_max_block_size = 211 ; <nl> + CREATE TABLE test . view ( key UInt64 , value UInt64 ) <nl> + ENGINE = MergeTree ( ) <nl> + ORDER BY key ; <nl> + CREATE MATERIALIZED VIEW test . consumer TO test . view AS <nl> + SELECT * FROM test . kafka ; <nl> + ' ' ' ) <nl> + <nl> + messages = [ ] <nl> + count = 0 <nl> + for dummy_msg in range ( 1000 ) : <nl> + rows = [ ] <nl> + for dummy_row in range ( random . randrange ( 3 , 10 ) ) : <nl> + count = count + 1 <nl> + rows . append ( json . dumps ( { ' key ' : count , ' value ' : count } ) ) <nl> + messages . append ( " \ n " . join ( rows ) ) <nl> + kafka_produce ( ' topic_with_multiple_partitions2 ' , messages ) <nl> + <nl> + time . sleep ( 30 ) <nl> + <nl> + result = instance . query ( ' SELECT count ( ) , uniqExact ( key ) , max ( key ) FROM test . view ' ) <nl> + print ( result ) <nl> + assert TSV ( result ) = = TSV ( ' { 0 } \ t { 0 } \ t { 0 } ' . format ( count ) ) <nl> + <nl> + instance . query ( ' ' ' <nl> + DROP TABLE test . consumer ; <nl> + DROP TABLE test . view ; <nl> + ' ' ' ) <nl> + <nl> + @ pytest . mark . timeout ( 1200 ) <nl> + def test_kafka_rebalance ( kafka_cluster ) : <nl> + <nl> + NUMBER_OF_CONSURRENT_CONSUMERS = 11 <nl> + <nl> + instance . query ( ' ' ' <nl> + DROP TABLE IF EXISTS test . destination ; <nl> + CREATE TABLE test . destination ( <nl> + key UInt64 , <nl> + value UInt64 , <nl> + _topic String , <nl> + _key String , <nl> + _offset UInt64 , <nl> + _partition UInt64 , <nl> + _timestamp Nullable ( DateTime ) , <nl> + _consumed_by LowCardinality ( String ) <nl> + ) <nl> + ENGINE = MergeTree ( ) <nl> + ORDER BY key ; <nl> + ' ' ' ) <nl> + <nl> + # kafka_cluster . open_bash_shell ( ' instance ' ) <nl> + <nl> + # time . sleep ( 2 ) <nl> + <nl> + admin_client = KafkaAdminClient ( bootstrap_servers = " localhost : 9092 " ) <nl> + topic_list = [ ] <nl> + topic_list . append ( NewTopic ( name = " topic_with_multiple_partitions " , num_partitions = 11 , replication_factor = 1 ) ) <nl> + admin_client . create_topics ( new_topics = topic_list , validate_only = False ) <nl> + <nl> + cancel = threading . Event ( ) <nl> + <nl> + msg_index = [ 0 ] <nl> + def produce ( ) : <nl> + while not cancel . is_set ( ) : <nl> + messages = [ ] <nl> + for _ in range ( 59 ) : <nl> + messages . append ( json . dumps ( { ' key ' : msg_index [ 0 ] , ' value ' : msg_index [ 0 ] } ) ) <nl> + msg_index [ 0 ] + = 1 <nl> + kafka_produce ( ' topic_with_multiple_partitions ' , messages ) <nl> + <nl> + kafka_thread = threading . Thread ( target = produce ) <nl> + kafka_thread . start ( ) <nl> + <nl> + for consumer_index in range ( NUMBER_OF_CONSURRENT_CONSUMERS ) : <nl> + table_name = ' kafka_consumer { } ' . format ( consumer_index ) <nl> + print ( " Setting up { } " . format ( table_name ) ) <nl> + <nl> + instance . query ( ' ' ' <nl> + DROP TABLE IF EXISTS test . { 0 } ; <nl> + DROP TABLE IF EXISTS test . { 0 } _mv ; <nl> + CREATE TABLE test . { 0 } ( key UInt64 , value UInt64 ) <nl> + ENGINE = Kafka <nl> + SETTINGS kafka_broker_list = ' kafka1 : 19092 ' , <nl> + kafka_topic_list = ' topic_with_multiple_partitions ' , <nl> + kafka_group_name = ' rebalance_test_group ' , <nl> + kafka_format = ' JSONEachRow ' , <nl> + kafka_max_block_size = 33 ; <nl> + CREATE MATERIALIZED VIEW test . { 0 } _mv TO test . destination AS <nl> + SELECT <nl> + key , <nl> + value , <nl> + _topic , <nl> + _key , <nl> + _offset , <nl> + _partition , <nl> + _timestamp , <nl> + ' { 0 } ' as _consumed_by <nl> + FROM test . { 0 } ; <nl> + ' ' ' . format ( table_name ) ) <nl> + # kafka_cluster . open_bash_shell ( ' instance ' ) <nl> + while int ( instance . query ( " SELECT count ( ) FROM test . destination WHERE _consumed_by = ' { } ' " . format ( table_name ) ) ) = = 0 : <nl> + print ( " Waiting for test . kafka_consumer { } to start consume " . format ( consumer_index ) ) <nl> + time . sleep ( 1 ) <nl> + <nl> + cancel . set ( ) <nl> + <nl> + # I leave last one working by intent ( to finish consuming after all rebalances ) <nl> + for consumer_index in range ( NUMBER_OF_CONSURRENT_CONSUMERS - 1 ) : <nl> + print ( " Dropping test . kafka_consumer { } " . format ( consumer_index ) ) <nl> + instance . query ( ' DROP TABLE IF EXISTS test . kafka_consumer { } ' . format ( consumer_index ) ) <nl> + while int ( instance . query ( " SELECT count ( ) FROM system . tables WHERE database = ' test ' AND name = ' kafka_consumer { } ' " . format ( consumer_index ) ) ) = = 1 : <nl> + time . sleep ( 1 ) <nl> + <nl> + # print ( instance . query ( ' SELECT count ( ) , uniqExact ( key ) , max ( key ) + 1 FROM test . destination ' ) ) <nl> + # kafka_cluster . open_bash_shell ( ' instance ' ) <nl> + <nl> + while 1 : <nl> + messages_consumed = int ( instance . query ( ' SELECT uniqExact ( key ) FROM test . destination ' ) ) <nl> + if messages_consumed > = msg_index [ 0 ] : <nl> + break <nl> + time . sleep ( 1 ) <nl> + print ( " Waiting for finishing consuming ( have { } , should be { } ) " . format ( messages_consumed , msg_index [ 0 ] ) ) <nl> + <nl> + print ( instance . query ( ' SELECT count ( ) , uniqExact ( key ) , max ( key ) + 1 FROM test . destination ' ) ) <nl> + <nl> + # SELECT * FROM test . destination where key in ( SELECT key FROM test . destination group by key having count ( ) < > 1 ) <nl> + # select number + 1 as key from numbers ( 4141 ) left join test . destination using ( key ) where test . destination . key = 0 ; <nl> + # SELECT * FROM test . destination WHERE key between 2360 and 2370 order by key ; <nl> + # select _partition from test . destination group by _partition having count ( ) < > max ( _offset ) + 1 ; <nl> + # select toUInt64 ( 0 ) as _partition , number + 1 as _offset from numbers ( 400 ) left join test . destination using ( _partition , _offset ) where test . destination . key = 0 order by _offset ; <nl> + # SELECT * FROM test . destination WHERE _partition = 0 and _offset between 220 and 240 order by _offset ; <nl> + <nl> + result = int ( instance . query ( ' SELECT count ( ) = = uniqExact ( key ) FROM test . destination ' ) ) <nl> + <nl> + for consumer_index in range ( NUMBER_OF_CONSURRENT_CONSUMERS ) : <nl> + print ( " kafka_consumer { } " . format ( consumer_index ) ) <nl> + table_name = ' kafka_consumer { } ' . format ( consumer_index ) <nl> + instance . query ( ' ' ' <nl> + DROP TABLE IF EXISTS test . { 0 } ; <nl> + DROP TABLE IF EXISTS test . { 0 } _mv ; <nl> + ' ' ' . format ( table_name ) ) <nl> + <nl> + instance . query ( ' ' ' <nl> + DROP TABLE IF EXISTS test . destination ; <nl> + ' ' ' ) <nl> + <nl> + kafka_thread . join ( ) <nl> + <nl> + assert result = = 1 , ' Messages from kafka get duplicated ! ' <nl> + <nl> + <nl> + <nl> if __name__ = = ' __main__ ' : <nl> cluster . start ( ) <nl> raw_input ( " Cluster created , press any key to destroy . . . " ) <nl>
|
Merge pull request from filimonov / kafka_fixes_part2
|
ClickHouse/ClickHouse
|
5d3c62cd52994984ffcb0c7f247de0c4ef921fe2
|
2020-01-31T00:55:46Z
|
mmm a / Code / CryEngine / Cry3DEngine / 3dEngineLoad . cpp <nl> ppp b / Code / CryEngine / Cry3DEngine / 3dEngineLoad . cpp <nl> I3DEngine : : ELevelLoadStatus C3DEngineLevelLoadTimeslicer : : DoStep ( ) <nl> / / preload level cgfs <nl> if ( ShouldPreloadLevelObjects ( ) ) <nl> { <nl> - if ( m_owner . GetCVars ( ) - > e_StatObjPreload = = 2 ) <nl> - m_owner . GetSystem ( ) - > OutputLoadingTimeStats ( ) ; <nl> - <nl> m_owner . m_pObjManager - > StartPreloadLevelObjects ( ) ; <nl> } <nl> } <nl> I3DEngine : : ELevelLoadStatus C3DEngineLevelLoadTimeslicer : : DoStep ( ) <nl> / / do nothing and continue with next step <nl> break ; <nl> } <nl> - <nl> - if ( m_owner . GetCVars ( ) - > e_StatObjPreload = = 2 ) <nl> - { <nl> - m_owner . GetSystem ( ) - > OutputLoadingTimeStats ( ) ; <nl> - } <nl> } <nl> } <nl> <nl> I3DEngine : : ELevelLoadStatus C3DEngineLevelLoadTimeslicer : : DoStep ( ) <nl> / / preload level cgfs <nl> if ( m_owner . GetCVars ( ) - > e_StatObjPreload & & ! gEnv - > IsEditor ( ) ) <nl> { <nl> - if ( m_owner . GetCVars ( ) - > e_StatObjPreload = = 2 ) <nl> - m_owner . GetSystem ( ) - > OutputLoadingTimeStats ( ) ; <nl> - <nl> m_owner . m_pObjManager - > PreloadLevelObjects ( ) ; <nl> - <nl> - if ( m_owner . GetCVars ( ) - > e_StatObjPreload = = 2 ) <nl> - { <nl> - m_owner . GetSystem ( ) - > OutputLoadingTimeStats ( ) ; <nl> - } <nl> } <nl> } <nl> <nl> mmm a / Code / CryEngine / Cry3DEngine / Material . cpp <nl> ppp b / Code / CryEngine / Cry3DEngine / Material . cpp <nl> CMatInfo : : CMatInfo ( ) <nl> <nl> ZeroStruct ( m_streamZoneInfo ) ; <nl> <nl> - # ifdef TRACE_MATERIAL_LEAKS <nl> - m_sLoadingCallstack = GetSystem ( ) - > GetLoadingProfilerCallstack ( ) ; <nl> - # endif <nl> - <nl> # if defined ( ENABLE_CONSOLE_MTL_VIZ ) <nl> m_pConsoleMtl = 0 ; <nl> # endif <nl> mmm a / Code / CryEngine / Cry3DEngine / Material . h <nl> ppp b / Code / CryEngine / Cry3DEngine / Material . h <nl> <nl> # include < Cry3DEngine / IMaterial . h > <nl> <nl> # if CRY_PLATFORM_DESKTOP <nl> - # define TRACE_MATERIAL_LEAKS <nl> # define SUPPORT_MATERIAL_EDITING <nl> # endif <nl> <nl> class CMatInfo : public IMaterial , public stl : : intrusive_linked_list_node < CMatIn <nl> # endif <nl> <nl> virtual CryCriticalSection & GetSubMaterialResizeLock ( ) ; <nl> - public : <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / for debug purposes <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - # ifdef TRACE_MATERIAL_LEAKS <nl> - string m_sLoadingCallstack ; <nl> - # endif <nl> <nl> private : <nl> <nl> mmm a / Code / CryEngine / Cry3DEngine / StatObj . h <nl> ppp b / Code / CryEngine / Cry3DEngine / StatObj . h <nl> <nl> / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> # pragma once <nl> <nl> - # if CRY_PLATFORM_DESKTOP <nl> - # define TRACE_CGF_LEAKS <nl> - # endif <nl> - <nl> class CIndexedMesh ; <nl> class CRenderObject ; <nl> class CContentCGF ; <nl> struct CRY_ALIGN ( 8 ) CStatObj : public IStatObj , public IStreamCallback , public st <nl> struct SMeshBoneMapping_uint8 * m_pBoneMapping ; <nl> std : : vector < uint16 > m_chunkBoneIds ; <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / for debug purposes <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - # ifdef TRACE_CGF_LEAKS <nl> - string m_sLoadingCallstack ; <nl> - # endif <nl> - <nl> + <nl> private : <nl> <nl> / / Returns a list of all CStatObj instances contained within this object ( all sub - objects plus the parent object itself ) . <nl> mmm a / Code / CryEngine / Cry3DEngine / StatObjConstr . cpp <nl> ppp b / Code / CryEngine / Cry3DEngine / StatObjConstr . cpp <nl> CStatObj : : CStatObj ( ) <nl> m_fLodDistance = 0 . 0f ; <nl> <nl> Init ( ) ; <nl> - <nl> - # ifdef TRACE_CGF_LEAKS <nl> - m_sLoadingCallstack = GetSystem ( ) - > GetLoadingProfilerCallstack ( ) ; <nl> - # endif <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / MNM / IslandConnections . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / MNM / IslandConnections . cpp <nl> void IslandConnections : : SetTwoWayConnectionBetweenIslands ( const MNM : : GlobalIslan <nl> / / Connection between two islands consists always of two links for having possibility of reversed search . <nl> <nl> SIslandNode & islandNode1 = m_islandConnections [ islandId1 ] ; <nl> - islandNode1 . annotation = islandAnnotation1 ; <nl> - ModifyConnectionToIsland ( islandNode1 , islandId2 . GetStaticIslandID ( ) , islandAnnotation2 , OffMeshLinkID ( ) , connectionsChange , connectionsChange ) ; <nl> - if ( islandNode1 . links . empty ( ) ) <nl> - { <nl> - / / if connectionsChange was negative , link could be removed in SetConnectionToIsland <nl> - m_islandConnections . erase ( islandId1 ) ; <nl> - } <nl> - <nl> SIslandNode & islandNode2 = m_islandConnections [ islandId2 ] ; <nl> + islandNode1 . annotation = islandAnnotation1 ; <nl> islandNode2 . annotation = islandAnnotation2 ; <nl> - ModifyConnectionToIsland ( islandNode2 , islandId1 . GetStaticIslandID ( ) , islandAnnotation1 , OffMeshLinkID ( ) , connectionsChange , connectionsChange ) ; <nl> - if ( islandNode2 . links . empty ( ) ) <nl> + <nl> + if ( connectionsChange ! = 0 ) <nl> { <nl> - / / if connectionsChange was negative , link could be removed in SetConnectionToIsland <nl> - m_islandConnections . erase ( islandId2 ) ; <nl> + ModifyConnectionToIsland ( islandNode1 , islandId2 . GetStaticIslandID ( ) , islandAnnotation2 , OffMeshLinkID ( ) , connectionsChange , connectionsChange ) ; <nl> + if ( islandNode1 . links . empty ( ) ) <nl> + { <nl> + / / if connectionsChange was negative , link could be removed in SetConnectionToIsland <nl> + m_islandConnections . erase ( islandId1 ) ; <nl> + } <nl> + <nl> + ModifyConnectionToIsland ( islandNode2 , islandId1 . GetStaticIslandID ( ) , islandAnnotation1 , OffMeshLinkID ( ) , connectionsChange , connectionsChange ) ; <nl> + if ( islandNode2 . links . empty ( ) ) <nl> + { <nl> + / / if connectionsChange was negative , link could be removed in SetConnectionToIsland <nl> + m_islandConnections . erase ( islandId2 ) ; <nl> + } <nl> } <nl> } <nl> <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / MNM / Islands . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / MNM / Islands . cpp <nl> inline bool IsIslandVisited ( StaticIslandID id ) <nl> CIslands : : CIslands ( ) <nl> { <nl> m_islands . reserve ( 32 ) ; <nl> - m_islandsFreeIndices . reserve ( 4 ) ; <nl> } <nl> <nl> void CIslands : : ComputeStaticIslandsAndConnections ( CNavMesh & navMesh , const NavigationMeshID meshID , const OffMeshNavigationManager & offMeshNavigationManager , MNM : : IslandConnections & islandConnections ) <nl> void CIslands : : UpdateIslandsForTriangles ( CNavMesh & navMesh , const NavigationMesh <nl> } ) ; <nl> } <nl> <nl> + / / Apply pending connection requests before any new islands are created . <nl> + / / Since island id can be reused , it could cause troubles updating links between the islands , if they were resolved only in the end . <nl> + ResolvePendingConnectionRequests ( navMesh , connectionRequests , meshID , nullptr , islandConnections ) ; <nl> + connectionRequests . Reset ( ) ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Splitting islands <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CIslands : : SIsland & CIslands : : GetNewIsland ( const AreaAnnotation annotation ) <nl> <nl> if ( m_islandsFreeIndices . size ( ) ) <nl> { <nl> - const size_t freeIdx = m_islandsFreeIndices . back ( ) ; <nl> - m_islandsFreeIndices . pop_back ( ) ; <nl> + const size_t freeIdx = m_islandsFreeIndices . front ( ) ; <nl> + m_islandsFreeIndices . pop_front ( ) ; <nl> <nl> CRY_ASSERT ( freeIdx < m_islands . size ( ) ) ; <nl> CRY_ASSERT ( m_islands [ freeIdx ] . trianglesCount = = 0 ) ; <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / MNM / Islands . h <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / MNM / Islands . h <nl> class CIslands <nl> uint16 offMeshLinkIndex ; <nl> } ; <nl> <nl> + void Reset ( ) <nl> + { <nl> + offmeshConnections . clear ( ) ; <nl> + areaConnection . clear ( ) ; <nl> + } <nl> + <nl> void AddAreaConnection ( const StaticIslandID firstIslandId , const StaticIslandID secondIslandId ) ; <nl> void RemoveAreaConnection ( const StaticIslandID firstIslandId , const StaticIslandID secondIslandId ) ; <nl> <nl> class CIslands <nl> } <nl> <nl> std : : vector < SIsland > m_islands ; <nl> - std : : vector < size_t > m_islandsFreeIndices ; <nl> + std : : deque < size_t > m_islandsFreeIndices ; <nl> } ; <nl> <nl> } / / MNM <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / MNM / NavMesh . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / MNM / NavMesh . cpp <nl> const AreaAnnotation * CNavMesh : : GetTriangleAnnotation ( TriangleID triangleID ) con <nl> return nullptr ; <nl> } <nl> <nl> - void CNavMesh : : SetTrianglesAnnotation ( const TriangleID * pTrianglesArray , const size_t trianglesCount , const MNM : : AreaAnnotation areaAnnotation , std : : vector < TileID > & affectedTiles ) <nl> + void CNavMesh : : SetTrianglesAnnotation ( const TriangleID * pTrianglesArray , const size_t trianglesCount , const MNM : : AreaAnnotation areaAnnotation , std : : vector < TriangleID > & changedTriangles ) <nl> { <nl> for ( size_t i = 0 ; i < trianglesCount ; + + i ) <nl> { <nl> void CNavMesh : : SetTrianglesAnnotation ( const TriangleID * pTrianglesArray , const s <nl> <nl> triangle . areaAnnotation = areaAnnotation ; <nl> <nl> - stl : : push_back_unique ( affectedTiles , MNM : : ComputeTileID ( triangleId ) ) ; <nl> + changedTriangles . push_back ( triangleId ) ; <nl> } <nl> } <nl> } <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / MNM / NavMesh . h <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / MNM / NavMesh . h <nl> class CNavMesh : public MNM : : INavMesh <nl> TileID GetNeighbourTileID ( size_t x , size_t y , size_t z , size_t side ) const ; <nl> TileID GetNeighbourTileID ( const TileID tileId , size_t side ) const ; <nl> <nl> - void SetTrianglesAnnotation ( const MNM : : TriangleID * pTrianglesArray , const size_t trianglesCount , const MNM : : AreaAnnotation areaAnnotation , std : : vector < TileID > & affectedTiles ) ; <nl> + void SetTrianglesAnnotation ( const MNM : : TriangleID * pTrianglesArray , const size_t trianglesCount , const MNM : : AreaAnnotation areaAnnotation , std : : vector < MNM : : TriangleID > & changedTriangles ) ; <nl> bool SnapPosition ( const vector3_t & localPosition , const SOrderedSnappingMetrics & snappingMetrics , const INavMeshQueryFilter * pFilter , vector3_t * pSnappedLocalPosition , MNM : : TriangleID * pTriangleId ) const ; <nl> bool SnapPosition ( const vector3_t & localPosition , const MNM : : SSnappingMetric & snappingMetric , const INavMeshQueryFilter * pFilter , vector3_t * pSnappedLocalPosition , MNM : : TriangleID * pTriangleId ) const ; <nl> <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / NavigationSystem / NavigationSystem . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / NavigationSystem / NavigationSystem . cpp <nl> void NavigationSystem : : SetAnnotationForMarkupTriangles ( NavigationVolumeID markup <nl> <nl> void NavigationSystem : : ApplyAnnotationChanges ( ) <nl> { <nl> + if ( m_markupAnnotationChangesToApply . empty ( ) ) <nl> + return ; <nl> + <nl> / / We are assuming here that every triangle can be owned by at most one markup volume . <nl> / / Otherwise we would need to use something else then std : : vector to store changed triangles . <nl> std : : unordered_map < NavigationMeshID , std : : vector < MNM : : TriangleID > > changedTrianglesPerNavmeshMap ; <nl> + std : : vector < MNM : : TriangleID > changedTriangles ; <nl> <nl> for ( const auto & markupAnnotationChange : m_markupAnnotationChangesToApply ) <nl> { <nl> void NavigationSystem : : ApplyAnnotationChanges ( ) <nl> " ApplyAnnotationChanges : Mesh with id % u wasn ' t found for annotation data id % u . Is the NavMesh really up to date ? " , meshTriangles . meshId , markupAnnotationChange . first ) ; <nl> continue ; <nl> } <nl> - <nl> - std : : vector < MNM : : TileID > affectedTiles ; <nl> - NavigationMesh & mesh = m_meshes [ meshTriangles . meshId ] ; <nl> - mesh . navMesh . SetTrianglesAnnotation ( meshTriangles . triangleIds . data ( ) , meshTriangles . triangleIds . size ( ) , areaAnnotation , affectedTiles ) ; <nl> <nl> - auto & changedTriangles = changedTrianglesPerNavmeshMap [ meshTriangles . meshId ] ; <nl> - changedTriangles . insert ( changedTriangles . end ( ) , meshTriangles . triangleIds . begin ( ) , meshTriangles . triangleIds . end ( ) ) ; <nl> + changedTriangles . clear ( ) ; <nl> + NavigationMesh & mesh = m_meshes [ meshTriangles . meshId ] ; <nl> + mesh . navMesh . SetTrianglesAnnotation ( meshTriangles . triangleIds . data ( ) , meshTriangles . triangleIds . size ( ) , areaAnnotation , changedTriangles ) ; <nl> <nl> - AgentType & agentType = m_agentTypes [ mesh . agentTypeID - 1 ] ; <nl> - for ( MNM : : TileID tileId : affectedTiles ) <nl> - { <nl> - agentType . annotationCallbacks . CallSafe ( mesh . agentTypeID , meshTriangles . meshId , tileId ) ; <nl> - } <nl> + auto & changedTrianglesInMesh = changedTrianglesPerNavmeshMap [ meshTriangles . meshId ] ; <nl> + changedTrianglesInMesh . insert ( changedTrianglesInMesh . end ( ) , changedTriangles . begin ( ) , changedTriangles . end ( ) ) ; <nl> } <nl> } <nl> m_markupAnnotationChangesToApply . clear ( ) ; <nl> void NavigationSystem : : ApplyAnnotationChanges ( ) <nl> MNM : : IslandConnections & islandConnections = m_islandConnectionsManager . GetIslandConnections ( ) ; <nl> for ( auto it = changedTrianglesPerNavmeshMap . begin ( ) ; it ! = changedTrianglesPerNavmeshMap . end ( ) ; + + it ) <nl> { <nl> + const NavigationMeshID meshId = it - > first ; <nl> const auto & changedTriangles = it - > second ; <nl> - NavigationMesh & mesh = m_meshes [ it - > first ] ; <nl> + NavigationMesh & mesh = m_meshes [ meshId ] ; <nl> <nl> mesh . navMesh . GetIslands ( ) . UpdateIslandsForTriangles ( mesh . navMesh , NavigationMeshID ( it - > first ) , changedTriangles . data ( ) , changedTriangles . size ( ) , islandConnections ) ; <nl> + <nl> + std : : vector < MNM : : TileID > affectedTiles ; <nl> + for ( const MNM : : TriangleID triangleId : changedTriangles ) <nl> + { <nl> + stl : : push_back_unique ( affectedTiles , MNM : : ComputeTileID ( triangleId ) ) ; <nl> + } <nl> + <nl> + AgentType & agentType = m_agentTypes [ mesh . agentTypeID - 1 ] ; <nl> + for ( const MNM : : TileID tileId : affectedTiles ) <nl> + { <nl> + agentType . annotationCallbacks . CallSafe ( mesh . agentTypeID , meshId , tileId ) ; <nl> + } <nl> } <nl> } <nl> <nl> mmm a / Code / CryEngine / CryCommon / CryPhysics / physinterface . h <nl> ppp b / Code / CryEngine / CryCommon / CryPhysics / physinterface . h <nl> struct IGeometry <nl> virtual void SetData ( const primitives : : primitive * ) = 0 ; / / ! < not supported by meshes <nl> virtual float GetVolume ( ) = 0 ; <nl> virtual Vec3 GetCenter ( ) = 0 ; <nl> + virtual IGeometry * GetTriMesh ( int bClone = 1 ) = 0 ; / / ! < returns mesh representation of the geometry ( currently only supported by boxes and meshes ) <nl> / / ! Subtract : performs boolean subtraction ; if bLogUpdates = = 1 , will create bop_meshupdate inside the mesh <nl> virtual int Subtract ( IGeometry * pGeom , geom_world_data * pdata1 , geom_world_data * pdata2 , int bLogUpdates = 1 ) = 0 ; <nl> virtual int GetSubtractionsCount ( ) = 0 ; / / ! < number of Subtract ( ) s the mesh has survived so far <nl> mmm a / Code / CryEngine / CryCommon / CrySystem / ISystem . h <nl> ppp b / Code / CryEngine / CryCommon / CrySystem / ISystem . h <nl> class IOpticsManager ; <nl> class IXMLBinarySerializer ; <nl> class XmlNodeRef ; <nl> <nl> - struct CLoadingTimeProfiler ; <nl> struct CryGUID ; <nl> struct FrameProfiler ; <nl> struct I3DEngine ; <nl> struct ISystem <nl> virtual void SetFrameProfiler ( bool on , bool display , char * prefix ) = 0 ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Loading time / memory profiling <nl> - / / ! Starts function loading stats profiling . <nl> - virtual struct SLoadingTimeContainer * StartLoadingSectionProfiling ( CLoadingTimeProfiler * pProfiler , const char * szFuncName ) = 0 ; <nl> - <nl> - / / ! Ends function loading stats profiling . <nl> - virtual void EndLoadingSectionProfiling ( CLoadingTimeProfiler * pProfiler ) = 0 ; <nl> - <nl> + / / Loading time profiling <nl> / / ! Starts function profiling with bootprofiler ( session must be started ) . <nl> virtual CBootProfilerRecord * StartBootSectionProfiler ( const char * name , const char * args , EProfileDescription type ) = 0 ; <nl> <nl> struct ISystem <nl> / / ! game dll should call this on frame end <nl> virtual void OnFrameEnd ( ) = 0 ; <nl> <nl> - / / ! Prints loading stats into log . <nl> - virtual void OutputLoadingTimeStats ( ) = 0 ; <nl> - <nl> - / / ! Starts function loading stats profiling . <nl> - virtual const char * GetLoadingProfilerCallstack ( ) = 0 ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / File version . <nl> / / ! Gets file version . <nl> mmm a / Code / CryEngine / CryCommon / CrySystem / Profilers / FrameProfiler / FrameProfiler . h <nl> ppp b / Code / CryEngine / CryCommon / CrySystem / Profilers / FrameProfiler / FrameProfiler . h <nl> struct DiskOperationInfo <nl> <nl> } ; <nl> <nl> - struct CLoadingTimeProfiler <nl> - { <nl> - CLoadingTimeProfiler ( ISystem * pSystem , const char * szFuncName ) : m_pSystem ( pSystem ) <nl> - { <nl> - m_pSystem = pSystem ; <nl> - m_pTimeContainer = m_pSystem - > StartLoadingSectionProfiling ( this , szFuncName ) ; <nl> - } <nl> - <nl> - ~ CLoadingTimeProfiler ( ) <nl> - { <nl> - m_pSystem - > EndLoadingSectionProfiling ( this ) ; <nl> - } <nl> - <nl> - struct SLoadingTimeContainer * m_pTimeContainer ; <nl> - double m_fConstructorTime ; <nl> - double m_fConstructorMemUsage ; <nl> - <nl> - DiskOperationInfo m_constructorInfo ; <nl> - <nl> - ISystem * m_pSystem ; <nl> - } ; <nl> - <nl> class CSYSBootProfileBlock <nl> { <nl> ISystem * m_pSystem ; <nl> mmm a / Code / CryEngine / CryEntitySystem / PhysicsProxy . cpp <nl> ppp b / Code / CryEngine / CryEntitySystem / PhysicsProxy . cpp <nl> int CEntityPhysics : : AddSlotGeometry ( int nSlot , SEntityPhysicalizeParams & params , <nl> / / if ( pSlot - > HaveLocalMatrix ( ) ) <nl> { <nl> mtx = GetEntity ( ) - > GetSlotLocalTM ( nSlot | ENTITY_SLOT_ACTUAL & - bNoSubslots , false ) ; <nl> - mtx . SetTranslation ( Diag33 ( scale ) * mtx . GetTranslation ( ) ) ; <nl> + if ( max ( max ( fabs_tpl ( scale . x - 1 . 0f ) , fabs_tpl ( scale . y - 1 . 0f ) ) , fabs_tpl ( scale . z - 1 . 0f ) ) > 0 . 0001f ) <nl> + mtx = Matrix34 : : CreateScale ( scale ) * mtx ; <nl> + else <nl> + mtx . SetTranslation ( Diag33 ( scale ) * mtx . GetTranslation ( ) ) ; <nl> / / scale * = mtx . GetColumn ( 0 ) . len ( ) ; <nl> } <nl> partpos . pMtx3x4 = & mtx ; <nl> int CEntityPhysics : : AddSlotGeometry ( int nSlot , SEntityPhysicalizeParams & params , <nl> pAdamProxy = this ; <nl> if ( pAdamProxy ! = this ) <nl> mtx = GetEntity ( ) - > GetLocalTM ( ) * mtx ; <nl> - else if ( max ( max ( fabs_tpl ( scale . x - 1 . 0f ) , fabs_tpl ( scale . y - 1 . 0f ) ) , fabs_tpl ( scale . z - 1 . 0f ) ) > 0 . 0001f ) <nl> - mtx = mtx * Matrix33 : : CreateScale ( scale ) ; <nl> <nl> partpos . flags = geom_collides | geom_floats ; <nl> partpos . flags & = params . nFlagsAND ; <nl> mmm a / Code / CryEngine / CryPhysics / physicalentity . cpp <nl> ppp b / Code / CryEngine / CryPhysics / physicalentity . cpp <nl> int CPhysicalEntity : : SetParams ( pe_params * _params , int bThreadSafe ) <nl> } <nl> } <nl> <nl> - Vec3 scale ; <nl> - if ( ( scale = get_xqs_from_matrices ( params - > pMtx3x4 , params - > pMtx3x3 , params - > pos , params - > q , params - > scale ) ) . len2 ( ) > 3 . 03f ) { <nl> + Vec3 scale ; Matrix33 skewMtx ; <nl> + if ( ( scale = get_xqs_from_matrices ( params - > pMtx3x4 , params - > pMtx3x3 , params - > pos , params - > q , params - > scale , 0 , 0 , & skewMtx ) ) . len2 ( ) > 3 . 03f ) { <nl> WriteLock lock ( m_lockUpdate ) ; <nl> for ( i = 0 ; i < m_nParts ; i + + ) { <nl> phys_geometry * pgeom ; <nl> + Matrix33 skewMtxPart = Matrix33 ( ! m_parts [ i ] . q ) * skewMtx * Matrix33 ( m_parts [ i ] . q ) ; <nl> if ( m_parts [ i ] . pPhysGeom ! = m_parts [ i ] . pPhysGeomProxy ) { <nl> if ( ! ( pgeom = ( phys_geometry * ) m_parts [ i ] . pPhysGeomProxy - > pGeom - > GetForeignData ( DATA_UNSCALED_GEOM ) ) ) <nl> pgeom = m_parts [ i ] . pPhysGeomProxy ; <nl> - if ( BakeScaleIntoGeometry ( pgeom , m_pWorld - > GetGeomManager ( ) , scale ) ) { <nl> + if ( BakeScaleIntoGeometry ( pgeom , m_pWorld - > GetGeomManager ( ) , scale , 0 , & skewMtxPart ) ) { <nl> m_pWorld - > GetGeomManager ( ) - > UnregisterGeometry ( m_parts [ i ] . pPhysGeomProxy ) ; <nl> ( m_parts [ i ] . pPhysGeomProxy = pgeom ) - > nRefCount + + ; <nl> } <nl> int CPhysicalEntity : : SetParams ( pe_params * _params , int bThreadSafe ) <nl> bool doBake = true ; <nl> if ( ! ( pgeom = ( phys_geometry * ) m_parts [ i ] . pPhysGeom - > pGeom - > GetForeignData ( DATA_UNSCALED_GEOM ) ) ) <nl> doBake = ( pgeom = m_parts [ i ] . pPhysGeom ) - > nRefCount > 1 ; / / can ' t store DATA_UNSCALED_GEOM ptr to a volatile geom <nl> - if ( doBake & & BakeScaleIntoGeometry ( pgeom , m_pWorld - > GetGeomManager ( ) , scale ) ) { <nl> + if ( doBake & & BakeScaleIntoGeometry ( pgeom , m_pWorld - > GetGeomManager ( ) , scale , 0 , & skewMtxPart ) ) { <nl> if ( m_parts [ i ] . pPhysGeom = = m_parts [ i ] . pPhysGeomProxy ) { <nl> m_pWorld - > GetGeomManager ( ) - > UnregisterGeometry ( m_parts [ i ] . pPhysGeomProxy ) ; <nl> ( m_parts [ i ] . pPhysGeomProxy = pgeom ) - > nRefCount + + ; <nl> int CPhysicalEntity : : SetParams ( pe_params * _params , int bThreadSafe ) <nl> m_pWorld - > GetGeomManager ( ) - > UnregisterGeometry ( m_parts [ i ] . pPhysGeom ) ; <nl> ( m_parts [ i ] . pPhysGeom = pgeom ) - > nRefCount + + ; <nl> } <nl> + m_parts [ i ] . pos = skewMtx * ( m_parts [ i ] . pos / params - > scale ) ; <nl> } <nl> } <nl> ENTITY_VALIDATE ( " CPhysicalEntity : SetParams ( pe_params_pos ) " , params ) ; <nl> int CPhysicalEntity : : SetParams ( pe_params * _params , int bThreadSafe ) <nl> bPosChanged = m_pWorld - > RepositionEntity ( this , 5 , BBox ) ; <nl> m_BBox [ 0 ] = BBox [ 0 ] ; <nl> m_BBox [ 1 ] = BBox [ 1 ] ; <nl> + for ( i = 0 ; i < m_nParts ; i + + ) { <nl> + m_parts [ i ] . BBox [ 0 ] = m_parts [ i ] . pNewCoords - > BBox [ 0 ] ; <nl> + m_parts [ i ] . BBox [ 1 ] = m_parts [ i ] . pNewCoords - > BBox [ 1 ] ; <nl> + } <nl> m_pWorld - > UnlockGrid ( this , - bPosChanged ) ; <nl> } <nl> } <nl> int CPhysicalEntity : : SetParams ( pe_params * _params , int bThreadSafe ) <nl> for ( i = 0 ; i < m_nParts & & m_parts [ i ] . id ! = params - > partid ; i + + ) ; <nl> if ( i > = m_nParts ) <nl> return 0 ; <nl> - Vec3 scale ; <nl> - if ( ( scale = get_xqs_from_matrices ( params - > pMtx3x4 , params - > pMtx3x3 , params - > pos , params - > q , params - > scale ) ) . len2 ( ) > 3 . 03f ) { <nl> + Vec3 scale ; Matrix33 skewMtx ; <nl> + if ( ( scale = get_xqs_from_matrices ( params - > pMtx3x4 , params - > pMtx3x3 , params - > pos , params - > q , params - > scale , 0 , 0 , & skewMtx ) ) . len2 ( ) > 3 . 03f ) { <nl> if ( is_unused ( params - > pPhysGeom ) ) <nl> m_pWorld - > GetGeomManager ( ) - > AddRefGeometry ( params - > pPhysGeom = m_parts [ i ] . pPhysGeom ) ; <nl> if ( is_unused ( params - > pPhysGeomProxy ) ) <nl> m_pWorld - > GetGeomManager ( ) - > AddRefGeometry ( params - > pPhysGeomProxy = m_parts [ i ] . pPhysGeomProxy ) ; <nl> phys_geometry * pgeom0 = params - > pPhysGeom ; <nl> - if ( BakeScaleIntoGeometry ( params - > pPhysGeom , m_pWorld - > GetGeomManager ( ) , scale , 1 ) ) <nl> + if ( BakeScaleIntoGeometry ( params - > pPhysGeom , m_pWorld - > GetGeomManager ( ) , scale , 1 , & skewMtx ) ) <nl> m_pWorld - > GetGeomManager ( ) - > AddRefGeometry ( params - > pPhysGeom ) ; <nl> if ( pgeom0 ! = params - > pPhysGeomProxy ) { <nl> - if ( BakeScaleIntoGeometry ( params - > pPhysGeomProxy , m_pWorld - > GetGeomManager ( ) , scale , 1 ) ) <nl> + if ( BakeScaleIntoGeometry ( params - > pPhysGeomProxy , m_pWorld - > GetGeomManager ( ) , scale , 1 , & skewMtx ) ) <nl> m_pWorld - > GetGeomManager ( ) - > AddRefGeometry ( params - > pPhysGeomProxy ) ; <nl> } else <nl> params - > pPhysGeomProxy = params - > pPhysGeom ; <nl> int CPhysicalEntity : : Action ( pe_action * _action , int bThreadSafe ) <nl> continue ; <nl> gp . mass = m_parts [ i ] . mass * cube ( action - > mtxRel . GetColumn0 ( ) . len ( ) / m_parts [ i ] . scale ) ; <nl> gp . flags = m_parts [ i ] . flags ; gp . flagsCollider = m_parts [ i ] . flagsCollider ; <nl> - mtxPart = action - > mtxRel * Matrix34 ( Vec3 ( 1 ) , m_parts [ i ] . q , m_parts [ i ] . pos ) ; <nl> + mtxPart = action - > mtxRel * Matrix34 ( Vec3 ( m_parts [ i ] . scale ) , m_parts [ i ] . q , m_parts [ i ] . pos ) ; <nl> gp . pLattice = m_parts [ i ] . pLattice ; gp . idmatBreakable = m_parts [ i ] . idmatBreakable ; <nl> gp . pMatMapping = m_parts [ i ] . pMatMapping ; gp . nMats = m_parts [ i ] . nMats ; <nl> pTarget - > AddGeometry ( m_parts [ i ] . pPhysGeom , & gp , idnew , 1 ) ; <nl> mmm a / Code / CryEngine / CryPhysics / physicalworld . cpp <nl> ppp b / Code / CryEngine / CryPhysics / physicalworld . cpp <nl> void SEntityGrid : : Init ( ) <nl> { <nl> m_next = m_prev = nullptr ; <nl> cells = 0 ; <nl> - zGran = 1 . 0f / 16 ; rzGran = 16 ; <nl> + zGran = 1 . 0f / 16 ; rzGran = 16 ; iup = 2 ; <nl> pPODcells = & ( pDummyPODcell = & dummyPODcell ) ; dummyPODcell . lifeTime = 1E10f ; <nl> dummyPODcell . zlim . set ( 1E10f , - 1E10f ) ; <nl> log2PODscale = 0 ; <nl> void CPhysicalWorld : : Init ( ) <nl> } <nl> memset ( m_threadData , 0 , sizeof ( m_threadData ) ) ; <nl> <nl> - m_iNextId = 1 ; <nl> - m_iNextIdDown = m_lastExtId = m_nExtIds = 0 ; <nl> - m_pEntsById = 0 ; <nl> - m_nIdsAlloc = 0 ; <nl> + m_pEntsById . reset ( ) ; <nl> m_nExplVictims = m_nExplVictimsAlloc = 0 ; <nl> m_pPlaceholders = 0 ; m_pPlaceholderMap = 0 ; <nl> m_nPlaceholders = m_nPlaceholderChunks = 0 ; <nl> void CPhysicalWorld : : Shutdown ( int bDeleteGeometries ) <nl> if ( m_pMassList ) delete [ ] m_pMassList ; m_pMassList = 0 ; <nl> if ( m_pGroupIds ) delete [ ] m_pGroupIds ; m_pGroupIds = 0 ; <nl> if ( m_pGroupNums ) delete [ ] m_pGroupNums ; m_pGroupNums = 0 ; <nl> - if ( m_pEntsById ) delete [ ] m_pEntsById ; m_pEntsById = 0 ; m_nIdsAlloc = 0 ; <nl> + m_pEntsById . reset ( ) ; <nl> m_cubeMapStatic . Free ( ) ; <nl> m_cubeMapDynamic . Free ( ) ; <nl> if ( m_nExplVictimsAlloc ) { <nl> IPhysicalEntity * CPhysicalWorld : : SetupEntityGrid ( int axisz , Vec3 org , int nx , int <nl> <nl> if ( pgrid - > cells ) { <nl> int i ; <nl> - if ( m_pEntsById ) for ( i = 0 ; i < m_iNextId ; i + + ) if ( m_pEntsById [ i ] & & GetGrid ( m_pEntsById [ i ] ) = = pgrid ) { <nl> + for ( i = 0 ; i < = m_pEntsById . getMaxId ( ) ; i + + ) if ( m_pEntsById [ i ] & & GetGrid ( m_pEntsById [ i ] ) = = pgrid ) { <nl> DetachEntityGridThunks ( m_pEntsById [ i ] ) ; <nl> if ( ! m_pEntsById [ i ] - > m_pEntBuddy | | m_pEntsById [ i ] - > m_pEntBuddy = = m_pEntsById [ i ] ) { <nl> - CPhysicalEntity * pent = ( CPhysicalEntity * ) m_pEntsById [ i ] ; <nl> + CPhysicalEntity * pent = ( CPhysicalEntity * ) ( CPhysicalPlaceholder * ) m_pEntsById [ i ] ; <nl> for ( int j = 0 ; j < pent - > m_nParts ; j + + ) if ( pent - > m_parts [ j ] . pPlaceholder ) <nl> DetachEntityGridThunks ( pent - > m_parts [ j ] . pPlaceholder ) ; <nl> } <nl> IPhysicalEntity * CPhysicalWorld : : CreatePhysicalEntity ( pe_type type , float lifeTi <nl> res - > m_bPrevPermanent = res - > m_bPermanent = 1 ; <nl> res - > m_pForeignData = pForeignData ; <nl> res - > m_iForeignData = iForeignData ; <nl> - m_lastExtId = max ( m_lastExtId , id ) ; <nl> - m_nExtIds + = 1 + ( id > > 31 ) ; <nl> SetPhysicalEntityId ( res , id > = 0 ? id : GetFreeEntId ( ) ) ; <nl> } <nl> res - > m_flags | = 0x80000000u ; <nl> DEBUG_BREAK ; <nl> pent - > m_next - > m_prev = pent ; <nl> if ( pent - > m_pEntBuddy ) { <nl> pent - > m_pEntBuddy - > m_pEntBuddy = 0 ; <nl> - if ( IsPortal ( pent ) & & ! pent - > m_pEntBuddy - > m_pForeignData ) { <nl> - DestroyPhysicalEntity ( pent - > m_pEntBuddy , 0 , 1 ) ; <nl> + if ( IsPortal ( pent ) ) { <nl> + if ( ! pent - > m_pEntBuddy - > m_pForeignData ) <nl> + DestroyPhysicalEntity ( pent - > m_pEntBuddy , 0 , 1 ) ; <nl> goto freeid ; <nl> } <nl> } else { <nl> freeid : <nl> - if ( pent - > m_id < = m_lastExtId ) <nl> - - - m_nExtIds ; <nl> SetPhysicalEntityId ( pent , - 1 ) ; pent - > m_id = - 1 ; <nl> } <nl> pent - > m_iSimClass = 7 ; <nl> void CPhysicalWorld : : PatchEventsQueue ( IPhysicalEntity * pEntity , void * pForeignDa <nl> <nl> int CPhysicalWorld : : GetFreeEntId ( ) <nl> { <nl> - int nPhysEnts = m_nEnts - m_nExtIds , nPhysSlots = m_iNextId - m_lastExtId ; <nl> - if ( nPhysEnts * 2 > nPhysSlots ) <nl> - return m_iNextId + + ; <nl> - int nTries ; <nl> - for ( nTries = 100 ; nTries > 0 & & m_iNextIdDown > m_lastExtId & & m_pEntsById [ m_iNextIdDown ] ; m_iNextIdDown - - , nTries - - ) ; <nl> - if ( nTries < = 0 ) <nl> - return m_iNextId + + ; <nl> - if ( m_iNextIdDown < = m_lastExtId ) <nl> - for ( m_iNextIdDown = m_iNextId - 2 , nTries = 100 ; nTries > 0 & & m_iNextIdDown > m_lastExtId & & m_pEntsById [ m_iNextIdDown ] ; m_iNextIdDown - - , nTries - - ) ; <nl> - if ( nTries < = 0 | | m_iNextIdDown < = m_lastExtId ) <nl> - return m_iNextId + + ; <nl> - return m_iNextIdDown - - ; <nl> + return m_pEntsById . findFreeIdx ( ) ; <nl> } <nl> <nl> <nl> int CPhysicalWorld : : SetPhysicalEntityId ( IPhysicalEntity * _pent , int id , int bRep <nl> { <nl> WriteLockCond lock ( m_lockEntIdList , bThreadSafe ^ 1 ) ; <nl> CPhysicalPlaceholder * pent = ( CPhysicalPlaceholder * ) _pent ; <nl> - unsigned int previd = ( unsigned int ) pent - > m_id ; <nl> - if ( previd < ( unsigned int ) m_nIdsAlloc ) { <nl> - m_pEntsById [ previd ] = 0 ; <nl> - if ( previd = = m_iNextId - 1 ) <nl> - for ( ; m_iNextId > 0 & & m_pEntsById [ m_iNextId - 1 ] = = 0 ; m_iNextId - - ) ; <nl> - if ( previd = = m_lastExtId ) <nl> - for ( - - m_lastExtId ; m_lastExtId > 0 & & ! m_pEntsById [ m_lastExtId ] ; m_lastExtId - - ) ; <nl> - } <nl> - m_iNextId = max ( m_iNextId , id + 1 ) ; <nl> + if ( pent - > m_id > = 0 ) <nl> + m_pEntsById [ pent - > m_id ] = 0 ; <nl> <nl> if ( id > = 0 ) { <nl> - if ( id > = m_nIdsAlloc ) { <nl> - int nAllocPrev = m_nIdsAlloc ; <nl> - ReallocateList ( m_pEntsById , nAllocPrev , m_nIdsAlloc = ( id & ~ 32767 ) + 32768 , true ) ; <nl> - } <nl> if ( m_pEntsById [ id ] ) { <nl> if ( bReplace ) <nl> SetPhysicalEntityId ( m_pEntsById [ id ] , GetFreeEntId ( ) , 1 , 1 ) ; <nl> IPhysicalEntity * CPhysicalWorld : : GetPhysicalEntityById ( int id ) <nl> return & g_StaticPhysicalEntity ; <nl> else { <nl> int bNoExpand = id > > 30 ; id & = ~ ( 1 < < 30 ) ; <nl> - if ( ( unsigned int ) id < ( unsigned int ) m_nIdsAlloc ) <nl> - return m_pEntsById [ id ] ? ( ! bNoExpand ? m_pEntsById [ id ] - > GetEntity ( ) : m_pEntsById [ id ] - > GetEntityFast ( ) ) : 0 ; <nl> + if ( CPhysicalPlaceholder * ppc = m_pEntsById [ id ] ) <nl> + return ! bNoExpand ? ppc - > GetEntity ( ) : ppc - > GetEntityFast ( ) ; <nl> + return nullptr ; <nl> } <nl> return 0 ; <nl> } <nl> int CPhysicalWorld : : RepositionEntity ( CPhysicalPlaceholder * pobj , int flags , Vec3 <nl> Vec3 com = pgrid1 - > m_transInHost . GetInverted ( ) * pgrid1 - > m_com * pent - > m_qrot ; <nl> pe_action_impulse ai ; <nl> ai . iSource = 5 ; <nl> - for ( ithunk = m_gthunks [ pgrid1 - > m_iGThunk0 ] . inext ; ithunk ; ithunk = m_gthunks [ ithunk ] . inext ) <nl> + for ( ithunk = m_gthunks [ pgrid1 - > m_iGThunk0 ] . inext ; ithunk & & m_gthunks [ ithunk ] . pent ; ithunk = m_gthunks [ ithunk ] . inext ) <nl> if ( IsPortal ( m_gthunks [ ithunk ] ) ) <nl> SyncPortal ( m_gthunks [ ithunk ] . pent ) ; <nl> else if ( ( unsigned int ) m_gthunks [ ithunk ] . pent - > m_iSimClass - 1u < 2u ) { <nl> void CPhysicalWorld : : GetMemoryStatistics ( ICrySizer * pSizer ) <nl> pSizer - > AddObject ( m_pMassList , m_nEntsAlloc * sizeof ( m_pMassList [ 0 ] ) ) ; <nl> pSizer - > AddObject ( m_pGroupIds , m_nEntsAlloc * sizeof ( m_pGroupIds [ 0 ] ) ) ; <nl> pSizer - > AddObject ( m_pGroupNums , m_nEntsAlloc * sizeof ( m_pGroupNums [ 0 ] ) ) ; <nl> - pSizer - > AddObject ( m_pEntsById , m_nIdsAlloc * sizeof ( m_pEntsById [ 0 ] ) ) ; <nl> + pSizer - > AddObject ( m_pEntsById . data , m_pEntsById . size * sizeof ( m_pEntsById . data [ 0 ] ) ) ; <nl> pSizer - > AddObject ( & m_entgrid . cells , GetGridSize ( m_entgrid . cells , m_entgrid . size ) ) ; <nl> pSizer - > AddObject ( m_gthunks , m_thunkPoolSz * sizeof ( m_gthunks [ 0 ] ) ) ; <nl> <nl> mmm a / Code / CryEngine / CryPhysics / physicalworld . h <nl> ppp b / Code / CryEngine / CryPhysics / physicalworld . h <nl> struct SThreadTaskRequest { <nl> int * pbAllGroupsFinished ; <nl> } ; <nl> <nl> + template < typename I , int offs , int size > struct bitfield { / / signed int bitfield <nl> + I & data ; <nl> + operator I ( ) const { return ( data < < sizeof ( I ) * 8 - offs - size ) > > sizeof ( I ) * 8 - size ; } <nl> + bitfield & operator = ( I val ) { ( data & = ~ ( ( ( I ) 1 < < size ) - 1 < < offs ) ) | = ( val & ( ( I ) 1 < < size ) - 1 ) < < offs ; return * this ; } <nl> + } ; <nl> + <nl> + const int ISFREE = 1 ; <nl> + const int IDBITS = 24 ; <nl> + <nl> + struct SEntityIdList { <nl> + CPhysicalPlaceholder * * data = nullptr ; <nl> + ~ SEntityIdList ( ) { reset ( ) ; } <nl> + void reset ( ) { delete [ ] data ; size = 0 ; maxid = - 1 ; idx0 = ( ( INT_PTR ) 1 < < IDBITS * 2 ) - 1 < < ISFREE | 1 ; } <nl> + struct SFreeIndex { <nl> + SFreeIndex ( INT_PTR * pidx ) : next ( { * pidx } ) , prev ( { * pidx } ) { } <nl> + bitfield < INT_PTR , ISFREE , IDBITS > next ; / / next_free_id = this_id + 1 + next <nl> + bitfield < INT_PTR , IDBITS + ISFREE , IDBITS > prev ; / / prev_free_id = this_id - 1 - prev <nl> + bool isFree ( ) const { return next . data = = 0 | | next . data & 1 ; } <nl> + SFreeIndex & setFree ( ) { next . data | = 1 ; return * this ; } <nl> + } ; <nl> + INT_PTR idx0 = ( ( INT_PTR ) 1 < < IDBITS * 2 ) - 1 < < ISFREE | 1 ; / / next , prev = - 1 <nl> + int size = 0 , maxid = - 1 ; <nl> + <nl> + SFreeIndex freeIdx ( int id ) { return SFreeIndex ( ( unsigned int ) id < size ? ( INT_PTR * ) data + id : & idx0 ) ; } <nl> + int findFreeIdx ( ) { if ( freeIdx ( - 1 ) . next < 0 ) alloc ( ) ; return freeIdx ( - 1 ) . next ; } <nl> + int getMaxId ( ) const { return min ( size - 1 , maxid ) ; } <nl> + void alloc ( int id = 0 ) { <nl> + int szold = size ; <nl> + ReallocateList ( data , szold , size = max ( id + 32767 & ~ 32767 , size + 32768 ) , true ) ; <nl> + freeIdx ( size - 1 ) . next = freeIdx ( - 1 ) . next - size ; / / [ last_new_id ] . next_free = prev_first_free <nl> + freeIdx ( szold ) . prev = szold ; / / [ first_new_id ] . prev_free = - 1 <nl> + if ( freeIdx ( - 1 ) . next < 0 ) <nl> + freeIdx ( - 1 ) . prev = - 1 - size ; / / last_free = last_new_id <nl> + freeIdx ( - 1 ) . next = szold ; / / first_free = first_new_id <nl> + } <nl> + bool validate ( ) { <nl> + int iprev = - 1 , i , loop = 0 ; <nl> + for ( i = 0 ; i < maxid ; i + + ) if ( ! freeIdx ( i ) . isFree ( ) ) <nl> + data [ i ] - > GetType ( ) ; / / makes sure the pointer is not stale <nl> + for ( i = freeIdx ( iprev ) . next ; i ! = - 1 & & i - 1 - freeIdx ( i ) . prev = = iprev & & loop < size + 10 ; loop + + , iprev = i , i + = 1 + freeIdx ( i ) . next ) ; <nl> + return i = = - 1 ; <nl> + } <nl> + <nl> + struct SEntityIdListItem { <nl> + SEntityIdList & list ; <nl> + int id ; <nl> + operator CPhysicalPlaceholder * ( ) { return id > = list . size | | list . freeIdx ( id ) . isFree ( ) ? nullptr : list . data [ id ] ; } <nl> + CPhysicalPlaceholder * operator - > ( ) const { return list . data [ id ] ; } <nl> + SEntityIdListItem & operator = ( CPhysicalPlaceholder * ptr ) { <nl> + if ( ptr ) { <nl> + if ( id > = list . size ) <nl> + list . alloc ( id ) ; <nl> + auto idx = list . freeIdx ( id ) ; <nl> + if ( idx . isFree ( ) ) { / / remove id from the free id list <nl> + int delta = idx . next + idx . prev + 1 ; <nl> + list . freeIdx ( id + 1 + idx . next ) . setFree ( ) . prev = delta ; <nl> + list . freeIdx ( id - 1 - idx . prev ) . setFree ( ) . next = delta ; <nl> + } <nl> + list . maxid = max ( list . maxid , id ) ; <nl> + list . data [ id ] = ptr ; <nl> + } else if ( ( unsigned int ) id < list . size ) { <nl> + auto idx = list . freeIdx ( id ) ; <nl> + idx . setFree ( ) ; <nl> + SFreeIndex idx0 ( & list . idx0 ) ; <nl> + int delta = idx0 . next - id - 1 ; <nl> + list . freeIdx ( idx0 . next ) . prev = delta ; / / [ first_free ] . prev = id <nl> + idx . next = delta ; / / [ id ] . next_free = first_free <nl> + idx . prev = id ; / / [ id ] . prev_free = - 1 <nl> + idx0 . next = id ; / / first_free = id <nl> + } <nl> + return * this ; <nl> + } <nl> + } ; <nl> + SEntityIdListItem operator [ ] ( int id ) { return { * this , id } ; } <nl> + } ; <nl> + <nl> # ifdef ENTGRID_2LEVEL <nl> struct pe_entgrid { <nl> pe_entgrid & operator = ( const pe_entgrid & src ) { <nl> class CPhysicalWorld : public IPhysicalWorld , public IPhysUtils , public CGeomMan <nl> volatile int m_lockOldThunks ; <nl> int m_nEnts , m_nEntsAlloc ; <nl> int m_nDynamicEntitiesDeleted ; <nl> - CPhysicalPlaceholder * * m_pEntsById ; <nl> - int m_nIdsAlloc , m_iNextId ; <nl> - int m_iNextIdDown , m_lastExtId , m_nExtIds ; <nl> + SEntityIdList m_pEntsById ; <nl> int m_bGridThunksChanged ; <nl> int m_bUpdateOnlyFlagged ; <nl> int m_nTypeEnts [ 10 ] ; <nl> mmm a / Code / CryEngine / CryPhysics / utils . cpp <nl> ppp b / Code / CryEngine / CryPhysics / utils . cpp <nl> real RotatePointToPlane ( const Vec3r & pt , const Vec3r & axis , const Vec3r & center , <nl> } <nl> <nl> <nl> - int BakeScaleIntoGeometry ( phys_geometry * & pgeom , IGeomManager * pGeoman , const Vec3 & s , int bReleaseOld ) <nl> + int BakeScaleIntoGeometry ( phys_geometry * & pgeom , IGeomManager * pGeoman , const Vec3 & s , int bReleaseOld , const Matrix33 * pskewMtx ) <nl> { <nl> IGeometry * pGeomScaled = 0 ; <nl> if ( phys_geometry * pAdam = ( phys_geometry * ) pgeom - > pGeom - > GetForeignData ( DATA_UNSCALED_GEOM ) ) { <nl> int BakeScaleIntoGeometry ( phys_geometry * & pgeom , IGeomManager * pGeoman , const Vec <nl> switch ( int itype = pgeom - > pGeom - > GetType ( ) ) { <nl> case GEOM_BOX : { <nl> const primitives : : box * pbox = ( const primitives : : box * ) pgeom - > pGeom - > GetData ( ) ; <nl> + Matrix33 R = pskewMtx ? * pskewMtx * pbox - > Basis . T ( ) : pbox - > Basis . T ( ) ; <nl> + if ( fabs ( R . GetColumn0 ( ) * R . GetColumn1 ( ) ) + fabs ( R . GetColumn0 ( ) * R . GetColumn2 ( ) ) + fabs ( R . GetColumn1 ( ) * R . GetColumn2 ( ) ) > 0 . 01f ) { <nl> + pGeomScaled = pgeom - > pGeom - > GetTriMesh ( ) ; <nl> + goto use_mesh ; <nl> + } <nl> primitives : : box boxScaled ; <nl> boxScaled = * pbox ; <nl> Diag33 smtx ( s ) ; <nl> int BakeScaleIntoGeometry ( phys_geometry * & pgeom , IGeomManager * pGeoman , const Vec <nl> } break ; <nl> case GEOM_TRIMESH : { <nl> pGeomScaled = pGeoman - > CloneGeometry ( pgeom - > pGeom ) ; <nl> + use_mesh : <nl> mesh_data * pmd = ( mesh_data * ) pGeomScaled - > GetData ( ) ; <nl> - Diag33 smtx ( s ) ; <nl> + Matrix33 mtx = pskewMtx ? * pskewMtx : Diag33 ( s ) ; <nl> for ( int i = 0 ; i < pmd - > nVertices ; i + + ) <nl> - pmd - > pVertices [ i ] = smtx * pmd - > pVertices [ i ] ; <nl> + pmd - > pVertices [ i ] = mtx * pmd - > pVertices [ i ] ; <nl> pGeomScaled - > SetData ( pmd ) ; <nl> } break ; <nl> } <nl> int BakeScaleIntoGeometry ( phys_geometry * & pgeom , IGeomManager * pGeoman , const Vec <nl> } <nl> <nl> <nl> - Vec3 get_xqs_from_matrices ( Matrix34 * pMtx3x4 , Matrix33 * pMtx3x3 , Vec3 & pos , quaternionf & q , float & scale , phys_geometry * * ppgeom , IGeomManager * pGeoman ) <nl> + Vec3 get_xqs_from_matrices ( Matrix34 * pMtx3x4 , Matrix33 * pMtx3x3 , Vec3 & pos , quaternionf & q , float & scale , phys_geometry * * ppgeom , IGeomManager * pGeoman , Matrix33 * pskewMtx ) <nl> { <nl> Vec3 s ; <nl> + Matrix33 skewMtx ; <nl> if ( pMtx3x4 ) { <nl> s . Set ( pMtx3x4 - > GetColumn ( 0 ) . len ( ) , pMtx3x4 - > GetColumn ( 1 ) . len ( ) , pMtx3x4 - > GetColumn ( 2 ) . len ( ) ) ; <nl> - q = quaternionf ( Matrix33 ( pMtx3x4 - > GetColumn ( 0 ) / s . x , pMtx3x4 - > GetColumn ( 1 ) / s . y , pMtx3x4 - > GetColumn ( 2 ) / s . z ) ) ; <nl> + q = quaternionf ( Matrix33 ( pMtx3x4 - > GetColumn ( 0 ) / s . x , pMtx3x4 - > GetColumn ( 1 ) / s . y , pMtx3x4 - > GetColumn ( 2 ) / s . z ) ) . GetNormalized ( ) ; <nl> pos = pMtx3x4 - > GetTranslation ( ) ; <nl> + skewMtx = Matrix33 ( ! q ) * Matrix33 ( * pMtx3x4 ) ; <nl> } else if ( pMtx3x3 ) { <nl> s . Set ( pMtx3x3 - > GetColumn ( 0 ) . len ( ) , pMtx3x3 - > GetColumn ( 1 ) . len ( ) , pMtx3x3 - > GetColumn ( 2 ) . len ( ) ) ; <nl> - q = quaternionf ( Matrix33 ( pMtx3x3 - > GetColumn ( 0 ) / s . x , pMtx3x3 - > GetColumn ( 1 ) / s . y , pMtx3x3 - > GetColumn ( 2 ) / s . z ) ) ; <nl> + q = quaternionf ( Matrix33 ( pMtx3x3 - > GetColumn ( 0 ) / s . x , pMtx3x3 - > GetColumn ( 1 ) / s . y , pMtx3x3 - > GetColumn ( 2 ) / s . z ) ) . GetNormalized ( ) ; <nl> + skewMtx = Matrix33 ( ! q ) * * pMtx3x3 ; <nl> } else <nl> return Vec3 ( 1 ) ; <nl> scale = min ( min ( s . x , s . y ) , s . z ) ; <nl> if ( fabs_tpl ( scale - 1 . 0f ) < 0 . 001f ) <nl> scale = 1 . 0f ; <nl> - else <nl> + else { <nl> s / = scale ; <nl> + skewMtx / = scale ; <nl> + } <nl> if ( s . len2 ( ) > 3 . 03f & & ppgeom & & pGeoman ) <nl> - if ( ! BakeScaleIntoGeometry ( * ppgeom , pGeoman , s ) ) <nl> + if ( ! BakeScaleIntoGeometry ( * ppgeom , pGeoman , s , 0 , & skewMtx ) ) <nl> scale * = ( s . x + s . y + s . z ) * ( 1 . 0f / 3 ) ; <nl> + if ( pskewMtx ) <nl> + * pskewMtx = skewMtx ; <nl> return s ; <nl> } <nl> <nl> mmm a / Code / CryEngine / CryPhysics / utils . h <nl> ppp b / Code / CryEngine / CryPhysics / utils . h <nl> template < class dtype > dtype * ReallocateList ( dtype * & plist , int szold , int sznew , <nl> return plist ; <nl> } <nl> <nl> - Vec3 get_xqs_from_matrices ( Matrix34 * pMtx3x4 , Matrix33 * pMtx3x3 , Vec3 & pos , quaternionf & q , float & scale , struct phys_geometry * * ppgeom = 0 , struct IGeomManager * pGeoman = 0 ) ; <nl> + Vec3 get_xqs_from_matrices ( Matrix34 * pMtx3x4 , Matrix33 * pMtx3x3 , Vec3 & pos , quaternionf & q , float & scale , struct phys_geometry * * ppgeom = 0 , struct IGeomManager * pGeoman = 0 , Matrix33 * pskewMtx = 0 ) ; <nl> const int DATA_UNSCALED_GEOM = - 999 ; <nl> - int BakeScaleIntoGeometry ( struct phys_geometry * & pgeom , struct IGeomManager * pGeoman , const Vec3 & s , int bReleaseOld = 0 ) ; <nl> + int BakeScaleIntoGeometry ( struct phys_geometry * & pgeom , struct IGeomManager * pGeoman , const Vec3 & s , int bReleaseOld = 0 , const Matrix33 * pskewMtx = 0 ) ; <nl> <nl> / / int BreakPolygon ( Vec2 * ptSrc , int nPt , int nCellx , int nCelly , int maxPatchTris , Vec2 * & ptout , int * & nPtOut , <nl> / / float jointhresh = 0 . 5f , int seed = - 1 ) ; <nl> mmm a / Code / CryEngine / CryPhysicsSystem / CryPhysX / geometries . h <nl> ppp b / Code / CryEngine / CryPhysicsSystem / CryPhysX / geometries . h <nl> class PhysXGeom : public IGeometry <nl> virtual void SetData ( const primitives : : primitive * ) { } <nl> virtual float GetVolume ( ) ; <nl> virtual Vec3 GetCenter ( ) { return Vec3 ( 0 ) ; } <nl> + virtual IGeometry * GetTriMesh ( int bClone = 1 ) { return 0 ; } <nl> virtual int Subtract ( IGeometry * pGeom , geom_world_data * pdata1 , geom_world_data * pdata2 , int bLogUpdates = 1 ) { return 0 ; } <nl> virtual int GetSubtractionsCount ( ) { return 0 ; } <nl> virtual void * GetForeignData ( int iForeignData = 0 ) { return nullptr ; } <nl> mmm a / Code / CryEngine / CrySystem / CMakeLists . txt <nl> ppp b / Code / CryEngine / CrySystem / CMakeLists . txt <nl> add_sources ( " CrySystem_uber_4 . cpp " <nl> " DiskProfilerWindowsSpecific . h " <nl> " FrameProfileRender . cpp " <nl> " FrameProfileSystem . cpp " <nl> - " LoadingProfiler . cpp " <nl> " PerfHUD . cpp " <nl> " DiskProfiler . h " <nl> " FrameProfileSystem . h " <nl> - " LoadingProfiler . h " <nl> " PerfHUD . h " <nl> " Watchdog . h " <nl> " Watchdog . cpp " <nl> mmm a / Code / CryEngine / CrySystem / DebugCallStack . cpp <nl> ppp b / Code / CryEngine / CrySystem / DebugCallStack . cpp <nl> int DebugCallStack : : handleException ( EXCEPTION_POINTERS * exception_pointer ) <nl> cry_sprintf ( excCode , " 0x % 08X " , exception_pointer - > ExceptionRecord - > ExceptionCode ) ; <nl> WriteLineToLog ( " Exception : % s , at Address : % s " , excCode , excAddr ) ; <nl> <nl> - if ( CSystem * pSystem = ( CSystem * ) GetSystem ( ) ) <nl> - { <nl> - if ( const char * pLoadingProfilerCallstack = pSystem - > GetLoadingProfilerCallstack ( ) ) <nl> - if ( pLoadingProfilerCallstack [ 0 ] ) <nl> - WriteLineToLog ( " < CrySystem > LoadingProfilerCallstack : % s " , pLoadingProfilerCallstack ) ; <nl> - } <nl> - <nl> { <nl> IMemoryManager : : SProcessMemInfo memInfo ; <nl> if ( gEnv - > pSystem - > GetIMemoryManager ( ) - > GetProcessMemInfo ( memInfo ) ) <nl> deleted file mode 100644 <nl> index 609c6aaec6 . . 0000000000 <nl> mmm a / Code / CryEngine / CrySystem / LoadingProfiler . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - / / File name : loadingprofiler . cpp <nl> - / / Version : v1 . 00 <nl> - / / Created : 01 / 12 / 2007 by Vladimir Kajalin <nl> - / / Compilers : Visual Studio . NET <nl> - / / Description : <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - / / History : <nl> - / / <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # include " StdAfx . h " <nl> - <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - <nl> - # include " System . h " <nl> - # include " LoadingProfiler . h " <nl> - # include " DiskProfiler . h " <nl> - <nl> - # define LOADING_TIME_CONTAINER_MAX_TEXT_SIZE 1024 <nl> - # define MAX_LOADING_TIME_PROFILER_STACK_DEPTH 16 <nl> - <nl> - / / # define SAVE_SAVELEVELSTATS_IN_ROOT <nl> - <nl> - struct SLoadingTimeContainer : public _i_reference_target_t <nl> - { <nl> - SLoadingTimeContainer ( ) { } <nl> - <nl> - SLoadingTimeContainer ( SLoadingTimeContainer * pParent , const char * pPureFuncName , const int nRootIndex ) <nl> - { <nl> - m_dSelfMemUsage = m_dTotalMemUsage = m_dSelfTime = m_dTotalTime = 0 ; <nl> - m_nCounter = 1 ; <nl> - m_pFuncName = pPureFuncName ; <nl> - m_pParent = pParent ; <nl> - m_nRootIndex = nRootIndex ; <nl> - } <nl> - <nl> - static int Cmp_SLoadingTimeContainer_Time ( const void * v1 , const void * v2 ) <nl> - { <nl> - SLoadingTimeContainer * pChunk1 = ( SLoadingTimeContainer * ) v1 ; <nl> - SLoadingTimeContainer * pChunk2 = ( SLoadingTimeContainer * ) v2 ; <nl> - <nl> - if ( pChunk1 - > m_dSelfTime > pChunk2 - > m_dSelfTime ) <nl> - return - 1 ; <nl> - else if ( pChunk1 - > m_dSelfTime < pChunk2 - > m_dSelfTime ) <nl> - return 1 ; <nl> - <nl> - return 0 ; <nl> - } <nl> - <nl> - static int Cmp_SLoadingTimeContainer_MemUsage ( const void * v1 , const void * v2 ) <nl> - { <nl> - SLoadingTimeContainer * pChunk1 = ( SLoadingTimeContainer * ) v1 ; <nl> - SLoadingTimeContainer * pChunk2 = ( SLoadingTimeContainer * ) v2 ; <nl> - <nl> - if ( pChunk1 - > m_dSelfMemUsage > pChunk2 - > m_dSelfMemUsage ) <nl> - return - 1 ; <nl> - else if ( pChunk1 - > m_dSelfMemUsage < pChunk2 - > m_dSelfMemUsage ) <nl> - return 1 ; <nl> - <nl> - return 0 ; <nl> - } <nl> - <nl> - static double GetUsedMemory ( ISystem * pSysytem ) <nl> - { <nl> - static IMemoryManager : : SProcessMemInfo processMemInfo ; <nl> - pSysytem - > GetIMemoryManager ( ) - > GetProcessMemInfo ( processMemInfo ) ; <nl> - return double ( processMemInfo . PagefileUsage ) / double ( 1024 * 1024 ) ; <nl> - } <nl> - <nl> - void Clear ( ) <nl> - { <nl> - for ( size_t i = 0 , end = m_pChilds . size ( ) ; i < end ; + + i ) <nl> - { <nl> - delete m_pChilds [ i ] ; <nl> - } <nl> - } <nl> - <nl> - ~ SLoadingTimeContainer ( ) <nl> - { <nl> - Clear ( ) ; <nl> - } <nl> - <nl> - double m_dSelfTime , m_dTotalTime ; <nl> - double m_dSelfMemUsage , m_dTotalMemUsage ; <nl> - uint32 m_nCounter ; <nl> - <nl> - const char * m_pFuncName ; <nl> - SLoadingTimeContainer * m_pParent ; <nl> - int m_nRootIndex ; <nl> - std : : vector < SLoadingTimeContainer * > m_pChilds ; <nl> - <nl> - DiskOperationInfo m_selfInfo ; <nl> - DiskOperationInfo m_totalInfo ; <nl> - bool m_bUsed ; <nl> - <nl> - } ; <nl> - <nl> - bool operator = = ( const SLoadingTimeContainer & a , const SLoadingTimeContainer & b ) <nl> - { <nl> - return b . m_pFuncName = = a . m_pFuncName ; <nl> - } <nl> - <nl> - bool operator = = ( const SLoadingTimeContainer & a , const char * b ) <nl> - { <nl> - return b = = a . m_pFuncName ; <nl> - } <nl> - <nl> - SLoadingTimeContainer * CLoadingProfilerSystem : : m_pCurrentLoadingTimeContainer = 0 ; <nl> - SLoadingTimeContainer * CLoadingProfilerSystem : : m_pRoot [ 2 ] = { 0 , 0 } ; <nl> - int CLoadingProfilerSystem : : m_iActiveRoot = 0 ; <nl> - ICVar * CLoadingProfilerSystem : : m_pEnableProfile = 0 ; <nl> - int CLoadingProfilerSystem : : nLoadingProfileMode = 1 ; <nl> - int CLoadingProfilerSystem : : nLoadingProfilerNotTrackedAllocations = - 1 ; <nl> - CryCriticalSection CLoadingProfilerSystem : : csLock ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void CLoadingProfilerSystem : : OutputLoadingTimeStats ( ILog * pLog , int nMode ) <nl> - { <nl> - nLoadingProfileMode = nMode ; <nl> - <nl> - PodArray < SLoadingTimeContainer > arrNoStack ; <nl> - CreateNoStackList ( arrNoStack ) ; <nl> - <nl> - if ( nLoadingProfileMode > 0 ) <nl> - { <nl> - / / loading mem stats per func <nl> - pLog - > Log ( " mmmmmm Level loading memory allocations ( MB ) by function mmmmmmmmmmmm " ) ; <nl> - pLog - > Log ( " | | Self | Total | Calls | Function ( % d MB lost ) | | " , nLoadingProfilerNotTrackedAllocations ) ; <nl> - pLog - > Log ( " mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm " ) ; <nl> - <nl> - qsort ( arrNoStack . GetElements ( ) , arrNoStack . Count ( ) , sizeof ( arrNoStack [ 0 ] ) , SLoadingTimeContainer : : Cmp_SLoadingTimeContainer_MemUsage ) ; <nl> - <nl> - for ( int i = 0 ; i < arrNoStack . Count ( ) ; i + + ) <nl> - { <nl> - const SLoadingTimeContainer * pTimeContainer = & arrNoStack [ i ] ; <nl> - pLog - > Log ( " | % 6 . 1f | % 6 . 1f | % 6d | % s | " , <nl> - pTimeContainer - > m_dSelfMemUsage , pTimeContainer - > m_dTotalMemUsage , ( int ) pTimeContainer - > m_nCounter , pTimeContainer - > m_pFuncName ) ; <nl> - } <nl> - <nl> - pLog - > Log ( " mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm " ) ; <nl> - } <nl> - <nl> - if ( nLoadingProfileMode > 0 ) <nl> - { <nl> - / / loading time stats per func <nl> - pLog - > Log ( " mmmmmmmmm - - Level loading time ( sec ) by function mmmmmmmmmmmmmmmmmm - - " ) ; <nl> - pLog - > Log ( " | | Self | Total | Calls | Function | | " ) ; <nl> - pLog - > Log ( " mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm " ) ; <nl> - <nl> - qsort ( arrNoStack . GetElements ( ) , arrNoStack . Count ( ) , sizeof ( arrNoStack [ 0 ] ) , SLoadingTimeContainer : : Cmp_SLoadingTimeContainer_Time ) ; <nl> - <nl> - for ( int i = 0 ; i < arrNoStack . Count ( ) ; i + + ) <nl> - { <nl> - const SLoadingTimeContainer * pTimeContainer = & arrNoStack [ i ] ; <nl> - pLog - > Log ( " | % 6 . 1f | % 6 . 1f | % 6d | % s | " , <nl> - pTimeContainer - > m_dSelfTime , pTimeContainer - > m_dTotalTime , ( int ) pTimeContainer - > m_nCounter , pTimeContainer - > m_pFuncName ) ; <nl> - } <nl> - <nl> - if ( nLoadingProfileMode = = 1 ) <nl> - pLog - > Log ( " mmm - - ( Use sys_ProfileLevelLoading 2 for more detailed stats ) mmm - - " ) ; <nl> - else <nl> - pLog - > Log ( " mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm " ) ; <nl> - } <nl> - <nl> - if ( nLoadingProfileMode > 0 ) <nl> - { <nl> - / / file info <nl> - pLog - > Log ( " mmmmmmmmmmmmmmmmmmmmmmmmmmm - - Level file information by function mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - " ) ; <nl> - pLog - > Log ( " | | Self | Total | Bandwith | Calls | Function | | " ) ; <nl> - pLog - > Log ( " | | Seeks | FileOpen | FileRead | Seeks | FileOpen | FileRead | Kb / s | | | | " ) ; <nl> - <nl> - qsort ( arrNoStack . GetElements ( ) , arrNoStack . Count ( ) , sizeof ( arrNoStack [ 0 ] ) , SLoadingTimeContainer : : Cmp_SLoadingTimeContainer_Time ) ; <nl> - <nl> - for ( int i = 0 ; i < arrNoStack . Count ( ) ; i + + ) <nl> - { <nl> - <nl> - const SLoadingTimeContainer * pTimeContainer = & arrNoStack [ i ] ; <nl> - double bandwidth = pTimeContainer - > m_dSelfTime > 0 ? ( pTimeContainer - > m_selfInfo . m_dOperationSize / pTimeContainer - > m_dSelfTime / 1024 . 0 ) : 0 . ; <nl> - pLog - > Log ( " | % 6d | % 6d | % 6d | % 6d | % 6d | % 6d | % 6 . 1f | % 6d | % s | " , <nl> - pTimeContainer - > m_selfInfo . m_nSeeksCount , pTimeContainer - > m_selfInfo . m_nFileOpenCount , pTimeContainer - > m_selfInfo . m_nFileReadCount , <nl> - pTimeContainer - > m_totalInfo . m_nSeeksCount , pTimeContainer - > m_totalInfo . m_nFileOpenCount , pTimeContainer - > m_totalInfo . m_nFileReadCount , <nl> - bandwidth , ( int ) pTimeContainer - > m_nCounter , pTimeContainer - > m_pFuncName ) ; <nl> - } <nl> - <nl> - if ( nLoadingProfileMode = = 1 ) <nl> - pLog - > Log ( " mmm - - ( Use sys_ProfileLevelLoading 2 for more detailed stats ) mmm - - " ) ; <nl> - else <nl> - pLog - > Log ( " mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm " ) ; <nl> - } <nl> - <nl> - } <nl> - <nl> - struct CSystemEventListener_LoadingProfiler : public ISystemEventListener <nl> - { <nl> - private : <nl> - CLoadingTimeProfiler * m_pPrecacheProfiler ; <nl> - ESystemEvent lastEvent ; <nl> - public : <nl> - CSystemEventListener_LoadingProfiler ( ) : m_pPrecacheProfiler ( NULL ) { } <nl> - <nl> - virtual void OnSystemEvent ( ESystemEvent event , UINT_PTR wparam , UINT_PTR lparam ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case ESYSTEM_EVENT_GAME_MODE_SWITCH_START : <nl> - { <nl> - CLoadingProfilerSystem : : Clean ( ) ; <nl> - if ( m_pPrecacheProfiler = = NULL ) <nl> - m_pPrecacheProfiler = new CLoadingTimeProfiler ( gEnv - > pSystem , " ModeSwitch " ) ; <nl> - break ; <nl> - } <nl> - <nl> - case ESYSTEM_EVENT_GAME_MODE_SWITCH_END : <nl> - { <nl> - SAFE_DELETE ( m_pPrecacheProfiler ) ; <nl> - CLoadingProfilerSystem : : SaveTimeContainersToFile ( gEnv - > bMultiplayer = = true ? " mode_switch_mp . crylp " : " mode_switch_sp . crylp " , 0 . 0 , true ) ; <nl> - } <nl> - <nl> - case ESYSTEM_EVENT_LEVEL_LOAD_PREPARE : <nl> - { <nl> - CLoadingProfilerSystem : : Clean ( ) ; <nl> - if ( m_pPrecacheProfiler = = NULL ) <nl> - m_pPrecacheProfiler = new CLoadingTimeProfiler ( gEnv - > pSystem , " LevelLoading " ) ; <nl> - break ; <nl> - } <nl> - <nl> - case ESYSTEM_EVENT_LEVEL_LOAD_END : <nl> - { <nl> - delete m_pPrecacheProfiler ; <nl> - m_pPrecacheProfiler = new CLoadingTimeProfiler ( gEnv - > pSystem , " Precache " ) ; <nl> - break ; <nl> - } <nl> - case ESYSTEM_EVENT_LEVEL_PRECACHE_END : <nl> - { <nl> - if ( lastEvent = = ESYSTEM_EVENT_LEVEL_PRECACHE_FIRST_FRAME ) <nl> - { <nl> - SAFE_DELETE ( m_pPrecacheProfiler ) ; <nl> - string levelName = " no_level " ; <nl> - ICVar * sv_map = gEnv - > pConsole - > GetCVar ( " sv_map " ) ; <nl> - if ( sv_map ) <nl> - levelName = sv_map - > GetString ( ) ; <nl> - <nl> - string levelNameFullProfile = levelName + " _LP . crylp " ; <nl> - string levelNameThreshold = levelName + " _LP_OneSec . crylp " ; <nl> - CLoadingProfilerSystem : : SaveTimeContainersToFile ( levelNameFullProfile . c_str ( ) , 0 . 0 , false ) ; <nl> - CLoadingProfilerSystem : : SaveTimeContainersToFile ( levelNameThreshold . c_str ( ) , 1 . 0 , true ) ; <nl> - } <nl> - break ; <nl> - } <nl> - case ESYSTEM_EVENT_LEVEL_POST_UNLOAD : <nl> - { <nl> - / / Ensure that the precache profiler is dead <nl> - SAFE_DELETE ( m_pPrecacheProfiler ) ; <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - lastEvent = event ; <nl> - } <nl> - } ; <nl> - <nl> - static CSystemEventListener_LoadingProfiler g_system_event_listener_loadingProfiler ; <nl> - <nl> - void CLoadingProfilerSystem : : Init ( ) <nl> - { <nl> - gEnv - > pSystem - > GetISystemEventDispatcher ( ) - > RegisterListener ( & g_system_event_listener_loadingProfiler , " CSystemEventListener_LoadingProfiler " ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void CLoadingProfilerSystem : : ShutDown ( ) <nl> - { <nl> - gEnv - > pSystem - > GetISystemEventDispatcher ( ) - > RemoveListener ( & g_system_event_listener_loadingProfiler ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - SLoadingTimeContainer * CLoadingProfilerSystem : : StartLoadingSectionProfiling ( CLoadingTimeProfiler * pProfiler , const char * szFuncName ) <nl> - { <nl> - if ( ! nLoadingProfileMode | | ! gEnv - > pConsole ) <nl> - return NULL ; <nl> - <nl> - DWORD threadID = GetCurrentThreadId ( ) ; <nl> - <nl> - static DWORD dwMainThreadId = GetCurrentThreadId ( ) ; <nl> - if ( threadID ! = dwMainThreadId ) <nl> - return NULL ; <nl> - <nl> - if ( ! m_pEnableProfile ) <nl> - { <nl> - if ( gEnv - > pConsole ) <nl> - { <nl> - m_pEnableProfile = gEnv - > pConsole - > GetCVar ( " sys_ProfileLevelLoading " ) ; <nl> - if ( ! m_pEnableProfile ) <nl> - return 0 ; <nl> - } <nl> - else <nl> - return 0 ; <nl> - } <nl> - <nl> - if ( m_pEnableProfile - > GetIVal ( ) < = 0 ) <nl> - return 0 ; <nl> - <nl> - / / if ( m_pCurrentLoadingTimeContainer = = m_pRoot & & strstr ( szFuncName , " Open " ) ) <nl> - / / { <nl> - / / pProfiler - > m_constructorInfo . m_nFileOpenCount + = 1 ; <nl> - / / } <nl> - <nl> - CryAutoCriticalSection lock ( csLock ) ; <nl> - <nl> - if ( true / * pProfiler & & pProfiler - > m_pSystem * / ) <nl> - { <nl> - <nl> - ITimer * pTimer = pProfiler - > m_pSystem - > GetITimer ( ) ; <nl> - pProfiler - > m_fConstructorTime = pTimer - > GetAsyncTime ( ) . GetSeconds ( ) ; <nl> - pProfiler - > m_fConstructorMemUsage = SLoadingTimeContainer : : GetUsedMemory ( pProfiler - > m_pSystem ) ; <nl> - <nl> - DiskOperationInfo info ; <nl> - # ifdef USE_DISK_PROFILER <nl> - if ( gEnv - > pSystem - > GetIDiskProfiler ( ) ) <nl> - info = gEnv - > pSystem - > GetIDiskProfiler ( ) - > GetStatistics ( ) ; <nl> - # endif <nl> - <nl> - pProfiler - > m_constructorInfo = info ; <nl> - <nl> - if ( nLoadingProfilerNotTrackedAllocations < 0 ) <nl> - nLoadingProfilerNotTrackedAllocations = ( int ) pProfiler - > m_fConstructorMemUsage ; <nl> - } <nl> - <nl> - SLoadingTimeContainer * pParent = m_pCurrentLoadingTimeContainer ; <nl> - if ( ! pParent ) <nl> - { <nl> - pParent = m_pCurrentLoadingTimeContainer = m_pRoot [ m_iActiveRoot ] = new SLoadingTimeContainer ( 0 , " Root " , m_iActiveRoot ) ; <nl> - } <nl> - <nl> - for ( size_t i = 0 , end = m_pCurrentLoadingTimeContainer - > m_pChilds . size ( ) ; i < end ; + + i ) <nl> - { <nl> - if ( m_pCurrentLoadingTimeContainer - > m_pChilds [ i ] - > m_pFuncName = = szFuncName ) <nl> - { <nl> - assert ( m_pCurrentLoadingTimeContainer - > m_pChilds [ i ] - > m_pParent = = m_pCurrentLoadingTimeContainer ) ; <nl> - assert ( ! m_pCurrentLoadingTimeContainer - > m_pChilds [ i ] - > m_bUsed ) ; <nl> - m_pCurrentLoadingTimeContainer - > m_pChilds [ i ] - > m_bUsed = true ; <nl> - m_pCurrentLoadingTimeContainer - > m_pChilds [ i ] - > m_nCounter + + ; <nl> - m_pCurrentLoadingTimeContainer = m_pCurrentLoadingTimeContainer - > m_pChilds [ i ] ; <nl> - return m_pCurrentLoadingTimeContainer ; <nl> - } <nl> - } <nl> - <nl> - m_pCurrentLoadingTimeContainer = new SLoadingTimeContainer ( pParent , szFuncName , pParent - > m_nRootIndex ) ; <nl> - m_pCurrentLoadingTimeContainer - > m_bUsed = true ; <nl> - { <nl> - / / Need to iterate from the end than <nl> - pParent - > m_pChilds . push_back ( m_pCurrentLoadingTimeContainer ) ; <nl> - } <nl> - <nl> - return m_pCurrentLoadingTimeContainer ; <nl> - } <nl> - <nl> - void CLoadingProfilerSystem : : EndLoadingSectionProfiling ( CLoadingTimeProfiler * pProfiler ) <nl> - { <nl> - if ( ! nLoadingProfileMode ) <nl> - return ; <nl> - <nl> - static DWORD dwMainThreadId = GetCurrentThreadId ( ) ; <nl> - <nl> - if ( GetCurrentThreadId ( ) ! = dwMainThreadId ) <nl> - { <nl> - return ; <nl> - } <nl> - <nl> - if ( ! pProfiler - > m_pTimeContainer ) <nl> - return ; <nl> - <nl> - CryAutoCriticalSection lock ( csLock ) ; <nl> - <nl> - if ( true / * pProfiler & & pProfiler - > m_pSystem * / ) <nl> - { <nl> - <nl> - ITimer * pTimer = pProfiler - > m_pSystem - > GetITimer ( ) ; <nl> - double fSelfTime = pTimer - > GetAsyncTime ( ) . GetSeconds ( ) - pProfiler - > m_fConstructorTime ; <nl> - double fMemUsage = SLoadingTimeContainer : : GetUsedMemory ( pProfiler - > m_pSystem ) ; <nl> - double fSelfMemUsage = fMemUsage - pProfiler - > m_fConstructorMemUsage ; <nl> - <nl> - if ( fSelfTime < 0 . 0 ) <nl> - assert ( 0 ) ; <nl> - pProfiler - > m_pTimeContainer - > m_dSelfTime + = fSelfTime ; <nl> - pProfiler - > m_pTimeContainer - > m_dTotalTime + = fSelfTime ; <nl> - pProfiler - > m_pTimeContainer - > m_dSelfMemUsage + = fSelfMemUsage ; <nl> - pProfiler - > m_pTimeContainer - > m_dTotalMemUsage + = fSelfMemUsage ; <nl> - <nl> - DiskOperationInfo info ; <nl> - # ifdef USE_DISK_PROFILER <nl> - if ( gEnv - > pSystem - > GetIDiskProfiler ( ) ) <nl> - info = gEnv - > pSystem - > GetIDiskProfiler ( ) - > GetStatistics ( ) ; <nl> - # endif <nl> - <nl> - info - = pProfiler - > m_constructorInfo ; <nl> - pProfiler - > m_pTimeContainer - > m_totalInfo + = info ; <nl> - pProfiler - > m_pTimeContainer - > m_selfInfo + = info ; <nl> - pProfiler - > m_pTimeContainer - > m_bUsed = false ; <nl> - <nl> - SLoadingTimeContainer * pParent = pProfiler - > m_pTimeContainer - > m_pParent ; <nl> - pParent - > m_selfInfo - = info ; <nl> - pParent - > m_dSelfTime - = fSelfTime ; <nl> - pParent - > m_dSelfMemUsage - = fSelfMemUsage ; <nl> - if ( pProfiler - > m_pTimeContainer - > m_pParent & & pProfiler - > m_pTimeContainer - > m_pParent - > m_nRootIndex = = m_iActiveRoot ) <nl> - { <nl> - m_pCurrentLoadingTimeContainer = pProfiler - > m_pTimeContainer - > m_pParent ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - const char * CLoadingProfilerSystem : : GetLoadingProfilerCallstack ( ) <nl> - { <nl> - CryAutoCriticalSection lock ( csLock ) ; <nl> - <nl> - static char szStack [ 1024 ] ; <nl> - <nl> - szStack [ 0 ] = 0 ; <nl> - <nl> - SLoadingTimeContainer * pC = m_pCurrentLoadingTimeContainer ; <nl> - <nl> - PodArray < SLoadingTimeContainer * > arrItems ; <nl> - <nl> - while ( pC ) <nl> - { <nl> - arrItems . Add ( pC ) ; <nl> - pC = pC - > m_pParent ; <nl> - } <nl> - <nl> - for ( int i = arrItems . Count ( ) - 1 ; i > = 0 ; i - - ) <nl> - { <nl> - cry_strcat ( szStack , " > " ) ; <nl> - cry_strcat ( szStack , arrItems [ i ] - > m_pFuncName ) ; <nl> - } <nl> - <nl> - return & szStack [ 0 ] ; <nl> - } <nl> - <nl> - void CLoadingProfilerSystem : : FillProfilersList ( std : : vector < SLoadingProfilerInfo > & profilers ) <nl> - { <nl> - UpdateSelfStatistics ( m_pRoot [ m_iActiveRoot ] ) ; <nl> - <nl> - PodArray < SLoadingTimeContainer > arrNoStack ; <nl> - CreateNoStackList ( arrNoStack ) ; <nl> - / / qsort ( arrNoStack . GetElements ( ) , arrNoStack . Count ( ) , sizeof ( arrNoStack [ 0 ] ) , SLoadingTimeContainer : : Cmp_SLoadingTimeContainer_Time ) ; <nl> - <nl> - uint32 count = arrNoStack . Size ( ) ; <nl> - profilers . resize ( count ) ; <nl> - <nl> - for ( uint32 i = 0 ; i < count ; + + i ) <nl> - { <nl> - profilers [ i ] . name = arrNoStack [ i ] . m_pFuncName ; <nl> - profilers [ i ] . selfTime = arrNoStack [ i ] . m_dSelfTime ; <nl> - profilers [ i ] . callsTotal = arrNoStack [ i ] . m_nCounter ; <nl> - profilers [ i ] . totalTime = arrNoStack [ i ] . m_dTotalTime ; <nl> - profilers [ i ] . memorySize = arrNoStack [ i ] . m_dTotalMemUsage ; <nl> - profilers [ i ] . selfInfo = arrNoStack [ i ] . m_selfInfo ; <nl> - profilers [ i ] . totalInfo = arrNoStack [ i ] . m_totalInfo ; <nl> - } <nl> - } <nl> - <nl> - void CLoadingProfilerSystem : : AddTimeContainerFunction ( PodArray < SLoadingTimeContainer > & arrNoStack , SLoadingTimeContainer * node ) <nl> - { <nl> - if ( ! node ) <nl> - return ; <nl> - <nl> - SLoadingTimeContainer * it = std : : find ( arrNoStack . begin ( ) , arrNoStack . end ( ) , node - > m_pFuncName ) ; <nl> - <nl> - if ( it = = arrNoStack . end ( ) ) <nl> - { <nl> - arrNoStack . push_back ( * node ) ; <nl> - } <nl> - else <nl> - { <nl> - it - > m_dSelfMemUsage + = node - > m_dSelfMemUsage ; <nl> - it - > m_dSelfTime + = node - > m_dSelfTime ; <nl> - it - > m_dTotalMemUsage + = node - > m_dTotalMemUsage ; <nl> - it - > m_dTotalTime + = node - > m_dTotalTime ; <nl> - it - > m_nCounter + = node - > m_nCounter ; <nl> - it - > m_selfInfo + = node - > m_selfInfo ; <nl> - it - > m_totalInfo + = node - > m_totalInfo ; <nl> - } <nl> - <nl> - for ( size_t i = 0 , end = node - > m_pChilds . size ( ) ; i < end ; + + i ) <nl> - { <nl> - AddTimeContainerFunction ( arrNoStack , node - > m_pChilds [ i ] ) ; <nl> - } <nl> - <nl> - } <nl> - <nl> - void CLoadingProfilerSystem : : CreateNoStackList ( PodArray < SLoadingTimeContainer > & arrNoStack ) <nl> - { <nl> - AddTimeContainerFunction ( arrNoStack , m_pRoot [ m_iActiveRoot ] ) ; <nl> - } <nl> - <nl> - # define g_szTestResults " % USER % / TestResults " <nl> - <nl> - void CLoadingProfilerSystem : : SaveTimeContainersToFile ( const char * name , double fMinTotalTime , bool bClean ) <nl> - { <nl> - <nl> - if ( m_pRoot [ m_iActiveRoot ] ) <nl> - { <nl> - FILE * f ; <nl> - <nl> - const char * levelName = name ; <nl> - / / Ignore any folders in the input name <nl> - const char * folder = strrchr ( name , ' / ' ) ; <nl> - if ( folder ! = NULL ) <nl> - { <nl> - levelName = folder + 1 ; <nl> - } <nl> - char path [ ICryPak : : g_nMaxPath ] ; <nl> - path [ sizeof ( path ) - 1 ] = 0 ; <nl> - <nl> - gEnv - > pCryPak - > AdjustFileName ( string ( string ( g_szTestResults ) + " \ \ " + levelName ) . c_str ( ) , path , ICryPak : : FLAGS_PATH_REAL | ICryPak : : FLAGS_FOR_WRITING ) ; <nl> - gEnv - > pCryPak - > MakeDir ( g_szTestResults ) ; <nl> - f = fopen ( path , " wb " ) ; <nl> - <nl> - if ( f ) <nl> - { <nl> - UpdateSelfStatistics ( m_pRoot [ m_iActiveRoot ] ) ; <nl> - WriteTimeContainerToFile ( m_pRoot [ m_iActiveRoot ] , f , 0 , fMinTotalTime ) ; <nl> - fclose ( f ) ; <nl> - } <nl> - <nl> - if ( bClean ) <nl> - { <nl> - Clean ( ) ; <nl> - } <nl> - } <nl> - <nl> - } <nl> - <nl> - void CLoadingProfilerSystem : : WriteTimeContainerToFile ( SLoadingTimeContainer * p , FILE * f , unsigned int depth , double fMinTotalTime ) <nl> - { <nl> - if ( p = = NULL ) <nl> - return ; <nl> - <nl> - if ( p - > m_dTotalTime < fMinTotalTime ) <nl> - return ; <nl> - <nl> - CryFixedStringT < MAX_LOADING_TIME_PROFILER_STACK_DEPTH > sDepth ; <nl> - for ( unsigned int i = 0 ; i < depth ; i + + ) <nl> - { <nl> - sDepth + = " \ t " ; <nl> - } <nl> - <nl> - CryFixedStringT < 128 > str ( p - > m_pFuncName ) ; <nl> - str . replace ( ' : ' , ' _ ' ) ; <nl> - fprintf ( f , " % s < % s selfTime = ' % f ' selfMemory = ' % f ' totalTime = ' % f ' totalMemory = ' % f ' count = ' % u ' totalSeeks = ' % i ' totalReads = ' % i ' totalOpens = ' % i ' totalDiskSize = ' % f ' selfSeeks = ' % i ' selfReads = ' % i ' selfOpens = ' % i ' selfDiskSize = ' % f ' > \ n " , <nl> - sDepth . c_str ( ) , str . c_str ( ) , p - > m_dSelfTime , p - > m_dSelfMemUsage , p - > m_dTotalTime , p - > m_dTotalMemUsage , p - > m_nCounter , <nl> - p - > m_totalInfo . m_nSeeksCount , p - > m_totalInfo . m_nFileReadCount , p - > m_totalInfo . m_nFileOpenCount , p - > m_totalInfo . m_dOperationSize , <nl> - p - > m_selfInfo . m_nSeeksCount , p - > m_selfInfo . m_nFileReadCount , p - > m_selfInfo . m_nFileOpenCount , p - > m_selfInfo . m_dOperationSize ) ; <nl> - <nl> - for ( size_t i = 0 , end = p - > m_pChilds . size ( ) ; i < end ; + + i ) <nl> - { <nl> - WriteTimeContainerToFile ( p - > m_pChilds [ i ] , f , depth + 1 , fMinTotalTime ) ; <nl> - } <nl> - <nl> - fprintf ( f , " % s < / % s > \ n " , sDepth . c_str ( ) , str . c_str ( ) ) ; <nl> - } <nl> - <nl> - void CLoadingProfilerSystem : : UpdateSelfStatistics ( SLoadingTimeContainer * p ) <nl> - { <nl> - if ( p = = NULL ) <nl> - return ; <nl> - <nl> - p - > m_dSelfMemUsage = 0 ; <nl> - p - > m_dSelfTime = 0 ; <nl> - p - > m_nCounter = 1 ; <nl> - p - > m_selfInfo . m_dOperationSize = 0 ; <nl> - p - > m_selfInfo . m_nFileOpenCount = 0 ; <nl> - p - > m_selfInfo . m_nFileReadCount = 0 ; <nl> - p - > m_selfInfo . m_nSeeksCount = 0 ; <nl> - <nl> - for ( size_t i = 0 , end = p - > m_pChilds . size ( ) ; i < end ; + + i ) <nl> - { <nl> - p - > m_dTotalMemUsage + = p - > m_pChilds [ i ] - > m_dTotalMemUsage ; <nl> - p - > m_dTotalTime + = p - > m_pChilds [ i ] - > m_dTotalTime ; <nl> - p - > m_totalInfo + = p - > m_pChilds [ i ] - > m_totalInfo ; <nl> - } <nl> - } <nl> - <nl> - void CLoadingProfilerSystem : : Clean ( ) <nl> - { <nl> - m_iActiveRoot = ( m_iActiveRoot + 1 ) % 2 ; <nl> - if ( m_pRoot [ m_iActiveRoot ] ) <nl> - delete m_pRoot [ m_iActiveRoot ] ; <nl> - m_pCurrentLoadingTimeContainer = m_pRoot [ m_iActiveRoot ] = 0 ; <nl> - <nl> - } <nl> - <nl> - # endif <nl> deleted file mode 100644 <nl> index 00c04fdcf2 . . 0000000000 <nl> mmm a / Code / CryEngine / CrySystem / LoadingProfiler . h <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # ifndef LOADINGPROFILERSYSTEM_H <nl> - # define LOADINGPROFILERSYSTEM_H <nl> - <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - <nl> - struct SLoadingTimeContainer ; <nl> - <nl> - struct SLoadingProfilerInfo <nl> - { <nl> - string name ; <nl> - double selfTime ; <nl> - double totalTime ; <nl> - uint32 callsTotal ; <nl> - double memorySize ; <nl> - <nl> - DiskOperationInfo selfInfo ; <nl> - DiskOperationInfo totalInfo ; <nl> - } ; <nl> - <nl> - class CLoadingProfilerSystem <nl> - { <nl> - public : <nl> - static void Init ( ) ; <nl> - static void ShutDown ( ) ; <nl> - static void CreateNoStackList ( PodArray < SLoadingTimeContainer > & ) ; <nl> - static void OutputLoadingTimeStats ( ILog * pLog , int nMode ) ; <nl> - static SLoadingTimeContainer * StartLoadingSectionProfiling ( CLoadingTimeProfiler * pProfiler , const char * szFuncName ) ; <nl> - static void EndLoadingSectionProfiling ( CLoadingTimeProfiler * pProfiler ) ; <nl> - static const char * GetLoadingProfilerCallstack ( ) ; <nl> - static void FillProfilersList ( std : : vector < SLoadingProfilerInfo > & profilers ) ; <nl> - static void FlushTimeContainers ( ) ; <nl> - static void SaveTimeContainersToFile ( const char * , double fMinTotalTime , bool bClean ) ; <nl> - static void WriteTimeContainerToFile ( SLoadingTimeContainer * p , FILE * f , unsigned int depth , double fMinTotalTime ) ; <nl> - static void UpdateSelfStatistics ( SLoadingTimeContainer * p ) ; <nl> - static void Clean ( ) ; <nl> - protected : <nl> - static void AddTimeContainerFunction ( PodArray < SLoadingTimeContainer > & , SLoadingTimeContainer * ) ; <nl> - protected : <nl> - static int nLoadingProfileMode ; <nl> - static int nLoadingProfilerNotTrackedAllocations ; <nl> - static CryCriticalSection csLock ; <nl> - static int m_iMaxArraySize ; <nl> - static SLoadingTimeContainer * m_pCurrentLoadingTimeContainer ; <nl> - static SLoadingTimeContainer * m_pRoot [ 2 ] ; <nl> - static int m_iActiveRoot ; <nl> - static ICVar * m_pEnableProfile ; <nl> - } ; <nl> - <nl> - # endif <nl> - <nl> - # endif / / LOADINGPROFILERSYSTEM_H <nl> mmm a / Code / CryEngine / CrySystem / Statistics . cpp <nl> ppp b / Code / CryEngine / CrySystem / Statistics . cpp <nl> <nl> # include < CryMemory / CryMemoryManager . h > <nl> # include < CryScriptSystem / IScriptSystem . h > <nl> # include < CryCore / ToolsHelpers / ResourceCompilerHelper . h > <nl> - # include " LoadingProfiler . h " <nl> # include " PhysRenderer . h " <nl> # include < CrySystem / File / IResourceManager . h > <nl> # include < CrySystem / Scaleform / IFlashPlayer . h > <nl> struct SCryEngineStats <nl> std : : vector < SPeakProfilerInfo > peaks ; <nl> std : : vector < SModuleProfilerInfo > moduleprofilers ; <nl> std : : vector < SAnimationStatistics > animations ; <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - std : : vector < SLoadingProfilerInfo > loading ; <nl> - # endif <nl> std : : vector < SEntityInfo > entities ; <nl> <nl> MemInfo memInfo ; <nl> class CEngineStats <nl> void CollectMemInfo ( ) ; <nl> void CollectProfileStatistics ( ) ; <nl> void CollectAnimations ( ) ; <nl> - void CollectLoadingData ( ) ; <nl> <nl> / / Arguments : <nl> / / pObj - 0 is ignored <nl> void CEngineStats : : Collect ( ) <nl> CollectEntities ( ) ; <nl> CollectProfileStatistics ( ) ; <nl> CollectAnimations ( ) ; <nl> - / / CollectLoadingData ( ) ; <nl> } <nl> <nl> inline bool CompareMaterialsByName ( IMaterial * pMat1 , IMaterial * pMat2 ) <nl> inline bool CompareAnimations ( const SAnimationStatistics & p1 , const SAnimationSt <nl> return p1 . count > p2 . count ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void CEngineStats : : CollectLoadingData ( ) <nl> - { <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - CLoadingProfilerSystem : : FillProfilersList ( m_stats . loading ) ; <nl> - # endif <nl> - } <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CEngineStats : : CollectAnimations ( ) <nl> { <nl> class CStatsToExcelExporter <nl> void ExportDependencies ( CResourceCollector & stats ) ; <nl> void ExportProfilerStatistics ( SCryEngineStats & stats ) ; <nl> void ExportAnimationStatistics ( SCryEngineStats & stats ) ; <nl> - void ExportAllLoadingStatistics ( SCryEngineStats & stats ) ; <nl> - void ExportLoadingStatistics ( SCryEngineStats & stats ) ; <nl> void ExportFPSBuckets ( ) ; <nl> void ExportPhysEntStatistics ( SCryEngineStats & stats ) ; <nl> void ExportEntitiesStatistics ( SCryEngineStats & stats ) ; <nl> void CStatsToExcelExporter : : Export ( XmlNodeRef Workbook , SCryEngineStats & stats ) <nl> ExportTimeDemoInfo ( ) ; <nl> ExportProfilerStatistics ( stats ) ; <nl> ExportAnimationStatistics ( stats ) ; <nl> - / / ExportAllLoadingStatistics ( stats ) ; <nl> ExportPhysEntStatistics ( stats ) ; <nl> ExportEntitiesStatistics ( stats ) ; <nl> ExportAnimationInfo ( stats ) ; <nl> void CStatsToExcelExporter : : ExportStatObjects ( SCryEngineStats & stats ) <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void CStatsToExcelExporter : : ExportAllLoadingStatistics ( SCryEngineStats & stats ) <nl> - { <nl> - ExportLoadingStatistics ( stats ) ; <nl> - } <nl> - <nl> struct CrySizerNaive : ICrySizer <nl> { <nl> CrySizerNaive ( ) : m_count ( 0 ) , m_size ( 0 ) { } <nl> struct CrySizerNaive : ICrySizer <nl> size_t m_count , m_size ; <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void CStatsToExcelExporter : : ExportLoadingStatistics ( SCryEngineStats & stats ) <nl> - { <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - NewWorksheet ( " Load Stats " ) ; <nl> - <nl> - FreezeFirstRow ( ) ; <nl> - <nl> - XmlNodeRef Column ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 300 ) ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 50 ) ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 50 ) ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 50 ) ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 50 ) ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 50 ) ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 50 ) ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 50 ) ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 50 ) ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 50 ) ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 50 ) ; <nl> - Column = m_CurrTable - > newChild ( " Column " ) ; <nl> - Column - > setAttr ( " ss : Width " , 50 ) ; <nl> - <nl> - AddRow ( ) ; <nl> - m_CurrRow - > setAttr ( " ss : StyleID " , " s25 " ) ; <nl> - AddCell ( " Function " ) ; <nl> - AddCell ( " Self ( sec ) " ) ; <nl> - AddCell ( " Total ( sec ) " ) ; <nl> - AddCell ( " Calls " ) ; <nl> - AddCell ( " Memory ( Mb ) " ) ; <nl> - AddCell ( " Read file size " ) ; <nl> - AddCell ( " Bandwith self ( Kb / s ) " ) ; <nl> - AddCell ( " Bandwith total ( Kb / s ) " ) ; <nl> - AddCell ( " FOpens self " ) ; <nl> - AddCell ( " FReads self " ) ; <nl> - AddCell ( " FSeeks self " ) ; <nl> - AddCell ( " FOpens total " ) ; <nl> - AddCell ( " FReads total " ) ; <nl> - AddCell ( " FSeeks total " ) ; <nl> - <nl> - int nRows = ( int ) stats . loading . size ( ) ; <nl> - for ( int i = 0 ; i < nRows ; i + + ) <nl> - { <nl> - SLoadingProfilerInfo & an = stats . loading [ i ] ; <nl> - AddRow ( ) ; <nl> - AddCell ( an . name ) ; <nl> - AddCell ( ( float ) an . selfTime ) ; <nl> - AddCell ( ( float ) an . totalTime ) ; <nl> - AddCell ( an . callsTotal ) ; <nl> - AddCell ( ( float ) an . memorySize ) ; <nl> - AddCell ( ( float ) an . selfInfo . m_dOperationSize / 1024 . 0f ) ; <nl> - float bandwithSelf = an . selfTime > 0 . ? ( float ) ( an . selfInfo . m_dOperationSize / an . selfTime / 1024 . 0 ) : 0 . 0f ; <nl> - float bandwithTotal = an . totalTime > 0 . ? ( float ) ( an . totalInfo . m_dOperationSize / an . totalTime / 1024 . 0 ) : 0 . 0f ; <nl> - AddCell ( bandwithSelf ) ; <nl> - AddCell ( bandwithTotal ) ; <nl> - AddCell ( an . selfInfo . m_nFileOpenCount ) ; <nl> - AddCell ( an . selfInfo . m_nFileReadCount ) ; <nl> - AddCell ( an . selfInfo . m_nSeeksCount ) ; <nl> - AddCell ( an . totalInfo . m_nFileOpenCount ) ; <nl> - AddCell ( an . totalInfo . m_nFileReadCount ) ; <nl> - AddCell ( an . totalInfo . m_nSeeksCount ) ; <nl> - } <nl> - # endif <nl> - } <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CStatsToExcelExporter : : ExportPhysEntStatistics ( SCryEngineStats & stats ) <nl> { <nl> mmm a / Code / CryEngine / CrySystem / System . cpp <nl> ppp b / Code / CryEngine / CrySystem / System . cpp <nl> <nl> # include < CryMemory / ILocalMemoryUsage . h > <nl> # include " ResourceManager . h " <nl> # include " MemoryManager . h " <nl> - # include " LoadingProfiler . h " <nl> # include < CryLiveCreate / ILiveCreateHost . h > <nl> # include < CryLiveCreate / ILiveCreateManager . h > <nl> # include " OverloadSceneManager / OverloadSceneManager . h " <nl> void CSystem : : ShutDown ( ) <nl> <nl> m_FrameProfileSystem . Enable ( false , false ) ; <nl> <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - CLoadingProfilerSystem : : ShutDown ( ) ; <nl> - # endif <nl> - <nl> if ( m_pSystemEventDispatcher ) <nl> { <nl> m_pSystemEventDispatcher - > RemoveListener ( this ) ; <nl> mmm a / Code / CryEngine / CrySystem / System . h <nl> ppp b / Code / CryEngine / CrySystem / System . h <nl> class CCpuFeatures ; <nl> class CCryPluginManager ; <nl> class CDownloadManager ; <nl> class CJSONUtils ; <nl> - class CLoadingProfilerSystem ; <nl> class CLocalizedStringsManager ; <nl> class CManualFrameStepController ; <nl> class CMTRand_int32 ; <nl> class CSystem final : public ISystem , public ILoadConfigurationEntrySink , public <nl> <nl> uint64 m_nUpdateCounter ; <nl> <nl> - int sys_ProfileLevelLoading , sys_ProfileLevelLoadingDump ; <nl> - <nl> / / MT random generator <nl> CryCriticalSection m_mtLock ; <nl> CMTRand_int32 * m_pMtState ; <nl> class CSystem final : public ISystem , public ILoadConfigurationEntrySink , public <nl> void Deltree ( const char * szFolder , bool bRecurse ) ; <nl> void UpdateMovieSystem ( const int updateFlags , const float fFrameTime , const bool bPreUpdate ) ; <nl> <nl> - / / level loading profiling <nl> - virtual void OutputLoadingTimeStats ( ) override ; <nl> - virtual struct SLoadingTimeContainer * StartLoadingSectionProfiling ( CLoadingTimeProfiler * pProfiler , const char * szFuncName ) override ; <nl> - virtual void EndLoadingSectionProfiling ( CLoadingTimeProfiler * pProfiler ) override ; <nl> - virtual const char * GetLoadingProfilerCallstack ( ) override ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> virtual CBootProfilerRecord * StartBootSectionProfiler ( const char * name , const char * args , EProfileDescription type ) override ; <nl> virtual void StopBootSectionProfiler ( CBootProfilerRecord * record ) override ; <nl> mmm a / Code / CryEngine / CrySystem / SystemInit . cpp <nl> ppp b / Code / CryEngine / CrySystem / SystemInit . cpp <nl> <nl> # include " SystemCFG . h " <nl> # include " AutoDetectSpec . h " <nl> # include " ResourceManager . h " <nl> - # include " LoadingProfiler . h " <nl> # include " BootProfiler . h " <nl> # include " DiskProfiler . h " <nl> # include " Watchdog . h " <nl> void CSystem : : OpenLanguageAudioPak ( char const * const szLanguage ) <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void OnLevelLoadingDump ( ICVar * pArgs ) <nl> - { <nl> - gEnv - > pSystem - > OutputLoadingTimeStats ( ) ; <nl> - } <nl> - <nl> # if CRY_PLATFORM_WINDOWS <nl> static wstring GetErrorStringUnsupportedCPU ( ) <nl> { <nl> bool CSystem : : Initialize ( SSystemInitParams & startupParams ) <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> InlineInitializationProcessing ( " CSystem : : Init InitFileSystem " ) ; <nl> <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - CLoadingProfilerSystem : : Init ( ) ; <nl> - # endif <nl> - <nl> / / here we should be good to ask Crypak to do something <nl> <nl> / / # define GEN_PAK_CDR_CRC <nl> bool CSystem : : Initialize ( SSystemInitParams & startupParams ) <nl> m_env . pThreadManager - > EnableFloatExceptions ( ( EFPE_Severity ) g_cvars . sys_float_exceptions ) ; <nl> } <nl> <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - CLoadingProfilerSystem : : SaveTimeContainersToFile ( " EngineStart . crylp " , 0 . 0 , true ) ; <nl> - # endif <nl> - <nl> InlineInitializationProcessing ( " CSystem : : Init End " ) ; <nl> <nl> # if defined ( DEDICATED_SERVER ) <nl> void CSystem : : CreateSystemVars ( ) <nl> " e . g . LoadConfig lowspec . cfg \ n " <nl> " Usage : LoadConfig < filename > " ) ; <nl> <nl> - REGISTER_CVAR ( sys_ProfileLevelLoading , 0 , VF_CHEAT , <nl> - " Output level loading stats into log \ n " <nl> - " 0 = Off \ n " <nl> - " 1 = Output basic info about loading time per function \ n " <nl> - " 2 = Output full statistics including loading time and memory allocations with call stack info " ) ; <nl> - <nl> - REGISTER_CVAR_CB ( sys_ProfileLevelLoadingDump , 0 , VF_CHEAT , " Output level loading dump stats into log \ n " , OnLevelLoadingDump ) ; <nl> - <nl> # if defined ( USE_SCHEMATYC ) & & defined ( USE_SCHEMATYC_EXPERIMENTAL ) <nl> static const int default_sys_SchematycPlugin = 0 ; <nl> # elif defined ( USE_SCHEMATYC_EXPERIMENTAL ) <nl> void CSystem : : AddCVarGroupDirectory ( const string & sPath ) <nl> gEnv - > pCryPak - > FindClose ( handle ) ; <nl> } <nl> <nl> - void CSystem : : OutputLoadingTimeStats ( ) <nl> - { <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - if ( GetIConsole ( ) ) <nl> - if ( ICVar * pVar = GetIConsole ( ) - > GetCVar ( " sys_ProfileLevelLoading " ) ) <nl> - CLoadingProfilerSystem : : OutputLoadingTimeStats ( GetILog ( ) , pVar - > GetIVal ( ) ) ; <nl> - # endif <nl> - } <nl> - <nl> - SLoadingTimeContainer * CSystem : : StartLoadingSectionProfiling ( CLoadingTimeProfiler * pProfiler , const char * szFuncName ) <nl> - { <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - return CLoadingProfilerSystem : : StartLoadingSectionProfiling ( pProfiler , szFuncName ) ; <nl> - # else <nl> - return 0 ; <nl> - # endif <nl> - } <nl> - <nl> - void CSystem : : EndLoadingSectionProfiling ( CLoadingTimeProfiler * pProfiler ) <nl> - { <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - CLoadingProfilerSystem : : EndLoadingSectionProfiling ( pProfiler ) ; <nl> - # endif <nl> - } <nl> - <nl> - const char * CSystem : : GetLoadingProfilerCallstack ( ) <nl> - { <nl> - # if defined ( ENABLE_LOADING_PROFILER ) <nl> - return CLoadingProfilerSystem : : GetLoadingProfilerCallstack ( ) ; <nl> - # else <nl> - return 0 ; <nl> - # endif <nl> - } <nl> - <nl> CBootProfilerRecord * CSystem : : StartBootSectionProfiler ( const char * name , const char * args , EProfileDescription type ) <nl> { <nl> # if defined ( ENABLE_LOADING_PROFILER ) <nl> mmm a / Code / CryEngine / CrySystem / SystemWin32 . cpp <nl> ppp b / Code / CryEngine / CrySystem / SystemWin32 . cpp <nl> void CSystem : : FatalError ( const char * format , . . . ) <nl> if ( szSysErrorMessage ) <nl> CryLogAlways ( " < CrySystem > Last System Error : % s " , szSysErrorMessage ) ; <nl> <nl> - if ( const char * pLoadingProfilerCallstack = GetLoadingProfilerCallstack ( ) ) <nl> - if ( pLoadingProfilerCallstack [ 0 ] ) <nl> - CryLogAlways ( " < CrySystem > LoadingProfilerCallstack : % s " , pLoadingProfilerCallstack ) ; <nl> - <nl> assert ( szBuffer [ 0 ] > = ' ' ) ; <nl> / / strcpy ( szBuffer , szBuffer + 1 ) ; / / remove verbosity tag since it is not supported by : : MessageBox <nl> <nl> mmm a / Code / GameTemplates / cpp / FirstPersonShooter / Code / Components / Player . cpp <nl> ppp b / Code / GameTemplates / cpp / FirstPersonShooter / Code / Components / Player . cpp <nl> void CPlayerComponent : : UpdateLookDirectionRequest ( float frameTime ) <nl> const float rotationLimitsMinPitch = - 0 . 84f ; <nl> const float rotationLimitsMaxPitch = 1 . 5f ; <nl> <nl> - if ( m_mouseDeltaRotation . IsEquivalent ( ZERO , MOUSE_DELTA_TRESHOLD ) ) <nl> - return ; <nl> - <nl> / / Apply smoothing filter to the mouse input <nl> m_mouseDeltaRotation = m_mouseDeltaSmoothingFilter . Push ( m_mouseDeltaRotation ) . Get ( ) ; <nl> <nl> void CPlayerComponent : : UpdateLookDirectionRequest ( float frameTime ) <nl> m_horizontalAngularVelocity = ( m_mouseDeltaRotation . x * rotationSpeed ) / frameTime ; <nl> m_averagedHorizontalAngularVelocity . Push ( m_horizontalAngularVelocity ) ; <nl> <nl> + if ( m_mouseDeltaRotation . IsEquivalent ( ZERO , MOUSE_DELTA_TRESHOLD ) ) <nl> + return ; <nl> + <nl> / / Start with updating look orientation from the latest input <nl> Ang3 ypr = CCamera : : CreateAnglesYPR ( Matrix33 ( m_lookOrientation ) ) ; <nl> <nl>
|
! I integrate from / / ce / main . . .
|
CRYTEK/CRYENGINE
|
fc952cefdc95eb6300a08e52fd026b51e9c21197
|
2018-12-19T11:03:09Z
|
mmm a / src / Storages / MergeTree / MergeTreeSettings . h <nl> ppp b / src / Storages / MergeTree / MergeTreeSettings . h <nl> struct Settings ; <nl> M ( UInt64 , min_replicated_logs_to_keep , 10 , " Keep about this number of last records in ZooKeeper log , even if they are obsolete . It doesn ' t affect work of tables : used only to diagnose ZooKeeper log before cleaning . " , 0 ) \ <nl> M ( Seconds , prefer_fetch_merged_part_time_threshold , 3600 , " If time passed after replication log entry creation exceeds this threshold and sum size of parts is greater than \ " prefer_fetch_merged_part_size_threshold \ " , prefer fetching merged part from replica instead of doing merge locally . To speed up very long merges . " , 0 ) \ <nl> M ( UInt64 , prefer_fetch_merged_part_size_threshold , 10ULL * 1024 * 1024 * 1024 , " If sum size of parts exceeds this threshold and time passed after replication log entry creation is greater than \ " prefer_fetch_merged_part_time_threshold \ " , prefer fetching merged part from replica instead of doing merge locally . To speed up very long merges . " , 0 ) \ <nl> + M ( Seconds , execute_merges_on_single_replica_time_threshold , 0 , " When greater than zero only a single replica starts the merge immediately , others wait up to that amount of time to download the result instead of doing merges locally . If the chosen replica doesn ' t finish the merge during that amount of time , fallback to standard behavior happens . " , 0 ) \ <nl> M ( Seconds , try_fetch_recompressed_part_timeout , 7200 , " Recompression works slow in most cases , so we don ' t start merge with recompression until this timeout and trying to fetch recompressed part from replica which assigned this merge with recompression . " , 0 ) \ <nl> M ( Bool , always_fetch_merged_part , 0 , " If true , replica never merge parts and always download merged parts from other replicas . " , 0 ) \ <nl> M ( UInt64 , max_suspicious_broken_parts , 10 , " Max broken parts , if more - deny automatic deletion . " , 0 ) \ <nl> new file mode 100644 <nl> index 00000000000 . . d90183abd95 <nl> mmm / dev / null <nl> ppp b / src / Storages / MergeTree / ReplicatedMergeTreeMergeStrategyPicker . cpp <nl> <nl> + # include < Storages / MergeTree / ReplicatedMergeTreeMergeStrategyPicker . h > <nl> + # include < Storages / StorageReplicatedMergeTree . h > <nl> + # include < Storages / MergeTree / ReplicatedMergeTreeLogEntry . h > <nl> + <nl> + <nl> + # include < common / types . h > <nl> + # include < optional > <nl> + # include < mutex > <nl> + # include < city . h > <nl> + # include < algorithm > <nl> + # include < atomic > <nl> + <nl> + namespace DB <nl> + { <nl> + <nl> + / / / minimum interval ( seconds ) between checks if chosen replica finished the merge . <nl> + static const auto RECHECK_MERGE_READYNESS_INTERVAL_SECONDS = 1 ; <nl> + <nl> + / / / don ' t refresh state too often ( to limit number of zookeeper ops ) <nl> + static const auto REFRESH_STATE_MINIMUM_INTERVAL_SECONDS = 3 ; <nl> + <nl> + / / / refresh the state automatically it it was not refreshed for a longer time <nl> + static const auto REFRESH_STATE_MAXIMUM_INTERVAL_SECONDS = 30 ; <nl> + <nl> + <nl> + ReplicatedMergeTreeMergeStrategyPicker : : ReplicatedMergeTreeMergeStrategyPicker ( StorageReplicatedMergeTree & storage_ ) <nl> + : storage ( storage_ ) <nl> + { } <nl> + <nl> + <nl> + bool ReplicatedMergeTreeMergeStrategyPicker : : isMergeFinishedByReplica ( const String & replica , const ReplicatedMergeTreeLogEntryData & entry ) <nl> + { <nl> + / / / those have only seconds resolution , so recheck period is quite rough <nl> + auto reference_timestamp = entry . last_postpone_time ; <nl> + if ( reference_timestamp = = 0 ) <nl> + reference_timestamp = entry . create_time ; <nl> + <nl> + / / / we don ' t want to check zookeeper too frequent <nl> + if ( time ( nullptr ) - reference_timestamp > = RECHECK_MERGE_READYNESS_INTERVAL_SECONDS ) <nl> + { <nl> + return storage . checkReplicaHavePart ( replica , entry . new_part_name ) ; <nl> + } <nl> + <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + bool ReplicatedMergeTreeMergeStrategyPicker : : shouldMergeOnSingleReplica ( const ReplicatedMergeTreeLogEntryData & entry ) const <nl> + { <nl> + time_t threshold = execute_merges_on_single_replica_time_threshold ; <nl> + return ( <nl> + threshold > 0 / / / feature turned on <nl> + & & entry . type = = ReplicatedMergeTreeLogEntry : : MERGE_PARTS / / / it is a merge log entry <nl> + & & entry . create_time + threshold > time ( nullptr ) / / / not too much time waited <nl> + ) ; <nl> + } <nl> + <nl> + <nl> + / / / that will return the same replica name for ReplicatedMergeTreeLogEntry on all the replicas ( if the replica set is the same ) . <nl> + / / / that way each replica knows who is responsible for doing a certain merge . <nl> + <nl> + / / / in some corner cases ( added / removed / deactivated replica ) <nl> + / / / nodes can pick different replicas to execute merge and wait for it ( or to execute the same merge together ) <nl> + / / / but that doesn ' t have a significant impact ( in one case it will wait for the execute_merges_on_single_replica_time_threshold , <nl> + / / / in another just 2 replicas will do the merge ) <nl> + std : : optional < String > ReplicatedMergeTreeMergeStrategyPicker : : pickReplicaToExecuteMerge ( const ReplicatedMergeTreeLogEntryData & entry ) <nl> + { <nl> + / / / last state refresh was too long ago , need to sync up the replicas list <nl> + if ( time ( nullptr ) - last_refresh_time > REFRESH_STATE_MAXIMUM_INTERVAL_SECONDS ) <nl> + refreshState ( ) ; <nl> + <nl> + auto hash = getEntryHash ( entry ) ; <nl> + <nl> + std : : lock_guard lock ( mutex ) ; <nl> + <nl> + auto num_replicas = active_replicas . size ( ) ; <nl> + <nl> + if ( num_replicas = = 0 ) <nl> + return std : : nullopt ; <nl> + <nl> + auto replica_index = static_cast < int > ( hash % num_replicas ) ; <nl> + <nl> + if ( replica_index = = current_replica_index ) <nl> + return std : : nullopt ; <nl> + <nl> + return active_replicas . at ( replica_index ) ; <nl> + } <nl> + <nl> + <nl> + void ReplicatedMergeTreeMergeStrategyPicker : : refreshState ( ) <nl> + { <nl> + auto threshold = storage . getSettings ( ) - > execute_merges_on_single_replica_time_threshold . totalSeconds ( ) ; <nl> + <nl> + if ( threshold = = 0 ) <nl> + { <nl> + / / / we can reset the settings w / o lock ( it ' s atomic ) <nl> + execute_merges_on_single_replica_time_threshold = threshold ; <nl> + return ; <nl> + } <nl> + <nl> + auto now = time ( nullptr ) ; <nl> + <nl> + / / / the setting was already enabled , and last state refresh was done recently <nl> + if ( execute_merges_on_single_replica_time_threshold ! = 0 <nl> + & & now - last_refresh_time < REFRESH_STATE_MINIMUM_INTERVAL_SECONDS ) <nl> + return ; <nl> + <nl> + auto zookeeper = storage . getZooKeeper ( ) ; <nl> + auto all_replicas = zookeeper - > getChildren ( storage . zookeeper_path + " / replicas " ) ; <nl> + <nl> + std : : sort ( all_replicas . begin ( ) , all_replicas . end ( ) ) ; <nl> + <nl> + std : : vector < String > active_replicas_tmp ; <nl> + int current_replica_index_tmp = - 1 ; <nl> + <nl> + for ( const String & replica : all_replicas ) <nl> + { <nl> + if ( zookeeper - > exists ( storage . zookeeper_path + " / replicas / " + replica + " / is_active " ) ) <nl> + { <nl> + active_replicas_tmp . push_back ( replica ) ; <nl> + if ( replica = = storage . replica_name ) <nl> + { <nl> + current_replica_index_tmp = active_replicas_tmp . size ( ) - 1 ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( current_replica_index_tmp < 0 | | active_replicas_tmp . size ( ) < 2 ) <nl> + { <nl> + LOG_WARNING ( storage . log , " Can ' t find current replica in the active replicas list , or too few active replicas to use execute_merges_on_single_replica_time_threshold ! " ) ; <nl> + / / / we can reset the settings w / o lock ( it ' s atomic ) <nl> + execute_merges_on_single_replica_time_threshold = 0 ; <nl> + return ; <nl> + } <nl> + <nl> + std : : lock_guard lock ( mutex ) ; <nl> + execute_merges_on_single_replica_time_threshold = threshold ; <nl> + last_refresh_time = now ; <nl> + current_replica_index = current_replica_index_tmp ; <nl> + active_replicas = active_replicas_tmp ; <nl> + } <nl> + <nl> + <nl> + uint64_t ReplicatedMergeTreeMergeStrategyPicker : : getEntryHash ( const ReplicatedMergeTreeLogEntryData & entry ) const <nl> + { <nl> + auto hash_data = storage . zookeeper_path + entry . new_part_name ; <nl> + return CityHash_v1_0_2 : : CityHash64 ( hash_data . c_str ( ) , hash_data . length ( ) ) ; <nl> + } <nl> + <nl> + <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 02a760d1ace <nl> mmm / dev / null <nl> ppp b / src / Storages / MergeTree / ReplicatedMergeTreeMergeStrategyPicker . h <nl> <nl> + # pragma once <nl> + <nl> + # include < common / types . h > <nl> + # include < optional > <nl> + # include < mutex > <nl> + # include < vector > <nl> + # include < atomic > <nl> + # include < boost / noncopyable . hpp > <nl> + <nl> + namespace DB <nl> + { <nl> + <nl> + class StorageReplicatedMergeTree ; <nl> + struct ReplicatedMergeTreeLogEntryData ; <nl> + <nl> + / / / In some use cases merging can be more expensive than fetching <nl> + / / / ( so instead of doing exactly the same merge cluster - wise you can do merge once and fetch ready part ) <nl> + / / / Fetches may be desirable for other operational reasons ( backup replica without lot of CPU resources ) . <nl> + / / / <nl> + / / / That class allow to take a decisions about preferred strategy for a concreate merge . <nl> + / / / <nl> + / / / Since that code is used in shouldExecuteLogEntry we need to be able to : <nl> + / / / 1 ) make decision fast <nl> + / / / 2 ) avoid excessive zookeeper operations <nl> + / / / <nl> + / / / Because of that we need to cache some important things , <nl> + / / / like list of active replicas ( to limit the number of zookeeper operations ) <nl> + / / / <nl> + / / / That means we need to refresh the state of that object regularly <nl> + / / / <nl> + / / / NOTE : This class currently supports only single feature ( execute_merges_on_single_replica_time_threshold ) , <nl> + / / / may be extended to postpone merges in some other scenarios , namely <nl> + / / / * always_fetch_merged_part <nl> + / / / * try_fetch_recompressed_part_timeout <nl> + / / / * ( maybe , not for postpone ) prefer_fetch_merged_part_time_threshold <nl> + / / / <nl> + / / / NOTE : execute_merges_on_single_replica_time_threshold feature doesn ' t provide any strict guarantees . <nl> + / / / When some replicas are added / removed we may execute some merges on more than one replica , <nl> + / / / or not execute merge on any of replicas during execute_merges_on_single_replica_time_threshold interval . <nl> + / / / ( so it may be a bad idea to set that threshold to high values ) . <nl> + / / / <nl> + class ReplicatedMergeTreeMergeStrategyPicker : public boost : : noncopyable <nl> + { <nl> + public : <nl> + ReplicatedMergeTreeMergeStrategyPicker ( StorageReplicatedMergeTree & storage_ ) ; <nl> + <nl> + / / / triggers refreshing the cached state ( list of replicas etc . ) <nl> + / / / used when we get new merge event from the zookeeper queue ( see queueUpdatingTask ( ) etc ) <nl> + void refreshState ( ) ; <nl> + <nl> + / / / return true if execute_merges_on_single_replica_time_threshold feature is active <nl> + / / / and we may need to do a fetch ( or postpone ) instead of merge <nl> + bool shouldMergeOnSingleReplica ( const ReplicatedMergeTreeLogEntryData & entry ) const ; <nl> + <nl> + / / / returns the replica name <nl> + / / / and it ' s not current replica should do the merge <nl> + / / / used in shouldExecuteLogEntry and in tryExecuteMerge <nl> + std : : optional < String > pickReplicaToExecuteMerge ( const ReplicatedMergeTreeLogEntryData & entry ) ; <nl> + <nl> + / / / checks ( in zookeeper ) if the picked replica finished the merge <nl> + bool isMergeFinishedByReplica ( const String & replica , const ReplicatedMergeTreeLogEntryData & entry ) ; <nl> + <nl> + private : <nl> + StorageReplicatedMergeTree & storage ; <nl> + <nl> + / / / calculate entry hash based on zookeeper path and new part name <nl> + / / / ATTENTION : it ' s not a general - purpose hash , it just allows to select replicas consistently <nl> + uint64_t getEntryHash ( const ReplicatedMergeTreeLogEntryData & entry ) const ; <nl> + <nl> + std : : atomic < time_t > execute_merges_on_single_replica_time_threshold = 0 ; <nl> + std : : atomic < time_t > last_refresh_time = 0 ; <nl> + <nl> + std : : mutex mutex ; <nl> + <nl> + / / / those 2 members accessed under the mutex , only when <nl> + / / / execute_merges_on_single_replica_time_threshold enabled <nl> + int current_replica_index = - 1 ; <nl> + std : : vector < String > active_replicas ; <nl> + <nl> + } ; <nl> + <nl> + } <nl> mmm a / src / Storages / MergeTree / ReplicatedMergeTreeQueue . cpp <nl> ppp b / src / Storages / MergeTree / ReplicatedMergeTreeQueue . cpp <nl> <nl> # include < Storages / MergeTree / IMergeTreeDataPart . h > <nl> # include < Storages / MergeTree / MergeTreeDataMergerMutator . h > <nl> # include < Storages / MergeTree / ReplicatedMergeTreeQuorumEntry . h > <nl> + # include < Storages / MergeTree / ReplicatedMergeTreeMergeStrategyPicker . h > <nl> # include < Common / StringUtils / StringUtils . h > <nl> <nl> <nl> namespace ErrorCodes <nl> } <nl> <nl> <nl> - ReplicatedMergeTreeQueue : : ReplicatedMergeTreeQueue ( StorageReplicatedMergeTree & storage_ ) <nl> + ReplicatedMergeTreeQueue : : ReplicatedMergeTreeQueue ( StorageReplicatedMergeTree & storage_ , ReplicatedMergeTreeMergeStrategyPicker & merge_strategy_picker_ ) <nl> : storage ( storage_ ) <nl> + , merge_strategy_picker ( merge_strategy_picker_ ) <nl> , format_version ( storage . format_version ) <nl> , current_parts ( format_version ) <nl> , virtual_parts ( format_version ) <nl> bool ReplicatedMergeTreeQueue : : load ( zkutil : : ZooKeeperPtr zookeeper ) <nl> <nl> updateTimesInZooKeeper ( zookeeper , min_unprocessed_insert_time_changed , { } ) ; <nl> <nl> + merge_strategy_picker . refreshState ( ) ; <nl> + <nl> LOG_TRACE ( log , " Loaded queue " ) ; <nl> return updated ; <nl> } <nl> int32_t ReplicatedMergeTreeQueue : : pullLogsToQueue ( zkutil : : ZooKeeperPtr zookeeper <nl> } <nl> <nl> if ( ! copied_entries . empty ( ) ) <nl> + { <nl> LOG_DEBUG ( log , " Pulled { } entries to queue . " , copied_entries . size ( ) ) ; <nl> + merge_strategy_picker . refreshState ( ) ; <nl> + } <nl> } <nl> <nl> storage . background_executor . triggerTask ( ) ; <nl> bool ReplicatedMergeTreeQueue : : shouldExecuteLogEntry ( <nl> return false ; <nl> } <nl> <nl> + if ( merge_strategy_picker . shouldMergeOnSingleReplica ( entry ) ) <nl> + { <nl> + auto replica_to_execute_merge = merge_strategy_picker . pickReplicaToExecuteMerge ( entry ) ; <nl> + <nl> + if ( replica_to_execute_merge & & ! merge_strategy_picker . isMergeFinishedByReplica ( replica_to_execute_merge . value ( ) , entry ) ) <nl> + { <nl> + String reason = " Not executing merge for the part " + entry . new_part_name <nl> + + " , waiting for " + replica_to_execute_merge . value ( ) + " to execute merge . " ; <nl> + out_postpone_reason = reason ; <nl> + return false ; <nl> + } <nl> + } <nl> + <nl> UInt64 max_source_parts_size = entry . type = = LogEntry : : MERGE_PARTS ? merger_mutator . getMaxSourcePartsSizeForMerge ( ) <nl> : merger_mutator . getMaxSourcePartSizeForMutation ( ) ; <nl> / * * If there are enough free threads in background pool to do large merges ( maximal size of merge is allowed ) , <nl> mmm a / src / Storages / MergeTree / ReplicatedMergeTreeQueue . h <nl> ppp b / src / Storages / MergeTree / ReplicatedMergeTreeQueue . h <nl> class StorageReplicatedMergeTree ; <nl> class MergeTreeDataMergerMutator ; <nl> <nl> class ReplicatedMergeTreeMergePredicate ; <nl> + class ReplicatedMergeTreeMergeStrategyPicker ; <nl> <nl> <nl> class ReplicatedMergeTreeQueue <nl> class ReplicatedMergeTreeQueue <nl> using InsertsByTime = std : : set < LogEntryPtr , ByTime > ; <nl> <nl> StorageReplicatedMergeTree & storage ; <nl> + ReplicatedMergeTreeMergeStrategyPicker & merge_strategy_picker ; <nl> MergeTreeDataFormatVersion format_version ; <nl> <nl> String zookeeper_path ; <nl> class ReplicatedMergeTreeQueue <nl> size_t current_multi_batch_size = 1 ; <nl> <nl> public : <nl> - ReplicatedMergeTreeQueue ( StorageReplicatedMergeTree & storage_ ) ; <nl> + ReplicatedMergeTreeQueue ( StorageReplicatedMergeTree & storage_ , ReplicatedMergeTreeMergeStrategyPicker & merge_strategy_picker_ ) ; <nl> ~ ReplicatedMergeTreeQueue ( ) ; <nl> <nl> <nl> mmm a / src / Storages / StorageReplicatedMergeTree . cpp <nl> ppp b / src / Storages / StorageReplicatedMergeTree . cpp <nl> static const auto MERGE_SELECTING_SLEEP_MS = 5 * 1000 ; <nl> static const auto MUTATIONS_FINALIZING_SLEEP_MS = 1 * 1000 ; <nl> static const auto MUTATIONS_FINALIZING_IDLE_SLEEP_MS = 5 * 1000 ; <nl> <nl> - <nl> void StorageReplicatedMergeTree : : setZooKeeper ( zkutil : : ZooKeeperPtr zookeeper ) <nl> { <nl> std : : lock_guard lock ( current_zookeeper_mutex ) ; <nl> StorageReplicatedMergeTree : : StorageReplicatedMergeTree ( <nl> , reader ( * this ) <nl> , writer ( * this ) <nl> , merger_mutator ( * this , global_context . getSettingsRef ( ) . background_pool_size ) <nl> - , queue ( * this ) <nl> + , merge_strategy_picker ( * this ) <nl> + , queue ( * this , merge_strategy_picker ) <nl> , fetcher ( * this ) <nl> , background_executor ( * this , global_context ) <nl> , background_moves_executor ( * this , global_context ) <nl> bool StorageReplicatedMergeTree : : tryExecuteMerge ( const LogEntry & entry ) <nl> return false ; <nl> } <nl> <nl> + / / / In some use cases merging can be more expensive than fetching <nl> + / / / and it may be better to spread merges tasks across the replicas <nl> + / / / instead of doing exactly the same merge cluster - wise <nl> + if ( merge_strategy_picker . shouldMergeOnSingleReplica ( entry ) ) <nl> + { <nl> + auto replica_to_execute_merge = merge_strategy_picker . pickReplicaToExecuteMerge ( entry ) ; <nl> + <nl> + if ( replica_to_execute_merge ) <nl> + { <nl> + LOG_DEBUG ( log , " Prefer fetching part { } from replica { } due execute_merges_on_single_replica_time_threshold " , entry . new_part_name , replica_to_execute_merge . value ( ) ) ; <nl> + return false ; <nl> + } <nl> + } <nl> + <nl> DataPartsVector parts ; <nl> bool have_all_parts = true ; <nl> for ( const String & name : entry . source_parts ) <nl> void StorageReplicatedMergeTree : : exitLeaderElection ( ) <nl> leader_election = nullptr ; <nl> } <nl> <nl> + bool StorageReplicatedMergeTree : : checkReplicaHavePart ( const String & replica , const String & part_name ) <nl> + { <nl> + auto zookeeper = getZooKeeper ( ) ; <nl> + return zookeeper - > exists ( zookeeper_path + " / replicas / " + replica + " / parts / " + part_name ) ; <nl> + } <nl> <nl> String StorageReplicatedMergeTree : : findReplicaHavingPart ( const String & part_name , bool active ) <nl> { <nl> String StorageReplicatedMergeTree : : findReplicaHavingPart ( const String & part_nam <nl> if ( replica = = replica_name ) <nl> continue ; <nl> <nl> - if ( zookeeper - > exists ( zookeeper_path + " / replicas / " + replica + " / parts / " + part_name ) & & <nl> + if ( checkReplicaHavePart ( replica , part_name ) & & <nl> ( ! active | | zookeeper - > exists ( zookeeper_path + " / replicas / " + replica + " / is_active " ) ) ) <nl> return replica ; <nl> <nl> void StorageReplicatedMergeTree : : alter ( <nl> StorageInMemoryMetadata future_metadata = getInMemoryMetadata ( ) ; <nl> commands . apply ( future_metadata , query_context ) ; <nl> <nl> + merge_strategy_picker . refreshState ( ) ; <nl> + <nl> changeSettings ( future_metadata . settings_changes , table_lock_holder ) ; <nl> <nl> DatabaseCatalog : : instance ( ) . getDatabase ( table_id . database_name ) - > alterTable ( query_context , table_id , future_metadata ) ; <nl> mmm a / src / Storages / StorageReplicatedMergeTree . h <nl> ppp b / src / Storages / StorageReplicatedMergeTree . h <nl> <nl> # include < Storages / MergeTree / ReplicatedMergeTreeQueue . h > <nl> # include < Storages / MergeTree / ReplicatedMergeTreeCleanupThread . h > <nl> # include < Storages / MergeTree / ReplicatedMergeTreeRestartingThread . h > <nl> + # include < Storages / MergeTree / ReplicatedMergeTreeMergeStrategyPicker . h > <nl> # include < Storages / MergeTree / ReplicatedMergeTreePartCheckThread . h > <nl> # include < Storages / MergeTree / ReplicatedMergeTreeTableMetadata . h > <nl> # include < Storages / MergeTree / EphemeralLockInZooKeeper . h > <nl> class StorageReplicatedMergeTree final : public ext : : shared_ptr_helper < StorageRe <nl> bool canExecuteFetch ( const ReplicatedMergeTreeLogEntry & entry , String & disable_reason ) const ; <nl> <nl> private : <nl> - <nl> / / / Get a sequential consistent view of current parts . <nl> ReplicatedMergeTreeQuorumAddedParts : : PartitionIdToMaxBlock getMaxAddedBlocks ( ) const ; <nl> <nl> class StorageReplicatedMergeTree final : public ext : : shared_ptr_helper < StorageRe <nl> friend class ReplicatedMergeTreeCleanupThread ; <nl> friend class ReplicatedMergeTreeAlterThread ; <nl> friend class ReplicatedMergeTreeRestartingThread ; <nl> + friend class ReplicatedMergeTreeMergeStrategyPicker ; <nl> friend struct ReplicatedMergeTreeLogEntry ; <nl> friend class ScopedPartitionMergeLock ; <nl> friend class ReplicatedMergeTreeQueue ; <nl> friend class MergeTreeData ; <nl> <nl> + using MergeStrategyPicker = ReplicatedMergeTreeMergeStrategyPicker ; <nl> using LogEntry = ReplicatedMergeTreeLogEntry ; <nl> using LogEntryPtr = LogEntry : : Ptr ; <nl> <nl> class StorageReplicatedMergeTree final : public ext : : shared_ptr_helper < StorageRe <nl> MergeTreeDataWriter writer ; <nl> MergeTreeDataMergerMutator merger_mutator ; <nl> <nl> + MergeStrategyPicker merge_strategy_picker ; <nl> + <nl> / * * The queue of what needs to be done on this replica to catch up with everyone . It is taken from ZooKeeper ( / replicas / me / queue / ) . <nl> * In ZK entries in chronological order . Here it is not necessary . <nl> * / <nl> class StorageReplicatedMergeTree final : public ext : : shared_ptr_helper < StorageRe <nl> * / <nl> String findReplicaHavingPart ( const String & part_name , bool active ) ; <nl> <nl> + bool checkReplicaHavePart ( const String & replica , const String & part_name ) ; <nl> + <nl> / * * Find replica having specified part or any part that covers it . <nl> * If active = true , consider only active replicas . <nl> * If found , returns replica name and set ' entry - > actual_new_part_name ' to name of found largest covering part . <nl> mmm a / src / Storages / ya . make <nl> ppp b / src / Storages / ya . make <nl> SRCS ( <nl> MergeTree / ReplicatedMergeTreeBlockOutputStream . cpp <nl> MergeTree / ReplicatedMergeTreeCleanupThread . cpp <nl> MergeTree / ReplicatedMergeTreeLogEntry . cpp <nl> + MergeTree / ReplicatedMergeTreeMergeStrategyPicker . cpp <nl> MergeTree / ReplicatedMergeTreeMutationEntry . cpp <nl> MergeTree / ReplicatedMergeTreePartCheckThread . cpp <nl> MergeTree / ReplicatedMergeTreePartHeader . cpp <nl> new file mode 100644 <nl> index 00000000000 . . 171ce28cbd7 <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01532_execute_merges_on_single_replica . reference <nl> <nl> + # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> + # # # emulate normal feature operation - merges are distributed between replicas <nl> + # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> + # # # emulate execute_merges_on_single_replica_time_threshold timeout <nl> + # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> + # # # timeout not exceeded , r1 waits for r2 <nl> + Row 1 : <nl> + ─ ─ ─ ─ ─ ─ <nl> + table : execute_on_single_replica_r1 <nl> + type : MERGE_PARTS <nl> + new_part_name : all_0_0_5 <nl> + has_postpones : 1 <nl> + postpone_reason : Not executing merge for the part all_0_0_5 , waiting for r2 to execute merge . <nl> + <nl> + Row 2 : <nl> + ─ ─ ─ ─ ─ ─ <nl> + table : execute_on_single_replica_r2 <nl> + type : MERGE_PARTS <nl> + new_part_name : all_0_0_5 <nl> + has_postpones : 0 <nl> + postpone_reason : <nl> + # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> + # # # timeout exceeded , r1 failed to get the merged part from r2 and did the merge by its own <nl> + Row 1 : <nl> + ─ ─ ─ ─ ─ ─ <nl> + table : execute_on_single_replica_r2 <nl> + type : MERGE_PARTS <nl> + new_part_name : all_0_0_5 <nl> + has_postpones : 0 <nl> + postpone_reason : <nl> + # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> + # # # queue unfreeze <nl> + # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> + # # # disable the feature <nl> + # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> + # # # part_log <nl> + Row 1 : <nl> + ─ ─ ─ ─ ─ ─ <nl> + part_name : all_0_0_1 <nl> + mergers : [ ' execute_on_single_replica_r1 ' ] <nl> + fetchers : [ ' execute_on_single_replica_r2 ' ] <nl> + <nl> + Row 2 : <nl> + ─ ─ ─ ─ ─ ─ <nl> + part_name : all_0_0_2 <nl> + mergers : [ ' execute_on_single_replica_r1 ' ] <nl> + fetchers : [ ' execute_on_single_replica_r2 ' ] <nl> + <nl> + Row 3 : <nl> + ─ ─ ─ ─ ─ ─ <nl> + part_name : all_0_0_3 <nl> + mergers : [ ' execute_on_single_replica_r2 ' ] <nl> + fetchers : [ ' execute_on_single_replica_r1 ' ] <nl> + <nl> + Row 4 : <nl> + ─ ─ ─ ─ ─ ─ <nl> + part_name : all_0_0_4 <nl> + mergers : [ ' execute_on_single_replica_r2 ' ] <nl> + fetchers : [ ' execute_on_single_replica_r1 ' ] <nl> + <nl> + Row 5 : <nl> + ─ ─ ─ ─ ─ ─ <nl> + part_name : all_0_0_5 <nl> + mergers : [ ' execute_on_single_replica_r1 ' , ' execute_on_single_replica_r2 ' ] <nl> + fetchers : [ ] <nl> + <nl> + Row 6 : <nl> + ─ ─ ─ ─ ─ ─ <nl> + part_name : all_0_0_6 <nl> + mergers : [ ' execute_on_single_replica_r1 ' , ' execute_on_single_replica_r2 ' ] <nl> + fetchers : [ ] <nl> + <nl> + Row 7 : <nl> + ─ ─ ─ ─ ─ ─ <nl> + part_name : all_0_0_7 <nl> + mergers : [ ' execute_on_single_replica_r1 ' , ' execute_on_single_replica_r2 ' ] <nl> + fetchers : [ ] <nl> new file mode 100644 <nl> index 00000000000 . . c22f9d38eae <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01532_execute_merges_on_single_replica . sql <nl> <nl> + DROP TABLE IF EXISTS execute_on_single_replica_r1 NO DELAY ; <nl> + DROP TABLE IF EXISTS execute_on_single_replica_r2 NO DELAY ; <nl> + <nl> + / * that test requires fixed zookeeper path * / <nl> + CREATE TABLE execute_on_single_replica_r1 ( x UInt64 ) ENGINE = ReplicatedMergeTree ( ' / clickhouse / tables / test_01532 / execute_on_single_replica ' , ' r1 ' ) ORDER BY tuple ( ) SETTINGS execute_merges_on_single_replica_time_threshold = 10 ; <nl> + CREATE TABLE execute_on_single_replica_r2 ( x UInt64 ) ENGINE = ReplicatedMergeTree ( ' / clickhouse / tables / test_01532 / execute_on_single_replica ' , ' r2 ' ) ORDER BY tuple ( ) SETTINGS execute_merges_on_single_replica_time_threshold = 10 ; <nl> + <nl> + INSERT INTO execute_on_single_replica_r1 VALUES ( 1 ) ; <nl> + SYSTEM SYNC REPLICA execute_on_single_replica_r2 ; <nl> + <nl> + SET optimize_throw_if_noop = 1 ; <nl> + <nl> + SELECT ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' ; <nl> + SELECT ' # # # emulate normal feature operation - merges are distributed between replicas ' ; <nl> + <nl> + / * all_0_0_1 - will be merged by r1 , and downloaded by r2 * / <nl> + OPTIMIZE TABLE execute_on_single_replica_r1 FINAL ; <nl> + SYSTEM SYNC REPLICA execute_on_single_replica_r2 ; <nl> + <nl> + / * all_0_0_2 - will be merged by r1 , and downloaded by r2 * / <nl> + OPTIMIZE TABLE execute_on_single_replica_r2 FINAL ; <nl> + SYSTEM SYNC REPLICA execute_on_single_replica_r1 ; <nl> + <nl> + / * all_0_0_3 - will be merged by r2 , and downloaded by r1 * / <nl> + OPTIMIZE TABLE execute_on_single_replica_r1 FINAL ; <nl> + SYSTEM SYNC REPLICA execute_on_single_replica_r2 ; <nl> + <nl> + / * all_0_0_4 - will be merged by r2 , and downloaded by r1 * / <nl> + OPTIMIZE TABLE execute_on_single_replica_r2 FINAL ; <nl> + SYSTEM SYNC REPLICA execute_on_single_replica_r1 ; <nl> + <nl> + SELECT ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' ; <nl> + SELECT ' # # # emulate execute_merges_on_single_replica_time_threshold timeout ' ; <nl> + <nl> + SYSTEM STOP REPLICATION QUEUES execute_on_single_replica_r2 ; <nl> + <nl> + / * all_0_0_5 - should be merged by r2 , but it has replication queue stopped , so r1 do the merge * / <nl> + OPTIMIZE TABLE execute_on_single_replica_r1 FINAL SETTINGS replication_alter_partitions_sync = 0 ; <nl> + <nl> + / * if we will check immediately we can find the log entry unchecked * / <nl> + SELECT * FROM numbers ( 4 ) where sleepEachRow ( 1 ) ; <nl> + <nl> + SELECT ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' ; <nl> + SELECT ' # # # timeout not exceeded , r1 waits for r2 ' ; <nl> + <nl> + / * we can now check that r1 waits for r2 * / <nl> + SELECT <nl> + table , <nl> + type , <nl> + new_part_name , <nl> + num_postponed > 0 AS has_postpones , <nl> + postpone_reason <nl> + FROM system . replication_queue <nl> + WHERE table LIKE ' execute \ \ _on \ \ _single \ \ _replica \ \ _r % ' <nl> + AND database = currentDatabase ( ) <nl> + ORDER BY table <nl> + FORMAT Vertical ; <nl> + <nl> + / * we have execute_merges_on_single_replica_time_threshold exceeded * / <nl> + SELECT * FROM numbers ( 10 ) where sleepEachRow ( 1 ) ; <nl> + <nl> + SELECT ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' ; <nl> + SELECT ' # # # timeout exceeded , r1 failed to get the merged part from r2 and did the merge by its own ' ; <nl> + <nl> + SELECT <nl> + table , <nl> + type , <nl> + new_part_name , <nl> + num_postponed > 0 AS has_postpones , <nl> + postpone_reason <nl> + FROM system . replication_queue <nl> + WHERE table LIKE ' execute \ \ _on \ \ _single \ \ _replica \ \ _r % ' <nl> + AND database = currentDatabase ( ) <nl> + ORDER BY table <nl> + FORMAT Vertical ; <nl> + <nl> + SYSTEM START REPLICATION QUEUES execute_on_single_replica_r2 ; <nl> + SYSTEM SYNC REPLICA execute_on_single_replica_r2 ; <nl> + <nl> + SELECT ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' ; <nl> + SELECT ' # # # queue unfreeze ' ; <nl> + <nl> + SELECT <nl> + table , <nl> + type , <nl> + new_part_name , <nl> + num_postponed > 0 AS has_postpones , <nl> + postpone_reason <nl> + FROM system . replication_queue <nl> + WHERE table LIKE ' execute \ \ _on \ \ _single \ \ _replica \ \ _r % ' <nl> + AND database = currentDatabase ( ) <nl> + ORDER BY table <nl> + FORMAT Vertical ; <nl> + <nl> + SELECT ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' ; <nl> + SELECT ' # # # disable the feature ' ; <nl> + <nl> + ALTER TABLE execute_on_single_replica_r1 MODIFY SETTING execute_merges_on_single_replica_time_threshold = 0 ; <nl> + ALTER TABLE execute_on_single_replica_r2 MODIFY SETTING execute_merges_on_single_replica_time_threshold = 0 ; <nl> + <nl> + / * all_0_0_6 - we disabled the feature , both replicas will merge * / <nl> + OPTIMIZE TABLE execute_on_single_replica_r2 FINAL ; <nl> + / * all_0_0_7 - same * / <nl> + OPTIMIZE TABLE execute_on_single_replica_r1 FINAL ; <nl> + <nl> + SYSTEM SYNC REPLICA execute_on_single_replica_r1 ; <nl> + SYSTEM SYNC REPLICA execute_on_single_replica_r2 ; <nl> + <nl> + SYSTEM FLUSH LOGS ; <nl> + <nl> + SELECT ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' ; <nl> + SELECT ' # # # part_log ' ; <nl> + SELECT <nl> + part_name , <nl> + arraySort ( groupArrayIf ( table , event_type = ' MergeParts ' ) ) AS mergers , <nl> + arraySort ( groupArrayIf ( table , event_type = ' DownloadPart ' ) ) AS fetchers <nl> + FROM system . part_log <nl> + WHERE ( event_time > ( now ( ) - 40 ) ) <nl> + AND ( table LIKE ' execute \ \ _on \ \ _single \ \ _replica \ \ _r % ' ) <nl> + AND ( part_name NOT LIKE ' % \ \ _0 ' ) <nl> + AND ( database = currentDatabase ( ) ) <nl> + GROUP BY part_name <nl> + ORDER BY part_name <nl> + FORMAT Vertical ; <nl> + <nl> + DROP TABLE execute_on_single_replica_r1 NO DELAY ; <nl> + DROP TABLE execute_on_single_replica_r2 NO DELAY ; <nl> \ No newline at end of file <nl>
|
Merge pull request from filimonov / execute_merges_on_single_replica_v2
|
ClickHouse/ClickHouse
|
978e577b0fd6fbbacfef45627866219d217798b4
|
2020-11-19T07:15:52Z
|
mmm a / test / core / end2end / no_server_test . c <nl> ppp b / test / core / end2end / no_server_test . c <nl> <nl> * / <nl> <nl> # include < grpc / grpc . h > <nl> + # include < grpc / support / alloc . h > <nl> # include < grpc / support / log . h > <nl> # include " test / core / end2end / cq_verifier . h " <nl> # include " test / core / util / test_config . h " <nl> int main ( int argc , char * * argv ) { <nl> grpc_channel_destroy ( chan ) ; <nl> cq_verifier_destroy ( cqv ) ; <nl> <nl> + gpr_free ( details ) ; <nl> + grpc_metadata_array_destroy ( & trailing_metadata_recv ) ; <nl> + <nl> grpc_shutdown ( ) ; <nl> <nl> return 0 ; <nl> mmm a / test / core / end2end / tests / invoke_large_request . c <nl> ppp b / test / core / end2end / tests / invoke_large_request . c <nl> static void test_invoke_large_request ( grpc_end2end_test_config config ) { <nl> grpc_byte_buffer_destroy ( response_payload ) ; <nl> grpc_byte_buffer_destroy ( request_payload_recv ) ; <nl> grpc_byte_buffer_destroy ( response_payload_recv ) ; <nl> + gpr_slice_unref ( request_payload_slice ) ; <nl> + gpr_slice_unref ( response_payload_slice ) ; <nl> <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> mmm a / test / core / end2end / tests / max_concurrent_streams . c <nl> ppp b / test / core / end2end / tests / max_concurrent_streams . c <nl> static void test_max_concurrent_streams ( grpc_end2end_test_config config ) { <nl> grpc_call_destroy ( c2 ) ; <nl> grpc_call_destroy ( s2 ) ; <nl> <nl> + gpr_free ( details1 ) ; <nl> + gpr_free ( details2 ) ; <nl> + grpc_metadata_array_destroy ( & initial_metadata_recv1 ) ; <nl> + grpc_metadata_array_destroy ( & trailing_metadata_recv1 ) ; <nl> + grpc_metadata_array_destroy ( & initial_metadata_recv2 ) ; <nl> + grpc_metadata_array_destroy ( & trailing_metadata_recv2 ) ; <nl> + grpc_metadata_array_destroy ( & request_metadata_recv ) ; <nl> + grpc_call_details_destroy ( & call_details ) ; <nl> + <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> } <nl> mmm a / test / core / end2end / tests / ping_pong_streaming . c <nl> ppp b / test / core / end2end / tests / ping_pong_streaming . c <nl> static void test_pingpong_streaming ( grpc_end2end_test_config config , <nl> cq_verifier_destroy ( v_client ) ; <nl> cq_verifier_destroy ( v_server ) ; <nl> <nl> + grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> + grpc_metadata_array_destroy ( & trailing_metadata_recv ) ; <nl> + grpc_metadata_array_destroy ( & request_metadata_recv ) ; <nl> + grpc_call_details_destroy ( & call_details ) ; <nl> + gpr_free ( details ) ; <nl> + <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> } <nl> mmm a / test / core / surface / lame_client_test . c <nl> ppp b / test / core / surface / lame_client_test . c <nl> <nl> <nl> # include " test / core / end2end / cq_verifier . h " <nl> # include " test / core / util / test_config . h " <nl> + # include < grpc / support / alloc . h > <nl> # include < grpc / support / log . h > <nl> <nl> static void * tag ( gpr_intptr x ) { return ( void * ) x ; } <nl> int main ( int argc , char * * argv ) { <nl> cq_verifier_destroy ( cqv ) ; <nl> grpc_completion_queue_destroy ( cq ) ; <nl> <nl> + grpc_metadata_array_destroy ( & trailing_metadata_recv ) ; <nl> + gpr_free ( details ) ; <nl> + <nl> grpc_shutdown ( ) ; <nl> <nl> return 0 ; <nl>
|
Fix some memory leaks
|
grpc/grpc
|
5fe7e5d81cd5a4f24791239cba54c331dd0096b0
|
2015-05-01T17:52:35Z
|
mmm a / db / queryoptimizer . cpp <nl> ppp b / db / queryoptimizer . cpp <nl> namespace mongo { <nl> } <nl> <nl> bool MultiPlanScanner : : uselessOr ( const BSONElement & hint ) const { <nl> + NamespaceDetails * nsd = nsdetails ( _ns ) ; <nl> + if ( ! nsd ) { <nl> + return true ; <nl> + } <nl> IndexDetails * id = 0 ; <nl> if ( ! hint . eoo ( ) ) { <nl> - IndexDetails * id = parseHint ( hint , nsdetails ( _ns ) ) ; <nl> + IndexDetails * id = parseHint ( hint , nsd ) ; <nl> if ( ! id ) { <nl> return true ; <nl> } <nl> namespace mongo { <nl> } <nl> } else { <nl> bool useful = false ; <nl> - NamespaceDetails : : IndexIterator j = nsdetails ( _ns ) - > ii ( ) ; <nl> + NamespaceDetails : : IndexIterator j = nsd - > ii ( ) ; <nl> while ( j . more ( ) ) { <nl> IndexDetails & id = j . next ( ) ; <nl> if ( id . getSpec ( ) . suitability ( * i , BSONObj ( ) ) ! = USELESS ) { <nl> new file mode 100644 <nl> index 000000000000 . . c58507ee30e0 <nl> mmm / dev / null <nl> ppp b / jstests / or8 . js <nl> <nl> + / / missing collection <nl> + <nl> + t = db . jstests_or8 ; <nl> + t . drop ( ) ; <nl> + <nl> + t . find ( { " $ or " : [ { " PropA " : { " $ lt " : " b " } } , { " PropA " : { " $ lt " : " b " , " $ gt " : " a " } } ] } ) . toArray ( ) ; <nl> mmm a / mongo . xcodeproj / project . pbxproj <nl> ppp b / mongo . xcodeproj / project . pbxproj <nl> <nl> 936B895E0F4C899400934AF2 / * message . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = message . cpp ; sourceTree = " < group > " ; } ; <nl> 936B895F0F4C899400934AF2 / * message . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = message . h ; sourceTree = " < group > " ; } ; <nl> 9378842D11C6C987007E85F5 / * indexh . js * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . javascript ; path = indexh . js ; sourceTree = " < group > " ; } ; <nl> + 937884C311C80276007E85F5 / * indexi . js * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . javascript ; path = indexi . js ; sourceTree = " < group > " ; } ; <nl> + 937884E811C80B22007E85F5 / * or8 . js * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . javascript ; path = or8 . js ; sourceTree = " < group > " ; } ; <nl> 937C493311C0358D00836543 / * or7 . js * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . javascript ; path = or7 . js ; sourceTree = " < group > " ; } ; <nl> 937CACE90F27BF4900C57AA6 / * socktests . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = socktests . cpp ; sourceTree = " < group > " ; } ; <nl> 937D0E340F28CB070071FFA9 / * repltests . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = repltests . cpp ; sourceTree = " < group > " ; } ; <nl> <nl> 934BEB9A10DFFA9600178102 / * jstests * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> + 937884E811C80B22007E85F5 / * or8 . js * / , <nl> + 937884C311C80276007E85F5 / * indexi . js * / , <nl> 9378842D11C6C987007E85F5 / * indexh . js * / , <nl> 937C493311C0358D00836543 / * or7 . js * / , <nl> 932D854611AB912B002749FB / * array_match1 . js * / , <nl>
|
SERVER - 1242 check nsdetails before using
|
mongodb/mongo
|
0715c4db07354dffa7c08b0c2269b1fae5517684
|
2010-06-15T19:29:27Z
|
new file mode 100644 <nl> index 000000000000 . . 6ecb529330d5 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv2d . expected . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 16b8a38e15e6 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv2d . input . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . f172acd3ada9 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv2d . scripted . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 9736cb00cbdd <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv2d . state_dict . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 290c762eb5ae <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv2d . traced . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 197f607734f2 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv2d_relu . expected . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . b8b25f969b32 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv2d_relu . input . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 589bbcee9ede <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv2d_relu . scripted . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 3b159bbc0509 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv2d_relu . state_dict . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 4d660ca1ab50 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv2d_relu . traced . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 3e9be40fedbb <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv3d . expected . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . ffdcc1eaf0aa <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv3d . input . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 5e3acf4870da <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv3d . scripted . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 8f9c6657b9f8 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv3d . state_dict . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . ebd058468923 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv3d . traced . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . e821b0c3187f <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv3d_relu . expected . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 27591cc549b2 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv3d_relu . input . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . b32dd2322e35 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv3d_relu . scripted . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 65a3e5327ee9 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv3d_relu . state_dict . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . d0517ac84d52 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_conv3d_relu . traced . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . c7df3725e7c1 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear . expected . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . ff13cf815039 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear . input . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 4fbe21099ee9 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear . scripted . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 48f73551c26b <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear . state_dict . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 994cec9111fc <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear . traced . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . b17f8b16f0d3 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_dynamic_float16 . expected . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . c1150b187f29 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_dynamic_float16 . input . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . b97b6ec5a31b <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_dynamic_float16 . scripted . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 66b4058a7614 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_dynamic_float16 . state_dict . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 5c83be49e1d1 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_dynamic_float16 . traced . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 774124e33ad7 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_dynamic_qint8 . expected . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 6823d9b1483b <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_dynamic_qint8 . input . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 367d2dbb01de <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_dynamic_qint8 . scripted . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 53dcd7fb33a5 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_dynamic_qint8 . state_dict . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 76c80b443fbe <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_dynamic_qint8 . traced . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . ca5520e06066 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_relu . expected . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . bf60eb16ceed <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_relu . input . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . bf829055ebd9 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_relu . scripted . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . bf9bef67535f <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_relu . state_dict . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . b1159c0bd527 <nl> Binary files / dev / null and b / test / quantization / serialized / TestSerialization . test_linear_relu . traced . pt differ <nl> new file mode 100644 <nl> index 000000000000 . . 17d700d26f44 <nl> mmm / dev / null <nl> ppp b / test / quantization / test_backward_compatibility . py <nl> <nl> + # - * - coding : utf - 8 - * - <nl> + <nl> + import sys <nl> + import os <nl> + import unittest <nl> + <nl> + # torch <nl> + import torch <nl> + import torch . nn . quantized as nnq <nl> + import torch . nn . quantized . dynamic as nnqd <nl> + import torch . nn . intrinsic . quantized as nniq <nl> + <nl> + # Testing utils <nl> + from torch . testing . _internal . common_utils import TestCase <nl> + from torch . testing . _internal . common_utils import run_tests <nl> + <nl> + # TODO : remove this global setting <nl> + # JIT tests use double as the default dtype <nl> + torch . set_default_dtype ( torch . double ) <nl> + <nl> + class TestSerialization ( TestCase ) : <nl> + # Copy and modified from TestCase . assertExpected <nl> + def _test_op ( self , qmodule , subname = None , input_size = None , input_quantized = True , generate = False , prec = None ) : <nl> + r " " " Test quantized modules serialized previously can be loaded <nl> + with current code , make sure we don ' t break backward compatibility for the <nl> + serialization of quantized modules <nl> + " " " <nl> + def remove_prefix ( text , prefix ) : <nl> + if text . startswith ( prefix ) : <nl> + return text [ len ( prefix ) : ] <nl> + return text <nl> + # NB : we take __file__ from the module that defined the test <nl> + # class , so we place the expect directory where the test script <nl> + # lives , NOT where test / common_utils . py lives . <nl> + module_id = self . __class__ . __module__ <nl> + munged_id = remove_prefix ( self . id ( ) , module_id + " . " ) <nl> + test_file = os . path . realpath ( sys . modules [ module_id ] . __file__ ) <nl> + # TODO : change to quantization / serialized after we add test_quantization . py <nl> + # under pytorch / test folder <nl> + base_name = os . path . join ( os . path . dirname ( test_file ) , <nl> + " serialized " , <nl> + munged_id ) <nl> + <nl> + subname_output = " " <nl> + if subname : <nl> + base_name + = " _ " + subname <nl> + subname_output = " ( { } ) " . format ( subname ) <nl> + <nl> + input_file = base_name + " . input . pt " <nl> + state_dict_file = base_name + " . state_dict . pt " <nl> + scripted_module_file = base_name + " . scripted . pt " <nl> + traced_module_file = base_name + " . traced . pt " <nl> + expected_file = base_name + " . expected . pt " <nl> + <nl> + if generate : <nl> + input_tensor = torch . rand ( * input_size ) . float ( ) <nl> + if input_quantized : <nl> + input_tensor = torch . quantize_per_tensor ( input_tensor , 0 . 5 , 2 , torch . quint8 ) <nl> + torch . save ( input_tensor , input_file ) <nl> + torch . save ( qmodule . state_dict ( ) , state_dict_file ) <nl> + torch . jit . save ( torch . jit . script ( qmodule ) , scripted_module_file ) <nl> + torch . jit . save ( torch . jit . trace ( qmodule , input_tensor ) , traced_module_file ) <nl> + torch . save ( qmodule ( input_tensor ) , expected_file ) <nl> + <nl> + input_tensor = torch . load ( input_file ) <nl> + qmodule . load_state_dict ( torch . load ( state_dict_file ) ) <nl> + qmodule_scripted = torch . jit . load ( scripted_module_file ) <nl> + qmodule_traced = torch . jit . load ( traced_module_file ) <nl> + <nl> + expected = torch . load ( expected_file ) <nl> + self . assertEqual ( qmodule ( input_tensor ) , expected , prec = prec ) <nl> + self . assertEqual ( qmodule_scripted ( input_tensor ) , expected , prec = prec ) <nl> + self . assertEqual ( qmodule_traced ( input_tensor ) , expected , prec = prec ) <nl> + <nl> + @ unittest . skipUnless ( <nl> + ' fbgemm ' in torch . backends . quantized . supported_engines or <nl> + ' qnnpack ' in torch . backends . quantized . supported_engines , <nl> + " Quantized operations require FBGEMM . FBGEMM is only optimized for CPUs " <nl> + " with instruction set support avx2 or newer . " , <nl> + ) <nl> + def test_linear ( self ) : <nl> + module = nnq . Linear ( 3 , 1 , bias_ = True , dtype = torch . qint8 ) <nl> + self . _test_op ( module , input_size = [ 1 , 3 ] , generate = False ) <nl> + <nl> + @ unittest . skipUnless ( <nl> + ' fbgemm ' in torch . backends . quantized . supported_engines or <nl> + ' qnnpack ' in torch . backends . quantized . supported_engines , <nl> + " Quantized operations require FBGEMM . FBGEMM is only optimized for CPUs " <nl> + " with instruction set support avx2 or newer . " , <nl> + ) <nl> + def test_linear_relu ( self ) : <nl> + module = nniq . LinearReLU ( 3 , 1 , bias = True , dtype = torch . qint8 ) <nl> + self . _test_op ( module , input_size = [ 1 , 3 ] , generate = False ) <nl> + <nl> + @ unittest . skipUnless ( <nl> + ' fbgemm ' in torch . backends . quantized . supported_engines or <nl> + ' qnnpack ' in torch . backends . quantized . supported_engines , <nl> + " Quantized operations require FBGEMM . FBGEMM is only optimized for CPUs " <nl> + " with instruction set support avx2 or newer . " , <nl> + ) <nl> + def test_linear_dynamic ( self ) : <nl> + module_qint8 = nnqd . Linear ( 3 , 1 , bias_ = True , dtype = torch . qint8 ) <nl> + module_float16 = nnqd . Linear ( 3 , 1 , bias_ = True , dtype = torch . float16 ) <nl> + self . _test_op ( module_qint8 , " qint8 " , input_size = [ 1 , 3 ] , input_quantized = False , generate = False ) <nl> + self . _test_op ( module_float16 , " float16 " , input_size = [ 1 , 3 ] , input_quantized = False , generate = False ) <nl> + <nl> + @ unittest . skipUnless ( <nl> + ' fbgemm ' in torch . backends . quantized . supported_engines or <nl> + ' qnnpack ' in torch . backends . quantized . supported_engines , <nl> + " Quantized operations require FBGEMM . FBGEMM is only optimized for CPUs " <nl> + " with instruction set support avx2 or newer . " , <nl> + ) <nl> + def test_conv2d ( self ) : <nl> + module = nnq . Conv2d ( 3 , 3 , kernel_size = 3 , stride = 1 , padding = 0 , dilation = 1 , <nl> + groups = 1 , bias = True , padding_mode = " zeros " ) <nl> + self . _test_op ( module , input_size = [ 1 , 3 , 6 , 6 ] , generate = False ) <nl> + # TODO : graph mode quantized conv2d module <nl> + <nl> + @ unittest . skipUnless ( <nl> + ' fbgemm ' in torch . backends . quantized . supported_engines or <nl> + ' qnnpack ' in torch . backends . quantized . supported_engines , <nl> + " Quantized operations require FBGEMM . FBGEMM is only optimized for CPUs " <nl> + " with instruction set support avx2 or newer . " , <nl> + ) <nl> + def test_conv2d_relu ( self ) : <nl> + module = nniq . ConvReLU2d ( 3 , 3 , kernel_size = 3 , stride = 1 , padding = 0 , dilation = 1 , <nl> + groups = 1 , bias = True , padding_mode = " zeros " ) <nl> + self . _test_op ( module , input_size = [ 1 , 3 , 6 , 6 ] , generate = False ) <nl> + # TODO : graph mode quantized conv2d module <nl> + <nl> + @ unittest . skipUnless ( <nl> + ' fbgemm ' in torch . backends . quantized . supported_engines or <nl> + ' qnnpack ' in torch . backends . quantized . supported_engines , <nl> + " Quantized operations require FBGEMM . FBGEMM is only optimized for CPUs " <nl> + " with instruction set support avx2 or newer . " , <nl> + ) <nl> + def test_conv3d ( self ) : <nl> + module = nnq . Conv3d ( 3 , 3 , kernel_size = 3 , stride = 1 , padding = 0 , dilation = 1 , <nl> + groups = 1 , bias = True , padding_mode = " zeros " ) <nl> + self . _test_op ( module , input_size = [ 1 , 3 , 6 , 6 , 6 ] , generate = False ) <nl> + # TODO : graph mode quantized conv3d module <nl> + <nl> + @ unittest . skipUnless ( <nl> + ' fbgemm ' in torch . backends . quantized . supported_engines or <nl> + ' qnnpack ' in torch . backends . quantized . supported_engines , <nl> + " Quantized operations require FBGEMM . FBGEMM is only optimized for CPUs " <nl> + " with instruction set support avx2 or newer . " , <nl> + ) <nl> + def test_conv3d_relu ( self ) : <nl> + module = nniq . ConvReLU3d ( 3 , 3 , kernel_size = 3 , stride = 1 , padding = 0 , dilation = 1 , <nl> + groups = 1 , bias = True , padding_mode = " zeros " ) <nl> + self . _test_op ( module , input_size = [ 1 , 3 , 6 , 6 , 6 ] , generate = False ) <nl> + # TODO : graph mode quantized conv3d module <nl> + <nl> + <nl> + <nl> + if __name__ = = " __main__ " : <nl> + run_tests ( ) <nl> mmm a / test / run_test . py <nl> ppp b / test / run_test . py <nl> <nl> ' quantization / test_quantized_tensor ' , <nl> ' quantization / test_quantized_nn_mods ' , <nl> ' quantization / test_quantize_script ' , <nl> + ' quantization / test_backward_compatibility . py ' , <nl> ' test_sparse ' , <nl> ' test_serialization ' , <nl> ' test_show_pickle ' , <nl>
|
[ quant ] Add backward compatiblity test ( )
|
pytorch/pytorch
|
484a00b2d36f73963ed10f2f3d50ca0dc49ff241
|
2020-04-17T02:00:30Z
|
mmm a / xbmc / Application . cpp <nl> ppp b / xbmc / Application . cpp <nl> <nl> # include " playlists / SmartPlayList . h " <nl> # include " playlists / PlayList . h " <nl> # include " profiles / ProfilesManager . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " powermanagement / PowerManager . h " <nl> # include " powermanagement / DPMSSupport . h " <nl> # include " settings / Settings . h " <nl> <nl> # include " utils / AMLUtils . h " <nl> # endif <nl> <nl> + / / TODO : XInitThreads <nl> + # ifdef HAVE_X11 <nl> + # include " X11 / Xlib . h " <nl> + # endif <nl> + <nl> # include " cores / FFmpeg . h " <nl> # include " utils / CharsetConverter . h " <nl> # include " pictures / GUIWindowSlideShow . h " <nl> void CApplication : : CApplication : : HandleWinEvents ( ) <nl> break ; <nl> case XBMC_VIDEOMOVE : <nl> { <nl> - g_Windowing . OnMove ( newEvent . move . x , newEvent . move . y ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . OnMove ( newEvent . move . x , newEvent . move . y ) ; <nl> } <nl> break ; <nl> case XBMC_MODECHANGE : <nl> bool CApplication : : Create ( const CAppParamParser & params ) <nl> m_threadID = CThread : : GetCurrentThreadId ( ) ; <nl> <nl> m_ServiceManager . reset ( new CServiceManager ( ) ) ; <nl> + <nl> + / / TODO <nl> + / / some of the serives depend on the WinSystem : ( <nl> + std : : unique_ptr < CWinSystemBase > winSystem = CWinSystemBase : : CreateWinSystem ( ) ; <nl> + m_ServiceManager - > SetWinSystem ( std : : move ( winSystem ) ) ; <nl> + <nl> if ( ! m_ServiceManager - > InitStageOne ( ) ) <nl> { <nl> return false ; <nl> bool CApplication : : CreateGUI ( ) <nl> <nl> m_renderGUI = true ; <nl> <nl> - if ( ! g_Windowing . InitWindowSystem ( ) ) <nl> + if ( ! CServiceBroker : : GetWinSystem ( ) . InitWindowSystem ( ) ) <nl> { <nl> CLog : : Log ( LOGFATAL , " CApplication : : Create : Unable to init windowing system " ) ; <nl> return false ; <nl> bool CApplication : : CreateGUI ( ) <nl> } <nl> <nl> / / update the window resolution <nl> - g_Windowing . SetWindowResolution ( m_ServiceManager - > GetSettings ( ) . GetInt ( CSettings : : SETTING_WINDOW_WIDTH ) , m_ServiceManager - > GetSettings ( ) . GetInt ( CSettings : : SETTING_WINDOW_HEIGHT ) ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . SetWindowResolution ( m_ServiceManager - > GetSettings ( ) . GetInt ( CSettings : : SETTING_WINDOW_WIDTH ) , m_ServiceManager - > GetSettings ( ) . GetInt ( CSettings : : SETTING_WINDOW_HEIGHT ) ) ; <nl> <nl> if ( g_advancedSettings . m_startFullScreen & & CDisplaySettings : : GetInstance ( ) . GetCurrentResolution ( ) = = RES_WINDOW ) <nl> { <nl> bool CApplication : : CreateGUI ( ) <nl> / / Set default screen saver mode <nl> auto screensaverModeSetting = std : : static_pointer_cast < CSettingString > ( m_ServiceManager - > GetSettings ( ) . GetSetting ( CSettings : : SETTING_SCREENSAVER_MODE ) ) ; <nl> / / Can only set this after windowing has been initialized since it depends on it <nl> - if ( g_Windowing . GetOSScreenSaver ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . GetOSScreenSaver ( ) ) <nl> { <nl> / / If OS has a screen saver , use it by default <nl> screensaverModeSetting - > SetDefault ( " " ) ; <nl> bool CApplication : : CreateGUI ( ) <nl> if ( sav_res ) <nl> CDisplaySettings : : GetInstance ( ) . SetCurrentResolution ( RES_DESKTOP , true ) ; <nl> <nl> - g_Windowing . ShowSplash ( " " ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . ShowSplash ( " " ) ; <nl> <nl> / / The key mappings may already have been loaded by a peripheral <nl> CLog : : Log ( LOGINFO , " load keymapping " ) ; <nl> bool CApplication : : InitWindow ( RESOLUTION res ) <nl> res = CDisplaySettings : : GetInstance ( ) . GetCurrentResolution ( ) ; <nl> <nl> bool bFullScreen = res ! = RES_WINDOW ; <nl> - if ( ! g_Windowing . CreateNewWindow ( CSysInfo : : GetAppName ( ) , bFullScreen , CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( res ) ) ) <nl> + if ( ! CServiceBroker : : GetWinSystem ( ) . CreateNewWindow ( CSysInfo : : GetAppName ( ) , <nl> + bFullScreen , CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( res ) ) ) <nl> { <nl> CLog : : Log ( LOGFATAL , " CApplication : : Create : Unable to create window " ) ; <nl> return false ; <nl> } <nl> <nl> - if ( ! g_Windowing . InitRenderSystem ( ) ) <nl> + if ( ! CServiceBroker : : GetRenderSystem ( ) . InitRenderSystem ( ) ) <nl> { <nl> CLog : : Log ( LOGFATAL , " CApplication : : Create : Unable to init rendering system " ) ; <nl> return false ; <nl> bool CApplication : : InitWindow ( RESOLUTION res ) <nl> <nl> bool CApplication : : DestroyWindow ( ) <nl> { <nl> - return g_Windowing . DestroyWindow ( ) ; <nl> + bool ret = CServiceBroker : : GetWinSystem ( ) . DestroyWindow ( ) ; <nl> + std : : unique_ptr < CWinSystemBase > winSystem ; <nl> + m_ServiceManager - > SetWinSystem ( std : : move ( winSystem ) ) ; <nl> + return ret ; <nl> } <nl> <nl> bool CApplication : : InitDirectoriesLinux ( ) <nl> bool CApplication : : Initialize ( ) <nl> while ( ! event . WaitMSec ( 1000 ) ) <nl> { <nl> if ( CDatabaseManager : : GetInstance ( ) . m_bIsUpgrading ) <nl> - g_Windowing . ShowSplash ( std : : string ( iDots , ' ' ) + localizedStr + std : : string ( iDots , ' . ' ) ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . ShowSplash ( std : : string ( iDots , ' ' ) + localizedStr + std : : string ( iDots , ' . ' ) ) ; <nl> if ( iDots = = 3 ) <nl> iDots = 1 ; <nl> else <nl> + + iDots ; <nl> } <nl> - g_Windowing . ShowSplash ( " " ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . ShowSplash ( " " ) ; <nl> <nl> StartServices ( ) ; <nl> <nl> bool CApplication : : Initialize ( ) <nl> while ( ! event . WaitMSec ( 1000 ) ) <nl> { <nl> if ( isMigratingAddons ) <nl> - g_Windowing . ShowSplash ( std : : string ( iDots , ' ' ) + localizedStr + std : : string ( iDots , ' . ' ) ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . ShowSplash ( std : : string ( iDots , ' ' ) + localizedStr + std : : string ( iDots , ' . ' ) ) ; <nl> if ( iDots = = 3 ) <nl> iDots = 1 ; <nl> else <nl> + + iDots ; <nl> } <nl> - g_Windowing . ShowSplash ( " " ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . ShowSplash ( " " ) ; <nl> m_incompatibleAddons = incompatibleAddons ; <nl> m_confirmSkinChange = true ; <nl> <nl> void CApplication : : Render ( ) <nl> ResetScreenSaver ( ) ; <nl> } <nl> <nl> - if ( ! g_Windowing . BeginRender ( ) ) <nl> + if ( ! CServiceBroker : : GetRenderSystem ( ) . BeginRender ( ) ) <nl> return ; <nl> <nl> / / render gui layer <nl> void CApplication : : Render ( ) <nl> / / render video layer <nl> g_windowManager . RenderEx ( ) ; <nl> <nl> - g_Windowing . EndRender ( ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . EndRender ( ) ; <nl> <nl> / / reset our info cache - we do this at the end of Render so that it is <nl> / / fresh for the next process ( ) , or after a windowclose animation ( where process ( ) <nl> void CApplication : : FrameMove ( bool processEvents , bool processGUI ) <nl> m_pPlayer - > FrameMove ( ) ; <nl> <nl> / / this will go away when render systems gets its own thread <nl> - g_Windowing . DriveRenderLoop ( ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . DriveRenderLoop ( ) ; <nl> } <nl> <nl> <nl> bool CApplication : : Cleanup ( ) <nl> m_globalScreensaverInhibitor . Release ( ) ; <nl> m_screensaverInhibitor . Release ( ) ; <nl> <nl> - g_Windowing . DestroyRenderSystem ( ) ; <nl> - g_Windowing . DestroyWindow ( ) ; <nl> - g_Windowing . DestroyWindowSystem ( ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . DestroyRenderSystem ( ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . DestroyWindow ( ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . DestroyWindowSystem ( ) ; <nl> g_windowManager . DestroyWindows ( ) ; <nl> <nl> CLog : : Log ( LOGNOTICE , " unload sections " ) ; <nl> bool CApplication : : WakeUpScreenSaver ( bool bPowerOffKeyPressed / * = false * / ) <nl> void CApplication : : CheckOSScreenSaverInhibitionSetting ( ) <nl> { <nl> / / Kodi screen saver overrides OS one : always inhibit OS screen saver then <nl> - if ( ! m_ServiceManager - > GetSettings ( ) . GetString ( CSettings : : SETTING_SCREENSAVER_MODE ) . empty ( ) & & g_Windowing . GetOSScreenSaver ( ) ) <nl> + if ( ! m_ServiceManager - > GetSettings ( ) . GetString ( CSettings : : SETTING_SCREENSAVER_MODE ) . empty ( ) & & <nl> + CServiceBroker : : GetWinSystem ( ) . GetOSScreenSaver ( ) ) <nl> { <nl> if ( ! m_globalScreensaverInhibitor ) <nl> { <nl> - m_globalScreensaverInhibitor = g_Windowing . GetOSScreenSaver ( ) - > CreateInhibitor ( ) ; <nl> + m_globalScreensaverInhibitor = CServiceBroker : : GetWinSystem ( ) . GetOSScreenSaver ( ) - > CreateInhibitor ( ) ; <nl> } <nl> } <nl> else if ( m_globalScreensaverInhibitor ) <nl> void CApplication : : CheckScreenSaverAndDPMS ( ) <nl> & & ! m_ServiceManager - > GetSettings ( ) . GetString ( CSettings : : SETTING_MUSICPLAYER_VISUALISATION ) . empty ( ) ) ; <nl> <nl> / / Handle OS screen saver state <nl> - if ( haveIdleActivity & & g_Windowing . GetOSScreenSaver ( ) ) <nl> + if ( haveIdleActivity & & CServiceBroker : : GetWinSystem ( ) . GetOSScreenSaver ( ) ) <nl> { <nl> / / Always inhibit OS screen saver during these kinds of activities <nl> - m_screensaverInhibitor = g_Windowing . GetOSScreenSaver ( ) - > CreateInhibitor ( ) ; <nl> + m_screensaverInhibitor = CServiceBroker : : GetWinSystem ( ) . GetOSScreenSaver ( ) - > CreateInhibitor ( ) ; <nl> } <nl> else if ( m_screensaverInhibitor ) <nl> { <nl> void CApplication : : ProcessSlow ( ) <nl> / / There is an issue on OS X that several system services ask the cursor to become visible <nl> / / during their startup routines . Given that we can ' t control this , we hack it in by <nl> / / forcing the <nl> - if ( g_Windowing . IsFullScreen ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . IsFullScreen ( ) ) <nl> { / / SDL thinks it ' s hidden <nl> Cocoa_HideMouse ( ) ; <nl> } <nl> bool CApplication : : SwitchToFullScreen ( bool force / * = false * / ) <nl> <nl> void CApplication : : Minimize ( ) <nl> { <nl> - g_Windowing . Minimize ( ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Minimize ( ) ; <nl> } <nl> <nl> std : : string CApplication : : GetCurrentPlayer ( ) <nl> mmm a / xbmc / GUIInfoManager . cpp <nl> ppp b / xbmc / GUIInfoManager . cpp <nl> <nl> # include " PlayListPlayer . h " <nl> # include " playlists / PlayList . h " <nl> # include " profiles / ProfilesManager . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " powermanagement / PowerManager . h " <nl> # include " settings / AdvancedSettings . h " <nl> # include " settings / DisplaySettings . h " <nl> std : : string CGUIInfoManager : : GetLabel ( int info , int contextWindow , std : : string * <nl> break ; <nl> <nl> case SYSTEM_SCREEN_RESOLUTION : <nl> - if ( g_Windowing . IsFullScreen ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . IsFullScreen ( ) ) <nl> strLabel = StringUtils : : Format ( " % ix % i @ % . 2fHz - % s " , <nl> CDisplaySettings : : GetInstance ( ) . GetCurrentResolutionInfo ( ) . iScreenWidth , <nl> CDisplaySettings : : GetInstance ( ) . GetCurrentResolutionInfo ( ) . iScreenHeight , <nl> std : : string CGUIInfoManager : : GetLabel ( int info , int contextWindow , std : : string * <nl> } <nl> break ; <nl> case SYSTEM_RENDER_VENDOR : <nl> - strLabel = g_Windowing . GetRenderVendor ( ) ; <nl> + strLabel = CServiceBroker : : GetRenderSystem ( ) . GetRenderVendor ( ) ; <nl> break ; <nl> case SYSTEM_RENDER_RENDERER : <nl> - strLabel = g_Windowing . GetRenderRenderer ( ) ; <nl> + strLabel = CServiceBroker : : GetRenderSystem ( ) . GetRenderRenderer ( ) ; <nl> break ; <nl> case SYSTEM_RENDER_VERSION : <nl> - strLabel = g_Windowing . GetRenderVersionString ( ) ; <nl> + strLabel = CServiceBroker : : GetRenderSystem ( ) . GetRenderVersionString ( ) ; <nl> break ; <nl> } <nl> <nl> bool CGUIInfoManager : : GetBool ( int condition1 , int contextWindow , const CGUIListI <nl> else if ( condition = = SYSTEM_ISMASTER ) <nl> bReturn = CProfilesManager : : GetInstance ( ) . GetMasterProfile ( ) . getLockMode ( ) ! = LOCK_MODE_EVERYONE & & g_passwordManager . bMasterUser ; <nl> else if ( condition = = SYSTEM_ISFULLSCREEN ) <nl> - bReturn = g_Windowing . IsFullScreen ( ) ; <nl> + bReturn = CServiceBroker : : GetWinSystem ( ) . IsFullScreen ( ) ; <nl> else if ( condition = = SYSTEM_ISSTANDALONE ) <nl> bReturn = g_application . IsStandAlone ( ) ; <nl> else if ( condition = = SYSTEM_ISINHIBIT ) <nl> mmm a / xbmc / ServiceBroker . cpp <nl> ppp b / xbmc / ServiceBroker . cpp <nl> <nl> <nl> # include " ServiceBroker . h " <nl> # include " Application . h " <nl> + # include " rendering / RenderSystem . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> using namespace KODI ; <nl> <nl> bool CServiceBroker : : IsBinaryAddonCacheUp ( ) <nl> { <nl> return g_application . m_ServiceManager - > init_level > 1 ; <nl> } <nl> + <nl> + CWinSystemBase & CServiceBroker : : GetWinSystem ( ) <nl> + { <nl> + return g_application . m_ServiceManager - > GetWinSystem ( ) ; <nl> + } <nl> + <nl> + CRenderSystemBase & CServiceBroker : : GetRenderSystem ( ) <nl> + { <nl> + CRenderSystemBase & renderSystem = dynamic_cast < CRenderSystemBase & > ( g_application . m_ServiceManager - > GetWinSystem ( ) ) ; <nl> + return renderSystem ; <nl> + } <nl> mmm a / xbmc / ServiceBroker . h <nl> ppp b / xbmc / ServiceBroker . h <nl> class CFavouritesService ; <nl> class CInputManager ; <nl> class CFileExtensionProvider ; <nl> class CNetwork ; <nl> + class CWinSystemBase ; <nl> + class CRenderSystemBase ; <nl> <nl> namespace KODI <nl> { <nl> class CServiceBroker <nl> static CFileExtensionProvider & GetFileExtensionProvider ( ) ; <nl> static bool IsBinaryAddonCacheUp ( ) ; <nl> static CNetwork & GetNetwork ( ) ; <nl> + static CWinSystemBase & GetWinSystem ( ) ; <nl> + static CRenderSystemBase & GetRenderSystem ( ) ; <nl> } ; <nl> mmm a / xbmc / ServiceManager . cpp <nl> ppp b / xbmc / ServiceManager . cpp <nl> <nl> # include " network / Network . h " <nl> # include " settings / Settings . h " <nl> # include " utils / FileExtensionProvider . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> using namespace KODI ; <nl> <nl> CFileExtensionProvider & CServiceManager : : GetFileExtensionProvider ( ) <nl> return * m_fileExtensionProvider ; <nl> } <nl> <nl> + CWinSystemBase & CServiceManager : : GetWinSystem ( ) <nl> + { <nl> + return * m_winSystem . get ( ) ; <nl> + } <nl> + <nl> + void CServiceManager : : SetWinSystem ( std : : unique_ptr < CWinSystemBase > winSystem ) <nl> + { <nl> + m_winSystem = std : : move ( winSystem ) ; <nl> + } <nl> + <nl> / / deleters for unique_ptr <nl> void CServiceManager : : delete_dataCacheCore : : operator ( ) ( CDataCacheCore * p ) const <nl> { <nl> CNetwork & CServiceManager : : GetNetwork ( ) <nl> { <nl> return * m_network ; <nl> } <nl> + <nl> mmm a / xbmc / ServiceManager . h <nl> ppp b / xbmc / ServiceManager . h <nl> class CSettings ; <nl> class IAE ; <nl> class CFavouritesService ; <nl> class CNetwork ; <nl> + class CWinSystemBase ; <nl> <nl> namespace KODI <nl> { <nl> class CServiceManager <nl> CInputManager & GetInputManager ( ) ; <nl> CFileExtensionProvider & GetFileExtensionProvider ( ) ; <nl> <nl> + CWinSystemBase & GetWinSystem ( ) ; <nl> + void SetWinSystem ( std : : unique_ptr < CWinSystemBase > winSystem ) ; <nl> + <nl> protected : <nl> struct delete_dataCacheCore <nl> { <nl> class CServiceManager <nl> std : : unique_ptr < CInputManager > m_inputManager ; <nl> std : : unique_ptr < CFileExtensionProvider > m_fileExtensionProvider ; <nl> std : : unique_ptr < CNetwork > m_network ; <nl> + std : : unique_ptr < CWinSystemBase > m_winSystem ; <nl> } ; <nl> mmm a / xbmc / addons / ScreenSaver . cpp <nl> ppp b / xbmc / addons / ScreenSaver . cpp <nl> <nl> # include " ScreenSaver . h " <nl> # include " filesystem / SpecialProtocol . h " <nl> # include " guilib / GraphicContext . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " utils / log . h " <nl> <nl> namespace ADDON <nl> mmm a / xbmc / cores / AudioEngine / Engines / ActiveAE / ActiveAE . cpp <nl> ppp b / xbmc / cores / AudioEngine / Engines / ActiveAE / ActiveAE . cpp <nl> using namespace ActiveAE ; <nl> # include " cores / AudioEngine / Encoders / AEEncoderFFmpeg . h " <nl> <nl> # include " settings / Settings . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " utils / log . h " <nl> <nl> # define MAX_CACHE_LEVEL 0 . 4 / / total cache time of stream in seconds <nl> CActiveAE : : ~ CActiveAE ( ) <nl> <nl> void CActiveAE : : Dispose ( ) <nl> { <nl> - g_Windowing . Unregister ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Unregister ( this ) ; <nl> <nl> m_bStop = true ; <nl> m_outMsgEvent . Set ( ) ; <nl> bool CActiveAE : : Initialize ( ) <nl> } <nl> <nl> / / hook into windowing for receiving display reset events <nl> - g_Windowing . Register ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Register ( this ) ; <nl> <nl> m_inMsgEvent . Reset ( ) ; <nl> return true ; <nl> mmm a / xbmc / cores / AudioEngine / Sinks / AESinkDARWINIOS . mm <nl> ppp b / xbmc / cores / AudioEngine / Sinks / AESinkDARWINIOS . mm <nl> <nl> # include " cores / AudioEngine / Utils / AEUtil . h " <nl> # include " cores / AudioEngine / Utils / AERingBuffer . h " <nl> # include " cores / AudioEngine / Sinks / osx / CoreAudioHelpers . h " <nl> + # include " ServiceBroker . h " <nl> # include " platform / darwin / DarwinUtils . h " <nl> # include " utils / log . h " <nl> # include " utils / StringUtils . h " <nl> # include " threads / Condition . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> # include < sstream > <nl> # include < AudioToolbox / AudioToolbox . h > <nl> static void EnumerateDevices ( AEDeviceInfoList & list ) <nl> device . m_displayNameExtra = " " ; <nl> / / TODO screen changing on ios needs to call <nl> / / devices changed once this is available in active <nl> - if ( g_Windowing . GetCurrentScreen ( ) > 0 ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . GetCurrentScreen ( ) > 0 ) <nl> { <nl> device . m_deviceType = AE_DEVTYPE_IEC958 ; / / allow passthrough for tvout <nl> device . m_streamTypes . push_back ( CAEStreamInfo : : STREAM_TYPE_AC3 ) ; <nl> mmm a / xbmc / cores / ExternalPlayer / ExternalPlayer . cpp <nl> ppp b / xbmc / cores / ExternalPlayer / ExternalPlayer . cpp <nl> <nl> # include " CompileInfo . h " <nl> # include " threads / SingleLock . h " <nl> # include " ExternalPlayer . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " dialogs / GUIDialogOK . h " <nl> # include " guilib / GUIWindowManager . h " <nl> # include " Application . h " <nl> void CExternalPlayer : : Process ( ) <nl> if ( m_hidexbmc & & ! m_islauncher ) <nl> { <nl> CLog : : Log ( LOGNOTICE , " % s : Hiding % s window " , __FUNCTION__ , CCompileInfo : : GetAppName ( ) ) ; <nl> - g_Windowing . Hide ( ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Hide ( ) ; <nl> } <nl> # if defined ( TARGET_WINDOWS_DESKTOP ) <nl> else if ( currentStyle & WS_EX_TOPMOST ) <nl> void CExternalPlayer : : Process ( ) <nl> if ( m_hidexbmc ) <nl> { <nl> CLog : : Log ( LOGNOTICE , " % s : % s cannot stay hidden for a launcher process " , __FUNCTION__ , CCompileInfo : : GetAppName ( ) ) ; <nl> - g_Windowing . Show ( false ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Show ( false ) ; <nl> } <nl> <nl> { <nl> void CExternalPlayer : : Process ( ) <nl> # endif <nl> { <nl> CLog : : Log ( LOGNOTICE , " % s : Showing % s window " , __FUNCTION__ , CCompileInfo : : GetAppName ( ) ) ; <nl> - g_Windowing . Show ( ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Show ( ) ; <nl> } <nl> <nl> # if defined ( TARGET_WINDOWS_DESKTOP ) <nl> mmm a / xbmc / cores / RetroPlayer / RetroPlayer . cpp <nl> ppp b / xbmc / cores / RetroPlayer / RetroPlayer . cpp <nl> <nl> # include " FileItem . h " <nl> # include " ServiceBroker . h " <nl> # include " URL . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> using namespace KODI ; <nl> using namespace GAME ; <nl> CRetroPlayer : : CRetroPlayer ( IPlayerCallback & callback ) : <nl> IPlayer ( callback ) , <nl> m_gameServices ( CServiceBroker : : GetGameServices ( ) ) <nl> { <nl> - g_Windowing . RegisterRenderLoop ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . RegisterRenderLoop ( this ) ; <nl> } <nl> <nl> CRetroPlayer : : ~ CRetroPlayer ( ) <nl> { <nl> - g_Windowing . UnregisterRenderLoop ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . UnregisterRenderLoop ( this ) ; <nl> CloseFile ( ) ; <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / process / RPProcessInfo . cpp <nl> ppp b / xbmc / cores / RetroPlayer / process / RPProcessInfo . cpp <nl> <nl> * / <nl> <nl> # include " RPProcessInfo . h " <nl> + # include " ServiceBroker . h " <nl> # include " cores / RetroPlayer / process / RenderBufferManager . h " <nl> # include " cores / RetroPlayer / rendering / RenderContext . h " <nl> # include " cores / DataCacheCore . h " <nl> <nl> # include " settings / DisplaySettings . h " <nl> # include " settings / MediaSettings . h " <nl> # include " threads / SingleLock . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> extern " C " { <nl> # include " libavutil / pixdesc . h " <nl> CCriticalSection CRPProcessInfo : : m_createSection ; <nl> <nl> CRPProcessInfo : : CRPProcessInfo ( ) : <nl> m_renderBufferManager ( new CRenderBufferManager ) , <nl> - m_renderContext ( new CRenderContext ( & g_Windowing , <nl> - & g_Windowing , <nl> + m_renderContext ( new CRenderContext ( & CServiceBroker : : GetRenderSystem ( ) , <nl> + & CServiceBroker : : GetWinSystem ( ) , <nl> g_graphicsContext , <nl> CDisplaySettings : : GetInstance ( ) , <nl> CMediaSettings : : GetInstance ( ) ) ) <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RenderContext . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RenderContext . cpp <nl> <nl> # include " rendering / RenderSystem . h " <nl> # include " settings / DisplaySettings . h " <nl> # include " settings / MediaSettings . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " system_gl . h " <nl> <nl> # if defined ( HAS_GL ) <nl> mmm a / xbmc / cores / VideoPlayer / DVDCodecs / Video / DVDVideoCodec . cpp <nl> ppp b / xbmc / cores / VideoPlayer / DVDCodecs / Video / DVDVideoCodec . cpp <nl> <nl> # include " DVDVideoCodec . h " <nl> # include " ServiceBroker . h " <nl> # include " cores / VideoPlayer / DVDCodecs / DVDFactoryCodec . h " <nl> + # include " rendering / RenderSystem . h " <nl> # include " settings / Settings . h " <nl> # include " settings / lib / Setting . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include < string > <nl> # include < vector > <nl> <nl> bool CDVDVideoCodec : : IsSettingVisible ( const std : : string & condition , const std : : s <nl> } <nl> <nl> / / check if we are running on nvidia hardware <nl> - std : : string gpuvendor = g_Windowing . GetRenderVendor ( ) ; <nl> + std : : string gpuvendor = CServiceBroker : : GetRenderSystem ( ) . GetRenderVendor ( ) ; <nl> std : : transform ( gpuvendor . begin ( ) , gpuvendor . end ( ) , gpuvendor . begin ( ) , : : tolower ) ; <nl> bool isNvidia = ( gpuvendor . compare ( 0 , 6 , " nvidia " ) = = 0 ) ; <nl> bool isIntel = ( gpuvendor . compare ( 0 , 5 , " intel " ) = = 0 ) ; <nl> mmm a / xbmc / cores / VideoPlayer / DVDCodecs / Video / VAAPI . cpp <nl> ppp b / xbmc / cores / VideoPlayer / DVDCodecs / Video / VAAPI . cpp <nl> <nl> * / <nl> # include " VAAPI . h " <nl> # include " ServiceBroker . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include " DVDVideoCodec . h " <nl> # include " cores / VideoPlayer / DVDCodecs / DVDCodecUtils . h " <nl> # include " cores / VideoPlayer / DVDCodecs / DVDFactoryCodec . h " <nl> void CVAAPIContext : : SetValidDRMVaDisplayFromRenderNode ( ) <nl> <nl> void CVAAPIContext : : SetVaDisplayForSystem ( ) <nl> { <nl> - m_display = g_Windowing . GetVaDisplay ( ) ; <nl> + m_display = CDecoder : : m_pWinSystem - > GetVADisplay ( ) ; <nl> <nl> / / Fallback to DRM <nl> if ( ! m_display ) <nl> bool CVideoSurfaces : : HasRefs ( ) <nl> <nl> bool CDecoder : : m_capGeneral = false ; <nl> bool CDecoder : : m_capHevc = false ; <nl> + IVaapiWinSystem * CDecoder : : m_pWinSystem = nullptr ; <nl> <nl> CDecoder : : CDecoder ( CProcessInfo & processInfo ) : <nl> m_vaapiOutput ( * this , & m_inMsgEvent ) , <nl> IHardwareDecoder * CDecoder : : Create ( CDVDStreamInfo & hint , CProcessInfo & processIn <nl> return nullptr ; <nl> } <nl> <nl> - void CDecoder : : Register ( bool hevc ) <nl> + void CDecoder : : Register ( IVaapiWinSystem * winSystem , bool hevc ) <nl> { <nl> + m_pWinSystem = winSystem ; <nl> + <nl> CVaapiConfig config ; <nl> if ( ! CVAAPIContext : : EnsureContext ( & config . context , nullptr ) ) <nl> return ; <nl> mmm a / xbmc / cores / VideoPlayer / DVDCodecs / Video / VAAPI . h <nl> ppp b / xbmc / cores / VideoPlayer / DVDCodecs / Video / VAAPI . h <nl> class CVAAPIContext <nl> int m_renderNodeFD { - 1 } ; <nl> } ; <nl> <nl> - / * * <nl> - * VAAPI main class <nl> - * / <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / Interface into windowing <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + class IVaapiWinSystem <nl> + { <nl> + public : <nl> + virtual VADisplay GetVADisplay ( ) = 0 ; <nl> + virtual void * GetEGLDisplay ( ) { return nullptr ; } ; <nl> + } ; <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / VAAPI main class <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> class CDecoder <nl> : public IHardwareDecoder <nl> { <nl> class CDecoder <nl> static int FFGetBuffer ( AVCodecContext * avctx , AVFrame * pic , int flags ) ; <nl> <nl> static IHardwareDecoder * Create ( CDVDStreamInfo & hint , CProcessInfo & processInfo , AVPixelFormat fmt ) ; <nl> - static void Register ( bool hevc ) ; <nl> + static void Register ( IVaapiWinSystem * winSystem , bool hevc ) ; <nl> + <nl> + static IVaapiWinSystem * m_pWinSystem ; <nl> <nl> protected : <nl> void SetWidthHeight ( int width , int height ) ; <nl> mmm a / xbmc / cores / VideoPlayer / DVDCodecs / Video / VDPAU . cpp <nl> ppp b / xbmc / cores / VideoPlayer / DVDCodecs / Video / VDPAU . cpp <nl> <nl> # include " VDPAU . h " <nl> # include " ServiceBroker . h " <nl> # include < dlfcn . h > <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / X11 / WinSystemX11 . h " <nl> # include " guilib / GraphicContext . h " <nl> # include " guilib / TextureManager . h " <nl> # include " cores / VideoPlayer / DVDCodecs / DVDFactoryCodec . h " <nl> # include " cores / VideoPlayer / Process / ProcessInfo . h " <nl> # include " cores / VideoPlayer / VideoRenderers / RenderManager . h " <nl> # include " cores / VideoPlayer / Interface / Addon / TimingConstants . h " <nl> + # include " rendering / RenderSystem . h " <nl> # include " settings / Settings . h " <nl> # include " settings / AdvancedSettings . h " <nl> # include " Application . h " <nl> bool CVDPAUContext : : CreateContext ( ) <nl> if ( ! m_display ) <nl> return false ; <nl> <nl> - mScreen = g_Windowing . GetCurrentScreen ( ) ; <nl> + mScreen = CServiceBroker : : GetWinSystem ( ) . GetCurrentScreen ( ) ; <nl> } <nl> <nl> VdpStatus vdp_st ; <nl> CDecoder : : CDecoder ( CProcessInfo & processInfo ) : <nl> bool CDecoder : : Open ( AVCodecContext * avctx , AVCodecContext * mainctx , const enum AVPixelFormat fmt ) <nl> { <nl> / / check if user wants to decode this format with VDPAU <nl> - std : : string gpuvendor = g_Windowing . GetRenderVendor ( ) ; <nl> + std : : string gpuvendor = CServiceBroker : : GetRenderSystem ( ) . GetRenderVendor ( ) ; <nl> std : : transform ( gpuvendor . begin ( ) , gpuvendor . end ( ) , gpuvendor . begin ( ) , : : tolower ) ; <nl> / / nvidia is whitelisted despite for mpeg - 4 we need to query user settings <nl> if ( ( gpuvendor . compare ( 0 , 6 , " nvidia " ) ! = 0 ) | | ( avctx - > codec_id = = AV_CODEC_ID_MPEG4 ) | | ( avctx - > codec_id = = AV_CODEC_ID_H263 ) ) <nl> bool CDecoder : : Open ( AVCodecContext * avctx , AVCodecContext * mainctx , const enum A <nl> return false ; <nl> } <nl> <nl> - if ( ! g_Windowing . IsExtSupported ( " GL_NV_vdpau_interop " ) ) <nl> + if ( ! CServiceBroker : : GetRenderSystem ( ) . IsExtSupported ( " GL_NV_vdpau_interop " ) ) <nl> { <nl> CLog : : Log ( LOGNOTICE , " VDPAU : : Open : required extension GL_NV_vdpau_interop not found " ) ; <nl> return false ; <nl> bool CDecoder : : Open ( AVCodecContext * avctx , AVCodecContext * mainctx , const enum A <nl> avctx - > slice_flags = SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD ; <nl> avctx - > hwaccel_context = & m_hwContext ; <nl> <nl> - g_Windowing . Register ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Register ( this ) ; <nl> m_avctx = mainctx ; <nl> return true ; <nl> } <nl> void CDecoder : : Close ( ) <nl> { <nl> CLog : : Log ( LOGNOTICE , " ( VDPAU ) % s " , __FUNCTION__ ) ; <nl> <nl> - g_Windowing . Unregister ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Unregister ( this ) ; <nl> <nl> CSingleLock lock ( m_DecoderSection ) ; <nl> <nl> mmm a / xbmc / cores / VideoPlayer / VideoPlayer . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoPlayer . cpp <nl> <nl> # include " cores / omxplayer / OMXHelper . h " <nl> # endif <nl> # include " VideoPlayerAudio . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " DVDCodecs / DVDCodecUtils . h " <nl> <nl> # include < iterator > <nl> CVideoPlayer : : CVideoPlayer ( IPlayerCallback & callback ) <nl> <nl> m_displayLost = false ; <nl> m_error = false ; <nl> - g_Windowing . Register ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Register ( this ) ; <nl> } <nl> <nl> CVideoPlayer : : ~ CVideoPlayer ( ) <nl> { <nl> - g_Windowing . Unregister ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Unregister ( this ) ; <nl> <nl> CloseFile ( ) ; <nl> DestroyPlayers ( ) ; <nl> void CVideoPlayer : : Prepare ( ) <nl> <nl> void CVideoPlayer : : Process ( ) <nl> { <nl> - g_Windowing . RegisterRenderLoop ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . RegisterRenderLoop ( this ) ; <nl> <nl> Prepare ( ) ; <nl> <nl> void CVideoPlayer : : Process ( ) <nl> ProcessPacket ( pStream , pPacket ) ; <nl> } <nl> <nl> - g_Windowing . UnregisterRenderLoop ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . UnregisterRenderLoop ( this ) ; <nl> } <nl> <nl> bool CVideoPlayer : : CheckIsCurrent ( CCurrentStream & current , CDemuxStream * stream , DemuxPacket * pkg ) <nl> { <nl> - if ( current . id = = pkg - > iStreamId <nl> - & & current . demuxerId = = stream - > demuxerId <nl> - & & current . source = = stream - > source <nl> - & & current . type = = stream - > type ) <nl> + if ( current . id = = pkg - > iStreamId & & <nl> + current . demuxerId = = stream - > demuxerId & & <nl> + current . source = = stream - > source & & <nl> + current . type = = stream - > type ) <nl> return true ; <nl> else <nl> return false ; <nl> mmm a / xbmc / cores / VideoPlayer / VideoPlayerVideo . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoPlayerVideo . cpp <nl> <nl> # include " system . h " <nl> # include " ServiceBroker . h " <nl> # include " cores / VideoPlayer / VideoRenderers / RenderFlags . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " settings / AdvancedSettings . h " <nl> # include " settings / Settings . h " <nl> # include " utils / MathUtils . h " <nl> mmm a / xbmc / cores / VideoPlayer / VideoReferenceClock . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoReferenceClock . cpp <nl> <nl> # include " guilib / GraphicContext . h " <nl> # include " settings / Settings . h " <nl> # include " windowing / VideoSync . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> CVideoReferenceClock : : CVideoReferenceClock ( ) : CThread ( " RefClock " ) <nl> { <nl> void CVideoReferenceClock : : Process ( ) <nl> <nl> while ( ! m_bStop ) <nl> { <nl> - m_pVideoSync = g_Windowing . GetVideoSync ( this ) ; <nl> + m_pVideoSync = CServiceBroker : : GetWinSystem ( ) . GetVideoSync ( this ) ; <nl> <nl> if ( m_pVideoSync ) <nl> { <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / FrameBufferObject . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / FrameBufferObject . cpp <nl> <nl> # include " system . h " <nl> <nl> # include " FrameBufferObject . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " ServiceBroker . h " <nl> + # include " rendering / RenderSystem . h " <nl> # include " utils / GLUtils . h " <nl> # include " utils / log . h " <nl> <nl> CFrameBufferObject : : CFrameBufferObject ( ) <nl> <nl> bool CFrameBufferObject : : IsSupported ( ) <nl> { <nl> - if ( g_Windowing . IsExtSupported ( " GL_EXT_framebuffer_object " ) ) <nl> + if ( CServiceBroker : : GetRenderSystem ( ) . IsExtSupported ( " GL_EXT_framebuffer_object " ) ) <nl> m_supported = true ; <nl> else <nl> m_supported = false ; <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGL . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGL . cpp <nl> <nl> # include " settings / AdvancedSettings . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> <nl> using namespace VAAPI ; <nl> <nl> + IVaapiWinSystem * CRendererVAAPI : : m_pWinSystem = nullptr ; <nl> + <nl> CBaseRenderer * CRendererVAAPI : : Create ( CVideoBuffer * buffer ) <nl> { <nl> CVaapiRenderPicture * vb = dynamic_cast < CVaapiRenderPicture * > ( buffer ) ; <nl> CBaseRenderer * CRendererVAAPI : : Create ( CVideoBuffer * buffer ) <nl> return nullptr ; <nl> } <nl> <nl> - void CRendererVAAPI : : Register ( VADisplay vaDpy , EGLDisplay eglDisplay , bool & general , bool & hevc ) <nl> + void CRendererVAAPI : : Register ( IVaapiWinSystem * winSystem , VADisplay vaDpy , EGLDisplay eglDisplay , bool & general , bool & hevc ) <nl> { <nl> CVaapiTexture : : TestInterop ( vaDpy , eglDisplay , general , hevc ) ; <nl> if ( general ) <nl> + { <nl> VIDEOPLAYER : : CRendererFactory : : RegisterRenderer ( " vaapi " , CRendererVAAPI : : Create ) ; <nl> + m_pWinSystem = winSystem ; <nl> + } <nl> } <nl> <nl> CRendererVAAPI : : CRendererVAAPI ( ) = default ; <nl> bool CRendererVAAPI : : Configure ( const VideoPicture & picture , float fps , unsigned <nl> interop . eglCreateImageKHR = ( PFNEGLCREATEIMAGEKHRPROC ) eglGetProcAddress ( " eglCreateImageKHR " ) ; <nl> interop . eglDestroyImageKHR = ( PFNEGLDESTROYIMAGEKHRPROC ) eglGetProcAddress ( " eglDestroyImageKHR " ) ; <nl> interop . glEGLImageTargetTexture2DOES = ( PFNGLEGLIMAGETARGETTEXTURE2DOESPROC ) eglGetProcAddress ( " glEGLImageTargetTexture2DOES " ) ; <nl> - interop . eglDisplay = g_Windowing . GetEGLDisplay ( ) ; <nl> + interop . eglDisplay = CRendererVAAPI : : m_pWinSystem - > GetEGLDisplay ( ) ; <nl> <nl> for ( auto & tex : m_vaapiTextures ) <nl> { <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGL . h <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGL . h <nl> <nl> # include " cores / VideoPlayer / VideoRenderers / LinuxRendererGL . h " <nl> # include " VaapiEGL . h " <nl> <nl> + namespace VAAPI <nl> + { <nl> + class IVaapiWinSystem ; <nl> + } <nl> + <nl> class CRendererVAAPI : public CLinuxRendererGL <nl> { <nl> public : <nl> class CRendererVAAPI : public CLinuxRendererGL <nl> ~ CRendererVAAPI ( ) override ; <nl> <nl> static CBaseRenderer * Create ( CVideoBuffer * buffer ) ; <nl> - static void Register ( VADisplay vaDpy , EGLDisplay eglDisplay , bool & general , bool & hevc ) ; <nl> + static void Register ( VAAPI : : IVaapiWinSystem * winSystem , VADisplay vaDpy , EGLDisplay eglDisplay , bool & general , bool & hevc ) ; <nl> <nl> bool Configure ( const VideoPicture & picture , float fps , unsigned flags , unsigned int orientation ) override ; <nl> <nl> class CRendererVAAPI : public CLinuxRendererGL <nl> bool m_isVAAPIBuffer = true ; <nl> VAAPI : : CVaapiTexture m_vaapiTextures [ NUM_BUFFERS ] ; <nl> GLsync m_fences [ NUM_BUFFERS ] ; <nl> + static VAAPI : : IVaapiWinSystem * m_pWinSystem ; <nl> } ; <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGLES . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGLES . cpp <nl> <nl> # include " settings / AdvancedSettings . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> <nl> using namespace VAAPI ; <nl> <nl> + IVaapiWinSystem * CRendererVAAPI : : m_pWinSystem = nullptr ; <nl> + <nl> CBaseRenderer * CRendererVAAPI : : Create ( CVideoBuffer * buffer ) <nl> { <nl> CVaapiRenderPicture * vb = dynamic_cast < CVaapiRenderPicture * > ( buffer ) ; <nl> CBaseRenderer * CRendererVAAPI : : Create ( CVideoBuffer * buffer ) <nl> return nullptr ; <nl> } <nl> <nl> - void CRendererVAAPI : : Register ( VADisplay vaDpy , EGLDisplay eglDisplay , bool & general , bool & hevc ) <nl> + void CRendererVAAPI : : Register ( IVaapiWinSystem * winSystem , VADisplay vaDpy , EGLDisplay eglDisplay , bool & general , bool & hevc ) <nl> { <nl> CVaapiTexture : : TestInterop ( vaDpy , eglDisplay , general , hevc ) ; <nl> if ( general ) <nl> + { <nl> VIDEOPLAYER : : CRendererFactory : : RegisterRenderer ( " vaapi " , CRendererVAAPI : : Create ) ; <nl> + m_pWinSystem = winSystem ; <nl> + } <nl> } <nl> <nl> CRendererVAAPI : : CRendererVAAPI ( ) = default ; <nl> bool CRendererVAAPI : : Configure ( const VideoPicture & picture , float fps , unsigned <nl> interop . eglCreateImageKHR = ( PFNEGLCREATEIMAGEKHRPROC ) eglGetProcAddress ( " eglCreateImageKHR " ) ; <nl> interop . eglDestroyImageKHR = ( PFNEGLDESTROYIMAGEKHRPROC ) eglGetProcAddress ( " eglDestroyImageKHR " ) ; <nl> interop . glEGLImageTargetTexture2DOES = ( PFNGLEGLIMAGETARGETTEXTURE2DOESPROC ) eglGetProcAddress ( " glEGLImageTargetTexture2DOES " ) ; <nl> - interop . eglDisplay = g_Windowing . GetEGLDisplay ( ) ; <nl> + interop . eglDisplay = m_pWinSystem - > GetEGLDisplay ( ) ; <nl> <nl> for ( auto & tex : m_vaapiTextures ) <nl> { <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGLES . h <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGLES . h <nl> <nl> # include " cores / VideoPlayer / VideoRenderers / LinuxRendererGLES . h " <nl> # include " VaapiEGL . h " <nl> <nl> + namespace VAAPI <nl> + { <nl> + class IVaapiWinSystem ; <nl> + } <nl> + <nl> class CRendererVAAPI : public CLinuxRendererGLES <nl> { <nl> public : <nl> class CRendererVAAPI : public CLinuxRendererGLES <nl> ~ CRendererVAAPI ( ) override ; <nl> <nl> static CBaseRenderer * Create ( CVideoBuffer * buffer ) ; <nl> - static void Register ( VADisplay vaDpy , EGLDisplay eglDisplay , bool & general , bool & hevc ) ; <nl> + static void Register ( VAAPI : : IVaapiWinSystem * winSystem , VADisplay vaDpy , EGLDisplay eglDisplay , bool & general , bool & hevc ) ; <nl> <nl> bool Configure ( const VideoPicture & picture , float fps , unsigned flags , unsigned int orientation ) override ; <nl> <nl> class CRendererVAAPI : public CLinuxRendererGLES <nl> bool m_isVAAPIBuffer = true ; <nl> VAAPI : : CVaapiTexture m_vaapiTextures [ NUM_BUFFERS ] ; <nl> GLsync m_fences [ NUM_BUFFERS ] ; <nl> + static VAAPI : : IVaapiWinSystem * m_pWinSystem ; <nl> } ; <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVDPAU . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVDPAU . cpp <nl> <nl> # include " settings / AdvancedSettings . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> <nl> using namespace VDPAU ; <nl> <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVTBGL . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVTBGL . cpp <nl> <nl> <nl> # include " RendererVTBGL . h " <nl> # include " . . / RenderFactory . h " <nl> + # include " ServiceBroker . h " <nl> # include " settings / Settings . h " <nl> # include " settings / AdvancedSettings . h " <nl> # include " cores / VideoPlayer / DVDCodecs / Video / DVDVideoCodec . h " <nl> <nl> # include " platform / darwin / osx / CocoaInterface . h " <nl> # include < CoreVideo / CoreVideo . h > <nl> # include < OpenGL / CGLIOSurface . h > <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> + # include " windowing / osx / WinSystemOSX . h " <nl> <nl> CBaseRenderer * CRendererVTB : : Create ( CVideoBuffer * buffer ) <nl> { <nl> bool CRendererVTB : : UploadTexture ( int index ) <nl> <nl> / / It is the fastest way to render a CVPixelBuffer backed <nl> / / with an IOSurface as there is no CPU - > GPU upload . <nl> - CGLContextObj cgl_ctx = ( CGLContextObj ) g_Windowing . GetCGLContextObj ( ) ; <nl> + CWinSystemOSX & winSystem = dynamic_cast < CWinSystemOSX & > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> + CGLContextObj cgl_ctx = ( CGLContextObj ) winSystem . GetCGLContextObj ( ) ; <nl> IOSurfaceRef surface = CVPixelBufferGetIOSurface ( cvBufferRef ) ; <nl> OSType format_type = IOSurfaceGetPixelFormat ( surface ) ; <nl> <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVTBGLES . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVTBGLES . cpp <nl> <nl> <nl> # include " RendererVTBGLES . h " <nl> # include " . . / RenderFactory . h " <nl> + # include " ServiceBroker . h " <nl> # include " cores / IPlayer . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> # include " cores / VideoPlayer / DVDCodecs / Video / VTB . h " <nl> # include " settings / MediaSettings . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / osx / WinSystemIOS . h " <nl> # include " platform / darwin / DarwinUtils . h " <nl> # include < CoreVideo / CVBuffer . h > <nl> # include < CoreVideo / CVPixelBuffer . h > <nl> bool CRendererVTB : : Register ( ) <nl> CRendererVTB : : CRendererVTB ( ) <nl> { <nl> m_textureCache = nullptr ; <nl> + CWinSystemIOS & winSystem = dynamic_cast < CWinSystemIOS & > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> + m_glContext = winSystem . GetEAGLContextObj ( ) ; <nl> CVReturn ret = CVOpenGLESTextureCacheCreate ( kCFAllocatorDefault , <nl> NULL , <nl> - g_Windowing . GetEAGLContextObj ( ) , <nl> + m_glContext , <nl> NULL , <nl> & m_textureCache ) ; <nl> if ( ret ! = kCVReturnSuccess ) <nl> bool CRendererVTB : : LoadShadersHook ( ) <nl> <nl> CVReturn ret = CVOpenGLESTextureCacheCreate ( kCFAllocatorDefault , <nl> NULL , <nl> - g_Windowing . GetEAGLContextObj ( ) , <nl> + m_glContext , <nl> NULL , <nl> & m_textureCache ) ; <nl> if ( ret ! = kCVReturnSuccess ) <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVTBGLES . h <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVTBGLES . h <nl> class CRendererVTB : public CLinuxRendererGLES <nl> GLsync m_fence ; <nl> } ; <nl> CRenderBuffer m_vtbBuffers [ NUM_BUFFERS ] ; <nl> + CVEAGLContext m_glContext ; <nl> } ; <nl> <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / LinuxRendererGL . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / LinuxRendererGL . cpp <nl> <nl> # include " settings / Settings . h " <nl> # include " VideoShaders / YUV2RGBShaderGL . h " <nl> # include " VideoShaders / VideoFilterShaderGL . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " guilib / Texture . h " <nl> # include " guilib / LocalizeStrings . h " <nl> # include " guilib / MatrixGLES . h " <nl> + # include " rendering / gl / RenderSystemGL . h " <nl> # include " threads / SingleLock . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> CLinuxRendererGL : : CLinuxRendererGL ( ) <nl> m_scalingMethodGui = ( ESCALINGMETHOD ) - 1 ; <nl> m_useDithering = CServiceBroker : : GetSettings ( ) . GetBool ( " videoscreen . dither " ) ; <nl> m_ditherDepth = CServiceBroker : : GetSettings ( ) . GetInt ( " videoscreen . ditherdepth " ) ; <nl> - m_fullRange = ! g_Windowing . UseLimitedColor ( ) ; <nl> + m_fullRange = ! CServiceBroker : : GetWinSystem ( ) . UseLimitedColor ( ) ; <nl> <nl> m_fbo . width = 0 . 0 ; <nl> m_fbo . height = 0 . 0 ; <nl> CLinuxRendererGL : : CLinuxRendererGL ( ) <nl> m_CLUTsize = 0 ; <nl> m_cmsToken = - 1 ; <nl> m_cmsOn = false ; <nl> + <nl> + m_renderSystem = dynamic_cast < CRenderSystemGL * > ( & CServiceBroker : : GetRenderSystem ( ) ) ; <nl> } <nl> <nl> CLinuxRendererGL : : ~ CLinuxRendererGL ( ) <nl> bool CLinuxRendererGL : : ValidateRenderTarget ( ) <nl> { <nl> if ( ! m_bValidated ) <nl> { <nl> - if ( ! g_Windowing . IsExtSupported ( " GL_ARB_texture_non_power_of_two " ) & & <nl> - g_Windowing . IsExtSupported ( " GL_ARB_texture_rectangle " ) ) <nl> + if ( ! CServiceBroker : : GetRenderSystem ( ) . IsExtSupported ( " GL_ARB_texture_non_power_of_two " ) & & <nl> + CServiceBroker : : GetRenderSystem ( ) . IsExtSupported ( " GL_ARB_texture_rectangle " ) ) <nl> { <nl> m_textureTarget = GL_TEXTURE_RECTANGLE_ARB ; <nl> } <nl> bool CLinuxRendererGL : : Configure ( const VideoPicture & picture , float fps , unsigne <nl> m_nonLinStretchGui = false ; <nl> m_pixelRatio = 1 . 0 ; <nl> <nl> - m_pboSupported = g_Windowing . IsExtSupported ( " GL_ARB_pixel_buffer_object " ) ; <nl> + m_pboSupported = CServiceBroker : : GetRenderSystem ( ) . IsExtSupported ( " GL_ARB_pixel_buffer_object " ) ; <nl> <nl> / / setup the background colour <nl> - m_clearColour = g_Windowing . UseLimitedColor ( ) ? ( 16 . 0f / 0xff ) : 0 . 0f ; <nl> + m_clearColour = CServiceBroker : : GetWinSystem ( ) . UseLimitedColor ( ) ? ( 16 . 0f / 0xff ) : 0 . 0f ; <nl> <nl> # ifdef TARGET_DARWIN_OSX <nl> / / on osx 10 . 9 mavericks we get a strange ripple <nl> bool CLinuxRendererGL : : Configure ( const VideoPicture & picture , float fps , unsigne <nl> / / when used on intel gpu - we have to quirk it here <nl> if ( CDarwinUtils : : IsMavericksOrHigher ( ) ) <nl> { <nl> - std : : string rendervendor = g_Windowing . GetRenderVendor ( ) ; <nl> + std : : string rendervendor = CServiceBroker : : GetRenderSystem ( ) . GetRenderVendor ( ) ; <nl> StringUtils : : ToLower ( rendervendor ) ; <nl> if ( rendervendor . find ( " intel " ) ! = std : : string : : npos ) <nl> m_pboSupported = false ; <nl> void CLinuxRendererGL : : DrawBlackBars ( ) <nl> Svertex vertices [ 24 ] ; <nl> GLubyte count = 0 ; <nl> <nl> - g_Windowing . EnableShader ( SM_DEFAULT ) ; <nl> - GLint posLoc = g_Windowing . ShaderGetPos ( ) ; <nl> - GLint uniCol = g_Windowing . ShaderGetUniCol ( ) ; <nl> + m_renderSystem - > EnableShader ( SM_DEFAULT ) ; <nl> + GLint posLoc = m_renderSystem - > ShaderGetPos ( ) ; <nl> + GLint uniCol = m_renderSystem - > ShaderGetUniCol ( ) ; <nl> <nl> glUniform4f ( uniCol , m_clearColour / 255 . 0f , m_clearColour / 255 . 0f , m_clearColour / 255 . 0f , 1 . 0f ) ; <nl> <nl> void CLinuxRendererGL : : DrawBlackBars ( ) <nl> glBindBuffer ( GL_ARRAY_BUFFER , 0 ) ; <nl> glDeleteBuffers ( 1 , & vertexVBO ) ; <nl> <nl> - g_Windowing . DisableShader ( ) ; <nl> + m_renderSystem - > DisableShader ( ) ; <nl> } <nl> <nl> void CLinuxRendererGL : : UpdateVideoFilter ( ) <nl> void CLinuxRendererGL : : LoadShaders ( int field ) <nl> } <nl> <nl> / / determine whether GPU supports NPOT textures <nl> - if ( ! g_Windowing . IsExtSupported ( " GL_ARB_texture_non_power_of_two " ) ) <nl> + if ( ! m_renderSystem - > IsExtSupported ( " GL_ARB_texture_non_power_of_two " ) ) <nl> { <nl> - if ( ! g_Windowing . IsExtSupported ( " GL_ARB_texture_rectangle " ) ) <nl> + if ( ! m_renderSystem - > IsExtSupported ( " GL_ARB_texture_rectangle " ) ) <nl> { <nl> CLog : : Log ( LOGWARNING , " GL : GL_ARB_texture_rectangle not supported and OpenGL version is not 2 . x " ) ; <nl> } <nl> void CLinuxRendererGL : : RenderToFBO ( int index , int field , bool weave / * = false * / ) <nl> glMatrixProject . Load ( ) ; <nl> <nl> CRect viewport ; <nl> - g_Windowing . GetViewPort ( viewport ) ; <nl> + m_renderSystem - > GetViewPort ( viewport ) ; <nl> glViewport ( 0 , 0 , m_sourceWidth , m_sourceHeight ) ; <nl> glScissor ( 0 , 0 , m_sourceWidth , m_sourceHeight ) ; <nl> <nl> void CLinuxRendererGL : : RenderToFBO ( int index , int field , bool weave / * = false * / ) <nl> glMatrixModview . PopLoad ( ) ; <nl> glMatrixProject . PopLoad ( ) ; <nl> <nl> - g_Windowing . SetViewPort ( viewport ) ; <nl> + m_renderSystem - > SetViewPort ( viewport ) ; <nl> <nl> m_fbo . fbo . EndRender ( ) ; <nl> <nl> bool CLinuxRendererGL : : Supports ( ERENDERFEATURE feature ) <nl> <nl> bool CLinuxRendererGL : : SupportsMultiPassRendering ( ) <nl> { <nl> - return g_Windowing . IsExtSupported ( " GL_EXT_framebuffer_object " ) ; <nl> + return m_renderSystem - > IsExtSupported ( " GL_EXT_framebuffer_object " ) ; <nl> } <nl> <nl> bool CLinuxRendererGL : : Supports ( ESCALINGMETHOD method ) <nl> bool CLinuxRendererGL : : Supports ( ESCALINGMETHOD method ) <nl> <nl> bool hasFramebuffer = false ; <nl> unsigned int major , minor ; <nl> - g_Windowing . GetRenderVersion ( major , minor ) ; <nl> + m_renderSystem - > GetRenderVersion ( major , minor ) ; <nl> if ( major > 3 | | <nl> ( major = = 3 & & minor > = 2 ) ) <nl> hasFramebuffer = true ; <nl> - if ( g_Windowing . IsExtSupported ( " GL_EXT_framebuffer_object " ) ) <nl> + if ( m_renderSystem - > IsExtSupported ( " GL_EXT_framebuffer_object " ) ) <nl> hasFramebuffer = true ; <nl> if ( hasFramebuffer & & ( m_renderMethod & RENDER_GLSL ) ) <nl> { <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / LinuxRendererGL . h <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / LinuxRendererGL . h <nl> <nl> # include " VideoShaders / ShaderFormats . h " <nl> <nl> class CRenderCapture ; <nl> + class CRenderSystemGL ; <nl> <nl> class CBaseTexture ; <nl> namespace Shaders { class BaseYUV2RGBGLSLShader ; } <nl> class CLinuxRendererGL : public CBaseRenderer <nl> GLenum m_textureTarget ; <nl> int m_renderMethod ; <nl> RenderQuality m_renderQuality ; <nl> + CRenderSystemGL * m_renderSystem ; <nl> <nl> / / Raw data used by renderer <nl> int m_currentField ; <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / LinuxRendererGLES . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / LinuxRendererGLES . cpp <nl> <nl> * <nl> * / <nl> <nl> - / / # define DEBUG_VERBOSE 1 <nl> - <nl> # include " system . h " <nl> <nl> - # if HAS_GLES > = 2 <nl> # include " system_gl . h " <nl> <nl> # include < locale . h > <nl> <nl> # include " settings / Settings . h " <nl> # include " VideoShaders / YUV2RGBShaderGLES . h " <nl> # include " VideoShaders / VideoFilterShaderGLES . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / gles / RenderSystemGLES . h " <nl> # include " guilib / Texture . h " <nl> # include " threads / SingleLock . h " <nl> # include " RenderCapture . h " <nl> # include " Application . h " <nl> # include " RenderFactory . h " <nl> # include " cores / IPlayer . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> # if defined ( __ARM_NEON__ ) & & ! defined ( __LP64__ ) <nl> # include " yuv2rgb . neon . h " <nl> CLinuxRendererGLES : : CLinuxRendererGLES ( ) <nl> m_fbo . width = 0 . 0 ; <nl> m_fbo . height = 0 . 0 ; <nl> <nl> + m_renderSystem = dynamic_cast < CRenderSystemGLES * > ( & CServiceBroker : : GetRenderSystem ( ) ) ; <nl> + <nl> # if defined ( EGL_KHR_reusable_sync ) & & ! defined ( EGL_EGLEXT_PROTOTYPES ) <nl> if ( ! eglCreateSyncKHR ) { <nl> eglCreateSyncKHR = ( PFNEGLCREATESYNCKHRPROC ) eglGetProcAddress ( " eglCreateSyncKHR " ) ; <nl> void CLinuxRendererGLES : : LoadShaders ( int field ) <nl> } <nl> } <nl> <nl> - / / determine whether GPU supports NPOT textures <nl> - if ( ! g_Windowing . IsExtSupported ( " GL_TEXTURE_NPOT " ) ) <nl> - { <nl> - CLog : : Log ( LOGNOTICE , " GL : GL_ARB_texture_rectangle not supported and OpenGL version is not 2 . x " ) ; <nl> - CLog : : Log ( LOGNOTICE , " GL : Reverting to POT textures " ) ; <nl> - m_renderMethod | = RENDER_POT ; <nl> - } <nl> - else <nl> - CLog : : Log ( LOGNOTICE , " GL : NPOT texture support detected " ) ; <nl> - <nl> if ( m_oldRenderMethod ! = m_renderMethod ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " CLinuxRendererGLES : Reorder drawpoints due to method change from % i to % i " , m_oldRenderMethod , m_renderMethod ) ; <nl> void CLinuxRendererGLES : : RenderSinglePass ( int index , int field ) <nl> pYUVShader - > SetField ( 0 ) ; <nl> <nl> pYUVShader - > SetMatrices ( glMatrixProject . Get ( ) , glMatrixModview . Get ( ) ) ; <nl> - pYUVShader - > SetConvertFullColorRange ( ! g_Windowing . UseLimitedColor ( ) ) ; <nl> + pYUVShader - > SetConvertFullColorRange ( ! CServiceBroker : : GetWinSystem ( ) . UseLimitedColor ( ) ) ; <nl> pYUVShader - > Enable ( ) ; <nl> <nl> GLubyte idx [ 4 ] = { 0 , 1 , 3 , 2 } ; / / determines order of triangle strip <nl> void CLinuxRendererGLES : : RenderToFBO ( int index , int field , bool weave / * = false * <nl> else if ( field = = FIELD_BOT ) <nl> pYUVShader - > SetField ( 0 ) ; <nl> <nl> - pYUVShader - > SetConvertFullColorRange ( ! g_Windowing . UseLimitedColor ( ) ) ; <nl> + pYUVShader - > SetConvertFullColorRange ( ! CServiceBroker : : GetWinSystem ( ) . UseLimitedColor ( ) ) ; <nl> <nl> VerifyGLState ( ) ; <nl> <nl> void CLinuxRendererGLES : : RenderToFBO ( int index , int field , bool weave / * = false * <nl> pYUVShader - > SetMatrices ( glMatrixProject . Get ( ) , glMatrixModview . Get ( ) ) ; <nl> <nl> CRect viewport ; <nl> - g_Windowing . GetViewPort ( viewport ) ; <nl> + m_renderSystem - > GetViewPort ( viewport ) ; <nl> glViewport ( 0 , 0 , m_sourceWidth , m_sourceHeight ) ; <nl> glScissor ( 0 , 0 , m_sourceWidth , m_sourceHeight ) ; <nl> <nl> void CLinuxRendererGLES : : RenderToFBO ( int index , int field , bool weave / * = false * <nl> glDisableVertexAttribArray ( Uloc ) ; <nl> glDisableVertexAttribArray ( Vloc ) ; <nl> <nl> - g_Windowing . SetViewPort ( viewport ) ; <nl> + m_renderSystem - > SetViewPort ( viewport ) ; <nl> <nl> m_fbo . fbo . EndRender ( ) ; <nl> <nl> bool CLinuxRendererGLES : : CreateYV12Texture ( int index ) <nl> planes [ p ] . pixpertex_y = 1 ; <nl> } <nl> <nl> - if ( m_renderMethod & RENDER_POT ) <nl> - { <nl> - for ( int p = 0 ; p < 3 ; p + + ) <nl> - { <nl> - planes [ p ] . texwidth = NP2 ( planes [ p ] . texwidth ) ; <nl> - planes [ p ] . texheight = NP2 ( planes [ p ] . texheight ) ; <nl> - } <nl> - } <nl> - <nl> for ( int p = 0 ; p < 3 ; p + + ) <nl> { <nl> YUVPLANE & plane = planes [ p ] ; <nl> bool CLinuxRendererGLES : : CreateNV12Texture ( int index ) <nl> planes [ p ] . pixpertex_y = 1 ; <nl> } <nl> <nl> - if ( m_renderMethod & RENDER_POT ) <nl> - { <nl> - for ( int p = 0 ; p < 3 ; p + + ) <nl> - { <nl> - planes [ p ] . texwidth = NP2 ( planes [ p ] . texwidth ) ; <nl> - planes [ p ] . texheight = NP2 ( planes [ p ] . texheight ) ; <nl> - } <nl> - } <nl> - <nl> for ( int p = 0 ; p < 2 ; p + + ) <nl> { <nl> YUVPLANE & plane = planes [ p ] ; <nl> bool CLinuxRendererGLES : : IsGuiLayer ( ) <nl> return true ; <nl> } <nl> <nl> - # endif <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / LinuxRendererGLES . h <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / LinuxRendererGLES . h <nl> <nl> - # ifndef LINUXRENDERERGLES_RENDERER <nl> - # define LINUXRENDERERGLES_RENDERER <nl> - <nl> / * <nl> * Copyright ( C ) 2010 - 2013 Team XBMC <nl> * http : / / xbmc . org <nl> <nl> * <nl> * / <nl> <nl> - # if HAS_GLES > = 2 <nl> + # pragma once <nl> + <nl> # include < vector > <nl> <nl> # include " system_gl . h " <nl> <nl> # include " xbmc / cores / VideoPlayer / DVDCodecs / Video / DVDVideoCodec . h " <nl> <nl> class CRenderCapture ; <nl> + class CRenderSystemGLES ; <nl> <nl> class CBaseTexture ; <nl> namespace Shaders { class BaseYUV2RGBShader ; } <nl> class CLinuxRendererGLES : public CBaseRenderer <nl> / / Raw data used by renderer <nl> int m_currentField ; <nl> int m_reloadShaders ; <nl> + CRenderSystemGLES * m_renderSystem ; <nl> <nl> struct YUVPLANE <nl> { <nl> class CLinuxRendererGLES : public CBaseRenderer <nl> float m_clearColour ; <nl> } ; <nl> <nl> - <nl> - inline int NP2 ( unsigned x ) <nl> - { <nl> - - - x ; <nl> - x | = x > > 1 ; <nl> - x | = x > > 2 ; <nl> - x | = x > > 4 ; <nl> - x | = x > > 8 ; <nl> - x | = x > > 16 ; <nl> - return + + x ; <nl> - } <nl> - # endif <nl> - <nl> - # endif <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / OverlayRendererGL . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / OverlayRendererGL . cpp <nl> <nl> # include " OverlayRendererUtil . h " <nl> # include " OverlayRendererGL . h " <nl> # ifdef HAS_GL <nl> - # include " LinuxRendererGL . h " <nl> + # include " LinuxRendererGL . h " <nl> + # include " rendering / gl / RenderSystemGL . h " <nl> # elif HAS_GLES > = 2 <nl> - # include " LinuxRendererGLES . h " <nl> + # include " LinuxRendererGLES . h " <nl> + # include " rendering / gles / RenderSystemGLES . h " <nl> # endif <nl> # include " guilib / MatrixGLES . h " <nl> # include " RenderManager . h " <nl> + # include " ServiceBroker . h " <nl> # include " cores / VideoPlayer / DVDCodecs / Overlay / DVDOverlayImage . h " <nl> # include " cores / VideoPlayer / DVDCodecs / Overlay / DVDOverlaySpu . h " <nl> # include " cores / VideoPlayer / DVDCodecs / Overlay / DVDOverlaySSA . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " settings / Settings . h " <nl> # include " utils / MathUtils . h " <nl> # include " utils / log . h " <nl> static void LoadTexture ( GLenum target <nl> int bytesPerPixel = glFormatElementByteCount ( externalFormat ) ; <nl> <nl> # ifdef HAS_GLES <nl> - if ( ! g_Windowing . SupportsNPOT ( 0 ) ) <nl> - { <nl> - width2 = NP2 ( width ) ; <nl> - height2 = NP2 ( height ) ; <nl> - } <nl> <nl> / * * OpenGL ES does not support BGR * * / <nl> if ( ! alpha ) <nl> void COverlayGlyphGL : : Render ( SRenderState & state ) <nl> glMatrixModview . Load ( ) ; <nl> <nl> # ifdef HAS_GL <nl> - g_Windowing . EnableShader ( SM_FONTS ) ; <nl> - GLint posLoc = g_Windowing . ShaderGetPos ( ) ; <nl> - GLint colLoc = g_Windowing . ShaderGetCol ( ) ; <nl> - GLint tex0Loc = g_Windowing . ShaderGetCoord0 ( ) ; <nl> + CRenderSystemGL & renderSystem = dynamic_cast < CRenderSystemGL & > ( CServiceBroker : : GetRenderSystem ( ) ) ; <nl> + renderSystem . EnableShader ( SM_FONTS ) ; <nl> + GLint posLoc = renderSystem . ShaderGetPos ( ) ; <nl> + GLint colLoc = renderSystem . ShaderGetCol ( ) ; <nl> + GLint tex0Loc = renderSystem . ShaderGetCoord0 ( ) ; <nl> <nl> std : : vector < VERTEX > vecVertices ( 6 * m_count ) ; <nl> VERTEX * vertices = & vecVertices [ 0 ] ; <nl> void COverlayGlyphGL : : Render ( SRenderState & state ) <nl> glBindBuffer ( GL_ARRAY_BUFFER , 0 ) ; <nl> glDeleteBuffers ( 1 , & VertexVBO ) ; <nl> <nl> - g_Windowing . DisableShader ( ) ; <nl> + renderSystem . DisableShader ( ) ; <nl> <nl> # else <nl> - g_Windowing . EnableGUIShader ( SM_FONTS ) ; <nl> - GLint posLoc = g_Windowing . GUIShaderGetPos ( ) ; <nl> - GLint colLoc = g_Windowing . GUIShaderGetCol ( ) ; <nl> - GLint tex0Loc = g_Windowing . GUIShaderGetCoord0 ( ) ; <nl> + CRenderSystemGLES & renderSystem = dynamic_cast < CRenderSystemGLES & > ( CServiceBroker : : GetRenderSystem ( ) ) ; <nl> + renderSystem . EnableGUIShader ( SM_FONTS ) ; <nl> + GLint posLoc = renderSystem . GUIShaderGetPos ( ) ; <nl> + GLint colLoc = renderSystem . GUIShaderGetCol ( ) ; <nl> + GLint tex0Loc = renderSystem . GUIShaderGetCoord0 ( ) ; <nl> <nl> / / stack object until VBOs will be used <nl> std : : vector < VERTEX > vecVertices ( 6 * m_count ) ; <nl> void COverlayGlyphGL : : Render ( SRenderState & state ) <nl> glDisableVertexAttribArray ( colLoc ) ; <nl> glDisableVertexAttribArray ( tex0Loc ) ; <nl> <nl> - g_Windowing . DisableGUIShader ( ) ; <nl> + renderSystem . DisableGUIShader ( ) ; <nl> # endif <nl> <nl> glMatrixModview . PopLoad ( ) ; <nl> void COverlayTextureGL : : Render ( SRenderState & state ) <nl> } <nl> <nl> # if defined ( HAS_GL ) <nl> - g_Windowing . EnableShader ( SM_TEXTURE ) ; <nl> - GLint posLoc = g_Windowing . ShaderGetPos ( ) ; <nl> - GLint tex0Loc = g_Windowing . ShaderGetCoord0 ( ) ; <nl> - GLint uniColLoc = g_Windowing . ShaderGetUniCol ( ) ; <nl> + CRenderSystemGL & renderSystem = dynamic_cast < CRenderSystemGL & > ( CServiceBroker : : GetRenderSystem ( ) ) ; <nl> + renderSystem . EnableShader ( SM_TEXTURE ) ; <nl> + GLint posLoc = renderSystem . ShaderGetPos ( ) ; <nl> + GLint tex0Loc = renderSystem . ShaderGetCoord0 ( ) ; <nl> + GLint uniColLoc = renderSystem . ShaderGetUniCol ( ) ; <nl> <nl> GLfloat col [ 4 ] = { 1 . 0f , 1 . 0f , 1 . 0f , 1 . 0f } ; <nl> <nl> void COverlayTextureGL : : Render ( SRenderState & state ) <nl> glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER , 0 ) ; <nl> glDeleteBuffers ( 1 , & indexVBO ) ; <nl> <nl> - g_Windowing . DisableShader ( ) ; <nl> + renderSystem . DisableShader ( ) ; <nl> <nl> # else <nl> - g_Windowing . EnableGUIShader ( SM_TEXTURE ) ; <nl> - GLint posLoc = g_Windowing . GUIShaderGetPos ( ) ; <nl> - GLint colLoc = g_Windowing . GUIShaderGetCol ( ) ; <nl> - GLint tex0Loc = g_Windowing . GUIShaderGetCoord0 ( ) ; <nl> - GLint uniColLoc = g_Windowing . GUIShaderGetUniCol ( ) ; <nl> + CRenderSystemGLES & renderSystem = dynamic_cast < CRenderSystemGLES & > ( CServiceBroker : : GetRenderSystem ( ) ) ; <nl> + renderSystem . EnableGUIShader ( SM_TEXTURE ) ; <nl> + GLint posLoc = renderSystem . GUIShaderGetPos ( ) ; <nl> + GLint colLoc = renderSystem . GUIShaderGetCol ( ) ; <nl> + GLint tex0Loc = renderSystem . GUIShaderGetCoord0 ( ) ; <nl> + GLint uniColLoc = renderSystem . GUIShaderGetUniCol ( ) ; <nl> <nl> GLfloat col [ 4 ] = { 1 . 0f , 1 . 0f , 1 . 0f , 1 . 0f } ; <nl> GLfloat ver [ 4 ] [ 2 ] ; <nl> void COverlayTextureGL : : Render ( SRenderState & state ) <nl> glDisableVertexAttribArray ( colLoc ) ; <nl> glDisableVertexAttribArray ( tex0Loc ) ; <nl> <nl> - g_Windowing . DisableGUIShader ( ) ; <nl> + renderSystem . DisableGUIShader ( ) ; <nl> # endif <nl> <nl> glDisable ( GL_BLEND ) ; <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / OverlayRendererUtil . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / OverlayRendererUtil . cpp <nl> <nl> # include " cores / VideoPlayer / DVDCodecs / Overlay / DVDOverlayImage . h " <nl> # include " cores / VideoPlayer / DVDCodecs / Overlay / DVDOverlaySpu . h " <nl> # include " cores / VideoPlayer / DVDCodecs / Overlay / DVDOverlaySSA . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include " guilib / GraphicContext . h " <nl> # include " settings / Settings . h " <nl> <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / RenderCapture . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / RenderCapture . cpp <nl> <nl> * / <nl> <nl> # include " RenderCapture . h " <nl> + # include " ServiceBroker . h " <nl> # include " utils / log . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " settings / AdvancedSettings . h " <nl> # include " cores / IPlayer . h " <nl> + # include " rendering / RenderSystem . h " <nl> # ifdef HAS_DX <nl> # include " rendering / dx / DirectXHelper . h " <nl> # endif <nl> bool CRenderCaptureBase : : UseOcclusionQuery ( ) <nl> return false ; <nl> else if ( ( g_advancedSettings . m_videoCaptureUseOcclusionQuery = = 0 ) | | <nl> ( g_advancedSettings . m_videoCaptureUseOcclusionQuery = = - 1 & & <nl> - g_Windowing . GetRenderQuirks ( ) & RENDER_QUIRKS_BROKEN_OCCLUSION_QUERY ) ) <nl> + CServiceBroker : : GetRenderSystem ( ) . GetRenderQuirks ( ) & RENDER_QUIRKS_BROKEN_OCCLUSION_QUERY ) ) <nl> return false ; <nl> else <nl> return true ; <nl> void CRenderCaptureGL : : BeginRender ( ) <nl> if ( ! m_asyncChecked ) <nl> { <nl> # ifndef HAS_GLES <nl> - m_asyncSupported = g_Windowing . IsExtSupported ( " GL_ARB_pixel_buffer_object " ) ; <nl> - m_occlusionQuerySupported = g_Windowing . IsExtSupported ( " GL_ARB_occlusion_query " ) ; <nl> + m_asyncSupported = CServiceBroker : : GetRenderSystem ( ) . IsExtSupported ( " GL_ARB_pixel_buffer_object " ) ; <nl> + m_occlusionQuerySupported = CServiceBroker : : GetRenderSystem ( ) . IsExtSupported ( " GL_ARB_occlusion_query " ) ; <nl> <nl> if ( m_flags & CAPTUREFLAG_CONTINUOUS ) <nl> { <nl> if ( ! m_occlusionQuerySupported ) <nl> CLog : : Log ( LOGWARNING , " CRenderCaptureGL : GL_ARB_occlusion_query not supported , performance might suffer " ) ; <nl> - if ( ! g_Windowing . IsExtSupported ( " GL_ARB_pixel_buffer_object " ) ) <nl> + if ( ! CServiceBroker : : GetRenderSystem ( ) . IsExtSupported ( " GL_ARB_pixel_buffer_object " ) ) <nl> CLog : : Log ( LOGWARNING , " CRenderCaptureGL : GL_ARB_pixel_buffer_object not supported , performance might suffer " ) ; <nl> if ( UseOcclusionQuery ( ) ) <nl> CLog : : Log ( LOGWARNING , " CRenderCaptureGL : GL_ARB_occlusion_query disabled , performance might suffer " ) ; <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / RenderManager . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / RenderManager . cpp <nl> <nl> # include " threads / SingleLock . h " <nl> # include " utils / log . h " <nl> # include " utils / StringUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> # include " Application . h " <nl> # include " ServiceBroker . h " <nl> void CRenderManager : : PrepareNextRender ( ) <nl> double frameOnScreen = m_dvdClock . GetClock ( ) ; <nl> double frametime = 1 . 0 / g_graphicsContext . GetFPS ( ) * DVD_TIME_BASE ; <nl> <nl> - m_displayLatency = DVD_MSEC_TO_TIME ( m_latencyTweak + g_graphicsContext . GetDisplayLatency ( ) - m_videoDelay - g_Windowing . GetFrameLatencyAdjustment ( ) ) ; <nl> + m_displayLatency = DVD_MSEC_TO_TIME ( m_latencyTweak + g_graphicsContext . GetDisplayLatency ( ) - m_videoDelay - CServiceBroker : : GetWinSystem ( ) . GetFrameLatencyAdjustment ( ) ) ; <nl> <nl> double renderPts = frameOnScreen + m_displayLatency ; <nl> <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / VideoShaders / VideoFilterShaderGL . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / VideoShaders / VideoFilterShaderGL . cpp <nl> <nl> # include < math . h > <nl> <nl> # include " VideoFilterShaderGL . h " <nl> + # include " ServiceBroker . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> # include " ConvolutionKernels . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> <nl> # define USE1DTEXTURE <nl> # define TEXTARGET GL_TEXTURE_1D <nl> ConvolutionFilterShader : : ConvolutionFilterShader ( ESCALINGMETHOD method , bool str <nl> std : : string shadername ; <nl> std : : string defines ; <nl> <nl> - m_floattex = g_Windowing . IsExtSupported ( " GL_ARB_texture_float " ) ; <nl> + m_floattex = CServiceBroker : : GetRenderSystem ( ) . IsExtSupported ( " GL_ARB_texture_float " ) ; <nl> <nl> if ( m_method = = VS_SCALINGMETHOD_CUBIC | | <nl> m_method = = VS_SCALINGMETHOD_LANCZOS2 | | <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / VideoShaders / VideoFilterShaderGLES . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / VideoShaders / VideoFilterShaderGLES . cpp <nl> <nl> # include < math . h > <nl> <nl> # include " VideoFilterShaderGLES . h " <nl> + # include " ServiceBroker . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> # include " ConvolutionKernels . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / gles / RenderSystemGLES . h " <nl> <nl> # define TEXTARGET GL_TEXTURE_2D <nl> <nl> ConvolutionFilterShader : : ConvolutionFilterShader ( ESCALINGMETHOD method , bool str <nl> std : : string shadername ; <nl> std : : string defines ; <nl> <nl> - if ( g_Windowing . IsExtSupported ( " GL_EXT_color_buffer_float " ) ) <nl> + if ( CServiceBroker : : GetRenderSystem ( ) . IsExtSupported ( " GL_EXT_color_buffer_float " ) ) <nl> { <nl> m_floattex = true ; <nl> } <nl> mmm a / xbmc / dialogs / GUIDialogKeyboardGeneric . cpp <nl> ppp b / xbmc / dialogs / GUIDialogKeyboardGeneric . cpp <nl> <nl> # include " utils / StringUtils . h " <nl> # include " messaging / ApplicationMessenger . h " <nl> # include " utils / CharsetConverter . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " utils / log . h " <nl> <nl> # ifdef TARGET_ANDROID <nl> CGUIDialogKeyboardGeneric : : CGUIDialogKeyboardGeneric ( ) <nl> <nl> void CGUIDialogKeyboardGeneric : : OnWindowLoaded ( ) <nl> { <nl> - g_Windowing . EnableTextInput ( false ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . EnableTextInput ( false ) ; <nl> CGUIEditControl * edit = static_cast < CGUIEditControl * > ( GetControl ( CTL_EDIT ) ) ; <nl> if ( edit ) <nl> { <nl> mmm a / xbmc / guilib / GUIEditControl . cpp <nl> ppp b / xbmc / guilib / GUIEditControl . cpp <nl> <nl> <nl> # include " GUIEditControl . h " <nl> # include " GUIWindowManager . h " <nl> + # include " ServiceBroker . h " <nl> # include " utils / CharsetConverter . h " <nl> # include " utils / Variant . h " <nl> # include " GUIKeyboardFactory . h " <nl> <nl> # include " input / Key . h " <nl> # include " LocalizeStrings . h " <nl> # include " XBDateTime . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " utils / md5 . h " <nl> # include " GUIUserMessages . h " <nl> <nl> bool CGUIEditControl : : OnAction ( const CAction & action ) <nl> } <nl> default : <nl> { <nl> - if ( ! g_Windowing . IsTextInputEnabled ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . IsTextInputEnabled ( ) ) <nl> { <nl> ClearMD5 ( ) ; <nl> m_edit . clear ( ) ; <nl> void CGUIEditControl : : OnPasteClipboard ( ) <nl> std : : wstring unicode_text ; <nl> std : : string utf8_text ; <nl> <nl> - / / Get text from the clipboard <nl> - utf8_text = g_Windowing . GetClipboardText ( ) ; <nl> + / / Get text from the clipboard <nl> + utf8_text = CServiceBroker : : GetWinSystem ( ) . GetClipboardText ( ) ; <nl> g_charsetConverter . utf8ToW ( utf8_text , unicode_text ) ; <nl> <nl> / / Insert the pasted text at the current cursor position . <nl> void CGUIEditControl : : ValidateInput ( ) <nl> void CGUIEditControl : : SetFocus ( bool focus ) <nl> { <nl> m_smsTimer . Stop ( ) ; <nl> - g_Windowing . EnableTextInput ( focus ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . EnableTextInput ( focus ) ; <nl> CGUIControl : : SetFocus ( focus ) ; <nl> SetInvalid ( ) ; <nl> } <nl> mmm a / xbmc / guilib / GUIFontTTF . cpp <nl> ppp b / xbmc / guilib / GUIFontTTF . cpp <nl> <nl> # include " GUIFontManager . h " <nl> # include " Texture . h " <nl> # include " GraphicContext . h " <nl> + # include " ServiceBroker . h " <nl> # include " filesystem / SpecialProtocol . h " <nl> # include " utils / MathUtils . h " <nl> # include " utils / log . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " URL . h " <nl> # include " filesystem / File . h " <nl> # include " threads / SystemClock . h " <nl> bool CGUIFontTTFBase : : Load ( const std : : string & strFilename , float height , float a <nl> <nl> m_textureWidth = CBaseTexture : : PadPow2 ( m_textureWidth ) ; <nl> <nl> - if ( m_textureWidth > g_Windowing . GetMaxTextureSize ( ) ) <nl> - m_textureWidth = g_Windowing . GetMaxTextureSize ( ) ; <nl> + if ( m_textureWidth > CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ) <nl> + m_textureWidth = CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ; <nl> m_textureScaleX = 1 . 0f / m_textureWidth ; <nl> <nl> / / set the posX and posY so that our texture will be created on first character write . <nl> void CGUIFontTTFBase : : DrawTextInternal ( float x , float y , const vecColors & colors <nl> <nl> uint32_t rawAlignment = alignment ; <nl> bool dirtyCache ( false ) ; <nl> - bool hardwareClipping = g_Windowing . ScissorsCanEffectClipping ( ) ; <nl> + bool hardwareClipping = CServiceBroker : : GetRenderSystem ( ) . ScissorsCanEffectClipping ( ) ; <nl> CGUIFontCacheStaticPosition staticPos ( x , y ) ; <nl> CGUIFontCacheDynamicPosition dynamicPos ; <nl> if ( hardwareClipping ) <nl> bool CGUIFontTTFBase : : CacheCharacter ( wchar_t letter , uint32_t style , Character * <nl> / / create the new larger texture <nl> unsigned int newHeight = m_posY + GetTextureLineHeight ( ) ; <nl> / / check for max height <nl> - if ( newHeight > g_Windowing . GetMaxTextureSize ( ) ) <nl> + if ( newHeight > CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " % s : New cache texture is too large ( % u > % u pixels long ) " , __FUNCTION__ , newHeight , g_Windowing . GetMaxTextureSize ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " % s : New cache texture is too large ( % u > % u pixels long ) " , __FUNCTION__ , newHeight , CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ) ; <nl> FT_Done_Glyph ( glyph ) ; <nl> return false ; <nl> } <nl> void CGUIFontTTFBase : : RenderCharacter ( float posX , float posY , const Character * c <nl> ( posY + ch - > offsetY + height ) * g_graphicsContext . GetGUIScaleY ( ) ) ; <nl> vertex + = CPoint ( m_originX , m_originY ) ; <nl> CRect texture ( ch - > left , ch - > top , ch - > right , ch - > bottom ) ; <nl> - if ( ! g_Windowing . ScissorsCanEffectClipping ( ) ) <nl> + if ( ! CServiceBroker : : GetRenderSystem ( ) . ScissorsCanEffectClipping ( ) ) <nl> g_graphicsContext . ClipRect ( vertex , texture ) ; <nl> <nl> / / transform our positions - note , no scaling due to GUI calibration / resolution occurs <nl> void CGUIFontTTFBase : : RenderCharacter ( float posX , float posY , const Character * c <nl> , b = GET_B ( color ) <nl> , a = GET_A ( color ) ; <nl> <nl> - if ( g_Windowing . UseLimitedColor ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . UseLimitedColor ( ) ) <nl> { <nl> r = ( 235 - 16 ) * r / 255 ; <nl> g = ( 235 - 16 ) * g / 255 ; <nl> mmm a / xbmc / guilib / GUIFontTTFGL . cpp <nl> ppp b / xbmc / guilib / GUIFontTTFGL . cpp <nl> <nl> # include " Texture . h " <nl> # include " TextureManager . h " <nl> # include " GraphicContext . h " <nl> + # include " ServiceBroker . h " <nl> # include " gui3d . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # ifdef HAS_GL <nl> + # include " rendering / gl / RenderSystemGL . h " <nl> + # elif HAS_GLES <nl> + # include " rendering / gles / RenderSystemGLES . h " <nl> + # endif <nl> # include " guilib / MatrixGLES . h " <nl> <nl> / / stuff for freetype <nl> bool CGUIFontTTFGL : : FirstBegin ( ) <nl> void CGUIFontTTFGL : : LastEnd ( ) <nl> { <nl> # ifdef HAS_GL <nl> - g_Windowing . EnableShader ( SM_FONTS ) ; <nl> + CRenderSystemGL & renderSystem = dynamic_cast < CRenderSystemGL & > ( CServiceBroker : : GetRenderSystem ( ) ) ; <nl> + renderSystem . EnableShader ( SM_FONTS ) ; <nl> <nl> - GLint posLoc = g_Windowing . ShaderGetPos ( ) ; <nl> - GLint colLoc = g_Windowing . ShaderGetCol ( ) ; <nl> - GLint tex0Loc = g_Windowing . ShaderGetCoord0 ( ) ; <nl> - GLint modelLoc = g_Windowing . ShaderGetModel ( ) ; <nl> + GLint posLoc = renderSystem . ShaderGetPos ( ) ; <nl> + GLint colLoc = renderSystem . ShaderGetCol ( ) ; <nl> + GLint tex0Loc = renderSystem . ShaderGetCoord0 ( ) ; <nl> + GLint modelLoc = renderSystem . ShaderGetModel ( ) ; <nl> <nl> CreateStaticVertexBuffers ( ) ; <nl> <nl> void CGUIFontTTFGL : : LastEnd ( ) <nl> <nl> # else <nl> / / GLES 2 . 0 version . <nl> - g_Windowing . EnableGUIShader ( SM_FONTS ) ; <nl> + CRenderSystemGLES & renderSystem = dynamic_cast < CRenderSystemGLES & > ( CServiceBroker : : GetRenderSystem ( ) ) ; <nl> + renderSystem . EnableGUIShader ( SM_FONTS ) ; <nl> <nl> - GLint posLoc = g_Windowing . GUIShaderGetPos ( ) ; <nl> - GLint colLoc = g_Windowing . GUIShaderGetCol ( ) ; <nl> - GLint tex0Loc = g_Windowing . GUIShaderGetCoord0 ( ) ; <nl> - GLint modelLoc = g_Windowing . GUIShaderGetModel ( ) ; <nl> + GLint posLoc = renderSystem . GUIShaderGetPos ( ) ; <nl> + GLint colLoc = renderSystem . GUIShaderGetCol ( ) ; <nl> + GLint tex0Loc = renderSystem . GUIShaderGetCoord0 ( ) ; <nl> + GLint modelLoc = renderSystem . GUIShaderGetModel ( ) ; <nl> <nl> <nl> CreateStaticVertexBuffers ( ) ; <nl> void CGUIFontTTFGL : : LastEnd ( ) <nl> for ( size_t i = 0 ; i < m_vertexTrans . size ( ) ; i + + ) <nl> { <nl> / / Apply the clip rectangle <nl> - CRect clip = g_Windowing . ClipRectToScissorRect ( m_vertexTrans [ i ] . clip ) ; <nl> + CRect clip = renderSystem . ClipRectToScissorRect ( m_vertexTrans [ i ] . clip ) ; <nl> if ( ! clip . IsEmpty ( ) ) <nl> { <nl> / / intersect with current scissor <nl> void CGUIFontTTFGL : : LastEnd ( ) <nl> / / skip empty clip <nl> if ( clip . IsEmpty ( ) ) <nl> continue ; <nl> - g_Windowing . SetScissors ( clip ) ; <nl> + renderSystem . SetScissors ( clip ) ; <nl> } <nl> <nl> / / Apply the translation to the currently active ( top - of - stack ) model view matrix <nl> void CGUIFontTTFGL : : LastEnd ( ) <nl> glMatrixModview . Pop ( ) ; <nl> } <nl> / / Restore the original scissor rectangle <nl> - g_Windowing . SetScissors ( scissor ) ; <nl> + renderSystem . SetScissors ( scissor ) ; <nl> / / Restore the original model view matrix <nl> glUniformMatrix4fv ( modelLoc , 1 , GL_FALSE , glMatrixModview . Get ( ) ) ; <nl> / / Unbind GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER <nl> void CGUIFontTTFGL : : LastEnd ( ) <nl> glDisableVertexAttribArray ( tex0Loc ) ; <nl> <nl> # ifdef HAS_GL <nl> - g_Windowing . DisableShader ( ) ; <nl> + renderSystem . DisableShader ( ) ; <nl> # else <nl> - g_Windowing . DisableGUIShader ( ) ; <nl> + renderSystem . DisableGUIShader ( ) ; <nl> # endif <nl> } <nl> <nl> mmm a / xbmc / guilib / GUIRenderingControl . cpp <nl> ppp b / xbmc / guilib / GUIRenderingControl . cpp <nl> <nl> # include " GUIRenderingControl . h " <nl> # include " threads / SingleLock . h " <nl> # include " guilib / IRenderingCallback . h " <nl> - # include " windowing / WindowingFactory . h " <nl> <nl> # define LABEL_ROW1 10 <nl> # define LABEL_ROW2 11 <nl> mmm a / xbmc / guilib / GUIShader . cpp <nl> ppp b / xbmc / guilib / GUIShader . cpp <nl> <nl> <nl> # include " system . h " <nl> <nl> - # if HAS_GLES > = 2 <nl> - <nl> # include " GUIShader . h " <nl> # include " MatrixGLES . h " <nl> + # include " ServiceBroker . h " <nl> # include " utils / log . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> # include " guilib / GraphicContext . h " <nl> <nl> using namespace Shaders ; <nl> bool CGUIShader : : OnEnabled ( ) <nl> <nl> const TransformMatrix & guiMatrix = g_graphicsContext . GetGUIMatrix ( ) ; <nl> CRect viewPort ; / / absolute positions of corners <nl> - g_Windowing . GetViewPort ( viewPort ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . GetViewPort ( viewPort ) ; <nl> <nl> / * glScissor operates in window coordinates . In order that we can use it to <nl> * perform clipping , we must ensure that there is an independent linear <nl> void CGUIShader : : Free ( ) <nl> CGLSLShaderProgram : : Free ( ) ; <nl> } <nl> <nl> - # endif <nl> mmm a / xbmc / guilib / GUITextureGL . cpp <nl> ppp b / xbmc / guilib / GUITextureGL . cpp <nl> <nl> <nl> # include " system . h " <nl> # include " GUITextureGL . h " <nl> + # include " ServiceBroker . h " <nl> # include " Texture . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> # include " guilib / Geometry . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / gl / RenderSystemGL . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> # define BUFFER_OFFSET ( i ) ( ( char * ) NULL + ( i ) ) <nl> <nl> CGUITextureGL : : CGUITextureGL ( float posX , float posY , float width , float height , <nl> : CGUITextureBase ( posX , posY , width , height , texture ) <nl> { <nl> memset ( m_col , 0 , sizeof ( m_col ) ) ; <nl> + m_renderSystem = dynamic_cast < CRenderSystemGL * > ( & CServiceBroker : : GetRenderSystem ( ) ) ; <nl> } <nl> <nl> void CGUITextureGL : : Begin ( color_t color ) <nl> void CGUITextureGL : : Begin ( color_t color ) <nl> m_col [ 2 ] = ( GLubyte ) GET_B ( color ) ; <nl> m_col [ 3 ] = ( GLubyte ) GET_A ( color ) ; <nl> <nl> - if ( g_Windowing . UseLimitedColor ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . UseLimitedColor ( ) ) <nl> { <nl> m_col [ 0 ] = ( 235 - 16 ) * m_col [ 0 ] / 255 + 16 . 0f / 255 . 0f ; <nl> m_col [ 1 ] = ( 235 - 16 ) * m_col [ 1 ] / 255 + 16 . 0f / 255 . 0f ; <nl> void CGUITextureGL : : Begin ( color_t color ) <nl> { <nl> if ( m_col [ 0 ] = = 255 & & m_col [ 1 ] = = 255 & & m_col [ 2 ] = = 255 & & m_col [ 3 ] = = 255 ) <nl> { <nl> - g_Windowing . EnableShader ( SM_MULTI ) ; <nl> + m_renderSystem - > EnableShader ( SM_MULTI ) ; <nl> } <nl> else <nl> { <nl> - g_Windowing . EnableShader ( SM_MULTI_BLENDCOLOR ) ; <nl> + m_renderSystem - > EnableShader ( SM_MULTI_BLENDCOLOR ) ; <nl> } <nl> <nl> hasAlpha | = m_diffuse . m_textures [ 0 ] - > HasAlpha ( ) ; <nl> void CGUITextureGL : : Begin ( color_t color ) <nl> { <nl> if ( m_col [ 0 ] = = 255 & & m_col [ 1 ] = = 255 & & m_col [ 2 ] = = 255 & & m_col [ 3 ] = = 255 ) <nl> { <nl> - g_Windowing . EnableShader ( SM_TEXTURE_NOBLEND ) ; <nl> + m_renderSystem - > EnableShader ( SM_TEXTURE_NOBLEND ) ; <nl> } <nl> else <nl> { <nl> - g_Windowing . EnableShader ( SM_TEXTURE ) ; <nl> + m_renderSystem - > EnableShader ( SM_TEXTURE ) ; <nl> } <nl> } <nl> <nl> void CGUITextureGL : : End ( ) <nl> { <nl> if ( m_packedVertices . size ( ) ) <nl> { <nl> - GLint posLoc = g_Windowing . ShaderGetPos ( ) ; <nl> - GLint tex0Loc = g_Windowing . ShaderGetCoord0 ( ) ; <nl> - GLint tex1Loc = g_Windowing . ShaderGetCoord1 ( ) ; <nl> - GLint uniColLoc = g_Windowing . ShaderGetUniCol ( ) ; <nl> + GLint posLoc = m_renderSystem - > ShaderGetPos ( ) ; <nl> + GLint tex0Loc = m_renderSystem - > ShaderGetCoord0 ( ) ; <nl> + GLint tex1Loc = m_renderSystem - > ShaderGetCoord1 ( ) ; <nl> + GLint uniColLoc = m_renderSystem - > ShaderGetUniCol ( ) ; <nl> <nl> GLuint VertexVBO ; <nl> GLuint IndexVBO ; <nl> void CGUITextureGL : : End ( ) <nl> glActiveTexture ( GL_TEXTURE0 ) ; <nl> glEnable ( GL_BLEND ) ; <nl> <nl> - g_Windowing . DisableShader ( ) ; <nl> + m_renderSystem - > DisableShader ( ) ; <nl> } <nl> <nl> void CGUITextureGL : : Draw ( float * x , float * y , float * z , const CRect & texture , const CRect & diffuse , int orientation ) <nl> void CGUITextureGL : : Draw ( float * x , float * y , float * z , const CRect & texture , con <nl> <nl> void CGUITextureGL : : DrawQuad ( const CRect & rect , color_t color , CBaseTexture * texture , const CRect * texCoords ) <nl> { <nl> + CRenderSystemGL * renderSystem = dynamic_cast < CRenderSystemGL * > ( & CServiceBroker : : GetRenderSystem ( ) ) ; <nl> if ( texture ) <nl> { <nl> texture - > LoadToGPU ( ) ; <nl> void CGUITextureGL : : DrawQuad ( const CRect & rect , color_t color , CBaseTexture * tex <nl> } vertex [ 4 ] ; <nl> <nl> if ( texture ) <nl> - g_Windowing . EnableShader ( SM_TEXTURE ) ; <nl> + renderSystem - > EnableShader ( SM_TEXTURE ) ; <nl> else <nl> - g_Windowing . EnableShader ( SM_DEFAULT ) ; <nl> + renderSystem - > EnableShader ( SM_DEFAULT ) ; <nl> <nl> - GLint posLoc = g_Windowing . ShaderGetPos ( ) ; <nl> - GLint tex0Loc = g_Windowing . ShaderGetCoord0 ( ) ; <nl> - GLint uniColLoc = g_Windowing . ShaderGetUniCol ( ) ; <nl> + GLint posLoc = renderSystem - > ShaderGetPos ( ) ; <nl> + GLint tex0Loc = renderSystem - > ShaderGetCoord0 ( ) ; <nl> + GLint uniColLoc = renderSystem - > ShaderGetUniCol ( ) ; <nl> <nl> / / Setup Colors <nl> col [ 0 ] = ( GLubyte ) GET_R ( color ) ; <nl> void CGUITextureGL : : DrawQuad ( const CRect & rect , color_t color , CBaseTexture * tex <nl> glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER , 0 ) ; <nl> glDeleteBuffers ( 1 , & indexVBO ) ; <nl> <nl> - g_Windowing . DisableShader ( ) ; <nl> + renderSystem - > DisableShader ( ) ; <nl> } <nl> <nl> mmm a / xbmc / guilib / GUITextureGL . h <nl> ppp b / xbmc / guilib / GUITextureGL . h <nl> <nl> <nl> # include " GUITexture . h " <nl> <nl> + class CRenderSystemGL ; <nl> + <nl> class CGUITextureGL : public CGUITextureBase <nl> { <nl> public : <nl> class CGUITextureGL : public CGUITextureBase <nl> <nl> std : : vector < PackedVertex > m_packedVertices ; <nl> std : : vector < GLushort > m_idx ; <nl> + CRenderSystemGL * m_renderSystem ; <nl> } ; <nl> <nl> mmm a / xbmc / guilib / GUITextureGLES . cpp <nl> ppp b / xbmc / guilib / GUITextureGLES . cpp <nl> <nl> * / <nl> <nl> # include " system . h " <nl> - # if defined ( HAS_GLES ) <nl> + <nl> # include " GUITextureGLES . h " <nl> - # endif <nl> # include " Texture . h " <nl> + # include " ServiceBroker . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> # include " utils / MathUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / gles / RenderSystemGLES . h " <nl> # include " guilib / GraphicContext . h " <nl> <nl> # include < cstddef > <nl> <nl> - # if defined ( HAS_GLES ) <nl> - <nl> <nl> CGUITextureGLES : : CGUITextureGLES ( float posX , float posY , float width , float height , const CTextureInfo & texture ) <nl> : CGUITextureBase ( posX , posY , width , height , texture ) <nl> { <nl> + m_renderSystem = dynamic_cast < CRenderSystemGLES * > ( & CServiceBroker : : GetRenderSystem ( ) ) ; <nl> } <nl> <nl> void CGUITextureGLES : : Begin ( color_t color ) <nl> void CGUITextureGLES : : Begin ( color_t color ) <nl> { <nl> if ( m_col [ 0 ] = = 255 & & m_col [ 1 ] = = 255 & & m_col [ 2 ] = = 255 & & m_col [ 3 ] = = 255 ) <nl> { <nl> - g_Windowing . EnableGUIShader ( SM_MULTI ) ; <nl> + m_renderSystem - > EnableGUIShader ( SM_MULTI ) ; <nl> } <nl> else <nl> { <nl> - g_Windowing . EnableGUIShader ( SM_MULTI_BLENDCOLOR ) ; <nl> + m_renderSystem - > EnableGUIShader ( SM_MULTI_BLENDCOLOR ) ; <nl> } <nl> <nl> hasAlpha | = m_diffuse . m_textures [ 0 ] - > HasAlpha ( ) ; <nl> void CGUITextureGLES : : Begin ( color_t color ) <nl> { <nl> if ( m_col [ 0 ] = = 255 & & m_col [ 1 ] = = 255 & & m_col [ 2 ] = = 255 & & m_col [ 3 ] = = 255 ) <nl> { <nl> - g_Windowing . EnableGUIShader ( SM_TEXTURE_NOBLEND ) ; <nl> + m_renderSystem - > EnableGUIShader ( SM_TEXTURE_NOBLEND ) ; <nl> } <nl> else <nl> { <nl> - g_Windowing . EnableGUIShader ( SM_TEXTURE ) ; <nl> + m_renderSystem - > EnableGUIShader ( SM_TEXTURE ) ; <nl> } <nl> } <nl> <nl> void CGUITextureGLES : : End ( ) <nl> { <nl> if ( m_packedVertices . size ( ) ) <nl> { <nl> - GLint posLoc = g_Windowing . GUIShaderGetPos ( ) ; <nl> - GLint tex0Loc = g_Windowing . GUIShaderGetCoord0 ( ) ; <nl> - GLint tex1Loc = g_Windowing . GUIShaderGetCoord1 ( ) ; <nl> - GLint uniColLoc = g_Windowing . GUIShaderGetUniCol ( ) ; <nl> + GLint posLoc = m_renderSystem - > GUIShaderGetPos ( ) ; <nl> + GLint tex0Loc = m_renderSystem - > GUIShaderGetCoord0 ( ) ; <nl> + GLint tex1Loc = m_renderSystem - > GUIShaderGetCoord1 ( ) ; <nl> + GLint uniColLoc = m_renderSystem - > GUIShaderGetUniCol ( ) ; <nl> <nl> if ( uniColLoc > = 0 ) <nl> { <nl> void CGUITextureGLES : : End ( ) <nl> if ( m_diffuse . size ( ) ) <nl> glActiveTexture ( GL_TEXTURE0 ) ; <nl> glEnable ( GL_BLEND ) ; <nl> - g_Windowing . DisableGUIShader ( ) ; <nl> + m_renderSystem - > DisableGUIShader ( ) ; <nl> } <nl> <nl> void CGUITextureGLES : : Draw ( float * x , float * y , float * z , const CRect & texture , const CRect & diffuse , int orientation ) <nl> void CGUITextureGLES : : Draw ( float * x , float * y , float * z , const CRect & texture , c <nl> <nl> void CGUITextureGLES : : DrawQuad ( const CRect & rect , color_t color , CBaseTexture * texture , const CRect * texCoords ) <nl> { <nl> + CRenderSystemGLES * renderSystem = dynamic_cast < CRenderSystemGLES * > ( & CServiceBroker : : GetRenderSystem ( ) ) ; <nl> if ( texture ) <nl> { <nl> texture - > LoadToGPU ( ) ; <nl> void CGUITextureGLES : : DrawQuad ( const CRect & rect , color_t color , CBaseTexture * t <nl> GLubyte idx [ 4 ] = { 0 , 1 , 3 , 2 } ; / / determines order of triangle strip <nl> <nl> if ( texture ) <nl> - g_Windowing . EnableGUIShader ( SM_TEXTURE ) ; <nl> + renderSystem - > EnableGUIShader ( SM_TEXTURE ) ; <nl> else <nl> - g_Windowing . EnableGUIShader ( SM_DEFAULT ) ; <nl> + renderSystem - > EnableGUIShader ( SM_DEFAULT ) ; <nl> <nl> - GLint posLoc = g_Windowing . GUIShaderGetPos ( ) ; <nl> - GLint tex0Loc = g_Windowing . GUIShaderGetCoord0 ( ) ; <nl> - GLint uniColLoc = g_Windowing . GUIShaderGetUniCol ( ) ; <nl> + GLint posLoc = renderSystem - > GUIShaderGetPos ( ) ; <nl> + GLint tex0Loc = renderSystem - > GUIShaderGetCoord0 ( ) ; <nl> + GLint uniColLoc = renderSystem - > GUIShaderGetUniCol ( ) ; <nl> <nl> glVertexAttribPointer ( posLoc , 3 , GL_FLOAT , 0 , 0 , ver ) ; <nl> if ( texture ) <nl> void CGUITextureGLES : : DrawQuad ( const CRect & rect , color_t color , CBaseTexture * t <nl> if ( texture ) <nl> glDisableVertexAttribArray ( tex0Loc ) ; <nl> <nl> - g_Windowing . DisableGUIShader ( ) ; <nl> + renderSystem - > DisableGUIShader ( ) ; <nl> } <nl> <nl> - # endif <nl> mmm a / xbmc / guilib / GUITextureGLES . h <nl> ppp b / xbmc / guilib / GUITextureGLES . h <nl> <nl> - / * ! <nl> - \ file GUITextureGLES . h <nl> - \ brief <nl> - * / <nl> - <nl> - # ifndef GUILIB_GUITEXTUREGLES_H <nl> - # define GUILIB_GUITEXTUREGLES_H <nl> - <nl> # pragma once <nl> <nl> / * <nl> struct PackedVertex <nl> } ; <nl> typedef std : : vector < PackedVertex > PackedVertices ; <nl> <nl> + class CRenderSystemGLES ; <nl> + <nl> class CGUITextureGLES : public CGUITextureBase <nl> { <nl> public : <nl> class CGUITextureGLES : public CGUITextureBase <nl> <nl> PackedVertices m_packedVertices ; <nl> std : : vector < GLushort > m_idx ; <nl> + CRenderSystemGLES * m_renderSystem ; <nl> } ; <nl> <nl> - # endif <nl> mmm a / xbmc / guilib / GraphicContext . cpp <nl> ppp b / xbmc / guilib / GraphicContext . cpp <nl> <nl> # include " settings / lib / Setting . h " <nl> # include " settings / Settings . h " <nl> # include " utils / log . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " TextureManager . h " <nl> # include " input / InputManager . h " <nl> # include " GUIWindowManager . h " <nl> bool CGraphicContext : : SetViewPort ( float fx , float fy , float fwidth , float fheigh <nl> m_viewStack . push ( newviewport ) ; <nl> <nl> newviewport = StereoCorrection ( newviewport ) ; <nl> - g_Windowing . SetViewPort ( newviewport ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . SetViewPort ( newviewport ) ; <nl> <nl> <nl> UpdateCameraPosition ( m_cameras . top ( ) , m_stereoFactors . top ( ) ) ; <nl> void CGraphicContext : : RestoreViewPort ( ) <nl> <nl> m_viewStack . pop ( ) ; <nl> CRect viewport = StereoCorrection ( m_viewStack . top ( ) ) ; <nl> - g_Windowing . SetViewPort ( viewport ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . SetViewPort ( viewport ) ; <nl> <nl> UpdateCameraPosition ( m_cameras . top ( ) , m_stereoFactors . top ( ) ) ; <nl> } <nl> void CGraphicContext : : SetScissors ( const CRect & rect ) <nl> { <nl> m_scissors = rect ; <nl> m_scissors . Intersect ( CRect ( 0 , 0 , ( float ) m_iScreenWidth , ( float ) m_iScreenHeight ) ) ; <nl> - g_Windowing . SetScissors ( StereoCorrection ( m_scissors ) ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . SetScissors ( StereoCorrection ( m_scissors ) ) ; <nl> } <nl> <nl> void CGraphicContext : : ResetScissors ( ) <nl> { <nl> m_scissors . SetRect ( 0 , 0 , ( float ) m_iScreenWidth , ( float ) m_iScreenHeight ) ; <nl> - g_Windowing . SetScissors ( StereoCorrection ( m_scissors ) ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . SetScissors ( StereoCorrection ( m_scissors ) ) ; <nl> } <nl> <nl> const CRect CGraphicContext : : GetViewWindow ( ) const <nl> void CGraphicContext : : SetVideoResolutionInternal ( RESOLUTION res , bool forceUpdat <nl> { <nl> # if defined ( TARGET_DARWIN ) | | defined ( TARGET_WINDOWS ) <nl> bool blankOtherDisplays = CServiceBroker : : GetSettings ( ) . GetBool ( CSettings : : SETTING_VIDEOSCREEN_BLANKDISPLAYS ) ; <nl> - switched = g_Windowing . SetFullScreen ( true , info_org , blankOtherDisplays ) ; <nl> + switched = CServiceBroker : : GetWinSystem ( ) . SetFullScreen ( true , info_org , blankOtherDisplays ) ; <nl> # else <nl> - switched = g_Windowing . SetFullScreen ( true , info_org , false ) ; <nl> + switched = CServiceBroker : : GetWinSystem ( ) . SetFullScreen ( true , info_org , false ) ; <nl> # endif <nl> } <nl> else if ( lastRes > = RES_DESKTOP ) <nl> - switched = g_Windowing . SetFullScreen ( false , info_org , false ) ; <nl> + switched = CServiceBroker : : GetWinSystem ( ) . SetFullScreen ( false , info_org , false ) ; <nl> else <nl> - switched = g_Windowing . ResizeWindow ( info_org . iWidth , info_org . iHeight , - 1 , - 1 ) ; <nl> - <nl> - / / FIXME At the moment only Wayland expects the return value to be interpreted <nl> - / / - all other windowing implementations might still assume that it does <nl> - / / not matter what they return as it was before . <nl> - / / This needs to get fixed when the resolution switching code is refactored . <nl> - if ( g_Windowing . GetWinSystem ( ) ! = WINDOW_SYSTEM_WAYLAND ) <nl> - { <nl> - switched = true ; <nl> - } <nl> + switched = CServiceBroker : : GetWinSystem ( ) . ResizeWindow ( info_org . iWidth , info_org . iHeight , - 1 , - 1 ) ; <nl> <nl> if ( switched ) <nl> { <nl> void CGraphicContext : : UpdateInternalStateWithResolution ( RESOLUTION res ) <nl> void CGraphicContext : : ApplyModeChange ( RESOLUTION res ) <nl> { <nl> ApplyVideoResolution ( res ) ; <nl> - g_Windowing . FinishModeChange ( res ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . FinishModeChange ( res ) ; <nl> } <nl> <nl> void CGraphicContext : : ApplyWindowResize ( int newWidth , int newHeight ) <nl> { <nl> - g_Windowing . SetWindowResolution ( newWidth , newHeight ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . SetWindowResolution ( newWidth , newHeight ) ; <nl> ApplyVideoResolution ( RES_WINDOW ) ; <nl> - g_Windowing . FinishWindowResize ( newWidth , newHeight ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . FinishWindowResize ( newWidth , newHeight ) ; <nl> } <nl> <nl> RESOLUTION CGraphicContext : : GetVideoResolution ( ) const <nl> void CGraphicContext : : ResetScreenParameters ( RESOLUTION res ) <nl> <nl> void CGraphicContext : : Clear ( color_t color ) <nl> { <nl> - g_Windowing . ClearBuffers ( color ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . ClearBuffers ( color ) ; <nl> } <nl> <nl> void CGraphicContext : : CaptureStateBlock ( ) <nl> { <nl> - g_Windowing . CaptureStateBlock ( ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . CaptureStateBlock ( ) ; <nl> } <nl> <nl> void CGraphicContext : : ApplyStateBlock ( ) <nl> { <nl> - g_Windowing . ApplyStateBlock ( ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . ApplyStateBlock ( ) ; <nl> } <nl> <nl> const RESOLUTION_INFO CGraphicContext : : GetResInfo ( RESOLUTION res ) const <nl> void CGraphicContext : : SetStereoView ( RENDER_STEREO_VIEW view ) <nl> m_viewStack . push ( viewport ) ; <nl> <nl> viewport = StereoCorrection ( viewport ) ; <nl> - g_Windowing . SetStereoMode ( m_stereoMode , m_stereoView ) ; <nl> - g_Windowing . SetViewPort ( viewport ) ; <nl> - g_Windowing . SetScissors ( viewport ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . SetStereoMode ( m_stereoMode , m_stereoView ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . SetViewPort ( viewport ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . SetScissors ( viewport ) ; <nl> } <nl> <nl> void CGraphicContext : : InvertFinalCoords ( float & x , float & y ) const <nl> CRect CGraphicContext : : generateAABB ( const CRect & rect ) const <nl> <nl> float z = 0 . 0f ; <nl> ScaleFinalCoords ( x1 , y1 , z ) ; <nl> - g_Windowing . Project ( x1 , y1 , z ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . Project ( x1 , y1 , z ) ; <nl> <nl> z = 0 . 0f ; <nl> ScaleFinalCoords ( x2 , y2 , z ) ; <nl> - g_Windowing . Project ( x2 , y2 , z ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . Project ( x2 , y2 , z ) ; <nl> <nl> z = 0 . 0f ; <nl> ScaleFinalCoords ( x3 , y3 , z ) ; <nl> - g_Windowing . Project ( x3 , y3 , z ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . Project ( x3 , y3 , z ) ; <nl> <nl> z = 0 . 0f ; <nl> ScaleFinalCoords ( x4 , y4 , z ) ; <nl> - g_Windowing . Project ( x4 , y4 , z ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . Project ( x4 , y4 , z ) ; <nl> <nl> return CRect ( std : : min ( std : : min ( std : : min ( x1 , x2 ) , x3 ) , x4 ) , <nl> std : : min ( std : : min ( std : : min ( y1 , y2 ) , y3 ) , y4 ) , <nl> void CGraphicContext : : UpdateCameraPosition ( const CPoint & camera , const float & fa <nl> float scaleX = static_cast < float > ( CServiceBroker : : GetSettings ( ) . GetInt ( CSettings : : SETTING_LOOKANDFEEL_STEREOSTRENGTH ) ) * scaleRes ; <nl> stereoFactor = factor * ( m_stereoView = = RENDER_STEREO_VIEW_LEFT ? scaleX : - scaleX ) ; <nl> } <nl> - g_Windowing . SetCameraPosition ( camera , m_iScreenWidth , m_iScreenHeight , stereoFactor ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . SetCameraPosition ( camera , m_iScreenWidth , m_iScreenHeight , stereoFactor ) ; <nl> } <nl> <nl> bool CGraphicContext : : RectIsAngled ( float x1 , float y1 , float x2 , float y2 ) const <nl> float CGraphicContext : : GetFPS ( ) const <nl> <nl> float CGraphicContext : : GetDisplayLatency ( ) const <nl> { <nl> - float latency = g_Windowing . GetDisplayLatency ( ) ; <nl> + float latency = CServiceBroker : : GetWinSystem ( ) . GetDisplayLatency ( ) ; <nl> if ( latency < 0 . 0f ) <nl> { <nl> / / fallback <nl> - latency = ( g_Windowing . NoOfBuffers ( ) + 1 ) / GetFPS ( ) * 1000 . 0f ; <nl> + latency = ( CServiceBroker : : GetWinSystem ( ) . NoOfBuffers ( ) + 1 ) / GetFPS ( ) * 1000 . 0f ; <nl> } <nl> <nl> return latency ; <nl> void CGraphicContext : : ToggleFullScreen ( ) <nl> if ( CDisplaySettings : : GetInstance ( ) . GetCurrentResolution ( ) > RES_DESKTOP ) <nl> uiRes = CDisplaySettings : : GetInstance ( ) . GetCurrentResolution ( ) ; <nl> else <nl> - uiRes = ( RESOLUTION ) g_Windowing . DesktopResolution ( g_Windowing . GetCurrentScreen ( ) ) ; <nl> + uiRes = ( RESOLUTION ) CServiceBroker : : GetWinSystem ( ) . DesktopResolution ( CServiceBroker : : GetWinSystem ( ) . GetCurrentScreen ( ) ) ; <nl> } <nl> <nl> CDisplaySettings : : GetInstance ( ) . SetCurrentResolution ( uiRes , true ) ; <nl> void CGraphicContext : : SetMediaDir ( const std : : string & strMediaDir ) <nl> <nl> void CGraphicContext : : Flip ( bool rendered , bool videoLayer ) <nl> { <nl> - g_Windowing . PresentRender ( rendered , videoLayer ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . PresentRender ( rendered , videoLayer ) ; <nl> <nl> if ( m_stereoMode ! = m_nextStereoMode ) <nl> { <nl> void CGraphicContext : : Flip ( bool rendered , bool videoLayer ) <nl> <nl> void CGraphicContext : : ApplyHardwareTransform ( ) <nl> { <nl> - g_Windowing . ApplyHardwareTransform ( m_finalTransform . matrix ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . ApplyHardwareTransform ( m_finalTransform . matrix ) ; <nl> } <nl> <nl> void CGraphicContext : : RestoreHardwareTransform ( ) <nl> { <nl> - g_Windowing . RestoreHardwareTransform ( ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . RestoreHardwareTransform ( ) ; <nl> } <nl> <nl> void CGraphicContext : : GetAllowedResolutions ( std : : vector < RESOLUTION > & res ) <nl> mmm a / xbmc / guilib / Shader . cpp <nl> ppp b / xbmc / guilib / Shader . cpp <nl> <nl> <nl> # include " system . h " <nl> <nl> + # include " ServiceBroker . h " <nl> # include " Shader . h " <nl> # include " filesystem / File . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> <nl> # ifdef HAS_GLES <nl> # define GLchar char <nl> bool CShader : : LoadSource ( const std : : string & filename , const std : : string & prefix ) <nl> CFileStream file ; <nl> <nl> std : : string path = " special : / / xbmc / system / shaders / " ; <nl> - path + = g_Windowing . GetShaderPath ( ) ; <nl> + path + = CServiceBroker : : GetRenderSystem ( ) . GetShaderPath ( ) ; <nl> path + = filename ; <nl> if ( ! file . Open ( path ) ) <nl> { <nl> bool CShader : : AppendSource ( const std : : string & filename ) <nl> std : : string temp ; <nl> <nl> std : : string path = " special : / / xbmc / system / shaders / " ; <nl> - path + = g_Windowing . GetShaderPath ( ) ; <nl> + path + = CServiceBroker : : GetRenderSystem ( ) . GetShaderPath ( ) ; <nl> path + = filename ; <nl> if ( ! file . Open ( path ) ) <nl> { <nl> mmm a / xbmc / guilib / StereoscopicsManager . cpp <nl> ppp b / xbmc / guilib / StereoscopicsManager . cpp <nl> <nl> # include " utils / RegExp . h " <nl> # include " utils / StringUtils . h " <nl> # include " utils / Variant . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> # include " guiinfo / GUIInfoLabels . h " <nl> <nl> using namespace KODI : : MESSAGING ; <nl> void CStereoscopicsManager : : SetStereoMode ( const RENDER_STEREO_MODE & mode ) <nl> <nl> if ( applyMode ! = currentMode & & applyMode > = RENDER_STEREO_MODE_OFF ) <nl> { <nl> - if ( ! g_Windowing . SupportsStereo ( applyMode ) ) <nl> + if ( ! CServiceBroker : : GetRenderSystem ( ) . SupportsStereo ( applyMode ) ) <nl> return ; <nl> CServiceBroker : : GetSettings ( ) . SetInt ( CSettings : : SETTING_VIDEOSCREEN_STEREOSCOPICMODE , applyMode ) ; <nl> } <nl> RENDER_STEREO_MODE CStereoscopicsManager : : GetNextSupportedStereoMode ( const RENDE <nl> RENDER_STEREO_MODE mode = currentMode ; <nl> do { <nl> mode = ( RENDER_STEREO_MODE ) ( ( mode + step ) % RENDER_STEREO_MODE_COUNT ) ; <nl> - if ( g_Windowing . SupportsStereo ( mode ) ) <nl> + if ( CServiceBroker : : GetRenderSystem ( ) . SupportsStereo ( mode ) ) <nl> break ; <nl> } while ( mode ! = currentMode ) ; <nl> return mode ; <nl> RENDER_STEREO_MODE CStereoscopicsManager : : GetStereoModeByUserChoice ( const std : : s <nl> for ( int i = RENDER_STEREO_MODE_OFF ; i < RENDER_STEREO_MODE_COUNT ; i + + ) <nl> { <nl> RENDER_STEREO_MODE selectableMode = ( RENDER_STEREO_MODE ) i ; <nl> - if ( g_Windowing . SupportsStereo ( selectableMode ) ) <nl> + if ( CServiceBroker : : GetRenderSystem ( ) . SupportsStereo ( selectableMode ) ) <nl> { <nl> selectableModes . push_back ( selectableMode ) ; <nl> std : : string label = GetLabelForStereoMode ( ( RENDER_STEREO_MODE ) i ) ; <nl> void CStereoscopicsManager : : OnPlaybackStarted ( void ) <nl> <nl> int idx_mono = pDlgSelect - > Add ( GetLabelForStereoMode ( RENDER_STEREO_MODE_MONO ) ) ; / / mono / 2d <nl> <nl> - if ( playing ! = RENDER_STEREO_MODE_OFF & & playing ! = preferred & & preferred ! = RENDER_STEREO_MODE_AUTO & & g_Windowing . SupportsStereo ( playing ) ) / / same as movie <nl> + if ( playing ! = RENDER_STEREO_MODE_OFF & & playing ! = preferred & & preferred ! = RENDER_STEREO_MODE_AUTO & & CServiceBroker : : GetRenderSystem ( ) . SupportsStereo ( playing ) ) / / same as movie <nl> idx_playing = pDlgSelect - > Add ( g_localizeStrings . Get ( 36532 ) <nl> + " ( " <nl> + GetLabelForStereoMode ( playing ) <nl> mmm a / xbmc / guilib / Texture . cpp <nl> ppp b / xbmc / guilib / Texture . cpp <nl> <nl> * / <nl> <nl> # include " Texture . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " ServiceBroker . h " <nl> # include " utils / log . h " <nl> # include " utils / URIUtils . h " <nl> # include " DDSImage . h " <nl> <nl> # ifdef TARGET_POSIX <nl> # include " linux / XMemUtils . h " <nl> # endif <nl> + # include " rendering / RenderSystem . h " <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * * / <nl> void CBaseTexture : : Allocate ( unsigned int width , unsigned int height , unsigned in <nl> m_textureHeight = m_imageHeight ; <nl> <nl> if ( m_format & XB_FMT_DXT_MASK ) <nl> - while ( GetPitch ( ) < g_Windowing . GetMinDXTPitch ( ) ) <nl> + while ( GetPitch ( ) < CServiceBroker : : GetRenderSystem ( ) . GetMinDXTPitch ( ) ) <nl> m_textureWidth + = GetBlockSize ( ) ; <nl> <nl> - if ( ! g_Windowing . SupportsNPOT ( ( m_format & XB_FMT_DXT_MASK ) ! = 0 ) ) <nl> + if ( ! CServiceBroker : : GetRenderSystem ( ) . SupportsNPOT ( ( m_format & XB_FMT_DXT_MASK ) ! = 0 ) ) <nl> { <nl> m_textureWidth = PadPow2 ( m_textureWidth ) ; <nl> m_textureHeight = PadPow2 ( m_textureHeight ) ; <nl> void CBaseTexture : : Allocate ( unsigned int width , unsigned int height , unsigned in <nl> <nl> / / check for max texture size <nl> # define CLAMP ( x , y ) { if ( x > y ) x = y ; } <nl> - CLAMP ( m_textureWidth , g_Windowing . GetMaxTextureSize ( ) ) ; <nl> - CLAMP ( m_textureHeight , g_Windowing . GetMaxTextureSize ( ) ) ; <nl> + CLAMP ( m_textureWidth , CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ) ; <nl> + CLAMP ( m_textureHeight , CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ) ; <nl> CLAMP ( m_imageWidth , m_textureWidth ) ; <nl> CLAMP ( m_imageHeight , m_textureHeight ) ; <nl> <nl> bool CBaseTexture : : LoadFromFileInternal ( const std : : string & texturePath , unsigned <nl> return false ; <nl> } <nl> <nl> - unsigned int width = maxWidth ? std : : min ( maxWidth , g_Windowing . GetMaxTextureSize ( ) ) : g_Windowing . GetMaxTextureSize ( ) ; <nl> - unsigned int height = maxHeight ? std : : min ( maxHeight , g_Windowing . GetMaxTextureSize ( ) ) : g_Windowing . GetMaxTextureSize ( ) ; <nl> + unsigned int width = maxWidth ? std : : min ( maxWidth , CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ) : <nl> + CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ; <nl> + unsigned int height = maxHeight ? std : : min ( maxHeight , CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ) : <nl> + CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ; <nl> <nl> / / Read image into memory to use our vfs <nl> XFILE : : CFile file ; <nl> bool CBaseTexture : : LoadFromFileInMem ( unsigned char * buffer , size_t size , const s <nl> if ( ! buffer | | ! size ) <nl> return false ; <nl> <nl> - unsigned int width = maxWidth ? std : : min ( maxWidth , g_Windowing . GetMaxTextureSize ( ) ) : g_Windowing . GetMaxTextureSize ( ) ; <nl> - unsigned int height = maxHeight ? std : : min ( maxHeight , g_Windowing . GetMaxTextureSize ( ) ) : g_Windowing . GetMaxTextureSize ( ) ; <nl> + unsigned int width = maxWidth ? std : : min ( maxWidth , CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ) : <nl> + CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ; <nl> + unsigned int height = maxHeight ? std : : min ( maxHeight , CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ) : <nl> + CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ; <nl> <nl> IImage * pImage = ImageFactory : : CreateLoaderFromMimeType ( mimeType ) ; <nl> if ( ! LoadIImage ( pImage , buffer , size , width , height ) ) <nl> mmm a / xbmc / guilib / TextureGL . cpp <nl> ppp b / xbmc / guilib / TextureGL . cpp <nl> <nl> * / <nl> <nl> # include " system . h " <nl> + # include " ServiceBroker . h " <nl> # include " Texture . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> # include " guilib / TextureManager . h " <nl> <nl> # include " linux / XMemUtils . h " <nl> # endif <nl> <nl> - # if defined ( HAS_GL ) | | defined ( HAS_GLES ) <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * CGLTexture * / <nl> void CGLTexture : : LoadToGPU ( ) <nl> glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_S , GL_CLAMP_TO_EDGE ) ; <nl> glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_T , GL_CLAMP_TO_EDGE ) ; <nl> <nl> - unsigned int maxSize = g_Windowing . GetMaxTextureSize ( ) ; <nl> + unsigned int maxSize = CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ; <nl> if ( m_textureHeight > maxSize ) <nl> { <nl> CLog : : Log ( LOGERROR , " GL : Image height % d too big to fit into single texture unit , truncating to % u " , m_textureHeight , maxSize ) ; <nl> void CGLTexture : : LoadToGPU ( ) <nl> internalformat = pixelformat = GL_RGB ; <nl> break ; <nl> case XB_FMT_A8R8G8B8 : <nl> - if ( g_Windowing . SupportsBGRA ( ) ) <nl> + if ( CServiceBroker : : GetRenderSystem ( ) . SupportsBGRA ( ) ) <nl> { <nl> internalformat = pixelformat = GL_BGRA_EXT ; <nl> } <nl> - else if ( g_Windowing . SupportsBGRAApple ( ) ) <nl> + else if ( CServiceBroker : : GetRenderSystem ( ) . SupportsBGRAApple ( ) ) <nl> { <nl> / / Apple ' s implementation does not conform to spec . Instead , they require <nl> / / differing format / internalformat , more like GL . <nl> void CGLTexture : : BindToUnit ( unsigned int unit ) <nl> glBindTexture ( GL_TEXTURE_2D , m_texture ) ; <nl> } <nl> <nl> - # endif / / HAS_GL <nl> mmm a / xbmc / guilib / TextureManager . cpp <nl> ppp b / xbmc / guilib / TextureManager . cpp <nl> <nl> # include " utils / TimeUtils . h " <nl> # endif <nl> # if defined ( TARGET_DARWIN_IOS ) <nl> - # include " windowing / WindowingFactory . h " / / for g_Windowing in CGUITextureManager : : FreeUnusedTextures <nl> + # include " ServiceBroker . h " <nl> + # include " windowing / osx / WinSystemIOS . h " / / for g_Windowing in CGUITextureManager : : FreeUnusedTextures <nl> # endif <nl> # include " FFmpegImage . h " <nl> <nl> void CGUITextureManager : : FreeUnusedTextures ( unsigned int timeDelay ) <nl> / / when XBMC is backgrounded ( e . x . for backgrounded music playback ) <nl> / / sanity check before delete in that case . <nl> # if defined ( TARGET_DARWIN_IOS ) <nl> - if ( ! g_Windowing . IsBackgrounded ( ) | | glIsTexture ( m_unusedHwTextures [ i ] ) ) <nl> + CWinSystemIOS & winSystem = dynamic_cast < CWinSystemIOS & > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> + if ( ! winSystem . IsBackgrounded ( ) | | glIsTexture ( m_unusedHwTextures [ i ] ) ) <nl> # endif <nl> glDeleteTextures ( 1 , ( GLuint * ) & m_unusedHwTextures [ i ] ) ; <nl> } <nl> mmm a / xbmc / input / InertialScrollingHandler . cpp <nl> ppp b / xbmc / input / InertialScrollingHandler . cpp <nl> <nl> <nl> # include " InertialScrollingHandler . h " <nl> # include " Application . h " <nl> + # include " ServiceBroker . h " <nl> # include " utils / TimeUtils . h " <nl> # include " input / Key . h " <nl> # include " guilib / GUIWindowManager . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> # include " utils / log . h " <nl> <nl> bool CInertialScrollingHandler : : CheckForInertialScrolling ( const CAction * action ) <nl> { <nl> bool ret = false ; / / return value - false no inertial scrolling - true - inertial scrolling <nl> <nl> - if ( g_Windowing . HasInertialGestures ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . HasInertialGestures ( ) ) <nl> { <nl> return ret ; / / no need for emulating inertial scrolling - windowing does support it natively . <nl> } <nl> mmm a / xbmc / input / MouseStat . cpp <nl> ppp b / xbmc / input / MouseStat . cpp <nl> <nl> # include " MouseStat . h " <nl> # include " input / Key . h " <nl> # include " utils / TimeUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " ServiceBroker . h " <nl> + # include " windowing / WinSystem . h " <nl> + # include < cstring > <nl> <nl> CMouseStat : : CMouseStat ( ) <nl> { <nl> void CMouseStat : : SetActive ( bool active / * = true * / ) <nl> / / 1 . The mouse is active ( it has been moved ) AND <nl> / / 2 . The XBMC mouse is disabled in settings AND <nl> / / 3 . XBMC is not in fullscreen . <nl> - g_Windowing . ShowOSMouse ( m_mouseState . active & & ! IsEnabled ( ) & & ! g_Windowing . IsFullScreen ( ) ) ; <nl> + CWinSystemBase & winSystem = CServiceBroker : : GetWinSystem ( ) ; <nl> + winSystem . ShowOSMouse ( m_mouseState . active & & ! IsEnabled ( ) & & ! CServiceBroker : : GetWinSystem ( ) . IsFullScreen ( ) ) ; <nl> } <nl> <nl> / / IsActive - returns true if we have been active in the last MOUSE_ACTIVE_LENGTH period <nl> mmm a / xbmc / interfaces / json - rpc / GUIOperations . cpp <nl> ppp b / xbmc / interfaces / json - rpc / GUIOperations . cpp <nl> <nl> # include " settings / Settings . h " <nl> # include " utils / Variant . h " <nl> # include " guilib / StereoscopicsManager . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> <nl> using namespace JSONRPC ; <nl> using namespace ADDON ; <nl> JSONRPC_STATUS CGUIOperations : : GetStereoscopicModes ( const std : : string & method , I <nl> for ( int i = RENDER_STEREO_MODE_OFF ; i < RENDER_STEREO_MODE_COUNT ; i + + ) <nl> { <nl> RENDER_STEREO_MODE mode = ( RENDER_STEREO_MODE ) i ; <nl> - if ( g_Windowing . SupportsStereo ( mode ) ) <nl> + if ( CServiceBroker : : GetRenderSystem ( ) . SupportsStereo ( mode ) ) <nl> result [ " stereoscopicmodes " ] . push_back ( GetStereoModeObjectFromGuiMode ( mode ) ) ; <nl> } <nl> <nl> mmm a / xbmc / network / upnp / UPnPPlayer . cpp <nl> ppp b / xbmc / network / upnp / UPnPPlayer . cpp <nl> <nl> # include < Platinum / Source / Devices / MediaRenderer / PltMediaController . h > <nl> # include < Platinum / Source / Devices / MediaServer / PltDidl . h > <nl> <nl> + # include " ServiceBroker . h " <nl> # include " UPnPPlayer . h " <nl> # include " UPnP . h " <nl> # include " UPnPInternal . h " <nl> <nl> # include " dialogs / GUIDialogBusy . h " <nl> # include " guilib / GUIWindowManager . h " <nl> # include " input / Key . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> using namespace KODI : : MESSAGING ; <nl> <nl> CUPnPPlayer : : CUPnPPlayer ( IPlayerCallback & callback , const char * uuid ) <nl> else <nl> CLog : : Log ( LOGERROR , " UPNP : CUPnPPlayer couldn ' t find device as % s " , uuid ) ; <nl> <nl> - g_Windowing . RegisterRenderLoop ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . RegisterRenderLoop ( this ) ; <nl> } <nl> <nl> CUPnPPlayer : : ~ CUPnPPlayer ( ) <nl> { <nl> - g_Windowing . UnregisterRenderLoop ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . UnregisterRenderLoop ( this ) ; <nl> CloseFile ( ) ; <nl> CUPnP : : UnregisterUserdata ( m_delegate ) ; <nl> delete m_delegate ; <nl> mmm a / xbmc / pictures / GUIWindowSlideShow . cpp <nl> ppp b / xbmc / pictures / GUIWindowSlideShow . cpp <nl> <nl> # include " settings / Settings . h " <nl> # include " FileItem . h " <nl> # include " guilib / Texture . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> # include " guilib / LocalizeStrings . h " <nl> # include " TextureDatabase . h " <nl> # include " threads / SingleLock . h " <nl> void CBackgroundPicLoader : : Process ( ) <nl> int iSize = texture - > GetWidth ( ) * texture - > GetHeight ( ) - MAX_PICTURE_SIZE ; <nl> if ( ( iSize + ( int ) texture - > GetWidth ( ) > 0 ) | | ( iSize + ( int ) texture - > GetHeight ( ) > 0 ) ) <nl> bFullSize = true ; <nl> - if ( ! bFullSize & & texture - > GetWidth ( ) = = g_Windowing . GetMaxTextureSize ( ) ) <nl> + if ( ! bFullSize & & texture - > GetWidth ( ) = = CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ) <nl> bFullSize = true ; <nl> - if ( ! bFullSize & & texture - > GetHeight ( ) = = g_Windowing . GetMaxTextureSize ( ) ) <nl> + if ( ! bFullSize & & texture - > GetHeight ( ) = = CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ) <nl> bFullSize = true ; <nl> } <nl> } <nl> void CGUIWindowSlideShow : : AddItems ( const std : : string & strPath , path_set * recursi <nl> <nl> void CGUIWindowSlideShow : : GetCheckedSize ( float width , float height , int & maxWidth , int & maxHeight ) <nl> { <nl> - maxWidth = g_Windowing . GetMaxTextureSize ( ) ; <nl> - maxHeight = g_Windowing . GetMaxTextureSize ( ) ; <nl> + maxWidth = CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ; <nl> + maxHeight = CServiceBroker : : GetRenderSystem ( ) . GetMaxTextureSize ( ) ; <nl> } <nl> <nl> std : : string CGUIWindowSlideShow : : GetPicturePath ( CFileItem * item ) <nl> mmm a / xbmc / pictures / SlideShowPicture . cpp <nl> ppp b / xbmc / pictures / SlideShowPicture . cpp <nl> <nl> # include " guilib / Texture . h " <nl> # include " settings / AdvancedSettings . h " <nl> # include " settings / Settings . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include " threads / SingleLock . h " <nl> + # include " windowing / WinSystem . h " <nl> # ifndef _USE_MATH_DEFINES <nl> # define _USE_MATH_DEFINES <nl> # endif <nl> # include < math . h > <nl> <nl> + # if defined ( HAS_GL ) <nl> + # include " rendering / gl / RenderSystemGL . h " <nl> + # elif defined ( HAS_GLES ) <nl> + # include " rendering / gles / RenderSystemGLES . h " <nl> + # endif <nl> + <nl> # define IMMEDIATE_TRANSITION_TIME 20 <nl> <nl> # define PICTURE_MOVE_AMOUNT 0 . 02f <nl> void CSlideShowPic : : Render ( float * x , float * y , CBaseTexture * pTexture , color_t c <nl> } <nl> <nl> # elif defined ( HAS_GL ) <nl> + CRenderSystemGL * renderSystem = dynamic_cast < CRenderSystemGL * > ( & CServiceBroker : : GetRenderSystem ( ) ) ; <nl> if ( pTexture ) <nl> { <nl> pTexture - > LoadToGPU ( ) ; <nl> void CSlideShowPic : : Render ( float * x , float * y , CBaseTexture * pTexture , color_t c <nl> glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ) ; <nl> glEnable ( GL_BLEND ) ; / / Turn Blending On <nl> <nl> - g_Windowing . EnableShader ( SM_TEXTURE ) ; <nl> + renderSystem - > EnableShader ( SM_TEXTURE ) ; <nl> } <nl> else <nl> { <nl> - g_Windowing . EnableShader ( SM_DEFAULT ) ; <nl> + renderSystem - > EnableShader ( SM_DEFAULT ) ; <nl> } <nl> <nl> float u1 = 0 , u2 = 1 , v1 = 0 , v2 = 1 ; <nl> void CSlideShowPic : : Render ( float * x , float * y , CBaseTexture * pTexture , color_t c <nl> vertex [ 3 ] . u1 = u1 ; <nl> vertex [ 3 ] . v1 = v2 ; <nl> <nl> - GLint posLoc = g_Windowing . ShaderGetPos ( ) ; <nl> - GLint tex0Loc = g_Windowing . ShaderGetCoord0 ( ) ; <nl> - GLint uniColLoc = g_Windowing . ShaderGetUniCol ( ) ; <nl> + GLint posLoc = renderSystem - > ShaderGetPos ( ) ; <nl> + GLint tex0Loc = renderSystem - > ShaderGetCoord0 ( ) ; <nl> + GLint uniColLoc = renderSystem - > ShaderGetUniCol ( ) ; <nl> <nl> glGenBuffers ( 1 , & vertexVBO ) ; <nl> glBindBuffer ( GL_ARRAY_BUFFER , vertexVBO ) ; <nl> void CSlideShowPic : : Render ( float * x , float * y , CBaseTexture * pTexture , color_t c <nl> colour [ 2 ] = ( GLubyte ) GET_B ( color ) ; <nl> colour [ 3 ] = ( GLubyte ) GET_A ( color ) ; <nl> <nl> - if ( g_Windowing . UseLimitedColor ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . UseLimitedColor ( ) ) <nl> { <nl> colour [ 0 ] = ( 235 - 16 ) * colour [ 0 ] / 255 + 16 . 0f / 255 . 0f ; <nl> colour [ 1 ] = ( 235 - 16 ) * colour [ 1 ] / 255 + 16 . 0f / 255 . 0f ; <nl> void CSlideShowPic : : Render ( float * x , float * y , CBaseTexture * pTexture , color_t c <nl> glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER , 0 ) ; <nl> glDeleteBuffers ( 1 , & indexVBO ) ; <nl> <nl> - g_Windowing . DisableShader ( ) ; <nl> + renderSystem - > DisableShader ( ) ; <nl> <nl> # elif defined ( HAS_GLES ) <nl> + CRenderSystemGLES * renderSystem = dynamic_cast < CRenderSystemGLES * > ( & CServiceBroker : : GetRenderSystem ( ) ) ; <nl> if ( pTexture ) <nl> { <nl> pTexture - > LoadToGPU ( ) ; <nl> void CSlideShowPic : : Render ( float * x , float * y , CBaseTexture * pTexture , color_t c <nl> glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ) ; <nl> glEnable ( GL_BLEND ) ; / / Turn Blending On <nl> <nl> - g_Windowing . EnableGUIShader ( SM_TEXTURE ) ; <nl> + renderSystem - > EnableGUIShader ( SM_TEXTURE ) ; <nl> } <nl> else <nl> { <nl> - g_Windowing . EnableGUIShader ( SM_DEFAULT ) ; <nl> + renderSystem - > EnableGUIShader ( SM_DEFAULT ) ; <nl> } <nl> <nl> float u1 = 0 , u2 = 1 , v1 = 0 , v2 = 1 ; <nl> void CSlideShowPic : : Render ( float * x , float * y , CBaseTexture * pTexture , color_t c <nl> GLfloat tex [ 4 ] [ 2 ] ; <nl> GLubyte idx [ 4 ] = { 0 , 1 , 3 , 2 } ; / / determines order of triangle strip <nl> <nl> - GLint posLoc = g_Windowing . GUIShaderGetPos ( ) ; <nl> - GLint tex0Loc = g_Windowing . GUIShaderGetCoord0 ( ) ; <nl> - GLint uniColLoc = g_Windowing . GUIShaderGetUniCol ( ) ; <nl> + GLint posLoc = renderSystem - > GUIShaderGetPos ( ) ; <nl> + GLint tex0Loc = renderSystem - > GUIShaderGetCoord0 ( ) ; <nl> + GLint uniColLoc = renderSystem - > GUIShaderGetUniCol ( ) ; <nl> <nl> glVertexAttribPointer ( posLoc , 3 , GL_FLOAT , 0 , 0 , ver ) ; <nl> glVertexAttribPointer ( tex0Loc , 2 , GL_FLOAT , 0 , 0 , tex ) ; <nl> void CSlideShowPic : : Render ( float * x , float * y , CBaseTexture * pTexture , color_t c <nl> glDisableVertexAttribArray ( posLoc ) ; <nl> glDisableVertexAttribArray ( tex0Loc ) ; <nl> <nl> - g_Windowing . DisableGUIShader ( ) ; <nl> + renderSystem - > DisableGUIShader ( ) ; <nl> <nl> # endif <nl> } <nl> mmm a / xbmc / platform / darwin / ios / IOSEAGLView . mm <nl> ppp b / xbmc / platform / darwin / ios / IOSEAGLView . mm <nl> <nl> # include " settings / AdvancedSettings . h " <nl> # include " Application . h " <nl> # include " messaging / ApplicationMessenger . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include " utils / log . h " <nl> # include " utils / TimeUtils . h " <nl> # include " Util . h " <nl> mmm a / xbmc / platform / darwin / ios / IOSExternalTouchController . mm <nl> ppp b / xbmc / platform / darwin / ios / IOSExternalTouchController . mm <nl> <nl> * / <nl> <nl> # include " input / MouseStat . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include " filesystem / SpecialProtocol . h " <nl> # include " guilib / LocalizeStrings . h " <nl> <nl> mmm a / xbmc / platform / darwin / ios / IOSScreenManager . mm <nl> ppp b / xbmc / platform / darwin / ios / IOSScreenManager . mm <nl> <nl> <nl> # include < sys / resource . h > <nl> # include < signal . h > <nl> + # include " ServiceBroker . h " <nl> # include " utils / log . h " <nl> # include " settings / DisplaySettings . h " <nl> # include " threads / Event . h " <nl> # include " Application . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " settings / DisplaySettings . h " <nl> # include " ServiceBroker . h " <nl> # include " cores / AudioEngine / Interfaces / AE . h " <nl> - ( void ) screenDisconnect <nl> if ( [ [ UIScreen screens ] count ] = = 1 & & _screenIdx ! = 0 ) <nl> { <nl> RESOLUTION_INFO res = CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( RES_DESKTOP ) ; / / internal screen default res <nl> - g_Windowing . SetFullScreen ( true , res , false ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . SetFullScreen ( true , res , false ) ; <nl> } <nl> } <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + ( void ) updateResolutions <nl> { <nl> - g_Windowing . UpdateResolutions ( ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . UpdateResolutions ( ) ; <nl> } <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ( void ) dealloc <nl> mmm a / xbmc / platform / darwin / ios / XBMCController . mm <nl> ppp b / xbmc / platform / darwin / ios / XBMCController . mm <nl> <nl> # include < sys / resource . h > <nl> # include < signal . h > <nl> <nl> + # include " ServiceBroker . h " <nl> # include " system . h " <nl> # include " settings / AdvancedSettings . h " <nl> # include " settings / Settings . h " <nl> <nl> # include " input / touch / generic / GenericTouchActionHandler . h " <nl> # include " guilib / GUIControl . h " <nl> # include " input / Key . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / osx / WinSystemIOS . h " <nl> # include " windowing / XBMC_events . h " <nl> # include " utils / log . h " <nl> # include " utils / TimeUtils . h " <nl> - ( void ) enterBackground <nl> m_isPlayingBeforeInactive = YES ; <nl> CApplicationMessenger : : GetInstance ( ) . SendMsg ( TMSG_MEDIA_PAUSE_IF_PLAYING ) ; <nl> } <nl> - g_Windowing . OnAppFocusChange ( false ) ; <nl> + CWinSystemIOS & winSystem = dynamic_cast < CWinSystemIOS & > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> + winSystem . OnAppFocusChange ( false ) ; <nl> } <nl> <nl> - ( void ) enterForeground <nl> { <nl> PRINT_SIGNATURE ( ) ; <nl> - g_Windowing . OnAppFocusChange ( true ) ; <nl> + CWinSystemIOS & winSystem = dynamic_cast < CWinSystemIOS & > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> + winSystem . OnAppFocusChange ( true ) ; <nl> / / when we come back , restore playing if we were . <nl> if ( m_isPlayingBeforeInactive ) <nl> { <nl> mmm a / xbmc / platform / darwin / osx / CocoaInterface . mm <nl> ppp b / xbmc / platform / darwin / osx / CocoaInterface . mm <nl> <nl> # define BOOL XBMC_BOOL <nl> # include " utils / log . h " <nl> # include " CompileInfo . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " ServiceBroker . h " <nl> + # include " windowing / osx / WinSystemOSX . h " <nl> # undef BOOL <nl> <nl> # import < Cocoa / Cocoa . h > <nl> <nl> <nl> NSOpenGLContext * Cocoa_GL_GetCurrentContext ( void ) <nl> { <nl> - return ( NSOpenGLContext * ) g_Windowing . GetNSOpenGLContext ( ) ; <nl> + CWinSystemOSX * winSystem = dynamic_cast < CWinSystemOSX * > ( & CServiceBroker : : GetWinSystem ( ) ) ; <nl> + return ( NSOpenGLContext * ) winSystem - > GetNSOpenGLContext ( ) ; <nl> } <nl> <nl> uint32_t Cocoa_GL_GetCurrentDisplayID ( void ) <nl> mmm a / xbmc / powermanagement / DPMSSupport . cpp <nl> ppp b / xbmc / powermanagement / DPMSSupport . cpp <nl> <nl> # include " system . h " <nl> # include " DPMSSupport . h " <nl> # include " utils / log . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include < assert . h > <nl> # include < string > <nl> # ifdef TARGET_WINDOWS <nl> bool DPMSSupport : : DisablePowerSaving ( ) <nl> / / / / / / / / / Platform - specific support <nl> <nl> # if defined ( HAVE_X11 ) <nl> + # include " ServiceBroker . h " <nl> + # include " windowing / X11 / WinSystemX11 . h " <nl> / / / / X Windows <nl> <nl> / / Here ' s a sad story : our Windows - inspired BOOL type from linux / PlatformDefs . h <nl> static const CARD16 X_DPMS_MODES [ ] = <nl> <nl> void DPMSSupport : : PlatformSpecificInit ( ) <nl> { <nl> - Display * dpy = g_Windowing . GetDisplay ( ) ; <nl> - if ( dpy = = NULL ) return ; <nl> + CWinSystemX11 & winSystem = dynamic_cast < CWinSystemX11 & > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> + Display * dpy = winSystem . GetDisplay ( ) ; <nl> + if ( dpy = = NULL ) <nl> + return ; <nl> <nl> int event_base , error_base ; / / we ignore these <nl> if ( ! DPMSQueryExtension ( dpy , & event_base , & error_base ) ) { <nl> void DPMSSupport : : PlatformSpecificInit ( ) <nl> <nl> bool DPMSSupport : : PlatformSpecificEnablePowerSaving ( PowerSavingMode mode ) <nl> { <nl> - Display * dpy = g_Windowing . GetDisplay ( ) ; <nl> - if ( dpy = = NULL ) return false ; <nl> + CWinSystemX11 & winSystem = dynamic_cast < CWinSystemX11 & > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> + Display * dpy = winSystem . GetDisplay ( ) ; <nl> + if ( dpy = = NULL ) <nl> + return false ; <nl> <nl> / / This is not needed on my ATI Radeon , but the docs say that DPMSForceLevel <nl> / / after a DPMSDisable ( from SDL ) should not normally work . <nl> bool DPMSSupport : : PlatformSpecificEnablePowerSaving ( PowerSavingMode mode ) <nl> <nl> bool DPMSSupport : : PlatformSpecificDisablePowerSaving ( ) <nl> { <nl> - Display * dpy = g_Windowing . GetDisplay ( ) ; <nl> - if ( dpy = = NULL ) return false ; <nl> + CWinSystemX11 & winSystem = dynamic_cast < CWinSystemX11 & > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> + Display * dpy = winSystem . GetDisplay ( ) ; <nl> + if ( dpy = = NULL ) <nl> + return false ; <nl> <nl> DPMSForceLevel ( dpy , DPMSModeOn ) ; <nl> DPMSDisable ( dpy ) ; <nl> XFlush ( dpy ) ; <nl> <nl> - g_Windowing . RecreateWindow ( ) ; <nl> + winSystem . RecreateWindow ( ) ; <nl> <nl> return true ; <nl> } <nl> mmm a / xbmc / powermanagement / PowerManager . cpp <nl> ppp b / xbmc / powermanagement / PowerManager . cpp <nl> <nl> # include " system . h " <nl> # include " utils / log . h " <nl> # include " utils / Weather . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> # if defined ( TARGET_DARWIN ) <nl> # include " osx / CocoaPowerSyscall . h " <nl> void CPowerManager : : OnWake ( ) <nl> dialog - > Close ( true ) ; / / force close . no closing animation , sound etc at this early stage <nl> <nl> # if defined ( HAS_SDL ) | | defined ( TARGET_WINDOWS ) <nl> - if ( g_Windowing . IsFullScreen ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . IsFullScreen ( ) ) <nl> { <nl> # if defined ( TARGET_WINDOWS_DESKTOP ) <nl> ShowWindow ( g_hWnd , SW_RESTORE ) ; <nl> mmm a / xbmc / powermanagement / osx / CocoaPowerSyscall . cpp <nl> ppp b / xbmc / powermanagement / osx / CocoaPowerSyscall . cpp <nl> typedef unsigned char BYTE ; <nl> # include " utils / SystemInfo . h " <nl> # include " Application . h " <nl> # include " powermanagement / PowerManager . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include " CocoaPowerSyscall . h " <nl> <nl> # if defined ( TARGET_DARWIN_OSX ) <nl> mmm a / xbmc / rendering / gl / GLShader . cpp <nl> ppp b / xbmc / rendering / gl / GLShader . cpp <nl> <nl> # include " system . h " <nl> <nl> # include " GLShader . h " <nl> + # include " ServiceBroker . h " <nl> # include " utils / log . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> # include " guilib / GraphicContext . h " <nl> # include " guilib / MatrixGLES . h " <nl> <nl> bool CGLShader : : OnEnabled ( ) <nl> <nl> const TransformMatrix & guiMatrix = g_graphicsContext . GetGUIMatrix ( ) ; <nl> CRect viewPort ; / / absolute positions of corners <nl> - g_Windowing . GetViewPort ( viewPort ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . GetViewPort ( viewPort ) ; <nl> <nl> / * glScissor operates in window coordinates . In order that we can use it to <nl> * perform clipping , we must ensure that there is an independent linear <nl> mmm a / xbmc / rendering / gles / RenderSystemGLES . cpp <nl> ppp b / xbmc / rendering / gles / RenderSystemGLES . cpp <nl> <nl> # include " settings / AdvancedSettings . h " <nl> # include " RenderSystemGLES . h " <nl> # include " guilib / MatrixGLES . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include " utils / log . h " <nl> # include " utils / GLUtils . h " <nl> # include " utils / TimeUtils . h " <nl> bool CRenderSystemGLES : : InitRenderSystem ( ) <nl> <nl> LogGraphicsInfo ( ) ; <nl> <nl> - if ( IsExtSupported ( " GL_TEXTURE_NPOT " ) ) <nl> - { <nl> - m_renderCaps | = RENDER_CAPS_NPOT ; <nl> - } <nl> + m_renderCaps | = RENDER_CAPS_NPOT ; <nl> <nl> if ( IsExtSupported ( " GL_EXT_texture_format_BGRA8888 " ) ) <nl> { <nl> void CRenderSystemGLES : : InitialiseGUIShader ( ) <nl> { <nl> if ( i = = SM_TEXTURE_RGBA_OES | | i = = SM_TEXTURE_RGBA_BOB_OES ) <nl> { <nl> - if ( ! g_Windowing . IsExtSupported ( " GL_OES_EGL_image_external " ) ) <nl> + if ( ! IsExtSupported ( " GL_OES_EGL_image_external " ) ) <nl> { <nl> m_pGUIshader [ i ] = NULL ; <nl> continue ; <nl> mmm a / xbmc / rendering / gles / RenderSystemGLES . h <nl> ppp b / xbmc / rendering / gles / RenderSystemGLES . h <nl> <nl> * <nl> * / <nl> <nl> - # ifndef RENDER_SYSTEM_GLES_H <nl> - # define RENDER_SYSTEM_GLES_H <nl> - <nl> # pragma once <nl> <nl> # include " system . h " <nl> class CRenderSystemGLES : public CRenderSystemBase <nl> GLint m_viewPort [ 4 ] ; <nl> } ; <nl> <nl> - # endif / / RENDER_SYSTEM_H <nl> mmm a / xbmc / settings / DisplaySettings . cpp <nl> ppp b / xbmc / settings / DisplaySettings . cpp <nl> <nl> # include " utils / StringUtils . h " <nl> # include " utils / Variant . h " <nl> # include " utils / XMLUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> + # include " windowing / WinSystem . h " <nl> + <nl> + # if defined ( HAVE_X11 ) <nl> + # include " windowing / X11 / WinSystemX11 . h " <nl> + # elif defined ( HAVE_WAYLAND ) <nl> + # include " windowing / wayland / WinSystemWayland . h " <nl> + # endif <nl> <nl> using namespace KODI : : MESSAGING ; <nl> <nl> bool CDisplaySettings : : OnSettingChanging ( std : : shared_ptr < const CSetting > setting <nl> } <nl> else if ( settingId = = CSettings : : SETTING_VIDEOSCREEN_MONITOR ) <nl> { <nl> - g_Windowing . UpdateResolutions ( ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . UpdateResolutions ( ) ; <nl> RESOLUTION newRes = GetResolutionForScreen ( ) ; <nl> <nl> SetCurrentResolution ( newRes , false ) ; <nl> bool CDisplaySettings : : OnSettingChanging ( std : : shared_ptr < const CSetting > setting <nl> # if defined ( HAVE_X11 ) <nl> else if ( settingId = = CSettings : : SETTING_VIDEOSCREEN_BLANKDISPLAYS ) <nl> { <nl> - g_Windowing . UpdateResolutions ( ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . UpdateResolutions ( ) ; <nl> } <nl> # endif <nl> <nl> bool CDisplaySettings : : OnSettingUpdate ( std : : shared_ptr < CSetting > setting , const <nl> <nl> void CDisplaySettings : : SetCurrentResolution ( RESOLUTION resolution , bool save / * = false * / ) <nl> { <nl> - if ( resolution = = RES_WINDOW & & ! g_Windowing . CanDoWindowed ( ) ) <nl> + if ( resolution = = RES_WINDOW & & ! CServiceBroker : : GetWinSystem ( ) . CanDoWindowed ( ) ) <nl> resolution = RES_DESKTOP ; <nl> <nl> if ( save ) <nl> RESOLUTION CDisplaySettings : : GetResolutionForScreen ( ) <nl> if ( mode = = DM_WINDOWED ) <nl> return RES_WINDOW ; <nl> <nl> - for ( int idx = 0 ; idx < g_Windowing . GetNumScreens ( ) ; idx + + ) <nl> + for ( int idx = 0 ; idx < CServiceBroker : : GetWinSystem ( ) . GetNumScreens ( ) ; idx + + ) <nl> { <nl> if ( CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( RES_DESKTOP + idx ) . iScreen = = mode ) <nl> return ( RESOLUTION ) ( RES_DESKTOP + idx ) ; <nl> void CDisplaySettings : : SettingOptionsRefreshRatesFiller ( SettingConstPtr setting , <nl> <nl> RESOLUTION_INFO resInfo = CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( res ) ; <nl> / / The only meaningful parts of res here are iScreen , iScreenWidth , iScreenHeight <nl> - std : : vector < REFRESHRATE > refreshrates = g_Windowing . RefreshRates ( resInfo . iScreen , resInfo . iScreenWidth , resInfo . iScreenHeight , resInfo . dwFlags ) ; <nl> + std : : vector < REFRESHRATE > refreshrates = CServiceBroker : : GetWinSystem ( ) . RefreshRates ( resInfo . iScreen , resInfo . iScreenWidth , resInfo . iScreenHeight , resInfo . dwFlags ) ; <nl> <nl> bool match = false ; <nl> for ( std : : vector < REFRESHRATE > : : const_iterator refreshrate = refreshrates . begin ( ) ; refreshrate ! = refreshrates . end ( ) ; + + refreshrate ) <nl> void CDisplaySettings : : SettingOptionsRefreshRatesFiller ( SettingConstPtr setting , <nl> } <nl> <nl> if ( ! match ) <nl> - current = GetStringFromResolution ( res , g_Windowing . DefaultRefreshRate ( resInfo . iScreen , refreshrates ) . RefreshRate ) ; <nl> + current = GetStringFromResolution ( res , CServiceBroker : : GetWinSystem ( ) . DefaultRefreshRate ( resInfo . iScreen , refreshrates ) . RefreshRate ) ; <nl> } <nl> <nl> void CDisplaySettings : : SettingOptionsResolutionsFiller ( SettingConstPtr setting , std : : vector < std : : pair < std : : string , int > > & list , int & current , void * data ) <nl> void CDisplaySettings : : SettingOptionsResolutionsFiller ( SettingConstPtr setting , <nl> else <nl> { <nl> std : : map < RESOLUTION , RESOLUTION_INFO > resolutionInfos ; <nl> - std : : vector < RESOLUTION_WHR > resolutions = g_Windowing . ScreenResolutions ( info . iScreen , info . fRefreshRate ) ; <nl> + std : : vector < RESOLUTION_WHR > resolutions = CServiceBroker : : GetWinSystem ( ) . ScreenResolutions ( info . iScreen , info . fRefreshRate ) ; <nl> for ( std : : vector < RESOLUTION_WHR > : : const_iterator resolution = resolutions . begin ( ) ; resolution ! = resolutions . end ( ) ; + + resolution ) <nl> { <nl> list . push_back ( std : : make_pair ( <nl> void CDisplaySettings : : SettingOptionsScreensFiller ( SettingConstPtr setting , std : <nl> / / setting . When the user sets canwindowed to true but the windowing system <nl> / / does not support windowed modes , we would just shoot ourselves in the foot <nl> / / by offering the option . <nl> - if ( g_advancedSettings . m_canWindowed & & g_Windowing . CanDoWindowed ( ) ) <nl> + if ( g_advancedSettings . m_canWindowed & & CServiceBroker : : GetWinSystem ( ) . CanDoWindowed ( ) ) <nl> list . push_back ( std : : make_pair ( g_localizeStrings . Get ( 242 ) , DM_WINDOWED ) ) ; <nl> <nl> # if defined ( HAVE_X11 ) | | defined ( HAVE_WAYLAND ) <nl> list . push_back ( std : : make_pair ( g_localizeStrings . Get ( 244 ) , 0 ) ) ; <nl> # else <nl> <nl> - for ( int idx = 0 ; idx < g_Windowing . GetNumScreens ( ) ; idx + + ) <nl> + for ( int idx = 0 ; idx < CServiceBroker : : GetWinSystem ( ) . GetNumScreens ( ) ; idx + + ) <nl> { <nl> int screen = CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( RES_DESKTOP + idx ) . iScreen ; <nl> # if defined ( TARGET_DARWIN_OSX ) <nl> void CDisplaySettings : : SettingOptionsStereoscopicModesFiller ( SettingConstPtr set <nl> for ( int i = RENDER_STEREO_MODE_OFF ; i < RENDER_STEREO_MODE_COUNT ; i + + ) <nl> { <nl> RENDER_STEREO_MODE mode = ( RENDER_STEREO_MODE ) i ; <nl> - if ( g_Windowing . SupportsStereo ( mode ) ) <nl> + if ( CServiceBroker : : GetRenderSystem ( ) . SupportsStereo ( mode ) ) <nl> list . push_back ( std : : make_pair ( CStereoscopicsManager : : GetInstance ( ) . GetLabelForStereoMode ( mode ) , mode ) ) ; <nl> } <nl> } <nl> void CDisplaySettings : : SettingOptionsPreferredStereoscopicViewModesFiller ( Settin <nl> { <nl> RENDER_STEREO_MODE mode = ( RENDER_STEREO_MODE ) i ; <nl> / / also skip " mono " mode which is no real stereoscopic mode <nl> - if ( mode ! = RENDER_STEREO_MODE_MONO & & g_Windowing . SupportsStereo ( mode ) ) <nl> + if ( mode ! = RENDER_STEREO_MODE_MONO & & CServiceBroker : : GetRenderSystem ( ) . SupportsStereo ( mode ) ) <nl> list . push_back ( std : : make_pair ( CStereoscopicsManager : : GetInstance ( ) . GetLabelForStereoMode ( mode ) , mode ) ) ; <nl> } <nl> } <nl> void CDisplaySettings : : SettingOptionsMonitorsFiller ( SettingConstPtr setting , std <nl> { <nl> # if defined ( HAVE_X11 ) <nl> std : : vector < std : : string > monitors ; <nl> - g_Windowing . GetConnectedOutputs ( & monitors ) ; <nl> + CWinSystemX11 & winSystem = dynamic_cast < CWinSystemX11 & > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> + winSystem . GetConnectedOutputs ( & monitors ) ; <nl> std : : string currentMonitor = CServiceBroker : : GetSettings ( ) . GetString ( CSettings : : SETTING_VIDEOSCREEN_MONITOR ) ; <nl> for ( unsigned int i = 0 ; i < monitors . size ( ) ; + + i ) <nl> { <nl> void CDisplaySettings : : SettingOptionsMonitorsFiller ( SettingConstPtr setting , std <nl> } <nl> # elif defined ( HAVE_WAYLAND ) <nl> std : : vector < std : : string > monitors ; <nl> - g_Windowing . GetConnectedOutputs ( & monitors ) ; <nl> + KODI : : WINDOWING : : WAYLAND : : CWinSystemWayland & winSystem = dynamic_cast < KODI : : WINDOWING : : WAYLAND : : CWinSystemWayland & > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> + winSystem . GetConnectedOutputs ( & monitors ) ; <nl> bool foundMonitor = false ; <nl> std : : string currentMonitor = CServiceBroker : : GetSettings ( ) . GetString ( CSettings : : SETTING_VIDEOSCREEN_MONITOR ) ; <nl> for ( auto const & monitor : monitors ) <nl> mmm a / xbmc / settings / SettingConditions . cpp <nl> ppp b / xbmc / settings / SettingConditions . cpp <nl> <nl> # endif / / defined ( HAS_LIBAMCODEC ) <nl> # include " utils / StringUtils . h " <nl> # include " utils / SystemInfo . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # if defined ( TARGET_DARWIN_OSX ) <nl> # include " platform / darwin / DarwinUtils . h " <nl> # endif / / defined ( TARGET_DARWIN_OSX ) <nl> + # include " windowing / WinSystem . h " <nl> <nl> bool AddonHasSettings ( const std : : string & condition , const std : : string & value , SettingConstPtr setting , void * data ) <nl> { <nl> bool HasPowerOffFeature ( const std : : string & condition , const std : : string & value , <nl> <nl> bool IsFullscreen ( const std : : string & condition , const std : : string & value , SettingConstPtr setting , void * data ) <nl> { <nl> - return g_Windowing . IsFullScreen ( ) ; <nl> + return CServiceBroker : : GetWinSystem ( ) . IsFullScreen ( ) ; <nl> } <nl> <nl> bool IsMasterUser ( const std : : string & condition , const std : : string & value , SettingConstPtr setting , void * data ) <nl> mmm a / xbmc / settings / windows / GUIWindowSettingsScreenCalibration . cpp <nl> ppp b / xbmc / settings / windows / GUIWindowSettingsScreenCalibration . cpp <nl> <nl> # include " utils / log . h " <nl> # include " utils / StringUtils . h " <nl> # include " utils / Variant . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> # include < string > <nl> # include < utility > <nl> void CGUIWindowSettingsScreenCalibration : : UpdateFromControl ( int iControl ) <nl> <nl> / / set the label control correctly <nl> std : : string strText ; <nl> - if ( g_Windowing . IsFullScreen ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . IsFullScreen ( ) ) <nl> strText = StringUtils : : Format ( " % ix % i @ % . 2f - % s | % s " , <nl> info . iScreenWidth , <nl> info . iScreenHeight , <nl> mmm a / xbmc / settings / windows / GUIWindowTestPattern . cpp <nl> ppp b / xbmc / settings / windows / GUIWindowTestPattern . cpp <nl> <nl> * / <nl> <nl> # include " GUIWindowTestPattern . h " <nl> + # include " ServiceBroker . h " <nl> # include " input / Key . h " <nl> # include " guilib / WindowIDs . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> <nl> CGUIWindowTestPattern : : CGUIWindowTestPattern ( void ) <nl> void CGUIWindowTestPattern : : Process ( unsigned int currentTime , CDirtyRegionList & <nl> m_renderRegion . SetRect ( 0 , 0 , ( float ) g_graphicsContext . GetWidth ( ) , ( float ) g_graphicsContext . GetHeight ( ) ) ; <nl> <nl> # ifndef HAS_DX <nl> - if ( g_Windowing . UseLimitedColor ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . UseLimitedColor ( ) ) <nl> { <nl> m_white = 235 . 0f / 255 ; <nl> m_black = 16 . 0f / 255 ; <nl> mmm a / xbmc / system . h <nl> ppp b / xbmc / system . h <nl> <nl> # if defined ( TARGET_DARWIN_OSX ) <nl> # define HAS_GL <nl> # define HAS_SDL <nl> - # define HAS_SDL_WIN_EVENTS <nl> # endif <nl> # define HAS_ZEROCONF <nl> # define HAS_LINUX_NETWORK <nl> <nl> # define HAS_DBUS <nl> # endif <nl> # define HAS_GL <nl> - # ifdef HAVE_X11 <nl> - # define HAS_X11_WIN_EVENTS <nl> - # endif <nl> # ifdef HAVE_SDL <nl> # define HAS_SDL <nl> - # ifndef HAVE_X11 <nl> - # define HAS_SDL_WIN_EVENTS <nl> - # endif <nl> # else <nl> # ifndef HAVE_X11 <nl> # define HAS_LINUX_EVENTS <nl> mmm a / xbmc / test / TestBasicEnvironment . cpp <nl> ppp b / xbmc / test / TestBasicEnvironment . cpp <nl> <nl> # include " interfaces / python / XBPython . h " <nl> # include " pvr / PVRManager . h " <nl> # include " AppParamParser . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> # if defined ( TARGET_WINDOWS ) <nl> # include " platform / win32 / WIN32Util . h " <nl> void TestBasicEnvironment : : SetUp ( ) <nl> g_application . m_ServiceManager - > CreateAudioEngine ( ) ; <nl> CServiceBroker : : GetSettings ( ) . Initialize ( ) ; <nl> <nl> + std : : unique_ptr < CWinSystemBase > winSystem = CWinSystemBase : : CreateWinSystem ( ) ; <nl> + g_application . m_ServiceManager - > SetWinSystem ( std : : move ( winSystem ) ) ; <nl> + <nl> if ( ! g_application . m_ServiceManager - > InitStageTwo ( CAppParamParser ( ) ) ) <nl> exit ( 1 ) ; <nl> <nl> mmm a / xbmc / utils / GLUtils . cpp <nl> ppp b / xbmc / utils / GLUtils . cpp <nl> <nl> <nl> # include " GLUtils . h " <nl> # include " log . h " <nl> + # include " ServiceBroker . h " <nl> # include " settings / AdvancedSettings . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> <nl> void _VerifyGLState ( const char * szfile , const char * szfunction , int lineno ) { <nl> # if defined ( HAS_GL ) & & defined ( _DEBUG ) <nl> void LogGraphicsInfo ( ) <nl> # define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A <nl> # define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B <nl> <nl> - if ( g_Windowing . IsExtSupported ( " GL_NVX_gpu_memory_info " ) ) <nl> + if ( CServiceBroker : : GetRenderSystem ( ) . IsExtSupported ( " GL_NVX_gpu_memory_info " ) ) <nl> { <nl> GLint mem = 0 ; <nl> <nl> void LogGraphicsInfo ( ) <nl> std : : string extensions ; <nl> # if defined ( HAS_GL ) <nl> unsigned int renderVersionMajor , renderVersionMinor ; <nl> - g_Windowing . GetRenderVersion ( renderVersionMajor , renderVersionMinor ) ; <nl> + CServiceBroker : : GetRenderSystem ( ) . GetRenderVersion ( renderVersionMajor , renderVersionMinor ) ; <nl> if ( renderVersionMajor > 3 | | <nl> ( renderVersionMajor = = 3 & & renderVersionMinor > = 2 ) ) <nl> { <nl> mmm a / xbmc / utils / Screenshot . cpp <nl> ppp b / xbmc / utils / Screenshot . cpp <nl> <nl> # include " Screenshot . h " <nl> <nl> # include " system . h " <nl> + # include " system_gl . h " <nl> # include < vector > <nl> <nl> # include " ServiceBroker . h " <nl> # include " Util . h " <nl> # include " URL . h " <nl> <nl> - # include " windowing / WindowingFactory . h " <nl> # include " pictures / Picture . h " <nl> <nl> # ifdef TARGET_RASPBERRY_PI <nl> mmm a / xbmc / utils / SystemInfo . cpp <nl> ppp b / xbmc / utils / SystemInfo . cpp <nl> <nl> # include " filesystem / File . h " <nl> # include " network / Network . h " <nl> # include " ServiceBroker . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " rendering / RenderSystem . h " <nl> # include " guilib / LocalizeStrings . h " <nl> # include " CPUInfo . h " <nl> # include " CompileInfo . h " <nl> std : : string CSysInfoJob : : GetMACAddress ( ) <nl> <nl> std : : string CSysInfoJob : : GetVideoEncoder ( ) <nl> { <nl> - return " GPU : " + g_Windowing . GetRenderRenderer ( ) ; <nl> + return " GPU : " + CServiceBroker : : GetRenderSystem ( ) . GetRenderRenderer ( ) ; <nl> } <nl> <nl> std : : string CSysInfoJob : : GetBatteryLevel ( ) <nl> mmm a / xbmc / video / windows / GUIWindowFullScreen . cpp <nl> ppp b / xbmc / video / windows / GUIWindowFullScreen . cpp <nl> <nl> # include " utils / StringUtils . h " <nl> # include " XBDateTime . h " <nl> # include " input / InputManager . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " cores / IPlayer . h " <nl> # include " guiinfo / GUIInfoLabels . h " <nl> # include " video / ViewModeSettings . h " <nl> void CGUIWindowFullScreen : : FrameMove ( ) <nl> / / show resolution information <nl> { <nl> std : : string strStatus ; <nl> - if ( g_Windowing . IsFullScreen ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . IsFullScreen ( ) ) <nl> strStatus = StringUtils : : Format ( " % s % ix % i @ % . 2fHz - % s " , <nl> g_localizeStrings . Get ( 13287 ) . c_str ( ) , <nl> res . iScreenWidth , <nl> mmm a / xbmc / windowing / CMakeLists . txt <nl> ppp b / xbmc / windowing / CMakeLists . txt <nl> set ( SOURCES OSScreenSaver . cpp <nl> WinSystem . cpp ) <nl> <nl> set ( HEADERS OSScreenSaver . h <nl> - WindowingFactory . h <nl> WinEvents . h <nl> WinSystem . h <nl> XBMC_events . h <nl> mmm a / xbmc / windowing / WinSystem . cpp <nl> ppp b / xbmc / windowing / WinSystem . cpp <nl> <nl> <nl> CWinSystemBase : : CWinSystemBase ( ) <nl> { <nl> - m_eWindowSystem = WINDOW_SYSTEM_WIN32 ; / / this is the 0 value enum <nl> m_nWidth = 0 ; <nl> m_nHeight = 0 ; <nl> m_nTop = 0 ; <nl> mmm a / xbmc / windowing / WinSystem . h <nl> ppp b / xbmc / windowing / WinSystem . h <nl> <nl> * <nl> * / <nl> <nl> - # ifndef WINDOW_SYSTEM_BASE_H <nl> - # define WINDOW_SYSTEM_BASE_H <nl> + # pragma once <nl> <nl> # include " OSScreenSaver . h " <nl> # include " VideoSync . h " <nl> # include " WinEvents . h " <nl> + # include " guilib / DispResource . h " <nl> # include " guilib / Resolution . h " <nl> # include < memory > <nl> # include < vector > <nl> <nl> - enum WindowSystemType <nl> - { <nl> - WINDOW_SYSTEM_WIN32 , <nl> - WINDOW_SYSTEM_OSX , <nl> - WINDOW_SYSTEM_IOS , <nl> - WINDOW_SYSTEM_X11 , <nl> - WINDOW_SYSTEM_MIR , <nl> - WINDOW_SYSTEM_GBM , <nl> - WINDOW_SYSTEM_SDL , <nl> - WINDOW_SYSTEM_EGL , <nl> - WINDOW_SYSTEM_RPI , <nl> - WINDOW_SYSTEM_AML , <nl> - WINDOW_SYSTEM_ANDROID , <nl> - WINDOW_SYSTEM_WAYLAND , <nl> - WINDOW_SYSTEM_WIN10 <nl> - } ; <nl> - <nl> struct RESOLUTION_WHR <nl> { <nl> int width ; <nl> class CWinSystemBase <nl> public : <nl> CWinSystemBase ( ) ; <nl> virtual ~ CWinSystemBase ( ) ; <nl> - WindowSystemType GetWinSystem ( ) { return m_eWindowSystem ; } <nl> + <nl> + static std : : unique_ptr < CWinSystemBase > CreateWinSystem ( ) ; <nl> <nl> / / windowing interfaces <nl> virtual bool InitWindowSystem ( ) ; <nl> class CWinSystemBase <nl> / / OS System screensaver <nl> / * * <nl> * Get OS screen saver inhibit implementation if available <nl> - * <nl> + * <nl> * \ return OS screen saver implementation that can be used with this windowing system <nl> * or nullptr if unsupported . <nl> * Lifetime of the returned object will usually end with \ ref DestroyWindowSystem , so <nl> class CWinSystemBase <nl> virtual bool IsTextInputEnabled ( ) { return false ; } <nl> virtual std : : string GetClipboardText ( void ) ; <nl> <nl> + / / Display event callback <nl> + virtual void Register ( IDispResource * resource ) = 0 ; <nl> + virtual void Unregister ( IDispResource * resource ) = 0 ; <nl> + <nl> / / render loop <nl> void RegisterRenderLoop ( IRenderLoop * client ) ; <nl> void UnregisterRenderLoop ( IRenderLoop * client ) ; <nl> class CWinSystemBase <nl> void UpdateDesktopResolution ( RESOLUTION_INFO & newRes , int screen , int width , int height , float refreshRate , uint32_t dwFlags = 0 ) ; <nl> virtual std : : unique_ptr < KODI : : WINDOWING : : IOSScreenSaver > GetOSScreenSaverImpl ( ) { return nullptr ; } <nl> <nl> - WindowSystemType m_eWindowSystem ; <nl> - int m_nWidth ; <nl> - int m_nHeight ; <nl> - int m_nTop ; <nl> - int m_nLeft ; <nl> - bool m_bWindowCreated ; <nl> - bool m_bFullScreen ; <nl> - int m_nScreen ; <nl> - bool m_bBlankOtherDisplay ; <nl> - float m_fRefreshRate ; <nl> + int m_nWidth ; <nl> + int m_nHeight ; <nl> + int m_nTop ; <nl> + int m_nLeft ; <nl> + bool m_bWindowCreated ; <nl> + bool m_bFullScreen ; <nl> + int m_nScreen ; <nl> + bool m_bBlankOtherDisplay ; <nl> + float m_fRefreshRate ; <nl> std : : unique_ptr < KODI : : WINDOWING : : COSScreenSaverManager > m_screenSaverManager ; <nl> CCriticalSection m_renderLoopSection ; <nl> std : : vector < IRenderLoop * > m_renderLoopClients ; <nl> <nl> std : : unique_ptr < IWinEvents > m_winEvents ; <nl> } ; <nl> - <nl> - <nl> - # endif / / WINDOW_SYSTEM_H <nl> deleted file mode 100644 <nl> index 652959abdfc8 . . 000000000000 <nl> mmm a / xbmc / windowing / WindowingFactory . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2013 Team XBMC <nl> - * http : / / xbmc . org <nl> - * <nl> - * This Program is free software ; you can redistribute it and / or modify <nl> - * it under the terms of the GNU General Public License as published by <nl> - * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> - * any later version . <nl> - * <nl> - * This Program is distributed in the hope that it will be useful , <nl> - * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> - * GNU General Public License for more details . <nl> - * <nl> - * You should have received a copy of the GNU General Public License <nl> - * along with XBMC ; see the file COPYING . If not , see <nl> - * < http : / / www . gnu . org / licenses / > . <nl> - * <nl> - * / <nl> - <nl> - # ifndef WINDOWING_FACTORY_H <nl> - # define WINDOWING_FACTORY_H <nl> - <nl> - # include " system . h " <nl> - <nl> - # if defined ( TARGET_WINDOWS_DESKTOP ) <nl> - # include " windows / WinSystemWin32DX . h " <nl> - <nl> - # elif defined ( TARGET_WINDOWS_STORE ) <nl> - # include " win10 / WinSystemWin10DX . h " <nl> - <nl> - # elif defined ( TARGET_RASPBERRY_PI ) & & defined ( HAS_GLES ) <nl> - # include " rpi / WinSystemRpiGLESContext . h " <nl> - <nl> - # elif defined ( TARGET_LINUX ) & & defined ( HAS_LIBAMCODEC ) & & defined ( HAS_GLES ) <nl> - # include " amlogic / WinSystemAmlogicGLESContext . h " <nl> - <nl> - # elif defined ( TARGET_ANDROID ) & & defined ( HAS_GLES ) <nl> - # include " android / WinSystemAndroidGLESContext . h " <nl> - <nl> - # elif defined ( HAVE_WAYLAND ) & & defined ( HAS_GL ) <nl> - # include " wayland / WinSystemWaylandEGLContextGL . h " <nl> - <nl> - # elif defined ( HAVE_WAYLAND ) & & defined ( HAS_GLES ) <nl> - # include " wayland / WinSystemWaylandEGLContextGLES . h " <nl> - <nl> - # elif defined ( TARGET_LINUX ) & & defined ( HAVE_GBM ) & & defined ( HAS_GLES ) <nl> - # include " gbm / WinSystemGbmGLESContext . h " <nl> - <nl> - # elif defined ( TARGET_LINUX ) & & defined ( HAVE_MIR ) & & defined ( HAS_GL ) <nl> - # include " mir / WinSystemMirGLContext . h " <nl> - <nl> - # elif defined ( TARGET_LINUX ) & & defined ( HAVE_MIR ) & & defined ( HAS_GLES ) <nl> - # include " mir / WinSystemMirGLESContext . h " <nl> - <nl> - # elif defined ( TARGET_LINUX ) & & defined ( HAVE_X11 ) & & defined ( HAS_GL ) <nl> - # include " X11 / WinSystemX11GLContext . h " <nl> - <nl> - # elif defined ( TARGET_LINUX ) & & defined ( HAS_GLES ) & & defined ( HAS_EGL ) & & ! defined ( HAVE_X11 ) <nl> - # include " egl / WinSystemEGL . h " <nl> - <nl> - # elif defined ( TARGET_FREEBSD ) & & defined ( HAS_GL ) & & defined ( HAVE_X11 ) <nl> - # include " X11 / WinSystemX11GLContext . h " <nl> - <nl> - # elif defined ( TARGET_FREEBSD ) & & defined ( HAS_GLES ) & & defined ( HAS_EGL ) <nl> - # include " egl / WinSystemGLESContext . h " <nl> - <nl> - # elif defined ( TARGET_DARWIN_OSX ) <nl> - # include " osx / WinSystemOSXGL . h " <nl> - <nl> - # elif defined ( TARGET_DARWIN_IOS ) <nl> - # include " osx / WinSystemIOS . h " <nl> - <nl> - # endif <nl> - <nl> - # endif / / WINDOWING_FACTORY_H <nl> - <nl> mmm a / xbmc / windowing / X11 / VideoSyncDRM . cpp <nl> ppp b / xbmc / windowing / X11 / VideoSyncDRM . cpp <nl> <nl> # include " system . h " <nl> <nl> # include " VideoSyncDRM . h " <nl> + # include " ServiceBroker . h " <nl> # include " xf86drm . h " <nl> # include < sys / poll . h > <nl> # include < sys / time . h > <nl> # include " utils / TimeUtils . h " <nl> # include " utils / MathUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include " guilib / GraphicContext . h " <nl> # include " utils / log . h " <nl> + # include " windowing / X11 / WinSystemX11GLContext . h " <nl> <nl> static drmVBlankSeqType CrtcSel ( void ) <nl> { <nl> - int crtc = g_Windowing . GetCrtc ( ) ; <nl> + CWinSystemX11 & winSystem = dynamic_cast < CWinSystemX11 & > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> + int crtc = winSystem . GetCrtc ( ) ; <nl> int ret = 0 ; <nl> <nl> if ( crtc = = 1 ) <nl> bool CVideoSyncDRM : : Setup ( PUPDATECLOCK func ) <nl> } <nl> <nl> m_abort = false ; <nl> - g_Windowing . Register ( this ) ; <nl> + m_winSystem . Register ( this ) ; <nl> <nl> return true ; <nl> } <nl> void CVideoSyncDRM : : Run ( CEvent & stopEvent ) <nl> void CVideoSyncDRM : : Cleanup ( ) <nl> { <nl> close ( m_fd ) ; <nl> - g_Windowing . Unregister ( this ) ; <nl> + m_winSystem . Unregister ( this ) ; <nl> } <nl> <nl> void CVideoSyncDRM : : EventHandler ( int fd , unsigned int frame , unsigned int sec , <nl> mmm a / xbmc / windowing / X11 / VideoSyncDRM . h <nl> ppp b / xbmc / windowing / X11 / VideoSyncDRM . h <nl> <nl> # include " windowing / VideoSync . h " <nl> # include " guilib / DispResource . h " <nl> <nl> + class CWinSystemX11GLContext ; <nl> + <nl> class CVideoSyncDRM : public CVideoSync , IDispResource <nl> { <nl> public : <nl> - explicit CVideoSyncDRM ( void * clock ) : CVideoSync ( clock ) { } ; <nl> + explicit CVideoSyncDRM ( void * clock , CWinSystemX11GLContext & winSystem ) : <nl> + CVideoSync ( clock ) , m_winSystem ( winSystem ) { } ; <nl> bool Setup ( PUPDATECLOCK func ) override ; <nl> void Run ( CEvent & stopEvent ) override ; <nl> void Cleanup ( ) override ; <nl> class CVideoSyncDRM : public CVideoSync , IDispResource <nl> uint64_t start ; <nl> CVideoSyncDRM * videoSync ; <nl> } ; <nl> + CWinSystemX11GLContext & m_winSystem ; <nl> } ; <nl> <nl> mmm a / xbmc / windowing / X11 / VideoSyncGLX . cpp <nl> ppp b / xbmc / windowing / X11 / VideoSyncGLX . cpp <nl> <nl> # include " VideoSyncGLX . h " <nl> # include < sstream > <nl> # include < X11 / extensions / Xrandr . h > <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / X11 / WinSystemX11GLContext . h " <nl> # include " guilib / GraphicContext . h " <nl> # include " threads / SingleLock . h " <nl> # include " utils / log . h " <nl> bool CVideoSyncGLX : : Setup ( PUPDATECLOCK func ) <nl> <nl> CLog : : Log ( LOGDEBUG , " CVideoReferenceClock : Setting up GLX " ) ; <nl> <nl> - g_Windowing . Register ( this ) ; <nl> + m_winSystem . Register ( this ) ; <nl> <nl> m_displayLost = false ; <nl> m_displayReset = false ; <nl> bool CVideoSyncGLX : : Setup ( PUPDATECLOCK func ) <nl> } <nl> <nl> bool ExtensionFound = false ; <nl> - std : : istringstream Extensions ( glXQueryExtensionsString ( m_Dpy , g_Windowing . GetCurrentScreen ( ) ) ) ; <nl> + std : : istringstream Extensions ( glXQueryExtensionsString ( m_Dpy , m_winSystem . GetCurrentScreen ( ) ) ) ; <nl> std : : string ExtensionStr ; <nl> <nl> while ( ! ExtensionFound ) <nl> bool CVideoSyncGLX : : Setup ( PUPDATECLOCK func ) <nl> return false ; <nl> } <nl> <nl> - m_vInfo = glXChooseVisual ( m_Dpy , g_Windowing . GetCurrentScreen ( ) , singleBufferAttributes ) ; <nl> + m_vInfo = glXChooseVisual ( m_Dpy , m_winSystem . GetCurrentScreen ( ) , singleBufferAttributes ) ; <nl> if ( ! m_vInfo ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " CVideoReferenceClock : glXChooseVisual returned NULL " ) ; <nl> bool CVideoSyncGLX : : Setup ( PUPDATECLOCK func ) <nl> <nl> Swa . border_pixel = 0 ; <nl> Swa . event_mask = StructureNotifyMask ; <nl> - Swa . colormap = XCreateColormap ( m_Dpy , g_Windowing . GetWindow ( ) , m_vInfo - > visual , AllocNone ) ; <nl> + Swa . colormap = XCreateColormap ( m_Dpy , m_winSystem . GetWindow ( ) , m_vInfo - > visual , AllocNone ) ; <nl> SwaMask = CWBorderPixel | CWColormap | CWEventMask ; <nl> <nl> - m_Window = XCreateWindow ( m_Dpy , g_Windowing . GetWindow ( ) , 0 , 0 , 256 , 256 , 0 , <nl> + m_Window = XCreateWindow ( m_Dpy , m_winSystem . GetWindow ( ) , 0 , 0 , 256 , 256 , 0 , <nl> m_vInfo - > depth , InputOutput , m_vInfo - > visual , SwaMask , & Swa ) ; <nl> <nl> m_Context = glXCreateContext ( m_Dpy , m_vInfo , NULL , True ) ; <nl> void CVideoSyncGLX : : Cleanup ( ) <nl> } <nl> <nl> m_lostEvent . Set ( ) ; <nl> - g_Windowing . Unregister ( this ) ; <nl> + m_winSystem . Unregister ( this ) ; <nl> } <nl> <nl> float CVideoSyncGLX : : GetFps ( ) <nl> mmm a / xbmc / windowing / X11 / VideoSyncGLX . h <nl> ppp b / xbmc / windowing / X11 / VideoSyncGLX . h <nl> <nl> # include " guilib / DispResource . h " <nl> # include " threads / Event . h " <nl> <nl> + class CWinSystemX11GLContext ; <nl> + <nl> class CVideoSyncGLX : public CVideoSync , IDispResource <nl> { <nl> public : <nl> - explicit CVideoSyncGLX ( void * clock ) : CVideoSync ( clock ) { } ; <nl> + explicit CVideoSyncGLX ( void * clock , CWinSystemX11GLContext & winSystem ) : <nl> + CVideoSync ( clock ) , m_winSystem ( winSystem ) { } ; <nl> bool Setup ( PUPDATECLOCK func ) override ; <nl> void Run ( CEvent & stopEvent ) override ; <nl> void Cleanup ( ) override ; <nl> class CVideoSyncGLX : public CVideoSync , IDispResource <nl> int ( * m_glXGetVideoSyncSGI ) ( unsigned int * ) ; <nl> <nl> static Display * m_Dpy ; <nl> + CWinSystemX11GLContext & m_winSystem ; <nl> XVisualInfo * m_vInfo ; <nl> Window m_Window ; <nl> GLXContext m_Context ; <nl> mmm a / xbmc / windowing / X11 / WinEventsX11 . cpp <nl> ppp b / xbmc / windowing / X11 / WinEventsX11 . cpp <nl> <nl> <nl> # include " system . h " <nl> <nl> - # ifdef HAS_X11_WIN_EVENTS <nl> - <nl> # include " xbmc / windowing / WinEvents . h " <nl> # include " WinEventsX11 . h " <nl> # include " Application . h " <nl> # include " messaging / ApplicationMessenger . h " <nl> # include < X11 / Xlib . h > <nl> # include < X11 / extensions / Xrandr . h > <nl> - # include " xbmc / windowing / WindowingFactory . h " <nl> + # include " xbmc / windowing / X11 / WinSystemX11 . h " <nl> # include " X11 / keysymdef . h " <nl> # include " X11 / XF86keysym . h " <nl> # include " utils / log . h " <nl> <nl> <nl> using namespace KODI : : MESSAGING ; <nl> <nl> - CWinEventsX11Imp * CWinEventsX11Imp : : WinEvents = 0 ; <nl> - <nl> static uint32_t SymMappingsX11 [ ] [ 2 ] = <nl> { <nl> { XK_BackSpace , XBMCK_BACKSPACE } <nl> static uint32_t SymMappingsX11 [ ] [ 2 ] = <nl> , { XF86XK_AudioForward , XBMCK_FASTFORWARD } <nl> } ; <nl> <nl> - bool CWinEventsX11 : : MessagePump ( ) <nl> + CWinEventsX11 : : CWinEventsX11 ( CWinSystemX11 & winSystem ) : m_winSystem ( winSystem ) <nl> { <nl> - return CWinEventsX11Imp : : MessagePump ( ) ; <nl> } <nl> <nl> - CWinEventsX11Imp : : CWinEventsX11Imp ( ) <nl> + CWinEventsX11 : : ~ CWinEventsX11 ( ) <nl> { <nl> - m_display = 0 ; <nl> - m_window = 0 ; <nl> - m_keybuf = 0 ; <nl> - m_keybuf_len = 0 ; <nl> + Quit ( ) ; <nl> } <nl> <nl> - CWinEventsX11Imp : : ~ CWinEventsX11Imp ( ) <nl> + bool CWinEventsX11 : : Init ( Display * dpy , Window win ) <nl> { <nl> - free ( m_keybuf ) ; <nl> - m_keybuf = 0 ; <nl> - <nl> - if ( m_xic ) <nl> - { <nl> - XUnsetICFocus ( m_xic ) ; <nl> - XDestroyIC ( m_xic ) ; <nl> - m_xic = 0 ; <nl> - } <nl> - <nl> - if ( m_xim ) <nl> - { <nl> - XCloseIM ( m_xim ) ; <nl> - m_xim = 0 ; <nl> - } <nl> - <nl> - m_symLookupTable . clear ( ) ; <nl> - } <nl> - <nl> - bool CWinEventsX11Imp : : Init ( Display * dpy , Window win ) <nl> - { <nl> - if ( WinEvents ) <nl> + if ( m_display ) <nl> return true ; <nl> <nl> - WinEvents = new CWinEventsX11Imp ( ) ; <nl> - WinEvents - > m_display = dpy ; <nl> - WinEvents - > m_window = win ; <nl> - WinEvents - > m_keybuf_len = 32 * sizeof ( char ) ; <nl> - WinEvents - > m_keybuf = ( char * ) malloc ( WinEvents - > m_keybuf_len ) ; <nl> - WinEvents - > m_keymodState = 0 ; <nl> - WinEvents - > m_wmDeleteMessage = XInternAtom ( dpy , " WM_DELETE_WINDOW " , False ) ; <nl> - WinEvents - > m_structureChanged = false ; <nl> - WinEvents - > m_xrrEventPending = false ; <nl> + m_display = dpy ; <nl> + m_window = win ; <nl> + m_keybuf_len = 32 * sizeof ( char ) ; <nl> + m_keybuf = ( char * ) malloc ( m_keybuf_len ) ; <nl> + m_keymodState = 0 ; <nl> + m_wmDeleteMessage = XInternAtom ( dpy , " WM_DELETE_WINDOW " , False ) ; <nl> + m_structureChanged = false ; <nl> + m_xrrEventPending = false ; <nl> <nl> / / open input method <nl> char * old_locale = NULL , * old_modifiers = NULL ; <nl> bool CWinEventsX11Imp : : Init ( Display * dpy , Window win ) <nl> / / set users preferences and open input method <nl> p = setlocale ( LC_ALL , " " ) ; <nl> XSetLocaleModifiers ( " " ) ; <nl> - WinEvents - > m_xim = XOpenIM ( WinEvents - > m_display , NULL , res_name , res_name ) ; <nl> + m_xim = XOpenIM ( m_display , NULL , res_name , res_name ) ; <nl> <nl> / / restore old locale <nl> if ( old_locale ) <nl> bool CWinEventsX11Imp : : Init ( Display * dpy , Window win ) <nl> free ( old_modifiers ) ; <nl> } <nl> <nl> - WinEvents - > m_xic = NULL ; <nl> - if ( WinEvents - > m_xim ) <nl> + m_xic = NULL ; <nl> + if ( m_xim ) <nl> { <nl> - WinEvents - > m_xic = XCreateIC ( WinEvents - > m_xim , <nl> - XNClientWindow , WinEvents - > m_window , <nl> - XNFocusWindow , WinEvents - > m_window , <nl> - XNInputStyle , XIMPreeditNothing | XIMStatusNothing , <nl> - XNResourceName , res_name , <nl> - XNResourceClass , res_name , <nl> - NULL ) ; <nl> + m_xic = XCreateIC ( m_xim , <nl> + XNClientWindow , m_window , <nl> + XNFocusWindow , m_window , <nl> + XNInputStyle , XIMPreeditNothing | XIMStatusNothing , <nl> + XNResourceName , res_name , <nl> + XNResourceClass , res_name , <nl> + nullptr ) ; <nl> } <nl> <nl> - if ( ! WinEvents - > m_xic ) <nl> + if ( ! m_xic ) <nl> CLog : : Log ( LOGWARNING , " CWinEventsX11 : : Init - no input method found " ) ; <nl> <nl> / / build Keysym lookup table <nl> for ( unsigned int i = 0 ; i < sizeof ( SymMappingsX11 ) / ( 2 * sizeof ( uint32_t ) ) ; + + i ) <nl> { <nl> - WinEvents - > m_symLookupTable [ SymMappingsX11 [ i ] [ 0 ] ] = SymMappingsX11 [ i ] [ 1 ] ; <nl> + m_symLookupTable [ SymMappingsX11 [ i ] [ 0 ] ] = SymMappingsX11 [ i ] [ 1 ] ; <nl> } <nl> <nl> / / register for xrandr events <nl> int iReturn ; <nl> - XRRQueryExtension ( WinEvents - > m_display , & WinEvents - > m_RREventBase , & iReturn ) ; <nl> - int numScreens = XScreenCount ( WinEvents - > m_display ) ; <nl> + XRRQueryExtension ( m_display , & m_RREventBase , & iReturn ) ; <nl> + int numScreens = XScreenCount ( m_display ) ; <nl> for ( int i = 0 ; i < numScreens ; i + + ) <nl> { <nl> - XRRSelectInput ( WinEvents - > m_display , RootWindow ( WinEvents - > m_display , i ) , RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask ) ; <nl> + XRRSelectInput ( m_display , RootWindow ( m_display , i ) , RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask ) ; <nl> } <nl> <nl> return true ; <nl> } <nl> <nl> - void CWinEventsX11Imp : : Quit ( ) <nl> + void CWinEventsX11 : : Quit ( ) <nl> { <nl> - if ( ! WinEvents ) <nl> - return ; <nl> + free ( m_keybuf ) ; <nl> + m_keybuf = nullptr ; <nl> + <nl> + if ( m_xic ) <nl> + { <nl> + XUnsetICFocus ( m_xic ) ; <nl> + XDestroyIC ( m_xic ) ; <nl> + m_xic = nullptr ; <nl> + } <nl> <nl> - delete WinEvents ; <nl> - WinEvents = 0 ; <nl> + if ( m_xim ) <nl> + { <nl> + XCloseIM ( m_xim ) ; <nl> + m_xim = nullptr ; <nl> + } <nl> + <nl> + m_symLookupTable . clear ( ) ; <nl> + <nl> + m_display = nullptr ; <nl> } <nl> <nl> - bool CWinEventsX11Imp : : HasStructureChanged ( ) <nl> + bool CWinEventsX11 : : HasStructureChanged ( ) <nl> { <nl> - if ( ! WinEvents ) <nl> + if ( ! m_display ) <nl> return false ; <nl> <nl> - bool ret = WinEvents - > m_structureChanged ; <nl> - WinEvents - > m_structureChanged = false ; <nl> + bool ret = m_structureChanged ; <nl> + m_structureChanged = false ; <nl> return ret ; <nl> } <nl> <nl> - void CWinEventsX11Imp : : SetXRRFailSafeTimer ( int millis ) <nl> + void CWinEventsX11 : : SetXRRFailSafeTimer ( int millis ) <nl> { <nl> - if ( ! WinEvents ) <nl> + if ( ! m_display ) <nl> return ; <nl> <nl> - WinEvents - > m_xrrFailSafeTimer . Set ( millis ) ; <nl> - WinEvents - > m_xrrEventPending = true ; <nl> + m_xrrFailSafeTimer . Set ( millis ) ; <nl> + m_xrrEventPending = true ; <nl> } <nl> <nl> - bool CWinEventsX11Imp : : MessagePump ( ) <nl> + bool CWinEventsX11 : : MessagePump ( ) <nl> { <nl> - if ( ! WinEvents ) <nl> + if ( ! m_display ) <nl> return false ; <nl> <nl> bool ret = false ; <nl> XEvent xevent ; <nl> unsigned long serial = 0 ; <nl> <nl> - while ( WinEvents & & XPending ( WinEvents - > m_display ) ) <nl> + while ( m_display & & XPending ( m_display ) ) <nl> { <nl> memset ( & xevent , 0 , sizeof ( XEvent ) ) ; <nl> - XNextEvent ( WinEvents - > m_display , & xevent ) ; <nl> + XNextEvent ( m_display , & xevent ) ; <nl> <nl> - if ( WinEvents & & ( xevent . type = = WinEvents - > m_RREventBase + RRScreenChangeNotify ) ) <nl> + if ( m_display & & ( xevent . type = = m_RREventBase + RRScreenChangeNotify ) ) <nl> { <nl> XRRUpdateConfiguration ( & xevent ) ; <nl> if ( xevent . xgeneric . serial ! = serial ) <nl> - g_Windowing . NotifyXRREvent ( ) ; <nl> - WinEvents - > m_xrrEventPending = false ; <nl> + m_winSystem . NotifyXRREvent ( ) ; <nl> + m_xrrEventPending = false ; <nl> serial = xevent . xgeneric . serial ; <nl> continue ; <nl> } <nl> - else if ( WinEvents & & ( xevent . type = = WinEvents - > m_RREventBase + RRNotify ) ) <nl> + else if ( m_display & & ( xevent . type = = m_RREventBase + RRNotify ) ) <nl> { <nl> if ( xevent . xgeneric . serial ! = serial ) <nl> - g_Windowing . NotifyXRREvent ( ) ; <nl> - WinEvents - > m_xrrEventPending = false ; <nl> + m_winSystem . NotifyXRREvent ( ) ; <nl> + m_xrrEventPending = false ; <nl> serial = xevent . xgeneric . serial ; <nl> continue ; <nl> } <nl> <nl> - if ( XFilterEvent ( & xevent , WinEvents - > m_window ) ) <nl> + if ( XFilterEvent ( & xevent , m_window ) ) <nl> continue ; <nl> <nl> switch ( xevent . type ) <nl> bool CWinEventsX11Imp : : MessagePump ( ) <nl> <nl> case FocusIn : <nl> { <nl> - if ( WinEvents - > m_xic ) <nl> - XSetICFocus ( WinEvents - > m_xic ) ; <nl> + if ( m_xic ) <nl> + XSetICFocus ( m_xic ) ; <nl> g_application . m_AppFocused = true ; <nl> - WinEvents - > m_keymodState = 0 ; <nl> + m_keymodState = 0 ; <nl> if ( serial = = xevent . xfocus . serial ) <nl> break ; <nl> - g_Windowing . NotifyAppFocusChange ( g_application . m_AppFocused ) ; <nl> + m_winSystem . NotifyAppFocusChange ( g_application . m_AppFocused ) ; <nl> break ; <nl> } <nl> <nl> case FocusOut : <nl> { <nl> - if ( WinEvents - > m_xic ) <nl> - XUnsetICFocus ( WinEvents - > m_xic ) ; <nl> + if ( m_xic ) <nl> + XUnsetICFocus ( m_xic ) ; <nl> g_application . m_AppFocused = false ; <nl> - g_Windowing . NotifyAppFocusChange ( g_application . m_AppFocused ) ; <nl> + m_winSystem . NotifyAppFocusChange ( g_application . m_AppFocused ) ; <nl> serial = xevent . xfocus . serial ; <nl> break ; <nl> } <nl> bool CWinEventsX11Imp : : MessagePump ( ) <nl> <nl> case ConfigureNotify : <nl> { <nl> - if ( xevent . xconfigure . window ! = WinEvents - > m_window ) <nl> + if ( xevent . xconfigure . window ! = m_window ) <nl> break ; <nl> <nl> - WinEvents - > m_structureChanged = true ; <nl> + m_structureChanged = true ; <nl> XBMC_Event newEvent ; <nl> memset ( & newEvent , 0 , sizeof ( newEvent ) ) ; <nl> newEvent . type = XBMC_VIDEORESIZE ; <nl> bool CWinEventsX11Imp : : MessagePump ( ) <nl> <nl> case ClientMessage : <nl> { <nl> - if ( ( unsigned int ) xevent . xclient . data . l [ 0 ] = = WinEvents - > m_wmDeleteMessage ) <nl> + if ( ( unsigned int ) xevent . xclient . data . l [ 0 ] = = m_wmDeleteMessage ) <nl> if ( ! g_application . m_bStop ) CApplicationMessenger : : GetInstance ( ) . PostMsg ( TMSG_QUIT ) ; <nl> break ; <nl> } <nl> bool CWinEventsX11Imp : : MessagePump ( ) <nl> KeySym xkeysym ; <nl> <nl> / / fallback if we have no IM <nl> - if ( ! WinEvents - > m_xic ) <nl> + if ( ! m_xic ) <nl> { <nl> static XComposeStatus state ; <nl> char keybuf [ 32 ] ; <nl> bool CWinEventsX11Imp : : MessagePump ( ) <nl> <nl> Status status ; <nl> int len ; <nl> - len = Xutf8LookupString ( WinEvents - > m_xic , & xevent . xkey , <nl> - WinEvents - > m_keybuf , WinEvents - > m_keybuf_len , <nl> + len = Xutf8LookupString ( m_xic , & xevent . xkey , <nl> + m_keybuf , m_keybuf_len , <nl> & xkeysym , & status ) ; <nl> if ( status = = XBufferOverflow ) <nl> { <nl> - WinEvents - > m_keybuf_len = len ; <nl> - WinEvents - > m_keybuf = ( char * ) realloc ( WinEvents - > m_keybuf , WinEvents - > m_keybuf_len ) ; <nl> - len = Xutf8LookupString ( WinEvents - > m_xic , & xevent . xkey , <nl> - WinEvents - > m_keybuf , WinEvents - > m_keybuf_len , <nl> + m_keybuf_len = len ; <nl> + m_keybuf = ( char * ) realloc ( m_keybuf , m_keybuf_len ) ; <nl> + len = Xutf8LookupString ( m_xic , & xevent . xkey , <nl> + m_keybuf , m_keybuf_len , <nl> & xkeysym , & status ) ; <nl> } <nl> switch ( status ) <nl> bool CWinEventsX11Imp : : MessagePump ( ) <nl> case XLookupChars : <nl> case XLookupBoth : <nl> { <nl> - std : : string data ( WinEvents - > m_keybuf , len ) ; <nl> + std : : string data ( m_keybuf , len ) ; <nl> std : : wstring keys ; <nl> g_charsetConverter . utf8ToW ( data , keys , false ) ; <nl> <nl> bool CWinEventsX11Imp : : MessagePump ( ) <nl> case KeyRelease : <nl> { <nl> / / if we have a queued press directly after , this is a repeat <nl> - if ( XEventsQueued ( WinEvents - > m_display , QueuedAfterReading ) ) <nl> + if ( XEventsQueued ( m_display , QueuedAfterReading ) ) <nl> { <nl> XEvent next_event ; <nl> - XPeekEvent ( WinEvents - > m_display , & next_event ) ; <nl> - if ( next_event . type = = KeyPress <nl> - & & next_event . xkey . window = = xevent . xkey . window <nl> - & & next_event . xkey . keycode = = xevent . xkey . keycode <nl> - & & ( next_event . xkey . time - xevent . xkey . time < 2 ) ) <nl> + XPeekEvent ( m_display , & next_event ) ; <nl> + if ( next_event . type = = KeyPress & & <nl> + next_event . xkey . window = = xevent . xkey . window & & <nl> + next_event . xkey . keycode = = xevent . xkey . keycode & & <nl> + ( next_event . xkey . time - xevent . xkey . time < 2 ) ) <nl> continue ; <nl> } <nl> <nl> bool CWinEventsX11Imp : : MessagePump ( ) <nl> <nl> case MotionNotify : <nl> { <nl> - if ( xevent . xmotion . window ! = WinEvents - > m_window ) <nl> + if ( xevent . xmotion . window ! = m_window ) <nl> break ; <nl> XBMC_Event newEvent ; <nl> memset ( & newEvent , 0 , sizeof ( newEvent ) ) ; <nl> bool CWinEventsX11Imp : : MessagePump ( ) <nl> } / / switch event . type <nl> } / / while <nl> <nl> - if ( WinEvents & & WinEvents - > m_xrrEventPending & & WinEvents - > m_xrrFailSafeTimer . IsTimePast ( ) ) <nl> + if ( m_display & & m_xrrEventPending & & m_xrrFailSafeTimer . IsTimePast ( ) ) <nl> { <nl> CLog : : Log ( LOGERROR , " CWinEventsX11 : : MessagePump - missed XRR Events " ) ; <nl> - g_Windowing . NotifyXRREvent ( ) ; <nl> - WinEvents - > m_xrrEventPending = false ; <nl> + m_winSystem . NotifyXRREvent ( ) ; <nl> + m_xrrEventPending = false ; <nl> } <nl> <nl> return ret ; <nl> } <nl> <nl> - bool CWinEventsX11Imp : : ProcessKey ( XBMC_Event & event ) <nl> + bool CWinEventsX11 : : ProcessKey ( XBMC_Event & event ) <nl> { <nl> if ( event . type = = XBMC_KEYDOWN ) <nl> { <nl> bool CWinEventsX11Imp : : ProcessKey ( XBMC_Event & event ) <nl> switch ( event . key . keysym . sym ) <nl> { <nl> case XBMCK_LSHIFT : <nl> - WinEvents - > m_keymodState | = XBMCKMOD_LSHIFT ; <nl> + m_keymodState | = XBMCKMOD_LSHIFT ; <nl> break ; <nl> case XBMCK_RSHIFT : <nl> - WinEvents - > m_keymodState | = XBMCKMOD_RSHIFT ; <nl> + m_keymodState | = XBMCKMOD_RSHIFT ; <nl> break ; <nl> case XBMCK_LCTRL : <nl> - WinEvents - > m_keymodState | = XBMCKMOD_LCTRL ; <nl> + m_keymodState | = XBMCKMOD_LCTRL ; <nl> break ; <nl> case XBMCK_RCTRL : <nl> - WinEvents - > m_keymodState | = XBMCKMOD_RCTRL ; <nl> + m_keymodState | = XBMCKMOD_RCTRL ; <nl> break ; <nl> case XBMCK_LALT : <nl> - WinEvents - > m_keymodState | = XBMCKMOD_LALT ; <nl> + m_keymodState | = XBMCKMOD_LALT ; <nl> break ; <nl> case XBMCK_RALT : <nl> - WinEvents - > m_keymodState | = XBMCKMOD_RCTRL ; <nl> + m_keymodState | = XBMCKMOD_RCTRL ; <nl> break ; <nl> case XBMCK_LMETA : <nl> - WinEvents - > m_keymodState | = XBMCKMOD_LMETA ; <nl> + m_keymodState | = XBMCKMOD_LMETA ; <nl> break ; <nl> case XBMCK_RMETA : <nl> - WinEvents - > m_keymodState | = XBMCKMOD_RMETA ; <nl> + m_keymodState | = XBMCKMOD_RMETA ; <nl> break ; <nl> case XBMCK_MODE : <nl> - WinEvents - > m_keymodState | = XBMCKMOD_MODE ; <nl> + m_keymodState | = XBMCKMOD_MODE ; <nl> break ; <nl> default : <nl> break ; <nl> } <nl> - event . key . keysym . mod = ( XBMCMod ) WinEvents - > m_keymodState ; <nl> + event . key . keysym . mod = ( XBMCMod ) m_keymodState ; <nl> } <nl> else if ( event . type = = XBMC_KEYUP ) <nl> { <nl> switch ( event . key . keysym . sym ) <nl> { <nl> case XBMCK_LSHIFT : <nl> - WinEvents - > m_keymodState & = ~ XBMCKMOD_LSHIFT ; <nl> + m_keymodState & = ~ XBMCKMOD_LSHIFT ; <nl> break ; <nl> case XBMCK_RSHIFT : <nl> - WinEvents - > m_keymodState & = ~ XBMCKMOD_RSHIFT ; <nl> + m_keymodState & = ~ XBMCKMOD_RSHIFT ; <nl> break ; <nl> case XBMCK_LCTRL : <nl> - WinEvents - > m_keymodState & = ~ XBMCKMOD_LCTRL ; <nl> + m_keymodState & = ~ XBMCKMOD_LCTRL ; <nl> break ; <nl> case XBMCK_RCTRL : <nl> - WinEvents - > m_keymodState & = ~ XBMCKMOD_RCTRL ; <nl> + m_keymodState & = ~ XBMCKMOD_RCTRL ; <nl> break ; <nl> case XBMCK_LALT : <nl> - WinEvents - > m_keymodState & = ~ XBMCKMOD_LALT ; <nl> + m_keymodState & = ~ XBMCKMOD_LALT ; <nl> break ; <nl> case XBMCK_RALT : <nl> - WinEvents - > m_keymodState & = ~ XBMCKMOD_RCTRL ; <nl> + m_keymodState & = ~ XBMCKMOD_RCTRL ; <nl> break ; <nl> case XBMCK_LMETA : <nl> - WinEvents - > m_keymodState & = ~ XBMCKMOD_LMETA ; <nl> + m_keymodState & = ~ XBMCKMOD_LMETA ; <nl> break ; <nl> case XBMCK_RMETA : <nl> - WinEvents - > m_keymodState & = ~ XBMCKMOD_RMETA ; <nl> + m_keymodState & = ~ XBMCKMOD_RMETA ; <nl> break ; <nl> case XBMCK_MODE : <nl> - WinEvents - > m_keymodState & = ~ XBMCKMOD_MODE ; <nl> + m_keymodState & = ~ XBMCKMOD_MODE ; <nl> break ; <nl> default : <nl> break ; <nl> } <nl> - event . key . keysym . mod = ( XBMCMod ) WinEvents - > m_keymodState ; <nl> + event . key . keysym . mod = ( XBMCMod ) m_keymodState ; <nl> } <nl> <nl> return g_application . OnEvent ( event ) ; <nl> } <nl> <nl> - XBMCKey CWinEventsX11Imp : : LookupXbmcKeySym ( KeySym keysym ) <nl> + XBMCKey CWinEventsX11 : : LookupXbmcKeySym ( KeySym keysym ) <nl> { <nl> / / try direct mapping first <nl> std : : map < uint32_t , uint32_t > : : iterator it ; <nl> - it = WinEvents - > m_symLookupTable . find ( keysym ) ; <nl> - if ( it ! = WinEvents - > m_symLookupTable . end ( ) ) <nl> + it = m_symLookupTable . find ( keysym ) ; <nl> + if ( it ! = m_symLookupTable . end ( ) ) <nl> { <nl> return ( XBMCKey ) ( it - > second ) ; <nl> } <nl> XBMCKey CWinEventsX11Imp : : LookupXbmcKeySym ( KeySym keysym ) <nl> <nl> return ( XBMCKey ) keysym ; <nl> } <nl> - # endif <nl> mmm a / xbmc / windowing / X11 / WinEventsX11 . h <nl> ppp b / xbmc / windowing / X11 / WinEventsX11 . h <nl> <nl> # pragma once <nl> <nl> # include " xbmc / windowing / WinEvents . h " <nl> + # include " xbmc / windowing / X11 / WinSystemX11 . h " <nl> # include < X11 / Xlib . h > <nl> # include " threads / SystemClock . h " <nl> <nl> <nl> class CWinEventsX11 : public IWinEvents <nl> { <nl> public : <nl> + CWinEventsX11 ( CWinSystemX11 & winSystem ) ; <nl> + virtual ~ CWinEventsX11 ( ) ; <nl> bool MessagePump ( ) override ; <nl> - } ; <nl> - <nl> - class CWinEventsX11Imp <nl> - { <nl> - public : <nl> - CWinEventsX11Imp ( ) ; <nl> - virtual ~ CWinEventsX11Imp ( ) ; <nl> - static bool Init ( Display * dpy , Window win ) ; <nl> - static void Quit ( ) ; <nl> - static bool HasStructureChanged ( ) ; <nl> - static void PendingResize ( int width , int height ) ; <nl> - static void SetXRRFailSafeTimer ( int millis ) ; <nl> - static bool MessagePump ( ) ; <nl> + bool Init ( Display * dpy , Window win ) ; <nl> + void Quit ( ) ; <nl> + bool HasStructureChanged ( ) ; <nl> + void PendingResize ( int width , int height ) ; <nl> + void SetXRRFailSafeTimer ( int millis ) ; <nl> <nl> protected : <nl> - static XBMCKey LookupXbmcKeySym ( KeySym keysym ) ; <nl> - static bool ProcessKey ( XBMC_Event & event ) ; <nl> - static CWinEventsX11Imp * WinEvents ; <nl> - Display * m_display ; <nl> - Window m_window ; <nl> + XBMCKey LookupXbmcKeySym ( KeySym keysym ) ; <nl> + bool ProcessKey ( XBMC_Event & event ) ; <nl> + Display * m_display = nullptr ; <nl> + Window m_window = 0 ; <nl> Atom m_wmDeleteMessage ; <nl> - char * m_keybuf ; <nl> - size_t m_keybuf_len ; <nl> - XIM m_xim ; <nl> - XIC m_xic ; <nl> + char * m_keybuf = nullptr ; <nl> + size_t m_keybuf_len = 0 ; <nl> + XIM m_xim = nullptr ; <nl> + XIC m_xic = nullptr ; <nl> std : : map < uint32_t , uint32_t > m_symLookupTable ; <nl> int m_keymodState ; <nl> bool m_structureChanged ; <nl> int m_RREventBase ; <nl> XbmcThreads : : EndTime m_xrrFailSafeTimer ; <nl> bool m_xrrEventPending ; <nl> + CWinSystemX11 & m_winSystem ; <nl> } ; <nl> mmm a / xbmc / windowing / X11 / WinSystemX11 . cpp <nl> ppp b / xbmc / windowing / X11 / WinSystemX11 . cpp <nl> <nl> # include " threads / SingleLock . h " <nl> # include " utils / TimeUtils . h " <nl> # include " utils / StringUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include " CompileInfo . h " <nl> # include " messaging / ApplicationMessenger . h " <nl> # include < X11 / Xatom . h > <nl> using namespace KODI : : WINDOWING ; <nl> <nl> CWinSystemX11 : : CWinSystemX11 ( ) : CWinSystemBase ( ) <nl> { <nl> - m_eWindowSystem = WINDOW_SYSTEM_X11 ; <nl> m_dpy = NULL ; <nl> m_glWindow = 0 ; <nl> m_mainWindow = 0 ; <nl> CWinSystemX11 : : CWinSystemX11 ( ) : CWinSystemBase ( ) <nl> <nl> XSetErrorHandler ( XErrorHandler ) ; <nl> <nl> - m_winEvents . reset ( new CWinEventsX11 ( ) ) ; <nl> + m_winEventsX11 = new CWinEventsX11 ( * this ) ; <nl> + m_winEvents . reset ( m_winEventsX11 ) ; <nl> } <nl> <nl> CWinSystemX11 : : ~ CWinSystemX11 ( ) = default ; <nl> bool CWinSystemX11 : : DestroyWindow ( ) <nl> m_invisibleCursor = 0 ; <nl> } <nl> <nl> - CWinEventsX11Imp : : Quit ( ) ; <nl> + m_winEventsX11 - > Quit ( ) ; <nl> <nl> XUnmapWindow ( m_dpy , m_mainWindow ) ; <nl> XDestroyWindow ( m_dpy , m_glWindow ) ; <nl> bool CWinSystemX11 : : ResizeWindow ( int newWidth , int newHeight , int newLeft , int n <nl> m_bFullScreen = false ; <nl> m_currentOutput = m_userOutput ; <nl> <nl> - return false ; <nl> + return true ; <nl> } <nl> <nl> bool CWinSystemX11 : : SetFullScreen ( bool fullScreen , RESOLUTION_INFO & res , bool blankOtherDisplays ) <nl> void CWinSystemX11 : : OnLostDevice ( ) <nl> ( * i ) - > OnLostDisplay ( ) ; <nl> } <nl> <nl> - CWinEventsX11Imp : : SetXRRFailSafeTimer ( 3000 ) ; <nl> + m_winEventsX11 - > SetXRRFailSafeTimer ( 3000 ) ; <nl> } <nl> <nl> void CWinSystemX11 : : Register ( IDispResource * resource ) <nl> bool CWinSystemX11 : : SetWindow ( int width , int height , bool fullscreen , const std : <nl> XFree ( vi ) ; <nl> <nl> / / init X11 events <nl> - CWinEventsX11Imp : : Init ( m_dpy , m_mainWindow ) ; <nl> + m_winEventsX11 - > Init ( m_dpy , m_mainWindow ) ; <nl> <nl> changeWindow = true ; <nl> changeSize = true ; <nl> } <nl> <nl> - if ( ! CWinEventsX11Imp : : HasStructureChanged ( ) & & ( ( width ! = m_nWidth ) | | ( height ! = m_nHeight ) ) ) <nl> + if ( ! m_winEventsX11 - > HasStructureChanged ( ) & & ( ( width ! = m_nWidth ) | | ( height ! = m_nHeight ) ) ) <nl> { <nl> changeSize = true ; <nl> } <nl> mmm a / xbmc / windowing / X11 / WinSystemX11 . h <nl> ppp b / xbmc / windowing / X11 / WinSystemX11 . h <nl> <nl> # include " X11 / Xutil . h " <nl> <nl> class IDispResource ; <nl> + class CWinEventsX11 ; <nl> <nl> class CWinSystemX11 : public CWinSystemBase <nl> { <nl> class CWinSystemX11 : public CWinSystemBase <nl> bool m_bIsInternalXrr ; <nl> int m_MouseX , m_MouseY ; <nl> int m_crtc ; <nl> + CWinEventsX11 * m_winEventsX11 ; <nl> <nl> private : <nl> bool IsSuitableVisual ( XVisualInfo * vInfo ) ; <nl> mmm a / xbmc / windowing / X11 / WinSystemX11GLContext . cpp <nl> ppp b / xbmc / windowing / X11 / WinSystemX11GLContext . cpp <nl> <nl> <nl> using namespace KODI ; <nl> <nl> + std : : unique_ptr < CWinSystemBase > CWinSystemBase : : CreateWinSystem ( ) <nl> + { <nl> + std : : unique_ptr < CWinSystemBase > winSystem ( new CWinSystemX11GLContext ( ) ) ; <nl> + return winSystem ; <nl> + } <nl> + <nl> CWinSystemX11GLContext : : CWinSystemX11GLContext ( ) = default ; <nl> <nl> CWinSystemX11GLContext : : ~ CWinSystemX11GLContext ( ) <nl> XVisualInfo * CWinSystemX11GLContext : : GetVisual ( ) <nl> # include < va / va_x11 . h > <nl> # include " cores / VideoPlayer / DVDCodecs / Video / VAAPI . h " <nl> # include " cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGL . h " <nl> + <nl> + class CVaapiProxy : public VAAPI : : IVaapiWinSystem <nl> + { <nl> + public : <nl> + CVaapiProxy ( CWinSystemX11GLContext & winSystem ) : m_winSystem ( winSystem ) { } ; <nl> + VADisplay GetVADisplay ( ) override { return m_winSystem . GetVaDisplay ( ) ; } ; <nl> + void * GetEGLDisplay ( ) override { return m_winSystem . GetEGLDisplay ( ) ; } ; <nl> + protected : <nl> + CWinSystemX11GLContext & m_winSystem ; <nl> + } ; <nl> + # else <nl> + class CVaapiProxy <nl> + { <nl> + } ; <nl> # endif <nl> + <nl> # if defined ( HAVE_LIBVDPAU ) <nl> # include " cores / VideoPlayer / DVDCodecs / Video / VDPAU . h " <nl> # include " cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVDPAU . h " <nl> bool CWinSystemX11GLContext : : RefreshGLContext ( bool force ) <nl> if ( gpuvendor . compare ( 0 , 5 , " intel " ) = = 0 ) <nl> { <nl> # if defined ( HAVE_LIBVA ) <nl> + m_vaapiProxy . reset ( new CVaapiProxy ( * this ) ) ; <nl> EGLDisplay eglDpy = static_cast < CGLContextEGL * > ( m_pGLContext ) - > m_eglDisplay ; <nl> VADisplay vaDpy = GetVaDisplay ( ) ; <nl> bool general , hevc ; <nl> - CRendererVAAPI : : Register ( vaDpy , eglDpy , general , hevc ) ; <nl> + CRendererVAAPI : : Register ( m_vaapiProxy . get ( ) , vaDpy , eglDpy , general , hevc ) ; <nl> if ( general ) <nl> - VAAPI : : CDecoder : : Register ( hevc ) ; <nl> + VAAPI : : CDecoder : : Register ( m_vaapiProxy . get ( ) , hevc ) ; <nl> # endif <nl> return success ; <nl> } <nl> std : : unique_ptr < CVideoSync > CWinSystemX11GLContext : : GetVideoSync ( void * clock ) <nl> <nl> if ( dynamic_cast < CGLContextEGL * > ( m_pGLContext ) ) <nl> { <nl> - pVSync . reset ( new CVideoSyncDRM ( clock ) ) ; <nl> + pVSync . reset ( new CVideoSyncDRM ( clock , * this ) ) ; <nl> } <nl> # ifdef HAS_GLX <nl> else if ( dynamic_cast < CGLContextGLX * > ( m_pGLContext ) ) <nl> { <nl> - pVSync . reset ( new CVideoSyncGLX ( clock ) ) ; <nl> + pVSync . reset ( new CVideoSyncGLX ( clock , * this ) ) ; <nl> } <nl> # endif / / HAS_GLX <nl> return pVSync ; <nl> mmm a / xbmc / windowing / X11 / WinSystemX11GLContext . h <nl> ppp b / xbmc / windowing / X11 / WinSystemX11GLContext . h <nl> <nl> <nl> # include " EGL / egl . h " <nl> # include " rendering / gl / RenderSystemGL . h " <nl> - # include " utils / GlobalsHandling . h " <nl> + # include < memory > <nl> <nl> class CGLContext ; <nl> + class CVaapiProxy ; <nl> <nl> class CWinSystemX11GLContext : public CWinSystemX11 , public CRenderSystemGL <nl> { <nl> class CWinSystemX11GLContext : public CWinSystemX11 , public CRenderSystemGL <nl> <nl> CGLContext * m_pGLContext = nullptr ; <nl> bool m_newGlContext ; <nl> + std : : unique_ptr < CVaapiProxy > m_vaapiProxy ; <nl> } ; <nl> - <nl> - XBMC_GLOBAL_REF ( CWinSystemX11GLContext , g_Windowing ) ; <nl> - # define g_Windowing XBMC_GLOBAL_USE ( CWinSystemX11GLContext ) <nl> mmm a / xbmc / windowing / osx / VideoSyncIos . cpp <nl> ppp b / xbmc / windowing / osx / VideoSyncIos . cpp <nl> <nl> <nl> # include " system . h " <nl> <nl> - # if defined ( TARGET_DARWIN_IOS ) <nl> # include " utils / log . h " <nl> # include " VideoSyncIos . h " <nl> # include " utils / MathUtils . h " <nl> # include " cores / VideoPlayer / VideoReferenceClock . h " <nl> # include " guilib / GraphicContext . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / osx / WinSystemIOS . h " <nl> # include " utils / TimeUtils . h " <nl> <nl> bool CVideoSyncIos : : Setup ( PUPDATECLOCK func ) <nl> bool CVideoSyncIos : : Setup ( PUPDATECLOCK func ) <nl> bool setupOk = InitDisplayLink ( ) ; <nl> if ( setupOk ) <nl> { <nl> - g_Windowing . Register ( this ) ; <nl> + m_winSystem . Register ( this ) ; <nl> } <nl> <nl> return setupOk ; <nl> void CVideoSyncIos : : Cleanup ( ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " CVideoSyncIos : : % s cleaning up OSX " , __FUNCTION__ ) ; <nl> DeinitDisplayLink ( ) ; <nl> - g_Windowing . Unregister ( this ) ; <nl> + m_winSystem . Unregister ( this ) ; <nl> } <nl> <nl> float CVideoSyncIos : : GetFps ( ) <nl> bool CVideoSyncIos : : InitDisplayLink ( ) <nl> { <nl> bool ret = true ; <nl> CLog : : Log ( LOGDEBUG , " CVideoSyncIos : setting up displaylink " ) ; <nl> - if ( ! g_Windowing . InitDisplayLink ( this ) ) <nl> + if ( ! m_winSystem . InitDisplayLink ( this ) ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " CVideoSyncIos : InitDisplayLink failed " ) ; <nl> ret = false ; <nl> bool CVideoSyncIos : : InitDisplayLink ( ) <nl> <nl> void CVideoSyncIos : : DeinitDisplayLink ( ) <nl> { <nl> - g_Windowing . DeinitDisplayLink ( ) ; <nl> + m_winSystem . DeinitDisplayLink ( ) ; <nl> } <nl> <nl> - # endif / / TARGET_DARWIN_IOS <nl> mmm a / xbmc / windowing / osx / VideoSyncIos . h <nl> ppp b / xbmc / windowing / osx / VideoSyncIos . h <nl> <nl> * <nl> * / <nl> <nl> - # if defined ( TARGET_DARWIN_IOS ) <nl> # include " windowing / VideoSync . h " <nl> # include " guilib / DispResource . h " <nl> <nl> + class CWinSystemIOS ; <nl> + <nl> class CVideoSyncIos : public CVideoSync , IDispResource <nl> { <nl> public : <nl> - CVideoSyncIos ( void * clock ) : CVideoSync ( clock ) , m_LastVBlankTime ( 0 ) { } <nl> + CVideoSyncIos ( void * clock , CWinSystemIOS & winSystem ) : <nl> + CVideoSync ( clock ) , m_winSystem ( winSystem ) { } <nl> <nl> / / CVideoSync interface <nl> virtual bool Setup ( PUPDATECLOCK func ) override ; <nl> class CVideoSyncIos : public CVideoSync , IDispResource <nl> virtual bool InitDisplayLink ( ) ; <nl> virtual void DeinitDisplayLink ( ) ; <nl> <nl> - int64_t m_LastVBlankTime ; / / timestamp of the last vblank , used for calculating how many vblanks happened <nl> + int64_t m_LastVBlankTime = 0 ; / / timestamp of the last vblank , used for calculating how many vblanks happened <nl> CEvent m_abortEvent ; <nl> + CWinSystemIOS & m_winSystem ; <nl> } ; <nl> <nl> - # endif / / TARGET_DARWIN_IOS <nl> mmm a / xbmc / windowing / osx / VideoSyncOsx . cpp <nl> ppp b / xbmc / windowing / osx / VideoSyncOsx . cpp <nl> <nl> <nl> # include " utils / log . h " <nl> # include " VideoSyncOsx . h " <nl> + # include " ServiceBroker . h " <nl> # include " utils / MathUtils . h " <nl> # include " guilib / GraphicContext . h " <nl> # include " utils / TimeUtils . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include < QuartzCore / CVDisplayLink . h > <nl> # include < CoreVideo / CVHostTime . h > <nl> # include " platform / darwin / osx / CocoaInterface . h " <nl> bool CVideoSyncOsx : : Setup ( PUPDATECLOCK func ) <nl> m_displayReset = false ; <nl> m_lostEvent . Reset ( ) ; <nl> <nl> - g_Windowing . Register ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Register ( this ) ; <nl> <nl> return true ; <nl> } <nl> void CVideoSyncOsx : : Cleanup ( ) <nl> CLog : : Log ( LOGDEBUG , " CVideoSyncOsx : : % s cleaning up OSX " , __FUNCTION__ ) ; <nl> m_lostEvent . Set ( ) ; <nl> m_LastVBlankTime = 0 ; <nl> - g_Windowing . Unregister ( this ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Unregister ( this ) ; <nl> } <nl> <nl> float CVideoSyncOsx : : GetFps ( ) <nl> mmm a / xbmc / windowing / osx / WinEventsIOS . mm <nl> ppp b / xbmc / windowing / osx / WinEventsIOS . mm <nl> <nl> # include " input / InputManager . h " <nl> # include " input / XBMC_vkeys . h " <nl> # include " Application . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include " threads / CriticalSection . h " <nl> # include " guilib / GUIWindowManager . h " <nl> # include " utils / log . h " <nl> mmm a / xbmc / windowing / osx / WinEventsSDL . cpp <nl> ppp b / xbmc / windowing / osx / WinEventsSDL . cpp <nl> <nl> <nl> # include " WinEventsSDL . h " <nl> # include " Application . h " <nl> + # include " ServiceBroker . h " <nl> # include " messaging / ApplicationMessenger . h " <nl> # include " GUIUserMessages . h " <nl> # include " settings / DisplaySettings . h " <nl> <nl> # include " input / Key . h " <nl> # include " input / InputManager . h " <nl> # include " input / MouseStat . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / WinSystem . h " <nl> # include " platform / darwin / osx / CocoaInterface . h " <nl> # include " ServiceBroker . h " <nl> <nl> bool CWinEventsSDL : : MessagePump ( ) <nl> if ( event . active . state & SDL_APPACTIVE ) <nl> { <nl> g_application . SetRenderGUI ( event . active . gain ! = 0 ) ; <nl> - g_Windowing . NotifyAppActiveChange ( g_application . GetRenderGUI ( ) ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . NotifyAppActiveChange ( g_application . GetRenderGUI ( ) ) ; <nl> } <nl> else if ( event . active . state & SDL_APPINPUTFOCUS ) <nl> { <nl> g_application . m_AppFocused = event . active . gain ! = 0 ; <nl> - g_Windowing . NotifyAppFocusChange ( g_application . m_AppFocused ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . NotifyAppFocusChange ( g_application . m_AppFocused ) ; <nl> } <nl> break ; <nl> <nl> bool CWinEventsSDL : : MessagePump ( ) <nl> / / Under newer osx versions sdl is so fucked up that it even fires resize events <nl> / / that exceed the screen size ( maybe some HiDP incompatibility in old SDL ? ) <nl> / / ensure to ignore those events because it will mess with windowed size <nl> - int RES_SCREEN = g_Windowing . DesktopResolution ( g_Windowing . GetCurrentScreen ( ) ) ; <nl> + int RES_SCREEN = CServiceBroker : : GetWinSystem ( ) . DesktopResolution ( CServiceBroker : : GetWinSystem ( ) . GetCurrentScreen ( ) ) ; <nl> if ( ( event . resize . w > CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( RES_SCREEN ) . iWidth ) | | <nl> ( event . resize . h > CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( RES_SCREEN ) . iHeight ) ) <nl> { <nl> bool CWinEventsSDL : : ProcessOSXShortcuts ( SDL_Event & event ) <nl> return true ; <nl> <nl> case SDLK_h : / / CMD - h to hide <nl> - g_Windowing . Hide ( ) ; <nl> + CServiceBroker : : GetWinSystem ( ) . Hide ( ) ; <nl> return true ; <nl> <nl> case SDLK_m : / / CMD - m to minimize <nl> mmm a / xbmc / windowing / osx / WinSystemIOS . h <nl> ppp b / xbmc / windowing / osx / WinSystemIOS . h <nl> <nl> <nl> # pragma once <nl> <nl> - # ifndef WINDOW_SYSTEM_IOSEGL_H <nl> - # define WINDOW_SYSTEM_IOSEGL_H <nl> - <nl> - # if defined ( TARGET_DARWIN_IOS ) <nl> # include < string > <nl> # include < vector > <nl> <nl> # include " windowing / WinSystem . h " <nl> # include " rendering / gles / RenderSystemGLES . h " <nl> - # include " utils / GlobalsHandling . h " <nl> # include " threads / CriticalSection . h " <nl> <nl> class IDispResource ; <nl> class CWinSystemIOS : public CWinSystemBase , public CRenderSystemGLES <nl> bool BeginRender ( ) override ; <nl> bool EndRender ( ) override ; <nl> <nl> - virtual void Register ( IDispResource * resource ) ; <nl> - virtual void Unregister ( IDispResource * resource ) ; <nl> + void Register ( IDispResource * resource ) override ; <nl> + void Unregister ( IDispResource * resource ) override ; <nl> <nl> int GetNumScreens ( ) override ; <nl> int GetCurrentScreen ( ) override ; <nl> class CWinSystemIOS : public CWinSystemBase , public CRenderSystemGLES <nl> CADisplayLinkWrapper * m_pDisplayLink ; <nl> } ; <nl> <nl> - XBMC_GLOBAL_REF ( CWinSystemIOS , g_Windowing ) ; <nl> - # define g_Windowing XBMC_GLOBAL_USE ( CWinSystemIOS ) <nl> - <nl> - # endif <nl> - <nl> - # endif / / WINDOW_SYSTEM_IOSEGL_H <nl> mmm a / xbmc / windowing / osx / WinSystemIOS . mm <nl> ppp b / xbmc / windowing / osx / WinSystemIOS . mm <nl> - ( void ) runDisplayLink ; <nl> IOSDisplayLinkCallback * callbackClass ; <nl> } ; <nl> <nl> - CWinSystemIOS : : CWinSystemIOS ( ) : CWinSystemBase ( ) <nl> + std : : unique_ptr < CWinSystemBase > CWinSystemBase : : CreateWinSystem ( ) <nl> { <nl> - m_eWindowSystem = WINDOW_SYSTEM_IOS ; <nl> + std : : unique_ptr < CWinSystemBase > winSystem ( new CWinSystemIOS ( ) ) ; <nl> + return winSystem ; <nl> + } <nl> <nl> + CWinSystemIOS : : CWinSystemIOS ( ) : CWinSystemBase ( ) <nl> + { <nl> m_iVSyncErrors = 0 ; <nl> m_bIsBackgrounded = false ; <nl> m_pDisplayLink = new CADisplayLinkWrapper ; <nl> - ( void ) runDisplayLink <nl> <nl> std : : unique_ptr < CVideoSync > CWinSystemIOS : : GetVideoSync ( void * clock ) <nl> { <nl> - std : : unique_ptr < CVideoSync > pVSync ( new CVideoSyncIos ( clock ) ) ; <nl> + std : : unique_ptr < CVideoSync > pVSync ( new CVideoSyncIos ( clock , * this ) ) ; <nl> return pVSync ; <nl> } <nl> mmm a / xbmc / windowing / osx / WinSystemOSX . h <nl> ppp b / xbmc / windowing / osx / WinSystemOSX . h <nl> <nl> * <nl> * / <nl> <nl> - # if defined ( TARGET_DARWIN_OSX ) <nl> - <nl> # include < string > <nl> # include < vector > <nl> <nl> class CWinSystemOSX : public CWinSystemBase , public ITimerCallback <nl> <nl> virtual std : : string GetClipboardText ( void ) override ; <nl> <nl> - void Register ( IDispResource * resource ) ; <nl> - void Unregister ( IDispResource * resource ) ; <nl> - <nl> + void Register ( IDispResource * resource ) override ; <nl> + void Unregister ( IDispResource * resource ) override ; <nl> + <nl> virtual int GetNumScreens ( ) override ; <nl> virtual int GetCurrentScreen ( ) override ; <nl> <nl> virtual std : : unique_ptr < CVideoSync > GetVideoSync ( void * clock ) override ; <nl> - <nl> + <nl> void WindowChangedScreen ( ) ; <nl> <nl> void AnnounceOnLostDevice ( ) ; <nl> class CWinSystemOSX : public CWinSystemBase , public ITimerCallback <nl> void HandleOnResetDevice ( ) ; <nl> void StartLostDeviceTimer ( ) ; <nl> void StopLostDeviceTimer ( ) ; <nl> - <nl> + <nl> void * GetCGLContextObj ( ) ; <nl> void * GetNSOpenGLContext ( ) ; <nl> <nl> protected : <nl> virtual std : : unique_ptr < KODI : : WINDOWING : : IOSScreenSaver > GetOSScreenSaverImpl ( ) override ; <nl> - <nl> + <nl> void HandlePossibleRefreshrateChange ( ) ; <nl> void * CreateWindowedContext ( void * shareCtx ) ; <nl> void * CreateFullScreenContext ( int screen_index , void * shareCtx ) ; <nl> void GetScreenResolution ( int * w , int * h , double * fps , int screenIdx ) ; <nl> - void EnableVSync ( bool enable ) ; <nl> + void EnableVSync ( bool enable ) ; <nl> bool SwitchToVideoMode ( int width , int height , double refreshrate , int screenIdx ) ; <nl> void FillInVideoModes ( ) ; <nl> bool FlushBuffer ( void ) ; <nl> class CWinSystemOSX : public CWinSystemBase , public ITimerCallback <nl> bool m_delayDispReset ; <nl> XbmcThreads : : EndTime m_dispResetTimer ; <nl> } ; <nl> - <nl> - # endif <nl> mmm a / xbmc / windowing / osx / WinSystemOSX . mm <nl> ppp b / xbmc / windowing / osx / WinSystemOSX . mm <nl> static void DisplayReconfigured ( CGDirectDisplayID display , <nl> winsys - > UpdateResolutions ( ) ; <nl> } <nl> <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> CWinSystemOSX : : CWinSystemOSX ( ) : CWinSystemBase ( ) , m_lostDeviceTimer ( this ) <nl> { <nl> - m_eWindowSystem = WINDOW_SYSTEM_OSX ; <nl> m_glContext = 0 ; <nl> m_SDLSurface = NULL ; <nl> m_osx_events = NULL ; <nl> mmm a / xbmc / windowing / osx / WinSystemOSXGL . h <nl> ppp b / xbmc / windowing / osx / WinSystemOSXGL . h <nl> <nl> - # ifndef WINDOW_SYSTEM_OSX_GL_H <nl> - # define WINDOW_SYSTEM_OSX_GL_H <nl> <nl> # pragma once <nl> <nl> <nl> # if ! defined ( __arm__ ) & & ! defined ( __aarch64__ ) <nl> # include " WinSystemOSX . h " <nl> # include " rendering / gl / RenderSystemGL . h " <nl> - # include " utils / GlobalsHandling . h " <nl> <nl> class CWinSystemOSXGL : public CWinSystemOSX , public CRenderSystemGL <nl> { <nl> class CWinSystemOSXGL : public CWinSystemOSX , public CRenderSystemGL <nl> virtual void SetVSyncImpl ( bool enable ) override ; <nl> } ; <nl> <nl> - XBMC_GLOBAL_REF ( CWinSystemOSXGL , g_Windowing ) ; <nl> - # define g_Windowing XBMC_GLOBAL_USE ( CWinSystemOSXGL ) <nl> - <nl> # endif <nl> - # endif / / WINDOW_SYSTEM_H <nl> + <nl> mmm a / xbmc / windowing / osx / WinSystemOSXGL . mm <nl> ppp b / xbmc / windowing / osx / WinSystemOSXGL . mm <nl> <nl> * <nl> * / <nl> <nl> - # if defined ( TARGET_DARWIN_OSX ) <nl> - <nl> # include " guilib / Texture . h " <nl> # include " WinSystemOSXGL . h " <nl> # include " rendering / gl / RenderSystemGL . h " <nl> <nl> <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + std : : unique_ptr < CWinSystemBase > CWinSystemBase : : CreateWinSystem ( ) <nl> + { <nl> + std : : unique_ptr < CWinSystemBase > winSystem ( new CWinSystemOSXGL ( ) ) ; <nl> + return winSystem ; <nl> + } <nl> + <nl> CWinSystemOSXGL : : CWinSystemOSXGL ( ) <nl> { <nl> } <nl> <nl> return true ; <nl> } <nl> <nl> - # endif <nl> mmm a / xbmc / windowing / wayland / VideoSyncWpPresentation . cpp <nl> ppp b / xbmc / windowing / wayland / VideoSyncWpPresentation . cpp <nl> <nl> # include " utils / log . h " <nl> # include " utils / TimeUtils . h " <nl> # include " settings / AdvancedSettings . h " <nl> - # include " windowing / WindowingFactory . h " <nl> + # include " windowing / wayland / WinSystemWayland . h " <nl> <nl> using namespace KODI : : WINDOWING : : WAYLAND ; <nl> using namespace std : : placeholders ; <nl> <nl> - CVideoSyncWpPresentation : : CVideoSyncWpPresentation ( void * clock ) <nl> - : CVideoSync ( clock ) <nl> + CVideoSyncWpPresentation : : CVideoSyncWpPresentation ( void * clock , CWinSystemWayland & winSystem ) <nl> + : CVideoSync ( clock ) , m_winSystem ( winSystem ) <nl> { <nl> } <nl> <nl> bool CVideoSyncWpPresentation : : Setup ( PUPDATECLOCK func ) <nl> { <nl> UpdateClock = func ; <nl> m_stopEvent . Reset ( ) ; <nl> - m_fps = g_Windowing . GetSyncOutputRefreshRate ( ) ; <nl> + m_fps = m_winSystem . GetSyncOutputRefreshRate ( ) ; <nl> <nl> return true ; <nl> } <nl> <nl> void CVideoSyncWpPresentation : : Run ( CEvent & stopEvent ) <nl> { <nl> - m_presentationHandler = g_Windowing . RegisterOnPresentationFeedback ( std : : bind ( & CVideoSyncWpPresentation : : HandlePresentation , this , _1 , _2 , _3 , _4 , _5 ) ) ; <nl> + m_presentationHandler = m_winSystem . RegisterOnPresentationFeedback ( std : : bind ( & CVideoSyncWpPresentation : : HandlePresentation , this , _1 , _2 , _3 , _4 , _5 ) ) ; <nl> <nl> XbmcThreads : : CEventGroup waitGroup { & stopEvent , & m_stopEvent } ; <nl> waitGroup . wait ( ) ; <nl> void CVideoSyncWpPresentation : : HandlePresentation ( timespec tv , std : : uint32_t ref <nl> / / FIXME use timespec instead of currenthostcounter ( ) ? Possibly difficult <nl> / / due to different clock base <nl> UpdateClock ( mscDiff , CurrentHostCounter ( ) , m_refClock ) ; <nl> - } <nl> \ No newline at end of file <nl> + } <nl> mmm a / xbmc / windowing / wayland / VideoSyncWpPresentation . h <nl> ppp b / xbmc / windowing / wayland / VideoSyncWpPresentation . h <nl> namespace WINDOWING <nl> namespace WAYLAND <nl> { <nl> <nl> + class CWinSystemWayland ; <nl> + <nl> class CVideoSyncWpPresentation : public CVideoSync <nl> { <nl> public : <nl> - explicit CVideoSyncWpPresentation ( void * clock ) ; <nl> + explicit CVideoSyncWpPresentation ( void * clock , CWinSystemWayland & winSystem ) ; <nl> <nl> float GetFps ( ) override ; <nl> bool Setup ( PUPDATECLOCK func ) override ; <nl> class CVideoSyncWpPresentation : public CVideoSync <nl> CSignalRegistration m_presentationHandler ; <nl> std : : uint64_t m_lastMsc { } ; <nl> std : : uint32_t m_syncOutputID { } ; <nl> + CWinSystemWayland & m_winSystem ; <nl> } ; <nl> <nl> } <nl> } <nl> - } <nl> \ No newline at end of file <nl> + } <nl> mmm a / xbmc / windowing / wayland / WinSystemWayland . cpp <nl> ppp b / xbmc / windowing / wayland / WinSystemWayland . cpp <nl> struct MsgBufferScale <nl> CWinSystemWayland : : CWinSystemWayland ( ) <nl> : CWinSystemBase { } , m_protocol { " WinSystemWaylandInternal " } <nl> { <nl> - m_eWindowSystem = WINDOW_SYSTEM_WAYLAND ; <nl> - <nl> m_winEvents . reset ( new CWinEventsWayland ( ) ) ; <nl> } <nl> <nl> std : : unique_ptr < CVideoSync > CWinSystemWayland : : GetVideoSync ( void * clock ) <nl> if ( m_surface & & m_presentation ) <nl> { <nl> CLog : : LogF ( LOGINFO , " Using presentation protocol for video sync " ) ; <nl> - return std : : unique_ptr < CVideoSync > ( new CVideoSyncWpPresentation ( clock ) ) ; <nl> + return std : : unique_ptr < CVideoSync > ( new CVideoSyncWpPresentation ( clock , * this ) ) ; <nl> } <nl> else <nl> { <nl> mmm a / xbmc / windowing / wayland / WinSystemWaylandEGLContextGL . cpp <nl> ppp b / xbmc / windowing / wayland / WinSystemWaylandEGLContextGL . cpp <nl> <nl> # if defined ( HAVE_LIBVA ) <nl> # include " cores / VideoPlayer / DVDCodecs / Video / VAAPI . h " <nl> # include " cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGL . h " <nl> + using namespace KODI : : WINDOWING : : WAYLAND ; <nl> + class CVaapiProxy : public VAAPI : : IVaapiWinSystem <nl> + { <nl> + public : <nl> + CVaapiProxy ( CWinSystemWaylandEGLContextGL & winSystem ) : m_winSystem ( winSystem ) { } ; <nl> + VADisplay GetVADisplay ( ) override { return m_winSystem . GetVaDisplay ( ) ; } ; <nl> + void * GetEGLDisplay ( ) override { return m_winSystem . GetEGLDisplay ( ) ; } ; <nl> + protected : <nl> + CWinSystemWaylandEGLContextGL & m_winSystem ; <nl> + } ; <nl> + # else <nl> + class CVaapiProxy <nl> + { <nl> + } ; <nl> # endif <nl> <nl> using namespace KODI : : WINDOWING : : WAYLAND ; <nl> <nl> + std : : unique_ptr < CWinSystemBase > CWinSystemBase : : CreateWinSystem ( ) <nl> + { <nl> + std : : unique_ptr < CWinSystemBase > winSystem ( new CWinSystemWaylandEGLContextGL ( ) ) ; <nl> + return winSystem ; <nl> + } <nl> + <nl> bool CWinSystemWaylandEGLContextGL : : InitWindowSystem ( ) <nl> { <nl> if ( ! CWinSystemWaylandEGLContext : : InitWindowSystemEGL ( EGL_OPENGL_BIT , EGL_OPENGL_API ) ) <nl> bool CWinSystemWaylandEGLContextGL : : InitWindowSystem ( ) <nl> <nl> # if defined ( HAVE_LIBVA ) <nl> bool general , hevc ; <nl> - CRendererVAAPI : : Register ( GetVaDisplay ( ) , m_eglContext . GetEGLDisplay ( ) , general , hevc ) ; <nl> + m_vaapiProxy . reset ( new CVaapiProxy ( * this ) ) ; <nl> + CRendererVAAPI : : Register ( m_vaapiProxy . get ( ) , GetVaDisplay ( ) , m_eglContext . GetEGLDisplay ( ) , general , hevc ) ; <nl> if ( general ) <nl> { <nl> - VAAPI : : CDecoder : : Register ( hevc ) ; <nl> + VAAPI : : CDecoder : : Register ( m_vaapiProxy . get ( ) , hevc ) ; <nl> } <nl> # endif <nl> <nl> mmm a / xbmc / windowing / wayland / WinSystemWaylandEGLContextGL . h <nl> ppp b / xbmc / windowing / wayland / WinSystemWaylandEGLContextGL . h <nl> <nl> # pragma once <nl> <nl> # include " rendering / gl / RenderSystemGL . h " <nl> - # include " utils / GlobalsHandling . h " <nl> # include " WinSystemWaylandEGLContext . h " <nl> <nl> + class CVaapiProxy ; <nl> + <nl> namespace KODI <nl> { <nl> namespace WINDOWING <nl> class CWinSystemWaylandEGLContextGL : public CWinSystemWaylandEGLContext , public <nl> void SetContextSize ( CSizeInt size ) override ; <nl> void SetVSyncImpl ( bool enable ) override ; <nl> void PresentRenderImpl ( bool rendered ) override ; <nl> + std : : unique_ptr < CVaapiProxy > m_vaapiProxy ; <nl> } ; <nl> <nl> } <nl> } <nl> } <nl> - <nl> - XBMC_GLOBAL_REF ( KODI : : WINDOWING : : WAYLAND : : CWinSystemWaylandEGLContextGL , g_Windowing ) ; <nl> - # define g_Windowing XBMC_GLOBAL_USE ( KODI : : WINDOWING : : WAYLAND : : CWinSystemWaylandEGLContextGL ) <nl> \ No newline at end of file <nl> mmm a / xbmc / windowing / wayland / WinSystemWaylandEGLContextGLES . cpp <nl> ppp b / xbmc / windowing / wayland / WinSystemWaylandEGLContextGLES . cpp <nl> <nl> # if defined ( HAVE_LIBVA ) <nl> # include " cores / VideoPlayer / DVDCodecs / Video / VAAPI . h " <nl> # include " cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGLES . h " <nl> + <nl> + using namespace KODI : : WINDOWING : : WAYLAND ; <nl> + class CVaapiProxy : public VAAPI : : IVaapiWinSystem <nl> + { <nl> + public : <nl> + CVaapiProxy ( CWinSystemWaylandEGLContextGLES & winSystem ) : m_winSystem ( winSystem ) { } ; <nl> + VADisplay GetVADisplay ( ) override { return m_winSystem . GetVaDisplay ( ) ; } ; <nl> + void * GetEGLDisplay ( ) override { return m_winSystem . GetEGLDisplay ( ) ; } ; <nl> + protected : <nl> + CWinSystemWaylandEGLContextGLES & m_winSystem ; <nl> + } ; <nl> + # else <nl> + class CVaapiProxy <nl> + { <nl> + } ; <nl> # endif <nl> <nl> using namespace KODI : : WINDOWING : : WAYLAND ; <nl> <nl> + std : : unique_ptr < CWinSystemBase > CWinSystemBase : : CreateWinSystem ( ) <nl> + { <nl> + std : : unique_ptr < CWinSystemBase > winSystem ( new CWinSystemWaylandEGLContextGLES ( ) ) ; <nl> + return winSystem ; <nl> + } <nl> + <nl> bool CWinSystemWaylandEGLContextGLES : : InitWindowSystem ( ) <nl> { <nl> if ( ! CWinSystemWaylandEGLContext : : InitWindowSystemEGL ( EGL_OPENGL_ES2_BIT , EGL_OPENGL_ES_API ) ) <nl> bool CWinSystemWaylandEGLContextGLES : : InitWindowSystem ( ) <nl> <nl> # if defined ( HAVE_LIBVA ) <nl> bool general , hevc ; <nl> - CRendererVAAPI : : Register ( GetVaDisplay ( ) , m_eglContext . GetEGLDisplay ( ) , general , hevc ) ; <nl> + m_vaapiProxy . reset ( new CVaapiProxy ( * this ) ) ; <nl> + CRendererVAAPI : : Register ( m_vaapiProxy . get ( ) , GetVaDisplay ( ) , m_eglContext . GetEGLDisplay ( ) , general , hevc ) ; <nl> if ( general ) <nl> { <nl> - VAAPI : : CDecoder : : Register ( hevc ) ; <nl> + VAAPI : : CDecoder : : Register ( m_vaapiProxy . get ( ) , hevc ) ; <nl> } <nl> # endif <nl> <nl> mmm a / xbmc / windowing / wayland / WinSystemWaylandEGLContextGLES . h <nl> ppp b / xbmc / windowing / wayland / WinSystemWaylandEGLContextGLES . h <nl> <nl> # pragma once <nl> <nl> # include " rendering / gles / RenderSystemGLES . h " <nl> - # include " utils / GlobalsHandling . h " <nl> # include " WinSystemWaylandEGLContext . h " <nl> <nl> + class CVaapiProxy ; <nl> + <nl> namespace KODI <nl> { <nl> namespace WINDOWING <nl> class CWinSystemWaylandEGLContextGLES : public CWinSystemWaylandEGLContext , publ <nl> void SetContextSize ( CSizeInt size ) override ; <nl> void SetVSyncImpl ( bool enable ) override ; <nl> void PresentRenderImpl ( bool rendered ) override ; <nl> + std : : unique_ptr < CVaapiProxy > m_vaapiProxy ; <nl> } ; <nl> <nl> } <nl> } <nl> } <nl> - <nl> - XBMC_GLOBAL_REF ( KODI : : WINDOWING : : WAYLAND : : CWinSystemWaylandEGLContextGLES , g_Windowing ) ; <nl> - # define g_Windowing XBMC_GLOBAL_USE ( KODI : : WINDOWING : : WAYLAND : : CWinSystemWaylandEGLContextGLES ) <nl> \ No newline at end of file <nl> mmm a / xbmc / windows / GUIWindowPointer . cpp <nl> ppp b / xbmc / windows / GUIWindowPointer . cpp <nl> <nl> # include " GUIWindowPointer . h " <nl> # include " input / MouseStat . h " <nl> # include " input / InputManager . h " <nl> - # include " windowing / WindowingFactory . h " <nl> # include " ServiceBroker . h " <nl> + # include " windowing / WinSystem . h " <nl> <nl> # define ID_POINTER 10 <nl> <nl> void CGUIWindowPointer : : SetPointer ( int pointer ) <nl> <nl> void CGUIWindowPointer : : UpdateVisibility ( ) <nl> { <nl> - if ( g_Windowing . HasCursor ( ) ) <nl> + if ( CServiceBroker : : GetWinSystem ( ) . HasCursor ( ) ) <nl> { <nl> if ( CServiceBroker : : GetInputManager ( ) . IsMouseActive ( ) ) <nl> Open ( ) ; <nl>
|
kill g_Windowing , another nasty global
|
xbmc/xbmc
|
ab9f535265461072e3e5cf020ebddb63dd6d868f
|
2017-11-24T16:54:47Z
|
mmm a / src / tests / core / arm / arm_test_common . cpp <nl> ppp b / src / tests / core / arm / arm_test_common . cpp <nl> boost : : optional < bool > TestEnvironment : : TestMemory : : IsValidAddress ( VAddr addr ) { <nl> } <nl> <nl> boost : : optional < u8 > TestEnvironment : : TestMemory : : Read8 ( VAddr addr ) { <nl> - auto iter = data . find ( addr ) ; <nl> + const auto iter = data . find ( addr ) ; <nl> + <nl> if ( iter = = data . end ( ) ) { <nl> - return addr ; / / Some arbitrary data <nl> + / / Some arbitrary data <nl> + return static_cast < u8 > ( addr ) ; <nl> } <nl> + <nl> return iter - > second ; <nl> } <nl> <nl>
|
arm_test_common : Get rid of truncation warnings
|
yuzu-emu/yuzu
|
48733744bb38d3a18af9713096f6e9b729944bb2
|
2018-07-20T21:53:53Z
|
mmm a / xbmc / cores / dvdplayer / DVDCodecs / Video / DVDVideoCodecOpenMax . cpp <nl> ppp b / xbmc / cores / dvdplayer / DVDCodecs / Video / DVDVideoCodecOpenMax . cpp <nl> <nl> # include < OpenMAX / il / OMX_Index . h > <nl> # include < OpenMAX / il / OMX_Image . h > <nl> <nl> + # define OMXCLASSNAME " CDVDVideoCodecOpenMax " <nl> / / EGL extension functions <nl> static PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR ; <nl> static PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR ; <nl> class DllLibOpenMax : public DllDynamic , DllLibOpenMaxInterface <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CDVDVideoCodecOpenMax : : CDVDVideoCodecOpenMax ( ) : CDVDVideoCodec ( ) <nl> { <nl> + # if defined ( OMX_DEBUG_VERBOSE ) <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s \ n " , OMXCLASSNAME , __func__ ) ; <nl> + # endif <nl> m_dll = new DllLibOpenMax ; <nl> m_dll - > Load ( ) ; <nl> + m_is_open = false ; <nl> <nl> m_omx_decoder = NULL ; <nl> m_pFormatName = " omx - xxxx " ; <nl> CDVDVideoCodecOpenMax : : CDVDVideoCodecOpenMax ( ) : CDVDVideoCodec ( ) <nl> pthread_mutex_init ( & m_omx_ready_mutex , NULL ) ; <nl> pthread_mutex_init ( & m_omx_avaliable_mutex , NULL ) ; <nl> <nl> - m_omx_state_change = ( sem_t * ) malloc ( sizeof ( sem_t ) ) ; <nl> - sem_init ( m_omx_state_change , 0 , 0 ) ; <nl> + m_omx_decoder_state_change = ( sem_t * ) malloc ( sizeof ( sem_t ) ) ; <nl> + sem_init ( m_omx_decoder_state_change , 0 , 0 ) ; <nl> / * <nl> m_omx_flush_input = ( sem_t * ) malloc ( sizeof ( sem_t ) ) ; <nl> sem_init ( m_omx_flush_input , 0 , 0 ) ; <nl> CDVDVideoCodecOpenMax : : CDVDVideoCodecOpenMax ( ) : CDVDVideoCodec ( ) <nl> <nl> CDVDVideoCodecOpenMax : : ~ CDVDVideoCodecOpenMax ( ) <nl> { <nl> - Dispose ( ) ; <nl> + # if defined ( OMX_DEBUG_VERBOSE ) <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s \ n " , OMXCLASSNAME , __func__ ) ; <nl> + # endif <nl> + if ( m_is_open ) <nl> + Dispose ( ) ; <nl> pthread_mutex_destroy ( & m_omx_ready_mutex ) ; <nl> pthread_mutex_destroy ( & m_omx_avaliable_mutex ) ; <nl> - sem_destroy ( m_omx_state_change ) ; <nl> - free ( m_omx_state_change ) ; <nl> + sem_destroy ( m_omx_decoder_state_change ) ; <nl> + free ( m_omx_decoder_state_change ) ; <nl> / * <nl> sem_destroy ( m_omx_flush_input ) ; <nl> free ( m_omx_flush_input ) ; <nl> CDVDVideoCodecOpenMax : : ~ CDVDVideoCodecOpenMax ( ) <nl> <nl> bool CDVDVideoCodecOpenMax : : Open ( CDVDStreamInfo & hints , CDVDCodecOptions & options ) <nl> { <nl> + # if defined ( OMX_DEBUG_VERBOSE ) <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s \ n " , OMXCLASSNAME , __func__ ) ; <nl> + # endif <nl> / / we always qualify even if DVDFactoryCodec does this too . <nl> if ( g_guiSettings . GetBool ( " videoplayer . useomx " ) & & ! hints . software ) <nl> { <nl> bool CDVDVideoCodecOpenMax : : Open ( CDVDStreamInfo & hints , CDVDCodecOptions & option <nl> } <nl> if ( hints . extrasize < 7 | | hints . extradata = = NULL ) <nl> { <nl> - CLog : : Log ( LOGNOTICE , " % s - avcC data too small or missing " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGNOTICE , <nl> + " % s : : % s - avcC data too small or missing " , OMXCLASSNAME , __func__ ) ; <nl> return false ; <nl> } <nl> / / valid avcC data ( bitstream ) always starts with the value 1 ( version ) <nl> bool CDVDVideoCodecOpenMax : : Open ( CDVDStreamInfo & hints , CDVDCodecOptions & option <nl> omx_err = m_dll - > OMX_Init ( ) ; <nl> if ( omx_err ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s - OpenMax failed to init , status ( % d ) , codec ( % d ) , profile ( % d ) , level ( % d ) " , <nl> - __FUNCTION__ , omx_err , hints . codec , hints . profile , hints . level ) ; <nl> + CLog : : Log ( LOGERROR , <nl> + " % s : : % s - OpenMax failed to init , status ( % d ) , codec ( % d ) , profile ( % d ) , level ( % d ) " , <nl> + OMXCLASSNAME , __func__ , omx_err , hints . codec , hints . profile , hints . level ) ; <nl> return false ; <nl> } <nl> <nl> bool CDVDVideoCodecOpenMax : : Open ( CDVDStreamInfo & hints , CDVDCodecOptions & option <nl> omx_err = m_dll - > OMX_GetHandle ( & m_omx_decoder , ( char * ) decoder_name . c_str ( ) , this , & decoder_callbacks ) ; <nl> if ( omx_err ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s - could not get decoder handle \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGERROR , <nl> + " % s : : % s - could not get decoder handle \ n " , OMXCLASSNAME , __func__ ) ; <nl> m_dll - > OMX_Deinit ( ) ; <nl> return false ; <nl> } <nl> bool CDVDVideoCodecOpenMax : : Open ( CDVDStreamInfo & hints , CDVDCodecOptions & option <nl> omx_err = OMX_GetParameter ( m_omx_decoder , OMX_IndexParamVideoInit , & port_param ) ; <nl> if ( omx_err ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s - failed to get component port parameter \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGERROR , <nl> + " % s : : % s - failed to get component port parameter \ n " , OMXCLASSNAME , __func__ ) ; <nl> m_dll - > OMX_FreeHandle ( m_omx_decoder ) ; <nl> m_omx_decoder = NULL ; <nl> m_dll - > OMX_Deinit ( ) ; <nl> bool CDVDVideoCodecOpenMax : : Open ( CDVDStreamInfo & hints , CDVDCodecOptions & option <nl> m_omx_input_port = port_param . nStartPortNumber ; <nl> m_omx_output_port = m_omx_input_port + 1 ; <nl> # if defined ( OMX_DEBUG_VERBOSE ) <nl> - CLog : : Log ( LOGDEBUG , " % s - decoder_component ( 0x % p ) , input_port ( 0x % x ) , output_port ( 0x % x ) \ n " , <nl> - __FUNCTION__ , m_omx_decoder , m_omx_input_port , m_omx_output_port ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - decoder_component ( 0x % p ) , input_port ( 0x % x ) , output_port ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , m_omx_decoder , m_omx_input_port , m_omx_output_port ) ; <nl> # endif <nl> <nl> / / TODO : Set role for the component because components could have multiple roles . <nl> bool CDVDVideoCodecOpenMax : : Open ( CDVDStreamInfo & hints , CDVDCodecOptions & option <nl> memset ( m_videobuffer . data [ 1 ] , 0 , chroma_pixels ) ; <nl> memset ( m_videobuffer . data [ 2 ] , 0 , chroma_pixels ) ; <nl> <nl> + m_is_open = true ; <nl> m_drop_pictures = false ; <nl> m_videoplayback_done = false ; <nl> <nl> bool CDVDVideoCodecOpenMax : : Open ( CDVDStreamInfo & hints , CDVDCodecOptions & option <nl> <nl> void CDVDVideoCodecOpenMax : : Dispose ( ) <nl> { <nl> + # if defined ( OMX_DEBUG_VERBOSE ) <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s \ n " , OMXCLASSNAME , __func__ ) ; <nl> + # endif <nl> if ( m_omx_decoder ) <nl> { <nl> - if ( m_omx_state ! = OMX_StateLoaded ) <nl> + if ( m_omx_decoder_state ! = OMX_StateLoaded ) <nl> StopDecoder ( ) ; <nl> m_dll - > OMX_FreeHandle ( m_omx_decoder ) ; <nl> m_omx_decoder = NULL ; <nl> void CDVDVideoCodecOpenMax : : Dispose ( ) <nl> _aligned_free ( m_videobuffer . data [ 2 ] ) ; <nl> m_videobuffer . iFlags = 0 ; <nl> } <nl> - if ( m_sps_pps_context . sps_pps_data ) <nl> + if ( m_convert_bitstream ) <nl> { <nl> - free ( m_sps_pps_context . sps_pps_data ) ; <nl> - m_sps_pps_context . sps_pps_data = NULL ; <nl> + if ( m_sps_pps_context . sps_pps_data ) <nl> + { <nl> + free ( m_sps_pps_context . sps_pps_data ) ; <nl> + m_sps_pps_context . sps_pps_data = NULL ; <nl> + } <nl> } <nl> + m_is_open = false ; <nl> } <nl> <nl> void CDVDVideoCodecOpenMax : : SetDropState ( bool bDrop ) <nl> int CDVDVideoCodecOpenMax : : Decode ( BYTE * pData , int iSize , double dts , double pts <nl> omx_buffer - > nInputPortIndex = m_omx_input_port ; <nl> <nl> # if defined ( OMX_DEBUG_EMPTYBUFFERDONE ) <nl> - CLog : : Log ( LOGDEBUG , " % s - feeding decoder , omx_buffer - > pBuffer ( 0x % p ) , demuxer_bytes ( % d ) \ n " , <nl> - __FUNCTION__ , omx_buffer - > pBuffer , demuxer_bytes ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - feeding decoder , omx_buffer - > pBuffer ( 0x % p ) , demuxer_bytes ( % d ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_buffer - > pBuffer , demuxer_bytes ) ; <nl> # endif <nl> / / Give this omx_buffer to OpenMax to be decoded . <nl> omx_err = OMX_EmptyThisBuffer ( m_omx_decoder , omx_buffer ) ; <nl> if ( omx_err ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_EmptyThisBuffer ( ) failed with result ( 0x % x ) \ n " , __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - OMX_EmptyThisBuffer ( ) failed with result ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> return VC_ERROR ; <nl> } <nl> / / only push if we are successful with feeding OMX_EmptyThisBuffer <nl> int CDVDVideoCodecOpenMax : : Decode ( BYTE * pData , int iSize , double dts , double pts <nl> <nl> # if defined ( OMX_DEBUG_VERBOSE ) <nl> if ( m_omx_input_avaliable . empty ( ) ) <nl> - CLog : : Log ( LOGDEBUG , " % s - buffering demux , m_demux_queue_size ( % d ) , demuxer_bytes ( % d ) \ n " , <nl> - __FUNCTION__ , m_demux_queue . size ( ) , demuxer_bytes ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - buffering demux , m_demux_queue_size ( % d ) , demuxer_bytes ( % d ) \ n " , <nl> + OMXCLASSNAME , __func__ , m_demux_queue . size ( ) , demuxer_bytes ) ; <nl> # endif <nl> } <nl> <nl> + / * <nl> + if ( m_drop_pictures & & ( m_omx_output_ready . size ( ) > 1 ) ) <nl> + { <nl> + pthread_mutex_lock ( & m_omx_ready_mutex ) ; <nl> + m_dts_queue . pop ( ) ; <nl> + m_omx_output_ready . pop ( ) ; <nl> + pthread_mutex_unlock ( & m_omx_ready_mutex ) ; <nl> + } <nl> + * / <nl> + <nl> if ( m_omx_output_ready . empty ( ) ) <nl> return VC_BUFFER ; <nl> <nl> int CDVDVideoCodecOpenMax : : Decode ( BYTE * pData , int iSize , double dts , double pts <nl> <nl> void CDVDVideoCodecOpenMax : : Reset ( void ) <nl> { <nl> + # if defined ( OMX_DEBUG_VERBOSE ) <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s \ n " , OMXCLASSNAME , __func__ ) ; <nl> + # endif <nl> / / only reset OpenMax decoder if it ' s running <nl> - if ( m_omx_state = = OMX_StateExecuting ) <nl> + if ( m_omx_decoder_state = = OMX_StateExecuting ) <nl> { <nl> StopDecoder ( ) ; <nl> while ( ! m_omx_input_avaliable . empty ( ) ) <nl> bool CDVDVideoCodecOpenMax : : GetPicture ( DVDVideoPicture * pDvdVideoPicture ) <nl> # if defined ( OMX_DEBUG_VERBOSE ) <nl> else <nl> { <nl> - CLog : : Log ( LOGDEBUG , " % s - nAllocLen ( % lu ) , nFilledLen ( % lu ) should be filled_size ( % lu ) \ n " , <nl> - __FUNCTION__ , omx_buffer - > nAllocLen , omx_buffer - > nFilledLen , filled_size ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - nAllocLen ( % lu ) , nFilledLen ( % lu ) should be filled_size ( % lu ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_buffer - > nAllocLen , omx_buffer - > nFilledLen , filled_size ) ; <nl> } <nl> # endif <nl> <nl> / / release the omx buffer back to OpenMax to fill . <nl> OMX_ERRORTYPE omx_err = OMX_FillThisBuffer ( m_omx_decoder , omx_buffer ) ; <nl> if ( omx_err ) <nl> - CLog : : Log ( LOGERROR , " % s - OMX_FillThisBuffer , omx_err ( 0x % x ) \ n " , __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_FillThisBuffer , omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> } <nl> # if defined ( OMX_DEBUG_VERBOSE ) <nl> else <nl> { <nl> - CLog : : Log ( LOGDEBUG , " % s - called but m_omx_output_ready is empty \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - called but m_omx_output_ready is empty \ n " , <nl> + OMXCLASSNAME , __func__ ) ; <nl> } <nl> # endif <nl> } <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : DecoderEventHandler ( <nl> <nl> / * <nl> # if defined ( OMX_DEBUG_VERBOSE ) <nl> - CLog : : Log ( LOGDEBUG , " % s - hComponent ( 0x % p ) , eEvent ( 0x % x ) , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) , pEventData ( 0x % p ) \ n " , <nl> - __FUNCTION__ , hComponent , eEvent , nData1 , nData2 , pEventData ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " CDVDVideoCodecOpenMax : : % s - hComponent ( 0x % p ) , eEvent ( 0x % x ) , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) , pEventData ( 0x % p ) \ n " , <nl> + __func__ , hComponent , eEvent , nData1 , nData2 , pEventData ) ; <nl> # endif <nl> * / <nl> <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : DecoderEventHandler ( <nl> switch ( nData1 ) <nl> { <nl> case OMX_CommandStateSet : <nl> - ctx - > m_omx_state = ( int ) nData2 ; <nl> - sem_post ( ctx - > m_omx_state_change ) ; <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - switch ( ctx - > m_omx_state ) <nl> + ctx - > m_omx_decoder_state = ( int ) nData2 ; <nl> + switch ( ctx - > m_omx_decoder_state ) <nl> { <nl> case OMX_StateInvalid : <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_StateInvalid \ n " , __FUNCTION__ ) ; <nl> - break ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - OMX_StateInvalid \ n " , OMXCLASSNAME , __func__ ) ; <nl> + break ; <nl> case OMX_StateLoaded : <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_StateLoaded \ n " , __FUNCTION__ ) ; <nl> - break ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - OMX_StateLoaded \ n " , OMXCLASSNAME , __func__ ) ; <nl> + break ; <nl> case OMX_StateIdle : <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_StateIdle \ n " , __FUNCTION__ ) ; <nl> - break ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - OMX_StateIdle \ n " , OMXCLASSNAME , __func__ ) ; <nl> + break ; <nl> case OMX_StateExecuting : <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_StateExecuting \ n " , __FUNCTION__ ) ; <nl> - break ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - OMX_StateExecuting \ n " , OMXCLASSNAME , __func__ ) ; <nl> + break ; <nl> case OMX_StatePause : <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_StatePause \ n " , __FUNCTION__ ) ; <nl> - break ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - OMX_StatePause \ n " , OMXCLASSNAME , __func__ ) ; <nl> + break ; <nl> case OMX_StateWaitForResources : <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_StateWaitForResources \ n " , __FUNCTION__ ) ; <nl> - break ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - OMX_StateWaitForResources \ n " , OMXCLASSNAME , __func__ ) ; <nl> + break ; <nl> + default : <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - Unknown OMX_Statexxxxx , state ( % d ) \ n " , <nl> + OMXCLASSNAME , __func__ , ctx - > m_omx_decoder_state ) ; <nl> + break ; <nl> } <nl> - # endif <nl> + sem_post ( ctx - > m_omx_decoder_state_change ) ; <nl> break ; <nl> case OMX_CommandFlush : <nl> / * <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : DecoderEventHandler ( <nl> { <nl> sem_post ( ctx - > m_omx_flush_input ) ; <nl> sem_post ( ctx - > m_omx_flush_output ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_CommandFlush input / output \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGDEBUG , " CDVDVideoCodecOpenMax : : % s - OMX_CommandFlush input / output \ n " , __func__ ) ; <nl> } <nl> else if ( ctx - > m_omx_input_port = = ( int ) nData2 ) <nl> { <nl> sem_post ( ctx - > m_omx_flush_input ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_CommandFlush input \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGDEBUG , " CDVDVideoCodecOpenMax : : % s - OMX_CommandFlush input \ n " , __func__ ) ; <nl> } <nl> else if ( ctx - > m_omx_output_port = = ( int ) nData2 ) <nl> { <nl> sem_post ( ctx - > m_omx_flush_output ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_CommandFlush ouput \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGDEBUG , " CDVDVideoCodecOpenMax : : % s - OMX_CommandFlush ouput \ n " , __func__ ) ; <nl> } <nl> else <nl> * / <nl> { <nl> # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_CommandFlush , nData2 ( 0x % lx ) \ n " , __FUNCTION__ , nData2 ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - OMX_CommandFlush , nData2 ( 0x % lx ) \ n " , <nl> + OMXCLASSNAME , __func__ , nData2 ) ; <nl> # endif <nl> } <nl> break ; <nl> case OMX_CommandPortDisable : <nl> # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_CommandPortDisable , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) \ n " , <nl> - __FUNCTION__ , nData1 , nData2 ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - OMX_CommandPortDisable , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) \ n " , <nl> + OMXCLASSNAME , __func__ , nData1 , nData2 ) ; <nl> # endif <nl> if ( ctx - > m_omx_output_port = = ( int ) nData2 ) <nl> { <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : DecoderEventHandler ( <nl> break ; <nl> case OMX_CommandPortEnable : <nl> # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_CommandPortEnable , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) \ n " , <nl> - __FUNCTION__ , nData1 , nData2 ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - OMX_CommandPortEnable , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) \ n " , <nl> + OMXCLASSNAME , __func__ , nData1 , nData2 ) ; <nl> # endif <nl> if ( ctx - > m_omx_output_port = = ( int ) nData2 ) <nl> { <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : DecoderEventHandler ( <nl> break ; <nl> # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> case OMX_CommandMarkBuffer : <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_CommandMarkBuffer , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) \ n " , <nl> - __FUNCTION__ , nData1 , nData2 ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - OMX_CommandMarkBuffer , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) \ n " , <nl> + OMXCLASSNAME , __func__ , nData1 , nData2 ) ; <nl> break ; <nl> # endif <nl> } <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : DecoderEventHandler ( <nl> if ( ctx - > m_omx_decoder = = hComponent & & ( nData2 & OMX_BUFFERFLAG_EOS ) ) { <nl> # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> if ( ctx - > m_omx_input_port = = ( int ) nData1 ) <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_EventBufferFlag ( input ) \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - OMX_EventBufferFlag ( input ) \ n " , <nl> + OMXCLASSNAME , __func__ ) ; <nl> # endif <nl> if ( ctx - > m_omx_output_port = = ( int ) nData1 ) <nl> { <nl> ctx - > m_videoplayback_done = true ; <nl> # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_EventBufferFlag ( output ) \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - OMX_EventBufferFlag ( output ) \ n " , <nl> + OMXCLASSNAME , __func__ ) ; <nl> # endif <nl> } <nl> } <nl> break ; <nl> case OMX_EventPortSettingsChanged : <nl> # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_EventPortSettingsChanged ( output ) \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - OMX_EventPortSettingsChanged ( output ) \ n " , OMXCLASSNAME , __func__ ) ; <nl> # endif <nl> / / not sure nData2 is the input / output ports in this call , docs don ' t say <nl> if ( ctx - > m_omx_output_port = = ( int ) nData2 ) <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : DecoderEventHandler ( <nl> break ; <nl> # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> case OMX_EventMark : <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_EventMark \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - OMX_EventMark \ n " , OMXCLASSNAME , __func__ ) ; <nl> break ; <nl> case OMX_EventResourcesAcquired : <nl> - CLog : : Log ( LOGDEBUG , " % s - OMX_EventResourcesAcquired \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - OMX_EventResourcesAcquired \ n " , OMXCLASSNAME , __func__ ) ; <nl> break ; <nl> # endif <nl> case OMX_EventError : <nl> switch ( ( OMX_S32 ) nData1 ) <nl> { <nl> case OMX_ErrorInsufficientResources : <nl> - CLog : : Log ( LOGERROR , " % s - OMX_EventError , insufficient resources \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_EventError , insufficient resources \ n " , <nl> + OMXCLASSNAME , __func__ ) ; <nl> / / we are so frack ' ed <nl> / / exit ( 0 ) ; <nl> break ; <nl> case OMX_ErrorFormatNotDetected : <nl> - CLog : : Log ( LOGERROR , " % s - OMX_EventError , cannot parse input stream \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_EventError , cannot parse input stream \ n " , <nl> + OMXCLASSNAME , __func__ ) ; <nl> break ; <nl> case OMX_ErrorPortUnpopulated : <nl> / / silently ignore these . We can get them when setting OMX_CommandPortDisable <nl> / / on the output port and the component flushes the output buffers . <nl> break ; <nl> case OMX_ErrorStreamCorrupt : <nl> - CLog : : Log ( LOGERROR , " % s - OMX_EventError , Bitstream corrupt \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_EventError , Bitstream corrupt \ n " , <nl> + OMXCLASSNAME , __func__ ) ; <nl> ctx - > m_videoplayback_done = true ; <nl> break ; <nl> default : <nl> - CLog : : Log ( LOGERROR , " % s - OMX_EventError detected , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) \ n " , <nl> - __FUNCTION__ , nData1 , nData2 ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_EventError detected , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) \ n " , <nl> + OMXCLASSNAME , __func__ , nData1 , nData2 ) ; <nl> break ; <nl> } <nl> / / do this so we don ' t hang on errors <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : DecoderEventHandler ( <nl> sem_post ( ctx - > m_omx_flush_input ) ; <nl> sem_post ( ctx - > m_omx_flush_output ) ; <nl> * / <nl> - sem_post ( ctx - > m_omx_state_change ) ; <nl> + sem_post ( ctx - > m_omx_decoder_state_change ) ; <nl> break ; <nl> default : <nl> - CLog : : Log ( LOGWARNING , " % s - Unknown eEvent ( 0x % x ) , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) \ n " , <nl> - __FUNCTION__ , eEvent , nData1 , nData2 ) ; <nl> + CLog : : Log ( LOGWARNING , <nl> + " % s : : % s - Unknown eEvent ( 0x % x ) , nData1 ( 0x % lx ) , nData2 ( 0x % lx ) \ n " , <nl> + OMXCLASSNAME , __func__ , eEvent , nData1 , nData2 ) ; <nl> break ; <nl> } <nl> <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : DecoderEmptyBufferDone ( <nl> { <nl> CDVDVideoCodecOpenMax * ctx = ( CDVDVideoCodecOpenMax * ) pAppData ; <nl> <nl> + # if defined ( OMX_DEBUG_EMPTYBUFFERDONE ) <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - buffer_size ( % lu ) , timestamp ( % f ) \ n " , <nl> + OMXCLASSNAME , __func__ , pBuffer - > nFilledLen , ( double ) pBuffer - > nTimeStamp / 1000 . 0 ) ; <nl> + # endif <nl> / / queue free input buffer to avaliable list . <nl> pthread_mutex_lock ( & ctx - > m_omx_avaliable_mutex ) ; <nl> ctx - > m_omx_input_avaliable . push ( pBuffer ) ; <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : DecoderEmptyBufferDone ( <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : DecoderFillBufferDone ( <nl> OMX_HANDLETYPE hComponent , <nl> OMX_PTR pAppData , <nl> - OMX_BUFFERHEADERTYPE * pBufferHeader ) <nl> + OMX_BUFFERHEADERTYPE * pBuffer ) <nl> { <nl> - # if defined ( OMX_DEBUG_FILLBUFFERDONE ) <nl> - CLog : : Log ( LOGDEBUG , " % s - buffer_size ( % lu ) , timestamp ( % f ) \ n " , <nl> - __FUNCTION__ , pBufferHeader - > nFilledLen , ( double ) pBufferHeader - > nTimeStamp / 1000 . 0 ) ; <nl> - # endif <nl> CDVDVideoCodecOpenMax * ctx = ( CDVDVideoCodecOpenMax * ) pAppData ; <nl> <nl> + # if defined ( OMX_DEBUG_FILLBUFFERDONE ) <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - buffer_size ( % lu ) , timestamp ( % f ) \ n " , <nl> + OMXCLASSNAME , __func__ , pBuffer - > nFilledLen , ( double ) pBuffer - > nTimeStamp / 1000 . 0 ) ; <nl> + # endif <nl> / / queue output omx buffer to ready list . <nl> pthread_mutex_lock ( & ctx - > m_omx_ready_mutex ) ; <nl> - ctx - > m_omx_output_ready . push ( pBufferHeader ) ; <nl> + ctx - > m_omx_output_ready . push ( pBuffer ) ; <nl> pthread_mutex_unlock ( & ctx - > m_omx_ready_mutex ) ; <nl> <nl> return OMX_ErrorNone ; <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : PrimeFillBuffers ( void ) <nl> <nl> omx_err = OMX_FillThisBuffer ( m_omx_decoder , buffer ) ; <nl> if ( omx_err ) <nl> - CLog : : Log ( LOGERROR , " % s - OMX_FillThisBuffer failed with omx_err ( 0x % x ) \ n " , <nl> - __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_FillThisBuffer failed with omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> } <nl> <nl> return omx_err ; <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : AllocOMXInputBuffers ( void ) <nl> OMX_GetParameter ( m_omx_decoder , OMX_IndexParamPortDefinition , & port_format ) ; <nl> <nl> # if defined ( OMX_DEBUG_VERBOSE ) <nl> - CLog : : Log ( LOGDEBUG , " % s - iport ( % d ) , nBufferCountMin ( % lu ) , nBufferSize ( % lu ) \ n " , <nl> - __FUNCTION__ , m_omx_input_port , port_format . nBufferCountMin , port_format . nBufferSize ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " % s : : % s - iport ( % d ) , nBufferCountMin ( % lu ) , nBufferSize ( % lu ) \ n " , <nl> + OMXCLASSNAME , __func__ , m_omx_input_port , port_format . nBufferCountMin , port_format . nBufferSize ) ; <nl> # endif <nl> for ( size_t i = 0 ; i < port_format . nBufferCountMin ; i + + ) <nl> { <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : AllocOMXInputBuffers ( void ) <nl> omx_err = OMX_UseBuffer ( m_omx_decoder , & buffer , m_omx_input_port , NULL , port_format . nBufferSize , data ) ; <nl> if ( omx_err ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s - OMX_UseBuffer failed with omx_err ( 0x % x ) \ n " , __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_UseBuffer failed with omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> return ( omx_err ) ; <nl> } <nl> m_omx_input_buffers . push_back ( buffer ) ; <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : FreeOMXInputBuffers ( bool wait ) <nl> / * <nl> omx_err = OMX_SendCommand ( m_omx_decoder , OMX_CommandFlush , m_omx_input_port , 0 ) ; <nl> if ( omx_err ) <nl> - CLog : : Log ( LOGERROR , " % s - OMX_CommandFlush failed with omx_err ( 0x % x ) \ n " , <nl> - __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_CommandFlush failed with omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> else if ( wait ) <nl> sem_wait ( m_omx_flush_input ) ; <nl> * / <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : AllocOMXOutputBuffers ( void ) <nl> <nl> # if defined ( OMX_DEBUG_VERBOSE ) <nl> CLog : : Log ( LOGDEBUG , <nl> - " % s ( 1 ) - oport ( % d ) , nFrameWidth ( % lu ) , nFrameHeight ( % lu ) , nStride ( % lx ) , nBufferCountMin ( % lu ) , nBufferSize ( % lu ) \ n " , <nl> - __FUNCTION__ , m_omx_output_port , <nl> + " % s : : % s ( 1 ) - oport ( % d ) , nFrameWidth ( % lu ) , nFrameHeight ( % lu ) , nStride ( % lx ) , nBufferCountMin ( % lu ) , nBufferSize ( % lu ) \ n " , <nl> + OMXCLASSNAME , __func__ , m_omx_output_port , <nl> port_format . format . video . nFrameWidth , port_format . format . video . nFrameHeight , port_format . format . video . nStride , <nl> port_format . nBufferCountMin , port_format . nBufferSize ) ; <nl> # endif <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : AllocOMXOutputBuffers ( void ) <nl> omx_err = OMX_AllocateBuffer ( m_omx_decoder , & buffer , m_omx_output_port , NULL , buffer_size ) ; <nl> if ( omx_err ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s - OMX_AllocateBuffer failed with omx_err ( 0x % x ) \ n " , __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_AllocateBuffer failed with omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> return ( omx_err ) ; <nl> } <nl> m_omx_output_buffers . push_back ( buffer ) ; <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : FreeOMXOutputBuffers ( bool wait ) <nl> / * <nl> omx_err = OMX_SendCommand ( m_omx_decoder , OMX_CommandFlush , m_omx_output_port , 0 ) ; <nl> if ( omx_err ) <nl> - CLog : : Log ( LOGERROR , " % s - OMX_CommandFlush failed with omx_err ( 0x % x ) \ n " , <nl> - __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_CommandFlush failed with omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> else if ( wait ) <nl> sem_wait ( m_omx_flush_output ) ; <nl> * / <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : AllocOMXOutputEGLTextures ( void ) <nl> <nl> # if defined ( OMX_DEBUG_VERBOSE ) <nl> CLog : : Log ( LOGDEBUG , <nl> - " % s ( 1 ) - oport ( % d ) , nFrameWidth ( % lu ) , nFrameHeight ( % lu ) , nStride ( % lx ) , nBufferCountMin ( % lu ) , nBufferSize ( % lu ) \ n " , <nl> - __FUNCTION__ , m_omx_output_port , <nl> + " % s : : % s ( 1 ) - oport ( % d ) , nFrameWidth ( % lu ) , nFrameHeight ( % lu ) , nStride ( % lx ) , nBufferCountMin ( % lu ) , nBufferSize ( % lu ) \ n " , <nl> + OMXCLASSNAME , __func__ , m_omx_output_port , <nl> port_format . format . video . nFrameWidth , port_format . format . video . nFrameHeight , port_format . format . video . nStride , <nl> port_format . nBufferCountMin , port_format . nBufferSize ) ; <nl> # endif <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : AllocOMXOutputEGLTextures ( void ) <nl> & attrib ) ; <nl> if ( ! egl_buffer - > egl_image ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s - ERROR creating EglImage \ n " , __FUNCTION__ ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - ERROR creating EglImage \ n " , OMXCLASSNAME , __func__ ) ; <nl> return ( OMX_ErrorUndefined ) ; <nl> } <nl> egl_buffer - > index = i ; <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : AllocOMXOutputEGLTextures ( void ) <nl> m_omx_decoder , & egl_buffer - > omx_buffer , m_omx_output_port , this , egl_buffer - > egl_image ) ; <nl> if ( omx_err ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s - OMX_UseEGLImage failed with omx_err ( 0x % x ) \ n " , __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_UseEGLImage failed with omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> return ( omx_err ) ; <nl> } <nl> m_omx_egl_output_buffers . push_back ( egl_buffer ) ; <nl> <nl> - CLog : : Log ( LOGDEBUG , " % s - Texture % p Width % d Height % d \ n " , <nl> - __FUNCTION__ , egl_buffer - > egl_image , egl_buffer - > width , egl_buffer - > height ) ; <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - Texture % p Width % d Height % d \ n " , <nl> + OMXCLASSNAME , __func__ , egl_buffer - > egl_image , egl_buffer - > width , egl_buffer - > height ) ; <nl> } <nl> m_omx_output_eos = false ; <nl> while ( ! m_omx_egl_output_ready . empty ( ) ) <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : FreeOMXOutputEGLTextures ( bool wait ) <nl> return omx_err ; <nl> } <nl> <nl> + / / Wait for a component to transition to the specified state <nl> + OMX_ERRORTYPE CDVDVideoCodecOpenMax : : WaitForState ( OMX_STATETYPE state ) <nl> + { <nl> + OMX_ERRORTYPE omx_error = OMX_ErrorNone ; <nl> + OMX_STATETYPE test_state ; <nl> + int tries = 0 ; <nl> + struct timespec timeout ; <nl> + omx_error = OMX_GetState ( m_omx_decoder , & test_state ) ; <nl> + <nl> + # if defined ( OMX_DEBUG_VERBOSE ) <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - waiting for state ( % d ) \ n " , OMXCLASSNAME , __func__ , state ) ; <nl> + # endif <nl> + while ( ( omx_error = = OMX_ErrorNone ) & & ( test_state ! = state ) ) <nl> + { <nl> + clock_gettime ( CLOCK_REALTIME , & timeout ) ; <nl> + timeout . tv_sec + = 1 ; <nl> + sem_timedwait ( m_omx_decoder_state_change , & timeout ) ; <nl> + if ( errno = = ETIMEDOUT ) <nl> + tries + + ; <nl> + else if ( tries > 5 ) <nl> + return OMX_ErrorUndefined ; <nl> + <nl> + omx_error = OMX_GetState ( m_omx_decoder , & test_state ) ; <nl> + } <nl> + <nl> + return omx_error ; <nl> + } <nl> + <nl> / / SetStateForAllComponents <nl> / / Blocks until all state changes have completed <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : SetStateForComponent ( OMX_STATETYPE state ) <nl> { <nl> OMX_ERRORTYPE omx_err ; <nl> <nl> + # if defined ( OMX_DEBUG_VERBOSE ) <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s - state ( % d ) \ n " , OMXCLASSNAME , __func__ , state ) ; <nl> + # endif <nl> omx_err = OMX_SendCommand ( m_omx_decoder , OMX_CommandStateSet , state , 0 ) ; <nl> if ( omx_err ) <nl> - CLog : : Log ( LOGERROR , " % s - OMX_CommandStateSet failed with omx_err ( 0x % x ) \ n " , <nl> - __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - OMX_CommandStateSet failed with omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> else <nl> - sem_wait ( m_omx_state_change ) ; <nl> + omx_err = WaitForState ( state ) ; <nl> <nl> return omx_err ; <nl> } <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : StartDecoder ( void ) <nl> { <nl> OMX_ERRORTYPE omx_err ; <nl> <nl> + # if defined ( OMX_DEBUG_VERBOSE ) <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s \ n " , OMXCLASSNAME , __func__ ) ; <nl> + # endif <nl> / / transition decoder component to IDLE state <nl> omx_err = SetStateForComponent ( OMX_StateIdle ) ; <nl> if ( omx_err ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s - setting OMX_StateIdle failed with omx_err ( 0x % x ) \ n " , <nl> - __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - setting OMX_StateIdle failed with omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> return omx_err ; <nl> } <nl> <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : StartDecoder ( void ) <nl> omx_err = SetStateForComponent ( OMX_StateExecuting ) ; <nl> if ( omx_err ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s - setting OMX_StateExecuting failed with omx_err ( 0x % x ) \ n " , <nl> - __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - setting OMX_StateExecuting failed with omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> return omx_err ; <nl> } <nl> <nl> OMX_ERRORTYPE CDVDVideoCodecOpenMax : : StopDecoder ( void ) <nl> { <nl> OMX_ERRORTYPE omx_err ; <nl> <nl> + # if defined ( OMX_DEBUG_VERBOSE ) <nl> + CLog : : Log ( LOGDEBUG , " % s : : % s \ n " , OMXCLASSNAME , __func__ ) ; <nl> + # endif <nl> / / transition decoder component from executing to idle <nl> omx_err = SetStateForComponent ( OMX_StateIdle ) ; <nl> if ( omx_err ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s - setting OMX_StateIdle failed with omx_err ( 0x % x ) \ n " , <nl> - __FUNCTION__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - setting OMX_StateIdle failed with omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> return omx_err ; <nl> } <nl> <nl> - / / transition decoder component from idle to loaded <nl> - omx_err = SetStateForComponent ( OMX_StateLoaded ) ; <nl> - if ( omx_err ) <nl> - CLog : : Log ( LOGERROR , " % s - setting OMX_StateLoaded failed with omx_err ( 0x % x ) \ n " , <nl> - __FUNCTION__ , omx_err ) ; <nl> - <nl> - / / we can free port buffers in OMX_StateLoaded state . <nl> + / / we can free our allocated port buffers in OMX_StateIdle state . <nl> / / free OpenMax input buffers . <nl> omx_err = FreeOMXInputBuffers ( true ) ; <nl> / / free OpenMax output buffers . <nl> omx_err = FreeOMXOutputBuffers ( true ) ; <nl> <nl> + / / transition decoder component from idle to loaded <nl> + omx_err = SetStateForComponent ( OMX_StateLoaded ) ; <nl> + if ( omx_err ) <nl> + CLog : : Log ( LOGERROR , <nl> + " % s : : % s - setting OMX_StateLoaded failed with omx_err ( 0x % x ) \ n " , <nl> + OMXCLASSNAME , __func__ , omx_err ) ; <nl> + <nl> return omx_err ; <nl> } <nl> <nl> mmm a / xbmc / cores / dvdplayer / DVDCodecs / Video / DVDVideoCodecOpenMax . h <nl> ppp b / xbmc / cores / dvdplayer / DVDCodecs / Video / DVDVideoCodecOpenMax . h <nl> class CDVDVideoCodecOpenMax : public CDVDVideoCodec <nl> virtual const char * GetName ( void ) { return ( const char * ) m_pFormatName ; } <nl> <nl> protected : <nl> + enum OMX_CLIENT_STATE { <nl> + DEAD , <nl> + LOADED , <nl> + LOADED_TO_IDLE , <nl> + IDLE_TO_EXECUTING , <nl> + EXECUTING , <nl> + EXECUTING_TO_IDLE , <nl> + IDLE_TO_LOADED , <nl> + RECONFIGURING , <nl> + ERROR <nl> + } ; <nl> + <nl> / / bitstream to bytestream ( Annex B ) conversion routines . <nl> bool bitstream_convert_init ( void * in_extradata , int in_extrasize ) ; <nl> bool bitstream_convert ( BYTE * pData , int iSize , uint8_t * * poutbuf , int * poutbuf_size ) ; <nl> class CDVDVideoCodecOpenMax : public CDVDVideoCodec <nl> OMX_ERRORTYPE FreeOMXOutputBuffers ( bool wait ) ; <nl> OMX_ERRORTYPE AllocOMXOutputEGLTextures ( void ) ; <nl> OMX_ERRORTYPE FreeOMXOutputEGLTextures ( bool wait ) ; <nl> + OMX_ERRORTYPE WaitForState ( OMX_STATETYPE state ) ; <nl> OMX_ERRORTYPE SetStateForComponent ( OMX_STATETYPE state ) ; <nl> OMX_ERRORTYPE StartDecoder ( void ) ; <nl> OMX_ERRORTYPE StopDecoder ( void ) ; <nl> <nl> DllLibOpenMax * m_dll ; <nl> + bool m_is_open ; <nl> OMX_HANDLETYPE m_omx_decoder ; / / openmax decoder component reference <nl> DVDVideoPicture m_videobuffer ; <nl> const char * m_pFormatName ; <nl> class CDVDVideoCodecOpenMax : public CDVDVideoCodec <nl> <nl> <nl> / / OpenMax state tracking <nl> - volatile int m_omx_state ; <nl> - sem_t * m_omx_state_change ; <nl> + OMX_CLIENT_STATE m_omx_client_state ; <nl> + volatile int m_omx_decoder_state ; <nl> + sem_t * m_omx_decoder_state_change ; <nl> volatile bool m_videoplayback_done ; <nl> <nl> / / bitstream to bytestream convertion ( Annex B ) <nl>
|
[ arm / omx ] 1 ) added more verbose logging , 2 ) cosmetic log output changes , 3 ) more robust wait for decoder state change , fixes another crash on stopping
|
xbmc/xbmc
|
482f60fc358885bcc32865234d0f719bf9699191
|
2010-05-23T18:44:13Z
|
mmm a / examples / README . md <nl> ppp b / examples / README . md <nl> <nl> # Weex Examples <nl> <nl> - We import a simple UI Gallery for consistent UI style . We recommend a new example can be composed with these UI components . <nl> + # # Add an example <nl> + <nl> + Copy [ template file ] ( . / modal . we ) and build an example with [ UI Gallery ] ( # ui - gallery ) . <nl> <nl> - See ` ui . we ` to get all the UI components . <nl> <nl> # # UI Gallery <nl> <nl> + We import a simple UI Gallery for consistent UI style . We recommend a new example can be composed with these UI components . <nl> + <nl> > Inspired by Bootstrap . <nl> <nl> See [ UI Gallery Example ] ( . / ui . we ) for details . <nl>
|
* [ doc ] add a example
|
apache/incubator-weex
|
960da8a8c4e4e3ab03be0f5815bec25173854879
|
2016-04-13T12:52:06Z
|
mmm a / lib / AST / ASTScopeCreation . cpp <nl> ppp b / lib / AST / ASTScopeCreation . cpp <nl> class ScopeCreator final { <nl> <nl> ScopeCreator ( SourceFile * SF ) <nl> : ctx ( SF - > getASTContext ( ) ) , <nl> - sourceFileScope ( new ( ctx ) ASTSourceFileScope ( SF , this ) ) { } <nl> + sourceFileScope ( new ( ctx ) ASTSourceFileScope ( SF , this ) ) { <nl> + ctx . addDestructorCleanup ( scopedNodes ) ; <nl> + } <nl> <nl> ScopeCreator ( const ScopeCreator & ) = delete ; / / ensure no copies <nl> ScopeCreator ( const ScopeCreator & & ) = delete ; / / ensure no moves <nl> class ScopeCreator final { <nl> <nl> / / Make vanilla new illegal for ASTScopes . <nl> void * operator new ( size_t bytes ) = delete ; <nl> - / / Need this because have virtual destructors <nl> - void operator delete ( void * data ) { } <nl> <nl> / / Only allow allocation of scopes using the allocator of a particular source <nl> / / file . <nl>
|
Merge remote - tracking branch ' origin / master ' into master - rebranch
|
apple/swift
|
a4fc5f34f93cd80ad5ecb718d7c6b9f3e4ea2726
|
2019-08-24T07:43:42Z
|
mmm a / tests / cpp - tests / Classes / Sprite3DTest / Sprite3DTest . cpp <nl> ppp b / tests / cpp - tests / Classes / Sprite3DTest / Sprite3DTest . cpp <nl> void Effect3DOutline : : setOutlineColor ( const Vec3 & color ) <nl> if ( _outlineColor ! = color ) <nl> { <nl> _outlineColor = color ; <nl> - _glProgramState - > setUniformVec3 ( " OutLineColor " , _outlineColor ) ; <nl> + if ( _glProgramState ) <nl> + _glProgramState - > setUniformVec3 ( " OutLineColor " , _outlineColor ) ; <nl> } <nl> } <nl> <nl> void Effect3DOutline : : setOutlineWidth ( float width ) <nl> if ( _outlineWidth ! = width ) <nl> { <nl> _outlineWidth = width ; <nl> - _glProgramState - > setUniformFloat ( " OutlineWidth " , _outlineWidth ) ; <nl> + if ( _glProgramState ) <nl> + _glProgramState - > setUniformFloat ( " OutlineWidth " , _outlineWidth ) ; <nl> } <nl> } <nl> <nl> void Sprite3DWithSkinOutlineTest : : addNewSpriteWithCoords ( Vec2 p ) <nl> auto sprite = EffectSprite3D : : createFromObjFileAndTexture ( fileName , " " ) ; <nl> <nl> Effect3DOutline * effect = Effect3DOutline : : create ( ) ; <nl> - sprite - > addEffect ( effect , - 1 ) ; <nl> effect - > setOutlineColor ( Vec3 ( 1 , 0 , 0 ) ) ; <nl> effect - > setOutlineWidth ( 0 . 01f ) ; <nl> + sprite - > addEffect ( effect , - 1 ) ; <nl> + <nl> <nl> Effect3DOutline * effect2 = Effect3DOutline : : create ( ) ; <nl> - sprite - > addEffect ( effect2 , - 2 ) ; <nl> effect2 - > setOutlineWidth ( 0 . 02f ) ; <nl> effect2 - > setOutlineColor ( Vec3 ( 1 , 1 , 0 ) ) ; <nl> + sprite - > addEffect ( effect2 , - 2 ) ; <nl> + <nl> <nl> sprite - > setScale ( 3 ) ; <nl> sprite - > setRotation3D ( Vec3 ( 0 , 180 , 0 ) ) ; <nl>
|
adjust SkinnedEffectCode
|
cocos2d/cocos2d-x
|
0dff45cfc226910315e2dc55ca4018b6ec3ac2e3
|
2014-08-12T01:51:03Z
|
mmm a / hphp / test / frameworks / composer . lock <nl> ppp b / hphp / test / frameworks / composer . lock <nl> <nl> { <nl> " _readme " : [ <nl> " This file locks the dependencies of your project to a known state " , <nl> - " Read more about it at http : / / getcomposer . org / doc / 01 - basic - usage . md # composer - lock - the - lock - file " , <nl> + " Read more about it at https : / / getcomposer . org / doc / 01 - basic - usage . md # composer - lock - the - lock - file " , <nl> " This file is @ generated automatically " <nl> ] , <nl> " hash " : " c5cdf6bd1cdc6fe5f051698eed8da277 " , <nl> <nl> " constructor " , <nl> " instantiate " <nl> ] , <nl> + " abandoned " : " doctrine / instantiator " , <nl> " time " : " 2014 - 10 - 04 23 : 28 : 28 " <nl> } , <nl> { <nl> <nl> } , <nl> { <nl> " name " : " phpunit / dbunit " , <nl> - " version " : " 1 . 3 . 1 " , <nl> + " version " : " 1 . 3 . 2 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / sebastianbergmann / dbunit . git " , <nl> - " reference " : " a5891b7a9c4f21587a51f9bc4e8f7042b741b480 " <nl> + " reference " : " 1507040c2541bdffd7fbd71fc792cecdea6a7c61 " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / dbunit / zipball / a5891b7a9c4f21587a51f9bc4e8f7042b741b480 " , <nl> - " reference " : " a5891b7a9c4f21587a51f9bc4e8f7042b741b480 " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / dbunit / zipball / 1507040c2541bdffd7fbd71fc792cecdea6a7c61 " , <nl> + " reference " : " 1507040c2541bdffd7fbd71fc792cecdea6a7c61 " , <nl> " shasum " : " " <nl> } , <nl> " require " : { <nl> " ext - pdo " : " * " , <nl> " ext - simplexml " : " * " , <nl> " php " : " > = 5 . 3 . 3 " , <nl> - " phpunit / phpunit " : " > = 3 . 7 . 0 @ stable " , <nl> - " symfony / yaml " : " > = 2 . 1 . 0 " <nl> + " phpunit / phpunit " : " ~ 3 . 7 | ~ 4 . 0 " , <nl> + " symfony / yaml " : " ~ 2 . 1 " <nl> } , <nl> " bin " : [ <nl> " composer / bin / dbunit " <nl> <nl> " testing " , <nl> " xunit " <nl> ] , <nl> - " time " : " 2014 - 03 - 26 11 : 25 : 06 " <nl> + " time " : " 2015 - 03 - 29 14 : 23 : 04 " <nl> } , <nl> { <nl> " name " : " phpunit / php - code - coverage " , <nl> - " version " : " 2 . 0 . 13 " , <nl> + " version " : " 2 . 2 . 2 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / sebastianbergmann / php - code - coverage . git " , <nl> - " reference " : " 0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5 " <nl> + " reference " : " 2d7c03c0e4e080901b8f33b2897b0577be18a13c " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / php - code - coverage / zipball / 0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5 " , <nl> - " reference " : " 0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5 " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / php - code - coverage / zipball / 2d7c03c0e4e080901b8f33b2897b0577be18a13c " , <nl> + " reference " : " 2d7c03c0e4e080901b8f33b2897b0577be18a13c " , <nl> " shasum " : " " <nl> } , <nl> " require " : { <nl> <nl> " phpunit / php - file - iterator " : " ~ 1 . 3 " , <nl> " phpunit / php - text - template " : " ~ 1 . 2 " , <nl> " phpunit / php - token - stream " : " ~ 1 . 3 " , <nl> - " sebastian / environment " : " ~ 1 . 0 " , <nl> + " sebastian / environment " : " ^ 1 . 3 . 2 " , <nl> " sebastian / version " : " ~ 1 . 0 " <nl> } , <nl> " require - dev " : { <nl> " ext - xdebug " : " > = 2 . 1 . 4 " , <nl> - " phpunit / phpunit " : " ~ 4 . 1 " <nl> + " phpunit / phpunit " : " ~ 4 " <nl> } , <nl> " suggest " : { <nl> " ext - dom " : " * " , <nl> <nl> " type " : " library " , <nl> " extra " : { <nl> " branch - alias " : { <nl> - " dev - master " : " 2 . 0 . x - dev " <nl> + " dev - master " : " 2 . 2 . x - dev " <nl> } <nl> } , <nl> " autoload " : { <nl> <nl> ] <nl> } , <nl> " notification - url " : " https : / / packagist . org / downloads / " , <nl> - " include - path " : [ <nl> - " " <nl> - ] , <nl> " license " : [ <nl> " BSD - 3 - Clause " <nl> ] , <nl> <nl> " testing " , <nl> " xunit " <nl> ] , <nl> - " time " : " 2014 - 12 - 03 06 : 41 : 44 " <nl> + " time " : " 2015 - 08 - 04 03 : 42 : 39 " <nl> } , <nl> { <nl> " name " : " phpunit / php - file - iterator " , <nl> <nl> } , <nl> { <nl> " name " : " phpunit / php - invoker " , <nl> - " version " : " 1 . 1 . 3 " , <nl> + " version " : " 1 . 1 . 4 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / sebastianbergmann / php - invoker . git " , <nl> - " reference " : " 8696484458cb43eed025ab46260846de5b74655c " <nl> + " reference " : " 86074bf0fc2caf02ec8819a93f65a37cd0b44c8e " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / php - invoker / zipball / 8696484458cb43eed025ab46260846de5b74655c " , <nl> - " reference " : " 8696484458cb43eed025ab46260846de5b74655c " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / php - invoker / zipball / 86074bf0fc2caf02ec8819a93f65a37cd0b44c8e " , <nl> + " reference " : " 86074bf0fc2caf02ec8819a93f65a37cd0b44c8e " , <nl> " shasum " : " " <nl> } , <nl> " require " : { <nl> " ext - pcntl " : " * " , <nl> - " php " : " > = 5 . 2 . 7 " , <nl> - " phpunit / php - timer " : " > = 1 . 0 . 4 , < 1 . 1 . 0 " <nl> + " php " : " > = 5 . 3 . 3 " , <nl> + " phpunit / php - timer " : " > = 1 . 0 . 6 " <nl> + } , <nl> + " require - dev " : { <nl> + " phpunit / phpunit " : " ~ 4 " <nl> } , <nl> " type " : " library " , <nl> " autoload " : { <nl> " classmap " : [ <nl> - " PHP / " <nl> + " src / " <nl> ] <nl> } , <nl> " notification - url " : " https : / / packagist . org / downloads / " , <nl> - " include - path " : [ <nl> - " " <nl> - ] , <nl> " license " : [ <nl> " BSD - 3 - Clause " <nl> ] , <nl> " authors " : [ <nl> { <nl> " name " : " Sebastian Bergmann " , <nl> - " email " : " sb @ sebastian - bergmann . de " , <nl> + " email " : " sebastian @ phpunit . de " , <nl> " role " : " lead " <nl> } <nl> ] , <nl> <nl> " keywords " : [ <nl> " process " <nl> ] , <nl> - " time " : " 2013 - 07 - 16 05 : 20 : 21 " <nl> + " time " : " 2015 - 06 - 21 13 : 32 : 55 " <nl> } , <nl> { <nl> " name " : " phpunit / php - text - template " , <nl> - " version " : " 1 . 2 . 0 " , <nl> + " version " : " 1 . 2 . 1 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / sebastianbergmann / php - text - template . git " , <nl> - " reference " : " 206dfefc0ffe9cebf65c413e3d0e809c82fbf00a " <nl> + " reference " : " 31f8b717e51d9a2afca6c9f046f5d69fc27c8686 " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / php - text - template / zipball / 206dfefc0ffe9cebf65c413e3d0e809c82fbf00a " , <nl> - " reference " : " 206dfefc0ffe9cebf65c413e3d0e809c82fbf00a " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / php - text - template / zipball / 31f8b717e51d9a2afca6c9f046f5d69fc27c8686 " , <nl> + " reference " : " 31f8b717e51d9a2afca6c9f046f5d69fc27c8686 " , <nl> " shasum " : " " <nl> } , <nl> " require " : { <nl> <nl> " type " : " library " , <nl> " autoload " : { <nl> " classmap " : [ <nl> - " Text / " <nl> + " src / " <nl> ] <nl> } , <nl> " notification - url " : " https : / / packagist . org / downloads / " , <nl> - " include - path " : [ <nl> - " " <nl> - ] , <nl> " license " : [ <nl> " BSD - 3 - Clause " <nl> ] , <nl> " authors " : [ <nl> { <nl> " name " : " Sebastian Bergmann " , <nl> - " email " : " sb @ sebastian - bergmann . de " , <nl> + " email " : " sebastian @ phpunit . de " , <nl> " role " : " lead " <nl> } <nl> ] , <nl> <nl> " keywords " : [ <nl> " template " <nl> ] , <nl> - " time " : " 2014 - 01 - 30 17 : 20 : 04 " <nl> + " time " : " 2015 - 06 - 21 13 : 50 : 34 " <nl> } , <nl> { <nl> " name " : " phpunit / php - timer " , <nl> - " version " : " 1 . 0 . 5 " , <nl> + " version " : " 1 . 0 . 7 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / sebastianbergmann / php - timer . git " , <nl> - " reference " : " 19689d4354b295ee3d8c54b4f42c3efb69cbc17c " <nl> + " reference " : " 3e82f4e9fc92665fafd9157568e4dcb01d014e5b " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / php - timer / zipball / 19689d4354b295ee3d8c54b4f42c3efb69cbc17c " , <nl> - " reference " : " 19689d4354b295ee3d8c54b4f42c3efb69cbc17c " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / php - timer / zipball / 3e82f4e9fc92665fafd9157568e4dcb01d014e5b " , <nl> + " reference " : " 3e82f4e9fc92665fafd9157568e4dcb01d014e5b " , <nl> " shasum " : " " <nl> } , <nl> " require " : { <nl> <nl> " type " : " library " , <nl> " autoload " : { <nl> " classmap " : [ <nl> - " PHP / " <nl> + " src / " <nl> ] <nl> } , <nl> " notification - url " : " https : / / packagist . org / downloads / " , <nl> - " include - path " : [ <nl> - " " <nl> - ] , <nl> " license " : [ <nl> " BSD - 3 - Clause " <nl> ] , <nl> <nl> " keywords " : [ <nl> " timer " <nl> ] , <nl> - " time " : " 2013 - 08 - 02 07 : 42 : 54 " <nl> + " time " : " 2015 - 06 - 21 08 : 01 : 12 " <nl> } , <nl> { <nl> " name " : " phpunit / php - token - stream " , <nl> - " version " : " 1 . 3 . 0 " , <nl> + " version " : " 1 . 4 . 6 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / sebastianbergmann / php - token - stream . git " , <nl> - " reference " : " f8d5d08c56de5cfd592b3340424a81733259a876 " <nl> + " reference " : " 3ab72c62e550370a6cd5dc873e1a04ab57562f5b " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / php - token - stream / zipball / f8d5d08c56de5cfd592b3340424a81733259a876 " , <nl> - " reference " : " f8d5d08c56de5cfd592b3340424a81733259a876 " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / php - token - stream / zipball / 3ab72c62e550370a6cd5dc873e1a04ab57562f5b " , <nl> + " reference " : " 3ab72c62e550370a6cd5dc873e1a04ab57562f5b " , <nl> " shasum " : " " <nl> } , <nl> " require " : { <nl> <nl> " type " : " library " , <nl> " extra " : { <nl> " branch - alias " : { <nl> - " dev - master " : " 1 . 3 - dev " <nl> + " dev - master " : " 1 . 4 - dev " <nl> } <nl> } , <nl> " autoload " : { <nl> <nl> " keywords " : [ <nl> " tokenizer " <nl> ] , <nl> - " time " : " 2014 - 08 - 31 06 : 12 : 13 " <nl> + " time " : " 2015 - 08 - 16 08 : 51 : 00 " <nl> } , <nl> { <nl> " name " : " phpunit / phpunit " , <nl> <nl> " version " : " 1 . 0 . 2 " , <nl> " source " : { <nl> " type " : " git " , <nl> - " url " : " https : / / github . com / sebastianbergmann / phpunit - story . git " , <nl> + " url " : " https : / / github . com / phpunit / phpunit - story . git " , <nl> " reference " : " b8579ada6ede4fd2f4b49e8549a8a176606cae68 " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / phpunit - story / zipball / b8579ada6ede4fd2f4b49e8549a8a176606cae68 " , <nl> + " url " : " https : / / api . github . com / repos / phpunit / phpunit - story / zipball / b8579ada6ede4fd2f4b49e8549a8a176606cae68 " , <nl> " reference " : " b8579ada6ede4fd2f4b49e8549a8a176606cae68 " , <nl> " shasum " : " " <nl> } , <nl> <nl> } , <nl> { <nl> " name " : " sebastian / comparator " , <nl> - " version " : " 1 . 1 . 0 " , <nl> + " version " : " 1 . 2 . 0 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / sebastianbergmann / comparator . git " , <nl> - " reference " : " c484a80f97573ab934e37826dba0135a3301b26a " <nl> + " reference " : " 937efb279bd37a375bcadf584dec0726f84dbf22 " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / comparator / zipball / c484a80f97573ab934e37826dba0135a3301b26a " , <nl> - " reference " : " c484a80f97573ab934e37826dba0135a3301b26a " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / comparator / zipball / 937efb279bd37a375bcadf584dec0726f84dbf22 " , <nl> + " reference " : " 937efb279bd37a375bcadf584dec0726f84dbf22 " , <nl> " shasum " : " " <nl> } , <nl> " require " : { <nl> " php " : " > = 5 . 3 . 3 " , <nl> - " sebastian / diff " : " ~ 1 . 1 " , <nl> - " sebastian / exporter " : " ~ 1 . 0 " <nl> + " sebastian / diff " : " ~ 1 . 2 " , <nl> + " sebastian / exporter " : " ~ 1 . 2 " <nl> } , <nl> " require - dev " : { <nl> - " phpunit / phpunit " : " ~ 4 . 1 " <nl> + " phpunit / phpunit " : " ~ 4 . 4 " <nl> } , <nl> " type " : " library " , <nl> " extra " : { <nl> " branch - alias " : { <nl> - " dev - master " : " 1 . 1 . x - dev " <nl> + " dev - master " : " 1 . 2 . x - dev " <nl> } <nl> } , <nl> " autoload " : { <nl> <nl> " compare " , <nl> " equality " <nl> ] , <nl> - " time " : " 2014 - 11 - 16 21 : 32 : 38 " <nl> + " time " : " 2015 - 07 - 26 15 : 48 : 44 " <nl> } , <nl> { <nl> " name " : " sebastian / diff " , <nl> - " version " : " 1 . 2 . 0 " , <nl> + " version " : " 1 . 3 . 0 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / sebastianbergmann / diff . git " , <nl> - " reference " : " 5843509fed39dee4b356a306401e9dd1a931fec7 " <nl> + " reference " : " 863df9687835c62aa423a22412d26fa2ebde3fd3 " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / diff / zipball / 5843509fed39dee4b356a306401e9dd1a931fec7 " , <nl> - " reference " : " 5843509fed39dee4b356a306401e9dd1a931fec7 " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / diff / zipball / 863df9687835c62aa423a22412d26fa2ebde3fd3 " , <nl> + " reference " : " 863df9687835c62aa423a22412d26fa2ebde3fd3 " , <nl> " shasum " : " " <nl> } , <nl> " require " : { <nl> <nl> " type " : " library " , <nl> " extra " : { <nl> " branch - alias " : { <nl> - " dev - master " : " 1 . 2 - dev " <nl> + " dev - master " : " 1 . 3 - dev " <nl> } <nl> } , <nl> " autoload " : { <nl> <nl> " keywords " : [ <nl> " diff " <nl> ] , <nl> - " time " : " 2014 - 08 - 15 10 : 29 : 00 " <nl> + " time " : " 2015 - 02 - 22 15 : 13 : 53 " <nl> } , <nl> { <nl> " name " : " sebastian / environment " , <nl> - " version " : " 1 . 2 . 1 " , <nl> + " version " : " 1 . 3 . 2 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / sebastianbergmann / environment . git " , <nl> - " reference " : " 6e6c71d918088c251b181ba8b3088af4ac336dd7 " <nl> + " reference " : " 6324c907ce7a52478eeeaede764f48733ef5ae44 " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / environment / zipball / 6e6c71d918088c251b181ba8b3088af4ac336dd7 " , <nl> - " reference " : " 6e6c71d918088c251b181ba8b3088af4ac336dd7 " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / environment / zipball / 6324c907ce7a52478eeeaede764f48733ef5ae44 " , <nl> + " reference " : " 6324c907ce7a52478eeeaede764f48733ef5ae44 " , <nl> " shasum " : " " <nl> } , <nl> " require " : { <nl> " php " : " > = 5 . 3 . 3 " <nl> } , <nl> " require - dev " : { <nl> - " phpunit / phpunit " : " ~ 4 . 3 " <nl> + " phpunit / phpunit " : " ~ 4 . 4 " <nl> } , <nl> " type " : " library " , <nl> " extra " : { <nl> " branch - alias " : { <nl> - " dev - master " : " 1 . 2 . x - dev " <nl> + " dev - master " : " 1 . 3 . x - dev " <nl> } <nl> } , <nl> " autoload " : { <nl> <nl> " environment " , <nl> " hhvm " <nl> ] , <nl> - " time " : " 2014 - 10 - 25 08 : 00 : 45 " <nl> + " time " : " 2015 - 08 - 03 06 : 14 : 51 " <nl> } , <nl> { <nl> " name " : " sebastian / exporter " , <nl> - " version " : " 1 . 0 . 2 " , <nl> + " version " : " 1 . 2 . 1 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / sebastianbergmann / exporter . git " , <nl> - " reference " : " c7d59948d6e82818e1bdff7cadb6c34710eb7dc0 " <nl> + " reference " : " 7ae5513327cb536431847bcc0c10edba2701064e " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / exporter / zipball / c7d59948d6e82818e1bdff7cadb6c34710eb7dc0 " , <nl> - " reference " : " c7d59948d6e82818e1bdff7cadb6c34710eb7dc0 " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / exporter / zipball / 7ae5513327cb536431847bcc0c10edba2701064e " , <nl> + " reference " : " 7ae5513327cb536431847bcc0c10edba2701064e " , <nl> " shasum " : " " <nl> } , <nl> " require " : { <nl> - " php " : " > = 5 . 3 . 3 " <nl> + " php " : " > = 5 . 3 . 3 " , <nl> + " sebastian / recursion - context " : " ~ 1 . 0 " <nl> } , <nl> " require - dev " : { <nl> - " phpunit / phpunit " : " ~ 4 . 0 " <nl> + " phpunit / phpunit " : " ~ 4 . 4 " <nl> } , <nl> " type " : " library " , <nl> " extra " : { <nl> " branch - alias " : { <nl> - " dev - master " : " 1 . 0 . x - dev " <nl> + " dev - master " : " 1 . 2 . x - dev " <nl> } <nl> } , <nl> " autoload " : { <nl> <nl> " export " , <nl> " exporter " <nl> ] , <nl> - " time " : " 2014 - 09 - 10 00 : 51 : 36 " <nl> + " time " : " 2015 - 06 - 21 07 : 55 : 53 " <nl> + } , <nl> + { <nl> + " name " : " sebastian / recursion - context " , <nl> + " version " : " 1 . 0 . 1 " , <nl> + " source " : { <nl> + " type " : " git " , <nl> + " url " : " https : / / github . com / sebastianbergmann / recursion - context . git " , <nl> + " reference " : " 994d4a811bafe801fb06dccbee797863ba2792ba " <nl> + } , <nl> + " dist " : { <nl> + " type " : " zip " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / recursion - context / zipball / 994d4a811bafe801fb06dccbee797863ba2792ba " , <nl> + " reference " : " 994d4a811bafe801fb06dccbee797863ba2792ba " , <nl> + " shasum " : " " <nl> + } , <nl> + " require " : { <nl> + " php " : " > = 5 . 3 . 3 " <nl> + } , <nl> + " require - dev " : { <nl> + " phpunit / phpunit " : " ~ 4 . 4 " <nl> + } , <nl> + " type " : " library " , <nl> + " extra " : { <nl> + " branch - alias " : { <nl> + " dev - master " : " 1 . 0 . x - dev " <nl> + } <nl> + } , <nl> + " autoload " : { <nl> + " classmap " : [ <nl> + " src / " <nl> + ] <nl> + } , <nl> + " notification - url " : " https : / / packagist . org / downloads / " , <nl> + " license " : [ <nl> + " BSD - 3 - Clause " <nl> + ] , <nl> + " authors " : [ <nl> + { <nl> + " name " : " Jeff Welch " , <nl> + " email " : " whatthejeff @ gmail . com " <nl> + } , <nl> + { <nl> + " name " : " Sebastian Bergmann " , <nl> + " email " : " sebastian @ phpunit . de " <nl> + } , <nl> + { <nl> + " name " : " Adam Harvey " , <nl> + " email " : " aharvey @ php . net " <nl> + } <nl> + ] , <nl> + " description " : " Provides functionality to recursively process PHP variables " , <nl> + " homepage " : " http : / / www . github . com / sebastianbergmann / recursion - context " , <nl> + " time " : " 2015 - 06 - 21 08 : 04 : 50 " <nl> } , <nl> { <nl> " name " : " sebastian / version " , <nl> - " version " : " 1 . 0 . 3 " , <nl> + " version " : " 1 . 0 . 6 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / sebastianbergmann / version . git " , <nl> - " reference " : " b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43 " <nl> + " reference " : " 58b3a85e7999757d6ad81c787a1fbf5ff6c628c6 " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / sebastianbergmann / version / zipball / b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43 " , <nl> - " reference " : " b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43 " , <nl> + " url " : " https : / / api . github . com / repos / sebastianbergmann / version / zipball / 58b3a85e7999757d6ad81c787a1fbf5ff6c628c6 " , <nl> + " reference " : " 58b3a85e7999757d6ad81c787a1fbf5ff6c628c6 " , <nl> " shasum " : " " <nl> } , <nl> " type " : " library " , <nl> <nl> ] , <nl> " description " : " Library that helps with managing the version number of Git - hosted PHP projects " , <nl> " homepage " : " https : / / github . com / sebastianbergmann / version " , <nl> - " time " : " 2014 - 03 - 07 15 : 35 : 33 " <nl> + " time " : " 2015 - 06 - 21 13 : 59 : 46 " <nl> } , <nl> { <nl> " name " : " symfony / yaml " , <nl> - " version " : " v2 . 6 . 1 " , <nl> - " target - dir " : " Symfony / Component / Yaml " , <nl> + " version " : " v2 . 7 . 3 " , <nl> " source " : { <nl> " type " : " git " , <nl> " url " : " https : / / github . com / symfony / Yaml . git " , <nl> - " reference " : " 3346fc090a3eb6b53d408db2903b241af51dcb20 " <nl> + " reference " : " 71340e996171474a53f3d29111d046be4ad8a0ff " <nl> } , <nl> " dist " : { <nl> " type " : " zip " , <nl> - " url " : " https : / / api . github . com / repos / symfony / Yaml / zipball / 3346fc090a3eb6b53d408db2903b241af51dcb20 " , <nl> - " reference " : " 3346fc090a3eb6b53d408db2903b241af51dcb20 " , <nl> + " url " : " https : / / api . github . com / repos / symfony / Yaml / zipball / 71340e996171474a53f3d29111d046be4ad8a0ff " , <nl> + " reference " : " 71340e996171474a53f3d29111d046be4ad8a0ff " , <nl> " shasum " : " " <nl> } , <nl> " require " : { <nl> - " php " : " > = 5 . 3 . 3 " <nl> + " php " : " > = 5 . 3 . 9 " <nl> + } , <nl> + " require - dev " : { <nl> + " symfony / phpunit - bridge " : " ~ 2 . 7 " <nl> } , <nl> " type " : " library " , <nl> " extra " : { <nl> " branch - alias " : { <nl> - " dev - master " : " 2 . 6 - dev " <nl> + " dev - master " : " 2 . 7 - dev " <nl> } <nl> } , <nl> " autoload " : { <nl> - " psr - 0 " : { <nl> + " psr - 4 " : { <nl> " Symfony \ \ Component \ \ Yaml \ \ " : " " <nl> } <nl> } , <nl> <nl> " MIT " <nl> ] , <nl> " authors " : [ <nl> - { <nl> - " name " : " Symfony Community " , <nl> - " homepage " : " http : / / symfony . com / contributors " <nl> - } , <nl> { <nl> " name " : " Fabien Potencier " , <nl> " email " : " fabien @ symfony . com " <nl> + } , <nl> + { <nl> + " name " : " Symfony Community " , <nl> + " homepage " : " https : / / symfony . com / contributors " <nl> } <nl> ] , <nl> " description " : " Symfony Yaml Component " , <nl> - " homepage " : " http : / / symfony . com " , <nl> - " time " : " 2014 - 12 - 02 20 : 19 : 20 " <nl> + " homepage " : " https : / / symfony . com " , <nl> + " time " : " 2015 - 07 - 28 14 : 07 : 07 " <nl> } <nl> ] , <nl> " packages - dev " : [ ] , <nl> <nl> " minimum - stability " : " stable " , <nl> " stability - flags " : [ ] , <nl> " prefer - stable " : false , <nl> + " prefer - lowest " : false , <nl> " platform " : [ ] , <nl> " platform - dev " : [ ] <nl> } <nl> mmm a / hphp / test / frameworks / run . php <nl> ppp b / hphp / test / frameworks / run . php <nl> function get_unit_testing_infra_dependencies ( ) : void { <nl> } <nl> } <nl> <nl> - $ checksum = md5 ( serialize ( [ <nl> - / / Use both in case composer . json has been changed , but the lock file <nl> - / / hasn ' t been updated yet . <nl> - file_get_contents ( __DIR__ . ' / composer . json ' ) , <nl> - file_get_contents ( __DIR__ . ' / composer . lock ' ) , <nl> - ] ) ) ; <nl> + <nl> + / / Use both in case composer . json has been changed , but the lock file <nl> + / / hasn ' t been updated yet . <nl> + $ checksum = md5 ( file_get_contents ( __DIR__ . ' / composer . json ' ) ) ; <nl> + $ checksum . = ' - ' ; <nl> + $ checksum . = md5 ( file_get_contents ( __DIR__ . ' / composer . lock ' ) ) ; <nl> $ stamp_file = __DIR__ . ' / vendor / ' . $ checksum . ' . stamp ' ; <nl> if ( file_exists ( $ stamp_file ) ) { <nl> return ; <nl>
|
Include composer . lock and composer . json md5 in vendor cache filename
|
facebook/hhvm
|
aeae3613184a634605bdea25474e524108b6d31a
|
2015-09-08T17:30:23Z
|
mmm a / folly / io / async / Request . cpp <nl> ppp b / folly / io / async / Request . cpp <nl> <nl> <nl> # include < folly / MapUtil . h > <nl> # include < folly / SingletonThreadLocal . h > <nl> - # include < folly / portability / GFlags . h > <nl> <nl> DEFINE_bool ( <nl> - reqctx_use_hazptr , <nl> + folly_reqctx_use_hazptr , <nl> false , <nl> " RequestContext implementation using hazard pointers " ) ; <nl> <nl> RequestContext : : StateHazptr : : Combined * RequestContext : : StateHazptr : : expand ( <nl> } <nl> <nl> RequestContext : : RequestContext ( ) <nl> - : useHazptr_ ( FLAGS_reqctx_use_hazptr ) , <nl> + : useHazptr_ ( FLAGS_folly_reqctx_use_hazptr ) , <nl> rootId_ ( reinterpret_cast < intptr_t > ( this ) ) { } <nl> <nl> RequestContext : : RequestContext ( const RequestContext & ctx , RootTag ) <nl> mmm a / folly / io / async / Request . h <nl> ppp b / folly / io / async / Request . h <nl> <nl> <nl> # include < folly / Synchronized . h > <nl> # include < folly / container / F14Map . h > <nl> + # include < folly / portability / GFlags . h > <nl> # include < folly / sorted_vector_types . h > <nl> # include < folly / synchronization / Hazptr . h > <nl> <nl> <nl> # include < mutex > <nl> # include < string > <nl> <nl> + DECLARE_bool ( folly_reqctx_use_hazptr ) ; <nl> + <nl> namespace folly { <nl> <nl> / * <nl>
|
RequestContext : Declare gflag , add folly_ prefix to gflag name
|
facebook/folly
|
ba225d4b04dcf7963053aa7e451898fbfdb96cd1
|
2020-01-03T05:29:04Z
|
mmm a / tensorflow / lite / delegates / gpu / cl / kernels / convolution_transposed_3x3_thin . cc <nl> ppp b / tensorflow / lite / delegates / gpu / cl / kernels / convolution_transposed_3x3_thin . cc <nl> std : : string GenerateConvolutionTransposedCode ( <nl> const OperationDef & op_def , const LinearStorage & biases , int src_depth , <nl> int dst_depth , const CLDevice & device , <nl> const std : : vector < ElementwiseOperation * > & linked_operations ) { <nl> - TensorCodeGenerator src_tensor ( " src_data " , " src_size " , op_def . src_tensors [ 0 ] ) ; <nl> - TensorCodeGenerator dst_tensor ( " dst_data " , " dst_size " , op_def . dst_tensors [ 0 ] ) ; <nl> + const TensorCodeGenerator : : SizeVariablesNames src_size ( <nl> + " src_size . x " , " src_size . y " , " src_size . z " , " src_size . w " ) ; <nl> + const TensorCodeGenerator : : SizeVariablesNames dst_size ( <nl> + " dst_size . x " , " dst_size . y " , " dst_size . z " , " dst_size . w " ) ; <nl> + TensorCodeGenerator src_tensor ( " src_data " , src_size , op_def . src_tensors [ 0 ] ) ; <nl> + TensorCodeGenerator dst_tensor ( " dst_data " , dst_size , op_def . dst_tensors [ 0 ] ) ; <nl> const auto src_tensor_type = op_def . src_tensors [ 0 ] . storage_type ; <nl> <nl> + const std : : string batch_id = op_def . batch_support ? " B " : " " ; <nl> std : : string c = GetCommonDefines ( op_def . precision ) ; <nl> <nl> switch ( op_def . precision ) { <nl> std : : string GenerateConvolutionTransposedCode ( <nl> c + = " int4 src_size , \ n " ; <nl> c + = " int4 dst_size \ n " ; <nl> c + = " ) { \ n " ; <nl> - c + = " int X = get_global_id ( 0 ) ; \ n " ; <nl> + if ( op_def . batch_support ) { <nl> + c + = " int X = get_global_id ( 0 ) / dst_size . w ; \ n " ; <nl> + c + = " int B = get_global_id ( 0 ) % dst_size . w ; \ n " ; <nl> + } else { <nl> + c + = " int X = get_global_id ( 0 ) ; \ n " ; <nl> + } <nl> c + = " int Y = get_global_id ( 1 ) ; \ n " ; <nl> c + = " if ( X > = src_size . x | | Y > = src_size . y ) return ; \ n " ; <nl> for ( int d = 0 ; d < dst_depth ; + + d ) { <nl> std : : string GenerateConvolutionTransposedCode ( <nl> if ( src_tensor_type = = TensorStorageType : : BUFFER ) { <nl> c + = " bool x_in = X + 1 < src_size . x ; \ n " ; <nl> c + = " bool y_in = Y + 1 < src_size . y ; \ n " ; <nl> - c + = " FLT4 src0 = " + src_tensor . Read3D ( " X " , " Y " , z ) + " ; \ n " ; <nl> + c + = " FLT4 src0 = " + src_tensor . Read4D ( " X " , " Y " , z , batch_id ) + " ; \ n " ; <nl> c + = " FLT4 src1 = ( FLT4 ) ( 0 . 0 ) ; \ n " ; <nl> c + = " FLT4 src2 = ( FLT4 ) ( 0 . 0 ) ; \ n " ; <nl> c + = " FLT4 src3 = ( FLT4 ) ( 0 . 0 ) ; \ n " ; <nl> c + = " if ( x_in ) { \ n " ; <nl> - c + = " src1 = " + src_tensor . Read3D ( " X + 1 " , " Y " , z ) + " ; \ n " ; <nl> + c + = " src1 = " + src_tensor . Read4D ( " X + 1 " , " Y " , z , batch_id ) + " ; \ n " ; <nl> c + = " } \ n " ; <nl> c + = " if ( y_in ) { \ n " ; <nl> - c + = " src2 = " + src_tensor . Read3D ( " X " , " Y + 1 " , z ) + " ; \ n " ; <nl> + c + = " src2 = " + src_tensor . Read4D ( " X " , " Y + 1 " , z , batch_id ) + " ; \ n " ; <nl> c + = " } \ n " ; <nl> c + = " if ( x_in & & y_in ) { \ n " ; <nl> - c + = " src3 = " + src_tensor . Read3D ( " X + 1 " , " Y + 1 " , z ) + " ; \ n " ; <nl> + c + = " src3 = " + src_tensor . Read4D ( " X + 1 " , " Y + 1 " , z , batch_id ) + <nl> + " ; \ n " ; <nl> c + = " } \ n " ; <nl> } else if ( src_tensor_type = = TensorStorageType : : IMAGE_BUFFER ) { <nl> - c + = " " + src_tensor . GetAddress ( " c0 " , " X " , " Y " , z ) + " ; \ n " ; <nl> - c + = " " + src_tensor . GetAddress ( " c1 " , " X + 1 " , " Y " , z ) + " ; \ n " ; <nl> - c + = " " + src_tensor . GetAddress ( " c2 " , " X " , " Y + 1 " , z ) + " ; \ n " ; <nl> - c + = " " + src_tensor . GetAddress ( " c3 " , " X + 1 " , " Y + 1 " , z ) + " ; \ n " ; <nl> + c + = " " + src_tensor . GetAddress ( " c0 " , " X " , " Y " , z , batch_id ) + " ; \ n " ; <nl> + c + = <nl> + " " + src_tensor . GetAddress ( " c1 " , " X + 1 " , " Y " , z , batch_id ) + " ; \ n " ; <nl> + c + = <nl> + " " + src_tensor . GetAddress ( " c2 " , " X " , " Y + 1 " , z , batch_id ) + " ; \ n " ; <nl> + c + = " " + src_tensor . GetAddress ( " c3 " , " X + 1 " , " Y + 1 " , z , batch_id ) + <nl> + " ; \ n " ; <nl> c + = " bool x_in = X + 1 < src_size . x ; \ n " ; <nl> c + = " bool y_in = Y + 1 < src_size . y ; \ n " ; <nl> c + = " c1 = select ( - 1 , c1 , x_in ) ; \ n " ; <nl> std : : string GenerateConvolutionTransposedCode ( <nl> c + = " FLT4 src3 = " + src_tensor . Read ( " c3 " ) + " ; \ n " ; <nl> } else { <nl> const auto mode = GetFastestZeroMode ( device ) ; <nl> - c + = " FLT4 src0 = " + src_tensor . Read3D ( " X " , " Y " , z , mode ) + " ; \ n " ; <nl> - c + = " FLT4 src1 = " + src_tensor . Read3D ( " X + 1 " , " Y " , z , mode ) + " ; \ n " ; <nl> - c + = " FLT4 src2 = " + src_tensor . Read3D ( " X " , " Y + 1 " , z , mode ) + " ; \ n " ; <nl> - c + = " FLT4 src3 = " + src_tensor . Read3D ( " X + 1 " , " Y + 1 " , z , mode ) + <nl> + c + = " FLT4 src0 = " + src_tensor . Read4D ( " X " , " Y " , z , batch_id , mode ) + <nl> " ; \ n " ; <nl> + c + = " FLT4 src1 = " + <nl> + src_tensor . Read4D ( " X + 1 " , " Y " , z , batch_id , mode ) + " ; \ n " ; <nl> + c + = " FLT4 src2 = " + <nl> + src_tensor . Read4D ( " X " , " Y + 1 " , z , batch_id , mode ) + " ; \ n " ; <nl> + c + = " FLT4 src3 = " + <nl> + src_tensor . Read4D ( " X + 1 " , " Y + 1 " , z , batch_id , mode ) + " ; \ n " ; <nl> } <nl> for ( int d = 0 ; d < dst_depth ; + + d ) { <nl> const std : : string layer = std : : to_string ( d ) ; <nl> std : : string GenerateConvolutionTransposedCode ( <nl> c + = " FLT4 bias_val = " + biases . ReadLinearFLT4 ( layer ) + " ; \ n " ; <nl> for ( int y = 0 ; y < 2 ; + + y ) { <nl> for ( int x = 0 ; x < 2 ; + + x ) { <nl> + const std : : string x_coord = " X + " + std : : to_string ( x ) ; <nl> + const std : : string y_coord = " Y + " + std : : to_string ( y ) ; <nl> c + = " { \ n " ; <nl> c + = " FLT4 result = TO_FLT4 ( r " + layer + " [ " + std : : to_string ( y ) + <nl> " ] [ " + std : : to_string ( x ) + " ] ) + bias_val ; \ n " ; <nl> - const LinkingContext context { " result " , " X + " + std : : to_string ( x ) , <nl> - " Y + " + std : : to_string ( y ) , layer } ; <nl> + const std : : string x_3dcoord = op_def . batch_support <nl> + ? " ( " + x_coord + " ) * dst_size . w + B " <nl> + : x_coord ; <nl> + const LinkingContext context { " result " , x_3dcoord , y_coord , layer } ; <nl> c + = PostProcess ( linked_operations , context ) ; <nl> c + = " " + <nl> - dst_tensor . Write3D ( " result " , context . x_coord , context . y_coord , <nl> - context . z_coord ) + <nl> + dst_tensor . Write4D ( " result " , x_coord , y_coord , layer , batch_id ) + <nl> " \ n " ; <nl> c + = " } \ n " ; <nl> } <nl> Status ConvolutionTransposed3x3Thin : : BindArguments ( ) { <nl> RETURN_IF_ERROR ( kernel_ . SetMemoryAuto ( biases_ . GetMemoryPtr ( ) ) ) ; <nl> RETURN_IF_ERROR ( BindArgs ( & kernel_ , linked_operations_ ) ) ; <nl> RETURN_IF_ERROR ( kernel_ . SetMemoryAuto ( dst_ [ 0 ] - > GetMemoryPtrForWriting ( ) ) ) ; <nl> - RETURN_IF_ERROR ( kernel_ . SetBytesAuto ( src_ [ 0 ] - > GetSizeWithDepth ( ) ) ) ; <nl> - RETURN_IF_ERROR ( kernel_ . SetBytesAuto ( dst_ [ 0 ] - > GetSizeWithDepth ( ) ) ) ; <nl> + RETURN_IF_ERROR ( kernel_ . SetBytesAuto ( src_ [ 0 ] - > GetWHDB ( ) ) ) ; <nl> + RETURN_IF_ERROR ( kernel_ . SetBytesAuto ( dst_ [ 0 ] - > GetWHDB ( ) ) ) ; <nl> return OkStatus ( ) ; <nl> } <nl> <nl> int3 ConvolutionTransposed3x3Thin : : GetGridSize ( ) const { <nl> - const int grid_x = src_ [ 0 ] - > Width ( ) ; <nl> + const int grid_x = src_ [ 0 ] - > Width ( ) * dst_ [ 0 ] - > Batch ( ) ; <nl> const int grid_y = src_ [ 0 ] - > Height ( ) ; <nl> const int grid_z = 1 ; <nl> return int3 ( grid_x , grid_y , grid_z ) ; <nl> bool IsConvolutionTransposed3x3ThinSupported ( <nl> return attr . weights . shape . o < = 8 & & attr . weights . shape . w = = 3 & & <nl> attr . weights . shape . h = = 3 & & attr . stride . w = = 2 & & <nl> attr . stride . h = = 2 & & attr . padding . prepended . w = = 1 & & <nl> - attr . padding . prepended . h = = 1 ; <nl> + attr . padding . prepended . h = = 1 & & attr . padding . appended . w = = 1 & & <nl> + attr . padding . appended . h = = 1 ; <nl> } <nl> <nl> Status CreateConvolutionTransposed3x3Thin ( <nl>
|
Batch support for ConvolutionTransposed3x3Thin .
|
tensorflow/tensorflow
|
3d67cb7f83a6de891ed0ce1c0e06b74af38a40e3
|
2019-10-09T06:24:52Z
|
mmm a / tensorflow / core / kernels / conv_3d . h <nl> ppp b / tensorflow / core / kernels / conv_3d . h <nl> struct CuboidConvolution ; <nl> template < typename Device , typename T > <nl> struct CuboidConvolutionBackwardInput ; <nl> <nl> + / / Backward filter pass for the cuboid convolution . <nl> + template < typename Device , typename T > <nl> + struct CuboidConvolutionBackwardFilter ; <nl> + <nl> typedef Eigen : : ThreadPoolDevice CPUDevice ; <nl> <nl> template < typename T > <nl> struct CuboidConvolutionBackwardInput < CPUDevice , T > { <nl> } <nl> } ; <nl> <nl> + template < typename T > <nl> + struct CuboidConvolutionBackwardFilter < CPUDevice , T > { <nl> + void operator ( ) ( const CPUDevice & d , <nl> + typename TTypes < T , 5 > : : Tensor filter_backward , <nl> + typename TTypes < T , 5 > : : ConstTensor input , <nl> + typename TTypes < T , 5 > : : ConstTensor output_backward , <nl> + int stride_planes , int stride_rows , int stride_cols ) { <nl> + / / Need to swap the order of plane / row / col strides when calling Eigen . <nl> + filter_backward . device ( d ) = Eigen : : CuboidConvolutionBackwardKernel ( <nl> + input , output_backward , <nl> + filter_backward . dimension ( 2 ) , / / kernel_planes <nl> + filter_backward . dimension ( 1 ) , / / kernel_rows <nl> + filter_backward . dimension ( 0 ) , / / kernel_cols <nl> + stride_cols , stride_rows , stride_planes ) ; <nl> + } <nl> + } ; <nl> + <nl> } / / namespace functor <nl> } / / namespace tensorflow <nl> <nl> mmm a / tensorflow / core / kernels / conv_grad_ops_3d . cc <nl> ppp b / tensorflow / core / kernels / conv_grad_ops_3d . cc <nl> class Conv3DBackpropFilterOp : public OpKernel { <nl> return ; <nl> } <nl> <nl> - / / For the backprop of the filter , we need to also transpose the <nl> - / / out_backprop . <nl> - / / The shape of backprop is <nl> - / / [ batch , out_z , out_y , out_x , out_depth ] <nl> - / / And we need to change it to <nl> - / / [ out_depth , out_x , out_y , out_z , batch ] <nl> - Eigen : : DSizes < Eigen : : DenseIndex , 5 > out_order { 4 , 1 , 2 , 3 , 0 } ; <nl> - TensorShape padded_out_shape ( { out_depth , padded_out_planes , padded_out_rows , <nl> - padded_out_cols , batch } ) ; <nl> - Tensor padded_output ; <nl> - OP_REQUIRES_OK ( context , <nl> - context - > allocate_temp ( DataTypeToEnum < T > : : v ( ) , <nl> - padded_out_shape , & padded_output ) ) ; <nl> - Eigen : : DSizes < Eigen : : DenseIndex , 5 > eigen_strides { 1 , strides [ 0 ] , strides [ 1 ] , <nl> - strides [ 2 ] , 1 } ; <nl> - functor : : InflatePadAndShuffle < Device , T , 5 , Eigen : : DenseIndex > ( ) ( <nl> - context - > eigen_device < Device > ( ) , out_backprop . tensor < T , 5 > ( ) , <nl> - eigen_strides , pad_dims , out_order , padded_output . tensor < T , 5 > ( ) ) ; <nl> - const Tensor & padded_output_cref = padded_output ; <nl> - <nl> - / / For the backprop of the filter , we need to transpose the input . <nl> - / / The shape of input is <nl> - / / [ batch , in_z , in_y , in_x , in_depth ] <nl> - / / And we need to change it to <nl> - / / [ in_z , in_y , in_x , batch , in_depth ] <nl> - Eigen : : DSizes < Eigen : : DenseIndex , 5 > in_order { 1 , 2 , 3 , 0 , 4 } ; <nl> - TensorShape in_shuffle_shape ( <nl> - { input_size [ 0 ] , input_size [ 1 ] , input_size [ 2 ] , batch , in_depth } ) ; <nl> - Tensor in_shuffle ; <nl> - OP_REQUIRES_OK ( context , <nl> - context - > allocate_temp ( DataTypeToEnum < T > : : v ( ) , <nl> - in_shuffle_shape , & in_shuffle ) ) ; <nl> - / / No need for reversing this time . <nl> - Eigen : : array < bool , 5 > no_reverse { false , false , false , false , false } ; <nl> - functor : : ShuffleAndReverse < Device , T , 5 , Eigen : : DenseIndex > ( ) ( <nl> - context - > eigen_device < Device > ( ) , input . tensor < T , 5 > ( ) , in_order , <nl> - no_reverse , in_shuffle . tensor < T , 5 > ( ) ) ; <nl> - const Tensor & in_shuffle_cref = in_shuffle ; <nl> - <nl> - / / The output of the conv_3d would be <nl> - / / [ out_depth , filter_size [ 2 ] , filter_size [ 1 ] , filter_size [ 0 ] , in_depth ] <nl> - / / and we need to shuffle it back to <nl> - / / [ filter_size [ 2 ] , filter_size [ 1 ] , filter_size [ 0 ] , in_depth , out_depth ] ; <nl> - / / And we need to reverse the filter backprops . <nl> - / / So we need to allocate ( sigh ) yet another piece of memory to hold the <nl> - / / output . <nl> - TensorShape filter_shuffle_shape ( <nl> - { out_depth , filter_size [ 0 ] , filter_size [ 1 ] , filter_size [ 2 ] , in_depth } ) ; <nl> - Tensor filter_shuffle ; <nl> - OP_REQUIRES_OK ( <nl> - context , context - > allocate_temp ( DataTypeToEnum < T > : : v ( ) , <nl> - filter_shuffle_shape , & filter_shuffle ) ) ; <nl> - functor : : CuboidConvolution < Device , T > ( ) ( <nl> - context - > eigen_device < Device > ( ) , filter_shuffle . tensor < T , 5 > ( ) , <nl> - padded_output_cref . tensor < T , 5 > ( ) , in_shuffle_cref . tensor < T , 5 > ( ) , 1 , 1 , <nl> - 1 , BrainPadding2EigenPadding ( VALID ) ) ; <nl> - <nl> - / / Now copy the filter_backprop back to the destination . <nl> - Eigen : : DSizes < Eigen : : DenseIndex , 5 > filter_order { 1 , 2 , 3 , 4 , 0 } ; <nl> - Eigen : : array < bool , 5 > filter_rev_dims { true , true , true , false , false } ; <nl> - const Tensor & filter_shuffle_cref = filter_shuffle ; <nl> - functor : : ShuffleAndReverse < Device , T , 5 , Eigen : : DenseIndex > ( ) ( <nl> - context - > eigen_device < Device > ( ) , filter_shuffle_cref . tensor < T , 5 > ( ) , <nl> - filter_order , filter_rev_dims , filter_backprop - > tensor < T , 5 > ( ) ) ; <nl> + / / There is no need to explicitly compute padding values ( and pad <nl> + / / out_backprop ) , because Eigen uses the same padding inference mechanism as <nl> + / / Tensorflow . <nl> + functor : : CuboidConvolutionBackwardFilter < Device , T > ( ) ( <nl> + context - > eigen_device < Device > ( ) , <nl> + filter_backprop - > tensor < T , 5 > ( ) , / / filter_backward <nl> + input . tensor < T , 5 > ( ) , / / input <nl> + out_backprop . tensor < T , 5 > ( ) , / / output_backward <nl> + / / Order of strides will be reversed before passing to Eigen . <nl> + static_cast < int > ( strides [ 0 ] ) , / / stride_planes <nl> + static_cast < int > ( strides [ 1 ] ) , / / stride_rows <nl> + static_cast < int > ( strides [ 2 ] ) ) ; / / stride_cols <nl> } <nl> <nl> private : <nl> mmm a / tensorflow / core / kernels / eigen_backward_cuboid_convolutions . h <nl> ppp b / tensorflow / core / kernels / eigen_backward_cuboid_convolutions . h <nl> EIGEN_ALWAYS_INLINE static const typename internal : : conditional < <nl> const array < <nl> typename internal : : traits < OutputBackward > : : Index , 5 > , <nl> const TensorReverseOp < const Eigen : : array < bool , 5 > , <nl> - const Kernel > > > > , <nl> + const Kernel > > > > , <nl> const TensorReshapingOp < <nl> const DSizes < typename internal : : traits < OutputBackward > : : Index , <nl> 2 > , <nl> const TensorVolumePatchOp < Dynamic , Dynamic , Dynamic , <nl> - const OutputBackward > > > > , <nl> + const OutputBackward > > > > , <nl> TensorReshapingOp < <nl> const DSizes < typename internal : : traits < OutputBackward > : : Index , <nl> internal : : traits < OutputBackward > : : NumDimensions > , <nl> EIGEN_ALWAYS_INLINE static const typename internal : : conditional < <nl> const DSizes < typename internal : : traits < OutputBackward > : : Index , <nl> 2 > , <nl> const TensorVolumePatchOp < Dynamic , Dynamic , Dynamic , <nl> - const OutputBackward > > , <nl> + const OutputBackward > > , <nl> const Eigen : : TensorForcedEvalOp < const TensorReshapingOp < <nl> const DSizes < typename internal : : traits < OutputBackward > : : Index , <nl> 2 > , <nl> EIGEN_ALWAYS_INLINE static const typename internal : : conditional < <nl> const array < <nl> typename internal : : traits < OutputBackward > : : Index , 5 > , <nl> const TensorReverseOp < const Eigen : : array < bool , 5 > , <nl> - const Kernel > > > > > > > : : type <nl> + const Kernel > > > > > > > : : type <nl> CuboidConvolutionBackwardInput ( <nl> const Kernel & kernel , const OutputBackward & output_backward , <nl> typename internal : : traits < OutputBackward > : : Index inputPlanes , <nl> CuboidConvolutionBackwardInput ( <nl> typedef typename internal : : traits < OutputBackward > : : Index TensorIndex ; <nl> const TensorRef < const Tensor < typename internal : : traits < Kernel > : : Scalar , <nl> internal : : traits < Kernel > : : NumDimensions , <nl> - internal : : traits < Kernel > : : Layout , TensorIndex > > <nl> + internal : : traits < Kernel > : : Layout , TensorIndex > > <nl> kern ( kernel ) ; <nl> const TensorRef < <nl> const Tensor < typename internal : : traits < OutputBackward > : : Scalar , <nl> internal : : traits < OutputBackward > : : NumDimensions , <nl> - internal : : traits < OutputBackward > : : Layout , TensorIndex > > <nl> + internal : : traits < OutputBackward > : : Layout , TensorIndex > > <nl> out ( output_backward ) ; <nl> <nl> EIGEN_STATIC_ASSERT ( internal : : traits < Kernel > : : Layout = = <nl> CuboidConvolutionBackwardInput ( <nl> * / <nl> template < typename OutputBackward , typename Input > <nl> EIGEN_ALWAYS_INLINE static const typename internal : : conditional < <nl> - internal : : traits < OutputBackward > : : Layout = = ColMajor , <nl> - TensorReshapingOp < <nl> - const DSizes < typename internal : : traits < Input > : : Index , 5 > , <nl> - const TensorContractionOp < <nl> - const array < IndexPair < typename internal : : traits < Input > : : Index > , 1 > , <nl> - const TensorReshapingOp < <nl> - const DSizes < typename internal : : traits < Input > : : Index , 2 > , <nl> - const OutputBackward > , <nl> - const TensorReshapingOp < <nl> - const DSizes < typename internal : : traits < Input > : : Index , 2 > , <nl> - const TensorVolumePatchOp < Dynamic , Dynamic , Dynamic , <nl> - const Input > > > > , <nl> - TensorReshapingOp < <nl> - const DSizes < typename internal : : traits < Input > : : Index , 5 > , <nl> - const TensorContractionOp < <nl> - const array < IndexPair < typename internal : : traits < Input > : : Index > , 1 > , <nl> - const TensorReshapingOp < <nl> - const DSizes < typename internal : : traits < Input > : : Index , 2 > , <nl> - const TensorVolumePatchOp < Dynamic , Dynamic , Dynamic , <nl> - const Input > > , <nl> - const TensorReshapingOp < <nl> - const DSizes < typename internal : : traits < Input > : : Index , 2 > , <nl> - const OutputBackward > > > > : : type <nl> + internal : : traits < Input > : : Layout = = ColMajor , <nl> + const TensorReverseOp < <nl> + const Eigen : : array < typename internal : : traits < Input > : : Index , <nl> + internal : : traits < Input > : : NumDimensions > , <nl> + const Eigen : : TensorShufflingOp < <nl> + const Eigen : : array < typename internal : : traits < Input > : : Index , <nl> + internal : : traits < Input > : : NumDimensions > , <nl> + const Eigen : : TensorReshapingOp < <nl> + const Eigen : : DSizes < typename internal : : traits < Input > : : Index , <nl> + internal : : traits < Input > : : NumDimensions > , <nl> + const TensorContractionOp < <nl> + const array < <nl> + IndexPair < typename internal : : traits < Input > : : Index > , 1 > , <nl> + const Eigen : : TensorForcedEvalOp < const TensorReshapingOp < <nl> + const DSizes < typename internal : : traits < Input > : : Index , <nl> + 2 > , <nl> + const Eigen : : TensorShufflingOp < <nl> + const Eigen : : array < <nl> + typename internal : : traits < Input > : : Index , <nl> + internal : : traits < Input > : : NumDimensions > , <nl> + const OutputBackward > > > , <nl> + const TensorReshapingOp < <nl> + const DSizes < typename internal : : traits < Input > : : Index , <nl> + 2 > , <nl> + const TensorVolumePatchOp < <nl> + Dynamic , Dynamic , Dynamic , <nl> + const Eigen : : TensorForcedEvalOp < <nl> + const Eigen : : TensorShufflingOp < <nl> + const Eigen : : array < <nl> + typename internal : : traits < Input > : : Index , <nl> + internal : : traits < Input > : : NumDimensions > , <nl> + const Input > > > > > > > > , <nl> + const TensorReverseOp < <nl> + const Eigen : : array < typename internal : : traits < Input > : : Index , <nl> + internal : : traits < Input > : : NumDimensions > , <nl> + const Eigen : : TensorShufflingOp < <nl> + const Eigen : : array < typename internal : : traits < Input > : : Index , <nl> + internal : : traits < Input > : : NumDimensions > , <nl> + const Eigen : : TensorReshapingOp < <nl> + const Eigen : : DSizes < typename internal : : traits < Input > : : Index , <nl> + internal : : traits < Input > : : NumDimensions > , <nl> + const TensorContractionOp < <nl> + const array < <nl> + IndexPair < typename internal : : traits < Input > : : Index > , 1 > , <nl> + const TensorReshapingOp < <nl> + const DSizes < typename internal : : traits < Input > : : Index , <nl> + 2 > , <nl> + const TensorVolumePatchOp < <nl> + Dynamic , Dynamic , Dynamic , <nl> + const Eigen : : TensorForcedEvalOp < <nl> + const Eigen : : TensorShufflingOp < <nl> + const Eigen : : array < <nl> + typename internal : : traits < Input > : : Index , <nl> + internal : : traits < Input > : : NumDimensions > , <nl> + const Input > > > > , <nl> + const Eigen : : TensorForcedEvalOp < const TensorReshapingOp < <nl> + const DSizes < typename internal : : traits < Input > : : Index , <nl> + 2 > , <nl> + const Eigen : : TensorShufflingOp < <nl> + const Eigen : : array < <nl> + typename internal : : traits < Input > : : Index , <nl> + internal : : traits < Input > : : NumDimensions > , <nl> + const OutputBackward > > > > > > > > : : type <nl> CuboidConvolutionBackwardKernel ( <nl> const Input & input , const OutputBackward & output_backward , <nl> typename internal : : traits < Input > : : Index kernelPlanes , <nl> CuboidConvolutionBackwardKernel ( <nl> typedef typename internal : : traits < Input > : : Index TensorIndex ; <nl> TensorRef < Tensor < typename internal : : traits < Input > : : Scalar , <nl> internal : : traits < Input > : : NumDimensions , <nl> - internal : : traits < Input > : : Layout , TensorIndex > > <nl> + internal : : traits < Input > : : Layout , TensorIndex > > <nl> in ( input ) ; <nl> TensorRef < Tensor < typename internal : : traits < OutputBackward > : : Scalar , <nl> internal : : traits < OutputBackward > : : NumDimensions , <nl> - internal : : traits < OutputBackward > : : Layout , TensorIndex > > <nl> + internal : : traits < OutputBackward > : : Layout , TensorIndex > > <nl> out ( output_backward ) ; <nl> <nl> EIGEN_STATIC_ASSERT ( internal : : traits < Input > : : Layout = = <nl> CuboidConvolutionBackwardKernel ( <nl> internal : : traits < OutputBackward > : : NumDimensions , <nl> YOU_MADE_A_PROGRAMMING_MISTAKE ) ; <nl> <nl> + / / We do not support higher dimensional backward convolutions , or convolutions <nl> + / / without batch dimension . <nl> + / / TODO ( ezhulenev ) : Relax this constraint , and turn on tests without batch <nl> + / / dimension in eigen_backward_cuboid_convolutions_test . cc . <nl> + EIGEN_STATIC_ASSERT ( internal : : traits < Input > : : NumDimensions = = 5 , <nl> + YOU_MADE_A_PROGRAMMING_MISTAKE ) ; <nl> + <nl> const TensorIndex inputPlanes = <nl> isColMajor ? in . dimension ( 1 ) : in . dimension ( NumDims - 2 ) ; <nl> const TensorIndex inputRows = <nl> CuboidConvolutionBackwardKernel ( <nl> const TensorIndex kernelChannels = <nl> isColMajor ? in . dimension ( 0 ) : in . dimension ( NumDims - 1 ) ; <nl> <nl> + / / Number of batches in the input tensor . <nl> + const TensorIndex batch = <nl> + isColMajor ? in . dimension ( 4 ) : in . dimension ( NumDims - 5 ) ; <nl> + <nl> / / TODO ( ezhulenev ) : Add support for inflated strides . Without inflated strides <nl> / / effective kernel planes / rows / cols are always the same as the kernel itself <nl> / / ( see eigen_spatial_convolutions for details ) . <nl> CuboidConvolutionBackwardKernel ( <nl> const TensorIndex kernelRowsEff = kernelRows ; <nl> const TensorIndex kernelColsEff = kernelCols ; <nl> <nl> + / / Compute forward padding from input and output_backward dimensions . <nl> const TensorIndex padPlanes = numext : : maxi < Index > ( <nl> 0 , ( outputPlanes - 1 ) * stridePlanes + kernelPlanesEff - inputPlanes ) ; <nl> const TensorIndex padRows = numext : : maxi < Index > ( <nl> CuboidConvolutionBackwardKernel ( <nl> 0 , ( outputCols - 1 ) * strideCols + kernelColsEff - inputCols ) ; <nl> <nl> const TensorIndex padding_top_z = padPlanes / 2 ; <nl> - const TensorIndex padding_bottom_z = padPlanes - padding_top_z ; <nl> const TensorIndex padding_top = padRows / 2 ; <nl> - const TensorIndex padding_bottom = padRows - padding_top ; <nl> const TensorIndex padding_left = padCols / 2 ; <nl> - const TensorIndex padding_right = padCols - padding_left ; <nl> <nl> - / / Reshaped output_backward before contraction . <nl> - DSizes < TensorIndex , 2 > output_dims ; <nl> + / / Compute paddings for output_backward before extracting patches . <nl> + const auto expanded_out_planes = ( outputPlanes - 1 ) * stridePlanes + 1 ; <nl> + const auto expanded_out_rows = ( outputRows - 1 ) * strideRows + 1 ; <nl> + const auto expanded_out_cols = ( outputCols - 1 ) * strideCols + 1 ; <nl> + const auto padded_out_planes = inputPlanes + kernelPlanes - 1 ; <nl> + const auto padded_out_rows = inputRows + kernelRows - 1 ; <nl> + const auto padded_out_cols = inputCols + kernelCols - 1 ; <nl> + const auto top_pad_planes = kernelPlanes - 1 - padding_top_z ; <nl> + const auto top_pad_rows = kernelRows - 1 - padding_top ; <nl> + const auto left_pad_cols = kernelCols - 1 - padding_left ; <nl> + const auto bottom_pad_planes = <nl> + padded_out_planes - expanded_out_planes - top_pad_planes ; <nl> + const auto bottom_pad_rows = <nl> + padded_out_rows - expanded_out_rows - top_pad_rows ; <nl> + const auto right_pad_cols = <nl> + padded_out_cols - expanded_out_cols - left_pad_cols ; <nl> + <nl> + / / Reorder output_backward dimensions . <nl> + array < TensorIndex , 5 > output_backward_shuffle ; <nl> if ( isColMajor ) { <nl> - output_dims [ 0 ] = kernelFilters ; <nl> - output_dims [ 1 ] = outputPlanes * outputRows * outputCols ; <nl> - for ( int i = 4 ; i < NumDims ; + + i ) { <nl> - output_dims [ 1 ] * = out . dimension ( i ) ; <nl> - } <nl> + / / From : [ out_depth , out_planes , out_rows , out_cols , batch ] <nl> + / / To : [ batch , out_planes , out_rows , out_cols , out_depth ] <nl> + output_backward_shuffle = { 4 , 1 , 2 , 3 , 0 } ; <nl> } else { <nl> - output_dims [ 1 ] = kernelFilters ; <nl> - output_dims [ 0 ] = outputCols * outputRows * outputPlanes ; <nl> - for ( int i = 0 ; i < NumDims - 4 ; + + i ) { <nl> - output_dims [ 0 ] * = out . dimension ( i ) ; <nl> - } <nl> + / / From : [ batch , out_cols , out_rows , out_planes , out_depth ] <nl> + / / To : [ out_depth , out_cols , out_rows , out_planes , batch ] <nl> + output_backward_shuffle = { 4 , 1 , 2 , 3 , 0 } ; <nl> } <nl> <nl> - / / Reshaped extract_volume_patches ( in ) <nl> - DSizes < TensorIndex , 2 > pre_contract_dims ; <nl> + / / Reorder input dimensions . <nl> + array < TensorIndex , 5 > input_shuffle ; <nl> if ( isColMajor ) { <nl> - pre_contract_dims [ 0 ] = <nl> - kernelChannels * kernelPlanes * kernelRows * kernelCols ; <nl> - pre_contract_dims [ 1 ] = outputPlanes * outputRows * outputCols ; <nl> - for ( int i = 4 ; i < NumDims ; + + i ) { <nl> - pre_contract_dims [ 1 ] * = in . dimension ( i ) ; <nl> - } <nl> - eigen_assert ( output_dims [ 1 ] = = pre_contract_dims [ 1 ] ) ; <nl> + / / From : [ in_depth , in_planes , in_rows , in_cols , batch ] <nl> + / / To : [ in_depth , batch , in_planes , in_rows , in_cols ] <nl> + input_shuffle = { 0 , 4 , 1 , 2 , 3 } ; <nl> + } else { <nl> + / / From : [ batch , in_cols , in_rows , in_planes , in_depth ] <nl> + / / To : [ in_cols , in_rows , in_planes , batch , in_depth ] <nl> + input_shuffle = { 1 , 2 , 3 , 0 , 4 } ; <nl> + } <nl> + <nl> + / / Input is playing the role of a " kernel " in this convolution . <nl> + DSizes < TensorIndex , 2 > input_dims ; <nl> + if ( isColMajor ) { <nl> + input_dims [ 0 ] = kernelChannels ; <nl> + input_dims [ 1 ] = batch * inputPlanes * inputRows * inputCols ; <nl> } else { <nl> + input_dims [ 1 ] = kernelChannels ; <nl> + input_dims [ 0 ] = inputCols * inputRows * inputPlanes * batch ; <nl> + } <nl> + <nl> + / / Molds the output of the patch extraction result into a 2D tensor : <nl> + / / - the first dimension ( dims [ 0 ] ) : the patch values to be multiplied with the <nl> + / / kernels <nl> + / / - the second dimension ( dims [ 1 ] ) : everything else <nl> + DSizes < TensorIndex , 2 > pre_contract_dims ; <nl> + if ( isColMajor ) { <nl> + pre_contract_dims [ 0 ] = batch * inputPlanes * inputRows * inputCols ; <nl> pre_contract_dims [ 1 ] = <nl> - kernelCols * kernelRows * kernelPlanes * kernelChannels ; <nl> - pre_contract_dims [ 0 ] = outputCols * outputRows * outputPlanes ; <nl> - for ( int i = 0 ; i < NumDims - 4 ; + + i ) { <nl> - pre_contract_dims [ 0 ] * = in . dimension ( i ) ; <nl> - } <nl> - eigen_assert ( output_dims [ 0 ] = = pre_contract_dims [ 0 ] ) ; <nl> + kernelPlanes * kernelRows * kernelCols * kernelFilters ; <nl> + } else { <nl> + pre_contract_dims [ 1 ] = inputCols * inputRows * inputPlanes * batch ; <nl> + pre_contract_dims [ 0 ] = <nl> + kernelFilters * kernelCols * kernelRows * kernelPlanes ; <nl> } <nl> <nl> / / We will contract along the collapsed dimension that contains the <nl> - / / outputCols , outputRows , outputPlanes and OTHERS . <nl> + / / batch , inputPlanes , inputRows and inputCols . <nl> array < IndexPair < TensorIndex > , 1 > contract_dims ; <nl> + contract_dims [ 0 ] = IndexPair < TensorIndex > ( 1 , 0 ) ; <nl> + <nl> + / / Dimensions after contraction . <nl> + DSizes < TensorIndex , NumDims > post_contract_dims ; <nl> if ( isColMajor ) { <nl> - / / col - major : output_backward . contract ( input . patches ) <nl> - contract_dims [ 0 ] = IndexPair < TensorIndex > ( 1 , 1 ) ; <nl> + post_contract_dims [ 0 ] = kernelChannels ; <nl> + post_contract_dims [ 1 ] = kernelPlanes ; <nl> + post_contract_dims [ 2 ] = kernelRows ; <nl> + post_contract_dims [ 3 ] = kernelCols ; <nl> + post_contract_dims [ 4 ] = kernelFilters ; <nl> } else { <nl> - / / row - major : input . patches . contract ( output_backward ) <nl> - contract_dims [ 0 ] = IndexPair < TensorIndex > ( 0 , 0 ) ; <nl> + post_contract_dims [ 0 ] = kernelFilters ; <nl> + post_contract_dims [ 1 ] = kernelCols ; <nl> + post_contract_dims [ 2 ] = kernelRows ; <nl> + post_contract_dims [ 3 ] = kernelPlanes ; <nl> + post_contract_dims [ 4 ] = kernelChannels ; <nl> + } <nl> + <nl> + / / Reorder output of contraction to valid filter shape . <nl> + array < TensorIndex , 5 > kernel_shuffle ; <nl> + if ( isColMajor ) { <nl> + / / From : [ in_depth , kernel_planes , kernel_rows , kernel_cols , out_depth ] <nl> + / / To : [ out_depth , in_depth , kernel_planes , kernel_rows , kernel_cols ] <nl> + kernel_shuffle = { 4 , 0 , 1 , 2 , 3 } ; <nl> + } else { <nl> + / / From : [ out_depth , kernel_cols , kernel_rows , kernel_planes , in_depth ] <nl> + / / To : [ kernel_cols , kernel_rows , kernel_planes , in_depth , out_depth ] <nl> + kernel_shuffle = { 1 , 2 , 3 , 4 , 0 } ; <nl> } <nl> <nl> - DSizes < TensorIndex , 5 > kernel_dims ; <nl> + / / Reverse kernel backprop dimensions . <nl> + array < TensorIndex , 5 > kernel_reverse ; <nl> if ( isColMajor ) { <nl> - kernel_dims [ 0 ] = kernelFilters ; <nl> - kernel_dims [ 1 ] = kernelChannels ; <nl> - kernel_dims [ 2 ] = kernelPlanes ; <nl> - kernel_dims [ 3 ] = kernelRows ; <nl> - kernel_dims [ 4 ] = kernelCols ; <nl> + kernel_reverse = { false , false , true , true , true } ; <nl> } else { <nl> - kernel_dims [ 4 ] = kernelFilters ; <nl> - kernel_dims [ 3 ] = kernelChannels ; <nl> - kernel_dims [ 2 ] = kernelPlanes ; <nl> - kernel_dims [ 1 ] = kernelRows ; <nl> - kernel_dims [ 0 ] = kernelCols ; <nl> + kernel_reverse = { true , true , true , false , false } ; <nl> } <nl> <nl> - return choose ( <nl> - Cond < internal : : traits < Input > : : Layout = = ColMajor > ( ) , <nl> - output_backward . reshape ( output_dims ) <nl> - . contract ( input <nl> + / / Create convolution input ( aka source of patches ) from output backward <nl> + / / tensor by shuffling dimensions . <nl> + const auto the_input = <nl> + output_backward . shuffle ( output_backward_shuffle ) . eval ( ) ; <nl> + <nl> + / / Create convolution kernel ( aka filter ) from input by shuffling and <nl> + / / reshaping . <nl> + const auto the_kernel = <nl> + input . shuffle ( input_shuffle ) . reshape ( input_dims ) . eval ( ) ; <nl> + <nl> + return choose ( Cond < internal : : traits < Input > : : Layout = = ColMajor > ( ) , <nl> + the_kernel . contract ( <nl> + the_input <nl> . extract_volume_patches ( <nl> - kernelPlanes , kernelRows , kernelCols , stridePlanes , <nl> - strideRows , strideCols , 1 , 1 , 1 , padding_top_z , <nl> - padding_bottom_z , padding_top , padding_bottom , <nl> - padding_left , padding_right ) <nl> + inputPlanes , inputRows , inputCols , 1 , 1 , 1 , <nl> + stridePlanes , strideRows , strideCols , <nl> + top_pad_planes , bottom_pad_planes , top_pad_rows , <nl> + bottom_pad_rows , left_pad_cols , right_pad_cols ) <nl> . reshape ( pre_contract_dims ) , <nl> - contract_dims ) <nl> - . reshape ( kernel_dims ) , <nl> - input <nl> - . extract_volume_patches ( kernelPlanes , kernelRows , kernelCols , <nl> - stridePlanes , strideRows , strideCols , 1 , 1 , 1 , <nl> - padding_top_z , padding_bottom_z , padding_top , <nl> - padding_bottom , padding_left , padding_right ) <nl> - . reshape ( pre_contract_dims ) <nl> - . contract ( output_backward . reshape ( output_dims ) , contract_dims ) <nl> - . reshape ( kernel_dims ) ) ; <nl> + contract_dims ) , <nl> + the_input <nl> + . extract_volume_patches ( <nl> + inputPlanes , inputRows , inputCols , 1 , 1 , 1 , <nl> + stridePlanes , strideRows , strideCols , top_pad_planes , <nl> + bottom_pad_planes , top_pad_rows , bottom_pad_rows , <nl> + left_pad_cols , right_pad_cols ) <nl> + . reshape ( pre_contract_dims ) <nl> + . contract ( the_kernel , contract_dims ) ) <nl> + . reshape ( post_contract_dims ) <nl> + . shuffle ( kernel_shuffle ) <nl> + . reverse ( kernel_reverse ) ; <nl> } <nl> <nl> } / / end namespace Eigen <nl> mmm a / tensorflow / core / kernels / eigen_backward_spatial_convolutions_test . cc <nl> ppp b / tensorflow / core / kernels / eigen_backward_spatial_convolutions_test . cc <nl> TEST ( EigenBackwardSpatialConvolutionsTest , <nl> const int output_cols = input_cols - patch_cols + 1 ; <nl> const int output_planes = input_planes - patch_planes + 1 ; <nl> <nl> - Tensor < float , 4 > input ( input_depth , input_planes , input_rows , input_cols ) ; <nl> + / / TODO ( ezhulenev ) : Support backward kernel convolution without batch <nl> + / / dimension . <nl> + Tensor < float , 5 > input ( input_depth , input_planes , input_rows , input_cols , <nl> + / * num_batches * / 1 ) ; <nl> Tensor < float , 5 > kernel ( output_depth , input_depth , patch_planes , patch_rows , <nl> patch_cols ) ; <nl> - Tensor < float , 4 > output_backward ( output_depth , output_planes , output_rows , <nl> - output_cols ) ; <nl> + Tensor < float , 5 > output_backward ( output_depth , output_planes , output_rows , <nl> + output_cols , / * num_batches * / 1 ) ; <nl> <nl> output_backward = output_backward . constant ( 11 . 0f ) + output_backward . random ( ) ; <nl> input = input . constant ( 2 . 0f ) + input . random ( ) ; <nl> TEST ( EigenBackwardSpatialConvolutionsTest , <nl> if ( output_i > = 0 & & output_i < output_planes & & <nl> output_j > = 0 & & output_j < output_rows & & <nl> output_k > = 0 & & output_k < output_cols ) { <nl> - expected + = <nl> - input ( id , i , j , k ) * <nl> - output_backward ( od , output_i , output_j , output_k ) ; <nl> + expected + = input ( id , i , j , k , / * batch * / 0 ) * <nl> + output_backward ( od , output_i , output_j , <nl> + output_k , / * batch * / 0 ) ; <nl> } <nl> } <nl> } <nl> TEST ( EigenBackwardSpatialConvolutionsTest , <nl> const int output_cols = input_cols - patch_cols + 1 ; <nl> const int output_planes = input_planes - patch_planes + 1 ; <nl> <nl> - Tensor < float , 4 , RowMajor > input ( input_cols , input_rows , input_planes , <nl> - input_depth ) ; <nl> + / / TODO ( ezhulenev ) : Support backward kernel convolution without batch <nl> + / / dimension . <nl> + Tensor < float , 5 , RowMajor > input ( / * num_batches * / 1 , input_cols , input_rows , <nl> + input_planes , input_depth ) ; <nl> Tensor < float , 5 , RowMajor > kernel ( patch_cols , patch_rows , patch_planes , <nl> input_depth , output_depth ) ; <nl> - Tensor < float , 4 , RowMajor > output_backward ( output_cols , output_rows , <nl> - output_planes , output_depth ) ; <nl> + Tensor < float , 5 , RowMajor > output_backward ( <nl> + / * num_batches * / 1 , output_cols , output_rows , output_planes , output_depth ) ; <nl> <nl> output_backward = output_backward . constant ( 11 . 0f ) + output_backward . random ( ) ; <nl> input = input . constant ( 2 . 0f ) + input . random ( ) ; <nl> TEST ( EigenBackwardSpatialConvolutionsTest , <nl> if ( output_i > = 0 & & output_i < output_planes & & <nl> output_j > = 0 & & output_j < output_rows & & <nl> output_k > = 0 & & output_k < output_cols ) { <nl> - expected + = <nl> - input ( k , j , i , id ) * <nl> - output_backward ( output_k , output_j , output_i , od ) ; <nl> + expected + = input ( / * batch * / 0 , k , j , i , id ) * <nl> + output_backward ( / * batch * / 0 , output_k , output_j , <nl> + output_i , od ) ; <nl> } <nl> } <nl> } <nl>
|
Use Eigen : : CuboidConvolutionBackwardKernel in Conv3DBackpropFilter .
|
tensorflow/tensorflow
|
c2b3222ac552e9698968c9a212095dbc8b9ca40b
|
2018-09-12T21:21:00Z
|
mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> Type Solution : : getFixedType ( TypeVariableType * typeVar ) const { <nl> return knownBinding - > second ; <nl> } <nl> <nl> - Type Solution : : computeSubstitutions ( Type origType , DeclContext * dc , <nl> - Type openedType , <nl> - SmallVectorImpl < Substitution > & substitutions ) const { <nl> + Type Solution : : computeSubstitutions ( <nl> + Type origType , DeclContext * dc , <nl> + Type openedType , <nl> + ConstraintLocator * locator , <nl> + SmallVectorImpl < Substitution > & substitutions ) const { <nl> auto & tc = getConstraintSystem ( ) . getTypeChecker ( ) ; <nl> auto & ctx = tc . Context ; <nl> <nl> - / / Gather the substitutions from archetypes to concrete types , found <nl> - / / by identifying all of the type variables in the original type <nl> - / / FIXME : It ' s unfortunate that we ' re using archetypes here , but we don ' t <nl> - / / have another way to map from type variables back to dependent types ( yet ) ; <nl> + / / Gather the substitutions from dependent types to concrete types . <nl> + auto openedTypes = OpenedTypes . find ( locator ) ; <nl> + assert ( openedTypes ! = OpenedTypes . end ( ) & & " Missing opened type information " ) ; <nl> TypeSubstitutionMap typeSubstitutions ; <nl> + for ( const auto & opened : openedTypes - > second ) { <nl> + typeSubstitutions [ opened . first . getPointer ( ) ] = getFixedType ( opened . second ) ; <nl> + } <nl> + <nl> + / / Produce the concrete form of the opened type . <nl> auto type = openedType . transform ( [ & ] ( Type type ) - > Type { <nl> if ( auto tv = dyn_cast < TypeVariableType > ( type . getPointer ( ) ) ) { <nl> auto archetype = tv - > getImpl ( ) . getArchetype ( ) ; <nl> auto simplified = getFixedType ( tv ) ; <nl> - typeSubstitutions [ archetype ] = simplified ; <nl> return SubstitutedType : : get ( archetype , simplified , <nl> tc . Context ) ; <nl> } <nl> Type Solution : : computeSubstitutions ( Type origType , DeclContext * dc , <nl> <nl> / / Each witness marker starts a new substitution . <nl> currentArchetype = firstArchetype ; <nl> - currentReplacement = tc . substType ( currentModule , currentArchetype , <nl> + currentReplacement = tc . substType ( currentModule , req . getFirstType ( ) , <nl> typeSubstitutions ) ; <nl> break ; <nl> } <nl> namespace { <nl> Expr * base = TypeExpr : : createImplicitHack ( loc , baseTy , ctx ) ; <nl> auto result = buildMemberRef ( base , openedType , SourceLoc ( ) , decl , <nl> loc , openedFnType - > getResult ( ) , <nl> - locator , implicit , semantics ) ; <nl> + locator , locator , implicit , semantics ) ; <nl> if ( ! result ) <nl> return nullptr ; ; <nl> <nl> namespace { <nl> auto dc = decl - > getPotentialGenericDeclContext ( ) ; <nl> <nl> SmallVector < Substitution , 4 > substitutions ; <nl> - auto type = solution . computeSubstitutions ( genericFn , dc , openedType , <nl> - substitutions ) ; <nl> + auto type = solution . computeSubstitutions ( <nl> + genericFn , dc , openedType , <nl> + getConstraintSystem ( ) . getConstraintLocator ( locator ) , <nl> + substitutions ) ; <nl> return new ( ctx ) DeclRefExpr ( ConcreteDeclRef ( ctx , decl , substitutions ) , <nl> loc , implicit , semantics , type ) ; <nl> } <nl> namespace { <nl> Expr * buildMemberRef ( Expr * base , Type openedFullType , SourceLoc dotLoc , <nl> ValueDecl * member , SourceLoc memberLoc , <nl> Type openedType , ConstraintLocatorBuilder locator , <nl> + ConstraintLocatorBuilder memberLocator , <nl> bool Implicit , AccessSemantics semantics ) { <nl> auto & tc = cs . getTypeChecker ( ) ; <nl> auto & context = tc . Context ; <nl> namespace { <nl> <nl> / / Build a reference to the generic member . <nl> SmallVector < Substitution , 4 > substitutions ; <nl> - refTy = solution . computeSubstitutions ( member - > getInterfaceType ( ) , <nl> - dc , <nl> - openedFullType , <nl> - substitutions ) ; <nl> + refTy = solution . computeSubstitutions ( <nl> + member - > getInterfaceType ( ) , <nl> + dc , <nl> + openedFullType , <nl> + getConstraintSystem ( ) . getConstraintLocator ( memberLocator ) , <nl> + substitutions ) ; <nl> <nl> memberRef = ConcreteDeclRef ( context , member , substitutions ) ; <nl> <nl> namespace { <nl> SourceLoc dotLoc , ValueDecl * member , <nl> SourceLoc memberLoc , Type openedType , <nl> ConstraintLocatorBuilder locator , <nl> + ConstraintLocatorBuilder memberLocator , <nl> bool implicit , <nl> AccessSemantics semantics , <nl> Optional < UnavailabilityReason > reason ) { <nl> <nl> / / Let buildMemberRef ( ) do the heavy lifting . <nl> Expr * ref = buildMemberRef ( base , openedFullType , dotLoc , member , memberLoc , <nl> - openedType , locator , implicit , semantics ) ; <nl> + openedType , locator , memberLocator , implicit , <nl> + semantics ) ; <nl> <nl> / / Wrap in a conversion expression if the member reference <nl> / / may not be available . <nl> namespace { <nl> <nl> / / Compute the substitutions used to reference the subscript . <nl> SmallVector < Substitution , 4 > substitutions ; <nl> - solution . computeSubstitutions ( subscript - > getInterfaceType ( ) , <nl> - dc , <nl> - selected . openedFullType , <nl> - substitutions ) ; <nl> + solution . computeSubstitutions ( <nl> + subscript - > getInterfaceType ( ) , <nl> + dc , <nl> + selected . openedFullType , <nl> + getConstraintSystem ( ) . getConstraintLocator ( <nl> + locator . withPathElement ( ConstraintLocator : : SubscriptMember ) ) , <nl> + substitutions ) ; <nl> <nl> / / Convert the base . <nl> auto openedFullFnType = selected . openedFullType - > castTo < FunctionType > ( ) ; <nl> namespace { <nl> / / / \ brief Build a new reference to another constructor . <nl> Expr * buildOtherConstructorRef ( Type openedFullType , <nl> ConstructorDecl * ctor , SourceLoc loc , <nl> + ConstraintLocatorBuilder locator , <nl> bool isDelegating , <nl> bool implicit ) { <nl> auto & tc = cs . getTypeChecker ( ) ; <nl> namespace { <nl> ctor - > getInterfaceType ( ) , <nl> ctor , <nl> openedFullType , <nl> + getConstraintSystem ( ) . getConstraintLocator ( locator ) , <nl> substitutions ) ; <nl> <nl> ref = ConcreteDeclRef ( ctx , ctor , substitutions ) ; <nl> namespace { <nl> tc . Context ) ) ; <nl> <nl> auto memberRef = buildMemberRef ( <nl> - typeRef , choice . openedFullType , <nl> - segment - > getStartLoc ( ) , choice . choice . getDecl ( ) , <nl> - segment - > getStartLoc ( ) , choice . openedType , <nl> - locatorBuilder , / * Implicit = * / true , AccessSemantics : : Ordinary ) ; <nl> + typeRef , choice . openedFullType , <nl> + segment - > getStartLoc ( ) , choice . choice . getDecl ( ) , <nl> + segment - > getStartLoc ( ) , choice . openedType , <nl> + locator , locator , / * Implicit = * / true , <nl> + AccessSemantics : : Ordinary ) ; <nl> ApplyExpr * apply = <nl> new ( tc . Context ) CallExpr ( memberRef , arg , / * Implicit = * / true ) ; <nl> <nl> namespace { <nl> <nl> Expr * visitUnresolvedConstructorExpr ( UnresolvedConstructorExpr * expr ) { <nl> / / Resolve the callee to the constructor declaration selected . <nl> - auto selected = getOverloadChoice ( <nl> - cs . getConstraintLocator ( <nl> - expr , <nl> - ConstraintLocator : : ConstructorMember ) ) ; <nl> + auto ctorLocator = cs . getConstraintLocator ( <nl> + expr , <nl> + ConstraintLocator : : ConstructorMember ) ; <nl> + auto selected = getOverloadChoice ( ctorLocator ) ; <nl> auto choice = selected . choice ; <nl> auto * ctor = cast < ConstructorDecl > ( choice . getDecl ( ) ) ; <nl> <nl> namespace { <nl> expr - > getType ( ) , <nl> ConstraintLocatorBuilder ( <nl> cs . getConstraintLocator ( expr ) ) , <nl> + ctorLocator , <nl> expr - > isImplicit ( ) , <nl> AccessSemantics : : Ordinary ) ; <nl> } <nl> namespace { <nl> Expr * ctorRef = buildOtherConstructorRef ( <nl> selected . openedFullType , <nl> ctor , expr - > getConstructorLoc ( ) , <nl> + cs . getConstraintLocator ( <nl> + expr , <nl> + ConstraintLocator : : ConstructorMember ) , <nl> ! expr - > getSubExpr ( ) - > isSuperExpr ( ) , <nl> expr - > isImplicit ( ) ) ; <nl> auto * call <nl> namespace { <nl> } <nl> <nl> Expr * visitOverloadedMemberRefExpr ( OverloadedMemberRefExpr * expr ) { <nl> - auto selected = getOverloadChoice ( <nl> - cs . getConstraintLocator ( expr , <nl> - ConstraintLocator : : Member ) ) ; <nl> + auto memberLocator = cs . getConstraintLocator ( expr , <nl> + ConstraintLocator : : Member ) ; <nl> + auto selected = getOverloadChoice ( memberLocator ) ; <nl> return buildMemberRef ( expr - > getBase ( ) , <nl> selected . openedFullType , <nl> expr - > getDotLoc ( ) , <nl> selected . choice . getDecl ( ) , expr - > getMemberLoc ( ) , <nl> selected . openedType , <nl> cs . getConstraintLocator ( expr ) , <nl> + memberLocator , <nl> expr - > isImplicit ( ) , expr - > getAccessSemantics ( ) ) ; <nl> } <nl> <nl> namespace { <nl> } <nl> <nl> Expr * visitMemberRefExpr ( MemberRefExpr * expr ) { <nl> - auto selected = getOverloadChoice ( <nl> - cs . getConstraintLocator ( expr , <nl> - ConstraintLocator : : Member ) ) ; <nl> + auto memberLocator = cs . getConstraintLocator ( expr , <nl> + ConstraintLocator : : Member ) ; <nl> + auto selected = getOverloadChoice ( memberLocator ) ; <nl> Optional < UnavailabilityReason > reason ; <nl> if ( selected . choice . isPotentiallyUnavailable ( ) ) { <nl> reason = selected . choice . getReasonUnavailable ( cs ) ; <nl> namespace { <nl> selected . choice . getDecl ( ) , expr - > getNameLoc ( ) , <nl> selected . openedType , <nl> cs . getConstraintLocator ( expr ) , <nl> + memberLocator , <nl> expr - > isImplicit ( ) , <nl> expr - > getAccessSemantics ( ) , <nl> reason ) ; <nl> namespace { <nl> auto & tc = cs . getTypeChecker ( ) ; <nl> <nl> / / Find the selected member . <nl> - auto selected = getOverloadChoice ( <nl> - cs . getConstraintLocator ( <nl> - expr , ConstraintLocator : : UnresolvedMember ) ) ; <nl> + auto memberLocator = cs . getConstraintLocator ( <nl> + expr , ConstraintLocator : : UnresolvedMember ) ; <nl> + auto selected = getOverloadChoice ( memberLocator ) ; <nl> auto member = selected . choice . getDecl ( ) ; <nl> <nl> / / If the member came by optional unwrapping , then unwrap the base type . <nl> namespace { <nl> expr - > getNameLoc ( ) , <nl> selected . openedType , <nl> cs . getConstraintLocator ( expr ) , <nl> - expr - > isImplicit ( ) , AccessSemantics : : Ordinary ) ; <nl> + memberLocator , <nl> + expr - > isImplicit ( ) , <nl> + AccessSemantics : : Ordinary ) ; <nl> if ( ! result ) <nl> return nullptr ; <nl> <nl> namespace { <nl> SourceLoc nameLoc , <nl> bool implicit ) { <nl> / / Determine the declaration selected for this overloaded reference . <nl> - auto selected = getOverloadChoice ( <nl> - cs . getConstraintLocator ( <nl> - expr , <nl> - ConstraintLocator : : Member ) ) ; <nl> + auto memberLocator = cs . getConstraintLocator ( expr , <nl> + ConstraintLocator : : Member ) ; <nl> + auto selected = getOverloadChoice ( memberLocator ) ; <nl> <nl> Optional < UnavailabilityReason > reason ; <nl> if ( selected . choice . isPotentiallyUnavailable ( ) ) { <nl> namespace { <nl> nameLoc , <nl> selected . openedType , <nl> cs . getConstraintLocator ( expr ) , <nl> + memberLocator , <nl> implicit , <nl> AccessSemantics : : Ordinary , <nl> reason ) ; <nl> findDefaultArgsOwner ( ConstraintSystem & cs , const Solution & solution , <nl> Type openedType ) - > ConcreteDeclRef { <nl> if ( decl - > getPotentialGenericDeclContext ( ) - > isGenericContext ( ) ) { <nl> SmallVector < Substitution , 4 > subs ; <nl> - solution . computeSubstitutions ( decl - > getType ( ) , <nl> - decl - > getPotentialGenericDeclContext ( ) , <nl> - openedType , subs ) ; <nl> + solution . computeSubstitutions ( <nl> + decl - > getType ( ) , <nl> + decl - > getPotentialGenericDeclContext ( ) , <nl> + openedType , locator , subs ) ; <nl> return ConcreteDeclRef ( cs . getASTContext ( ) , decl , subs ) ; <nl> } <nl> <nl> Expr * ExprRewriter : : finishApply ( ApplyExpr * apply , Type openedType , <nl> / / enum element to use . <nl> assert ( ty - > getNominalOrBoundGenericNominal ( ) | | ty - > is < DynamicSelfType > ( ) | | <nl> ty - > hasDependentProtocolConformances ( ) ) ; <nl> - auto selected = getOverloadChoiceIfAvailable ( <nl> - cs . getConstraintLocator ( <nl> - locator . withPathElement ( <nl> - ConstraintLocator : : ConstructorMember ) ) ) ; <nl> + auto ctorLocator = cs . getConstraintLocator ( <nl> + locator . withPathElement ( <nl> + ConstraintLocator : : ConstructorMember ) ) ; <nl> + auto selected = getOverloadChoiceIfAvailable ( ctorLocator ) ; <nl> <nl> / / We have the constructor . <nl> auto choice = selected - > choice ; <nl> Expr * ExprRewriter : : finishApply ( ApplyExpr * apply , Type openedType , <nl> selected - > openedFullType , <nl> / * DotLoc = * / SourceLoc ( ) , <nl> decl , fn - > getEndLoc ( ) , <nl> - selected - > openedType , locator , <nl> + selected - > openedType , <nl> + locator , <nl> + ctorLocator , <nl> / * Implicit = * / true , AccessSemantics : : Ordinary ) ; <nl> declRef - > setImplicit ( apply - > isImplicit ( ) ) ; <nl> apply - > setFn ( declRef ) ; <nl> Expr * TypeChecker : : callWitness ( Expr * base , DeclContext * dc , <nl> auto memberRef = rewriter . buildMemberRef ( base , openedFullType , <nl> base - > getStartLoc ( ) , <nl> witness , base - > getEndLoc ( ) , <nl> - openedType , locator , <nl> + openedType , locator , locator , <nl> / * Implicit = * / true , <nl> AccessSemantics : : Ordinary ) ; <nl> <nl> mmm a / lib / Sema / CSGen . cpp <nl> ppp b / lib / Sema / CSGen . cpp <nl> namespace { <nl> locatorBuilder . withPathElement ( <nl> ConstraintLocator : : Member ) , <nl> / * options = * / 0 ) ; <nl> + / / / FIXME : ArrayElementType is a total hack here . <nl> auto dictionaryValueTy = CS . getMemberType ( dictionaryTy , <nl> valueAssocTy , <nl> locatorBuilder . withPathElement ( <nl> - ConstraintLocator : : Member ) , <nl> + ConstraintLocator : : ArrayElementType ) , <nl> / * options = * / 0 ) ; <nl> <nl> TupleTypeElt tupleElts [ 2 ] = { TupleTypeElt ( dictionaryKeyTy ) , <nl> mmm a / lib / Sema / CSSolver . cpp <nl> ppp b / lib / Sema / CSSolver . cpp <nl> Solution ConstraintSystem : : finalize ( <nl> solution . DisjunctionChoices . insert ( choice ) ; <nl> } <nl> <nl> + / / Remember the opened types . <nl> + for ( const auto & opened : OpenedTypes ) { <nl> + / / We shouldn ' t ever register opened types multiple times , <nl> + / / but saving and re - applying solutions can cause us to get <nl> + / / multiple entries . We should use an optimized PartialSolution <nl> + / / structure for that use case , which would optimize a lot of <nl> + / / stuff here . <nl> + assert ( ( solution . OpenedTypes . count ( opened . first ) = = 0 | | <nl> + solution . OpenedTypes [ opened . first ] = = opened . second ) <nl> + & & " Already recorded " ) ; <nl> + solution . OpenedTypes . insert ( opened ) ; <nl> + } <nl> + <nl> return std : : move ( solution ) ; <nl> } <nl> <nl> void ConstraintSystem : : applySolution ( const Solution & solution ) { <nl> DisjunctionChoices . push_back ( choice ) ; <nl> } <nl> <nl> + / / Register the solution ' s opened types . <nl> + for ( const auto & opened : solution . OpenedTypes ) { <nl> + OpenedTypes . push_back ( opened ) ; <nl> + } <nl> + <nl> / / Register any fixes produced along this path . <nl> Fixes . append ( solution . Fixes . begin ( ) , solution . Fixes . end ( ) ) ; <nl> } <nl> ConstraintSystem : : SolverScope : : SolverScope ( ConstraintSystem & cs ) <nl> numConstraintRestrictions = cs . ConstraintRestrictions . size ( ) ; <nl> numFixes = cs . Fixes . size ( ) ; <nl> numDisjunctionChoices = cs . DisjunctionChoices . size ( ) ; <nl> + numOpenedTypes = cs . OpenedTypes . size ( ) ; <nl> numGeneratedConstraints = cs . solverState - > generatedConstraints . size ( ) ; <nl> PreviousScore = cs . CurrentScore ; <nl> <nl> ConstraintSystem : : SolverScope : : ~ SolverScope ( ) { <nl> / / Remove any disjunction choices . <nl> truncate ( cs . DisjunctionChoices , numDisjunctionChoices ) ; <nl> <nl> + / / Remove any opened types . <nl> + truncate ( cs . OpenedTypes , numOpenedTypes ) ; <nl> + <nl> / / Reset the previous score . <nl> cs . CurrentScore = PreviousScore ; <nl> <nl> mmm a / lib / Sema / ConstraintLocator . cpp <nl> ppp b / lib / Sema / ConstraintLocator . cpp <nl> void ConstraintLocator : : dump ( SourceManager * sm , raw_ostream & out ) { <nl> case Archetype : <nl> out < < " archetype ' " < < elt . getArchetype ( ) - > getString ( ) < < " ' " ; <nl> break ; <nl> - <nl> + <nl> + case AssociatedType : <nl> + out < < " associated type ' " <nl> + < < elt . getAssociatedType ( ) - > getNameStr ( ) < < " ' " ; <nl> + break ; <nl> + <nl> case ApplyArgument : <nl> out < < " apply argument " ; <nl> break ; <nl> void ConstraintLocator : : dump ( SourceManager * sm , raw_ostream & out ) { <nl> out < < " function result " ; <nl> break ; <nl> <nl> + case GeneratorElementType : <nl> + out < < " generator element type " ; <nl> + break ; <nl> + <nl> case GenericArgument : <nl> out < < " generic argument # " < < llvm : : utostr ( elt . getValue ( ) ) ; <nl> break ; <nl> void ConstraintLocator : : dump ( SourceManager * sm , raw_ostream & out ) { <nl> out < < " scalar to tuple " ; <nl> break ; <nl> <nl> + case SequenceGeneratorType : <nl> + out < < " sequence generator type " ; <nl> + break ; <nl> + <nl> case SubscriptIndex : <nl> out < < " subscript index " ; <nl> break ; <nl> mmm a / lib / Sema / ConstraintLocator . h <nl> ppp b / lib / Sema / ConstraintLocator . h <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> / / / <nl> / / / Also contains the archetype itself . <nl> Archetype , <nl> + / / / An associated type reference . <nl> + / / / <nl> + / / / Contains the associated type itself . <nl> + AssociatedType , <nl> / / / \ brief The argument type of a function . <nl> FunctionArgument , <nl> / / / \ brief The result type of a function . <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> ParentType , <nl> / / / \ brief The instance of a metatype type . <nl> InstanceType , <nl> + / / / \ brief The generic type of a sequence . <nl> + SequenceGeneratorType , <nl> + / / / \ brief The element type of a generator . <nl> + GeneratorElementType , <nl> / / / \ brief The element of an array type . <nl> ArrayElementType , <nl> / / / \ brief The object type of an lvalue type . <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> case ApplyArgument : <nl> case ApplyFunction : <nl> case Archetype : <nl> + case AssociatedType : <nl> case FunctionArgument : <nl> case FunctionResult : <nl> case Member : <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> case ClosureResult : <nl> case ParentType : <nl> case InstanceType : <nl> + case SequenceGeneratorType : <nl> + case GeneratorElementType : <nl> case ArrayElementType : <nl> case LvalueObjectType : <nl> case ScalarToTuple : <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> case ApplyArgument : <nl> case ApplyFunction : <nl> case ApplyArgToParam : <nl> + case SequenceGeneratorType : <nl> + case GeneratorElementType : <nl> case ArrayElementType : <nl> case CheckedCastOperand : <nl> case ClosureResult : <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> return IsFunctionConversion ; <nl> <nl> case Archetype : <nl> + case AssociatedType : <nl> case GenericArgument : <nl> case InterpolationArgument : <nl> case NamedTupleElement : <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> / / / \ brief Describes the kind of data stored here . <nl> enum StoredKind : unsigned char { <nl> StoredArchetype , <nl> + StoredAssociatedType , <nl> StoredWitness , <nl> StoredKindAndValue <nl> } ; <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> assert ( getWitness ( ) = = decl ) ; <nl> } <nl> <nl> + PathElement ( AssociatedTypeDecl * decl ) <nl> + : storage ( ( reinterpret_cast < uintptr_t > ( decl ) > > 2 ) ) , <nl> + storedKind ( StoredAssociatedType ) <nl> + { <nl> + assert ( getAssociatedType ( ) = = decl ) ; <nl> + } <nl> + <nl> / / / \ brief Retrieve a path element for a tuple element referred to by <nl> / / / its position . <nl> static PathElement getTupleElement ( unsigned position ) { <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> case StoredArchetype : <nl> return Archetype ; <nl> <nl> + case StoredAssociatedType : <nl> + return AssociatedType ; <nl> + <nl> case StoredWitness : <nl> return Witness ; <nl> <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> return reinterpret_cast < ArchetypeType * > ( storage < < 2 ) ; <nl> } <nl> <nl> + / / / Retrieve the declaration for an associated type path element . <nl> + AssociatedTypeDecl * getAssociatedType ( ) const { <nl> + assert ( getKind ( ) = = AssociatedType & & " Is not an associated type " ) ; <nl> + return reinterpret_cast < AssociatedTypeDecl * > ( storage < < 2 ) ; <nl> + } <nl> + <nl> / / / \ brief Return the summary flags for this particular element . <nl> unsigned getNewSummaryFlags ( ) const { <nl> return getSummaryFlagsForPathElement ( getKind ( ) ) ; <nl> mmm a / lib / Sema / ConstraintSystem . cpp <nl> ppp b / lib / Sema / ConstraintSystem . cpp <nl> namespace { <nl> archetype = implArchetype ; <nl> } <nl> <nl> - ConstraintLocator * locator = nullptr ; <nl> - if ( archetype ) <nl> + ConstraintLocator * locator ; <nl> + if ( archetype ) { <nl> locator = CS . getConstraintLocator ( <nl> Locator . withPathElement ( LocatorPathElt ( archetype ) ) ) ; <nl> - else <nl> - locator = CS . getConstraintLocator ( Locator ) ; <nl> + } else { <nl> + / / FIXME : Occurs when the nested type is a concrete type , <nl> + / / in which case it ' s quite silly to create a type variable at all . <nl> + locator = CS . getConstraintLocator ( Locator . withPathElement ( member ) ) ; <nl> + } <nl> <nl> auto memberTypeVar = CS . createTypeVariable ( locator , <nl> TVO_PrefersSubtypeBinding ) ; <nl> Type ConstraintSystem : : getFixedTypeRecursive ( Type type , <nl> return type ; <nl> } <nl> <nl> + void ConstraintSystem : : recordOpenedTypes ( <nl> + ConstraintLocatorBuilder locator , <nl> + const llvm : : DenseMap < CanType , TypeVariableType * > & replacements ) { <nl> + if ( replacements . empty ( ) ) <nl> + return ; <nl> + <nl> + / / If the last path element is an archetype or associated type , ignore it . <nl> + SmallVector < LocatorPathElt , 2 > pathElts ; <nl> + Expr * anchor = locator . getLocatorParts ( pathElts ) ; <nl> + if ( ! pathElts . empty ( ) & & <nl> + ( pathElts . back ( ) . getKind ( ) = = ConstraintLocator : : Archetype | | <nl> + pathElts . back ( ) . getKind ( ) = = ConstraintLocator : : AssociatedType ) ) <nl> + return ; <nl> + <nl> + / / If the locator is empty , ignore it . <nl> + if ( ! anchor & & pathElts . empty ( ) ) <nl> + return ; <nl> + <nl> + ConstraintLocator * locatorPtr = getConstraintLocator ( locator ) ; <nl> + assert ( locatorPtr & & " No locator for opened types ? " ) ; <nl> + assert ( std : : find_if ( OpenedTypes . begin ( ) , OpenedTypes . end ( ) , <nl> + [ & ] ( const std : : pair < ConstraintLocator * , <nl> + ArrayRef < OpenedType > > & entry ) { <nl> + return entry . first = = locatorPtr ; <nl> + } ) = = OpenedTypes . end ( ) & & <nl> + " already registered opened types for this locator " ) ; <nl> + <nl> + OpenedType * openedTypes <nl> + = Allocator . Allocate < OpenedType > ( replacements . size ( ) ) ; <nl> + std : : copy ( replacements . begin ( ) , replacements . end ( ) , openedTypes ) ; <nl> + OpenedTypes . push_back ( { locatorPtr , <nl> + llvm : : makeArrayRef ( openedTypes , <nl> + replacements . size ( ) ) } ) ; <nl> + } <nl> + <nl> std : : pair < Type , Type > <nl> ConstraintSystem : : getTypeOfReference ( ValueDecl * value , <nl> bool isTypeReference , <nl> bool isSpecialized , <nl> ConstraintLocatorBuilder locator , <nl> DependentTypeOpener * opener ) { <nl> + llvm : : DenseMap < CanType , TypeVariableType * > replacements ; <nl> + <nl> if ( value - > getDeclContext ( ) - > isTypeContext ( ) & & isa < FuncDecl > ( value ) ) { <nl> / / Unqualified lookup can find operator names within nominal types . <nl> auto func = cast < FuncDecl > ( value ) ; <nl> assert ( func - > isOperator ( ) & & " Lookup should only find operators " ) ; <nl> <nl> auto openedType = openType ( func - > getInterfaceType ( ) , locator , <nl> - func , false , opener ) ; <nl> + replacements , func , false , opener ) ; <nl> auto openedFnType = openedType - > castTo < FunctionType > ( ) ; <nl> <nl> / / If this is a method whose result type is dynamic Self , replace <nl> ConstraintSystem : : getTypeOfReference ( ValueDecl * value , <nl> addArchetypeConstraint ( openedFnType - > getInput ( ) - > getRValueInstanceType ( ) , <nl> getConstraintLocator ( locator ) ) ; <nl> <nl> + / / If we opened up any type variables , record the replacements . <nl> + recordOpenedTypes ( locator , replacements ) ; <nl> + <nl> / / The reference implicitly binds ' self ' . <nl> return { openedType , openedFnType - > getResult ( ) } ; <nl> } <nl> ConstraintSystem : : getTypeOfReference ( ValueDecl * value , <nl> return { nullptr , nullptr } ; <nl> <nl> / / Open the type . <nl> - type = openType ( type , locator , value - > getInnermostDeclContext ( ) , false , <nl> - opener ) ; <nl> + type = openType ( type , locator , replacements , <nl> + value - > getInnermostDeclContext ( ) , false , opener ) ; <nl> + <nl> + / / If we opened up any type variables , record the replacements . <nl> + recordOpenedTypes ( locator , replacements ) ; <nl> <nl> / / If it ' s a type reference , we ' re done . <nl> if ( isTypeReference ) <nl> ConstraintSystem : : getTypeOfReference ( ValueDecl * value , <nl> <nl> / / Adjust the type of the reference . <nl> valueType = openType ( valueType , locator , <nl> + replacements , <nl> value - > getPotentialGenericDeclContext ( ) , <nl> / * skipProtocolSelfConstraint = * / false , <nl> opener ) ; <nl> + <nl> + / / If we opened up any type variables , record the replacements . <nl> + recordOpenedTypes ( locator , replacements ) ; <nl> + <nl> return { valueType , valueType } ; <nl> } <nl> <nl> ConstraintSystem : : getTypeOfMemberReference ( Type baseTy , ValueDecl * value , <nl> <nl> / / Open the type of the generic function or member of a generic type . <nl> Type openedType ; <nl> + llvm : : DenseMap < CanType , TypeVariableType * > replacements ; <nl> if ( auto genericFn = value - > getInterfaceType ( ) - > getAs < GenericFunctionType > ( ) ) { <nl> - openedType = openType ( genericFn , locator , dc , <nl> + openedType = openType ( genericFn , locator , replacements , dc , <nl> / * skipProtocolSelfConstraint = * / true , opener ) ; <nl> } else { <nl> openedType = TC . getUnopenedTypeOfReference ( value , baseTy , DC , <nl> ConstraintSystem : : getTypeOfMemberReference ( Type baseTy , ValueDecl * value , <nl> Type selfTy ; <nl> if ( auto sig = dc - > getGenericSignatureOfContext ( ) ) { <nl> / / Open up the generic parameter list for the container . <nl> - llvm : : DenseMap < CanType , TypeVariableType * > replacements ; <nl> openGeneric ( dc , sig - > getGenericParams ( ) , sig - > getRequirements ( ) , <nl> / * skipProtocolSelfConstraint = * / true , <nl> opener , locator , replacements ) ; <nl> ConstraintSystem : : getTypeOfMemberReference ( Type baseTy , ValueDecl * value , <nl> } <nl> } <nl> <nl> + / / If we opened up any type variables , record the replacements . <nl> + recordOpenedTypes ( locator , replacements ) ; <nl> + <nl> return { openedType , type } ; <nl> } <nl> <nl> mmm a / lib / Sema / ConstraintSystem . h <nl> ppp b / lib / Sema / ConstraintSystem . h <nl> struct Score { <nl> / / / Display a score . <nl> llvm : : raw_ostream & operator < < ( llvm : : raw_ostream & out , const Score & score ) ; <nl> <nl> + / / / Describes a dependent type that has been opened to a particular type <nl> + / / / variable . <nl> + typedef std : : pair < CanType , TypeVariableType * > OpenedType ; <nl> + <nl> / / / \ brief A complete solution to a constraint system . <nl> / / / <nl> / / / A solution to a constraint system consists of type variable bindings to <nl> class Solution { <nl> / / / which informs constraint application . <nl> llvm : : SmallDenseMap < ConstraintLocator * , unsigned > DisjunctionChoices ; <nl> <nl> + / / / The set of opened types for a given locator . <nl> + llvm : : SmallDenseMap < ConstraintLocator * , ArrayRef < OpenedType > > OpenedTypes ; <nl> + <nl> / / / \ brief Simplify the given type by substituting all occurrences of <nl> / / / type variables for their fixed types . <nl> Type simplifyType ( TypeChecker & tc , Type type ) const ; <nl> class Solution { <nl> / / / <nl> / / / \ param dc The declaration context that owns the generic type <nl> / / / <nl> + / / / \ param locator The locator that describes where the substitutions came <nl> + / / / from . <nl> + / / / <nl> / / / \ param substitutions Will be populated with the set of substitutions <nl> / / / to be applied to the generic function type . <nl> / / / <nl> class Solution { <nl> Type computeSubstitutions ( Type origType , <nl> DeclContext * dc , <nl> Type openedType , <nl> + ConstraintLocator * locator , <nl> SmallVectorImpl < Substitution > & substitutions ) const ; <nl> <nl> / / / Return the disjunction choice for the given constraint location . <nl> class ConstraintSystem { <nl> / / / The constraint graph . <nl> ConstraintGraph & CG ; <nl> <nl> + / / / A mapping from constraint locators to the set of opened types associated <nl> + / / / with that locator . <nl> + SmallVector < std : : pair < ConstraintLocator * , ArrayRef < OpenedType > > , 4 > <nl> + OpenedTypes ; <nl> + <nl> / / / \ brief Describes the current solver state . <nl> struct SolverState { <nl> SolverState ( ConstraintSystem & cs ) ; <nl> class ConstraintSystem { <nl> / / / \ brief The length of \ c DisjunctionChoices . <nl> unsigned numDisjunctionChoices ; <nl> <nl> + / / / The length of \ c OpenedTypes . <nl> + unsigned numOpenedTypes ; <nl> + <nl> / / / The previous score . <nl> Score PreviousScore ; <nl> <nl> class ConstraintSystem { <nl> ConstraintLocatorBuilder locator , <nl> llvm : : DenseMap < CanType , TypeVariableType * > & replacements ) ; <nl> <nl> + / / / Record the set of opened types for the given locator . <nl> + void recordOpenedTypes ( <nl> + ConstraintLocatorBuilder locator , <nl> + const llvm : : DenseMap < CanType , TypeVariableType * > & replacements ) ; <nl> + <nl> / / / \ brief Retrieve the type of a reference to the given value declaration . <nl> / / / <nl> / / / For references to polymorphic function types , this routine " opens up " <nl> mmm a / lib / Sema / TypeCheckConstraints . cpp <nl> ppp b / lib / Sema / TypeCheckConstraints . cpp <nl> bool TypeChecker : : typeCheckForEachBinding ( DeclContext * dc , ForEachStmt * stmt ) { <nl> <nl> / / Determine the generator type of the sequence . <nl> generatorType = cs . createTypeVariable ( Locator , / * options = * / 0 ) ; <nl> - cs . addConstraint ( Constraint : : create ( cs , ConstraintKind : : TypeMember , <nl> - expr - > getType ( ) , generatorType , <nl> - tc . Context . Id_Generator , <nl> - Locator ) ) ; <nl> - <nl> + cs . addConstraint ( <nl> + Constraint : : create ( cs , ConstraintKind : : TypeMember , <nl> + expr - > getType ( ) , generatorType , <nl> + tc . Context . Id_Generator , <nl> + cs . getConstraintLocator ( <nl> + Locator , <nl> + ConstraintLocator : : SequenceGeneratorType ) ) ) ; <nl> + <nl> / / Determine the element type of the generator . <nl> / / FIXME : Should look up the type witness . <nl> elementType = cs . createTypeVariable ( Locator , / * options = * / 0 ) ; <nl> - cs . addConstraint ( Constraint : : create ( cs , ConstraintKind : : TypeMember , <nl> - generatorType , elementType , <nl> - tc . Context . Id_Element , <nl> - Locator ) ) ; <nl> + cs . addConstraint ( Constraint : : create ( <nl> + cs , ConstraintKind : : TypeMember , <nl> + generatorType , elementType , <nl> + tc . Context . Id_Element , <nl> + cs . getConstraintLocator ( <nl> + Locator , <nl> + ConstraintLocator : : GeneratorElementType ) ) ) ; <nl> } <nl> <nl> <nl> void Solution : : dump ( SourceManager * sm , raw_ostream & out ) const { <nl> out < < " is # " < < choice . second < < " \ n " ; <nl> } <nl> <nl> + if ( ! OpenedTypes . empty ( ) ) { <nl> + out < < " \ nOpened types : \ n " ; <nl> + for ( const auto & opened : OpenedTypes ) { <nl> + out . indent ( 2 ) ; <nl> + opened . first - > dump ( sm , out ) ; <nl> + out < < " opens " ; <nl> + interleave ( opened . second . begin ( ) , opened . second . end ( ) , <nl> + [ & ] ( OpenedType opened ) { <nl> + opened . first . print ( out ) ; <nl> + out < < " - > " ; <nl> + opened . second - > print ( out ) ; <nl> + } , <nl> + [ & ] ( ) { <nl> + out < < " , " ; <nl> + } ) ; <nl> + out < < " \ n " ; <nl> + } <nl> + } <nl> + <nl> if ( ! Fixes . empty ( ) ) { <nl> out < < " \ nFixes : \ n " ; <nl> for ( auto & fix : Fixes ) { <nl> void ConstraintSystem : : dump ( raw_ostream & out ) { <nl> } <nl> } <nl> <nl> + if ( ! OpenedTypes . empty ( ) ) { <nl> + out < < " \ nOpened types : \ n " ; <nl> + for ( const auto & opened : OpenedTypes ) { <nl> + out . indent ( 2 ) ; <nl> + opened . first - > dump ( & getTypeChecker ( ) . Context . SourceMgr , out ) ; <nl> + out < < " opens " ; <nl> + interleave ( opened . second . begin ( ) , opened . second . end ( ) , <nl> + [ & ] ( OpenedType opened ) { <nl> + opened . first . print ( out ) ; <nl> + out < < " - > " ; <nl> + opened . second - > print ( out ) ; <nl> + } , <nl> + [ & ] ( ) { <nl> + out < < " , " ; <nl> + } ) ; <nl> + out < < " \ n " ; <nl> + } <nl> + } <nl> + <nl> if ( failedConstraint ) { <nl> out < < " \ nFailed constraint : \ n " ; <nl> out . indent ( 2 ) ; <nl> mmm a / lib / Sema / TypeCheckProtocol . cpp <nl> ppp b / lib / Sema / TypeCheckProtocol . cpp <nl> matchWitness ( ConformanceChecker & cc , TypeChecker & tc , <nl> solution . computeSubstitutions ( witness - > getInterfaceType ( ) , <nl> witnessDC , <nl> openedFullWitnessType , <nl> + witnessLocator , <nl> result . WitnessSubstitutions ) ; <nl> } <nl> <nl> mmm a / test / Interpreter / algorithms . swift <nl> ppp b / test / Interpreter / algorithms . swift <nl> fib ( ) <nl> let two_one = Array ( lazy ( [ 1 , 2 , 3 , 4 ] ) . reverse ( ) . filter { $ 0 % 2 = = 0 } . map { $ 0 / 2 } ) <nl> println ( two_one ) <nl> / / CHECK : [ 2 , 1 ] <nl> + <nl> + / / rdar : / / problem / 18208283 <nl> + func flatten < Element , Sequence : SequenceType , InnerSequence : SequenceType <nl> + where Sequence . Generator . Element = = InnerSequence , InnerSequence . Generator . Element = = Element > ( outerSequence : Sequence ) - > [ Element ] { <nl> + var result = [ Element ] ( ) <nl> + <nl> + for innerSequence in outerSequence { <nl> + result . extend ( innerSequence ) <nl> + } <nl> + <nl> + return result <nl> + } <nl> + <nl> + / / CHECK : [ 1 , 2 , 3 , 4 , 5 , 6 ] <nl> + let flat = flatten ( [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ) <nl> + println ( flat ) <nl> + <nl> + / / rdar : / / problem / 19416848 <nl> + func observe < T : SequenceType , V where V = = T . Generator . Element > ( g : T ) { } <nl> + observe ( [ " a " : 1 ] ) <nl> mmm a / validation - test / compiler_crashers_2 / 0002 - rdar19792768 . swift <nl> ppp b / validation - test / compiler_crashers_2 / 0002 - rdar19792768 . swift <nl> <nl> - / / RUN : not - - crash % target - swift - frontend % s - emit - silgen <nl> - / / XFAIL : no_asserts <nl> + / / RUN : % target - swift - frontend % s - emit - silgen <nl> <nl> / / rdar : / / problem / 19792768 <nl> <nl>
|
Explicitly track the mapping from dependent types to their opened type variables .
|
apple/swift
|
3805e18090f06408576dabd4b33a079b133985c8
|
2015-02-18T19:41:40Z
|
mmm a / include / swift / SIL / SILFunction . h <nl> ppp b / include / swift / SIL / SILFunction . h <nl> class SILFunction <nl> / / / would indicate . <nl> unsigned HasCReferences : 1 ; <nl> <nl> - / / / Set if the function should be preserved and changed to public linkage <nl> - / / / during dead function elimination . This is used for some generic <nl> - / / / pre - specialization . <nl> - unsigned KeepAsPublic : 1 ; <nl> - <nl> / / / If ! = OptimizationMode : : NotSet , the optimization mode specified with an <nl> / / / function attribute . <nl> OptimizationMode OptMode ; <nl> class SILFunction <nl> LoweredType = newType ; <nl> } <nl> <nl> - bool canBeDeleted ( ) const { <nl> - return ! getRefCount ( ) & & ! isZombie ( ) & & ! isKeepAsPublic ( ) ; <nl> - } <nl> - <nl> / / / Return the number of entities referring to this function ( other <nl> / / / than the SILModule ) . <nl> unsigned getRefCount ( ) const { return RefCount ; } <nl> class SILFunction <nl> bool isGlobalInit ( ) const { return GlobalInitFlag ; } <nl> void setGlobalInit ( bool isGI ) { GlobalInitFlag = isGI ; } <nl> <nl> - bool isKeepAsPublic ( ) const { return KeepAsPublic ; } <nl> - void setKeepAsPublic ( bool keep ) { KeepAsPublic = keep ; } <nl> - <nl> / / / Return whether this function has a foreign implementation which can <nl> / / / be emitted on demand . <nl> bool hasForeignBody ( ) const ; <nl> mmm a / lib / SIL / SILFunction . cpp <nl> ppp b / lib / SIL / SILFunction . cpp <nl> SILFunction : : SILFunction ( SILModule & Module , SILLinkage Linkage , StringRef Name , <nl> Serialized ( isSerialized ) , Thunk ( isThunk ) , <nl> ClassSubclassScope ( unsigned ( classSubclassScope ) ) , GlobalInitFlag ( false ) , <nl> InlineStrategy ( inlineStrategy ) , Linkage ( unsigned ( Linkage ) ) , <nl> - HasCReferences ( false ) , KeepAsPublic ( false ) , <nl> + HasCReferences ( false ) , <nl> OptMode ( OptimizationMode : : NotSet ) , EffectsKindAttr ( E ) , <nl> EntryCount ( entryCount ) { <nl> if ( InsertBefore ) <nl> mmm a / lib / SIL / SILVerifier . cpp <nl> ppp b / lib / SIL / SILVerifier . cpp <nl> class SILVerifier : public SILVerifierBase < SILVerifier > { <nl> <nl> / / A direct reference to a non - public or shared but not fragile function <nl> / / from a fragile function is an error . <nl> - / / <nl> - / / Exception : When compiling OnoneSupport anything can reference anything , <nl> - / / because the bodies of functions are never SIL serialized , but <nl> - / / specializations are exposed as public symbols in the produced object <nl> - / / files . For the same reason , KeepAsPublic functions ( i . e . specializations ) <nl> - / / can refer to anything or can be referenced from any other function . <nl> - if ( ! F . getModule ( ) . isOptimizedOnoneSupportModule ( ) & & <nl> - ! ( F . isKeepAsPublic ( ) | | RefF - > isKeepAsPublic ( ) ) ) { <nl> - if ( F . isSerialized ( ) ) { <nl> - require ( ( SingleFunction & & RefF - > isExternalDeclaration ( ) ) | | <nl> - RefF - > hasValidLinkageForFragileRef ( ) , <nl> - " function_ref inside fragile function cannot " <nl> - " reference a private or hidden symbol " ) ; <nl> - } <nl> + if ( F . isSerialized ( ) ) { <nl> + require ( ( SingleFunction & & RefF - > isExternalDeclaration ( ) ) | | <nl> + RefF - > hasValidLinkageForFragileRef ( ) , <nl> + " function_ref inside fragile function cannot " <nl> + " reference a private or hidden symbol " ) ; <nl> } <nl> + <nl> verifySILFunctionType ( fnType ) ; <nl> } <nl> <nl> mmm a / lib / SILOptimizer / IPO / DeadFunctionElimination . cpp <nl> ppp b / lib / SILOptimizer / IPO / DeadFunctionElimination . cpp <nl> STATISTIC ( NumDeadFunc , " Number of dead functions eliminated " ) ; <nl> <nl> namespace { <nl> <nl> - / / / Returns true if a function should be SIL serialized or emitted by IRGen . <nl> - static bool shouldBeSerializedOrEmitted ( SILFunction * F ) { <nl> - / / global initializers are always emitted into the defining module and <nl> - / / their bodies are never SIL serialized . <nl> - if ( F - > isGlobalInit ( ) ) <nl> - return true ; <nl> - <nl> - / / public_external functions are never SIL serialized or emitted by IRGen . <nl> - if ( F - > isAvailableExternally ( ) & & hasPublicVisibility ( F - > getLinkage ( ) ) ) <nl> - return false ; <nl> - <nl> - / / [ serialized ] functions should always be SIL serialized . <nl> - if ( F - > isSerialized ( ) ) <nl> - return true ; <nl> - <nl> - return false ; <nl> - } <nl> - <nl> / / / This is a base class for passes that are based on function liveness <nl> / / / computations like e . g . dead function elimination . <nl> / / / It provides a common logic for computing live ( i . e . reachable ) functions . <nl> class FunctionLivenessComputation { <nl> if ( F - > getRepresentation ( ) = = SILFunctionTypeRepresentation : : ObjCMethod ) <nl> return true ; <nl> <nl> - / / Functions that may be used externally cannot be removed . <nl> - if ( isPossiblyUsedExternally ( F - > getLinkage ( ) , Module - > isWholeModule ( ) ) ) <nl> - return true ; <nl> - <nl> - / / If function is marked as " keep - as - public " , don ' t remove it . <nl> - / / Change its linkage to public , so that other applications can refer to it . <nl> - / / It is important that this transformation is done at the end of <nl> - / / a pipeline , as it may break some optimizations . <nl> - if ( F - > isKeepAsPublic ( ) ) { <nl> - F - > setLinkage ( SILLinkage : : Public ) ; <nl> - DEBUG ( llvm : : dbgs ( ) < < " DFE : Preserve the specialization " <nl> - < < F - > getName ( ) < < ' \ n ' ) ; <nl> - return true ; <nl> - } <nl> - <nl> - / / Do not consider public_external functions that do not need to be emitted <nl> - / / into the client as anchors . <nl> - if ( shouldBeSerializedOrEmitted ( F ) ) <nl> + / / Global initializers are always emitted into the defining module and <nl> + / / their bodies are never SIL serialized . <nl> + if ( F - > isGlobalInit ( ) ) <nl> return true ; <nl> <nl> return false ; <nl> mmm a / lib / SILOptimizer / IPO / EagerSpecializer . cpp <nl> ppp b / lib / SILOptimizer / IPO / EagerSpecializer . cpp <nl> void EagerSpecializerTransform : : run ( ) { <nl> SpecializedFuncs . push_back ( NewFunc ) ; <nl> <nl> if ( SA - > isExported ( ) ) { <nl> - NewFunc - > setKeepAsPublic ( true ) ; <nl> + NewFunc - > setLinkage ( SILLinkage : : Public ) ; <nl> continue ; <nl> } <nl> } <nl> mmm a / lib / SILOptimizer / Utils / Generics . cpp <nl> ppp b / lib / SILOptimizer / Utils / Generics . cpp <nl> void swift : : trySpecializeApplyOfGeneric ( <nl> = = SpecializedF - > getLoweredFunctionType ( ) & & <nl> " Previously specialized function does not match expected type . " ) ; <nl> <nl> - / / FIXME : Replace pre - specialization ' s " keep as public " hack with something <nl> - / / more principled <nl> - assert ( ( Serialized = = SpecializedF - > isSerialized ( ) | | <nl> - SpecializedF - > isKeepAsPublic ( ) ) & & <nl> - " Previously specialized function does not match expected " <nl> - " resilience level . " ) ; <nl> - <nl> DeadApplies . insert ( Apply . getInstruction ( ) ) ; <nl> <nl> if ( replacePartialApplyWithoutReabstraction ) { <nl> void swift : : trySpecializeApplyOfGeneric ( <nl> / / This uses the SIL linker to checks for the does not load the body of the pres <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> - static void keepSpecializationAsPublic ( SILFunction * F ) { <nl> - DEBUG ( auto DemangledNameString = <nl> - swift : : Demangle : : demangleSymbolAsString ( F - > getName ( ) ) ; <nl> - StringRef DemangledName = DemangledNameString ; <nl> - llvm : : dbgs ( ) < < " Keep specialization public : " < < DemangledName < < " : " <nl> - < < F - > getName ( ) < < " \ n " ) ; <nl> - / / Make it public , so that others can refer to it . <nl> - / / <nl> - / / NOTE : This function may refer to non - public symbols , which may lead to <nl> - / / problems , if you ever try to inline this function . Therefore , these <nl> - / / specializations should only be used to refer to them , but should never <nl> - / / be inlined ! The general rule could be : Never inline specializations <nl> - / / from stdlib ! <nl> - / / <nl> - / / NOTE : Making these specializations public at this point breaks <nl> - / / some optimizations . Therefore , just mark the function . <nl> - / / DeadFunctionElimination pass will check if the function is marked <nl> - / / and preserve it if required . <nl> - F - > setKeepAsPublic ( true ) ; <nl> - } <nl> - <nl> / / / Link a specialization for generating prespecialized code . <nl> / / / <nl> / / / For now , it is performed only for specializations in the <nl> static void keepSpecializationAsPublic ( SILFunction * F ) { <nl> / / / the library , but only used only by client code compiled at - Onone . They <nl> / / / should be never inlined . <nl> static bool linkSpecialization ( SILModule & M , SILFunction * F ) { <nl> - if ( F - > isKeepAsPublic ( ) ) <nl> + if ( F - > getLinkage ( ) = = SILLinkage : : Public ) <nl> return true ; <nl> / / Do not remove functions that are known prespecializations . <nl> / / Keep them around . Change their linkage to public , so that other <nl> / / applications can refer to them . <nl> if ( M . isOptimizedOnoneSupportModule ( ) ) { <nl> if ( isKnownPrespecialization ( F - > getName ( ) ) ) { <nl> - keepSpecializationAsPublic ( F ) ; <nl> + F - > setLinkage ( SILLinkage : : Public ) ; <nl> + F - > setSerialized ( IsNotSerialized ) ; <nl> return true ; <nl> } <nl> } <nl> mmm a / lib / Serialization / SerializeSIL . cpp <nl> ppp b / lib / Serialization / SerializeSIL . cpp <nl> void SILSerializer : : addMandatorySILFunction ( const SILFunction * F , <nl> <nl> / / Function body should be serialized unless it is a KeepAsPublic function <nl> / / ( which is typically a pre - specialization ) . <nl> - if ( ! emitDeclarationsForOnoneSupport & & ! F - > isKeepAsPublic ( ) ) <nl> + if ( ! emitDeclarationsForOnoneSupport ) <nl> Worklist . push_back ( F ) ; <nl> } <nl> <nl>
|
Merge remote - tracking branch ' origin / master ' into master - llvm - swift5 - transition
|
apple/swift
|
6382b98251ac08fb7ba17a21ecd3b365046eee50
|
2018-01-13T08:20:02Z
|
mmm a / src / compiler / register - allocator - verifier . cc <nl> ppp b / src / compiler / register - allocator - verifier . cc <nl> void RegisterAllocatorVerifier : : ValidateFinalAssessment ( <nl> const PendingAssessment * old = assessment - > original_pending_assessment ( ) ; <nl> CHECK_NOT_NULL ( old ) ; <nl> RpoNumber old_block = old - > origin ( ) - > rpo_number ( ) ; <nl> - BlockAssessments * old_block_assessments = assessments_ [ old_block ] ; <nl> + DCHECK_LE ( old_block , block_id ) ; <nl> + BlockAssessments * old_block_assessments = <nl> + old_block = = block_id ? current_assessments : assessments_ [ old_block ] ; <nl> ValidatePendingAssessment ( old_block , op , old_block_assessments , old , <nl> virtual_register ) ; <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . f78681e9b55 <nl> mmm / dev / null <nl> ppp b / test / mjsunit / regress / wasm / regression - 667745 . js <nl> <nl> + / / Copyright 2016 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + / / Flags : - - expose - wasm <nl> + <nl> + load ( " test / mjsunit / wasm / wasm - constants . js " ) ; <nl> + load ( " test / mjsunit / wasm / wasm - module - builder . js " ) ; <nl> + <nl> + ( function ( ) { <nl> + var builder = new WasmModuleBuilder ( ) ; <nl> + builder . addFunction ( " test " , kSig_i_iii ) <nl> + . addBody ( [ <nl> + kExprI8Const , 0xcb , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x67 , <nl> + kExprI8Const , 0x67 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Eq , <nl> + kExprI32RemU , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x25 , <nl> + kExprI32Const , 0x82 , 0x6c , <nl> + kExprI32Add , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x70 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x70 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x67 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32GeS , <nl> + kExprI32Const , 0x67 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x41 , <nl> + kExprDrop , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x01 , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprSelect , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x0e , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x01 , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprSelect , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x0e , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x01 , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprSelect , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x0e , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x01 , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprSelect , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x0e , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Const , 0x4a , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32LtU , <nl> + kExprI32Const , 0x67 , <nl> + kExprI32Clz , <nl> + kExprI32GtS , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Ne , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x1a , <nl> + kExprI32Const , 0x71 , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32ShrS , <nl> + kExprI32Clz , <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprI32Clz , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Const , 0x4a , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32LtU , <nl> + kExprI32Const , 0x67 , <nl> + kExprI32Clz , <nl> + kExprI32GtS , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Ne , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Const , 0x41 , <nl> + kExprI32Const , 0x1a , <nl> + kExprI32Const , 0x71 , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32And , <nl> + kExprI32ShrS , <nl> + kExprI32Clz , <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprI32Clz , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprUnreachable , <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprCallFunction , 0x00 , / / function # 0 <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprReturn , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprUnreachable , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprI32Clz , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI64DivS , <nl> + kExprI64LoadMem , 0x01 , 0x01 , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprNop , <nl> + kExprI64DivU , <nl> + kExprUnreachable , <nl> + kExprI32GeS , <nl> + kExprI8Const , 0xcb , <nl> + ] ) <nl> + . exportFunc ( ) ; <nl> + var module = builder . instantiate ( ) ; <nl> + assertTrue ( module ! = undefined ) ; <nl> + } ) ( ) ; <nl>
|
[ turbofan ] Regalloc validator : support same block pending assessment
|
v8/v8
|
7a1ad0c581e1ac5536723fcddbf8e623bd59b1c7
|
2016-11-22T17:31:06Z
|
mmm a / lib / Sema / CSSimplify . cpp <nl> ppp b / lib / Sema / CSSimplify . cpp <nl> ConstraintSystem : : SolutionKind ConstraintSystem : : simplifyConformsToConstraint ( <nl> / / This conformance may be conditional , in which case we need to consider <nl> / / those requirements as constraints too . <nl> if ( conformance . isConcrete ( ) ) { <nl> + unsigned index = 0 ; <nl> for ( const auto & req : conformance . getConditionalRequirements ( ) ) { <nl> - / / FIXME : Use a more specific locator . <nl> - addConstraint ( req , locator ) ; <nl> + addConstraint ( <nl> + req , <nl> + locator . withPathElement ( <nl> + LocatorPathElt : : getConditionalRequirementComponent ( index + + ) ) ) ; <nl> } <nl> } <nl> <nl> mmm a / lib / Sema / ConstraintLocator . cpp <nl> ppp b / lib / Sema / ConstraintLocator . cpp <nl> void ConstraintLocator : : Profile ( llvm : : FoldingSetNodeID & id , Expr * anchor , <nl> case ApplyArgToParam : <nl> case OpenedGeneric : <nl> case KeyPathComponent : <nl> + case ConditionalRequirement : <nl> if ( unsigned numValues = numNumericValuesInPathElement ( elt . getKind ( ) ) ) { <nl> id . AddInteger ( elt . getValue ( ) ) ; <nl> if ( numValues > 1 ) <nl> void ConstraintLocator : : dump ( SourceManager * sm , raw_ostream & out ) { <nl> case OpenedGeneric : <nl> out < < " opened generic " ; <nl> break ; <nl> + <nl> + case ConditionalRequirement : <nl> + out < < " conditional requirement # " < < llvm : : utostr ( elt . getValue ( ) ) ; <nl> + break ; <nl> } <nl> } <nl> <nl> mmm a / lib / Sema / ConstraintLocator . h <nl> ppp b / lib / Sema / ConstraintLocator . h <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> OpenedGeneric , <nl> / / / A component of a key path . <nl> KeyPathComponent , <nl> + / / / The Nth conditional requirement in the parent locator ' s conformance . <nl> + ConditionalRequirement , <nl> } ; <nl> <nl> / / / \ brief Determine the number of numeric values used for the given path <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> case NamedTupleElement : <nl> case TupleElement : <nl> case KeyPathComponent : <nl> + case ConditionalRequirement : <nl> return 1 ; <nl> <nl> case ApplyArgToParam : <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> case Requirement : <nl> case Witness : <nl> case KeyPathComponent : <nl> + case ConditionalRequirement : <nl> return 0 ; <nl> <nl> case FunctionArgument : <nl> class ConstraintLocator : public llvm : : FoldingSetNode { <nl> return PathElement ( KeyPathComponent , position ) ; <nl> } <nl> <nl> + / / / Get a path element for a conditional requirement . <nl> + static PathElement getConditionalRequirementComponent ( unsigned index ) { <nl> + return PathElement ( ConditionalRequirement , index ) ; <nl> + } <nl> + <nl> / / / \ brief Retrieve the kind of path element . <nl> PathElementKind getKind ( ) const { <nl> switch ( static_cast < StoredKind > ( storedKind ) ) { <nl>
|
[ Constraint solver ] Add a constraint locator element for conditional requirements .
|
apple/swift
|
33810d9a6aa2363fc362fb87372a8ed4eaa3ebf6
|
2017-11-21T05:07:13Z
|
mmm a / src / flag - definitions . h <nl> ppp b / src / flag - definitions . h <nl> DEFINE_BOOL ( strong_this , true , " don ' t allow ' this ' to escape from constructors " ) <nl> <nl> DEFINE_BOOL ( es_staging , false , " enable all completed harmony features " ) <nl> DEFINE_BOOL ( harmony , false , " enable all completed harmony features " ) <nl> - DEFINE_BOOL ( harmony_shipping , true , " enable all shipped harmony fetaures " ) <nl> + DEFINE_BOOL ( harmony_shipping , true , " enable all shipped harmony features " ) <nl> DEFINE_IMPLICATION ( harmony , es_staging ) <nl> DEFINE_IMPLICATION ( es_staging , harmony ) <nl> <nl> DEFINE_BOOL ( age_code , true , <nl> " old code ( required for code flushing ) " ) <nl> DEFINE_BOOL ( incremental_marking , true , " use incremental marking " ) <nl> DEFINE_BOOL ( overapproximate_weak_closure , true , <nl> - " overapproximate weak closer to reduce atomic pause time " ) <nl> + " overapproximate weak closure to reduce atomic pause time " ) <nl> DEFINE_INT ( min_progress_during_object_groups_marking , 128 , <nl> " keep overapproximating the weak closure as long as we discover at " <nl> " least this many unmarked objects " ) <nl>
|
fix typos - features and closure
|
v8/v8
|
ae8f79efb93fd885d0b974af2485c427531de57f
|
2015-10-26T07:39:35Z
|
mmm a / cocos / base / CCController . h <nl> ppp b / cocos / base / CCController . h <nl> class EventDispatcher ; <nl> class Controller <nl> { <nl> public : <nl> + / * * Controllers ' standard key <nl> + * Controller receives only standard key which contained within enum Key by default . <nl> + * / <nl> enum Key <nl> { <nl> JOYSTICK_LEFT_X = 1000 , <nl> class Controller <nl> static const int TAG_UNSET = - 1 ; <nl> <nl> static const std : : vector < Controller * > & getAllController ( ) { return s_allController ; } <nl> + / * * Gets a controller with its tag <nl> + * @ param tag An identifier to find the controller . <nl> + * / <nl> static Controller * getControllerByTag ( int tag ) ; <nl> - <nl> + / * * To start discovering new controllers <nl> + * @ warning The API only work on the IOS platform . Empty implementation on Android <nl> + * / <nl> static void startDiscoveryController ( ) ; <nl> + / * * End the discovery process <nl> + * @ warning The API only work on the IOS platform . Empty implementation on Android <nl> + * / <nl> static void stopDiscoveryController ( ) ; <nl> <nl> const std : : string & getDeviceName ( ) const { return _deviceName ; } <nl> class Controller <nl> * / <nl> void receiveExternalKeyEvent ( int externalKeyCode , bool receive ) ; <nl> <nl> + / * * Changes the tag that is used to identify the controller easily . <nl> + * @ param tag A integer that identifies the controller . <nl> + * / <nl> void setTag ( int tag ) { _controllerTag = tag ; } <nl> + / * * <nl> + * Returns a tag that is used to identify the controller easily . <nl> + * <nl> + * @ return An integer that identifies the controller . <nl> + * / <nl> int getTag ( ) const { return _controllerTag ; } <nl> <nl> private : <nl>
|
Add annotation for Controller class .
|
cocos2d/cocos2d-x
|
4e4464c9c1e835c26bcae49f8a588aaea97cee11
|
2014-07-11T02:56:09Z
|
mmm a / cocos / editor - support / cocostudio / ActionTimeline / CCBoneNode . cpp <nl> ppp b / cocos / editor - support / cocostudio / ActionTimeline / CCBoneNode . cpp <nl> void BoneNode : : draw ( cocos2d : : Renderer * renderer , const cocos2d : : Mat4 & transform , <nl> <nl> BoneNode : : ~ BoneNode ( ) <nl> { <nl> + _boneSkins . clear ( ) ; <nl> + _childBones . clear ( ) ; <nl> + _rootSkeleton = nullptr ; <nl> } <nl> <nl> bool BoneNode : : init ( ) <nl> void BoneNode : : onDraw ( const cocos2d : : Mat4 & transform , uint32_t flags ) <nl> <nl> } <nl> <nl> - cocos2d : : Vector < BoneNode * > BoneNode : : getAllSubBones ( ) const <nl> + const cocos2d : : Vector < BoneNode * > & BoneNode : : getAllSubBones ( ) const <nl> { <nl> cocos2d : : Vector < BoneNode * > allBones ; <nl> std : : stack < BoneNode * > boneStack ; / / for avoid recursive <nl> cocos2d : : Vector < BoneNode * > BoneNode : : getAllSubBones ( ) const <nl> return allBones ; <nl> } <nl> <nl> - cocos2d : : Vector < SkinNode * > BoneNode : : getAllSubSkins ( ) const <nl> + const cocos2d : : Vector < SkinNode * > & BoneNode : : getAllSubSkins ( ) const <nl> { <nl> auto allbones = getAllSubBones ( ) ; <nl> cocos2d : : Vector < SkinNode * > allskins ; <nl> mmm a / cocos / editor - support / cocostudio / ActionTimeline / CCSkeletonNode . cpp <nl> ppp b / cocos / editor - support / cocostudio / ActionTimeline / CCSkeletonNode . cpp <nl> SkeletonNode : : SkeletonNode ( ) <nl> <nl> SkeletonNode : : ~ SkeletonNode ( ) <nl> { <nl> + _subOrderedAllBones . clear ( ) ; <nl> + _subBonesMap . clear ( ) ; <nl> } <nl> <nl> void SkeletonNode : : updateVertices ( ) <nl>
|
add destruct
|
cocos2d/cocos2d-x
|
c6bc81d42062f5d940c4aa067fef38e14d6f469f
|
2015-08-07T05:13:48Z
|
mmm a / hphp / runtime / vm / jit / linearscan . cpp <nl> ppp b / hphp / runtime / vm / jit / linearscan . cpp <nl> void LinearScan : : allocRegsOneTrace ( BlockList : : iterator & blockIt , <nl> assert ( ! spill - > block ( ) - > trace ( ) - > isMain ( ) ) ; <nl> spill = spill - > clone ( m_irFactory ) ; <nl> } <nl> - block - > trace ( ) - > front ( ) - > prepend ( spill ) ; <nl> + trace - > front ( ) - > prepend ( spill ) ; <nl> } else if ( inst - > isBlockEnd ( ) ) { <nl> block - > next ( ) - > prepend ( spill ) ; <nl> } else { <nl> new file mode 100644 <nl> index 00000000000 . . 19e3b567c27 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / compilation / exitspill . php <nl> <nl> + < ? php <nl> + <nl> + define ( ' FIZ ' , 32 ) ; <nl> + <nl> + class X { <nl> + const FOO = 1 ; <nl> + const BAR = FIZ ; <nl> + const BAZ = FIZ ; <nl> + const BOO = FIZ ; <nl> + const BIZ = FIZ ; <nl> + const FIZ = FIZ ; <nl> + } <nl> + <nl> + function foo ( $ a , $ b ) { <nl> + var_dump ( $ a , $ b ) ; <nl> + } <nl> + <nl> + function f ( ) { return FIZ ; } <nl> + <nl> + function test ( ) { <nl> + foo ( f ( ) , array ( X : : FOO , X : : BAZ , <nl> + X : : BAR , X : : BAZ , <nl> + X : : BOO , X : : BIZ ) ) ; <nl> + } <nl> + <nl> + test ( ) ; <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . ed77cd27686 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / compilation / exitspill . php . expect <nl> <nl> + int ( 32 ) <nl> + array ( 6 ) { <nl> + [ 0 ] = > <nl> + int ( 1 ) <nl> + [ 1 ] = > <nl> + int ( 32 ) <nl> + [ 2 ] = > <nl> + int ( 32 ) <nl> + [ 3 ] = > <nl> + int ( 32 ) <nl> + [ 4 ] = > <nl> + int ( 32 ) <nl> + [ 5 ] = > <nl> + int ( 32 ) <nl> + } <nl>
|
Fix spilling bug in linearscan
|
facebook/hhvm
|
f72684f07a7ad9d96862e23aec5737dd3d5d9484
|
2013-07-02T18:46:26Z
|
mmm a / core / io / http_client . cpp <nl> ppp b / core / io / http_client . cpp <nl> Error HTTPClient : : connect ( const String & p_host , int p_port , bool p_ssl , bool p_ve <nl> return OK ; <nl> } <nl> <nl> - <nl> void HTTPClient : : set_connection ( const Ref < StreamPeer > & p_connection ) { <nl> <nl> close ( ) ; <nl> void HTTPClient : : set_connection ( const Ref < StreamPeer > & p_connection ) { <nl> <nl> } <nl> <nl> - <nl> Ref < StreamPeer > HTTPClient : : get_connection ( ) const { <nl> <nl> return connection ; <nl> } <nl> <nl> + Error HTTPClient : : request_raw ( Method p_method , const String & p_url , const Vector < String > & p_headers , const DVector < uint8_t > & p_body ) { <nl> + <nl> + ERR_FAIL_INDEX_V ( p_method , METHOD_MAX , ERR_INVALID_PARAMETER ) ; <nl> + ERR_FAIL_COND_V ( status ! = STATUS_CONNECTED , ERR_INVALID_PARAMETER ) ; <nl> + ERR_FAIL_COND_V ( connection . is_null ( ) , ERR_INVALID_DATA ) ; <nl> + <nl> + <nl> + static const char * _methods [ METHOD_MAX ] = { <nl> + " GET " , <nl> + " HEAD " , <nl> + " POST " , <nl> + " PUT " , <nl> + " DELETE " , <nl> + " OPTIONS " , <nl> + " TRACE " , <nl> + " CONNECT " } ; <nl> + <nl> + String request = String ( _methods [ p_method ] ) + " " + p_url + " HTTP / 1 . 1 \ r \ n " ; <nl> + request + = " Host : " + conn_host + " : " + itos ( conn_port ) + " \ r \ n " ; <nl> + bool add_clen = p_body . size ( ) > 0 ; <nl> + for ( int i = 0 ; i < p_headers . size ( ) ; i + + ) { <nl> + request + = p_headers [ i ] + " \ r \ n " ; <nl> + if ( add_clen & & p_headers [ i ] . find ( " Content - Length : " ) = = 0 ) { <nl> + add_clen = false ; <nl> + } <nl> + } <nl> + if ( add_clen ) { <nl> + request + = " Content - Length : " + itos ( p_body . size ( ) ) + " \ r \ n " ; <nl> + / / should it add utf8 encoding ? not sure <nl> + } <nl> + request + = " \ r \ n " ; <nl> + CharString cs = request . utf8 ( ) ; <nl> + <nl> + DVector < uint8_t > data ; <nl> + <nl> + / / Maybe this goes faster somehow ? <nl> + for ( int i = 0 ; i < cs . length ( ) ; i + + ) { <nl> + data . append ( cs [ i ] ) ; <nl> + } <nl> + data . append_array ( p_body ) ; <nl> + <nl> + DVector < uint8_t > : : Read r = data . read ( ) ; <nl> + Error err = connection - > put_data ( & r [ 0 ] , data . size ( ) ) ; <nl> + <nl> + if ( err ) { <nl> + close ( ) ; <nl> + status = STATUS_CONNECTION_ERROR ; <nl> + return err ; <nl> + } <nl> + <nl> + status = STATUS_REQUESTING ; <nl> + <nl> + return OK ; <nl> + } <nl> <nl> Error HTTPClient : : request ( Method p_method , const String & p_url , const Vector < String > & p_headers , const String & p_body ) { <nl> <nl> int HTTPClient : : get_response_code ( ) const { <nl> <nl> return response_num ; <nl> } <nl> + <nl> Error HTTPClient : : get_response_headers ( List < String > * r_response ) { <nl> <nl> if ( ! response_headers . size ( ) ) <nl> void HTTPClient : : _bind_methods ( ) { <nl> ObjectTypeDB : : bind_method ( _MD ( " connect : Error " , " host " , " port " , " use_ssl " , " verify_host " ) , & HTTPClient : : connect , DEFVAL ( false ) , DEFVAL ( true ) ) ; <nl> ObjectTypeDB : : bind_method ( _MD ( " set_connection " , " connection : StreamPeer " ) , & HTTPClient : : set_connection ) ; <nl> ObjectTypeDB : : bind_method ( _MD ( " get_connection : StreamPeer " ) , & HTTPClient : : get_connection ) ; <nl> + ObjectTypeDB : : bind_method ( _MD ( " request_raw " , " method " , " url " , " headers " , " body " ) , & HTTPClient : : request_raw , DEFVAL ( String ( ) ) ) ; <nl> ObjectTypeDB : : bind_method ( _MD ( " request " , " method " , " url " , " headers " , " body " ) , & HTTPClient : : request , DEFVAL ( String ( ) ) ) ; <nl> ObjectTypeDB : : bind_method ( _MD ( " send_body_text " , " body " ) , & HTTPClient : : send_body_text ) ; <nl> ObjectTypeDB : : bind_method ( _MD ( " send_body_data " , " body " ) , & HTTPClient : : send_body_data ) ; <nl> mmm a / core / io / http_client . h <nl> ppp b / core / io / http_client . h <nl> class HTTPClient : public Reference { <nl> void set_connection ( const Ref < StreamPeer > & p_connection ) ; <nl> Ref < StreamPeer > get_connection ( ) const ; <nl> <nl> + Error request_raw ( Method p_method , const String & p_url , const Vector < String > & p_headers , const DVector < uint8_t > & p_body ) ; <nl> Error request ( Method p_method , const String & p_url , const Vector < String > & p_headers , const String & p_body = String ( ) ) ; <nl> Error send_body_text ( const String & p_body ) ; <nl> Error send_body_data ( const ByteArray & p_body ) ; <nl>
|
httpclient request withh raw_array body
|
godotengine/godot
|
ab1da5dc1be0c24e0ac47c8e946372d8574ca575
|
2016-05-04T17:49:01Z
|
mmm a / filament / include / filament / VertexBuffer . h <nl> ppp b / filament / include / filament / VertexBuffer . h <nl> class UTILS_PUBLIC VertexBuffer : public FilamentAPI { <nl> * @ param engine Reference to the filament : : Engine to associate this VertexBuffer with . <nl> * <nl> * @ return pointer to the newly created object or nullptr if exceptions are disabled and <nl> - * an error occured . <nl> + * an error occurred . <nl> * <nl> - * @ exception utils : : PostConditionPanic if a runtime error occured , such as running out of <nl> + * @ exception utils : : PostConditionPanic if a runtime error occurred , such as running out of <nl> * memory or other resources . <nl> * @ exception utils : : PreConditionPanic if a parameter to a builder function was invalid . <nl> * / <nl> mmm a / filament / include / filament / View . h <nl> ppp b / filament / include / filament / View . h <nl> class UTILS_PUBLIC View : public FilamentAPI { <nl> * <nl> * enabled : enable or disables dynamic resolution on a View <nl> * homogeneousScaling : by default the system scales the major axis first . Set this to true <nl> - * to force homegeneous scaling . <nl> + * to force homogeneous scaling . <nl> * scaleRate : rate at which the scale will change to reach the target frame rate <nl> * This value can be computed as 1 / N , where N is the number of frames <nl> * needed to reach 64 % of the target scale factor . <nl> class UTILS_PUBLIC View : public FilamentAPI { <nl> * isn ' t visible and if lights are expected to shine there , there is no <nl> * point using a short zLightNear . ( Default 5m ) . <nl> * <nl> - * @ param zLightFar Distance from the camera after which lighits are not expected to be visible . <nl> + * @ param zLightFar Distance from the camera after which lights are not expected to be visible . <nl> * Similarly to zLightNear , setting this value properly can improve <nl> * performance . ( Default 100m ) . <nl> * <nl>
|
fix more comment typos
|
google/filament
|
a547f11a8cf786134e1233c7f9f7c45b77ca7e0e
|
2018-10-18T23:49:47Z
|
mmm a / xbmc / ServiceBroker . cpp <nl> ppp b / xbmc / ServiceBroker . cpp <nl> <nl> <nl> # include " ServiceBroker . h " <nl> # include " Application . h " <nl> - # include " rendering / RenderSystem . h " <nl> # include " windowing / WinSystem . h " <nl> <nl> using namespace KODI ; <nl> CWinSystemBase & CServiceBroker : : GetWinSystem ( ) <nl> <nl> CRenderSystemBase & CServiceBroker : : GetRenderSystem ( ) <nl> { <nl> - CRenderSystemBase & renderSystem = dynamic_cast < CRenderSystemBase & > ( g_application . m_ServiceManager - > GetWinSystem ( ) ) ; <nl> - return renderSystem ; <nl> + return * g_application . m_ServiceManager - > GetWinSystem ( ) . GetRenderSystem ( ) ; <nl> } <nl> <nl> CPowerManager & CServiceBroker : : GetPowerManager ( ) <nl> mmm a / xbmc / windowing / WinSystem . h <nl> ppp b / xbmc / windowing / WinSystem . h <nl> struct REFRESHRATE <nl> int ResInfo_Index ; <nl> } ; <nl> <nl> + class CRenderSystemBase ; <nl> class IRenderLoop ; <nl> <nl> class CWinSystemBase <nl> class CWinSystemBase <nl> <nl> static std : : unique_ptr < CWinSystemBase > CreateWinSystem ( ) ; <nl> <nl> + / / Access render system interface <nl> + virtual CRenderSystemBase * GetRenderSystem ( ) { return nullptr ; } <nl> + <nl> / / windowing interfaces <nl> virtual bool InitWindowSystem ( ) ; <nl> virtual bool DestroyWindowSystem ( ) ; <nl> mmm a / xbmc / windowing / X11 / WinSystemX11GLContext . h <nl> ppp b / xbmc / windowing / X11 / WinSystemX11GLContext . h <nl> class CWinSystemX11GLContext : public CWinSystemX11 , public CRenderSystemGL <nl> public : <nl> CWinSystemX11GLContext ( ) ; <nl> ~ CWinSystemX11GLContext ( ) override ; <nl> + <nl> + / / Implementation of CWinSystem via CWinSystemX11 <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool CreateNewWindow ( const std : : string & name , bool fullScreen , RESOLUTION_INFO & res ) override ; <nl> bool ResizeWindow ( int newWidth , int newHeight , int newLeft , int newTop ) override ; <nl> void FinishWindowResize ( int newWidth , int newHeight ) override ; <nl> mmm a / xbmc / windowing / amlogic / WinSystemAmlogicGLESContext . h <nl> ppp b / xbmc / windowing / amlogic / WinSystemAmlogicGLESContext . h <nl> class CWinSystemAmlogicGLESContext : public CWinSystemAmlogic , public CRenderSys <nl> CWinSystemAmlogicGLESContext ( ) = default ; <nl> virtual ~ CWinSystemAmlogicGLESContext ( ) = default ; <nl> <nl> + / / Implementation of CWinSystemBase via CWinSystemAmlogic <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool InitWindowSystem ( ) override ; <nl> bool CreateNewWindow ( const std : : string & name , <nl> bool fullScreen , <nl> mmm a / xbmc / windowing / android / WinSystemAndroidGLESContext . h <nl> ppp b / xbmc / windowing / android / WinSystemAndroidGLESContext . h <nl> class CWinSystemAndroidGLESContext : public CWinSystemAndroid , public CRenderSys <nl> CWinSystemAndroidGLESContext ( ) = default ; <nl> virtual ~ CWinSystemAndroidGLESContext ( ) = default ; <nl> <nl> + / / Implementation of CWinSystemBase via CWinSystemAndroid <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool InitWindowSystem ( ) override ; <nl> bool CreateNewWindow ( const std : : string & name , <nl> bool fullScreen , <nl> mmm a / xbmc / windowing / gbm / WinSystemGbmGLESContext . h <nl> ppp b / xbmc / windowing / gbm / WinSystemGbmGLESContext . h <nl> class CWinSystemGbmGLESContext : public CWinSystemGbm , public CRenderSystemGLES <nl> CWinSystemGbmGLESContext ( ) = default ; <nl> virtual ~ CWinSystemGbmGLESContext ( ) = default ; <nl> <nl> + / / Implementation of CWinSystemBase via CWinSystemGbm <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool InitWindowSystem ( ) override ; <nl> bool DestroyWindowSystem ( ) override ; <nl> bool CreateNewWindow ( const std : : string & name , <nl> mmm a / xbmc / windowing / mir / WinSystemMirGLContext . h <nl> ppp b / xbmc / windowing / mir / WinSystemMirGLContext . h <nl> class CWinSystemMirGLContext : public CWinSystemMir , public CRenderSystemGL <nl> CWinSystemMirGLContext ( ) = default ; <nl> virtual ~ CWinSystemMirGLContext ( ) = default ; <nl> <nl> + / / Implementation of CWinSystemBase via CWinSystemMir <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool CreateNewWindow ( const std : : string & name , <nl> bool fullScreen , <nl> RESOLUTION_INFO & res ) override ; <nl> mmm a / xbmc / windowing / mir / WinSystemMirGLESContext . h <nl> ppp b / xbmc / windowing / mir / WinSystemMirGLESContext . h <nl> class CWinSystemMirGLESContext : public CWinSystemMir , public CRenderSystemGLES <nl> CWinSystemMirGLESContext ( ) = default ; <nl> virtual ~ CWinSystemMirGLESContext ( ) = default ; <nl> <nl> + / / Implementation of CWinSystemBase via CWinSystemMir <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool CreateNewWindow ( const std : : string & name , <nl> bool fullScreen , <nl> RESOLUTION_INFO & res ) override ; <nl> mmm a / xbmc / windowing / osx / WinSystemIOS . h <nl> ppp b / xbmc / windowing / osx / WinSystemIOS . h <nl> class CWinSystemIOS : public CWinSystemBase , public CRenderSystemGLES <nl> CWinSystemIOS ( ) ; <nl> virtual ~ CWinSystemIOS ( ) ; <nl> <nl> + / / Implementation of CWinSystemBase <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool InitWindowSystem ( ) override ; <nl> bool DestroyWindowSystem ( ) override ; <nl> bool CreateNewWindow ( const std : : string & name , bool fullScreen , RESOLUTION_INFO & res ) override ; <nl> mmm a / xbmc / windowing / osx / WinSystemOSXGL . h <nl> ppp b / xbmc / windowing / osx / WinSystemOSXGL . h <nl> class CWinSystemOSXGL : public CWinSystemOSX , public CRenderSystemGL <nl> public : <nl> CWinSystemOSXGL ( ) ; <nl> virtual ~ CWinSystemOSXGL ( ) ; <nl> + <nl> + / / Implementation of CWinSystemBase via CWinSystemOSX <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> virtual bool ResizeWindow ( int newWidth , int newHeight , int newLeft , int newTop ) override ; <nl> virtual bool SetFullScreen ( bool fullScreen , RESOLUTION_INFO & res , bool blankOtherDisplays ) override ; <nl> <nl> mmm a / xbmc / windowing / rpi / WinSystemRpiGLESContext . h <nl> ppp b / xbmc / windowing / rpi / WinSystemRpiGLESContext . h <nl> class CWinSystemRpiGLESContext : public CWinSystemRpi , public CRenderSystemGLES <nl> CWinSystemRpiGLESContext ( ) = default ; <nl> virtual ~ CWinSystemRpiGLESContext ( ) = default ; <nl> <nl> + / / Implementation of CWinSystemBase via CWinSystemRpi <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool InitWindowSystem ( ) override ; <nl> bool CreateNewWindow ( const std : : string & name , <nl> bool fullScreen , <nl> mmm a / xbmc / windowing / wayland / WinSystemWaylandEGLContextGL . h <nl> ppp b / xbmc / windowing / wayland / WinSystemWaylandEGLContextGL . h <nl> namespace WAYLAND <nl> class CWinSystemWaylandEGLContextGL : public CWinSystemWaylandEGLContext , public CRenderSystemGL <nl> { <nl> public : <nl> + / / Implementation of CWinSystemBase via CWinSystemWaylandEGLContext <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool InitWindowSystem ( ) override ; <nl> + <nl> protected : <nl> bool CreateContext ( ) override ; <nl> void SetContextSize ( CSizeInt size ) override ; <nl> mmm a / xbmc / windowing / wayland / WinSystemWaylandEGLContextGLES . h <nl> ppp b / xbmc / windowing / wayland / WinSystemWaylandEGLContextGLES . h <nl> namespace WAYLAND <nl> class CWinSystemWaylandEGLContextGLES : public CWinSystemWaylandEGLContext , public CRenderSystemGLES <nl> { <nl> public : <nl> + / / Implementation of CWinSystemBase via CWinSystemWaylandEGLContext <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool InitWindowSystem ( ) override ; <nl> + <nl> protected : <nl> bool CreateContext ( ) override ; <nl> void SetContextSize ( CSizeInt size ) override ; <nl> mmm a / xbmc / windowing / win10 / WinSystemWin10DX . h <nl> ppp b / xbmc / windowing / win10 / WinSystemWin10DX . h <nl> class CWinSystemWin10DX : public CWinSystemWin10 , public CRenderSystemDX <nl> CWinSystemWin10DX ( ) ; <nl> ~ CWinSystemWin10DX ( ) ; <nl> <nl> + / / Implementation of CWinSystemBase via CWinSystemWin10 <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool CreateNewWindow ( const std : : string & name , bool fullScreen , RESOLUTION_INFO & res ) override ; <nl> bool ResizeWindow ( int newWidth , int newHeight , int newLeft , int newTop ) override ; <nl> bool SetFullScreen ( bool fullScreen , RESOLUTION_INFO & res , bool blankOtherDisplays ) override ; <nl> class CWinSystemWin10DX : public CWinSystemWin10 , public CRenderSystemDX <nl> bool IsStereoEnabled ( ) override ; <nl> } ; <nl> <nl> - # endif / / WIN_SYSTEM_WIN32_DX_H <nl> \ No newline at end of file <nl> + # endif / / WIN_SYSTEM_WIN32_DX_H <nl> mmm a / xbmc / windowing / windows / WinSystemWin32DX . h <nl> ppp b / xbmc / windowing / windows / WinSystemWin32DX . h <nl> class CWinSystemWin32DX : public CWinSystemWin32 , public CRenderSystemDX <nl> CWinSystemWin32DX ( ) ; <nl> ~ CWinSystemWin32DX ( ) ; <nl> <nl> + / / Implementation of CWinSystemBase via CWinSystemWin32 <nl> + CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> bool CreateNewWindow ( const std : : string & name , bool fullScreen , RESOLUTION_INFO & res ) override ; <nl> bool ResizeWindow ( int newWidth , int newHeight , int newLeft , int newTop ) override ; <nl> bool SetFullScreen ( bool fullScreen , RESOLUTION_INFO & res , bool blankOtherDisplays ) override ; <nl>
|
Move RenderSystem access to WinSystem
|
xbmc/xbmc
|
c71cf98667481d267f6e472183603a6bfd036d17
|
2018-03-21T21:55:26Z
|
mmm a / stdlib / runtime / Casting . cpp <nl> ppp b / stdlib / runtime / Casting . cpp <nl> static inline bool swift_isClassOrObjCExistentialImpl ( const Metadata * T ) { <nl> static_cast < const ExistentialTypeMetadata * > ( T ) - > isObjC ( ) ) ; <nl> } <nl> <nl> + / / / \ param value passed at + 1 , consumed . <nl> extern " C " HeapObject * swift_bridgeNonVerbatimToObjectiveC ( <nl> OpaqueValue * value , const Metadata * T <nl> ) { <nl> assert ( ! swift_isClassOrObjCExistentialImpl ( T ) ) ; <nl> <nl> if ( const auto * bridgeWitness = findBridgeWitness ( T ) ) { <nl> - if ( ! bridgeWitness - > isBridgedToObjectiveC ( T , T ) ) <nl> - return nullptr ; <nl> + if ( ! bridgeWitness - > isBridgedToObjectiveC ( T , T ) ) { <nl> + / / Witnesses take ' self ' at + 0 , so we still need to consume the + 1 argument . <nl> + T - > vw_destroy ( value ) ; <nl> + return nullptr ; <nl> + } <nl> auto result = bridgeWitness - > bridgeToObjectiveC ( value , T ) ; <nl> / / Witnesses take ' self ' at + 0 , so we still need to consume the + 1 argument . <nl> T - > vw_destroy ( value ) ; <nl> return result ; <nl> } <nl> <nl> + / / Consume the + 1 argument . <nl> + T - > vw_destroy ( value ) ; <nl> return nullptr ; <nl> } <nl> <nl> mmm a / test / stdlib / Runtime . swift <nl> ppp b / test / stdlib / Runtime . swift <nl> import Swift <nl> import StdlibUnittest <nl> import Foundation <nl> <nl> + var nsObjectCanaryCount = 0 <nl> + @ objc class NSObjectCanary : NSObject { <nl> + override init ( ) { <nl> + + + nsObjectCanaryCount <nl> + } <nl> + deinit { <nl> + - - nsObjectCanaryCount <nl> + } <nl> + } <nl> + <nl> + struct NSObjectCanaryStruct { <nl> + var ref = NSObjectCanary ( ) <nl> + } <nl> + <nl> + var swiftObjectCanaryCount = 0 <nl> + class SwiftObjectCanary { <nl> + init ( ) { <nl> + + + swiftObjectCanaryCount <nl> + } <nl> + deinit { <nl> + - - swiftObjectCanaryCount <nl> + } <nl> + } <nl> + <nl> + struct SwiftObjectCanaryStruct { <nl> + var ref = SwiftObjectCanary ( ) <nl> + } <nl> + <nl> @ objc class ClassA { <nl> init ( value : Int ) { <nl> self . value = value <nl> import Foundation <nl> <nl> struct NotBridgedValueType { <nl> / / Keep it pointer - sized . <nl> - var a : ClassA = ClassA ( value : 4242 ) <nl> + var canaryRef = SwiftObjectCanary ( ) <nl> } <nl> <nl> struct BridgedValueType : _ObjectiveCBridgeable { <nl> + init ( value : Int ) { <nl> + self . value = value <nl> + } <nl> + <nl> static func _getObjectiveCType ( ) - > Any . Type { <nl> return ClassA . self <nl> } <nl> struct BridgedValueType : _ObjectiveCBridgeable { <nl> } <nl> <nl> var value : Int <nl> + var canaryRef = SwiftObjectCanary ( ) <nl> } <nl> <nl> struct BridgedLargeValueType : _ObjectiveCBridgeable { <nl> struct BridgedLargeValueType : _ObjectiveCBridgeable { <nl> <nl> var ( value0 , value1 , value2 , value3 ) : ( Int , Int , Int , Int ) <nl> var ( value4 , value5 , value6 , value7 ) : ( Int , Int , Int , Int ) <nl> + var canaryRef = SwiftObjectCanary ( ) <nl> } <nl> <nl> <nl> struct ConditionallyBridgedValueType < T > : _ObjectiveCBridgeable { <nl> + init ( value : Int ) { <nl> + self . value = value <nl> + } <nl> + <nl> static func _getObjectiveCType ( ) - > Any . Type { <nl> return ClassA . self <nl> } <nl> struct ConditionallyBridgedValueType < T > : _ObjectiveCBridgeable { <nl> } <nl> <nl> var value : Int <nl> + var canaryRef = SwiftObjectCanary ( ) <nl> + } <nl> + <nl> + class BridgedVerbatimRefType { <nl> + var value : Int = 42 <nl> + var canaryRef = SwiftObjectCanary ( ) <nl> } <nl> <nl> - class BridgedVerbatimRefType { } <nl> + func withSwiftObjectCanary < T > ( <nl> + createValue : ( ) - > T , <nl> + check : ( T ) - > ( ) , <nl> + file : String = __FILE__ , line : UWord = __LINE__ <nl> + ) { <nl> + let stackTrace = SourceLocStack ( SourceLoc ( file , line ) ) <nl> + <nl> + swiftObjectCanaryCount = 0 <nl> + if true { <nl> + var valueWithCanary = createValue ( ) <nl> + expectEqual ( 1 , swiftObjectCanaryCount , stackTrace : stackTrace ) <nl> + check ( valueWithCanary ) <nl> + } <nl> + expectEqual ( 0 , swiftObjectCanaryCount , stackTrace : stackTrace ) <nl> + } <nl> <nl> var Runtime = TestCase ( " Runtime " ) <nl> <nl> Runtime . test ( " bridgeToObjectiveC " ) { <nl> expectTrue ( _bridgeToObjectiveC ( bridgedVerbatimRef ) = = = bridgedVerbatimRef ) <nl> } <nl> <nl> + Runtime . test ( " bridgeToObjectiveC / NoLeak " ) { <nl> + withSwiftObjectCanary ( <nl> + { NotBridgedValueType ( ) } , <nl> + { expectEmpty ( _bridgeToObjectiveC ( $ 0 ) ) } ) <nl> + <nl> + withSwiftObjectCanary ( <nl> + { BridgedValueType ( value : 42 ) } , <nl> + { expectEqual ( 42 , ( _bridgeToObjectiveC ( $ 0 ) as ClassA ) . value ) } ) <nl> + <nl> + withSwiftObjectCanary ( <nl> + { BridgedLargeValueType ( value : 42 ) } , <nl> + { expectEqual ( 42 , ( _bridgeToObjectiveC ( $ 0 ) as ClassA ) . value ) } ) <nl> + <nl> + withSwiftObjectCanary ( <nl> + { ConditionallyBridgedValueType < Int > ( value : 42 ) } , <nl> + { expectEqual ( 42 , ( _bridgeToObjectiveC ( $ 0 ) as ClassA ) . value ) } ) <nl> + <nl> + withSwiftObjectCanary ( <nl> + { ConditionallyBridgedValueType < String > ( value : 42 ) } , <nl> + { expectEmpty ( _bridgeToObjectiveC ( $ 0 ) ) } ) <nl> + <nl> + withSwiftObjectCanary ( <nl> + { BridgedVerbatimRefType ( ) } , <nl> + { expectTrue ( _bridgeToObjectiveC ( $ 0 ) = = = $ 0 ) } ) <nl> + } <nl> + <nl> Runtime . test ( " forceBridgeFromObjectiveC " ) { <nl> / / Bridge back using NotBridgedValueType . <nl> expectEmpty ( _conditionallyBridgeFromObjectiveC ( <nl> Runtime . run ( ) <nl> <nl> var RuntimeFoundationWrappers = TestCase ( " RuntimeFoundationWrappers " ) <nl> <nl> - var nsObjectCanaryCount = 0 <nl> - @ objc class NSObjectCanary : NSObject { <nl> - override init ( ) { <nl> - + + nsObjectCanaryCount <nl> - } <nl> - deinit { <nl> - - - nsObjectCanaryCount <nl> - } <nl> - } <nl> - <nl> - struct NSObjectCanaryStruct { <nl> - var ref = NSObjectCanary ( ) <nl> - } <nl> - <nl> - var swiftObjectCanaryCount = 0 <nl> - class SwiftObjectCanary { <nl> - init ( ) { <nl> - + + swiftObjectCanaryCount <nl> - } <nl> - deinit { <nl> - - - swiftObjectCanaryCount <nl> - } <nl> - } <nl> - <nl> - struct SwiftObjectCanaryStruct { <nl> - var ref = SwiftObjectCanary ( ) <nl> - } <nl> - <nl> RuntimeFoundationWrappers . test ( " _stdlib_NSObject_isEqual / NoLeak " ) { <nl> nsObjectCanaryCount = 0 <nl> if true { <nl>
|
stdlib / runtime : fix leaks in swift_bridgeNonVerbatimToObjectiveC
|
apple/swift
|
c7a5b1daca0f8f8b687d89bd995f1b2acc7c90d0
|
2014-07-31T15:49:17Z
|
mmm a / torch / lib / THCUNN / generic / THCUNN . h <nl> ppp b / torch / lib / THCUNN / generic / THCUNN . h <nl> TH_API void THNN_ ( MultiLabelMarginCriterion_updateGradInput ) ( <nl> THCTensor * istarget , <nl> bool sizeaverage ) ; <nl> <nl> - TH_API void THNN_ ( MultiMarginCriterion_updateGradInput ) ( <nl> - THCState * state , <nl> - THCTensor * input , <nl> - THCIndexTensor * target , <nl> - THCTensor * gradInput , <nl> - bool sizeAverage , <nl> - int p , <nl> - THCTensor * weights , <nl> - real margin ) ; <nl> - <nl> TH_API void THNN_ ( MultiMarginCriterion_updateOutput ) ( <nl> THCState * state , <nl> THCTensor * input , <nl> TH_API void THNN_ ( MultiMarginCriterion_updateOutput ) ( <nl> THCTensor * output , <nl> bool sizeAverage , <nl> int p , <nl> - THCTensor * weights , / / [ OPTIONAL ] <nl> + THCTensor * weights , / / [ OPTIONAL ] <nl> real margin ) ; <nl> <nl> TH_API void THNN_ ( MultiMarginCriterion_updateGradInput ) ( <nl> TH_API void THNN_ ( MultiMarginCriterion_updateGradInput ) ( <nl> THCTensor * gradInput , <nl> bool sizeAverage , <nl> int p , <nl> - THCTensor * weights , / / [ OPTIONAL ] <nl> + THCTensor * weights , / / [ OPTIONAL ] <nl> real margin ) ; <nl> <nl> TH_API void THNN_ ( PReLU_updateOutput ) ( <nl> TH_API void THNN_ ( SpatialConvolutionMM_updateOutput ) ( <nl> THCTensor * input , <nl> THCTensor * output , <nl> THCTensor * weight , <nl> - THCTensor * bias , <nl> + THCTensor * bias , / / [ OPTIONAL ] <nl> THCTensor * columns , <nl> THCTensor * ones , <nl> int kW , int kH , <nl> TH_API void THNN_ ( SpatialConvolutionMM_accGradParameters ) ( <nl> THCTensor * input , <nl> THCTensor * gradOutput , <nl> THCTensor * gradWeight , <nl> - THCTensor * gradBias , <nl> + THCTensor * gradBias , / / [ OPTIONAL ] <nl> THCTensor * columns , <nl> THCTensor * ones , <nl> int kW , int kH , <nl> TH_API void THNN_ ( VolumetricAveragePooling_updateGradInput ) ( <nl> int kT , int kW , int kH , <nl> int dT , int dW , int dH ) ; <nl> <nl> - TH_API void THNN_ ( VolumetricReplicationPadding_updateOutput ) ( <nl> - THCState * state , <nl> - THCTensor * input , <nl> - THCTensor * output , <nl> - int pleft , int pright , <nl> - int ptop , int pbottom , <nl> - int pfront , int pback ) ; <nl> - <nl> TH_API void THNN_ ( VolumetricConvolution_updateOutput ) ( <nl> THCState * state , <nl> THCTensor * input , <nl> TH_API void THNN_ ( VolumetricMaxUnpooling_updateGradInput ) ( <nl> int dT , int dW , int dH , <nl> int padT , int padW , int padH ) ; <nl> <nl> - TH_API void THNN_ ( VolumetricReplicationPadding_updateGradInput ) ( <nl> + TH_API void THNN_ ( VolumetricReplicationPadding_updateOutput ) ( <nl> THCState * state , <nl> THCTensor * input , <nl> - THCTensor * gradOutput , <nl> - THCTensor * gradInput , <nl> + THCTensor * output , <nl> int pleft , int pright , <nl> int ptop , int pbottom , <nl> int pfront , int pback ) ; <nl> <nl> - TH_API void THNN_ ( VolumetricReplicationPadding_updateOutput ) ( <nl> + TH_API void THNN_ ( VolumetricReplicationPadding_updateGradInput ) ( <nl> THCState * state , <nl> THCTensor * input , <nl> - THCTensor * output , <nl> + THCTensor * gradOutput , <nl> + THCTensor * gradInput , <nl> int pleft , int pright , <nl> int ptop , int pbottom , <nl> int pfront , int pback ) ; <nl>
|
Merge commit ' aeed8a6ea4650d1092289a60e71d8d83875a0ba6 '
|
pytorch/pytorch
|
456998f043c1281a1d202ab26dd7507bbd2a4902
|
2016-11-15T20:55:11Z
|
mmm a / gRPC . podspec <nl> ppp b / gRPC . podspec <nl> <nl> <nl> Pod : : Spec . new do | s | <nl> s . name = ' gRPC ' <nl> - version = ' 0 . 12 . 0 ' <nl> + version = ' 0 . 14 . 0 ' <nl> s . version = version <nl> s . summary = ' gRPC client library for iOS / OSX ' <nl> s . homepage = ' http : / / www . grpc . io ' <nl> mmm a / src / objective - c / CronetFramework . podspec <nl> ppp b / src / objective - c / CronetFramework . podspec <nl> Pod : : Spec . new do | s | <nl> s . license = { : type = > ' BSD ' } <nl> s . vendored_framework = " Cronet . framework " <nl> s . author = " The Chromium Authors " <nl> - s . ios . deployment_target = " 8 . 0 " <nl> + s . ios . deployment_target = " 7 . 1 " <nl> s . source = { : http = > ' https : / / storage . googleapis . com / grpc - precompiled - binaries / cronet / Cronet . framework . zip ' } <nl> s . preserve_paths = " Cronet . framework " <nl> s . public_header_files = " Cronet . framework / Headers / * * / * { . h } " <nl> mmm a / src / objective - c / tests / Podfile <nl> ppp b / src / objective - c / tests / Podfile <nl> post_install do | installer | <nl> target . build_configurations . each do | config | <nl> config . build_settings [ ' GCC_TREAT_WARNINGS_AS_ERRORS ' ] = ' YES ' <nl> end <nl> - if target . name = = ' gRPC ' <nl> + if target . name = = ' gRPC - Core ' <nl> target . build_configurations . each do | config | <nl> # TODO ( zyc ) Remove this setting after the issue is resolved <nl> # GPR_UNREACHABLE_CODE causes " Control may reach end of non - void <nl>
|
Merge fixup : version , deployment target & spec name
|
grpc/grpc
|
bb160258407289e9ab0dbb60c7d369c801bb3311
|
2016-07-01T17:09:16Z
|
mmm a / aten / src / ATen / native / Pooling . cpp <nl> ppp b / aten / src / ATen / native / Pooling . cpp <nl> std : : tuple < Tensor , Tensor > adaptive_max_pool1d ( const Tensor & self , IntList outpu <nl> return std : : make_tuple ( output . squeeze ( 2 ) , indices . squeeze ( 2 ) ) ; <nl> } <nl> <nl> - std : : tuple < Tensor , Tensor > max_pool1d ( <nl> - const Tensor & self , IntList kernel_size , IntList stride , IntList padding , <nl> - IntList dilation , bool ceil_mode ) { <nl> - <nl> + std : : tuple < Tensor , Tensor > max_pool1d_with_indices ( <nl> + const Tensor & self , <nl> + IntList kernel_size , <nl> + IntList stride , <nl> + IntList padding , <nl> + IntList dilation , <nl> + bool ceil_mode ) { <nl> if ( stride . empty ( ) ) { <nl> stride = kernel_size ; <nl> } <nl> std : : tuple < Tensor , Tensor > max_pool1d ( <nl> check1d ( " max_pool1d " , " dilation " , dilation ) ; <nl> <nl> Tensor output , indices ; <nl> - std : : tie ( output , indices ) = at : : max_pool2d ( <nl> + std : : tie ( output , indices ) = at : : max_pool2d_with_indices ( <nl> self . unsqueeze ( 2 ) , <nl> { 1 , kernel_size [ 0 ] } , <nl> { 1 , stride [ 0 ] } , <nl> Tensor avg_pool1d ( <nl> <nl> return output . squeeze ( 2 ) ; <nl> } <nl> + <nl> + Tensor max_pool1d ( <nl> + const Tensor & self , <nl> + IntList kernel_size , <nl> + IntList stride , <nl> + IntList padding , <nl> + IntList dilation , <nl> + bool ceil_mode ) { <nl> + auto output_and_indices = at : : max_pool1d_with_indices ( <nl> + self , kernel_size , stride , padding , dilation , ceil_mode ) ; <nl> + return std : : get < 0 > ( output_and_indices ) ; <nl> + } <nl> + <nl> + Tensor max_pool2d ( <nl> + const Tensor & self , <nl> + IntList kernel_size , <nl> + IntList stride , <nl> + IntList padding , <nl> + IntList dilation , <nl> + bool ceil_mode ) { <nl> + auto output_and_indices = at : : max_pool2d_with_indices ( <nl> + self , kernel_size , stride , padding , dilation , ceil_mode ) ; <nl> + return std : : get < 0 > ( output_and_indices ) ; <nl> + } <nl> + <nl> + Tensor max_pool3d ( <nl> + const Tensor & self , <nl> + IntList kernel_size , <nl> + IntList stride , <nl> + IntList padding , <nl> + IntList dilation , <nl> + bool ceil_mode ) { <nl> + auto output_and_indices = at : : max_pool3d_with_indices ( <nl> + self , kernel_size , stride , padding , dilation , ceil_mode ) ; <nl> + return std : : get < 0 > ( output_and_indices ) ; <nl> + } <nl> } / / namespace native <nl> } / / namespace at <nl> mmm a / aten / src / ATen / native / native_functions . yaml <nl> ppp b / aten / src / ATen / native / native_functions . yaml <nl> <nl> <nl> - func : max_values ( Tensor self , int64_t dim , bool keepdim = false ) - > Tensor <nl> <nl> - - func : max_pool1d ( Tensor self , IntList [ 1 ] kernel_size , IntList [ 1 ] stride = { } , IntList [ 1 ] padding = 0 , IntList [ 1 ] dilation = 1 , bool ceil_mode = false ) - > ( Tensor , Tensor ) <nl> + - func : max_pool1d_with_indices ( Tensor self , IntList [ 1 ] kernel_size , IntList [ 1 ] stride = { } , IntList [ 1 ] padding = 0 , IntList [ 1 ] dilation = 1 , bool ceil_mode = false ) - > ( Tensor , Tensor ) <nl> + variants : function <nl> + <nl> + - func : max_pool1d ( Tensor self , IntList [ 1 ] kernel_size , IntList [ 1 ] stride = { } , IntList [ 1 ] padding = 0 , IntList [ 1 ] dilation = 1 , bool ceil_mode = false ) - > Tensor <nl> + variants : function <nl> + <nl> + - func : max_pool2d ( Tensor self , IntList [ 1 ] kernel_size , IntList [ 1 ] stride = { } , IntList [ 1 ] padding = 0 , IntList [ 1 ] dilation = 1 , bool ceil_mode = false ) - > Tensor <nl> + variants : function <nl> + <nl> + - func : max_pool3d ( Tensor self , IntList [ 1 ] kernel_size , IntList [ 1 ] stride = { } , IntList [ 1 ] padding = 0 , IntList [ 1 ] dilation = 1 , bool ceil_mode = false ) - > Tensor <nl> variants : function <nl> <nl> # FIXME : These could be combined as optional < ScalarType > but for https : / / github . com / pytorch / pytorch / issues / 6593 . <nl> mmm a / aten / src / ATen / nn . yaml <nl> ppp b / aten / src / ATen / nn . yaml <nl> <nl> scalar_check : <nl> output : ' false ' <nl> <nl> - - name : max_pool2d ( Tensor self , IntList [ 2 ] kernel_size , IntList [ 2 ] stride = { } , IntList [ 2 ] padding = 0 , IntList [ 2 ] dilation = 1 , bool ceil_mode = false ) <nl> + - name : max_pool2d_with_indices ( Tensor self , IntList [ 2 ] kernel_size , IntList [ 2 ] stride = { } , IntList [ 2 ] padding = 0 , IntList [ 2 ] dilation = 1 , bool ceil_mode = false ) <nl> cname : SpatialDilatedMaxPooling <nl> default_init : <nl> stride : kernel_size <nl> <nl> - - name : max_pool3d ( Tensor self , IntList [ 3 ] kernel_size , IntList [ 3 ] stride = { } , IntList [ 3 ] padding = 0 , IntList [ 3 ] dilation = 1 , bool ceil_mode = false ) <nl> + - name : max_pool3d_with_indices ( Tensor self , IntList [ 3 ] kernel_size , IntList [ 3 ] stride = { } , IntList [ 3 ] padding = 0 , IntList [ 3 ] dilation = 1 , bool ceil_mode = false ) <nl> cname : VolumetricDilatedMaxPooling <nl> default_init : <nl> stride : kernel_size <nl> mmm a / test / cpp / api / integration . cpp <nl> ppp b / test / cpp / api / integration . cpp <nl> TEST_CASE ( " integration / mnist " , " [ cuda ] " ) { <nl> auto linear2 = model - > add ( Linear ( 50 , 10 ) , " linear2 " ) ; <nl> <nl> auto forward = [ & ] ( torch : : Tensor x ) { <nl> - x = std : : get < 0 > ( at : : max_pool2d ( conv1 - > forward ( x ) , { 2 , 2 } ) ) . clamp_min ( 0 ) ; <nl> + x = at : : max_pool2d ( conv1 - > forward ( x ) , { 2 , 2 } ) . relu ( ) ; <nl> x = conv2 - > forward ( x ) ; <nl> x = drop2d - > forward ( x ) ; <nl> - x = std : : get < 0 > ( at : : max_pool2d ( x , { 2 , 2 } ) ) . clamp_min ( 0 ) ; <nl> + x = at : : max_pool2d ( x , { 2 , 2 } ) . relu ( ) ; <nl> <nl> x = x . view ( { - 1 , 320 } ) ; <nl> x = linear1 - > forward ( x ) . clamp_min ( 0 ) ; <nl> TEST_CASE ( " integration / mnist / batchnorm " , " [ cuda ] " ) { <nl> auto linear2 = model - > add ( Linear ( 50 , 10 ) , " linear2 " ) ; <nl> <nl> auto forward = [ & ] ( torch : : Tensor x ) { <nl> - x = std : : get < 0 > ( at : : max_pool2d ( conv1 - > forward ( x ) , { 2 , 2 } ) ) . clamp_min ( 0 ) ; <nl> + x = at : : max_pool2d ( conv1 - > forward ( x ) , { 2 , 2 } ) . relu ( ) ; <nl> x = batchnorm2d - > forward ( x ) ; <nl> x = conv2 - > forward ( x ) ; <nl> - x = std : : get < 0 > ( at : : max_pool2d ( x , { 2 , 2 } ) ) . clamp_min ( 0 ) ; <nl> + x = at : : max_pool2d ( x , { 2 , 2 } ) . relu ( ) ; <nl> <nl> x = x . view ( { - 1 , 320 } ) ; <nl> x = linear1 - > forward ( x ) . clamp_min ( 0 ) ; <nl> mmm a / tools / autograd / derivatives . yaml <nl> ppp b / tools / autograd / derivatives . yaml <nl> <nl> - name : fractional_max_pool2d_forward ( Tensor self , IntList kernel_size , IntList output_size , Tensor random_samples ) <nl> self : fractional_max_pool2d_backward ( grad , self , kernel_size , output_size , indices ) <nl> <nl> - - name : max_pool2d_forward ( Tensor self , IntList kernel_size , IntList stride , IntList padding , IntList dilation , bool ceil_mode ) <nl> - self : max_pool2d_backward ( grad , self , kernel_size , stride , padding , dilation , ceil_mode , indices ) <nl> + - name : max_pool2d_with_indices_forward ( Tensor self , IntList kernel_size , IntList stride , IntList padding , IntList dilation , bool ceil_mode ) <nl> + self : max_pool2d_with_indices_backward ( grad , self , kernel_size , stride , padding , dilation , ceil_mode , indices ) <nl> <nl> - - name : max_pool3d_forward ( Tensor self , IntList kernel_size , IntList stride , IntList padding , IntList dilation , bool ceil_mode ) <nl> - self : max_pool3d_backward ( grad , self , kernel_size , stride , padding , dilation , ceil_mode , indices ) <nl> + - name : max_pool3d_with_indices_forward ( Tensor self , IntList kernel_size , IntList stride , IntList padding , IntList dilation , bool ceil_mode ) <nl> + self : max_pool3d_with_indices_backward ( grad , self , kernel_size , stride , padding , dilation , ceil_mode , indices ) <nl> <nl> - name : max_unpool2d_forward ( Tensor self , Tensor indices , IntList output_size ) <nl> self : max_unpool2d_backward ( grad , self , indices , output_size ) <nl> <nl> grad_output : leaky_relu_backward ( grad , self , negative_slope ) <nl> self : zeros_like ( grad ) <nl> <nl> - - name : max_pool2d_backward ( Tensor grad_output , Tensor self , IntList kernel_size , IntList stride , IntList padding , IntList dilation , bool ceil_mode , Tensor indices ) <nl> + - name : max_pool2d_with_indices_backward ( Tensor grad_output , Tensor self , IntList kernel_size , IntList stride , IntList padding , IntList dilation , bool ceil_mode , Tensor indices ) <nl> grad_output : max_pool_double_backward ( grad , indices , 2 ) ; <nl> self : zeros_like ( self ) <nl> <nl> - - name : max_pool3d_backward ( Tensor grad_output , Tensor self , IntList kernel_size , IntList stride , IntList padding , IntList dilation , bool ceil_mode , Tensor indices ) <nl> + - name : max_pool3d_with_indices_backward ( Tensor grad_output , Tensor self , IntList kernel_size , IntList stride , IntList padding , IntList dilation , bool ceil_mode , Tensor indices ) <nl> grad_output : max_pool_double_backward ( grad , indices , 3 ) ; <nl> self : zeros_like ( self ) <nl> <nl> mmm a / tools / autograd / gen_python_functions . py <nl> ppp b / tools / autograd / gen_python_functions . py <nl> <nl> ' index ' , <nl> ' _indexCopy_ ' , ' max_values ' , ' min_values ' , ' argmax ' , ' argmin ' , <nl> ' _cumsum . * ' , ' _cumprod . * ' , ' _sum . * ' , ' _prod . * ' , ' _th_sum . * ' , ' _th_prod . * ' , <nl> - ' arange . * ' , ' range . * ' , ' _gesv . * ' , ' slice ' , <nl> + ' arange . * ' , ' range . * ' , ' _gesv . * ' , ' slice ' , ' max_pool1d ' , ' max_pool2d ' , ' max_pool3d ' <nl> ] <nl> <nl> PY_VARIABLE_METHOD_VARARGS = CodeTemplate ( " " " \ <nl> mmm a / torch / nn / functional . py <nl> ppp b / torch / nn / functional . py <nl> def max_pool1d ( input , kernel_size , stride = None , padding = 0 , dilation = 1 , <nl> <nl> See : class : ` ~ torch . nn . MaxPool1d ` for details . <nl> " " " <nl> - ret = torch . max_pool1d ( input , kernel_size , stride , padding , dilation , ceil_mode ) <nl> + ret = torch . max_pool1d_with_indices ( input , kernel_size , stride , padding , dilation , ceil_mode ) <nl> return ret if return_indices else ret [ 0 ] <nl> <nl> <nl> def max_pool2d ( input , kernel_size , stride = None , padding = 0 , dilation = 1 , <nl> <nl> See : class : ` ~ torch . nn . MaxPool2d ` for details . <nl> " " " <nl> - ret = torch . _C . _nn . max_pool2d ( input , kernel_size , stride , padding , dilation , ceil_mode ) <nl> + ret = torch . _C . _nn . max_pool2d_with_indices ( input , kernel_size , stride , padding , dilation , ceil_mode ) <nl> return ret if return_indices else ret [ 0 ] <nl> <nl> <nl> def max_pool3d ( input , kernel_size , stride = None , padding = 0 , dilation = 1 , <nl> <nl> See : class : ` ~ torch . nn . MaxPool3d ` for details . <nl> " " " <nl> - ret = torch . _C . _nn . max_pool3d ( input , kernel_size , stride , padding , dilation , ceil_mode ) <nl> + ret = torch . _C . _nn . max_pool3d_with_indices ( input , kernel_size , stride , padding , dilation , ceil_mode ) <nl> return ret if return_indices else ret [ 0 ] <nl> <nl> <nl> mmm a / torch / onnx / symbolic . py <nl> ppp b / torch / onnx / symbolic . py <nl> def softplus ( g , self , beta , threshold ) : <nl> return g . op ( ' Softplus ' , self ) <nl> <nl> <nl> - def max_pool1d ( g , input , kernel_size , stride , padding , dilation , ceil_mode ) : <nl> + def max_pool1d_with_indices ( g , input , kernel_size , stride , padding , dilation , ceil_mode ) : <nl> if ceil_mode : <nl> - return _unimplemented ( " max_pool1d " , " ceil_mode " ) <nl> + return _unimplemented ( " max_pool1d_with_indices " , " ceil_mode " ) <nl> if set ( _single ( dilation ) ) ! = { 1 } : <nl> - return _unimplemented ( " max_pool1d " , " dilation " ) <nl> + return _unimplemented ( " max_pool1d_with_indices " , " dilation " ) <nl> if stride is None : <nl> stride = kernel_size <nl> r = g . op ( " MaxPool " , input , <nl> def max_pool1d ( g , input , kernel_size , stride , padding , dilation , ceil_mode ) : <nl> return r , None <nl> <nl> <nl> - def max_pool2d ( g , input , kernel_size , stride , padding , dilation , ceil_mode ) : <nl> + def max_pool2d_with_indices ( g , input , kernel_size , stride , padding , dilation , ceil_mode ) : <nl> if ceil_mode : <nl> - return _unimplemented ( " max_pool2d " , " ceil_mode " ) <nl> + return _unimplemented ( " max_pool2d_with_indices " , " ceil_mode " ) <nl> if set ( _pair ( dilation ) ) ! = { 1 } : <nl> - return _unimplemented ( " max_pool2d " , " dilation " ) <nl> + return _unimplemented ( " max_pool2d_with_indices " , " dilation " ) <nl> if not stride : <nl> stride = kernel_size <nl> r = g . op ( " MaxPool " , input , <nl> def max_pool2d ( g , input , kernel_size , stride , padding , dilation , ceil_mode ) : <nl> return r , None <nl> <nl> <nl> - def max_pool3d ( g , input , kernel_size , stride , padding , dilation , ceil_mode ) : <nl> + def max_pool3d_with_indices ( g , input , kernel_size , stride , padding , dilation , ceil_mode ) : <nl> if ceil_mode : <nl> - return _unimplemented ( " max_pool3d " , " ceil_mode " ) <nl> + return _unimplemented ( " max_pool3d_with_indices " , " ceil_mode " ) <nl> if set ( _triple ( dilation ) ) ! = { 1 } : <nl> - return _unimplemented ( " max_pool3d " , " dilation " ) <nl> + return _unimplemented ( " max_pool3d_with_indices " , " dilation " ) <nl> if not stride : <nl> stride = kernel_size <nl> r = g . op ( " MaxPool " , input , <nl>
|
Replace max_pool with max_pool_with_indices ( )
|
pytorch/pytorch
|
290d20b094dff35da866deafa92c12a6264dc544
|
2018-06-27T00:09:30Z
|
mmm a / tensorflow / tools / ci_build / sizetrack_helper . py <nl> ppp b / tensorflow / tools / ci_build / sizetrack_helper . py <nl> def main ( ) : <nl> print ( " DRY RUN : Generated this TSV row : " ) <nl> print ( " \ t " . join ( map ( str , next_tsv_row ) ) ) <nl> else : <nl> - with open ( " data . tsv " , " w " ) as tsvfile : <nl> - writer = csv . writer ( tsvfile , delimiter = " \ t " , quoting = csv . QUOTE_MINIMAL ) <nl> + with open ( " data . tsv " , " w " , newline = " " ) as tsvfile : <nl> + writer = csv . writer ( tsvfile , delimiter = " \ t " , quoting = csv . QUOTE_MINIMAL , <nl> + lineterminator = os . linesep ) <nl> writer . writerow ( next_tsv_row ) <nl> bq ( [ <nl> " load " , " - - source_format " , " CSV " , " - - field_delimiter " , " tab " , <nl>
|
Fix CSV writer on Windows
|
tensorflow/tensorflow
|
6411114cbd94777be68d78b6005cb44fad8e4983
|
2020-08-10T22:00:41Z
|
mmm a / tests / CMakeLists . txt <nl> ppp b / tests / CMakeLists . txt <nl> target_include_directories ( chain_test PUBLIC $ { CMAKE_CURRENT_SOURCE_DIR } / includ <nl> add_dependencies ( chain_test asserter test_api test_api_mem test_api_db test_api_multi_index exchange currency proxy identity identity_test stltest infinite eosio . system eosio . token eosio . bios test . inline multi_index_test noop dice eosio . msig ) <nl> <nl> # <nl> - configure_file ( $ { CMAKE_CURRENT_SOURCE_DIR } / llvm - gcov . sh $ { CMAKE_CURRENT_BINARY_DIR } / . . / llvm - gcov . sh COPYONLY ) <nl> - <nl> configure_file ( $ { CMAKE_CURRENT_SOURCE_DIR } / p2p_tests / sync / test . sh $ { CMAKE_CURRENT_BINARY_DIR } / p2p_tests / sync / test . sh COPYONLY ) <nl> configure_file ( $ { CMAKE_CURRENT_SOURCE_DIR } / p2p_tests / dawn_515 / test . sh $ { CMAKE_CURRENT_BINARY_DIR } / p2p_tests / dawn_515 / test . sh COPYONLY ) <nl> configure_file ( $ { CMAKE_CURRENT_SOURCE_DIR } / trans_sync_across_mixed_cluster_test . sh $ { CMAKE_CURRENT_BINARY_DIR } / trans_sync_across_mixed_cluster_test . sh COPYONLY ) <nl> endif ( ) <nl> # TODO : add_test ( NAME trans_sync_across_mixed_cluster_test COMMAND tests / trans_sync_across_mixed_cluster_test . sh - p 1 - n 2 WORKING_DIRECTORY $ { CMAKE_BINARY_DIR } ) <nl> add_test ( NAME distributed - transactions - test COMMAND tests / distributed - transactions - test . py - p 1 - n 4 - v - - dump - error - detail WORKING_DIRECTORY $ { CMAKE_BINARY_DIR } ) <nl> add_test ( NAME distributed - transactions - remote - test COMMAND tests / distributed - transactions - remote - test . py - v - - dump - error - detail WORKING_DIRECTORY $ { CMAKE_BINARY_DIR } ) <nl> - # TODO : add_test ( NAME restart - scenarios - test_resync COMMAND tests / restart - scenarios - test . py - c resync - p3 - - dump - error - details WORKING_DIRECTORY $ { CMAKE_BINARY_DIR } ) <nl> - # TODO : add_test ( NAME restart - scenarios - test_replay COMMAND tests / restart - scenarios - test . py - c replay - p3 - - dump - error - details WORKING_DIRECTORY $ { CMAKE_BINARY_DIR } ) <nl> + add_test ( NAME restart - scenarios - test_resync COMMAND tests / restart - scenarios - test . py - c resync - p4 - v - - dump - error - details WORKING_DIRECTORY $ { CMAKE_BINARY_DIR } ) <nl> + add_test ( NAME restart - scenarios - test_replay COMMAND tests / restart - scenarios - test . py - c replay - p4 - v - - dump - error - details WORKING_DIRECTORY $ { CMAKE_BINARY_DIR } ) <nl> # TODO : add_test ( NAME consensus - validation - malicious - producers COMMAND tests / consensus - validation - malicious - producers . py - w 80 - - dump - error - details WORKING_DIRECTORY $ { CMAKE_BINARY_DIR } ) <nl> <nl> if ( ENABLE_COVERAGE_TESTING ) <nl> if ( ENABLE_COVERAGE_TESTING ) <nl> endif ( ) # NOT GENHTML_PATH <nl> <nl> # no spaces allowed within tests list <nl> - set ( ctest_tests ' chain_test_binaryen | chain_test_wavm | p2p_dawn515_test ' ) <nl> - set ( ctest_exclude_tests ' nodeos_run_test | nodeos_run_remote_test | nodeos_run_test - mongodb | distributed - transactions - test | distributed - transactions - remote - test ' ) <nl> + set ( ctest_tests ' chain_test_binaryen | chain_test_wavm | p2p_dawn515_test | nodeos_run_test | distributed - transactions - test | restart - scenarios - test_resync ' ) <nl> + set ( ctest_exclude_tests ' nodeos_run_remote_test | nodeos_run_test - mongodb | distributed - transactions - remote - test | restart - scenarios - test_replay ' ) <nl> <nl> # Setup target <nl> add_custom_target ( $ { Coverage_NAME } <nl> if ( ENABLE_COVERAGE_TESTING ) <nl> COMMAND ctest - R $ { ctest_tests } - E $ { ctest_exclude_tests } <nl> <nl> COMMENT " Capturing lcov counters and generating report " <nl> - COMMAND $ { LCOV_PATH } - - directory . - - capture - - gcov - tool . / tests / llvm - gcov . sh - - output - file $ { Coverage_NAME } . info <nl> + COMMAND $ { LCOV_PATH } - - directory . - - capture - - gcov - tool . / tools / llvm - gcov . sh - - output - file $ { Coverage_NAME } . info <nl> <nl> COMMENT " Processing code coverage counters and generating report . " <nl> COMMAND $ { GENHTML_PATH } - o $ { Coverage_NAME } $ { PROJECT_BINARY_DIR } / $ { Coverage_NAME } . info <nl> mmm a / tests / distributed - transactions - test . py <nl> ppp b / tests / distributed - transactions - test . py <nl> def errorExit ( msg = " " , errorCode = 1 ) : <nl> parser . add_argument ( " - v " , help = " verbose " , action = ' store_true ' ) <nl> parser . add_argument ( " - - nodes - file " , type = str , help = " File containing nodes info in JSON format . " ) <nl> parser . add_argument ( " - - seed " , type = int , help = " random seed " , default = seed ) <nl> - parser . add_argument ( " - - not - noon " , help = " This is not the Noon branch . " , action = ' store_true ' ) <nl> parser . add_argument ( " - - dont - kill " , help = " Leave cluster running after test finishes " , action = ' store_true ' ) <nl> parser . add_argument ( " - - dump - error - details " , <nl> help = " Upon error print etc / eosio / node_ * / config . ini and var / lib / node_ * / stderr . log to stdout " , <nl> def errorExit ( msg = " " , errorCode = 1 ) : <nl> debug = args . v <nl> nodesFile = args . nodes_file <nl> seed = args . seed <nl> - amINoon = not args . not_noon <nl> dontKill = args . dont_kill <nl> dumpErrorDetails = args . dump_error_details <nl> <nl> def errorExit ( msg = " " , errorCode = 1 ) : <nl> testUtils . Utils . Debug = debug <nl> testSuccessful = False <nl> <nl> - if not amINoon : <nl> - testUtils . Utils . iAmNotNoon ( ) <nl> - <nl> random . seed ( seed ) # Use a fixed seed for repeatability . <nl> cluster = testUtils . Cluster ( walletd = True ) <nl> walletMgr = testUtils . WalletMgr ( True ) <nl> def errorExit ( msg = " " , errorCode = 1 ) : <nl> if not cluster . createAccounts ( initaAccount ) : <nl> errorExit ( " Accounts creation failed . " ) <nl> <nl> - # TDB : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> + # TBD : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> # Uncomment when functional <nl> # Print ( " Spread funds and validate " ) <nl> # if not cluster . spreadFundsAndValidate ( 10 ) : <nl> mmm a / tests / nodeos_run_test . py <nl> ppp b / tests / nodeos_run_test . py <nl> def cmdError ( name , code = 0 , exitNow = False ) : <nl> errorExit ( " Failed to transfer funds % d from account % s to % s " % ( <nl> transferAmount , initaAccount . name , testeraAccount . name ) ) <nl> <nl> - # TDB : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> + # TBD : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> # Uncomment when functional <nl> # expectedAmount = transferAmount <nl> # Print ( " Verify transfer , Expected : % d " % ( expectedAmount ) ) <nl> def cmdError ( name , code = 0 , exitNow = False ) : <nl> errorExit ( " Failed to force transfer funds % d from account % s to % s " % ( <nl> transferAmount , initaAccount . name , testeraAccount . name ) ) <nl> <nl> - # TDB : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> + # TBD : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> # Uncomment when functional <nl> # expectedAmount = 975421 <nl> # Print ( " Verify transfer , Expected : % d " % ( expectedAmount ) ) <nl> def cmdError ( name , code = 0 , exitNow = False ) : <nl> transferAmount , initaAccount . name , testeraAccount . name ) ) <nl> transId = testUtils . Node . getTransId ( trans ) <nl> <nl> - # TDB : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> + # TBD : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> # Uncomment when functional <nl> # expectedAmount = 975311 + 5000 # 5000 initial deposit <nl> # Print ( " Verify transfer , Expected : % d " % ( expectedAmount ) ) <nl> def cmdError ( name , code = 0 , exitNow = False ) : <nl> abiActionName = account [ " abi " ] [ " actions " ] [ 0 ] [ " name " ] <nl> abiType = account [ " abi " ] [ " actions " ] [ 0 ] [ " type " ] <nl> if abiName ! = " transfer " or abiActionName ! = " transfer " or abiType ! = " transfer " : <nl> - errorExit ( " FAILURE - get table currency account failed " , raw = True ) <nl> + errorExit ( " FAILURE - get EOS account failed " , raw = True ) <nl> <nl> Print ( " push create action to currency contract " ) <nl> contract = " currency " <nl> def cmdError ( name , code = 0 , exitNow = False ) : <nl> if trans is None or not trans [ 0 ] : <nl> errorExit ( " FAILURE - issue action to currency contract failed " , raw = True ) <nl> <nl> - # TODO need to update eosio . system contract to use new currency and update cleos and chain_plugin for interaction <nl> - # Print ( " Verify currency contract has proper initial balance ( via get table ) " ) <nl> - # contract = " currency " <nl> - # table = " accounts " <nl> - # row0 = node . getTableRow ( currencyAccount . name , contract , table , 0 ) <nl> - # if row0 is None : <nl> - # cmdError ( " % s get table currency account " % ( ClientName ) ) <nl> - # errorExit ( " Failed to retrieve contract % s table % s " % ( contract , table ) ) <nl> - # <nl> - # balanceKey = " balance " <nl> - # keyKey = " key " <nl> - # if row0 [ balanceKey ] ! = 1000000000 : <nl> - # errorExit ( " FAILURE - get table currency account failed " , raw = True ) <nl> - # <nl> - # Print ( " Verify currency contract has proper initial balance ( via get currency balance ) " ) <nl> - # res = node . getCurrencyBalance ( contract , currencyAccount . name , " CUR " ) <nl> - # if res is None : <nl> - # cmdError ( " % s get currency balance " % ( ClientName ) ) <nl> - # errorExit ( " Failed to retrieve CUR balance from contract % s account % s " % ( contract , currencyAccount . name ) ) <nl> - # <nl> - # if res . strip ( ) [ 1 : - 1 ] ! = " 100000 . 0000 CUR " : <nl> - # errorExit ( " FAILURE - get currency balance failed " , raw = True ) <nl> - # <nl> + Print ( " Verify currency contract has proper initial balance ( via get table ) " ) <nl> + contract = " currency " <nl> + table = " accounts " <nl> + row0 = node . getTableRow ( contract , currencyAccount . name , table , 0 ) <nl> + if row0 is None : <nl> + cmdError ( " % s get currency table currency account " % ( ClientName ) ) <nl> + errorExit ( " Failed to retrieve contract % s table % s " % ( contract , table ) ) <nl> + <nl> + balanceKey = " balance " <nl> + keyKey = " key " <nl> + if row0 [ balanceKey ] ! = " 100000 . 0000 CUR " : <nl> + errorExit ( " FAILURE - Wrong currency balance " , raw = True ) <nl> + <nl> + Print ( " Verify currency contract has proper initial balance ( via get currency balance ) " ) <nl> + res = node . getCurrencyBalance ( contract , currencyAccount . name , " CUR " ) <nl> + if res is None : <nl> + cmdError ( " % s get currency balance " % ( ClientName ) ) <nl> + errorExit ( " Failed to retrieve CUR balance from contract % s account % s " % ( contract , currencyAccount . name ) ) <nl> + <nl> + expected = " 100000 . 0000 CUR " <nl> + actual = res . strip ( ) <nl> + if actual ! = expected : <nl> + errorExit ( " FAILURE - get currency balance failed . Recieved response : < % s > " % ( res ) , raw = True ) <nl> + <nl> + # TBD : " get currency stats is still not working . Enable when ready . <nl> # Print ( " Verify currency contract has proper total supply of CUR ( via get currency stats ) " ) <nl> # res = node . getCurrencyStats ( contract , " CUR " ) <nl> # if res is None or not ( " supply " in res ) : <nl> # cmdError ( " % s get currency stats " % ( ClientName ) ) <nl> - # errorExit ( " Failed to retrieve CUR stats from contract " % ( contract ) ) <nl> - # <nl> + # errorExit ( " Failed to retrieve CUR stats from contract % s " % ( contract ) ) <nl> + <nl> # if res [ " supply " ] ! = " 100000 . 0000 CUR " : <nl> # errorExit ( " FAILURE - get currency stats failed " , raw = True ) <nl> <nl> def cmdError ( name , code = 0 , exitNow = False ) : <nl> errorExit ( " Failed to verify push message transaction id . " ) <nl> <nl> # TODO need to update eosio . system contract to use new currency and update cleos and chain_plugin for interaction <nl> - # Print ( " read current contract balance " ) <nl> - # contract = " currency " <nl> - # table = " accounts " <nl> - # row0 = node . getTableRow ( initaAccount . name , contract , table , 0 ) <nl> - # if row0 is None : <nl> - # cmdError ( " % s get table currency account " % ( ClientName ) ) <nl> - # errorExit ( " Failed to retrieve contract % s table % s " % ( contract , table ) ) <nl> - # <nl> - # balanceKey = " balance " <nl> - # keyKey = " key " <nl> - # if row0 [ balanceKey ] ! = 50 : <nl> - # errorExit ( " FAILURE - get table currency account failed " , raw = True ) <nl> - # <nl> - # row0 = node . getTableRow ( currencyAccount . name , contract , table , 0 ) <nl> - # if row0 is None : <nl> - # cmdError ( " % s get table currency account " % ( ClientName ) ) <nl> - # errorExit ( " Failed to retrieve contract % s table % s " % ( contract , table ) ) <nl> - # <nl> - # if row0 [ balanceKey ] ! = 999999950 : <nl> - # errorExit ( " FAILURE - get table currency account failed " , raw = True ) <nl> + Print ( " read current contract balance " ) <nl> + contract = " currency " <nl> + table = " accounts " <nl> + row0 = node . getTableRow ( contract , initaAccount . name , table , 0 ) <nl> + if row0 is None : <nl> + cmdError ( " % s get currency table inita account " % ( ClientName ) ) <nl> + errorExit ( " Failed to retrieve contract % s table % s " % ( contract , table ) ) <nl> + <nl> + balanceKey = " balance " <nl> + keyKey = " key " <nl> + expected = " 0 . 0050 CUR " <nl> + actual = row0 [ balanceKey ] <nl> + if actual ! = expected : <nl> + errorExit ( " FAILURE - Wrong currency balance ( expected = % s , actual = % s ) " % ( str ( expected ) , str ( actual ) ) , raw = True ) <nl> + <nl> + row0 = node . getTableRow ( contract , currencyAccount . name , table , 0 ) <nl> + if row0 is None : <nl> + cmdError ( " % s get currency table currency account " % ( ClientName ) ) <nl> + errorExit ( " Failed to retrieve contract % s table % s " % ( contract , table ) ) <nl> + <nl> + expected = " 99999 . 9950 CUR " <nl> + actual = row0 [ balanceKey ] <nl> + if actual ! = expected : <nl> + errorExit ( " FAILURE - Wrong currency balance ( expected = % s , actual = % s ) " % ( str ( expected ) , str ( actual ) ) , raw = True ) <nl> <nl> Print ( " Exchange Contract Tests " ) <nl> Print ( " upload exchange contract " ) <nl> def cmdError ( name , code = 0 , exitNow = False ) : <nl> for blockNum in range ( 1 , currentBlockNum + 1 ) : <nl> block = node . getBlock ( blockNum , retry = False , silentErrors = True ) <nl> if block is None : <nl> - # TDB : Known issue ( Issue 2099 ) that the block containing setprods isn ' t retrievable . <nl> + # TBD : Known issue ( Issue 2099 ) that the block containing setprods isn ' t retrievable . <nl> # Enable errorExit ( ) once that is resolved . <nl> Print ( " WARNING : Failed to get block % d ( probably issue 2099 ) . Report and keep going . . . " % ( blockNum ) ) <nl> # cmdError ( " % s get block " % ( ClientName ) ) <nl> mmm a / tests / restart - scenarios - test . py <nl> ppp b / tests / restart - scenarios - test . py <nl> <nl> import signal <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> - # Test for different test scenarios . <nl> + # Test for different nodes restart scenarios . <nl> # Nodes can be producing or non - producing . <nl> # - p < producing nodes count > <nl> # - c < chain strategy [ replay | resync | none ] > <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> <nl> <nl> - DefaultKillPercent = 25 <nl> Print = testUtils . Utils . Print <nl> <nl> def errorExit ( msg = " " , errorCode = 1 ) : <nl> def errorExit ( msg = " " , errorCode = 1 ) : <nl> parser . add_argument ( " - - kill - count " , type = int , help = " nodeos instances to kill " , default = - 1 ) <nl> parser . add_argument ( " - v " , help = " verbose logging " , action = ' store_true ' ) <nl> parser . add_argument ( " - - dont - kill " , help = " Leave cluster running after test finishes " , action = ' store_true ' ) <nl> - parser . add_argument ( " - - not - noon " , help = " This is not the Noon branch . " , action = ' store_true ' ) <nl> parser . add_argument ( " - - dump - error - details " , <nl> help = " Upon error print etc / eosio / node_ * / config . ini and var / lib / node_ * / stderr . log to stdout " , <nl> action = ' store_true ' ) <nl> def errorExit ( msg = " " , errorCode = 1 ) : <nl> chainSyncStrategyStr = args . c <nl> debug = args . v <nl> total_nodes = pnodes <nl> - killCount = args . kill_count if args . kill_count > 0 else int ( round ( ( DefaultKillPercent / 100 . 0 ) * total_nodes ) ) <nl> + killCount = args . kill_count if args . kill_count > 0 else 1 <nl> killSignal = args . kill_sig <nl> killEosInstances = not args . dont_kill <nl> dumpErrorDetails = args . dump_error_details <nl> keepLogs = args . keep_logs <nl> - amINoon = not args . not_noon <nl> <nl> + seed = 1 <nl> testUtils . Utils . Debug = debug <nl> + testSuccessful = False <nl> <nl> - if not amINoon : <nl> - testUtils . Utils . iAmNotNoon ( ) <nl> - <nl> - Print ( " producing nodes : % d , topology : % s , delay between nodes launch ( seconds ) : % d , chain sync strategy : % s " % ( <nl> - pnodes , topo , delay , chainSyncStrategyStr ) ) <nl> <nl> + random . seed ( seed ) # Use a fixed seed for repeatability . <nl> cluster = testUtils . Cluster ( ) <nl> walletMgr = testUtils . WalletMgr ( False ) <nl> - cluster . killall ( ) <nl> - cluster . cleanup ( ) <nl> - random . seed ( 1 ) # Use a fixed seed for repeatability . <nl> - testSuccessful = False <nl> <nl> try : <nl> cluster . setChainStrategy ( chainSyncStrategyStr ) <nl> cluster . setWalletMgr ( walletMgr ) <nl> + <nl> + cluster . killall ( ) <nl> + cluster . cleanup ( ) <nl> + <nl> + Print ( " producing nodes : % d , topology : % s , delay between nodes launch ( seconds ) : % d , chain sync strategy : % s " % ( <nl> + pnodes , topo , delay , chainSyncStrategyStr ) ) <nl> + <nl> Print ( " Stand up cluster " ) <nl> - if cluster . launch ( pnodes , total_nodes , topo , delay ) is False : <nl> + if cluster . launch ( pnodes , total_nodes , topo = topo , delay = delay ) is False : <nl> errorExit ( " Failed to stand up eos cluster . " ) <nl> <nl> Print ( " Wait for Cluster stabilization " ) <nl> def errorExit ( msg = " " , errorCode = 1 ) : <nl> if wallet is None : <nl> errorExit ( " Failed to create wallet % s " % ( walletName ) ) <nl> <nl> - Print ( " Create wallet . " ) <nl> + Print ( " Populate wallet with % d accounts . " % ( accountsCount ) ) <nl> if not cluster . populateWallet ( accountsCount , wallet ) : <nl> errorExit ( " Wallet initialization failed . " ) <nl> <nl> + initaAccount = cluster . initaAccount <nl> + <nl> + Print ( " Importing keys for account % s into wallet % s . " % ( initaAccount . name , wallet . name ) ) <nl> + if not walletMgr . importKey ( initaAccount , wallet ) : <nl> + errorExit ( " Failed to import key for account % s " % ( initaAccount . name ) ) <nl> + <nl> Print ( " Create accounts . " ) <nl> # if not cluster . createAccounts ( wallet ) : <nl> - if not cluster . createAccounts ( testUtils . Cluster . initaAccount ) : <nl> + if not cluster . createAccounts ( initaAccount ) : <nl> errorExit ( " Accounts creation failed . " ) <nl> <nl> Print ( " Wait on cluster sync . " ) <nl> if not cluster . waitOnClusterSync ( ) : <nl> errorExit ( " Cluster sync wait failed . " ) <nl> <nl> - Print ( " Spread funds and validate " ) <nl> - if not cluster . spreadFundsAndValidate ( 10 ) : <nl> - errorExit ( " Failed to spread and validate funds . " ) <nl> + # TBD : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> + # Uncomment when functional <nl> + # Print ( " Spread funds and validate " ) <nl> + # if not cluster . spreadFundsAndValidate ( 10 ) : <nl> + # errorExit ( " Failed to spread and validate funds . " ) <nl> <nl> Print ( " Wait on cluster sync . " ) <nl> if not cluster . waitOnClusterSync ( ) : <nl> def errorExit ( msg = " " , errorCode = 1 ) : <nl> errorExit ( " Failed to kill Eos instances " ) <nl> Print ( " nodeos instances killed . " ) <nl> <nl> - Print ( " Spread funds and validate " ) <nl> - if not cluster . spreadFundsAndValidate ( 10 ) : <nl> - errorExit ( " Failed to spread and validate funds . " ) <nl> + # TBD : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> + # Uncomment when functional <nl> + # Print ( " Spread funds and validate " ) <nl> + # if not cluster . spreadFundsAndValidate ( 10 ) : <nl> + # errorExit ( " Failed to spread and validate funds . " ) <nl> <nl> Print ( " Wait on cluster sync . " ) <nl> if not cluster . waitOnClusterSync ( ) : <nl> def errorExit ( msg = " " , errorCode = 1 ) : <nl> errorExit ( " Cluster never synchronized " ) <nl> Print ( " Cluster synched " ) <nl> <nl> - Print ( " Spread funds and validate " ) <nl> - if not cluster . spreadFundsAndValidate ( 10 ) : <nl> - errorExit ( " Failed to spread and validate funds . " ) <nl> + # TBD : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> + # Uncomment when functional <nl> + # Print ( " Spread funds and validate " ) <nl> + # if not cluster . spreadFundsAndValidate ( 10 ) : <nl> + # errorExit ( " Failed to spread and validate funds . " ) <nl> <nl> Print ( " Wait on cluster sync . " ) <nl> if not cluster . waitOnClusterSync ( ) : <nl> mmm a / tests / testUtils . py <nl> ppp b / tests / testUtils . py <nl> def errorExit ( msg = " " , raw = False , errorCode = 1 ) : <nl> Utils . Print ( " ERROR : " if not raw else " " , msg ) <nl> exit ( errorCode ) <nl> <nl> + @ staticmethod <nl> + def waitForObj ( lam , timeout = None ) : <nl> + if timeout is None : <nl> + timeout = 60 <nl> + <nl> + endTime = time . time ( ) + timeout <nl> + while endTime > time . time ( ) : <nl> + ret = lam ( ) <nl> + if ret is not None : <nl> + return ret <nl> + sleepTime = 3 <nl> + Utils . Print ( " cmd : sleep % d seconds , remaining time : % d seconds " % <nl> + ( sleepTime , endTime - time . time ( ) ) ) <nl> + time . sleep ( sleepTime ) <nl> + <nl> + return None <nl> + <nl> + @ staticmethod <nl> + def waitForBool ( lam , timeout = None ) : <nl> + myLam = lambda : True if lam ( ) else None <nl> + ret = Utils . waitForObj ( myLam ) <nl> + return False if ret is None else ret <nl> + <nl> + <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> class Table ( object ) : <nl> def __init__ ( self , name ) : <nl> def __init__ ( self , host , port , pid = None , cmd = None , alive = None , enableMongo = False <nl> self . pid = pid <nl> self . cmd = cmd <nl> self . alive = alive <nl> + self . killed = False # marks node as killed <nl> self . enableMongo = enableMongo <nl> self . mongoSyncTime = None if Utils . mongoSyncTime < 1 else Utils . mongoSyncTime <nl> self . mongoHost = mongoHost <nl> def __checkOutput ( cmd ) : <nl> # retStr = subprocess . check_output ( cmd ) . decode ( " utf - 8 " ) <nl> return retStr <nl> <nl> - <nl> # Passes input to stdin , executes cmd . Returns tuple with return code ( int ) , <nl> # stdout ( byte stream ) and stderr ( byte stream ) . <nl> @ staticmethod <nl> def verifyAccount ( self , account ) : <nl> return None <nl> <nl> def waitForBlockNumOnNode ( self , blockNum , timeout = None ) : <nl> - if timeout is None : <nl> - timeout = Utils . systemWaitTimeout <nl> - <nl> - endTime = time . time ( ) + timeout <nl> - while endTime > time . time ( ) : <nl> - if self . doesNodeHaveBlockNum ( blockNum ) : <nl> - return True <nl> - sleepTime = 3 <nl> - Utils . Debug and Utils . Print ( " cmd : sleep % d seconds , remaining time : % d seconds " % <nl> - ( sleepTime , endTime - time . time ( ) ) ) <nl> - time . sleep ( sleepTime ) <nl> - <nl> - return False <nl> + lam = lambda : self . doesNodeHaveBlockNum ( blockNum ) <nl> + ret = Utils . waitForBool ( lam , timeout ) <nl> + return ret <nl> <nl> def waitForTransIdOnNode ( self , transId , timeout = None ) : <nl> - if timeout is None : <nl> - timeout = Utils . systemWaitTimeout <nl> - <nl> - endTime = time . time ( ) + timeout <nl> - while endTime > time . time ( ) : <nl> - if self . doesNodeHaveTransId ( transId ) : <nl> - return True <nl> - sleepTime = 3 <nl> - Utils . Debug and Utils . Print ( " cmd : sleep % d seconds , remaining time : % d seconds " % <nl> - ( sleepTime , endTime - time . time ( ) ) ) <nl> - time . sleep ( sleepTime ) <nl> - <nl> - return False <nl> + lam = lambda : self . doesNodeHaveTransId ( transId ) <nl> + ret = Utils . waitForBool ( lam , timeout ) <nl> + return ret <nl> <nl> def waitForNextBlock ( self , timeout = None ) : <nl> - if timeout is None : <nl> - timeout = Utils . systemWaitTimeout <nl> - <nl> - endTime = time . time ( ) + timeout <nl> num = self . getIrreversibleBlockNum ( ) <nl> - Utils . Debug and Utils . Print ( " Current block number : % s " % ( num ) ) <nl> - <nl> - while endTime > time . time ( ) : <nl> - nextNum = self . getIrreversibleBlockNum ( ) <nl> - if nextNum > num : <nl> - Utils . Debug and Utils . Print ( " Next block number : % s " % ( nextNum ) ) <nl> - return True <nl> - <nl> - sleepTime = . 5 <nl> - Utils . Debug and Utils . Print ( " cmd : sleep % d seconds , remaining time : % d seconds " % <nl> - ( sleepTime , endTime - time . time ( ) ) ) <nl> - time . sleep ( sleepTime ) <nl> - <nl> - return False <nl> + lam = lambda : self . getIrreversibleBlockNum ( ) > num <nl> + ret = Utils . waitForBool ( lam , timeout ) <nl> + return ret <nl> <nl> # Trasfer funds . Returns " transfer " json return object <nl> def transferFunds ( self , source , destination , amount , memo = " memo " , force = False ) : <nl> def publishContract ( self , account , contractDir , wastFile , abiFile , waitForTransB <nl> return None <nl> return trans <nl> <nl> - def getTable ( self , account , contract , table ) : <nl> - cmd = " % s % s get table % s % s % s " % ( Utils . EosClientPath , self . endpointArgs , account , contract , table ) <nl> + def getTable ( self , contract , scope , table ) : <nl> + cmd = " % s % s get table % s % s % s " % ( Utils . EosClientPath , self . endpointArgs , contract , scope , table ) <nl> Utils . Debug and Utils . Print ( " cmd : % s " % ( cmd ) ) <nl> try : <nl> trans = Node . runCmdReturnJson ( cmd ) <nl> def getTable ( self , account , contract , table ) : <nl> Utils . Print ( " ERROR : Exception during table retrieval . % s " % ( msg ) ) <nl> return None <nl> <nl> - def getTableRows ( self , account , contract , table ) : <nl> - jsonData = self . getTable ( account , contract , table ) <nl> + def getTableRows ( self , contract , scope , table ) : <nl> + jsonData = self . getTable ( contract , scope , table ) <nl> if jsonData is None : <nl> return None <nl> rows = jsonData [ " rows " ] <nl> return rows <nl> <nl> - def getTableRow ( self , account , contract , table , idx ) : <nl> + def getTableRow ( self , contract , scope , table , idx ) : <nl> if idx < 0 : <nl> Utils . Print ( " ERROR : Table index cannot be negative . idx : % d " % ( idx ) ) <nl> return None <nl> - rows = self . getTableRows ( account , contract , table ) <nl> + rows = self . getTableRows ( contract , scope , table ) <nl> if rows is None or idx > = len ( rows ) : <nl> Utils . Print ( " ERROR : Retrieved table does not contain row % d " % idx ) <nl> return None <nl> row = rows [ idx ] <nl> return row <nl> <nl> - def getTableColumns ( self , account , contract , table ) : <nl> - row = self . getTableRow ( account , contract , table , 0 ) <nl> + def getTableColumns ( self , contract , scope , table ) : <nl> + row = self . getTableRow ( contract , scope , table , 0 ) <nl> keys = list ( row . keys ( ) ) <nl> return keys <nl> <nl> def getIrreversibleBlockNum ( self ) : <nl> return blockNum <nl> return None <nl> <nl> + def kill ( self , killSignal ) : <nl> + try : <nl> + os . kill ( self . pid , killSignal ) <nl> + # mark node as killed <nl> + self . killed = True <nl> + return True <nl> + except Exception as ex : <nl> + Utils . Print ( " ERROR : Failed to kill node ( pid % d ) . " % ( self . pid ) , ex ) <nl> + <nl> + return False <nl> + <nl> + # TBD : make nodeId an internal property <nl> + def relaunch ( self , nodeId , chainArg ) : <nl> + <nl> + running = True <nl> + try : <nl> + os . kill ( self . pid , 0 ) # check if process with pid is running <nl> + except Exception as ex : <nl> + running = False <nl> + <nl> + if running : <nl> + Utils . Print ( " WARNING : A process with pid ( % d ) is already running . " % ( self . pid ) ) <nl> + else : <nl> + Utils . Debug and Utils . Print ( " Launching node process , Id : % d " % ( nodeId ) ) <nl> + dataDir = " var / lib / node_ % 02d " % ( nodeId ) <nl> + dt = datetime . datetime . now ( ) <nl> + dateStr = " % d_ % 02d_ % 02d_ % 02d_ % 02d_ % 02d " % ( <nl> + dt . year , dt . month , dt . day , dt . hour , dt . minute , dt . second ) <nl> + stdoutFile = " % s / stdout . % s . txt " % ( dataDir , dateStr ) <nl> + stderrFile = " % s / stderr . % s . txt " % ( dataDir , dateStr ) <nl> + with open ( stdoutFile , ' w ' ) as sout , open ( stderrFile , ' w ' ) as serr : <nl> + cmd = self . cmd + ( " " if chainArg is None else ( " " + chainArg ) ) <nl> + Utils . Print ( " cmd : % s " % ( cmd ) ) <nl> + popen = subprocess . Popen ( cmd . split ( ) , stdout = sout , stderr = serr ) <nl> + self . pid = popen . pid <nl> + <nl> + self . killed = False <nl> + return True <nl> + <nl> + def relaunchEosInstances ( self ) : <nl> + <nl> + chainArg = self . __chainSyncStrategy . arg <nl> + <nl> + for i in range ( 0 , len ( self . nodes ) ) : <nl> + node = self . nodes [ i ] <nl> + running = True <nl> + try : <nl> + os . kill ( node . pid , 0 ) # check if instance is running <nl> + except Exception as ex : <nl> + running = False <nl> + <nl> + if running is False : <nl> + dataDir = " var / lib / node_ % 02d " % ( i ) <nl> + dt = datetime . datetime . now ( ) <nl> + dateStr = " % d_ % 02d_ % 02d_ % 02d_ % 02d_ % 02d " % ( <nl> + dt . year , dt . month , dt . day , dt . hour , dt . minute , dt . second ) <nl> + stdoutFile = " % s / stdout . % s . txt " % ( dataDir , dateStr ) <nl> + stderrFile = " % s / stderr . % s . txt " % ( dataDir , dateStr ) <nl> + with open ( stdoutFile , ' w ' ) as sout , open ( stderrFile , ' w ' ) as serr : <nl> + cmd = node . cmd + ( " " if chainArg is None else ( " " + chainArg ) ) <nl> + Utils . Print ( " cmd : % s " % ( cmd ) ) <nl> + popen = subprocess . Popen ( cmd . split ( ) , stdout = sout , stderr = serr ) <nl> + self . nodes [ i ] . pid = popen . pid <nl> + <nl> + return self . updateNodesStatus ( ) <nl> + <nl> + <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> <nl> Wallet = namedtuple ( " Wallet " , " name password host port " ) <nl> def setNodes ( self , nodes ) : <nl> # If a last transaction exists wait for it on root node , then collect its head block number . <nl> # Wait on this block number on each cluster node <nl> def waitOnClusterSync ( self , timeout = None ) : <nl> - if timeout is None : <nl> - timeout = Utils . systemWaitTimeout <nl> - startTime = time . time ( ) <nl> - Utils . Debug and Utils . Print ( " cmd : remaining time % d seconds " % ( timeout ) ) <nl> - if self . nodes [ 0 ] . alive is False : <nl> - Utils . Print ( " ERROR : Root node is down . " ) <nl> - return False ; <nl> - <nl> - if self . __lastTrans is not None : <nl> - if self . nodes [ 0 ] . waitForTransIdOnNode ( self . __lastTrans ) is False : <nl> - Utils . Print ( " ERROR : Failed to wait for last known transaction ( % s ) on root node . " % <nl> - ( self . __lastTrans ) ) <nl> - return False ; <nl> - <nl> targetHeadBlockNum = self . nodes [ 0 ] . getHeadBlockNum ( ) # get root nodes head block num <nl> Utils . Debug and Utils . Print ( " Head block number on root node : % d " % ( targetHeadBlockNum ) ) <nl> if targetHeadBlockNum = = - 1 : <nl> return False <nl> <nl> - currentTimeout = timeout - ( time . time ( ) - startTime ) <nl> - return self . waitOnClusterBlockNumSync ( targetHeadBlockNum , currentTimeout ) <nl> + return self . waitOnClusterBlockNumSync ( targetHeadBlockNum ) <nl> <nl> def waitOnClusterBlockNumSync ( self , targetHeadBlockNum , timeout = None ) : <nl> - if timeout is None : <nl> - timeout = Utils . systemWaitTimeout <nl> <nl> - endTime = time . time ( ) + timeout <nl> - while endTime > time . time ( ) : <nl> - synced = True <nl> - for node in self . nodes : <nl> - if node . alive : <nl> - if node . doesNodeHaveBlockNum ( targetHeadBlockNum ) is False : <nl> - synced = False <nl> - break <nl> - <nl> - if synced is True : <nl> - return True <nl> - sleepTime = 3 <nl> - Utils . Debug and Utils . Print ( " cmd : sleep % d seconds , remaining time : % d seconds " % <nl> - ( sleepTime , endTime - time . time ( ) ) ) <nl> - time . sleep ( sleepTime ) <nl> + def doNodesHaveBlockNum ( nodes , targetHeadBlockNum ) : <nl> + for node in nodes : <nl> + if ( not node . killed ) and ( not node . doesNodeHaveBlockNum ( targetHeadBlockNum ) ) : <nl> + return False <nl> <nl> - return False <nl> + return True <nl> + <nl> + lam = lambda : doNodesHaveBlockNum ( self . nodes , targetHeadBlockNum ) <nl> + ret = Utils . waitForBool ( lam , timeout ) <nl> + return ret <nl> <nl> @ staticmethod <nl> def createAccountKeys ( count ) : <nl> def bootstrap ( totalNodes , prodCount , biosHost , biosPort ) : <nl> if not biosNode . waitForTransIdOnNode ( transId ) : <nl> return False <nl> <nl> + # wait for block production handover ( essentially a block produced by anyone but eosio ) . <nl> + lam = lambda : biosNode . getInfo ( ) [ " head_block_producer " ] ! = " eosio " <nl> + ret = Utils . waitForBool ( lam ) <nl> + if not ret : <nl> + Utils . Print ( " ERROR : Block production handover failed . " ) <nl> + return False <nl> + <nl> contract = " eosio . system " <nl> contractDir = " contracts / % s " % ( contract ) <nl> wastFile = " contracts / % s / % s . wast " % ( contract , contract ) <nl> def bootstrap ( totalNodes , prodCount , biosHost , biosPort ) : <nl> transId = Node . getTransId ( trans [ 1 ] ) <nl> biosNode . waitForTransIdOnNode ( transId ) <nl> <nl> - # TDB : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> + # TBD : Known issue ( Issue 2043 ) that ' get currency balance ' doesn ' t return balance . <nl> # Uncomment when functional <nl> # expectedAmount = 10000000000000 <nl> # Utils . Print ( " Verify eosio issue , Expected : % d " % ( expectedAmount ) ) <nl> def discoverLocalNodes ( self , totalNodes , timeout = 0 ) : <nl> if platform . linux_distribution ( ) [ 0 ] in [ " Ubuntu " , " LinuxMint " , " Fedora " , " CentOS Linux " , " arch " ] : <nl> pgrepOpts = " - a " <nl> <nl> - endTime = time . time ( ) + timeout <nl> - checkForNodes = True <nl> + cmd = " pgrep % s % s " % ( pgrepOpts , Utils . EosServerName ) <nl> <nl> - psOut = None <nl> - while checkForNodes : <nl> + def myFunc ( ) : <nl> + psOut = None <nl> try : <nl> - cmd = " pgrep % s % s " % ( pgrepOpts , Utils . EosServerName ) <nl> Utils . Debug and Utils . Print ( " cmd : % s " % ( cmd ) ) <nl> psOut = subprocess . check_output ( cmd . split ( ) ) . decode ( " utf - 8 " ) <nl> - Utils . Debug and Utils . Print ( " psOut : \ " % s \ " " % psOut ) <nl> - break <nl> + return psOut <nl> except subprocess . CalledProcessError as ex : <nl> pass <nl> + return None <nl> <nl> - checkForNodes = ( endTime > time . time ( ) ) <nl> - if checkForNodes : <nl> - sleepTime = 3 <nl> - Utils . Debug and Utils . Print ( " cmd : sleep % d seconds , remaining time : % d seconds " % <nl> - ( sleepTime , endTime - time . time ( ) ) ) <nl> - time . sleep ( sleepTime ) <nl> - <nl> - if psOut is not None : <nl> - for i in range ( 0 , totalNodes ) : <nl> - pattern = " [ \ n ] ? ( \ d + ) ( . * - - data - dir var / lib / node_ % 02d ) " % ( i ) <nl> - m = re . search ( pattern , psOut , re . MULTILINE ) <nl> - if m is None : <nl> - Utils . Print ( " ERROR : Failed to find % s pid . Pattern % s " % ( Utils . EosServerName , pattern ) ) <nl> - break <nl> - instance = Node ( self . host , self . port + i , pid = int ( m . group ( 1 ) ) , cmd = m . group ( 2 ) , alive = True , enableMongo = self . enableMongo , mongoHost = self . mongoHost , mongoPort = self . mongoPort , mongoDb = self . mongoDb ) <nl> - instance . setWalletEndpointArgs ( self . walletEndpointArgs ) <nl> - Utils . Debug and Utils . Print ( " Node > " , instance ) <nl> - nodes . append ( instance ) <nl> - else : <nl> + lam = lambda : myFunc ( ) <nl> + psOut = Utils . waitForObj ( lam ) <nl> + if psOut is None : <nl> Utils . Print ( " ERROR : No nodes discovered . " ) <nl> + return nodes <nl> + <nl> + Utils . Debug and Utils . Print ( " pgrep : \ " % s \ " " % psOut ) <nl> + for i in range ( 0 , totalNodes ) : <nl> + pattern = " [ \ n ] ? ( \ d + ) ( . * - - data - dir var / lib / node_ % 02d ) " % ( i ) <nl> + m = re . search ( pattern , psOut , re . MULTILINE ) <nl> + if m is None : <nl> + Utils . Print ( " ERROR : Failed to find % s pid . Pattern % s " % ( Utils . EosServerName , pattern ) ) <nl> + break <nl> + instance = Node ( self . host , self . port + i , pid = int ( m . group ( 1 ) ) , cmd = m . group ( 2 ) , alive = True , enableMongo = self . enableMongo , mongoHost = self . mongoHost , mongoPort = self . mongoPort , mongoDb = self . mongoDb ) <nl> + instance . setWalletEndpointArgs ( self . walletEndpointArgs ) <nl> + Utils . Debug and Utils . Print ( " Node > " , instance ) <nl> + nodes . append ( instance ) <nl> <nl> return nodes <nl> <nl> # Check state of running nodeos process and update EosInstanceInfos <nl> # def updateEosInstanceInfos ( eosInstanceInfos ) : <nl> - def updateNodesStatus ( self ) : <nl> - for node in self . nodes : <nl> - node . checkPulse ( ) <nl> + # def updateNodesStatus ( self ) : <nl> + # for node in self . nodes : <nl> + # node . checkPulse ( ) <nl> <nl> # Kills a percentange of Eos instances starting from the tail and update eosInstanceInfos state <nl> def killSomeEosInstances ( self , killCount , killSignalStr = Utils . SigKillTag ) : <nl> def killSomeEosInstances ( self , killCount , killSignalStr = Utils . SigKillTag ) : <nl> <nl> killedCount = 0 <nl> for node in reversed ( self . nodes ) : <nl> - try : <nl> - os . kill ( node . pid , killSignal ) <nl> - except Exception as ex : <nl> - Utils . Print ( " ERROR : Failed to kill process pid % d . " % ( node . pid ) , ex ) <nl> + if not node . kill ( killSignal ) : <nl> return False <nl> + <nl> killedCount + = 1 <nl> if killedCount > = killCount : <nl> break <nl> <nl> time . sleep ( 1 ) # Give processes time to stand down <nl> - return self . updateNodesStatus ( ) <nl> + # return self . updateNodesStatus ( ) <nl> + return True <nl> <nl> def relaunchEosInstances ( self ) : <nl> <nl> def relaunchEosInstances ( self ) : <nl> <nl> for i in range ( 0 , len ( self . nodes ) ) : <nl> node = self . nodes [ i ] <nl> - running = True <nl> - try : <nl> - os . kill ( node . pid , 0 ) # check if instance is running <nl> - except Exception as ex : <nl> - running = False <nl> - <nl> - if running is False : <nl> - dataDir = " var / lib / node_ % 02d " % ( i ) <nl> - dt = datetime . datetime . now ( ) <nl> - dateStr = " % d_ % 02d_ % 02d_ % 02d_ % 02d_ % 02d " % ( <nl> - dt . year , dt . month , dt . day , dt . hour , dt . minute , dt . second ) <nl> - stdoutFile = " % s / stdout . % s . txt " % ( dataDir , dateStr ) <nl> - stderrFile = " % s / stderr . % s . txt " % ( dataDir , dateStr ) <nl> - with open ( stdoutFile , ' w ' ) as sout , open ( stderrFile , ' w ' ) as serr : <nl> - cmd = node . cmd + ( " " if chainArg is None else ( " " + chainArg ) ) <nl> - Utils . Print ( " cmd : % s " % ( cmd ) ) <nl> - popen = subprocess . Popen ( cmd . split ( ) , stdout = sout , stderr = serr ) <nl> - self . nodes [ i ] . pid = popen . pid <nl> + if not node . relaunch ( i , chainArg ) : <nl> + return False <nl> <nl> - return self . updateNodesStatus ( ) <nl> + return True <nl> <nl> def dumpErrorDetailImpl ( self , fileName ) : <nl> Utils . Print ( " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " ) <nl> mmm a / tools / CMakeLists . txt <nl> ppp b / tools / CMakeLists . txt <nl> <nl> configure_file ( eosiocpp . in eosiocpp @ ONLY ) <nl> + configure_file ( $ { CMAKE_CURRENT_SOURCE_DIR } / llvm - gcov . sh $ { CMAKE_CURRENT_BINARY_DIR } / llvm - gcov . sh COPYONLY ) <nl> install ( FILES $ { CMAKE_CURRENT_BINARY_DIR } / eosiocpp DESTINATION $ { CMAKE_INSTALL_FULL_BINDIR } <nl> PERMISSIONS OWNER_READ <nl> OWNER_WRITE <nl> similarity index 100 % <nl> rename from tests / llvm - gcov . sh <nl> rename to tools / llvm - gcov . sh <nl>
|
Move helper script llvm - gcov . sh into tools directory . Enable restart scenarios test . Add integration tests to coverage builds . Updated the restart test producer count to 4 to continue block finalization even with 1 node down . Use labdas to refactor wait based getter methods . Explicitly track node lifecycle to improve validation checks .
|
EOSIO/eos
|
74ed23f99ed88850da55a6a58dc04678802c753e
|
2018-04-19T13:12:20Z
|
mmm a / cocos / gui / UIButton . cpp <nl> ppp b / cocos / gui / UIButton . cpp <nl> void Button : : loadTextureNormal ( const char * normal , TextureResType texType ) <nl> } <nl> _normalTextureSize = _buttonNormalRenderer - > getContentSize ( ) ; <nl> updateAnchorPoint ( ) ; <nl> + updateFlippedX ( ) ; <nl> + updateFlippedY ( ) ; <nl> updateRGBAToRenderer ( _buttonNormalRenderer ) ; <nl> normalTextureScaleChangedWithSize ( ) ; <nl> _normalTextureLoaded = true ; <nl> void Button : : loadTexturePressed ( const char * selected , TextureResType texType ) <nl> } <nl> _pressedTextureSize = _buttonClickedRenderer - > getContentSize ( ) ; <nl> updateAnchorPoint ( ) ; <nl> + updateFlippedX ( ) ; <nl> + updateFlippedY ( ) ; <nl> updateRGBAToRenderer ( _buttonDisableRenderer ) ; <nl> pressedTextureScaleChangedWithSize ( ) ; <nl> _pressedTextureLoaded = true ; <nl> void Button : : loadTextureDisabled ( const char * disabled , TextureResType texType ) <nl> } <nl> _disabledTextureSize = _buttonDisableRenderer - > getContentSize ( ) ; <nl> updateAnchorPoint ( ) ; <nl> + updateFlippedX ( ) ; <nl> + updateFlippedY ( ) ; <nl> updateRGBAToRenderer ( _buttonDisableRenderer ) ; <nl> disabledTextureScaleChangedWithSize ( ) ; <nl> _disabledTextureLoaded = true ; <nl> void Button : : onPressStateChangedToDisabled ( ) <nl> _buttonClickedRenderer - > setScale ( _pressedTextureScaleXInSize , _pressedTextureScaleYInSize ) ; <nl> } <nl> <nl> - void Button : : setFlippedX ( bool flippedX ) <nl> + void Button : : updateFlippedX ( ) <nl> { <nl> - _titleRenderer - > setFlippedX ( flippedX ) ; <nl> + _titleRenderer - > setFlippedX ( _flippedX ) ; <nl> if ( _scale9Enabled ) <nl> { <nl> - return ; <nl> + int flip = _flippedX ? - 1 : 1 ; <nl> + _buttonNormalRenderer - > setScaleX ( flip ) ; <nl> + _buttonClickedRenderer - > setScaleX ( flip ) ; <nl> + _buttonDisableRenderer - > setScaleX ( flip ) ; <nl> } <nl> - static_cast < Sprite * > ( _buttonNormalRenderer ) - > setFlippedX ( flippedX ) ; <nl> - static_cast < Sprite * > ( _buttonClickedRenderer ) - > setFlippedX ( flippedX ) ; <nl> - static_cast < Sprite * > ( _buttonDisableRenderer ) - > setFlippedX ( flippedX ) ; <nl> - } <nl> - <nl> - void Button : : setFlippedY ( bool flippedY ) <nl> - { <nl> - _titleRenderer - > setFlippedY ( flippedY ) ; <nl> - if ( _scale9Enabled ) <nl> + else <nl> { <nl> - return ; <nl> + static_cast < Sprite * > ( _buttonNormalRenderer ) - > setFlippedX ( _flippedX ) ; <nl> + static_cast < Sprite * > ( _buttonClickedRenderer ) - > setFlippedX ( _flippedX ) ; <nl> + static_cast < Sprite * > ( _buttonDisableRenderer ) - > setFlippedX ( _flippedX ) ; <nl> } <nl> - static_cast < Sprite * > ( _buttonNormalRenderer ) - > setFlippedY ( flippedY ) ; <nl> - static_cast < Sprite * > ( _buttonClickedRenderer ) - > setFlippedY ( flippedY ) ; <nl> - static_cast < Sprite * > ( _buttonDisableRenderer ) - > setFlippedY ( flippedY ) ; <nl> } <nl> - <nl> - bool Button : : isFlippedX ( ) <nl> + <nl> + void Button : : updateFlippedY ( ) <nl> { <nl> + _titleRenderer - > setFlippedY ( _flippedY ) ; <nl> if ( _scale9Enabled ) <nl> { <nl> - return false ; <nl> + int flip = _flippedY ? - 1 : 1 ; <nl> + _buttonNormalRenderer - > setScaleY ( flip ) ; <nl> + _buttonClickedRenderer - > setScaleY ( flip ) ; <nl> + _buttonDisableRenderer - > setScaleY ( flip ) ; <nl> } <nl> - return static_cast < Sprite * > ( _buttonNormalRenderer ) - > isFlippedX ( ) ; <nl> - } <nl> - <nl> - bool Button : : isFlippedY ( ) <nl> - { <nl> - if ( _scale9Enabled ) <nl> + else <nl> { <nl> - return false ; <nl> + static_cast < Sprite * > ( _buttonNormalRenderer ) - > setFlippedY ( _flippedY ) ; <nl> + static_cast < Sprite * > ( _buttonClickedRenderer ) - > setFlippedY ( _flippedY ) ; <nl> + static_cast < Sprite * > ( _buttonDisableRenderer ) - > setFlippedY ( _flippedY ) ; <nl> } <nl> - return static_cast < Sprite * > ( _buttonNormalRenderer ) - > isFlippedY ( ) ; <nl> } <nl> <nl> void Button : : setAnchorPoint ( const Point & pt ) <nl> mmm a / cocos / gui / UIButton . h <nl> ppp b / cocos / gui / UIButton . h <nl> class Button : public Widget <nl> <nl> bool isScale9Enabled ( ) ; <nl> <nl> - / / override " setFlippedX " of widget . <nl> - virtual void setFlippedX ( bool flippedX ) override ; <nl> - <nl> - / / override " setFlippedY " of widget . <nl> - virtual void setFlippedY ( bool flippedY ) override ; <nl> - <nl> - / / override " isFlippedX " of widget . <nl> - virtual bool isFlippedX ( ) override ; <nl> - <nl> - / / override " isFlippedY " of widget . <nl> - virtual bool isFlippedY ( ) override ; <nl> - <nl> - / * * @ deprecated Use isFlippedX ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE bool isFlipX ( ) { return isFlippedX ( ) ; } ; <nl> - / * * @ deprecated Use setFlippedX ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE void setFlipX ( bool flipX ) { setFlippedX ( flipX ) ; } ; <nl> - / * * @ deprecated Use isFlippedY ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE bool isFlipY ( ) { return isFlippedY ( ) ; } ; <nl> - / * * @ deprecated Use setFlippedY ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE void setFlipY ( bool flipY ) { setFlippedY ( flipY ) ; } ; <nl> - <nl> / * * <nl> * Changes if button can be clicked zoom effect . <nl> * <nl> class Button : public Widget <nl> virtual void updateTextureColor ( ) override ; <nl> virtual void updateTextureOpacity ( ) override ; <nl> virtual void updateTextureRGBA ( ) override ; <nl> + virtual void updateFlippedX ( ) override ; <nl> + virtual void updateFlippedY ( ) override ; <nl> void normalTextureScaleChangedWithSize ( ) ; <nl> void pressedTextureScaleChangedWithSize ( ) ; <nl> void disabledTextureScaleChangedWithSize ( ) ; <nl> mmm a / cocos / gui / UICheckBox . cpp <nl> ppp b / cocos / gui / UICheckBox . cpp <nl> void CheckBox : : loadTextureBackGround ( const char * backGround , TextureResType texTy <nl> break ; <nl> } <nl> updateAnchorPoint ( ) ; <nl> + updateFlippedX ( ) ; <nl> + updateFlippedY ( ) ; <nl> updateRGBAToRenderer ( _backGroundBoxRenderer ) ; <nl> backGroundTextureScaleChangedWithSize ( ) ; <nl> } <nl> void CheckBox : : loadTextureBackGroundSelected ( const char * backGroundSelected , Text <nl> break ; <nl> } <nl> updateAnchorPoint ( ) ; <nl> + updateFlippedX ( ) ; <nl> + updateFlippedY ( ) ; <nl> updateRGBAToRenderer ( _backGroundSelectedBoxRenderer ) ; <nl> backGroundSelectedTextureScaleChangedWithSize ( ) ; <nl> } <nl> void CheckBox : : loadTextureFrontCross ( const char * cross , TextureResType texType ) <nl> break ; <nl> } <nl> updateAnchorPoint ( ) ; <nl> + updateFlippedX ( ) ; <nl> + updateFlippedY ( ) ; <nl> updateRGBAToRenderer ( _frontCrossRenderer ) ; <nl> frontCrossTextureScaleChangedWithSize ( ) ; <nl> } <nl> void CheckBox : : loadTextureBackGroundDisabled ( const char * backGroundDisabled , Text <nl> break ; <nl> } <nl> updateAnchorPoint ( ) ; <nl> + updateFlippedX ( ) ; <nl> + updateFlippedY ( ) ; <nl> updateRGBAToRenderer ( _backGroundBoxDisabledRenderer ) ; <nl> backGroundDisabledTextureScaleChangedWithSize ( ) ; <nl> } <nl> void CheckBox : : loadTextureFrontCrossDisabled ( const char * frontCrossDisabled , Text <nl> break ; <nl> } <nl> updateAnchorPoint ( ) ; <nl> + updateFlippedX ( ) ; <nl> + updateFlippedY ( ) ; <nl> updateRGBAToRenderer ( _frontCrossDisabledRenderer ) ; <nl> frontCrossDisabledTextureScaleChangedWithSize ( ) ; <nl> } <nl> void CheckBox : : addEventListenerCheckBox ( Ref * target , SEL_SelectedStateEvent sele <nl> _checkBoxEventListener = target ; <nl> _checkBoxEventSelector = selector ; <nl> } <nl> - <nl> - void CheckBox : : setFlippedX ( bool flippedX ) <nl> - { <nl> - _backGroundBoxRenderer - > setFlippedX ( flippedX ) ; <nl> - _backGroundSelectedBoxRenderer - > setFlippedX ( flippedX ) ; <nl> - _frontCrossRenderer - > setFlippedX ( flippedX ) ; <nl> - _backGroundBoxDisabledRenderer - > setFlippedX ( flippedX ) ; <nl> - _frontCrossDisabledRenderer - > setFlippedX ( flippedX ) ; <nl> - } <nl> - <nl> - void CheckBox : : setFlippedY ( bool flippedY ) <nl> - { <nl> - _backGroundBoxRenderer - > setFlippedY ( flippedY ) ; <nl> - _backGroundSelectedBoxRenderer - > setFlippedY ( flippedY ) ; <nl> - _frontCrossRenderer - > setFlippedY ( flippedY ) ; <nl> - _backGroundBoxDisabledRenderer - > setFlippedY ( flippedY ) ; <nl> - _frontCrossDisabledRenderer - > setFlippedY ( flippedY ) ; <nl> - } <nl> - <nl> - bool CheckBox : : isFlippedX ( ) <nl> + <nl> + void CheckBox : : updateFlippedX ( ) <nl> { <nl> - return _backGroundBoxRenderer - > isFlippedX ( ) ; <nl> + _backGroundBoxRenderer - > setFlippedX ( _flippedX ) ; <nl> + _backGroundSelectedBoxRenderer - > setFlippedX ( _flippedX ) ; <nl> + _frontCrossRenderer - > setFlippedX ( _flippedX ) ; <nl> + _backGroundBoxDisabledRenderer - > setFlippedX ( _flippedX ) ; <nl> + _frontCrossDisabledRenderer - > setFlippedX ( _flippedX ) ; <nl> } <nl> - <nl> - bool CheckBox : : isFlippedY ( ) <nl> + <nl> + void CheckBox : : updateFlippedY ( ) <nl> { <nl> - return _backGroundBoxRenderer - > isFlippedY ( ) ; <nl> + _backGroundBoxRenderer - > setFlippedY ( _flippedY ) ; <nl> + _backGroundSelectedBoxRenderer - > setFlippedY ( _flippedY ) ; <nl> + _frontCrossRenderer - > setFlippedY ( _flippedY ) ; <nl> + _backGroundBoxDisabledRenderer - > setFlippedY ( _flippedY ) ; <nl> + _frontCrossDisabledRenderer - > setFlippedY ( _flippedY ) ; <nl> } <nl> <nl> void CheckBox : : setAnchorPoint ( const Point & pt ) <nl> mmm a / cocos / gui / UICheckBox . h <nl> ppp b / cocos / gui / UICheckBox . h <nl> class CheckBox : public Widget <nl> / / add a call back function would called when checkbox is selected or unselected . <nl> void addEventListenerCheckBox ( Ref * target , SEL_SelectedStateEvent selector ) ; <nl> <nl> - / / override " setFlippedX " method of widget . <nl> - virtual void setFlippedX ( bool flippedX ) override ; <nl> - <nl> - / / override " setFlippedY " method of widget . <nl> - virtual void setFlippedY ( bool flippedY ) override ; <nl> - <nl> - / / override " isFlippedX " method of widget . <nl> - virtual bool isFlippedX ( ) override ; <nl> - <nl> - / / override " isFlippedY " method of widget . <nl> - virtual bool isFlippedY ( ) override ; <nl> - <nl> - / * * @ deprecated Use isFlippedX ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE bool isFlipX ( ) { return isFlippedX ( ) ; } ; <nl> - / * * @ deprecated Use setFlippedX ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE void setFlipX ( bool flipX ) { setFlippedX ( flipX ) ; } ; <nl> - / * * @ deprecated Use isFlippedY ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE bool isFlipY ( ) { return isFlippedY ( ) ; } ; <nl> - / * * @ deprecated Use setFlippedY ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE void setFlipY ( bool flipY ) { setFlippedY ( flipY ) ; } ; <nl> - <nl> / / override " onTouchEnded " method of widget . <nl> virtual void onTouchEnded ( Touch * touch , Event * unusedEvent ) ; <nl> <nl> class CheckBox : public Widget <nl> virtual void updateTextureColor ( ) override ; <nl> virtual void updateTextureOpacity ( ) override ; <nl> virtual void updateTextureRGBA ( ) override ; <nl> + virtual void updateFlippedX ( ) override ; <nl> + virtual void updateFlippedY ( ) override ; <nl> void backGroundTextureScaleChangedWithSize ( ) ; <nl> void backGroundSelectedTextureScaleChangedWithSize ( ) ; <nl> void frontCrossTextureScaleChangedWithSize ( ) ; <nl> mmm a / cocos / gui / UIImageView . cpp <nl> ppp b / cocos / gui / UIImageView . cpp <nl> void ImageView : : loadTexture ( const char * fileName , TextureResType texType ) <nl> } <nl> _imageTextureSize = _imageRenderer - > getContentSize ( ) ; <nl> updateAnchorPoint ( ) ; <nl> + updateFlippedX ( ) ; <nl> + updateFlippedY ( ) ; <nl> updateRGBAToRenderer ( _imageRenderer ) ; <nl> imageTextureScaleChangedWithSize ( ) ; <nl> } <nl> void ImageView : : setTextureRect ( const Rect & rect ) <nl> STATIC_CAST_CCSPRITE - > setTextureRect ( rect ) ; <nl> } <nl> } <nl> - <nl> - void ImageView : : setFlippedX ( bool flippedX ) <nl> - { <nl> - if ( _scale9Enabled ) <nl> - { <nl> - } <nl> - else <nl> - { <nl> - STATIC_CAST_CCSPRITE - > setFlippedX ( flippedX ) ; <nl> - } <nl> - } <nl> - <nl> - void ImageView : : setFlippedY ( bool flippedY ) <nl> + <nl> + void ImageView : : updateFlippedX ( ) <nl> { <nl> if ( _scale9Enabled ) <nl> { <nl> + int flip = _flippedX ? - 1 : 1 ; <nl> + STATIC_CAST_SCALE9SPRITE - > setScaleX ( flip ) ; <nl> } <nl> else <nl> { <nl> - STATIC_CAST_CCSPRITE - > setFlippedY ( flippedY ) ; <nl> + STATIC_CAST_CCSPRITE - > setFlippedX ( _flippedX ) ; <nl> } <nl> } <nl> - <nl> - bool ImageView : : isFlippedX ( ) <nl> + <nl> + void ImageView : : updateFlippedY ( ) <nl> { <nl> if ( _scale9Enabled ) <nl> { <nl> - return false ; <nl> + int flip = _flippedY ? - 1 : 1 ; <nl> + STATIC_CAST_SCALE9SPRITE - > setScaleY ( flip ) ; <nl> } <nl> else <nl> { <nl> - return STATIC_CAST_CCSPRITE - > isFlippedX ( ) ; <nl> + STATIC_CAST_CCSPRITE - > setFlippedY ( _flippedY ) ; <nl> } <nl> - } <nl> <nl> - bool ImageView : : isFlippedY ( ) <nl> - { <nl> - if ( _scale9Enabled ) <nl> - { <nl> - return false ; <nl> - } <nl> - else <nl> - { <nl> - return STATIC_CAST_CCSPRITE - > isFlippedY ( ) ; <nl> - } <nl> } <nl> <nl> void ImageView : : setScale9Enabled ( bool able ) <nl> mmm a / cocos / gui / UIImageView . h <nl> ppp b / cocos / gui / UIImageView . h <nl> class ImageView : public Widget <nl> <nl> const Rect & getCapInsets ( ) ; <nl> <nl> - / / override " setFlippedX " method of widget . <nl> - virtual void setFlippedX ( bool flippedX ) override ; <nl> - <nl> - / / override " setFlippedY " method of widget . <nl> - virtual void setFlippedY ( bool flippedY ) override ; <nl> - <nl> - / / override " isFlippedX " method of widget . <nl> - virtual bool isFlippedX ( ) override ; <nl> - <nl> - / / override " isFlippedY " method of widget . <nl> - virtual bool isFlippedY ( ) override ; <nl> - <nl> - / * * @ deprecated Use isFlippedX ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE bool isFlipX ( ) { return isFlippedX ( ) ; } ; <nl> - / * * @ deprecated Use setFlippedX ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE void setFlipX ( bool flipX ) { setFlippedX ( flipX ) ; } ; <nl> - / * * @ deprecated Use isFlippedY ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE bool isFlipY ( ) { return isFlippedY ( ) ; } ; <nl> - / * * @ deprecated Use setFlippedY ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE void setFlipY ( bool flipY ) { setFlippedY ( flipY ) ; } ; <nl> - <nl> / / override " setAnchorPoint " method of widget . <nl> virtual void setAnchorPoint ( const Point & pt ) override ; <nl> <nl> class ImageView : public Widget <nl> virtual void updateTextureColor ( ) override ; <nl> virtual void updateTextureOpacity ( ) override ; <nl> virtual void updateTextureRGBA ( ) override ; <nl> + virtual void updateFlippedX ( ) override ; <nl> + virtual void updateFlippedY ( ) override ; <nl> void imageTextureScaleChangedWithSize ( ) ; <nl> virtual Widget * createCloneInstance ( ) override ; <nl> virtual void copySpecialProperties ( Widget * model ) override ; <nl> mmm a / cocos / gui / UIText . cpp <nl> ppp b / cocos / gui / UIText . cpp <nl> void Text : : setTouchScaleChangeEnabled ( bool enable ) <nl> _touchScaleChangeEnabled = enable ; <nl> } <nl> <nl> - void Text : : setScale ( float fScale ) <nl> - { <nl> - Widget : : setScale ( fScale ) ; <nl> - } <nl> - <nl> - void Text : : setScaleX ( float fScaleX ) <nl> - { <nl> - Widget : : setScaleX ( fScaleX ) ; <nl> - } <nl> - <nl> - void Text : : setScaleY ( float fScaleY ) <nl> - { <nl> - Widget : : setScaleY ( fScaleY ) ; <nl> - } <nl> - <nl> bool Text : : isTouchScaleChangeEnabled ( ) <nl> { <nl> return _touchScaleChangeEnabled ; <nl> void Text : : onPressStateChangedToDisabled ( ) <nl> <nl> } <nl> <nl> - void Text : : setFlippedX ( bool flippedX ) <nl> - { <nl> - _labelRenderer - > setFlippedX ( flippedX ) ; <nl> - } <nl> - <nl> - void Text : : setFlippedY ( bool flippedY ) <nl> + void Text : : updateFlippedX ( ) <nl> { <nl> - _labelRenderer - > setFlippedY ( flippedY ) ; <nl> - } <nl> + _labelRenderer - > setFlippedX ( _flippedX ) ; <nl> <nl> - bool Text : : isFlippedX ( ) <nl> - { <nl> - return _labelRenderer - > isFlippedX ( ) ; <nl> } <nl> - <nl> - bool Text : : isFlippedY ( ) <nl> + <nl> + void Text : : updateFlippedY ( ) <nl> { <nl> - return _labelRenderer - > isFlippedY ( ) ; <nl> + _labelRenderer - > setFlippedY ( _flippedY ) ; <nl> } <nl> <nl> void Text : : setAnchorPoint ( const Point & pt ) <nl> mmm a / cocos / gui / UIText . h <nl> ppp b / cocos / gui / UIText . h <nl> class Text : public Widget <nl> * / <nl> bool isTouchScaleChangeEnabled ( ) ; <nl> <nl> - / * * <nl> - * Changes both X and Y scale factor of the widget . <nl> - * <nl> - * 1 . 0 is the default scale factor . It modifies the X and Y scale at the same time . <nl> - * <nl> - * @ param scale The scale factor for both X and Y axis . <nl> - * / <nl> - virtual void setScale ( float fScale ) override ; <nl> - <nl> - / * * <nl> - * Changes the scale factor on X axis of this widget <nl> - * <nl> - * The deafult value is 1 . 0 if you haven ' t changed it before <nl> - * <nl> - * @ param fScaleX The scale factor on X axis . <nl> - * / <nl> - virtual void setScaleX ( float fScaleX ) override ; <nl> - <nl> - / * * <nl> - * Changes the scale factor on Y axis of this widget <nl> - * <nl> - * The Default value is 1 . 0 if you haven ' t changed it before . <nl> - * <nl> - * @ param fScaleY The scale factor on Y axis . <nl> - * / <nl> - virtual void setScaleY ( float fScaleY ) override ; <nl> - <nl> - <nl> - / / override " setFlippedX " method of widget . <nl> - virtual void setFlippedX ( bool flippedX ) override ; <nl> - <nl> - / / override " setFlippedY " method of widget . <nl> - virtual void setFlippedY ( bool flippedY ) override ; <nl> - <nl> - / / override " isFlippedX " method of widget . <nl> - virtual bool isFlippedX ( ) override ; <nl> - <nl> - / / override " isFlippedY " method of widget . <nl> - virtual bool isFlippedY ( ) override ; <nl> - <nl> - / * * @ deprecated Use isFlippedX ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE bool isFlipX ( ) { return isFlippedX ( ) ; } ; <nl> - / * * @ deprecated Use setFlippedX ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE void setFlipX ( bool flipX ) { setFlippedX ( flipX ) ; } ; <nl> - / * * @ deprecated Use isFlippedY ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE bool isFlipY ( ) { return isFlippedY ( ) ; } ; <nl> - / * * @ deprecated Use setFlippedY ( ) instead * / <nl> - CC_DEPRECATED_ATTRIBUTE void setFlipY ( bool flipY ) { setFlippedY ( flipY ) ; } ; <nl> - <nl> / / override " setAnchorPoint " method of widget . <nl> virtual void setAnchorPoint ( const Point & pt ) override ; <nl> <nl> class Text : public Widget <nl> virtual void updateTextureColor ( ) override ; <nl> virtual void updateTextureOpacity ( ) override ; <nl> virtual void updateTextureRGBA ( ) override ; <nl> + virtual void updateFlippedX ( ) override ; <nl> + virtual void updateFlippedY ( ) override ; <nl> void labelScaleChangedWithSize ( ) ; <nl> virtual Widget * createCloneInstance ( ) override ; <nl> virtual void copySpecialProperties ( Widget * model ) override ; <nl> mmm a / cocos / gui / UIWidget . cpp <nl> ppp b / cocos / gui / UIWidget . cpp <nl> _hitted ( false ) , <nl> _touchListener ( nullptr ) , <nl> _nodes ( NULL ) , <nl> _color ( Color3B : : WHITE ) , <nl> - _opacity ( 255 ) <nl> + _opacity ( 255 ) , <nl> + _flippedX ( false ) , <nl> + _flippedY ( false ) <nl> { <nl> <nl> } <nl> void Widget : : setOpacity ( GLubyte opacity ) <nl> _opacity = opacity ; <nl> updateTextureOpacity ( ) ; <nl> } <nl> + <nl> + void Widget : : setFlippedX ( bool flippedX ) <nl> + { <nl> + _flippedX = flippedX ; <nl> + updateFlippedX ( ) ; <nl> + } <nl> + <nl> + void Widget : : setFlippedY ( bool flippedY ) <nl> + { <nl> + _flippedY = flippedY ; <nl> + updateFlippedY ( ) ; <nl> + } <nl> <nl> void Widget : : updateColorToRenderer ( Node * renderer ) <nl> { <nl> mmm a / cocos / gui / UIWidget . h <nl> ppp b / cocos / gui / UIWidget . h <nl> class Widget : public Node <nl> * <nl> * @ param bFlippedX true if the widget should be flipped horizaontally , false otherwise . <nl> * / <nl> - virtual void setFlippedX ( bool flippedX ) { } ; <nl> + virtual void setFlippedX ( bool flippedX ) ; <nl> <nl> / * * <nl> * Returns the flag which indicates whether the widget is flipped horizontally or not . <nl> class Widget : public Node <nl> * <nl> * @ return true if the widget is flipped horizaontally , false otherwise . <nl> * / <nl> - virtual bool isFlippedX ( ) { return false ; } ; <nl> + virtual bool isFlippedX ( ) { return _flippedX ; } ; <nl> <nl> / * * <nl> * Sets whether the widget should be flipped vertically or not . <nl> * <nl> * @ param bFlippedY true if the widget should be flipped vertically , flase otherwise . <nl> * / <nl> - virtual void setFlippedY ( bool flippedY ) { } ; <nl> + virtual void setFlippedY ( bool flippedY ) ; <nl> <nl> / * * <nl> * Return the flag which indicates whether the widget is flipped vertically or not . <nl> class Widget : public Node <nl> * <nl> * @ return true if the widget is flipped vertically , flase otherwise . <nl> * / <nl> - virtual bool isFlippedY ( ) { return false ; } ; <nl> + virtual bool isFlippedY ( ) { return _flippedY ; } ; <nl> <nl> virtual void setColor ( const Color3B & color ) override ; <nl> <nl> class Widget : public Node <nl> virtual void updateTextureColor ( ) { } ; <nl> virtual void updateTextureOpacity ( ) { } ; <nl> virtual void updateTextureRGBA ( ) { } ; <nl> + virtual void updateFlippedX ( ) { } ; <nl> + virtual void updateFlippedY ( ) { } ; <nl> void updateColorToRenderer ( Node * renderer ) ; <nl> void updateOpacityToRenderer ( Node * renderer ) ; <nl> void updateRGBAToRenderer ( Node * renderer ) ; <nl> class Widget : public Node <nl> Vector < Node * > _nodes ; <nl> Color3B _color ; <nl> GLubyte _opacity ; <nl> + bool _flippedX ; <nl> + bool _flippedY ; <nl> Map < int , LayoutParameter * > _layoutParameterDictionary ; <nl> Vector < Node * > _widgetChildren ; <nl> <nl>
|
Fixed bugs of Flipping
|
cocos2d/cocos2d-x
|
2a5ecc2376f8b11eb4b6d619753b0aa4c7bf258d
|
2014-03-06T05:40:46Z
|
mmm a / src / core / CMakeLists . txt <nl> ppp b / src / core / CMakeLists . txt <nl> add_library ( core STATIC <nl> loader / nsp . h <nl> loader / xci . cpp <nl> loader / xci . h <nl> - memory / freezer . cpp <nl> - memory / freezer . h <nl> memory . cpp <nl> memory . h <nl> memory_setup . h <nl> add_library ( core STATIC <nl> settings . h <nl> telemetry_session . cpp <nl> telemetry_session . h <nl> + tools / freezer . cpp <nl> + tools / freezer . h <nl> ) <nl> <nl> create_target_directory_groups ( core ) <nl> mmm a / src / core / core . cpp <nl> ppp b / src / core / core . cpp <nl> <nl> # include " core / hle / service / service . h " <nl> # include " core / hle / service / sm / sm . h " <nl> # include " core / loader / loader . h " <nl> - # include " core / memory / freezer . h " <nl> # include " core / perf_stats . h " <nl> # include " core / settings . h " <nl> # include " core / telemetry_session . h " <nl> + # include " core / tools / freezer . h " <nl> # include " file_sys / cheat_engine . h " <nl> # include " video_core / debug_utils / debug_utils . h " <nl> # include " video_core / renderer_base . h " <nl> struct System : : Impl { <nl> bool is_powered_on = false ; <nl> <nl> std : : unique_ptr < FileSys : : CheatEngine > cheat_engine ; <nl> - std : : unique_ptr < Memory : : Freezer > memory_freezer ; <nl> + std : : unique_ptr < Tools : : Freezer > memory_freezer ; <nl> <nl> / / / Frontend applets <nl> Service : : AM : : Applets : : AppletManager applet_manager ; <nl> similarity index 91 % <nl> rename from src / core / memory / freezer . cpp <nl> rename to src / core / tools / freezer . cpp <nl> mmm a / src / core / memory / freezer . cpp <nl> ppp b / src / core / tools / freezer . cpp <nl> <nl> # include " core / core_timing . h " <nl> # include " core / core_timing_util . h " <nl> # include " core / memory . h " <nl> - # include " core / memory / freezer . h " <nl> + # include " core / tools / freezer . h " <nl> <nl> - namespace Memory { <nl> + namespace Tools { <nl> <nl> namespace { <nl> <nl> constexpr s64 MEMORY_FREEZER_TICKS = static_cast < s64 > ( Core : : Timing : : BASE_CLOCK_R <nl> u64 MemoryReadWidth ( u32 width , VAddr addr ) { <nl> switch ( width ) { <nl> case 1 : <nl> - return Read8 ( addr ) ; <nl> + return Memory : : Read8 ( addr ) ; <nl> case 2 : <nl> - return Read16 ( addr ) ; <nl> + return Memory : : Read16 ( addr ) ; <nl> case 4 : <nl> - return Read32 ( addr ) ; <nl> + return Memory : : Read32 ( addr ) ; <nl> case 8 : <nl> - return Read64 ( addr ) ; <nl> + return Memory : : Read64 ( addr ) ; <nl> default : <nl> UNREACHABLE ( ) ; <nl> return 0 ; <nl> u64 MemoryReadWidth ( u32 width , VAddr addr ) { <nl> void MemoryWriteWidth ( u32 width , VAddr addr , u64 value ) { <nl> switch ( width ) { <nl> case 1 : <nl> - Write8 ( addr , static_cast < u8 > ( value ) ) ; <nl> + Memory : : Write8 ( addr , static_cast < u8 > ( value ) ) ; <nl> break ; <nl> case 2 : <nl> - Write16 ( addr , static_cast < u16 > ( value ) ) ; <nl> + Memory : : Write16 ( addr , static_cast < u16 > ( value ) ) ; <nl> break ; <nl> case 4 : <nl> - Write32 ( addr , static_cast < u32 > ( value ) ) ; <nl> + Memory : : Write32 ( addr , static_cast < u32 > ( value ) ) ; <nl> break ; <nl> case 8 : <nl> - Write64 ( addr , value ) ; <nl> + Memory : : Write64 ( addr , value ) ; <nl> break ; <nl> default : <nl> UNREACHABLE ( ) ; <nl> void Freezer : : FillEntryReads ( ) { <nl> } <nl> } <nl> <nl> - } / / namespace Memory <nl> + } / / namespace Tools <nl> similarity index 98 % <nl> rename from src / core / memory / freezer . h <nl> rename to src / core / tools / freezer . h <nl> mmm a / src / core / memory / freezer . h <nl> ppp b / src / core / tools / freezer . h <nl> class CoreTiming ; <nl> struct EventType ; <nl> } / / namespace Core : : Timing <nl> <nl> - namespace Memory { <nl> + namespace Tools { <nl> <nl> / / A class that will effectively freeze memory values . <nl> class Freezer { <nl> class Freezer { <nl> Core : : Timing : : CoreTiming & core_timing ; <nl> } ; <nl> <nl> - } / / namespace Memory <nl> + } / / namespace Tools <nl>
|
core : Move Freezer class to tools namespace
|
yuzu-emu/yuzu
|
ed82fa3a91fc84f7f906b898d8f71e15fb42c16e
|
2019-06-20T23:22:53Z
|
mmm a / platform / android / java / src / org / godotengine / godot / Godot . java <nl> ppp b / platform / android / java / src / org / godotengine / godot / Godot . java <nl> public void onVideoInit ( ) { <nl> / / . . . add to FrameLayout <nl> layout . addView ( edittext ) ; <nl> <nl> - mView = new GodotView ( getApplication ( ) , io , use_gl3 , use_32_bits , use_debug_opengl , this ) ; <nl> + mView = new GodotView ( getApplication ( ) , io , use_gl3 , use_32_bits , use_debug_opengl , this ) ; <nl> layout . addView ( mView , new LayoutParams ( LayoutParams . FILL_PARENT , LayoutParams . FILL_PARENT ) ) ; <nl> edittext . setView ( mView ) ; <nl> io . setEdit ( edittext ) ; <nl> mmm a / platform / android / java / src / org / godotengine / godot / GodotView . java <nl> ppp b / platform / android / java / src / org / godotengine / godot / GodotView . java <nl> <nl> private Godot activity ; <nl> <nl> private InputManagerCompat mInputManager ; <nl> - public GodotView ( Context context , GodotIO p_io , boolean p_use_gl3 , boolean p_use_32_bits , boolean p_use_debug_opengl , Godot p_activity ) { <nl> + public GodotView ( Context context , GodotIO p_io , boolean p_use_gl3 , boolean p_use_32_bits , boolean p_use_debug_opengl , Godot p_activity ) { <nl> super ( context ) ; <nl> ctx = context ; <nl> io = p_io ; <nl> private void init ( boolean translucent , int depth , int stencil ) { <nl> setRenderer ( new Renderer ( ) ) ; <nl> } <nl> <nl> - private static final int _EGL_CONTEXT_FLAGS_KHR = 0x30FC ; <nl> - private static final int _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR = 0x00000001 ; <nl> - <nl> + private static final int _EGL_CONTEXT_FLAGS_KHR = 0x30FC ; <nl> + private static final int _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR = 0x00000001 ; <nl> + <nl> private static class ContextFactory implements GLSurfaceView . EGLContextFactory { <nl> private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098 ; <nl> public EGLContext createContext ( EGL10 egl , EGLDisplay display , EGLConfig eglConfig ) { <nl> public EGLContext createContext ( EGL10 egl , EGLDisplay display , EGLConfig eglConf <nl> checkEglError ( " Before eglCreateContext " , egl ) ; <nl> EGLContext context ; <nl> if ( use_debug_opengl ) { <nl> - int [ ] attrib_list2 = { EGL_CONTEXT_CLIENT_VERSION , 2 , _EGL_CONTEXT_FLAGS_KHR , _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR , EGL10 . EGL_NONE } ; <nl> - int [ ] attrib_list3 = { EGL_CONTEXT_CLIENT_VERSION , 3 , _EGL_CONTEXT_FLAGS_KHR , _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR , EGL10 . EGL_NONE } ; <nl> - context = egl . eglCreateContext ( display , eglConfig , EGL10 . EGL_NO_CONTEXT , use_gl3 ? attrib_list3 : attrib_list2 ) ; <nl> + int [ ] attrib_list2 = { EGL_CONTEXT_CLIENT_VERSION , 2 , _EGL_CONTEXT_FLAGS_KHR , _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR , EGL10 . EGL_NONE } ; <nl> + int [ ] attrib_list3 = { EGL_CONTEXT_CLIENT_VERSION , 3 , _EGL_CONTEXT_FLAGS_KHR , _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR , EGL10 . EGL_NONE } ; <nl> + context = egl . eglCreateContext ( display , eglConfig , EGL10 . EGL_NO_CONTEXT , use_gl3 ? attrib_list3 : attrib_list2 ) ; <nl> } else { <nl> int [ ] attrib_list2 = { EGL_CONTEXT_CLIENT_VERSION , 2 , EGL10 . EGL_NONE } ; <nl> int [ ] attrib_list3 = { EGL_CONTEXT_CLIENT_VERSION , 3 , EGL10 . EGL_NONE } ; <nl>
|
Style : Apply clang - format to wrongly formatted files
|
godotengine/godot
|
bfd1f09ac515706e4c55335cf4be22676adefd6d
|
2018-10-29T22:47:40Z
|
mmm a / cocos / editor - support / spine / Animation . c <nl> ppp b / cocos / editor - support / spine / Animation . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> void spFlipTimeline_setFrame ( spFlipTimeline * self , int frameIndex , float time , <nl> } <nl> <nl> / * * / <nl> - <nl> mmm a / cocos / editor - support / spine / Animation . h <nl> ppp b / cocos / editor - support / spine / Animation . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / AnimationState . c <nl> ppp b / cocos / editor - support / spine / AnimationState . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / AnimationState . h <nl> ppp b / cocos / editor - support / spine / AnimationState . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / AnimationStateData . c <nl> ppp b / cocos / editor - support / spine / AnimationStateData . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / AnimationStateData . h <nl> ppp b / cocos / editor - support / spine / AnimationStateData . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Atlas . c <nl> ppp b / cocos / editor - support / spine / Atlas . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Atlas . h <nl> ppp b / cocos / editor - support / spine / Atlas . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / AtlasAttachmentLoader . c <nl> ppp b / cocos / editor - support / spine / AtlasAttachmentLoader . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / AtlasAttachmentLoader . h <nl> ppp b / cocos / editor - support / spine / AtlasAttachmentLoader . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Attachment . c <nl> ppp b / cocos / editor - support / spine / Attachment . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Attachment . h <nl> ppp b / cocos / editor - support / spine / Attachment . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / AttachmentLoader . c <nl> ppp b / cocos / editor - support / spine / AttachmentLoader . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / AttachmentLoader . h <nl> ppp b / cocos / editor - support / spine / AttachmentLoader . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Bone . c <nl> ppp b / cocos / editor - support / spine / Bone . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Bone . h <nl> ppp b / cocos / editor - support / spine / Bone . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / BoneData . c <nl> ppp b / cocos / editor - support / spine / BoneData . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / BoneData . h <nl> ppp b / cocos / editor - support / spine / BoneData . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / BoundingBoxAttachment . c <nl> ppp b / cocos / editor - support / spine / BoundingBoxAttachment . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / BoundingBoxAttachment . h <nl> ppp b / cocos / editor - support / spine / BoundingBoxAttachment . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Event . c <nl> ppp b / cocos / editor - support / spine / Event . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Event . h <nl> ppp b / cocos / editor - support / spine / Event . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / EventData . c <nl> ppp b / cocos / editor - support / spine / EventData . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / EventData . h <nl> ppp b / cocos / editor - support / spine / EventData . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / IkConstraint . c <nl> ppp b / cocos / editor - support / spine / IkConstraint . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / IkConstraint . h <nl> ppp b / cocos / editor - support / spine / IkConstraint . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / IkConstraintData . c <nl> ppp b / cocos / editor - support / spine / IkConstraintData . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / IkConstraintData . h <nl> ppp b / cocos / editor - support / spine / IkConstraintData . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / MeshAttachment . c <nl> ppp b / cocos / editor - support / spine / MeshAttachment . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / MeshAttachment . h <nl> ppp b / cocos / editor - support / spine / MeshAttachment . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> - * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Version 2 . 3 <nl> + * <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> - * <nl> + * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> - * <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> + * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / PolygonBatch . cpp <nl> ppp b / cocos / editor - support / spine / PolygonBatch . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / PolygonBatch . h <nl> ppp b / cocos / editor - support / spine / PolygonBatch . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / RegionAttachment . c <nl> ppp b / cocos / editor - support / spine / RegionAttachment . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / RegionAttachment . h <nl> ppp b / cocos / editor - support / spine / RegionAttachment . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Skeleton . c <nl> ppp b / cocos / editor - support / spine / Skeleton . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Skeleton . h <nl> ppp b / cocos / editor - support / spine / Skeleton . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / SkeletonAnimation . cpp <nl> ppp b / cocos / editor - support / spine / SkeletonAnimation . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> void disposeTrackEntry ( spTrackEntry * entry ) { <nl> <nl> / / <nl> <nl> - SkeletonAnimation * SkeletonAnimation : : createWithData ( spSkeletonData * skeletonData ) { <nl> - SkeletonAnimation * node = new SkeletonAnimation ( skeletonData ) ; <nl> + SkeletonAnimation * SkeletonAnimation : : createWithData ( spSkeletonData * skeletonData , bool ownsSkeletonData ) { <nl> + SkeletonAnimation * node = new SkeletonAnimation ( skeletonData , ownsSkeletonData ) ; <nl> node - > autorelease ( ) ; <nl> return node ; <nl> } <nl> SkeletonAnimation : : SkeletonAnimation ( ) <nl> : SkeletonRenderer ( ) { <nl> } <nl> <nl> - SkeletonAnimation : : SkeletonAnimation ( spSkeletonData * skeletonData ) <nl> - : SkeletonRenderer ( skeletonData ) { <nl> + SkeletonAnimation : : SkeletonAnimation ( spSkeletonData * skeletonData , bool ownsSkeletonData ) <nl> + : SkeletonRenderer ( skeletonData , ownsSkeletonData ) { <nl> initialize ( ) ; <nl> } <nl> <nl> mmm a / cocos / editor - support / spine / SkeletonAnimation . h <nl> ppp b / cocos / editor - support / spine / SkeletonAnimation . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> typedef std : : function < void ( int trackIndex , spEvent * event ) > EventListener ; <nl> * played later . * / <nl> class SkeletonAnimation : public SkeletonRenderer { <nl> public : <nl> - static SkeletonAnimation * createWithData ( spSkeletonData * skeletonData ) ; <nl> + static SkeletonAnimation * createWithData ( spSkeletonData * skeletonData , bool ownsSkeletonData = false ) ; <nl> static SkeletonAnimation * createWithFile ( const std : : string & skeletonDataFile , spAtlas * atlas , float scale = 1 ) ; <nl> static SkeletonAnimation * createWithFile ( const std : : string & skeletonDataFile , const std : : string & atlasFile , float scale = 1 ) ; <nl> <nl> class SkeletonAnimation : public SkeletonRenderer { <nl> <nl> CC_CONSTRUCTOR_ACCESS : <nl> SkeletonAnimation ( ) ; <nl> - SkeletonAnimation ( spSkeletonData * skeletonData ) ; <nl> + SkeletonAnimation ( spSkeletonData * skeletonData , bool ownsSkeletonData = false ) ; <nl> SkeletonAnimation ( const std : : string & skeletonDataFile , spAtlas * atlas , float scale = 1 ) ; <nl> SkeletonAnimation ( const std : : string & skeletonDataFile , const std : : string & atlasFile , float scale = 1 ) ; <nl> virtual ~ SkeletonAnimation ( ) ; <nl> mmm a / cocos / editor - support / spine / SkeletonBounds . c <nl> ppp b / cocos / editor - support / spine / SkeletonBounds . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / SkeletonBounds . h <nl> ppp b / cocos / editor - support / spine / SkeletonBounds . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / SkeletonData . c <nl> ppp b / cocos / editor - support / spine / SkeletonData . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / SkeletonData . h <nl> ppp b / cocos / editor - support / spine / SkeletonData . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / SkeletonJson . c <nl> ppp b / cocos / editor - support / spine / SkeletonJson . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> spSkeletonData * spSkeletonJson_readSkeletonData ( spSkeletonJson * self , const cha <nl> for ( slotMap = slots - > child , i = 0 ; slotMap ; slotMap = slotMap - > next , + + i ) { <nl> spSlotData * slotData ; <nl> const char * color ; <nl> - Json * attachmentItem ; <nl> + Json * item ; <nl> <nl> const char * boneName = Json_getString ( slotMap , " bone " , 0 ) ; <nl> spBoneData * boneData = spSkeletonData_findBone ( skeletonData , boneName ) ; <nl> spSkeletonData * spSkeletonJson_readSkeletonData ( spSkeletonJson * self , const cha <nl> slotData - > a = toColor ( color , 3 ) ; <nl> } <nl> <nl> - attachmentItem = Json_getItem ( slotMap , " attachment " ) ; <nl> - if ( attachmentItem ) spSlotData_setAttachmentName ( slotData , attachmentItem - > valueString ) ; <nl> - <nl> - slotData - > additiveBlending = Json_getInt ( slotMap , " additive " , 0 ) ; <nl> + item = Json_getItem ( slotMap , " attachment " ) ; <nl> + if ( item ) spSlotData_setAttachmentName ( slotData , item - > valueString ) ; <nl> + <nl> + item = Json_getItem ( slotMap , " blend " ) ; <nl> + if ( item ) { <nl> + if ( strcmp ( item - > valueString , " additive " ) = = 0 ) <nl> + slotData - > blendMode = SP_BLEND_MODE_ADDITIVE ; <nl> + else if ( strcmp ( item - > valueString , " multiply " ) = = 0 ) <nl> + slotData - > blendMode = SP_BLEND_MODE_MULTIPLY ; <nl> + else if ( strcmp ( item - > valueString , " screen " ) = = 0 ) <nl> + slotData - > blendMode = SP_BLEND_MODE_SCREEN ; <nl> + } <nl> <nl> skeletonData - > slots [ i ] = slotData ; <nl> } <nl> mmm a / cocos / editor - support / spine / SkeletonJson . h <nl> ppp b / cocos / editor - support / spine / SkeletonJson . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / SkeletonRenderer . cpp <nl> ppp b / cocos / editor - support / spine / SkeletonRenderer . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> void SkeletonRenderer : : drawSkeleton ( const Mat4 & transform , uint32_t transformFl <nl> _skeleton - > b = nodeColor . b / ( float ) 255 ; <nl> _skeleton - > a = getDisplayedOpacity ( ) / ( float ) 255 ; <nl> <nl> - int additive = - 1 ; <nl> + int blendMode = - 1 ; <nl> Color4B color ; <nl> const float * uvs = nullptr ; <nl> int verticesCount = 0 ; <nl> void SkeletonRenderer : : drawSkeleton ( const Mat4 & transform , uint32_t transformFl <nl> default : ; <nl> } <nl> if ( texture ) { <nl> - if ( slot - > data - > additiveBlending ! = additive ) { <nl> + if ( slot - > data - > blendMode ! = blendMode ) { <nl> _batch - > flush ( ) ; <nl> - GL : : blendFunc ( _blendFunc . src , slot - > data - > additiveBlending ? GL_ONE : _blendFunc . dst ) ; <nl> - additive = slot - > data - > additiveBlending ; <nl> + blendMode = slot - > data - > blendMode ; <nl> + switch ( slot - > data - > blendMode ) { <nl> + case SP_BLEND_MODE_ADDITIVE : <nl> + GL : : blendFunc ( _premultipliedAlpha ? GL_ONE : GL_SRC_ALPHA , GL_ONE ) ; <nl> + break ; <nl> + case SP_BLEND_MODE_MULTIPLY : <nl> + GL : : blendFunc ( GL_DST_COLOR , GL_ONE_MINUS_SRC_ALPHA ) ; <nl> + break ; <nl> + case SP_BLEND_MODE_SCREEN : <nl> + GL : : blendFunc ( GL_ONE , GL_ONE_MINUS_SRC_COLOR ) ; <nl> + break ; <nl> + default : <nl> + GL : : blendFunc ( _blendFunc . src , _blendFunc . dst ) ; <nl> + } <nl> } <nl> color . a = _skeleton - > a * slot - > a * a * 255 ; <nl> float multiplier = _premultipliedAlpha ? color . a : 255 ; <nl> mmm a / cocos / editor - support / spine / SkeletonRenderer . h <nl> ppp b / cocos / editor - support / spine / SkeletonRenderer . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> class SkeletonRenderer : public cocos2d : : Node , public cocos2d : : BlendProtocol { <nl> bool setAttachment ( const std : : string & slotName , const char * attachmentName ) ; <nl> <nl> / / mmm BlendProtocol <nl> - virtual void setBlendFunc ( const cocos2d : : BlendFunc & blendFunc ) override ; <nl> - virtual const cocos2d : : BlendFunc & getBlendFunc ( ) const override ; <nl> - virtual void setOpacityModifyRGB ( bool value ) override ; <nl> - virtual bool isOpacityModifyRGB ( ) const override ; <nl> + virtual void setBlendFunc ( const cocos2d : : BlendFunc & blendFunc ) ; <nl> + virtual const cocos2d : : BlendFunc & getBlendFunc ( ) const ; <nl> + virtual void setOpacityModifyRGB ( bool value ) ; <nl> + virtual bool isOpacityModifyRGB ( ) const ; <nl> <nl> CC_CONSTRUCTOR_ACCESS : <nl> SkeletonRenderer ( ) ; <nl> mmm a / cocos / editor - support / spine / Skin . c <nl> ppp b / cocos / editor - support / spine / Skin . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Skin . h <nl> ppp b / cocos / editor - support / spine / Skin . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / SkinnedMeshAttachment . c <nl> ppp b / cocos / editor - support / spine / SkinnedMeshAttachment . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / SkinnedMeshAttachment . h <nl> ppp b / cocos / editor - support / spine / SkinnedMeshAttachment . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> - * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Version 2 . 3 <nl> + * <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> - * <nl> + * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> - * <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> + * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Slot . c <nl> ppp b / cocos / editor - support / spine / Slot . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / Slot . h <nl> ppp b / cocos / editor - support / spine / Slot . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / SlotData . c <nl> ppp b / cocos / editor - support / spine / SlotData . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / SlotData . h <nl> ppp b / cocos / editor - support / spine / SlotData . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> <nl> extern " C " { <nl> # endif <nl> <nl> + typedef enum { <nl> + SP_BLEND_MODE_NORMAL , SP_BLEND_MODE_ADDITIVE , SP_BLEND_MODE_MULTIPLY , SP_BLEND_MODE_SCREEN <nl> + } spBlendMode ; <nl> + <nl> typedef struct spSlotData { <nl> const char * const name ; <nl> const spBoneData * const boneData ; <nl> const char * attachmentName ; <nl> float r , g , b , a ; <nl> - int / * bool * / additiveBlending ; <nl> + spBlendMode blendMode ; <nl> <nl> # ifdef __cplusplus <nl> spSlotData ( ) : <nl> typedef struct spSlotData { <nl> boneData ( 0 ) , <nl> attachmentName ( 0 ) , <nl> r ( 0 ) , g ( 0 ) , b ( 0 ) , a ( 0 ) , <nl> - additiveBlending ( 0 ) { <nl> + blendMode ( SP_BLEND_MODE_NORMAL ) { <nl> } <nl> # endif <nl> } spSlotData ; <nl> void spSlotData_dispose ( spSlotData * self ) ; <nl> void spSlotData_setAttachmentName ( spSlotData * self , const char * attachmentName ) ; <nl> <nl> # ifdef SPINE_SHORT_NAMES <nl> + typedef spBlendMode BlendMode ; <nl> + # define BLEND_MODE_NORMAL SP_BLEND_MODE_NORMAL <nl> + # define BLEND_MODE_ADDITIVE SP_BLEND_MODE_ADDITIVE <nl> + # define BLEND_MODE_MULTIPLY SP_BLEND_MODE_MULTIPLY <nl> + # define BLEND_MODE_SCREEN SP_BLEND_MODE_SCREEN <nl> typedef spSlotData SlotData ; <nl> # define SlotData_create ( . . . ) spSlotData_create ( __VA_ARGS__ ) <nl> # define SlotData_dispose ( . . . ) spSlotData_dispose ( __VA_ARGS__ ) <nl> mmm a / cocos / editor - support / spine / extension . c <nl> ppp b / cocos / editor - support / spine / extension . c <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / spine - cocos2dx . cpp <nl> ppp b / cocos / editor - support / spine / spine - cocos2dx . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / spine - cocos2dx . h <nl> ppp b / cocos / editor - support / spine / spine - cocos2dx . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl> mmm a / cocos / editor - support / spine / spine . h <nl> ppp b / cocos / editor - support / spine / spine . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Spine Runtimes Software License <nl> - * Version 2 . 1 <nl> + * Version 2 . 3 <nl> * <nl> - * Copyright ( c ) 2013 , Esoteric Software <nl> + * Copyright ( c ) 2013 - 2015 , Esoteric Software <nl> * All rights reserved . <nl> * <nl> * You are granted a perpetual , non - exclusive , non - sublicensable and <nl> - * non - transferable license to install , execute and perform the Spine Runtimes <nl> - * Software ( the " Software " ) solely for internal use . Without the written <nl> - * permission of Esoteric Software ( typically granted by licensing Spine ) , you <nl> - * may not ( a ) modify , translate , adapt or otherwise create derivative works , <nl> - * improvements of the Software or develop new applications using the Software <nl> - * or ( b ) remove , delete , alter or obscure any trademarks or any copyright , <nl> - * trademark , patent or other intellectual property or proprietary rights <nl> - * notices on or in the Software , including any copy thereof . Redistributions <nl> - * in binary or source form must include this license and terms . <nl> + * non - transferable license to use , install , execute and perform the Spine <nl> + * Runtimes Software ( the " Software " ) and derivative works solely for personal <nl> + * or internal use . Without the written permission of Esoteric Software ( see <nl> + * Section 2 of the Spine Software License Agreement ) , you may not ( a ) modify , <nl> + * translate , adapt or otherwise create derivative works , improvements of the <nl> + * Software or develop new applications using the Software or ( b ) remove , <nl> + * delete , alter or obscure any trademarks or any copyright , trademark , patent <nl> + * or other intellectual property or proprietary rights notices on or in the <nl> + * Software , including any copy thereof . Redistributions in binary or source <nl> + * form must include this license and terms . <nl> * <nl> * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE " AS IS " AND ANY EXPRESS OR <nl> * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF <nl> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO <nl> - * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , <nl> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; <nl> * OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , <nl>
|
Adds support for Spine runtime 2 . 3
|
cocos2d/cocos2d-x
|
301b55c686e65f25b97695f4dd37f0c888b13578
|
2015-07-20T17:39:34Z
|
mmm a / googlemock / include / gmock / gmock - generated - nice - strict . h <nl> ppp b / googlemock / include / gmock / gmock - generated - nice - strict . h <nl> <nl> <nl> namespace testing { <nl> <nl> - namespace internal { <nl> - <nl> - / / NiceMockBase serves as a mix - in to establish the " uninteresting call " <nl> - / / behavior for NiceMock on construction . It accomplishes this via CRTP to get <nl> - / / access to the derived MockClass . <nl> - template < class MockClass > <nl> - class NiceMockBase { <nl> - protected : <nl> - NiceMockBase ( ) ; <nl> - <nl> - ~ NiceMockBase ( ) ; <nl> - } ; <nl> - <nl> - } / / namespace internal <nl> - <nl> template < class MockClass > <nl> - class NiceMock : public MockClass , public internal : : NiceMockBase < MockClass > { <nl> + class NiceMock : public MockClass { <nl> public : <nl> - NiceMock ( ) : MockClass ( ) { } <nl> + NiceMock ( ) : MockClass ( ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> # if GTEST_LANG_CXX11 <nl> - / / Ideally , we would inherit base class ' s constructors through a using <nl> - / / declaration , which would preserve their visibility . However , many existing <nl> - / / tests rely on the fact that current implementation reexports protected <nl> - / / constructors as public . These tests would need to be cleaned up first . <nl> - <nl> / / Single argument constructor is special - cased so that it can be <nl> / / made explicit . <nl> template < typename A > <nl> - explicit NiceMock ( A & & arg ) : MockClass ( std : : forward < A > ( arg ) ) { } <nl> + explicit NiceMock ( A & & arg ) : MockClass ( std : : forward < A > ( arg ) ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename . . . An > <nl> NiceMock ( A1 & & arg1 , A2 & & arg2 , An & & . . . args ) <nl> : MockClass ( std : : forward < A1 > ( arg1 ) , std : : forward < A2 > ( arg2 ) , <nl> - std : : forward < An > ( args ) . . . ) { } <nl> + std : : forward < An > ( args ) . . . ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> # else <nl> / / C + + 98 doesn ' t have variadic templates , so we have to define one <nl> / / for each arity . <nl> template < typename A1 > <nl> - explicit NiceMock ( const A1 & a1 ) : MockClass ( a1 ) { } <nl> + explicit NiceMock ( const A1 & a1 ) : MockClass ( a1 ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> template < typename A1 , typename A2 > <nl> - NiceMock ( const A1 & a1 , const A2 & a2 ) : MockClass ( a1 , a2 ) { } <nl> + NiceMock ( const A1 & a1 , const A2 & a2 ) : MockClass ( a1 , a2 ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 > <nl> - NiceMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 ) : MockClass ( a1 , a2 , a3 ) { } <nl> + NiceMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 ) : MockClass ( a1 , a2 , a3 ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 > <nl> NiceMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , <nl> - const A4 & a4 ) : MockClass ( a1 , a2 , a3 , a4 ) { } <nl> + const A4 & a4 ) : MockClass ( a1 , a2 , a3 , a4 ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 > <nl> NiceMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> - const A5 & a5 ) : MockClass ( a1 , a2 , a3 , a4 , a5 ) { } <nl> + const A5 & a5 ) : MockClass ( a1 , a2 , a3 , a4 , a5 ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 > <nl> NiceMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> - const A5 & a5 , const A6 & a6 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 ) { } <nl> + const A5 & a5 , const A6 & a6 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 > <nl> NiceMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , <nl> - a6 , a7 ) { } <nl> + a6 , a7 ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 , typename A8 > <nl> NiceMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 , const A8 & a8 ) : MockClass ( a1 , <nl> - a2 , a3 , a4 , a5 , a6 , a7 , a8 ) { } <nl> + a2 , a3 , a4 , a5 , a6 , a7 , a8 ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 , typename A8 , typename A9 > <nl> NiceMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 , const A8 & a8 , <nl> - const A9 & a9 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 ) { } <nl> + const A9 & a9 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 , typename A8 , typename A9 , typename A10 > <nl> NiceMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 , const A8 & a8 , const A9 & a9 , <nl> - const A10 & a10 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 ) { } <nl> + const A10 & a10 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 ) { <nl> + : : testing : : Mock : : AllowUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> # endif / / GTEST_LANG_CXX11 <nl> <nl> + ~ NiceMock ( ) { <nl> + : : testing : : Mock : : UnregisterCallReaction ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> + <nl> private : <nl> GTEST_DISALLOW_COPY_AND_ASSIGN_ ( NiceMock ) ; <nl> } ; <nl> <nl> - namespace internal { <nl> - <nl> - template < typename MockClass > <nl> - NiceMockBase < MockClass > : : NiceMockBase ( ) { <nl> - : : testing : : Mock : : AllowUninterestingCalls ( <nl> - internal : : ImplicitCast_ < MockClass * > ( <nl> - static_cast < NiceMock < MockClass > * > ( this ) ) ) ; <nl> - } <nl> - <nl> - template < typename MockClass > <nl> - NiceMockBase < MockClass > : : ~ NiceMockBase ( ) { <nl> - : : testing : : Mock : : UnregisterCallReaction ( <nl> - internal : : ImplicitCast_ < MockClass * > ( <nl> - static_cast < NiceMock < MockClass > * > ( this ) ) ) ; <nl> - } <nl> - <nl> - } / / namespace internal <nl> - <nl> - namespace internal { <nl> - <nl> - / / NaggyMockBase serves as a mix - in to establish the " uninteresting call " <nl> - / / behavior for NaggyMock on construction . It accomplishes this via CRTP to get <nl> - / / access to the derived MockClass . <nl> - template < class MockClass > <nl> - class NaggyMockBase { <nl> - protected : <nl> - NaggyMockBase ( ) ; <nl> - <nl> - ~ NaggyMockBase ( ) ; <nl> - } ; <nl> - <nl> - } / / namespace internal <nl> - <nl> template < class MockClass > <nl> - class NaggyMock : public MockClass , public internal : : NaggyMockBase < MockClass > { <nl> + class NaggyMock : public MockClass { <nl> public : <nl> - NaggyMock ( ) : MockClass ( ) { } <nl> + NaggyMock ( ) : MockClass ( ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> # if GTEST_LANG_CXX11 <nl> - / / Ideally , we would inherit base class ' s constructors through a using <nl> - / / declaration , which would preserve their visibility . However , many existing <nl> - / / tests rely on the fact that current implementation reexports protected <nl> - / / constructors as public . These tests would need to be cleaned up first . <nl> - <nl> / / Single argument constructor is special - cased so that it can be <nl> / / made explicit . <nl> template < typename A > <nl> - explicit NaggyMock ( A & & arg ) : MockClass ( std : : forward < A > ( arg ) ) { } <nl> + explicit NaggyMock ( A & & arg ) : MockClass ( std : : forward < A > ( arg ) ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename . . . An > <nl> NaggyMock ( A1 & & arg1 , A2 & & arg2 , An & & . . . args ) <nl> : MockClass ( std : : forward < A1 > ( arg1 ) , std : : forward < A2 > ( arg2 ) , <nl> - std : : forward < An > ( args ) . . . ) { } <nl> + std : : forward < An > ( args ) . . . ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> # else <nl> / / C + + 98 doesn ' t have variadic templates , so we have to define one <nl> / / for each arity . <nl> template < typename A1 > <nl> - explicit NaggyMock ( const A1 & a1 ) : MockClass ( a1 ) { } <nl> + explicit NaggyMock ( const A1 & a1 ) : MockClass ( a1 ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> template < typename A1 , typename A2 > <nl> - NaggyMock ( const A1 & a1 , const A2 & a2 ) : MockClass ( a1 , a2 ) { } <nl> + NaggyMock ( const A1 & a1 , const A2 & a2 ) : MockClass ( a1 , a2 ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 > <nl> - NaggyMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 ) : MockClass ( a1 , a2 , a3 ) { } <nl> + NaggyMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 ) : MockClass ( a1 , a2 , a3 ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 > <nl> NaggyMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , <nl> - const A4 & a4 ) : MockClass ( a1 , a2 , a3 , a4 ) { } <nl> + const A4 & a4 ) : MockClass ( a1 , a2 , a3 , a4 ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 > <nl> NaggyMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> - const A5 & a5 ) : MockClass ( a1 , a2 , a3 , a4 , a5 ) { } <nl> + const A5 & a5 ) : MockClass ( a1 , a2 , a3 , a4 , a5 ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 > <nl> NaggyMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> - const A5 & a5 , const A6 & a6 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 ) { } <nl> + const A5 & a5 , const A6 & a6 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 > <nl> NaggyMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , <nl> - a6 , a7 ) { } <nl> + a6 , a7 ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 , typename A8 > <nl> NaggyMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 , const A8 & a8 ) : MockClass ( a1 , <nl> - a2 , a3 , a4 , a5 , a6 , a7 , a8 ) { } <nl> + a2 , a3 , a4 , a5 , a6 , a7 , a8 ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 , typename A8 , typename A9 > <nl> NaggyMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 , const A8 & a8 , <nl> - const A9 & a9 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 ) { } <nl> + const A9 & a9 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 , typename A8 , typename A9 , typename A10 > <nl> NaggyMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 , const A8 & a8 , const A9 & a9 , <nl> - const A10 & a10 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 ) { } <nl> + const A10 & a10 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 ) { <nl> + : : testing : : Mock : : WarnUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> # endif / / GTEST_LANG_CXX11 <nl> <nl> + ~ NaggyMock ( ) { <nl> + : : testing : : Mock : : UnregisterCallReaction ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> + <nl> private : <nl> GTEST_DISALLOW_COPY_AND_ASSIGN_ ( NaggyMock ) ; <nl> } ; <nl> <nl> - namespace internal { <nl> - <nl> - template < typename MockClass > <nl> - NaggyMockBase < MockClass > : : NaggyMockBase ( ) { <nl> - : : testing : : Mock : : WarnUninterestingCalls ( <nl> - internal : : ImplicitCast_ < MockClass * > ( <nl> - static_cast < NaggyMock < MockClass > * > ( this ) ) ) ; <nl> - } <nl> - <nl> - template < typename MockClass > <nl> - NaggyMockBase < MockClass > : : ~ NaggyMockBase ( ) { <nl> - : : testing : : Mock : : UnregisterCallReaction ( <nl> - internal : : ImplicitCast_ < MockClass * > ( <nl> - static_cast < NaggyMock < MockClass > * > ( this ) ) ) ; <nl> - } <nl> - <nl> - } / / namespace internal <nl> - <nl> - namespace internal { <nl> - <nl> - / / StrictMockBase serves as a mix - in to establish the " uninteresting call " <nl> - / / behavior for StrictMock on construction . It accomplishes this via CRTP to get <nl> - / / access to the derived MockClass . <nl> template < class MockClass > <nl> - class StrictMockBase { <nl> - protected : <nl> - StrictMockBase ( ) ; <nl> - <nl> - ~ StrictMockBase ( ) ; <nl> - } ; <nl> - <nl> - } / / namespace internal <nl> - <nl> - template < class MockClass > <nl> - class StrictMock : public MockClass , <nl> - public internal : : StrictMockBase < MockClass > { <nl> + class StrictMock : public MockClass { <nl> public : <nl> - StrictMock ( ) : MockClass ( ) { } <nl> + StrictMock ( ) : MockClass ( ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> # if GTEST_LANG_CXX11 <nl> - / / Ideally , we would inherit base class ' s constructors through a using <nl> - / / declaration , which would preserve their visibility . However , many existing <nl> - / / tests rely on the fact that current implementation reexports protected <nl> - / / constructors as public . These tests would need to be cleaned up first . <nl> - <nl> / / Single argument constructor is special - cased so that it can be <nl> / / made explicit . <nl> template < typename A > <nl> - explicit StrictMock ( A & & arg ) : MockClass ( std : : forward < A > ( arg ) ) { } <nl> + explicit StrictMock ( A & & arg ) : MockClass ( std : : forward < A > ( arg ) ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename . . . An > <nl> StrictMock ( A1 & & arg1 , A2 & & arg2 , An & & . . . args ) <nl> : MockClass ( std : : forward < A1 > ( arg1 ) , std : : forward < A2 > ( arg2 ) , <nl> - std : : forward < An > ( args ) . . . ) { } <nl> + std : : forward < An > ( args ) . . . ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> # else <nl> / / C + + 98 doesn ' t have variadic templates , so we have to define one <nl> / / for each arity . <nl> template < typename A1 > <nl> - explicit StrictMock ( const A1 & a1 ) : MockClass ( a1 ) { } <nl> + explicit StrictMock ( const A1 & a1 ) : MockClass ( a1 ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> template < typename A1 , typename A2 > <nl> - StrictMock ( const A1 & a1 , const A2 & a2 ) : MockClass ( a1 , a2 ) { } <nl> + StrictMock ( const A1 & a1 , const A2 & a2 ) : MockClass ( a1 , a2 ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 > <nl> - StrictMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 ) : MockClass ( a1 , a2 , <nl> - a3 ) { } <nl> + StrictMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 ) : MockClass ( a1 , a2 , a3 ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 > <nl> StrictMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , <nl> - const A4 & a4 ) : MockClass ( a1 , a2 , a3 , a4 ) { } <nl> + const A4 & a4 ) : MockClass ( a1 , a2 , a3 , a4 ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 > <nl> StrictMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> - const A5 & a5 ) : MockClass ( a1 , a2 , a3 , a4 , a5 ) { } <nl> + const A5 & a5 ) : MockClass ( a1 , a2 , a3 , a4 , a5 ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 > <nl> StrictMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> - const A5 & a5 , const A6 & a6 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 ) { } <nl> + const A5 & a5 , const A6 & a6 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 > <nl> StrictMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , <nl> - a6 , a7 ) { } <nl> + a6 , a7 ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 , typename A8 > <nl> StrictMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 , const A8 & a8 ) : MockClass ( a1 , <nl> - a2 , a3 , a4 , a5 , a6 , a7 , a8 ) { } <nl> + a2 , a3 , a4 , a5 , a6 , a7 , a8 ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 , typename A8 , typename A9 > <nl> StrictMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 , const A8 & a8 , <nl> - const A9 & a9 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 ) { } <nl> + const A9 & a9 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , <nl> typename A6 , typename A7 , typename A8 , typename A9 , typename A10 > <nl> StrictMock ( const A1 & a1 , const A2 & a2 , const A3 & a3 , const A4 & a4 , <nl> const A5 & a5 , const A6 & a6 , const A7 & a7 , const A8 & a8 , const A9 & a9 , <nl> - const A10 & a10 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 ) { } <nl> + const A10 & a10 ) : MockClass ( a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 ) { <nl> + : : testing : : Mock : : FailUninterestingCalls ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> # endif / / GTEST_LANG_CXX11 <nl> <nl> + ~ StrictMock ( ) { <nl> + : : testing : : Mock : : UnregisterCallReaction ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> + <nl> private : <nl> GTEST_DISALLOW_COPY_AND_ASSIGN_ ( StrictMock ) ; <nl> } ; <nl> <nl> - namespace internal { <nl> - <nl> - template < typename MockClass > <nl> - StrictMockBase < MockClass > : : StrictMockBase ( ) { <nl> - : : testing : : Mock : : FailUninterestingCalls ( <nl> - internal : : ImplicitCast_ < MockClass * > ( <nl> - static_cast < StrictMock < MockClass > * > ( this ) ) ) ; <nl> - } <nl> - <nl> - template < typename MockClass > <nl> - StrictMockBase < MockClass > : : ~ StrictMockBase ( ) { <nl> - : : testing : : Mock : : UnregisterCallReaction ( <nl> - internal : : ImplicitCast_ < MockClass * > ( <nl> - static_cast < StrictMock < MockClass > * > ( this ) ) ) ; <nl> - } <nl> - <nl> - } / / namespace internal <nl> - <nl> / / The following specializations catch some ( relatively more common ) <nl> / / user errors of nesting nice and strict mocks . They do NOT catch <nl> / / all possible errors . <nl> mmm a / googlemock / include / gmock / gmock - generated - nice - strict . h . pump <nl> ppp b / googlemock / include / gmock / gmock - generated - nice - strict . h . pump <nl> $ var method = [ [ $ if kind = = 0 [ [ AllowUninterestingCalls ] ] <nl> $ elif kind = = 1 [ [ WarnUninterestingCalls ] ] <nl> $ else [ [ FailUninterestingCalls ] ] ] ] <nl> <nl> - namespace internal { <nl> - <nl> - / / $ clazz [ [ ] ] Base serves as a mix - in to establish the " uninteresting call " <nl> - / / behavior for $ clazz on construction . It accomplishes this via CRTP to get <nl> - / / access to the derived MockClass . <nl> template < class MockClass > <nl> - class $ clazz [ [ ] ] Base { <nl> - protected : <nl> - $ clazz [ [ ] ] Base ( ) ; <nl> - <nl> - ~ $ clazz [ [ ] ] Base ( ) ; <nl> - } ; <nl> - <nl> - } / / namespace internal <nl> - <nl> - template < class MockClass > <nl> - class $ clazz : public MockClass , public internal : : $ clazz [ [ ] ] Base < MockClass > { <nl> + class $ clazz : public MockClass { <nl> public : <nl> - $ clazz ( ) : MockClass ( ) { } <nl> + $ clazz ( ) : MockClass ( ) { <nl> + : : testing : : Mock : : $ method ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> # if GTEST_LANG_CXX11 <nl> - / / Ideally , we would inherit base class ' s constructors through a using <nl> - / / declaration , which would preserve their visibility . However , many existing <nl> - / / tests rely on the fact that current implementation reexports protected <nl> - / / constructors as public . These tests would need to be cleaned up first . <nl> - <nl> / / Single argument constructor is special - cased so that it can be <nl> / / made explicit . <nl> template < typename A > <nl> - explicit $ clazz ( A & & arg ) : MockClass ( std : : forward < A > ( arg ) ) { } <nl> + explicit $ clazz ( A & & arg ) : MockClass ( std : : forward < A > ( arg ) ) { <nl> + : : testing : : Mock : : $ method ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> template < typename A1 , typename A2 , typename . . . An > <nl> $ clazz ( A1 & & arg1 , A2 & & arg2 , An & & . . . args ) <nl> : MockClass ( std : : forward < A1 > ( arg1 ) , std : : forward < A2 > ( arg2 ) , <nl> - std : : forward < An > ( args ) . . . ) { } <nl> + std : : forward < An > ( args ) . . . ) { <nl> + : : testing : : Mock : : $ method ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> # else <nl> / / C + + 98 doesn ' t have variadic templates , so we have to define one <nl> / / for each arity . <nl> template < typename A1 > <nl> - explicit $ clazz ( const A1 & a1 ) : MockClass ( a1 ) { } <nl> + explicit $ clazz ( const A1 & a1 ) : MockClass ( a1 ) { <nl> + : : testing : : Mock : : $ method ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> $ range i 2 . . n <nl> $ for i [ [ <nl> $ range j 1 . . i <nl> template < $ for j , [ [ typename A $ j ] ] > <nl> - $ clazz ( $ for j , [ [ const A $ j & a $ j ] ] ) : MockClass ( $ for j , [ [ a $ j ] ] ) { } <nl> + $ clazz ( $ for j , [ [ const A $ j & a $ j ] ] ) : MockClass ( $ for j , [ [ a $ j ] ] ) { <nl> + : : testing : : Mock : : $ method ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> <nl> <nl> ] ] <nl> # endif / / GTEST_LANG_CXX11 <nl> <nl> + ~ $ clazz ( ) { <nl> + : : testing : : Mock : : UnregisterCallReaction ( <nl> + internal : : ImplicitCast_ < MockClass * > ( this ) ) ; <nl> + } <nl> + <nl> private : <nl> GTEST_DISALLOW_COPY_AND_ASSIGN_ ( $ clazz ) ; <nl> } ; <nl> <nl> - namespace internal { <nl> - <nl> - template < typename MockClass > <nl> - $ clazz [ [ ] ] Base < MockClass > : : $ clazz [ [ ] ] Base ( ) { <nl> - : : testing : : Mock : : $ method ( <nl> - internal : : ImplicitCast_ < MockClass * > ( <nl> - static_cast < $ clazz < MockClass > * > ( this ) ) ) ; <nl> - } <nl> - <nl> - template < typename MockClass > <nl> - $ clazz [ [ ] ] Base < MockClass > : : ~ $ clazz [ [ ] ] Base ( ) { <nl> - : : testing : : Mock : : UnregisterCallReaction ( <nl> - internal : : ImplicitCast_ < MockClass * > ( <nl> - static_cast < $ clazz < MockClass > * > ( this ) ) ) ; <nl> - } <nl> - <nl> - } / / namespace internal <nl> - <nl> ] ] <nl> <nl> / / The following specializations catch some ( relatively more common ) <nl> mmm a / googlemock / include / gmock / gmock - spec - builders . h <nl> ppp b / googlemock / include / gmock / gmock - spec - builders . h <nl> class ExpectationTester ; <nl> / / Base class for function mockers . <nl> template < typename F > class FunctionMockerBase ; <nl> <nl> - / / Uninteresting call behavior mixins . <nl> - template < typename M > class NiceMockBase ; <nl> - template < typename M > class NaggyMockBase ; <nl> - template < typename M > class StrictMockBase ; <nl> - <nl> / / Protects the mock object registry ( in class Mock ) , all function <nl> / / mockers , and all expectations . <nl> / / <nl> class GTEST_API_ Mock { <nl> friend class internal : : FunctionMockerBase ; <nl> <nl> template < typename M > <nl> - friend class internal : : NiceMockBase ; <nl> + friend class NiceMock ; <nl> <nl> template < typename M > <nl> - friend class internal : : NaggyMockBase ; <nl> + friend class NaggyMock ; <nl> <nl> template < typename M > <nl> - friend class internal : : StrictMockBase ; <nl> + friend class StrictMock ; <nl> <nl> / / Tells Google Mock to allow uninteresting calls on the given mock <nl> / / object . <nl> mmm a / googlemock / test / gmock - nice - strict_test . cc <nl> ppp b / googlemock / test / gmock - nice - strict_test . cc <nl> TEST ( NiceMockTest , NonDefaultConstructor10 ) { <nl> nice_bar . That ( 5 , true ) ; <nl> } <nl> <nl> + TEST ( NiceMockTest , AllowLeak ) { <nl> + NiceMock < MockFoo > * leaked = new NiceMock < MockFoo > ; <nl> + Mock : : AllowLeak ( leaked ) ; <nl> + EXPECT_CALL ( * leaked , DoThis ( ) ) ; <nl> + leaked - > DoThis ( ) ; <nl> + } <nl> + <nl> # if ! GTEST_OS_SYMBIAN & & ! GTEST_OS_WINDOWS_MOBILE <nl> / / Tests that NiceMock < Mock > compiles where Mock is a user - defined <nl> / / class ( as opposed to : : testing : : Mock ) . We had to work around an <nl> TEST ( NaggyMockTest , NonDefaultConstructor10 ) { <nl> naggy_bar . That ( 5 , true ) ; <nl> } <nl> <nl> + TEST ( NaggyMockTest , AllowLeak ) { <nl> + NaggyMock < MockFoo > * leaked = new NaggyMock < MockFoo > ; <nl> + Mock : : AllowLeak ( leaked ) ; <nl> + EXPECT_CALL ( * leaked , DoThis ( ) ) ; <nl> + leaked - > DoThis ( ) ; <nl> + } <nl> + <nl> # if ! GTEST_OS_SYMBIAN & & ! GTEST_OS_WINDOWS_MOBILE <nl> / / Tests that NaggyMock < Mock > compiles where Mock is a user - defined <nl> / / class ( as opposed to : : testing : : Mock ) . We had to work around an <nl> TEST ( StrictMockTest , NonDefaultConstructor10 ) { <nl> " Uninteresting mock function call " ) ; <nl> } <nl> <nl> + TEST ( StrictMockTest , AllowLeak ) { <nl> + StrictMock < MockFoo > * leaked = new StrictMock < MockFoo > ; <nl> + Mock : : AllowLeak ( leaked ) ; <nl> + EXPECT_CALL ( * leaked , DoThis ( ) ) ; <nl> + leaked - > DoThis ( ) ; <nl> + } <nl> + <nl> # if ! GTEST_OS_SYMBIAN & & ! GTEST_OS_WINDOWS_MOBILE <nl> / / Tests that StrictMock < Mock > compiles where Mock is a user - defined <nl> / / class ( as opposed to : : testing : : Mock ) . We had to work around an <nl>
|
Merge pull request from pwnall / gmock - fix - ub
|
google/googletest
|
b640d8743d85f5e69c16679e7ead3f31d94e31ff
|
2018-04-12T13:13:11Z
|
mmm a / Source / Math / CPUMatrix . cpp <nl> ppp b / Source / Math / CPUMatrix . cpp <nl> void CPUMatrix < ElemType > : : MaxPoolingBackward ( const CPUMatrix < ElemType > & out , con <nl> int i0 = mpRowIndices ( row , 0 ) ; <nl> int size = indices ( i0 + + , 0 ) ; <nl> assert ( size > 0 ) ; <nl> - ElemType g = ( * this ) ( row , sample ) ; <nl> ElemType m = out ( row , sample ) ; <nl> + ElemType count = 0 ; <nl> for ( int i = 0 ; i < size ; i + + ) <nl> { <nl> int dcol = indices ( i0 + i , 0 ) ; <nl> assert ( 0 < = colBase + dcol & & colBase + dcol < grad . GetNumRows ( ) ) ; <nl> if ( in ( colBase + dcol , sample ) > = m ) <nl> + count + = ElemType ( 1 ) ; <nl> + } <nl> + assert ( count > 0 ) ; <nl> + ElemType g = ( * this ) ( row , sample ) / count ; <nl> + for ( int i = 0 ; i < size ; i + + ) <nl> + { <nl> + const int dcol = indices ( i0 + i , 0 ) ; <nl> + if ( in ( colBase + dcol , sample ) > = m ) <nl> + # pragma omp atomic <nl> grad ( colBase + dcol , sample ) + = g ; <nl> } <nl> } <nl> void CPUMatrix < ElemType > : : MaxUnpooling ( const CPUMatrix < int > & mpRowCol , const CPU <nl> assert ( size > 0 ) ; <nl> <nl> ElemType curMax = poolInput ( colBase + indices ( i0 , 0 ) , sample ) ; <nl> - ElemType prevMax = curMax ; <nl> - int imax = 0 ; <nl> for ( int i = 1 ; i < size ; i + + ) <nl> { <nl> int dcol = indices ( i0 + i , 0 ) ; <nl> assert ( 0 < = colBase + dcol & & colBase + dcol < poolInput . GetNumRows ( ) ) ; <nl> curMax = std : : max ( curMax , poolInput ( colBase + dcol , sample ) ) ; <nl> - if ( curMax > prevMax ) <nl> - { <nl> - prevMax = curMax ; <nl> - imax = i ; <nl> - } <nl> } <nl> - <nl> - int dcol = indices ( i0 + imax , 0 ) ; <nl> - assert ( 0 < = colBase + dcol & & colBase + dcol < input . GetNumRows ( ) ) ; <nl> - input ( colBase + dcol , sample ) = ( * this ) ( row , sample ) ; <nl> - <nl> - / / int i = ( int ) poolIn ( row , sample ) ; <nl> - / / assert ( 0 < = i & & i < size ) ; <nl> - / / int dcol = indices ( i0 + i , 0 ) ; <nl> - / / assert ( 0 < = colBase + dcol & & colBase + dcol < input . GetNumRows ( ) ) ; <nl> - / / input ( colBase + dcol , sample ) = ( * this ) ( row , sample ) ; <nl> + for ( int i = 0 ; i < size ; i + + ) <nl> + { <nl> + int dcol = indices ( i0 + i , 0 ) ; <nl> + if ( poolInput ( colBase + dcol , sample ) > = curMax ) <nl> + input ( colBase + dcol , sample ) = ( * this ) ( row , sample ) ; / / this should have no issue if we are unpooling features . <nl> + / / if ( * this ) contains gradient , the unpooling operator with overlapped pooling is not clearly defined <nl> + } <nl> } <nl> } <nl> } <nl> void CPUMatrix < ElemType > : : AveragePoolingBackward ( const CPUMatrix < int > & mpRowCol , <nl> { <nl> int dcol = indices ( i0 + i , 0 ) ; <nl> assert ( 0 < = colBase + dcol & & colBase + dcol < grad . GetNumRows ( ) ) ; <nl> + # pragma omp atomic <nl> grad ( colBase + dcol , sample ) + = g ; <nl> } <nl> } <nl> mmm a / Source / Math / Convolution . cuh <nl> ppp b / Source / Math / Convolution . cuh <nl> __global__ void kMaxPoolingBackward ( int batchSize , const ElemType * out , const El <nl> int i0 = mpRowIndices [ row ] ; <nl> int size = indices [ i0 + + ] ; <nl> assert ( size > 0 ) ; <nl> - ElemType g = srcGrad [ row ] ; <nl> ElemType m = out [ row ] ; <nl> + ElemType count = 0 ; <nl> for ( int i = 0 ; i < size ; i + + ) <nl> { <nl> int dcol = indices [ i0 + i ] ; <nl> assert ( 0 < = colBase + dcol & & colBase + dcol < dstVecSize ) ; <nl> + if ( in [ colBase + dcol ] > = m ) <nl> + count + = ElemType ( 1 ) ; <nl> + } <nl> + ElemType g = srcGrad [ row ] / count ; <nl> + for ( int i = 0 ; i < size ; i + + ) <nl> + { <nl> + int dcol = indices [ i0 + i ] ; <nl> if ( in [ colBase + dcol ] > = m ) <nl> atomicAdd ( & grad [ colBase + dcol ] , g ) ; <nl> } <nl> __global__ void kMaxUnpooling ( int batchSize , const int * mpRowCol , const int * mpR <nl> int i0 = mpRowIndices [ row ] ; <nl> int size = indices [ i0 + + ] ; <nl> ElemType curMax = poolIn [ colBase + indices [ i0 ] ] ; <nl> - ElemType prevMax = curMax ; <nl> - int imax = 0 ; <nl> for ( int i = 1 ; i < size ; i + + ) <nl> { <nl> int dcol = indices [ i0 + i ] ; <nl> assert ( 0 < = colBase + dcol & & colBase + dcol < dstVecSize ) ; <nl> curMax = max ( curMax , poolIn [ colBase + dcol ] ) ; <nl> - if ( curMax > prevMax ) <nl> - { <nl> - prevMax = curMax ; <nl> - imax = i ; <nl> - } <nl> - <nl> } <nl> - <nl> - int dcol = indices [ i0 + imax ] ; <nl> - assert ( 0 < = colBase + dcol & & colBase + dcol < dstVecSize ) ; <nl> - <nl> - dst [ colBase + dcol ] = src [ row ] ; <nl> + for ( int i = 0 ; i < size ; i + + ) <nl> + { <nl> + int dcol = indices [ i0 + i ] ; <nl> + if ( poolIn [ colBase + dcol ] > = curMax ) <nl> + dst [ colBase + dcol ] = src [ row ] ; <nl> + } <nl> <nl> src + = blockIdx . y * srcVecSize ; <nl> poolIn + = blockIdx . y * dstVecSize ; <nl>
|
Bug fix for racing conditions in pooling , and handle multiple max values in max pooling and unpooling .
|
microsoft/CNTK
|
2db195e3f111c1a14ec0e4a7747069c8c06b9eff
|
2016-10-02T18:23:27Z
|
mmm a / src / core / security / security_connector . c <nl> ppp b / src / core / security / security_connector . c <nl> static const char * ssl_cipher_suites ( void ) { <nl> <nl> / * - - Common methods . - - * / <nl> <nl> + / * Returns the first property with that name . * / <nl> + static const tsi_peer_property * tsi_peer_get_property_by_name ( <nl> + const tsi_peer * peer , const char * name ) { <nl> + size_t i ; <nl> + if ( peer = = NULL ) return NULL ; <nl> + for ( i = 0 ; i < peer - > property_count ; i + + ) { <nl> + const tsi_peer_property * property = & peer - > properties [ i ] ; <nl> + if ( name = = NULL & & property - > name = = NULL ) { <nl> + return property ; <nl> + } <nl> + if ( name ! = NULL & & property - > name ! = NULL & & <nl> + strcmp ( property - > name , name ) = = 0 ) { <nl> + return property ; <nl> + } <nl> + } <nl> + return NULL ; <nl> + } <nl> + <nl> grpc_security_status grpc_security_connector_create_handshaker ( <nl> grpc_security_connector * sc , tsi_handshaker * * handshaker ) { <nl> if ( sc = = NULL | | handshaker = = NULL ) return GRPC_SECURITY_ERROR ; <nl> static grpc_security_status fake_check_peer ( grpc_security_connector * sc , <nl> status = GRPC_SECURITY_ERROR ; <nl> goto end ; <nl> } <nl> - if ( peer . properties [ 0 ] . type ! = TSI_PEER_PROPERTY_TYPE_STRING ) { <nl> - gpr_log ( GPR_ERROR , " Invalid type of cert type property . " ) ; <nl> - status = GRPC_SECURITY_ERROR ; <nl> - goto end ; <nl> - } <nl> - if ( strncmp ( peer . properties [ 0 ] . value . string . data , TSI_FAKE_CERTIFICATE_TYPE , <nl> - peer . properties [ 0 ] . value . string . length ) ) { <nl> + if ( strncmp ( peer . properties [ 0 ] . value . data , TSI_FAKE_CERTIFICATE_TYPE , <nl> + peer . properties [ 0 ] . value . length ) ) { <nl> gpr_log ( GPR_ERROR , " Invalid value for cert type property . " ) ; <nl> status = GRPC_SECURITY_ERROR ; <nl> goto end ; <nl> static grpc_security_status ssl_check_peer ( const char * peer_name , <nl> gpr_log ( GPR_ERROR , " Missing selected ALPN property . " ) ; <nl> return GRPC_SECURITY_ERROR ; <nl> } <nl> - if ( p - > type ! = TSI_PEER_PROPERTY_TYPE_STRING ) { <nl> - gpr_log ( GPR_ERROR , " Invalid selected ALPN property . " ) ; <nl> - return GRPC_SECURITY_ERROR ; <nl> - } <nl> - if ( ! grpc_chttp2_is_alpn_version_supported ( p - > value . string . data , <nl> - p - > value . string . length ) ) { <nl> + if ( ! grpc_chttp2_is_alpn_version_supported ( p - > value . data , p - > value . length ) ) { <nl> gpr_log ( GPR_ERROR , " Invalid ALPN value . " ) ; <nl> return GRPC_SECURITY_ERROR ; <nl> } <nl> mmm a / src / core / tsi / ssl_transport_security . c <nl> ppp b / src / core / tsi / ssl_transport_security . c <nl> static tsi_result peer_property_from_x509_common_name ( <nl> } <nl> <nl> / * Gets the subject SANs from an X509 cert as a tsi_peer_property . * / <nl> - static tsi_result peer_property_from_x509_subject_alt_names ( <nl> - X509 * cert , tsi_peer_property * property ) { <nl> - int i = 0 ; <nl> - int subject_alt_name_count = 0 ; <nl> + static tsi_result add_subject_alt_names_properties_to_peer ( <nl> + tsi_peer * peer , GENERAL_NAMES * subject_alt_names , <nl> + int subject_alt_name_count ) { <nl> + int i ; <nl> tsi_result result = TSI_OK ; <nl> - GENERAL_NAMES * subject_alt_names = <nl> - X509_get_ext_d2i ( cert , NID_subject_alt_name , 0 , 0 ) ; <nl> - if ( subject_alt_names = = NULL ) { <nl> - / * Empty list . * / <nl> - return tsi_construct_list_peer_property ( <nl> - TSI_X509_SUBJECT_ALTERNATIVE_NAMES_PEER_PROPERTY , 0 , property ) ; <nl> - } <nl> - <nl> - subject_alt_name_count = sk_GENERAL_NAME_num ( subject_alt_names ) ; <nl> - result = tsi_construct_list_peer_property ( <nl> - TSI_X509_SUBJECT_ALTERNATIVE_NAMES_PEER_PROPERTY , subject_alt_name_count , <nl> - property ) ; <nl> - if ( result ! = TSI_OK ) return result ; <nl> <nl> / * Reset for DNS entries filtering . * / <nl> - subject_alt_name_count = property - > value . list . child_count ; <nl> - property - > value . list . child_count = 0 ; <nl> + peer - > property_count - = subject_alt_name_count ; <nl> <nl> for ( i = 0 ; i < subject_alt_name_count ; i + + ) { <nl> - tsi_peer_property * child_property = NULL ; <nl> GENERAL_NAME * subject_alt_name = <nl> sk_GENERAL_NAME_value ( subject_alt_names , i ) ; <nl> / * Filter out the non - dns entries names . * / <nl> static tsi_result peer_property_from_x509_subject_alt_names ( <nl> result = TSI_INTERNAL_ERROR ; <nl> break ; <nl> } <nl> - child_property = <nl> - & property - > value . list . children [ property - > value . list . child_count + + ] ; <nl> result = tsi_construct_string_peer_property ( <nl> - NULL , ( const char * ) dns_name , dns_name_size , child_property ) ; <nl> + TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY , <nl> + ( const char * ) dns_name , dns_name_size , <nl> + & peer - > properties [ peer - > property_count + + ] ) ; <nl> OPENSSL_free ( dns_name ) ; <nl> if ( result ! = TSI_OK ) break ; <nl> } <nl> } <nl> - if ( result ! = TSI_OK ) tsi_peer_property_destruct ( property ) ; <nl> - sk_GENERAL_NAME_pop_free ( subject_alt_names , GENERAL_NAME_free ) ; <nl> - return TSI_OK ; <nl> + return result ; <nl> } <nl> <nl> / * Gets information about the peer ' s X509 cert as a tsi_peer object . * / <nl> static tsi_result peer_from_x509 ( X509 * cert , int include_certificate_type , <nl> tsi_peer * peer ) { <nl> / * TODO ( jboeuf ) : Maybe add more properties . * / <nl> - size_t property_count = include_certificate_type ? 3 : 2 ; <nl> + GENERAL_NAMES * subject_alt_names = <nl> + X509_get_ext_d2i ( cert , NID_subject_alt_name , 0 , 0 ) ; <nl> + int subject_alt_name_count = <nl> + ( subject_alt_names ! = NULL ) ? sk_GENERAL_NAME_num ( subject_alt_names ) : 0 ; <nl> + size_t property_count = ( include_certificate_type ? 1 : 0 ) + <nl> + 1 / * common name * / + subject_alt_name_count ; <nl> tsi_result result = tsi_construct_peer ( property_count , peer ) ; <nl> if ( result ! = TSI_OK ) return result ; <nl> do { <nl> - result = peer_property_from_x509_common_name ( cert , & peer - > properties [ 0 ] ) ; <nl> - if ( result ! = TSI_OK ) break ; <nl> - result = <nl> - peer_property_from_x509_subject_alt_names ( cert , & peer - > properties [ 1 ] ) ; <nl> - if ( result ! = TSI_OK ) break ; <nl> if ( include_certificate_type ) { <nl> result = tsi_construct_string_peer_property_from_cstring ( <nl> TSI_CERTIFICATE_TYPE_PEER_PROPERTY , TSI_X509_CERTIFICATE_TYPE , <nl> - & peer - > properties [ 2 ] ) ; <nl> + & peer - > properties [ 0 ] ) ; <nl> + if ( result ! = TSI_OK ) break ; <nl> + } <nl> + result = peer_property_from_x509_common_name ( <nl> + cert , & peer - > properties [ include_certificate_type ? 1 : 0 ] ) ; <nl> + if ( result ! = TSI_OK ) break ; <nl> + <nl> + if ( subject_alt_name_count ! = 0 ) { <nl> + result = add_subject_alt_names_properties_to_peer ( peer , subject_alt_names , <nl> + subject_alt_name_count ) ; <nl> if ( result ! = TSI_OK ) break ; <nl> } <nl> } while ( 0 ) ; <nl> <nl> + if ( subject_alt_names ! = NULL ) { <nl> + sk_GENERAL_NAME_pop_free ( subject_alt_names , GENERAL_NAME_free ) ; <nl> + } <nl> if ( result ! = TSI_OK ) tsi_peer_destruct ( peer ) ; <nl> return result ; <nl> } <nl> tsi_result tsi_create_ssl_server_handshaker_factory ( <nl> int tsi_ssl_peer_matches_name ( const tsi_peer * peer , const char * name ) { <nl> size_t i = 0 ; <nl> size_t san_count = 0 ; <nl> - const tsi_peer_property * property = NULL ; <nl> + const tsi_peer_property * cn_property = NULL ; <nl> <nl> / * For now reject what looks like an IP address . * / <nl> if ( looks_like_ip_address ( name ) ) return 0 ; <nl> <nl> / * Check the SAN first . * / <nl> - property = tsi_peer_get_property_by_name ( <nl> - peer , TSI_X509_SUBJECT_ALTERNATIVE_NAMES_PEER_PROPERTY ) ; <nl> - if ( property = = NULL | | property - > type ! = TSI_PEER_PROPERTY_TYPE_LIST ) { <nl> - gpr_log ( GPR_ERROR , " Invalid x509 subject alternative names property . " ) ; <nl> - return 0 ; <nl> - } <nl> - <nl> - san_count = property - > value . list . child_count ; <nl> - for ( i = 0 ; i < san_count ; i + + ) { <nl> - const tsi_peer_property * alt_name_property = <nl> - & property - > value . list . children [ i ] ; <nl> - if ( alt_name_property - > type ! = TSI_PEER_PROPERTY_TYPE_STRING ) { <nl> - gpr_log ( GPR_ERROR , " Invalid x509 subject alternative name property . " ) ; <nl> - return 0 ; <nl> - } <nl> - if ( does_entry_match_name ( alt_name_property - > value . string . data , <nl> - alt_name_property - > value . string . length , name ) ) { <nl> - return 1 ; <nl> + for ( i = 0 ; i < peer - > property_count ; i + + ) { <nl> + const tsi_peer_property * property = & peer - > properties [ i ] ; <nl> + if ( property - > name = = NULL ) continue ; <nl> + if ( strcmp ( property - > name , <nl> + TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY ) = = 0 ) { <nl> + san_count + + ; <nl> + if ( does_entry_match_name ( property - > value . data , property - > value . length , <nl> + name ) ) { <nl> + return 1 ; <nl> + } <nl> + } else if ( strcmp ( property - > name , <nl> + TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY ) = = 0 ) { <nl> + cn_property = property ; <nl> } <nl> } <nl> <nl> / * If there ' s no SAN , try the CN . * / <nl> - if ( san_count = = 0 ) { <nl> - property = tsi_peer_get_property_by_name ( <nl> - peer , TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY ) ; <nl> - if ( property = = NULL | | property - > type ! = TSI_PEER_PROPERTY_TYPE_STRING ) { <nl> - gpr_log ( GPR_ERROR , " Invalid x509 subject common name property . " ) ; <nl> - return 0 ; <nl> - } <nl> - if ( does_entry_match_name ( property - > value . string . data , <nl> - property - > value . string . length , name ) ) { <nl> + if ( san_count = = 0 & & cn_property ! = NULL ) { <nl> + if ( does_entry_match_name ( cn_property - > value . data , <nl> + cn_property - > value . length , name ) ) { <nl> return 1 ; <nl> } <nl> } <nl> mmm a / src / core / tsi / ssl_transport_security . h <nl> ppp b / src / core / tsi / ssl_transport_security . h <nl> extern " C " { <nl> <nl> / * This property is of type TSI_PEER_PROPERTY_STRING . * / <nl> # define TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY " x509_subject_common_name " <nl> + # define TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY \ <nl> + " x509_subject_alternative_name " <nl> <nl> - / * This property is of type TSI_PEER_PROPERTY_LIST and the children contain <nl> - unnamed ( name = = NULL ) properties of type TSI_PEER_PROPERTY_STRING . * / <nl> - # define TSI_X509_SUBJECT_ALTERNATIVE_NAMES_PEER_PROPERTY \ <nl> - " x509_subject_alternative_names " <nl> - <nl> - / * This property is of type TSI_PEER_PROPERTY_STRING . * / <nl> # define TSI_SSL_ALPN_SELECTED_PROTOCOL " ssl_alpn_selected_protocol " <nl> <nl> / * mmm tsi_ssl_handshaker_factory object mmm <nl> mmm a / src / core / tsi / transport_security . c <nl> ppp b / src / core / tsi / transport_security . c <nl> void tsi_handshaker_destroy ( tsi_handshaker * self ) { <nl> <nl> / * mmm tsi_peer implementation . mmm * / <nl> <nl> - const tsi_peer_property * tsi_peer_get_property_by_name ( const tsi_peer * self , <nl> - const char * name ) { <nl> - size_t i ; <nl> - if ( self = = NULL ) return NULL ; <nl> - for ( i = 0 ; i < self - > property_count ; i + + ) { <nl> - const tsi_peer_property * property = & self - > properties [ i ] ; <nl> - if ( name = = NULL & & property - > name = = NULL ) { <nl> - return property ; <nl> - } <nl> - if ( name ! = NULL & & property - > name ! = NULL & & <nl> - strcmp ( property - > name , name ) = = 0 ) { <nl> - return property ; <nl> - } <nl> - } <nl> - return NULL ; <nl> - } <nl> - <nl> tsi_peer_property tsi_init_peer_property ( void ) { <nl> tsi_peer_property property ; <nl> memset ( & property , 0 , sizeof ( tsi_peer_property ) ) ; <nl> void tsi_peer_property_destruct ( tsi_peer_property * property ) { <nl> if ( property - > name ! = NULL ) { <nl> free ( property - > name ) ; <nl> } <nl> - switch ( property - > type ) { <nl> - case TSI_PEER_PROPERTY_TYPE_STRING : <nl> - if ( property - > value . string . data ! = NULL ) { <nl> - free ( property - > value . string . data ) ; <nl> - } <nl> - break ; <nl> - case TSI_PEER_PROPERTY_TYPE_LIST : <nl> - tsi_peer_destroy_list_property ( property - > value . list . children , <nl> - property - > value . list . child_count ) ; <nl> - default : <nl> - / * Nothing to free . * / <nl> - break ; <nl> + if ( property - > value . data ! = NULL ) { <nl> + free ( property - > value . data ) ; <nl> } <nl> * property = tsi_init_peer_property ( ) ; / * Reset everything to 0 . * / <nl> } <nl> void tsi_peer_destruct ( tsi_peer * self ) { <nl> self - > property_count = 0 ; <nl> } <nl> <nl> - tsi_result tsi_construct_signed_integer_peer_property ( <nl> - const char * name , int64_t value , tsi_peer_property * property ) { <nl> - * property = tsi_init_peer_property ( ) ; <nl> - property - > type = TSI_PEER_PROPERTY_TYPE_SIGNED_INTEGER ; <nl> - if ( name ! = NULL ) { <nl> - property - > name = tsi_strdup ( name ) ; <nl> - if ( property - > name = = NULL ) return TSI_OUT_OF_RESOURCES ; <nl> - } <nl> - property - > value . signed_int = value ; <nl> - return TSI_OK ; <nl> - } <nl> - <nl> - tsi_result tsi_construct_unsigned_integer_peer_property ( <nl> - const char * name , uint64_t value , tsi_peer_property * property ) { <nl> - * property = tsi_init_peer_property ( ) ; <nl> - property - > type = TSI_PEER_PROPERTY_TYPE_UNSIGNED_INTEGER ; <nl> - if ( name ! = NULL ) { <nl> - property - > name = tsi_strdup ( name ) ; <nl> - if ( property - > name = = NULL ) return TSI_OUT_OF_RESOURCES ; <nl> - } <nl> - property - > value . unsigned_int = value ; <nl> - return TSI_OK ; <nl> - } <nl> - <nl> - tsi_result tsi_construct_real_peer_property ( const char * name , double value , <nl> - tsi_peer_property * property ) { <nl> - * property = tsi_init_peer_property ( ) ; <nl> - property - > type = TSI_PEER_PROPERTY_TYPE_REAL ; <nl> - if ( name ! = NULL ) { <nl> - property - > name = tsi_strdup ( name ) ; <nl> - if ( property - > name = = NULL ) return TSI_OUT_OF_RESOURCES ; <nl> - } <nl> - property - > value . real = value ; <nl> - return TSI_OK ; <nl> - } <nl> - <nl> tsi_result tsi_construct_allocated_string_peer_property ( <nl> const char * name , size_t value_length , tsi_peer_property * property ) { <nl> * property = tsi_init_peer_property ( ) ; <nl> - property - > type = TSI_PEER_PROPERTY_TYPE_STRING ; <nl> if ( name ! = NULL ) { <nl> property - > name = tsi_strdup ( name ) ; <nl> if ( property - > name = = NULL ) return TSI_OUT_OF_RESOURCES ; <nl> } <nl> if ( value_length > 0 ) { <nl> - property - > value . string . data = calloc ( 1 , value_length ) ; <nl> - if ( property - > value . string . data = = NULL ) { <nl> + property - > value . data = calloc ( 1 , value_length ) ; <nl> + if ( property - > value . data = = NULL ) { <nl> tsi_peer_property_destruct ( property ) ; <nl> return TSI_OUT_OF_RESOURCES ; <nl> } <nl> - property - > value . string . length = value_length ; <nl> + property - > value . length = value_length ; <nl> } <nl> return TSI_OK ; <nl> } <nl> tsi_result tsi_construct_string_peer_property ( const char * name , <nl> name , value_length , property ) ; <nl> if ( result ! = TSI_OK ) return result ; <nl> if ( value_length > 0 ) { <nl> - memcpy ( property - > value . string . data , value , value_length ) ; <nl> - } <nl> - return TSI_OK ; <nl> - } <nl> - <nl> - tsi_result tsi_construct_list_peer_property ( const char * name , <nl> - size_t child_count , <nl> - tsi_peer_property * property ) { <nl> - * property = tsi_init_peer_property ( ) ; <nl> - property - > type = TSI_PEER_PROPERTY_TYPE_LIST ; <nl> - if ( name ! = NULL ) { <nl> - property - > name = tsi_strdup ( name ) ; <nl> - if ( property - > name = = NULL ) return TSI_OUT_OF_RESOURCES ; <nl> - } <nl> - if ( child_count > 0 ) { <nl> - property - > value . list . children = <nl> - calloc ( child_count , sizeof ( tsi_peer_property ) ) ; <nl> - if ( property - > value . list . children = = NULL ) { <nl> - tsi_peer_property_destruct ( property ) ; <nl> - return TSI_OUT_OF_RESOURCES ; <nl> - } <nl> - property - > value . list . child_count = child_count ; <nl> + memcpy ( property - > value . data , value , value_length ) ; <nl> } <nl> return TSI_OK ; <nl> } <nl> mmm a / src / core / tsi / transport_security . h <nl> ppp b / src / core / tsi / transport_security . h <nl> struct tsi_handshaker { <nl> tsi_result tsi_construct_peer ( size_t property_count , tsi_peer * peer ) ; <nl> tsi_peer_property tsi_init_peer_property ( void ) ; <nl> void tsi_peer_property_destruct ( tsi_peer_property * property ) ; <nl> - tsi_result tsi_construct_signed_integer_peer_property ( <nl> - const char * name , int64_t value , tsi_peer_property * property ) ; <nl> - tsi_result tsi_construct_unsigned_integer_peer_property ( <nl> - const char * name , uint64_t value , tsi_peer_property * property ) ; <nl> - tsi_result tsi_construct_real_peer_property ( const char * name , double value , <nl> - tsi_peer_property * property ) ; <nl> tsi_result tsi_construct_string_peer_property ( const char * name , <nl> const char * value , <nl> size_t value_length , <nl> tsi_result tsi_construct_allocated_string_peer_property ( <nl> const char * name , size_t value_length , tsi_peer_property * property ) ; <nl> tsi_result tsi_construct_string_peer_property_from_cstring ( <nl> const char * name , const char * value , tsi_peer_property * property ) ; <nl> - tsi_result tsi_construct_list_peer_property ( const char * name , <nl> - size_t child_count , <nl> - tsi_peer_property * property ) ; <nl> <nl> / * Utils . * / <nl> char * tsi_strdup ( const char * src ) ; / * Sadly , no strdup in C89 . * / <nl> mmm a / src / core / tsi / transport_security_interface . h <nl> ppp b / src / core / tsi / transport_security_interface . h <nl> void tsi_frame_protector_destroy ( tsi_frame_protector * self ) ; <nl> / * This property is of type TSI_PEER_PROPERTY_STRING . * / <nl> # define TSI_CERTIFICATE_TYPE_PEER_PROPERTY " certificate_type " <nl> <nl> - / * Properties of type TSI_PEER_PROPERTY_TYPE_STRING may contain NULL characters <nl> - just like C + + strings . The length field gives the length of the string . * / <nl> - typedef enum { <nl> - TSI_PEER_PROPERTY_TYPE_SIGNED_INTEGER , <nl> - TSI_PEER_PROPERTY_TYPE_UNSIGNED_INTEGER , <nl> - TSI_PEER_PROPERTY_TYPE_REAL , <nl> - TSI_PEER_PROPERTY_TYPE_STRING , <nl> - TSI_PEER_PROPERTY_TYPE_LIST <nl> - } tsi_peer_property_type ; <nl> - <nl> - / * The relevant field in the union value is dictated by the type field . <nl> - name may be NULL in case of an unnamed property . * / <nl> + / * Property values may contain NULL characters just like C + + strings . <nl> + The length field gives the length of the string . * / <nl> typedef struct tsi_peer_property { <nl> char * name ; <nl> - tsi_peer_property_type type ; <nl> - union { <nl> - int64_t signed_int ; <nl> - uint64_t unsigned_int ; <nl> - double real ; <nl> - struct { <nl> - char * data ; <nl> - size_t length ; <nl> - } string ; <nl> - struct { <nl> - struct tsi_peer_property * children ; <nl> - size_t child_count ; <nl> - } list ; <nl> + struct { <nl> + char * data ; <nl> + size_t length ; <nl> } value ; <nl> } tsi_peer_property ; <nl> <nl> typedef struct { <nl> size_t property_count ; <nl> } tsi_peer ; <nl> <nl> - / * Gets the first property with the specified name . Iteration over the <nl> - properties of the peer should be used if the client of the API is expecting <nl> - several properties with the same name . <nl> - Returns NULL if there is no corresponding property . * / <nl> - const tsi_peer_property * tsi_peer_get_property_by_name ( const tsi_peer * self , <nl> - const char * name ) ; <nl> - <nl> / * Destructs the tsi_peer object . * / <nl> void tsi_peer_destruct ( tsi_peer * self ) ; <nl> <nl> mmm a / test / core / tsi / transport_security_test . c <nl> ppp b / test / core / tsi / transport_security_test . c <nl> static tsi_peer peer_from_cert_name_test_entry ( <nl> name_list * nl ; <nl> parsed_dns_names dns_entries = parse_dns_names ( entry - > dns_names ) ; <nl> nl = dns_entries . names ; <nl> - GPR_ASSERT ( tsi_construct_peer ( 2 , & peer ) = = TSI_OK ) ; <nl> + GPR_ASSERT ( tsi_construct_peer ( 1 + dns_entries . name_count , & peer ) = = TSI_OK ) ; <nl> GPR_ASSERT ( tsi_construct_string_peer_property_from_cstring ( <nl> TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY , entry - > common_name , <nl> & peer . properties [ 0 ] ) = = TSI_OK ) ; <nl> - GPR_ASSERT ( tsi_construct_list_peer_property ( <nl> - TSI_X509_SUBJECT_ALTERNATIVE_NAMES_PEER_PROPERTY , <nl> - dns_entries . name_count , & peer . properties [ 1 ] ) = = TSI_OK ) ; <nl> - i = 0 ; <nl> + i = 1 ; <nl> while ( nl ! = NULL ) { <nl> char * processed = processed_dns_name ( nl - > name ) ; <nl> GPR_ASSERT ( tsi_construct_string_peer_property ( <nl> - NULL , processed , strlen ( nl - > name ) , <nl> - & peer . properties [ 1 ] . value . list . children [ i + + ] ) = = TSI_OK ) ; <nl> + TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY , processed , <nl> + strlen ( nl - > name ) , & peer . properties [ i + + ] ) = = TSI_OK ) ; <nl> nl = nl - > next ; <nl> gpr_free ( processed ) ; <nl> } <nl>
|
Merge pull request from jboeuf / tsi_properties_cleanup
|
grpc/grpc
|
6202f7da90a24bc992112061a128ca25faa9ecb0
|
2015-05-14T21:17:53Z
|
mmm a / editor / animation_track_editor . cpp <nl> ppp b / editor / animation_track_editor . cpp <nl> class AnimationTrackKeyEdit : public Object { <nl> } <nl> <nl> void _update_obj ( const Ref < Animation > & p_anim ) { <nl> - if ( setting ) <nl> - return ; <nl> - if ( ! ( animation = = p_anim ) ) <nl> + <nl> + if ( setting | | animation ! = p_anim ) <nl> return ; <nl> <nl> notify_change ( ) ; <nl> } <nl> <nl> void _key_ofs_changed ( const Ref < Animation > & p_anim , float from , float to ) { <nl> - if ( ! ( animation = = p_anim ) ) <nl> - return ; <nl> - if ( from ! = key_ofs ) <nl> + <nl> + if ( animation ! = p_anim | | from ! = key_ofs ) <nl> return ; <nl> + <nl> key_ofs = to ; <nl> + <nl> if ( setting ) <nl> return ; <nl> + <nl> notify_change ( ) ; <nl> } <nl> <nl> class AnimationTrackKeyEdit : public Object { <nl> } <nl> new_time / = fps ; <nl> } <nl> + <nl> if ( new_time = = key_ofs ) <nl> return true ; <nl> <nl> class AnimationTrackKeyEdit : public Object { <nl> trans = animation - > track_get_key_transition ( track , existing ) ; <nl> undo_redo - > add_undo_method ( animation . ptr ( ) , " track_insert_key " , track , new_time , v , trans ) ; <nl> } <nl> - <nl> undo_redo - > commit_action ( ) ; <nl> - setting = false ; <nl> <nl> + setting = false ; <nl> return true ; <nl> - } else if ( name = = " easing " ) { <nl> + } <nl> + <nl> + if ( name = = " easing " ) { <nl> <nl> float val = p_value ; <nl> float prev_val = animation - > track_get_key_transition ( track , key ) ; <nl> class AnimationTrackKeyEdit : public Object { <nl> undo_redo - > add_do_method ( this , " _update_obj " , animation ) ; <nl> undo_redo - > add_undo_method ( this , " _update_obj " , animation ) ; <nl> undo_redo - > commit_action ( ) ; <nl> + <nl> setting = false ; <nl> return true ; <nl> } <nl> class AnimationTrackKeyEdit : public Object { <nl> <nl> setting = false ; <nl> return true ; <nl> - <nl> } break ; <nl> case Animation : : TYPE_VALUE : { <nl> <nl> class AnimationTrackKeyEdit : public Object { <nl> Variant value = p_value ; <nl> <nl> if ( value . get_type ( ) = = Variant : : NODE_PATH ) { <nl> - <nl> _fix_node_path ( value ) ; <nl> } <nl> <nl> class AnimationTrackKeyEdit : public Object { <nl> setting = false ; <nl> return true ; <nl> } <nl> - <nl> } break ; <nl> case Animation : : TYPE_METHOD : { <nl> <nl> class AnimationTrackKeyEdit : public Object { <nl> if ( name = = " name " ) { <nl> <nl> d_new [ " method " ] = p_value ; <nl> - } <nl> - <nl> - if ( name = = " arg_count " ) { <nl> + } else if ( name = = " arg_count " ) { <nl> <nl> Vector < Variant > args = d_old [ " args " ] ; <nl> args . resize ( p_value ) ; <nl> d_new [ " args " ] = args ; <nl> change_notify_deserved = true ; <nl> - } <nl> - <nl> - if ( name . begins_with ( " args / " ) ) { <nl> + } else if ( name . begins_with ( " args / " ) ) { <nl> <nl> Vector < Variant > args = d_old [ " args " ] ; <nl> int idx = name . get_slice ( " / " , 1 ) . to_int ( ) ; <nl> class AnimationTrackKeyEdit : public Object { <nl> change_notify_deserved = true ; <nl> d_new [ " args " ] = args ; <nl> } <nl> - } <nl> - if ( what = = " value " ) { <nl> + } else if ( what = = " value " ) { <nl> <nl> Variant value = p_value ; <nl> if ( value . get_type ( ) = = Variant : : NODE_PATH ) { <nl> class AnimationTrackKeyEdit : public Object { <nl> setting = false ; <nl> return true ; <nl> } <nl> + <nl> if ( name = = " in_handle " ) { <nl> <nl> const Variant & value = p_value ; <nl> class AnimationTrackKeyEdit : public Object { <nl> setting = false ; <nl> return true ; <nl> } <nl> + <nl> if ( name = = " out_handle " ) { <nl> <nl> const Variant & value = p_value ; <nl> class AnimationTrackKeyEdit : public Object { <nl> setting = false ; <nl> return true ; <nl> } <nl> - <nl> } break ; <nl> case Animation : : TYPE_AUDIO : { <nl> <nl> class AnimationTrackKeyEdit : public Object { <nl> setting = false ; <nl> return true ; <nl> } <nl> + <nl> if ( name = = " start_offset " ) { <nl> <nl> float value = p_value ; <nl> class AnimationTrackKeyEdit : public Object { <nl> setting = false ; <nl> return true ; <nl> } <nl> + <nl> if ( name = = " end_offset " ) { <nl> <nl> float value = p_value ; <nl> class AnimationTrackKeyEdit : public Object { <nl> setting = false ; <nl> return true ; <nl> } <nl> - <nl> } break ; <nl> case Animation : : TYPE_ANIMATION : { <nl> <nl> class AnimationTrackKeyEdit : public Object { <nl> undo_redo - > add_do_method ( this , " _update_obj " , animation ) ; <nl> undo_redo - > add_undo_method ( this , " _update_obj " , animation ) ; <nl> undo_redo - > commit_action ( ) ; <nl> + <nl> setting = false ; <nl> return true ; <nl> } <nl> - <nl> } break ; <nl> } <nl> <nl> class AnimationTrackKeyEdit : public Object { <nl> if ( name = = " time " ) { <nl> r_ret = key_ofs ; <nl> return true ; <nl> - } else if ( name = = " frame " ) { <nl> + } <nl> + <nl> + if ( name = = " frame " ) { <nl> + <nl> float fps = animation - > get_step ( ) ; <nl> if ( fps > 0 ) { <nl> fps = 1 . 0 / fps ; <nl> } <nl> r_ret = key_ofs * fps ; <nl> return true ; <nl> - } else if ( name = = " easing " ) { <nl> + } <nl> + <nl> + if ( name = = " easing " ) { <nl> r_ret = animation - > track_get_key_transition ( track , key ) ; <nl> return true ; <nl> } <nl> <nl> switch ( animation - > track_get_type ( track ) ) { <nl> - <nl> case Animation : : TYPE_TRANSFORM : { <nl> <nl> Dictionary d = animation - > track_get_key_value ( track , key ) ; <nl> class AnimationTrackKeyEdit : public Object { <nl> Vector < Variant > args = d [ " args " ] ; <nl> <nl> if ( name = = " arg_count " ) { <nl> - <nl> r_ret = args . size ( ) ; <nl> return true ; <nl> } <nl> class AnimationTrackKeyEdit : public Object { <nl> r_ret = args [ idx ] . get_type ( ) ; <nl> return true ; <nl> } <nl> + <nl> if ( what = = " value " ) { <nl> r_ret = args [ idx ] ; <nl> return true ; <nl> class AnimationTrackKeyEdit : public Object { <nl> r_ret = animation - > bezier_track_get_key_value ( track , key ) ; <nl> return true ; <nl> } <nl> + <nl> if ( name = = " in_handle " ) { <nl> r_ret = animation - > bezier_track_get_key_in_handle ( track , key ) ; <nl> return true ; <nl> } <nl> + <nl> if ( name = = " out_handle " ) { <nl> r_ret = animation - > bezier_track_get_key_out_handle ( track , key ) ; <nl> return true ; <nl> class AnimationTrackKeyEdit : public Object { <nl> r_ret = animation - > audio_track_get_key_stream ( track , key ) ; <nl> return true ; <nl> } <nl> + <nl> if ( name = = " start_offset " ) { <nl> r_ret = animation - > audio_track_get_key_start_offset ( track , key ) ; <nl> return true ; <nl> } <nl> + <nl> if ( name = = " end_offset " ) { <nl> r_ret = animation - > audio_track_get_key_end_offset ( track , key ) ; <nl> return true ; <nl> class AnimationTrackKeyEdit : public Object { <nl> } <nl> } ; <nl> <nl> + class AnimationMultiTrackKeyEdit : public Object { <nl> + <nl> + GDCLASS ( AnimationMultiTrackKeyEdit , Object ) ; <nl> + <nl> + public : <nl> + bool setting ; <nl> + <nl> + bool _hide_script_from_inspector ( ) { <nl> + return true ; <nl> + } <nl> + <nl> + bool _dont_undo_redo ( ) { <nl> + return true ; <nl> + } <nl> + <nl> + static void _bind_methods ( ) { <nl> + <nl> + ClassDB : : bind_method ( " _update_obj " , & AnimationMultiTrackKeyEdit : : _update_obj ) ; <nl> + ClassDB : : bind_method ( " _key_ofs_changed " , & AnimationMultiTrackKeyEdit : : _key_ofs_changed ) ; <nl> + ClassDB : : bind_method ( " _hide_script_from_inspector " , & AnimationMultiTrackKeyEdit : : _hide_script_from_inspector ) ; <nl> + ClassDB : : bind_method ( " get_root_path " , & AnimationMultiTrackKeyEdit : : get_root_path ) ; <nl> + ClassDB : : bind_method ( " _dont_undo_redo " , & AnimationMultiTrackKeyEdit : : _dont_undo_redo ) ; <nl> + } <nl> + <nl> + void _fix_node_path ( Variant & value , NodePath & base ) { <nl> + <nl> + NodePath np = value ; <nl> + <nl> + if ( np = = NodePath ( ) ) <nl> + return ; <nl> + <nl> + Node * root = EditorNode : : get_singleton ( ) - > get_tree ( ) - > get_root ( ) ; <nl> + <nl> + Node * np_node = root - > get_node ( np ) ; <nl> + ERR_FAIL_COND ( ! np_node ) ; <nl> + <nl> + Node * edited_node = root - > get_node ( base ) ; <nl> + ERR_FAIL_COND ( ! edited_node ) ; <nl> + <nl> + value = edited_node - > get_path_to ( np_node ) ; <nl> + } <nl> + <nl> + void _update_obj ( const Ref < Animation > & p_anim ) { <nl> + <nl> + if ( setting | | animation ! = p_anim ) <nl> + return ; <nl> + <nl> + notify_change ( ) ; <nl> + } <nl> + <nl> + void _key_ofs_changed ( const Ref < Animation > & p_anim , float from , float to ) { <nl> + <nl> + if ( animation ! = p_anim ) <nl> + return ; <nl> + <nl> + for ( Map < int , List < float > > : : Element * E = key_ofs_map . front ( ) ; E ; E = E - > next ( ) ) { <nl> + <nl> + for ( List < float > : : Element * F = E - > value ( ) . front ( ) ; F ; F = F - > next ( ) ) { <nl> + <nl> + float key_ofs = F - > get ( ) ; <nl> + if ( from ! = key_ofs ) <nl> + continue ; <nl> + <nl> + int track = E - > key ( ) ; <nl> + key_ofs_map [ track ] [ key_ofs ] = to ; <nl> + <nl> + if ( setting ) <nl> + return ; <nl> + <nl> + notify_change ( ) ; <nl> + <nl> + return ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + bool _set ( const StringName & p_name , const Variant & p_value ) { <nl> + <nl> + bool update_obj = false ; <nl> + bool change_notify_deserved = false ; <nl> + for ( Map < int , List < float > > : : Element * E = key_ofs_map . front ( ) ; E ; E = E - > next ( ) ) { <nl> + <nl> + int track = E - > key ( ) ; <nl> + for ( List < float > : : Element * F = E - > value ( ) . front ( ) ; F ; F = F - > next ( ) ) { <nl> + <nl> + float key_ofs = F - > get ( ) ; <nl> + int key = animation - > track_find_key ( track , key_ofs , true ) ; <nl> + ERR_FAIL_COND_V ( key = = - 1 , false ) ; <nl> + <nl> + String name = p_name ; <nl> + if ( name = = " time " | | name = = " frame " ) { <nl> + <nl> + float new_time = p_value ; <nl> + <nl> + if ( name = = " frame " ) { <nl> + float fps = animation - > get_step ( ) ; <nl> + if ( fps > 0 ) { <nl> + fps = 1 . 0 / fps ; <nl> + } <nl> + new_time / = fps ; <nl> + } <nl> + <nl> + int existing = animation - > track_find_key ( track , new_time , true ) ; <nl> + <nl> + if ( ! setting ) { <nl> + setting = true ; <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Keyframe Time " ) , UndoRedo : : MERGE_ENDS ) ; <nl> + } <nl> + <nl> + Variant val = animation - > track_get_key_value ( track , key ) ; <nl> + float trans = animation - > track_get_key_transition ( track , key ) ; <nl> + <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " track_remove_key " , track , key ) ; <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " track_insert_key " , track , new_time , val , trans ) ; <nl> + undo_redo - > add_do_method ( this , " _key_ofs_changed " , animation , key_ofs , new_time ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " track_remove_key_at_position " , track , new_time ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " track_insert_key " , track , key_ofs , val , trans ) ; <nl> + undo_redo - > add_undo_method ( this , " _key_ofs_changed " , animation , new_time , key_ofs ) ; <nl> + <nl> + if ( existing ! = - 1 ) { <nl> + Variant v = animation - > track_get_key_value ( track , existing ) ; <nl> + trans = animation - > track_get_key_transition ( track , existing ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " track_insert_key " , track , new_time , v , trans ) ; <nl> + } <nl> + } else if ( name = = " easing " ) { <nl> + <nl> + float val = p_value ; <nl> + float prev_val = animation - > track_get_key_transition ( track , key ) ; <nl> + <nl> + if ( ! setting ) { <nl> + setting = true ; <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Transition " ) , UndoRedo : : MERGE_ENDS ) ; <nl> + } <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " track_set_key_transition " , track , key , val ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " track_set_key_transition " , track , key , prev_val ) ; <nl> + update_obj = true ; <nl> + } <nl> + <nl> + switch ( animation - > track_get_type ( track ) ) { <nl> + <nl> + case Animation : : TYPE_TRANSFORM : { <nl> + <nl> + Dictionary d_old = animation - > track_get_key_value ( track , key ) ; <nl> + Dictionary d_new = d_old ; <nl> + d_new [ p_name ] = p_value ; <nl> + <nl> + if ( ! setting ) { <nl> + setting = true ; <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Transform " ) ) ; <nl> + } <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " track_set_key_value " , track , key , d_new ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " track_set_key_value " , track , key , d_old ) ; <nl> + update_obj = true ; <nl> + } break ; <nl> + case Animation : : TYPE_VALUE : { <nl> + <nl> + if ( name = = " value " ) { <nl> + <nl> + Variant value = p_value ; <nl> + <nl> + if ( value . get_type ( ) = = Variant : : NODE_PATH ) { <nl> + _fix_node_path ( value , base_map [ track ] ) ; <nl> + } <nl> + <nl> + if ( ! setting ) { <nl> + setting = true ; <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Keyframe Value " ) , UndoRedo : : MERGE_ENDS ) ; <nl> + } <nl> + Variant prev = animation - > track_get_key_value ( track , key ) ; <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " track_set_key_value " , track , key , value ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " track_set_key_value " , track , key , prev ) ; <nl> + update_obj = true ; <nl> + } <nl> + } break ; <nl> + case Animation : : TYPE_METHOD : { <nl> + <nl> + Dictionary d_old = animation - > track_get_key_value ( track , key ) ; <nl> + Dictionary d_new = d_old ; <nl> + <nl> + bool mergeable = false ; <nl> + <nl> + if ( name = = " name " ) { <nl> + <nl> + d_new [ " method " ] = p_value ; <nl> + } else if ( name = = " arg_count " ) { <nl> + <nl> + Vector < Variant > args = d_old [ " args " ] ; <nl> + args . resize ( p_value ) ; <nl> + d_new [ " args " ] = args ; <nl> + change_notify_deserved = true ; <nl> + } else if ( name . begins_with ( " args / " ) ) { <nl> + <nl> + Vector < Variant > args = d_old [ " args " ] ; <nl> + int idx = name . get_slice ( " / " , 1 ) . to_int ( ) ; <nl> + ERR_FAIL_INDEX_V ( idx , args . size ( ) , false ) ; <nl> + <nl> + String what = name . get_slice ( " / " , 2 ) ; <nl> + if ( what = = " type " ) { <nl> + Variant : : Type t = Variant : : Type ( int ( p_value ) ) ; <nl> + <nl> + if ( t ! = args [ idx ] . get_type ( ) ) { <nl> + Variant : : CallError err ; <nl> + if ( Variant : : can_convert ( args [ idx ] . get_type ( ) , t ) ) { <nl> + Variant old = args [ idx ] ; <nl> + Variant * ptrs [ 1 ] = { & old } ; <nl> + args . write [ idx ] = Variant : : construct ( t , ( const Variant * * ) ptrs , 1 , err ) ; <nl> + } else { <nl> + <nl> + args . write [ idx ] = Variant : : construct ( t , NULL , 0 , err ) ; <nl> + } <nl> + change_notify_deserved = true ; <nl> + d_new [ " args " ] = args ; <nl> + } <nl> + } else if ( what = = " value " ) { <nl> + <nl> + Variant value = p_value ; <nl> + if ( value . get_type ( ) = = Variant : : NODE_PATH ) { <nl> + <nl> + _fix_node_path ( value , base_map [ track ] ) ; <nl> + } <nl> + <nl> + args . write [ idx ] = value ; <nl> + d_new [ " args " ] = args ; <nl> + mergeable = true ; <nl> + } <nl> + } <nl> + <nl> + Variant prev = animation - > track_get_key_value ( track , key ) ; <nl> + <nl> + if ( ! setting ) { <nl> + if ( mergeable ) <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Call " ) , UndoRedo : : MERGE_ENDS ) ; <nl> + else <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Call " ) ) ; <nl> + <nl> + setting = true ; <nl> + } <nl> + <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " track_set_key_value " , track , key , d_new ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " track_set_key_value " , track , key , d_old ) ; <nl> + update_obj = true ; <nl> + } break ; <nl> + case Animation : : TYPE_BEZIER : { <nl> + <nl> + if ( name = = " value " ) { <nl> + <nl> + const Variant & value = p_value ; <nl> + <nl> + if ( ! setting ) { <nl> + setting = true ; <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Keyframe Value " ) , UndoRedo : : MERGE_ENDS ) ; <nl> + } <nl> + float prev = animation - > bezier_track_get_key_value ( track , key ) ; <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " bezier_track_set_key_value " , track , key , value ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " bezier_track_set_key_value " , track , key , prev ) ; <nl> + update_obj = true ; <nl> + } else if ( name = = " in_handle " ) { <nl> + <nl> + const Variant & value = p_value ; <nl> + <nl> + if ( ! setting ) { <nl> + setting = true ; <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Keyframe Value " ) , UndoRedo : : MERGE_ENDS ) ; <nl> + } <nl> + Vector2 prev = animation - > bezier_track_get_key_in_handle ( track , key ) ; <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " bezier_track_set_key_in_handle " , track , key , value ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " bezier_track_set_key_in_handle " , track , key , prev ) ; <nl> + update_obj = true ; <nl> + } else if ( name = = " out_handle " ) { <nl> + <nl> + const Variant & value = p_value ; <nl> + <nl> + if ( ! setting ) { <nl> + setting = true ; <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Keyframe Value " ) , UndoRedo : : MERGE_ENDS ) ; <nl> + } <nl> + Vector2 prev = animation - > bezier_track_get_key_out_handle ( track , key ) ; <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " bezier_track_set_key_out_handle " , track , key , value ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " bezier_track_set_key_out_handle " , track , key , prev ) ; <nl> + update_obj = true ; <nl> + } <nl> + } break ; <nl> + case Animation : : TYPE_AUDIO : { <nl> + <nl> + if ( name = = " stream " ) { <nl> + <nl> + Ref < AudioStream > stream = p_value ; <nl> + <nl> + if ( ! setting ) { <nl> + setting = true ; <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Keyframe Value " ) , UndoRedo : : MERGE_ENDS ) ; <nl> + } <nl> + RES prev = animation - > audio_track_get_key_stream ( track , key ) ; <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " audio_track_set_key_stream " , track , key , stream ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " audio_track_set_key_stream " , track , key , prev ) ; <nl> + update_obj = true ; <nl> + } else if ( name = = " start_offset " ) { <nl> + <nl> + float value = p_value ; <nl> + <nl> + if ( ! setting ) { <nl> + setting = true ; <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Keyframe Value " ) , UndoRedo : : MERGE_ENDS ) ; <nl> + } <nl> + float prev = animation - > audio_track_get_key_start_offset ( track , key ) ; <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " audio_track_set_key_start_offset " , track , key , value ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " audio_track_set_key_start_offset " , track , key , prev ) ; <nl> + update_obj = true ; <nl> + } else if ( name = = " end_offset " ) { <nl> + <nl> + float value = p_value ; <nl> + <nl> + if ( ! setting ) { <nl> + setting = true ; <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Keyframe Value " ) , UndoRedo : : MERGE_ENDS ) ; <nl> + } <nl> + float prev = animation - > audio_track_get_key_end_offset ( track , key ) ; <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " audio_track_set_key_end_offset " , track , key , value ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " audio_track_set_key_end_offset " , track , key , prev ) ; <nl> + update_obj = true ; <nl> + } <nl> + } break ; <nl> + case Animation : : TYPE_ANIMATION : { <nl> + <nl> + if ( name = = " animation " ) { <nl> + <nl> + StringName anim_name = p_value ; <nl> + <nl> + if ( ! setting ) { <nl> + setting = true ; <nl> + undo_redo - > create_action ( TTR ( " Anim Multi Change Keyframe Value " ) , UndoRedo : : MERGE_ENDS ) ; <nl> + } <nl> + StringName prev = animation - > animation_track_get_key_animation ( track , key ) ; <nl> + undo_redo - > add_do_method ( animation . ptr ( ) , " animation_track_set_key_animation " , track , key , anim_name ) ; <nl> + undo_redo - > add_undo_method ( animation . ptr ( ) , " animation_track_set_key_animation " , track , key , prev ) ; <nl> + update_obj = true ; <nl> + } <nl> + } break ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( setting ) { <nl> + <nl> + if ( update_obj ) { <nl> + undo_redo - > add_do_method ( this , " _update_obj " , animation ) ; <nl> + undo_redo - > add_undo_method ( this , " _update_obj " , animation ) ; <nl> + } <nl> + <nl> + undo_redo - > commit_action ( ) ; <nl> + setting = false ; <nl> + <nl> + if ( change_notify_deserved ) <nl> + notify_change ( ) ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + return false ; <nl> + } <nl> + <nl> + bool _get ( const StringName & p_name , Variant & r_ret ) const { <nl> + <nl> + for ( Map < int , List < float > > : : Element * E = key_ofs_map . front ( ) ; E ; E = E - > next ( ) ) { <nl> + <nl> + int track = E - > key ( ) ; <nl> + for ( List < float > : : Element * F = E - > value ( ) . front ( ) ; F ; F = F - > next ( ) ) { <nl> + <nl> + float key_ofs = F - > get ( ) ; <nl> + int key = animation - > track_find_key ( track , key_ofs , true ) ; <nl> + ERR_CONTINUE ( key = = - 1 ) ; <nl> + <nl> + String name = p_name ; <nl> + if ( name = = " time " ) { <nl> + r_ret = key_ofs ; <nl> + return true ; <nl> + } <nl> + <nl> + if ( name = = " frame " ) { <nl> + <nl> + float fps = animation - > get_step ( ) ; <nl> + if ( fps > 0 ) { <nl> + fps = 1 . 0 / fps ; <nl> + } <nl> + r_ret = key_ofs * fps ; <nl> + return true ; <nl> + } <nl> + <nl> + if ( name = = " easing " ) { <nl> + r_ret = animation - > track_get_key_transition ( track , key ) ; <nl> + return true ; <nl> + } <nl> + <nl> + switch ( animation - > track_get_type ( track ) ) { <nl> + <nl> + case Animation : : TYPE_TRANSFORM : { <nl> + <nl> + Dictionary d = animation - > track_get_key_value ( track , key ) ; <nl> + ERR_FAIL_COND_V ( ! d . has ( name ) , false ) ; <nl> + r_ret = d [ p_name ] ; <nl> + return true ; <nl> + <nl> + } break ; <nl> + case Animation : : TYPE_VALUE : { <nl> + <nl> + if ( name = = " value " ) { <nl> + r_ret = animation - > track_get_key_value ( track , key ) ; <nl> + return true ; <nl> + } <nl> + <nl> + } break ; <nl> + case Animation : : TYPE_METHOD : { <nl> + <nl> + Dictionary d = animation - > track_get_key_value ( track , key ) ; <nl> + <nl> + if ( name = = " name " ) { <nl> + <nl> + ERR_FAIL_COND_V ( ! d . has ( " method " ) , false ) ; <nl> + r_ret = d [ " method " ] ; <nl> + return true ; <nl> + } <nl> + <nl> + ERR_FAIL_COND_V ( ! d . has ( " args " ) , false ) ; <nl> + <nl> + Vector < Variant > args = d [ " args " ] ; <nl> + <nl> + if ( name = = " arg_count " ) { <nl> + <nl> + r_ret = args . size ( ) ; <nl> + return true ; <nl> + } <nl> + <nl> + if ( name . begins_with ( " args / " ) ) { <nl> + <nl> + int idx = name . get_slice ( " / " , 1 ) . to_int ( ) ; <nl> + ERR_FAIL_INDEX_V ( idx , args . size ( ) , false ) ; <nl> + <nl> + String what = name . get_slice ( " / " , 2 ) ; <nl> + if ( what = = " type " ) { <nl> + r_ret = args [ idx ] . get_type ( ) ; <nl> + return true ; <nl> + } <nl> + <nl> + if ( what = = " value " ) { <nl> + r_ret = args [ idx ] ; <nl> + return true ; <nl> + } <nl> + } <nl> + <nl> + } break ; <nl> + case Animation : : TYPE_BEZIER : { <nl> + <nl> + if ( name = = " value " ) { <nl> + r_ret = animation - > bezier_track_get_key_value ( track , key ) ; <nl> + return true ; <nl> + } <nl> + <nl> + if ( name = = " in_handle " ) { <nl> + r_ret = animation - > bezier_track_get_key_in_handle ( track , key ) ; <nl> + return true ; <nl> + } <nl> + <nl> + if ( name = = " out_handle " ) { <nl> + r_ret = animation - > bezier_track_get_key_out_handle ( track , key ) ; <nl> + return true ; <nl> + } <nl> + <nl> + } break ; <nl> + case Animation : : TYPE_AUDIO : { <nl> + <nl> + if ( name = = " stream " ) { <nl> + r_ret = animation - > audio_track_get_key_stream ( track , key ) ; <nl> + return true ; <nl> + } <nl> + <nl> + if ( name = = " start_offset " ) { <nl> + r_ret = animation - > audio_track_get_key_start_offset ( track , key ) ; <nl> + return true ; <nl> + } <nl> + <nl> + if ( name = = " end_offset " ) { <nl> + r_ret = animation - > audio_track_get_key_end_offset ( track , key ) ; <nl> + return true ; <nl> + } <nl> + <nl> + } break ; <nl> + case Animation : : TYPE_ANIMATION : { <nl> + <nl> + if ( name = = " animation " ) { <nl> + r_ret = animation - > animation_track_get_key_animation ( track , key ) ; <nl> + return true ; <nl> + } <nl> + <nl> + } break ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + return false ; <nl> + } <nl> + void _get_property_list ( List < PropertyInfo > * p_list ) const { <nl> + <nl> + if ( animation . is_null ( ) ) <nl> + return ; <nl> + <nl> + int first_track = - 1 ; <nl> + float first_key = - 1 . 0 ; <nl> + <nl> + bool show_time = true ; <nl> + bool same_track_type = true ; <nl> + bool same_key_type = true ; <nl> + for ( Map < int , List < float > > : : Element * E = key_ofs_map . front ( ) ; E ; E = E - > next ( ) ) { <nl> + <nl> + int track = E - > key ( ) ; <nl> + ERR_FAIL_INDEX ( track , animation - > get_track_count ( ) ) ; <nl> + <nl> + if ( first_track < 0 ) <nl> + first_track = track ; <nl> + <nl> + if ( show_time & & E - > value ( ) . size ( ) > 1 ) <nl> + show_time = false ; <nl> + <nl> + if ( same_track_type ) { <nl> + <nl> + if ( animation - > track_get_type ( first_track ) ! = animation - > track_get_type ( track ) ) { <nl> + same_track_type = false ; <nl> + same_key_type = false ; <nl> + } <nl> + <nl> + for ( List < float > : : Element * F = E - > value ( ) . front ( ) ; F ; F = F - > next ( ) ) { <nl> + <nl> + int key = animation - > track_find_key ( track , F - > get ( ) , true ) ; <nl> + ERR_FAIL_COND ( key = = - 1 ) ; <nl> + if ( first_key < 0 ) <nl> + first_key = key ; <nl> + <nl> + if ( animation - > track_get_key_value ( first_track , first_key ) . get_type ( ) ! = animation - > track_get_key_value ( track , key ) . get_type ( ) ) <nl> + same_key_type = false ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( show_time ) { <nl> + <nl> + if ( use_fps & & animation - > get_step ( ) > 0 ) { <nl> + float max_frame = animation - > get_length ( ) / animation - > get_step ( ) ; <nl> + p_list - > push_back ( PropertyInfo ( Variant : : REAL , " frame " , PROPERTY_HINT_RANGE , " 0 , " + rtos ( max_frame ) + " , 1 " ) ) ; <nl> + } else { <nl> + p_list - > push_back ( PropertyInfo ( Variant : : REAL , " time " , PROPERTY_HINT_RANGE , " 0 , " + rtos ( animation - > get_length ( ) ) + " , 0 . 01 " ) ) ; <nl> + } <nl> + } <nl> + <nl> + if ( same_track_type ) { <nl> + switch ( animation - > track_get_type ( first_track ) ) { <nl> + <nl> + case Animation : : TYPE_TRANSFORM : { <nl> + <nl> + p_list - > push_back ( PropertyInfo ( Variant : : VECTOR3 , " location " ) ) ; <nl> + p_list - > push_back ( PropertyInfo ( Variant : : QUAT , " rotation " ) ) ; <nl> + p_list - > push_back ( PropertyInfo ( Variant : : VECTOR3 , " scale " ) ) ; <nl> + } break ; <nl> + case Animation : : TYPE_VALUE : { <nl> + <nl> + if ( ! same_key_type ) <nl> + break ; <nl> + <nl> + Variant v = animation - > track_get_key_value ( first_track , first_key ) ; <nl> + <nl> + if ( hint . type ! = Variant : : NIL ) { <nl> + <nl> + PropertyInfo pi = hint ; <nl> + pi . name = " value " ; <nl> + p_list - > push_back ( pi ) ; <nl> + } else { <nl> + <nl> + PropertyHint hint = PROPERTY_HINT_NONE ; <nl> + String hint_string ; <nl> + <nl> + if ( v . get_type ( ) = = Variant : : OBJECT ) { <nl> + / / could actually check the object property if exists . . ? yes i will ! <nl> + Ref < Resource > res = v ; <nl> + if ( res . is_valid ( ) ) { <nl> + <nl> + hint = PROPERTY_HINT_RESOURCE_TYPE ; <nl> + hint_string = res - > get_class ( ) ; <nl> + } <nl> + } <nl> + <nl> + if ( v . get_type ( ) ! = Variant : : NIL ) <nl> + p_list - > push_back ( PropertyInfo ( v . get_type ( ) , " value " , hint , hint_string ) ) ; <nl> + } <nl> + <nl> + p_list - > push_back ( PropertyInfo ( Variant : : REAL , " easing " , PROPERTY_HINT_EXP_EASING ) ) ; <nl> + } break ; <nl> + case Animation : : TYPE_METHOD : { <nl> + <nl> + p_list - > push_back ( PropertyInfo ( Variant : : STRING , " name " ) ) ; <nl> + p_list - > push_back ( PropertyInfo ( Variant : : INT , " arg_count " , PROPERTY_HINT_RANGE , " 0 , 5 , 1 " ) ) ; <nl> + <nl> + Dictionary d = animation - > track_get_key_value ( first_track , first_key ) ; <nl> + ERR_FAIL_COND ( ! d . has ( " args " ) ) ; <nl> + Vector < Variant > args = d [ " args " ] ; <nl> + String vtypes ; <nl> + for ( int i = 0 ; i < Variant : : VARIANT_MAX ; i + + ) { <nl> + <nl> + if ( i > 0 ) <nl> + vtypes + = " , " ; <nl> + vtypes + = Variant : : get_type_name ( Variant : : Type ( i ) ) ; <nl> + } <nl> + <nl> + for ( int i = 0 ; i < args . size ( ) ; i + + ) { <nl> + <nl> + p_list - > push_back ( PropertyInfo ( Variant : : INT , " args / " + itos ( i ) + " / type " , PROPERTY_HINT_ENUM , vtypes ) ) ; <nl> + if ( args [ i ] . get_type ( ) ! = Variant : : NIL ) <nl> + p_list - > push_back ( PropertyInfo ( args [ i ] . get_type ( ) , " args / " + itos ( i ) + " / value " ) ) ; <nl> + } <nl> + } break ; <nl> + case Animation : : TYPE_BEZIER : { <nl> + <nl> + p_list - > push_back ( PropertyInfo ( Variant : : REAL , " value " ) ) ; <nl> + p_list - > push_back ( PropertyInfo ( Variant : : VECTOR2 , " in_handle " ) ) ; <nl> + p_list - > push_back ( PropertyInfo ( Variant : : VECTOR2 , " out_handle " ) ) ; <nl> + } break ; <nl> + case Animation : : TYPE_AUDIO : { <nl> + <nl> + p_list - > push_back ( PropertyInfo ( Variant : : OBJECT , " stream " , PROPERTY_HINT_RESOURCE_TYPE , " AudioStream " ) ) ; <nl> + p_list - > push_back ( PropertyInfo ( Variant : : REAL , " start_offset " , PROPERTY_HINT_RANGE , " 0 , 3600 , 0 . 01 , or_greater " ) ) ; <nl> + p_list - > push_back ( PropertyInfo ( Variant : : REAL , " end_offset " , PROPERTY_HINT_RANGE , " 0 , 3600 , 0 . 01 , or_greater " ) ) ; <nl> + } break ; <nl> + case Animation : : TYPE_ANIMATION : { <nl> + <nl> + if ( key_ofs_map . size ( ) > 1 ) <nl> + break ; <nl> + <nl> + String animations ; <nl> + <nl> + if ( root_path & & root_path - > has_node ( animation - > track_get_path ( first_track ) ) ) { <nl> + <nl> + AnimationPlayer * ap = Object : : cast_to < AnimationPlayer > ( root_path - > get_node ( animation - > track_get_path ( first_track ) ) ) ; <nl> + if ( ap ) { <nl> + List < StringName > anims ; <nl> + ap - > get_animation_list ( & anims ) ; <nl> + for ( List < StringName > : : Element * G = anims . front ( ) ; G ; G = G - > next ( ) ) { <nl> + if ( animations ! = String ( ) ) { <nl> + animations + = " , " ; <nl> + } <nl> + <nl> + animations + = String ( G - > get ( ) ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( animations ! = String ( ) ) { <nl> + animations + = " , " ; <nl> + } <nl> + animations + = " [ stop ] " ; <nl> + <nl> + p_list - > push_back ( PropertyInfo ( Variant : : STRING , " animation " , PROPERTY_HINT_ENUM , animations ) ) ; <nl> + } break ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + Ref < Animation > animation ; <nl> + <nl> + Map < int , List < float > > key_ofs_map ; <nl> + Map < int , NodePath > base_map ; <nl> + PropertyInfo hint ; <nl> + <nl> + Node * root_path ; <nl> + <nl> + bool use_fps ; <nl> + <nl> + UndoRedo * undo_redo ; <nl> + <nl> + void notify_change ( ) { <nl> + <nl> + _change_notify ( ) ; <nl> + } <nl> + <nl> + Node * get_root_path ( ) { <nl> + return root_path ; <nl> + } <nl> + <nl> + void set_use_fps ( bool p_enable ) { <nl> + use_fps = p_enable ; <nl> + _change_notify ( ) ; <nl> + } <nl> + <nl> + AnimationMultiTrackKeyEdit ( ) { <nl> + use_fps = false ; <nl> + setting = false ; <nl> + root_path = NULL ; <nl> + } <nl> + } ; <nl> + <nl> void AnimationTimelineEdit : : _zoom_changed ( double ) { <nl> <nl> update ( ) ; <nl> void AnimationTrackEditor : : _clear_key_edit ( ) { <nl> } <nl> # else <nl> / / if key edit is the object being inspected , remove it first <nl> - if ( EditorNode : : get_singleton ( ) - > get_inspector ( ) - > get_edited_object ( ) = = key_edit ) { <nl> + if ( EditorNode : : get_singleton ( ) - > get_inspector ( ) - > get_edited_object ( ) = = key_edit | | <nl> + EditorNode : : get_singleton ( ) - > get_inspector ( ) - > get_edited_object ( ) = = multi_key_edit ) { <nl> EditorNode : : get_singleton ( ) - > push_item ( NULL ) ; <nl> } <nl> + <nl> / / then actually delete it <nl> - memdelete ( key_edit ) ; <nl> - key_edit = NULL ; <nl> + if ( key_edit ) { <nl> + memdelete ( key_edit ) ; <nl> + key_edit = NULL ; <nl> + } else if ( multi_key_edit ) { <nl> + memdelete ( multi_key_edit ) ; <nl> + multi_key_edit = NULL ; <nl> + } <nl> # endif <nl> } <nl> } <nl> void AnimationTrackEditor : : _update_key_edit ( ) { <nl> _clear_key_edit ( ) ; <nl> if ( ! animation . is_valid ( ) ) <nl> return ; <nl> - if ( selection . size ( ) ! = 1 ) { <nl> - return ; <nl> - } <nl> <nl> - key_edit = memnew ( AnimationTrackKeyEdit ) ; <nl> - key_edit - > animation = animation ; <nl> - key_edit - > track = selection . front ( ) - > key ( ) . track ; <nl> - key_edit - > use_fps = timeline - > is_using_fps ( ) ; <nl> + if ( selection . size ( ) = = 1 ) { <nl> + <nl> + key_edit = memnew ( AnimationTrackKeyEdit ) ; <nl> + key_edit - > animation = animation ; <nl> + key_edit - > track = selection . front ( ) - > key ( ) . track ; <nl> + key_edit - > use_fps = timeline - > is_using_fps ( ) ; <nl> + <nl> + float ofs = animation - > track_get_key_time ( key_edit - > track , selection . front ( ) - > key ( ) . key ) ; <nl> + key_edit - > key_ofs = ofs ; <nl> + key_edit - > root_path = root ; <nl> + <nl> + NodePath np ; <nl> + key_edit - > hint = _find_hint_for_track ( key_edit - > track , np ) ; <nl> + key_edit - > undo_redo = undo_redo ; <nl> + key_edit - > base = np ; <nl> <nl> - float ofs = animation - > track_get_key_time ( key_edit - > track , selection . front ( ) - > key ( ) . key ) ; <nl> - key_edit - > key_ofs = ofs ; <nl> - key_edit - > root_path = root ; <nl> + EditorNode : : get_singleton ( ) - > push_item ( key_edit ) ; <nl> + } else if ( selection . size ( ) > 1 ) { <nl> <nl> - NodePath np ; <nl> - key_edit - > hint = _find_hint_for_track ( key_edit - > track , np ) ; <nl> - key_edit - > undo_redo = undo_redo ; <nl> - key_edit - > base = np ; <nl> + multi_key_edit = memnew ( AnimationMultiTrackKeyEdit ) ; <nl> + multi_key_edit - > animation = animation ; <nl> <nl> - EditorNode : : get_singleton ( ) - > push_item ( key_edit ) ; <nl> + Map < int , List < float > > key_ofs_map ; <nl> + Map < int , NodePath > base_map ; <nl> + int first_track = - 1 ; <nl> + for ( Map < SelectedKey , KeyInfo > : : Element * E = selection . front ( ) ; E ; E = E - > next ( ) ) { <nl> + <nl> + int track = E - > key ( ) . track ; <nl> + if ( first_track < 0 ) <nl> + first_track = track ; <nl> + <nl> + if ( ! key_ofs_map . has ( track ) ) { <nl> + key_ofs_map [ track ] = List < float > ( ) ; <nl> + base_map [ track ] = * memnew ( NodePath ) ; <nl> + } <nl> + <nl> + key_ofs_map [ track ] . push_back ( animation - > track_get_key_time ( track , E - > key ( ) . key ) ) ; <nl> + } <nl> + multi_key_edit - > key_ofs_map = key_ofs_map ; <nl> + multi_key_edit - > base_map = base_map ; <nl> + multi_key_edit - > hint = _find_hint_for_track ( first_track , base_map [ first_track ] ) ; <nl> + <nl> + multi_key_edit - > use_fps = timeline - > is_using_fps ( ) ; <nl> + <nl> + multi_key_edit - > root_path = root ; <nl> + <nl> + multi_key_edit - > undo_redo = undo_redo ; <nl> + <nl> + EditorNode : : get_singleton ( ) - > push_item ( multi_key_edit ) ; <nl> + } <nl> } <nl> <nl> void AnimationTrackEditor : : _clear_selection_for_anim ( const Ref < Animation > & p_anim ) { <nl> <nl> - if ( ! ( animation = = p_anim ) ) <nl> + if ( animation ! = p_anim ) <nl> return ; <nl> - / / selection . clear ( ) ; <nl> + <nl> _clear_selection ( ) ; <nl> } <nl> <nl> void AnimationTrackEditor : : _select_at_anim ( const Ref < Animation > & p_anim , int p_track , float p_pos ) { <nl> <nl> - if ( ! ( animation = = p_anim ) ) <nl> + if ( animation ! = p_anim ) <nl> return ; <nl> <nl> int idx = animation - > track_find_key ( p_track , p_pos , true ) ; <nl> void AnimationTrackEditor : : _move_selection_commit ( ) { <nl> List < _AnimMoveRestore > to_restore ; <nl> <nl> float motion = moving_selection_offset ; <nl> - / / 1 - remove the keys <nl> + / / 1 - remove the keys <nl> for ( Map < SelectedKey , KeyInfo > : : Element * E = selection . back ( ) ; E ; E = E - > prev ( ) ) { <nl> <nl> undo_redo - > add_do_method ( animation . ptr ( ) , " track_remove_key " , E - > key ( ) . track , E - > key ( ) . key ) ; <nl> } <nl> - / / 2 - remove overlapped keys <nl> + / / 2 - remove overlapped keys <nl> for ( Map < SelectedKey , KeyInfo > : : Element * E = selection . back ( ) ; E ; E = E - > prev ( ) ) { <nl> <nl> float newtime = snap_time ( E - > get ( ) . pos + motion ) ; <nl> void AnimationTrackEditor : : _move_selection_commit ( ) { <nl> to_restore . push_back ( amr ) ; <nl> } <nl> <nl> - / / 3 - move the keys ( re insert them ) <nl> + / / 3 - move the keys ( re insert them ) <nl> for ( Map < SelectedKey , KeyInfo > : : Element * E = selection . back ( ) ; E ; E = E - > prev ( ) ) { <nl> <nl> float newpos = snap_time ( E - > get ( ) . pos + motion ) ; <nl> - / * <nl> - if ( newpos < 0 ) <nl> - continue ; / / no add at the beginning <nl> - * / <nl> undo_redo - > add_do_method ( animation . ptr ( ) , " track_insert_key " , E - > key ( ) . track , newpos , animation - > track_get_key_value ( E - > key ( ) . track , E - > key ( ) . key ) , animation - > track_get_key_transition ( E - > key ( ) . track , E - > key ( ) . key ) ) ; <nl> } <nl> <nl> - / / 4 - ( undo ) remove inserted keys <nl> + / / 4 - ( undo ) remove inserted keys <nl> for ( Map < SelectedKey , KeyInfo > : : Element * E = selection . back ( ) ; E ; E = E - > prev ( ) ) { <nl> <nl> float newpos = snap_time ( E - > get ( ) . pos + motion ) ; <nl> - / * <nl> - if ( newpos < 0 ) <nl> - continue ; / / no remove what no inserted <nl> - * / <nl> undo_redo - > add_undo_method ( animation . ptr ( ) , " track_remove_key_at_position " , E - > key ( ) . track , newpos ) ; <nl> } <nl> <nl> - / / 5 - ( undo ) reinsert keys <nl> + / / 5 - ( undo ) reinsert keys <nl> for ( Map < SelectedKey , KeyInfo > : : Element * E = selection . back ( ) ; E ; E = E - > prev ( ) ) { <nl> <nl> undo_redo - > add_undo_method ( animation . ptr ( ) , " track_insert_key " , E - > key ( ) . track , E - > get ( ) . pos , animation - > track_get_key_value ( E - > key ( ) . track , E - > key ( ) . key ) , animation - > track_get_key_transition ( E - > key ( ) . track , E - > key ( ) . key ) ) ; <nl> } <nl> <nl> - / / 6 - ( undo ) reinsert overlapped keys <nl> + / / 6 - ( undo ) reinsert overlapped keys <nl> for ( List < _AnimMoveRestore > : : Element * E = to_restore . front ( ) ; E ; E = E - > next ( ) ) { <nl> <nl> _AnimMoveRestore & amr = E - > get ( ) ; <nl> void AnimationTrackEditor : : _move_selection_commit ( ) { <nl> undo_redo - > add_do_method ( this , " _clear_selection_for_anim " , animation ) ; <nl> undo_redo - > add_undo_method ( this , " _clear_selection_for_anim " , animation ) ; <nl> <nl> - / / 7 - reselect <nl> + / / 7 - reselect <nl> for ( Map < SelectedKey , KeyInfo > : : Element * E = selection . back ( ) ; E ; E = E - > prev ( ) ) { <nl> <nl> float oldpos = E - > get ( ) . pos ; <nl> float newpos = snap_time ( oldpos + motion ) ; <nl> - / / if ( newpos > = 0 ) <nl> + <nl> undo_redo - > add_do_method ( this , " _select_at_anim " , animation , E - > key ( ) . track , newpos ) ; <nl> undo_redo - > add_undo_method ( this , " _select_at_anim " , animation , E - > key ( ) . track , oldpos ) ; <nl> } <nl> mmm a / editor / animation_track_editor . h <nl> ppp b / editor / animation_track_editor . h <nl> class AnimationTrackEditPlugin : public Reference { <nl> } ; <nl> <nl> class AnimationTrackKeyEdit ; <nl> + class AnimationMultiTrackKeyEdit ; <nl> class AnimationBezierTrackEdit ; <nl> <nl> class AnimationTrackEditGroup : public Control { <nl> class AnimationTrackEditor : public VBoxContainer { <nl> void _move_selection_cancel ( ) ; <nl> <nl> AnimationTrackKeyEdit * key_edit ; <nl> + AnimationMultiTrackKeyEdit * multi_key_edit ; <nl> void _update_key_edit ( ) ; <nl> <nl> void _clear_key_edit ( ) ; <nl>
|
Merge pull request from YeldhamDev / anim_multi_key_edit
|
godotengine/godot
|
adae2b073811d0f81afdfab277fdb27d2ba9f16a
|
2019-07-24T06:39:30Z
|
mmm a / modules / dreamview / conf / vehicle_data . pb . txt <nl> ppp b / modules / dreamview / conf / vehicle_data . pb . txt <nl> data_files { <nl> source_path : " navigation_lincoln . pb . txt " <nl> dest_path : " / apollo / modules / control / conf / navigation_lincoln . pb . txt " <nl> } <nl> + data_files { <nl> + source_path : " novatel_localization_extrinsics . yaml " <nl> + dest_path : " / apollo / modules / localization / msf / params " <nl> + } <nl> data_files { <nl> source_path : " velodyne_params " <nl> dest_path : " / apollo / modules / drivers / velodyne / params " <nl>
|
Perception : Added to copy noval_localiztion parameters using dreamview
|
ApolloAuto/apollo
|
ffe752708812927b30e8e504529e2a3f9433a497
|
2018-12-13T23:18:33Z
|
mmm a / db / dbwebserver . cpp <nl> ppp b / db / dbwebserver . cpp <nl> namespace mongo { <nl> <nl> ss < < bold ( ClientCursor : : byLocSize ( ) > 10000 ) < < " Cursors byLoc . size ( ) : " < < ClientCursor : : byLocSize ( ) < < bold ( ) < < ' \ n ' ; <nl> ss < < " \ n < b > replication < / b > \ n " ; <nl> - ss < < " master : " < < replSettings . master < < ' \ n ' ; <nl> - ss < < " slave : " < < replSettings . slave < < ' \ n ' ; <nl> - if ( replPair ) { <nl> - ss < < " replpair : \ n " ; <nl> - ss < < replPair - > getInfo ( ) ; <nl> + if ( replSet ) { <nl> + ss < < " < a title = \ " see replSetGetStatus link top of page \ " > - - replSet mode < / a > \ n " ; <nl> + } <nl> + else { <nl> + ss < < " master : " < < replSettings . master < < ' \ n ' ; <nl> + ss < < " slave : " < < replSettings . slave < < ' \ n ' ; <nl> + if ( replPair ) { <nl> + ss < < " replpair : \ n " ; <nl> + ss < < replPair - > getInfo ( ) ; <nl> + } <nl> + bool seemCaughtUp = getInitialSyncCompleted ( ) ; <nl> + if ( ! seemCaughtUp ) ss < < " < b > " ; <nl> + ss < < " initialSyncCompleted : " < < seemCaughtUp ; <nl> + if ( ! seemCaughtUp ) ss < < " < / b > " ; <nl> + ss < < ' \ n ' ; <nl> } <nl> - bool seemCaughtUp = getInitialSyncCompleted ( ) ; <nl> - if ( ! seemCaughtUp ) ss < < " < b > " ; <nl> - ss < < " initialSyncCompleted : " < < seemCaughtUp ; <nl> - if ( ! seemCaughtUp ) ss < < " < / b > " ; <nl> - ss < < ' \ n ' ; <nl> <nl> auto_ptr < SnapshotDelta > delta = statsSnapshots . computeDelta ( ) ; <nl> if ( delta . get ( ) ) { <nl> - ss < < " \ n < b > DBTOP ( occurences | percent of elapsed ) < / b > \ n " ; <nl> - ss < < " < table border = 1 > " ; <nl> + ss < < " \ n < b > dbtop < / b > ( occurences | percent of elapsed ) \ n " ; <nl> + ss < < " < table border = 1 cellpadding = 2 cellspacing = 0 > " ; <nl> ss < < " < tr align = ' left ' > " ; <nl> - ss < < " < th > NS < / th > " <nl> + ss < < " < th > < a title = \ " namespace \ " > NS < / a > < / th > " <nl> " < th colspan = 2 > total < / th > " <nl> " < th colspan = 2 > Reads < / th > " <nl> " < th colspan = 2 > Writes < / th > " <nl> namespace mongo { <nl> ss < < " git hash : " < < gitVersion ( ) < < ' \ n ' ; <nl> ss < < " sys info : " < < sysInfo ( ) < < ' \ n ' ; <nl> ss < < ' \ n ' ; <nl> - ss < < " dbwritelocked : " < < dbMutex . info ( ) . isLocked ( ) < < " ( initial ) \ n " ; <nl> - ss < < " uptime : " < < time ( 0 ) - started < < " seconds \ n " ; <nl> + ss < < " < a title = \ " snapshot : was the db in the write lock when this page was generated ? \ " > " ; <nl> + ss < < " write locked : < / a > " < < ( dbMutex . info ( ) . isLocked ( ) ? " true " : " false " ) < < " \ n " ; <nl> + ss < < " uptime : " < < time ( 0 ) - started < < " seconds \ n " ; <nl> if ( replAllDead ) <nl> ss < < " < b > replication replAllDead = " < < replAllDead < < " < / b > \ n " ; <nl> - ss < < " \ nassertions : \ n " ; <nl> + ss < < " \ n " ; <nl> + ss < < " < a title = \ " information on caught assertion exceptions \ " > " ; <nl> + ss < < " assertions : < / a > \ n " ; <nl> for ( int i = 0 ; i < 4 ; i + + ) { <nl> if ( lastAssert [ i ] . isSet ( ) ) { <nl> - ss < < " < b > " ; <nl> if ( i = = 3 ) ss < < " usererr " ; <nl> else ss < < i ; <nl> - ss < < " < / b > " < < ' ' < < lastAssert [ i ] . toString ( ) ; <nl> + ss < < ' ' < < lastAssert [ i ] . toString ( ) ; <nl> } <nl> } <nl> <nl> ss < < " \ nreplInfo : " < < replInfo < < " \ n \ n " ; <nl> <nl> ss < < " Clients : \ n " ; <nl> - ss < < " < table border = 1 > " ; <nl> + ss < < " < table border = 1 cellpadding = 2 cellspacing = 0 > " ; <nl> ss < < " < tr align = ' left ' > " <nl> < < " < th > Thread < / th > " <nl> <nl> namespace mongo { <nl> string dbname ; <nl> { <nl> stringstream z ; <nl> - z < < " mongod " < < " host : " < < getHostName ( ) < < " port : " < < mongo : : cmdLine . port < < ' ' ; <nl> + z < < " mongod " < < getHostName ( ) < < " : " < < mongo : : cmdLine . port ; <nl> dbname = z . str ( ) ; <nl> } <nl> - ss < < dbname < < " < / title > < / head > < body > < h2 > " < < dbname < < " < / h2 > < p > \ n " ; <nl> + ss < < dbname < < " < / title > < / head > < body > < h2 > " < < dbname < < " < / h2 > \ n " ; <nl> ss < < " < pre > " ; <nl> / / ss < < " < a href = \ " / _status \ " > _status < / a > " ; <nl> { <nl> namespace mongo { <nl> } <nl> } <nl> ss < < ' \ n ' ; <nl> + ss < < " rest / admin port : " < < _port < < " \ n " ; <nl> doUnlockedStuff ( ss ) ; <nl> <nl> { <nl> mmm a / db / repl . cpp <nl> ppp b / db / repl . cpp <nl> namespace mongo { <nl> if ( theReplSet = = 0 ) { <nl> result . append ( " ismaster " , 0 ) ; <nl> result . append ( " ok " , false ) ; <nl> - result . append ( " msg " , " still initializing " ) ; <nl> + result . append ( " msg " , " replSet still trying to initialize " ) ; <nl> return true ; <nl> } <nl> theReplSet - > fillIsMaster ( result ) ; <nl> mmm a / db / replpair . h <nl> ppp b / db / replpair . h <nl> namespace mongo { <nl> * / <nl> inline void replVerifyReadsOk ( ParsedQuery & pq ) { <nl> if ( replSet ) { <nl> - uassert ( 13124 , " not master still in initialization " , theReplSet ) ; / / during initialization , no queries allowed whatsover <nl> + uassert ( 13124 , " not master - replSet still initializing " , theReplSet ) ; / / during initialization , no queries allowed whatsover <nl> notMasterUnless ( theReplSet - > isMaster ( " " ) | | pq . hasOption ( QueryOption_SlaveOk ) ) ; <nl> return ; <nl> } <nl>
|
tweak web page
|
mongodb/mongo
|
3243403a5fa36604a33c6ea686ee733eeaf870a2
|
2010-04-22T17:07:36Z
|
mmm a / tensorflow / go / op / wrappers . go <nl> ppp b / tensorflow / go / op / wrappers . go <nl> func MatrixLogarithm ( scope * Scope , input tf . Output ) ( output tf . Output ) { <nl> / / SparseBincountAttr is an optional argument to SparseBincount . <nl> type SparseBincountAttr func ( optionalAttr ) <nl> <nl> - / / SparseBincountBinaryCount sets the optional binary_count attribute to value . <nl> + / / SparseBincountBinaryOutput sets the optional binary_output attribute to value . <nl> / / <nl> / / value : bool ; Whether the kernel should count the appearance or number of occurrences . <nl> / / If not specified , defaults to false <nl> - func SparseBincountBinaryCount ( value bool ) SparseBincountAttr { <nl> + func SparseBincountBinaryOutput ( value bool ) SparseBincountAttr { <nl> return func ( m optionalAttr ) { <nl> - m [ " binary_count " ] = value <nl> + m [ " binary_output " ] = value <nl> } <nl> } <nl> <nl> func Selu ( scope * Scope , features tf . Output ) ( activations tf . Output ) { <nl> / / DenseBincountAttr is an optional argument to DenseBincount . <nl> type DenseBincountAttr func ( optionalAttr ) <nl> <nl> - / / DenseBincountBinaryCount sets the optional binary_count attribute to value . <nl> + / / DenseBincountBinaryOutput sets the optional binary_output attribute to value . <nl> / / <nl> / / value : bool ; Whether the kernel should count the appearance or number of occurrences . <nl> / / If not specified , defaults to false <nl> - func DenseBincountBinaryCount ( value bool ) DenseBincountAttr { <nl> + func DenseBincountBinaryOutput ( value bool ) DenseBincountAttr { <nl> return func ( m optionalAttr ) { <nl> - m [ " binary_count " ] = value <nl> + m [ " binary_output " ] = value <nl> } <nl> } <nl> <nl> func SparseTensorDenseAdd ( scope * Scope , a_indices tf . Output , a_values tf . Output , <nl> / / RaggedBincountAttr is an optional argument to RaggedBincount . <nl> type RaggedBincountAttr func ( optionalAttr ) <nl> <nl> - / / RaggedBincountBinaryCount sets the optional binary_count attribute to value . <nl> + / / RaggedBincountBinaryOutput sets the optional binary_output attribute to value . <nl> / / <nl> / / value : bool ; Whether the kernel should count the appearance or number of occurrences . <nl> / / If not specified , defaults to false <nl> - func RaggedBincountBinaryCount ( value bool ) RaggedBincountAttr { <nl> + func RaggedBincountBinaryOutput ( value bool ) RaggedBincountAttr { <nl> return func ( m optionalAttr ) { <nl> - m [ " binary_count " ] = value <nl> + m [ " binary_output " ] = value <nl> } <nl> } <nl> <nl>
|
Go : Update generated wrapper functions for TensorFlow ops .
|
tensorflow/tensorflow
|
22eb1624cb3b2eb4e2369bcba35bd9156aa080d4
|
2020-05-14T01:44:27Z
|
mmm a / src / Interpreters / ActionsVisitor . cpp <nl> ppp b / src / Interpreters / ActionsVisitor . cpp <nl> <nl> - # include " Common / quoteString . h " <nl> + # include < Common / quoteString . h > <nl> # include < Common / typeid_cast . h > <nl> - # include < Common / PODArray . h > <nl> # include < Core / Row . h > <nl> <nl> # include < Functions / FunctionFactory . h > <nl> <nl> # include < AggregateFunctions / AggregateFunctionFactory . h > <nl> <nl> # include < DataTypes / DataTypeSet . h > <nl> - # include < DataTypes / DataTypesNumber . h > <nl> # include < DataTypes / DataTypeFunction . h > <nl> # include < DataTypes / DataTypeString . h > <nl> # include < DataTypes / DataTypeTuple . h > <nl> <nl> <nl> # include < Columns / ColumnSet . h > <nl> # include < Columns / ColumnConst . h > <nl> - # include < Columns / ColumnsNumber . h > <nl> <nl> # include < Storages / StorageSet . h > <nl> <nl> void ActionsMatcher : : visit ( const ASTFunction & node , const ASTPtr & ast , Data & <nl> if ( ! data . only_consts ) <nl> { <nl> String result_name = column_name . get ( ast ) ; <nl> - data . addAction ( ExpressionAction : : copyColumn ( arg - > getColumnName ( ) , result_name ) ) ; <nl> - NameSet joined_columns ; <nl> - joined_columns . insert ( result_name ) ; <nl> - data . addAction ( ExpressionAction : : arrayJoin ( std : : make_shared < ArrayJoinAction > ( joined_columns , false , data . context ) ) ) ; <nl> + / / / Here we copy argument because arrayJoin removes source column . <nl> + / / / It makes possible to remove source column before arrayJoin if it won ' t be needed anymore . <nl> + <nl> + / / / It could have been possible to implement arrayJoin which keeps source column , <nl> + / / / but in this case it will always be replicated ( as many arrays ) , which is expensive . <nl> + String tmp_name = data . getUniqueName ( " _array_join_ " + arg - > getColumnName ( ) ) ; <nl> + data . addAction ( ExpressionAction : : copyColumn ( arg - > getColumnName ( ) , tmp_name ) ) ; <nl> + data . addAction ( ExpressionAction : : arrayJoin ( tmp_name , result_name ) ) ; <nl> } <nl> <nl> return ; <nl> mmm a / src / Interpreters / ArrayJoinAction . cpp <nl> ppp b / src / Interpreters / ArrayJoinAction . cpp <nl> void ArrayJoinAction : : prepare ( Block & sample_block ) <nl> } <nl> } <nl> <nl> - void ArrayJoinAction : : execute ( Block & block , bool dry_run ) <nl> + void ArrayJoinAction : : execute ( Block & block ) <nl> { <nl> if ( columns . empty ( ) ) <nl> throw Exception ( " No arrays to join " , ErrorCodes : : LOGICAL_ERROR ) ; <nl> void ArrayJoinAction : : execute ( Block & block , bool dry_run ) <nl> <nl> Block tmp_block { src_col , { { } , src_col . type , { } } } ; <nl> <nl> - function_builder - > build ( { src_col } ) - > execute ( tmp_block , { 0 } , 1 , src_col . column - > size ( ) , dry_run ) ; <nl> + function_builder - > build ( { src_col } ) - > execute ( tmp_block , { 0 } , 1 , src_col . column - > size ( ) ) ; <nl> non_empty_array_columns [ name ] = tmp_block . safeGetByPosition ( 1 ) . column ; <nl> } <nl> <nl> void ArrayJoinAction : : execute ( Block & block , bool dry_run ) <nl> } <nl> } <nl> <nl> - void ArrayJoinAction : : finalize ( NameSet & needed_columns , NameSet & unmodified_columns , NameSet & final_columns ) <nl> - { <nl> - / / / Do not ARRAY JOIN columns that are not used anymore . <nl> - / / / Usually , such columns are not used until ARRAY JOIN , and therefore are ejected further in this function . <nl> - / / / We will not remove all the columns so as not to lose the number of rows . <nl> - for ( auto it = columns . begin ( ) ; it ! = columns . end ( ) ; ) <nl> - { <nl> - bool need = needed_columns . count ( * it ) ; <nl> - if ( ! need & & columns . size ( ) > 1 ) <nl> - { <nl> - columns . erase ( it + + ) ; <nl> - } <nl> - else <nl> - { <nl> - needed_columns . insert ( * it ) ; <nl> - unmodified_columns . erase ( * it ) ; <nl> - <nl> - / / / If no ARRAY JOIN results are used , forcibly leave an arbitrary column at the output , <nl> - / / / so you do not lose the number of rows . <nl> - if ( ! need ) <nl> - final_columns . insert ( * it ) ; <nl> - <nl> - + + it ; <nl> - } <nl> - } <nl> - } <nl> - <nl> } <nl> mmm a / src / Interpreters / ArrayJoinAction . h <nl> ppp b / src / Interpreters / ArrayJoinAction . h <nl> class ArrayJoinAction <nl> <nl> ArrayJoinAction ( const NameSet & array_joined_columns_ , bool array_join_is_left , const Context & context ) ; <nl> void prepare ( Block & sample_block ) ; <nl> - void execute ( Block & block , bool dry_run ) ; <nl> - void finalize ( NameSet & needed_columns , NameSet & unmodified_columns , NameSet & final_columns ) ; <nl> + void execute ( Block & block ) ; <nl> } ; <nl> <nl> using ArrayJoinActionPtr = std : : shared_ptr < ArrayJoinAction > ; <nl> mmm a / src / Interpreters / ExpressionActions . cpp <nl> ppp b / src / Interpreters / ExpressionActions . cpp <nl> <nl> # include < Interpreters / Set . h > <nl> # include < Common / ProfileEvents . h > <nl> # include < Common / SipHash . h > <nl> + # include < Interpreters / ArrayJoinAction . h > <nl> # include < Interpreters / ExpressionActions . h > <nl> # include < Interpreters / ExpressionJIT . h > <nl> # include < Interpreters / TableJoin . h > <nl> # include < Interpreters / Context . h > <nl> # include < Columns / ColumnsNumber . h > <nl> + # include < Columns / ColumnArray . h > <nl> # include < Common / typeid_cast . h > <nl> # include < DataTypes / DataTypeArray . h > <nl> # include < DataTypes / DataTypesNumber . h > <nl> - # include < Functions / FunctionFactory . h > <nl> # include < Functions / IFunction . h > <nl> # include < optional > <nl> # include < Columns / ColumnSet . h > <nl> - # include < Functions / FunctionHelpers . h > <nl> <nl> # if ! defined ( ARCADIA_BUILD ) <nl> # include " config_core . h " <nl> namespace ErrorCodes <nl> extern const int NOT_FOUND_COLUMN_IN_BLOCK ; <nl> extern const int TOO_MANY_TEMPORARY_COLUMNS ; <nl> extern const int TOO_MANY_TEMPORARY_NON_CONST_COLUMNS ; <nl> + extern const int TYPE_MISMATCH ; <nl> } <nl> <nl> / / / Read comment near usage <nl> Names ExpressionAction : : getNeededColumns ( ) const <nl> { <nl> Names res = argument_names ; <nl> <nl> - if ( array_join ) <nl> - res . insert ( res . end ( ) , array_join - > columns . begin ( ) , array_join - > columns . end ( ) ) ; <nl> - <nl> if ( table_join ) <nl> res . insert ( res . end ( ) , table_join - > keyNamesLeft ( ) . begin ( ) , table_join - > keyNamesLeft ( ) . end ( ) ) ; <nl> <nl> ExpressionAction ExpressionAction : : addAliases ( const NamesWithAliases & aliased_c <nl> return a ; <nl> } <nl> <nl> - ExpressionAction ExpressionAction : : arrayJoin ( ArrayJoinActionPtr array_join_ ) <nl> + ExpressionAction ExpressionAction : : arrayJoin ( std : : string source_name , std : : string result_name ) <nl> { <nl> + if ( source_name = = result_name ) <nl> + throw Exception ( " ARRAY JOIN action should have different source and result names " , ErrorCodes : : LOGICAL_ERROR ) ; <nl> + <nl> ExpressionAction a ; <nl> a . type = ARRAY_JOIN ; <nl> - a . array_join = std : : move ( array_join_ ) ; <nl> + a . source_name = std : : move ( source_name ) ; <nl> + a . result_name = std : : move ( result_name ) ; <nl> return a ; <nl> } <nl> <nl> void ExpressionAction : : prepare ( Block & sample_block , const Settings & settings , <nl> <nl> case ARRAY_JOIN : <nl> { <nl> - array_join - > prepare ( sample_block ) ; <nl> + ColumnWithTypeAndName current = sample_block . getByName ( source_name ) ; <nl> + sample_block . erase ( source_name ) ; <nl> + <nl> + const DataTypeArray * array_type = typeid_cast < const DataTypeArray * > ( & * current . type ) ; <nl> + if ( ! array_type ) <nl> + throw Exception ( " ARRAY JOIN requires array argument " , ErrorCodes : : TYPE_MISMATCH ) ; <nl> + <nl> + current . name = result_name ; <nl> + current . type = array_type - > getNestedType ( ) ; <nl> + current . column = nullptr ; / / / Result is never const <nl> + sample_block . insert ( std : : move ( current ) ) ; <nl> + <nl> break ; <nl> } <nl> <nl> void ExpressionAction : : execute ( Block & block , bool dry_run ) const <nl> <nl> case ARRAY_JOIN : <nl> { <nl> - array_join - > execute ( block , dry_run ) ; <nl> + auto source = block . getByName ( source_name ) ; <nl> + block . erase ( source_name ) ; <nl> + source . column = source . column - > convertToFullColumnIfConst ( ) ; <nl> + <nl> + const ColumnArray * array = typeid_cast < const ColumnArray * > ( source . column . get ( ) ) ; <nl> + if ( ! array ) <nl> + throw Exception ( " ARRAY JOIN of not array : " + source_name , ErrorCodes : : TYPE_MISMATCH ) ; <nl> + <nl> + for ( auto & column : block ) <nl> + column . column = column . column - > replicate ( array - > getOffsets ( ) ) ; <nl> + <nl> + source . column = array - > getDataPtr ( ) ; <nl> + source . type = assert_cast < const DataTypeArray & > ( * source . type ) . getNestedType ( ) ; <nl> + source . name = result_name ; <nl> + <nl> + block . insert ( std : : move ( source ) ) ; <nl> + <nl> break ; <nl> } <nl> <nl> std : : string ExpressionAction : : toString ( ) const <nl> break ; <nl> <nl> case ARRAY_JOIN : <nl> - ss < < ( array_join - > is_left ? " LEFT " : " " ) < < " ARRAY JOIN " ; <nl> - for ( NameSet : : const_iterator it = array_join - > columns . begin ( ) ; it ! = array_join - > columns . end ( ) ; + + it ) <nl> - { <nl> - if ( it ! = array_join - > columns . begin ( ) ) <nl> - ss < < " , " ; <nl> - ss < < * it ; <nl> - } <nl> + ss < < " ARRAY JOIN " < < source_name < < " - > " < < result_name ; <nl> break ; <nl> <nl> case JOIN : <nl> void ExpressionActions : : addImpl ( ExpressionAction action , Names & new_names ) <nl> if ( ! action . result_name . empty ( ) ) <nl> new_names . push_back ( action . result_name ) ; <nl> <nl> - if ( action . array_join ) <nl> - new_names . insert ( new_names . end ( ) , action . array_join - > columns . begin ( ) , action . array_join - > columns . end ( ) ) ; <nl> - <nl> / / / Compiled functions are custom functions and they don ' t need building <nl> if ( action . type = = ExpressionAction : : APPLY_FUNCTION & & ! action . is_function_compiled ) <nl> { <nl> void ExpressionActions : : prependProjectInput ( ) <nl> actions . insert ( actions . begin ( ) , ExpressionAction : : project ( getRequiredColumns ( ) ) ) ; <nl> } <nl> <nl> - void ExpressionActions : : prependArrayJoin ( const ExpressionAction & action , const Block & sample_block_before ) <nl> - { <nl> - if ( action . type ! = ExpressionAction : : ARRAY_JOIN ) <nl> - throw Exception ( " ARRAY_JOIN action expected " , ErrorCodes : : LOGICAL_ERROR ) ; <nl> - <nl> - NameSet array_join_set ( action . array_join - > columns . begin ( ) , action . array_join - > columns . end ( ) ) ; <nl> - for ( auto & it : input_columns ) <nl> - { <nl> - if ( array_join_set . count ( it . name ) ) <nl> - { <nl> - array_join_set . erase ( it . name ) ; <nl> - it . type = std : : make_shared < DataTypeArray > ( it . type ) ; <nl> - } <nl> - } <nl> - for ( const std : : string & name : array_join_set ) <nl> - { <nl> - input_columns . emplace_back ( name , sample_block_before . getByName ( name ) . type ) ; <nl> - actions . insert ( actions . begin ( ) , ExpressionAction : : removeColumn ( name ) ) ; <nl> - } <nl> - <nl> - actions . insert ( actions . begin ( ) , action ) ; <nl> - optimizeArrayJoin ( ) ; <nl> - } <nl> - <nl> - <nl> - bool ExpressionActions : : popUnusedArrayJoin ( const Names & required_columns , ExpressionAction & out_action ) <nl> - { <nl> - if ( actions . empty ( ) | | actions . back ( ) . type ! = ExpressionAction : : ARRAY_JOIN ) <nl> - return false ; <nl> - NameSet required_set ( required_columns . begin ( ) , required_columns . end ( ) ) ; <nl> - for ( const std : : string & name : actions . back ( ) . array_join - > columns ) <nl> - { <nl> - if ( required_set . count ( name ) ) <nl> - return false ; <nl> - } <nl> - for ( const std : : string & name : actions . back ( ) . array_join - > columns ) <nl> - { <nl> - DataTypePtr & type = sample_block . getByName ( name ) . type ; <nl> - type = std : : make_shared < DataTypeArray > ( type ) ; <nl> - } <nl> - out_action = actions . back ( ) ; <nl> - actions . pop_back ( ) ; <nl> - return true ; <nl> - } <nl> - <nl> void ExpressionActions : : execute ( Block & block , bool dry_run ) const <nl> { <nl> for ( const auto & action : actions ) <nl> void ExpressionActions : : finalize ( const Names & output_columns ) <nl> } <nl> else if ( action . type = = ExpressionAction : : ARRAY_JOIN ) <nl> { <nl> - action . array_join - > finalize ( needed_columns , unmodified_columns , final_columns ) ; <nl> + / / / We need source anyway , in order to calculate number of rows correctly . <nl> + needed_columns . insert ( action . source_name ) ; <nl> + unmodified_columns . erase ( action . result_name ) ; <nl> + needed_columns . erase ( action . result_name ) ; <nl> + <nl> + / / / Note : technically , if result of arrayJoin is not needed , <nl> + / / / we may remove all the columns and loose the number of rows here . <nl> + / / / However , I cannot imagine how it is possible . <nl> + / / / For " big " ARRAY JOIN it could have happened in query like <nl> + / / / SELECT count ( ) FROM table ARRAY JOIN x <nl> + / / / Now , " big " ARRAY JOIN is moved to separate pipeline step , <nl> + / / / and arrayJoin ( x ) is an expression which result can ' t be lost . <nl> } <nl> else <nl> { <nl> void ExpressionActions : : finalize ( const Names & output_columns ) <nl> auto process = [ & ] ( const String & name ) <nl> { <nl> auto refcount = - - columns_refcount [ name ] ; <nl> - if ( refcount < = 0 ) <nl> + if ( refcount < = 0 & & action . type ! = ExpressionAction : : ARRAY_JOIN ) <nl> { <nl> new_actions . push_back ( ExpressionAction : : removeColumn ( name ) ) ; <nl> if ( sample_block . has ( name ) ) <nl> void ExpressionActions : : optimizeArrayJoin ( ) <nl> <nl> if ( ! actions [ i ] . result_name . empty ( ) ) <nl> array_joined_columns . insert ( actions [ i ] . result_name ) ; <nl> - if ( actions [ i ] . array_join ) <nl> - array_joined_columns . insert ( actions [ i ] . array_join - > columns . begin ( ) , actions [ i ] . array_join - > columns . end ( ) ) ; <nl> <nl> array_join_dependencies . insert ( needed . begin ( ) , needed . end ( ) ) ; <nl> } <nl> ExpressionActionsPtr ExpressionActions : : splitActionsBeforeArrayJoin ( const NameSe <nl> <nl> / / / Do not split action if input depends only on array joined columns . <nl> if ( split_actions - > input_columns . empty ( ) ) <nl> - return split_actions ; <nl> + return nullptr ; <nl> <nl> / / / Actions which depend on ARRAY JOIN result . <nl> NameSet array_join_dependent_columns = array_joined_columns ; <nl> ExpressionActionsPtr ExpressionActions : : splitActionsBeforeArrayJoin ( const NameSe <nl> / / / Add result of this action to array_join_dependent_columns too . <nl> if ( ! action . result_name . empty ( ) ) <nl> array_join_dependent_columns . insert ( action . result_name ) ; <nl> - if ( action . array_join ) <nl> - array_join_dependent_columns . insert ( action . array_join - > columns . begin ( ) , action . array_join - > columns . end ( ) ) ; <nl> <nl> / / / Add arguments of this action to array_join_dependent_columns_arguments . <nl> auto needed = action . getNeededColumns ( ) ; <nl> ExpressionActionsPtr ExpressionActions : : splitActionsBeforeArrayJoin ( const NameSe <nl> <nl> / / / Return empty actions if nothing was separated . Keep ` this ` unchanged . <nl> if ( split_actions - > getActions ( ) . empty ( ) ) <nl> - return split_actions ; <nl> + return nullptr ; <nl> <nl> std : : swap ( actions , new_actions ) ; <nl> <nl> UInt128 ExpressionAction : : ActionHash : : operator ( ) ( const ExpressionAction & action <nl> hash . update ( arg_name ) ; <nl> break ; <nl> case ARRAY_JOIN : <nl> - hash . update ( action . array_join - > is_left ) ; <nl> - for ( const auto & col : action . array_join - > columns ) <nl> - hash . update ( col ) ; <nl> + hash . update ( action . result_name ) ; <nl> + hash . update ( action . source_name ) ; <nl> break ; <nl> case JOIN : <nl> for ( const auto & col : action . table_join - > columnsAddedByJoin ( ) ) <nl> bool ExpressionAction : : operator = = ( const ExpressionAction & other ) const <nl> return false ; <nl> } <nl> <nl> - bool same_array_join = ! array_join & & ! other . array_join ; <nl> - if ( array_join & & other . array_join ) <nl> - same_array_join = ( array_join - > columns = = other . array_join - > columns ) & & <nl> - ( array_join - > is_left = = other . array_join - > is_left ) ; <nl> - <nl> return source_name = = other . source_name <nl> & & result_name = = other . result_name <nl> & & argument_names = = other . argument_names <nl> - & & same_array_join <nl> & & TableJoin : : sameJoin ( table_join . get ( ) , other . table_join . get ( ) ) <nl> & & projection = = other . projection <nl> & & is_function_compiled = = other . is_function_compiled ; <nl> std : : string ExpressionActionsChain : : dumpChain ( ) const <nl> return ss . str ( ) ; <nl> } <nl> <nl> - ExpressionActionsChain : : Step : : Step ( ArrayJoinActionPtr array_join_ , ColumnsWithTypeAndName required_columns_ ) <nl> - : kind ( Kind : : ARRAY_JOIN ) <nl> - , array_join ( std : : move ( array_join_ ) ) <nl> - , columns_after_array_join ( std : : move ( required_columns_ ) ) <nl> + ExpressionActionsChain : : ArrayJoinLink : : ArrayJoinLink ( ArrayJoinActionPtr array_join_ , ColumnsWithTypeAndName required_columns_ ) <nl> + : array_join ( std : : move ( array_join_ ) ) <nl> + , result_columns ( std : : move ( required_columns_ ) ) <nl> { <nl> - for ( auto & column : columns_after_array_join ) <nl> + for ( auto & column : result_columns ) <nl> { <nl> required_columns . emplace_back ( NameAndTypePair ( column . name , column . type ) ) ; <nl> <nl> ExpressionActionsChain : : Step : : Step ( ArrayJoinActionPtr array_join_ , ColumnsWithTy <nl> } <nl> } <nl> <nl> - void ExpressionActionsChain : : Step : : finalize ( const Names & required_output_ ) <nl> + void ExpressionActionsChain : : ArrayJoinLink : : finalize ( const Names & required_output_ ) <nl> { <nl> - switch ( kind ) <nl> + NamesAndTypesList new_required_columns ; <nl> + ColumnsWithTypeAndName new_result_columns ; <nl> + <nl> + NameSet names ( required_output_ . begin ( ) , required_output_ . end ( ) ) ; <nl> + for ( const auto & column : result_columns ) <nl> { <nl> - case Kind : : ACTIONS : <nl> - { <nl> - actions - > finalize ( required_output_ ) ; <nl> - return ; <nl> - } <nl> - case Kind : : ARRAY_JOIN : <nl> - { <nl> - NamesAndTypesList new_required_columns ; <nl> - ColumnsWithTypeAndName new_result_columns ; <nl> + if ( array_join - > columns . count ( column . name ) ! = 0 | | names . count ( column . name ) ! = 0 ) <nl> + new_result_columns . emplace_back ( column ) ; <nl> + } <nl> + for ( const auto & column : required_columns ) <nl> + { <nl> + if ( array_join - > columns . count ( column . name ) ! = 0 | | names . count ( column . name ) ! = 0 ) <nl> + new_required_columns . emplace_back ( column ) ; <nl> + } <nl> <nl> - NameSet names ( required_output_ . begin ( ) , required_output_ . end ( ) ) ; <nl> - for ( const auto & column : columns_after_array_join ) <nl> - { <nl> - if ( array_join - > columns . count ( column . name ) ! = 0 | | names . count ( column . name ) ! = 0 ) <nl> - new_result_columns . emplace_back ( column ) ; <nl> - } <nl> - for ( const auto & column : required_columns ) <nl> - { <nl> - if ( array_join - > columns . count ( column . name ) ! = 0 | | names . count ( column . name ) ! = 0 ) <nl> - new_required_columns . emplace_back ( column ) ; <nl> - } <nl> + std : : swap ( required_columns , new_required_columns ) ; <nl> + std : : swap ( result_columns , new_result_columns ) ; <nl> + } <nl> <nl> - std : : swap ( required_columns , new_required_columns ) ; <nl> - std : : swap ( columns_after_array_join , new_result_columns ) ; <nl> - return ; <nl> - } <nl> - } <nl> + ExpressionActionsChain : : Step : : Step ( ArrayJoinActionPtr array_join , ColumnsWithTypeAndName required_columns ) <nl> + : link ( ArrayJoinLink ( std : : move ( array_join ) , std : : move ( required_columns ) ) ) <nl> + { <nl> + } <nl> + <nl> + template < typename Res , typename Ptr , typename Callback > <nl> + static Res dispatch ( Ptr * ptr , Callback & & callback ) <nl> + { <nl> + if ( std : : holds_alternative < ExpressionActionsChain : : ExpressionActionsLink > ( ptr - > link ) ) <nl> + return callback ( std : : get < ExpressionActionsChain : : ExpressionActionsLink > ( ptr - > link ) ) ; <nl> + if ( std : : holds_alternative < ExpressionActionsChain : : ArrayJoinLink > ( ptr - > link ) ) <nl> + return callback ( std : : get < ExpressionActionsChain : : ArrayJoinLink > ( ptr - > link ) ) ; <nl> + <nl> + throw Exception ( " Unknown variant in ExpressionActionsChain step " , ErrorCodes : : LOGICAL_ERROR ) ; <nl> + } <nl> + <nl> + const NamesAndTypesList & ExpressionActionsChain : : Step : : getRequiredColumns ( ) const <nl> + { <nl> + using Res = const NamesAndTypesList & ; <nl> + return dispatch < Res > ( this , [ ] ( auto & x ) - > Res { return x . getRequiredColumns ( ) ; } ) ; <nl> + } <nl> + <nl> + const ColumnsWithTypeAndName & ExpressionActionsChain : : Step : : getResultColumns ( ) const <nl> + { <nl> + using Res = const ColumnsWithTypeAndName & ; <nl> + return dispatch < Res > ( this , [ ] ( auto & x ) - > Res { return x . getResultColumns ( ) ; } ) ; <nl> + } <nl> + <nl> + void ExpressionActionsChain : : Step : : finalize ( const Names & required_output_ ) <nl> + { <nl> + dispatch < void > ( this , [ & required_output_ ] ( auto & x ) { x . finalize ( required_output_ ) ; } ) ; <nl> } <nl> <nl> void ExpressionActionsChain : : Step : : prependProjectInput ( ) const <nl> { <nl> - switch ( kind ) <nl> - { <nl> - case Kind : : ACTIONS : <nl> - { <nl> - actions - > prependProjectInput ( ) ; <nl> - return ; <nl> - } <nl> - case Kind : : ARRAY_JOIN : <nl> - { <nl> - / / / TODO : remove unused columns before ARRAY JOIN ? <nl> - return ; <nl> - } <nl> - } <nl> + dispatch < void > ( this , [ ] ( auto & x ) { x . prependProjectInput ( ) ; } ) ; <nl> + } <nl> + <nl> + std : : string ExpressionActionsChain : : Step : : dump ( ) const <nl> + { <nl> + return dispatch < std : : string > ( this , [ ] ( auto & x ) { return x . dump ( ) ; } ) ; <nl> } <nl> <nl> } <nl> mmm a / src / Interpreters / ExpressionActions . h <nl> ppp b / src / Interpreters / ExpressionActions . h <nl> <nl> # include < unordered_map > <nl> # include < unordered_set > <nl> # include < Parsers / ASTTablesInSelectQuery . h > <nl> - # include < Interpreters / ArrayJoinAction . h > <nl> # include < DataTypes / DataTypeArray . h > <nl> <nl> + # include < variant > <nl> + <nl> # if ! defined ( ARCADIA_BUILD ) <nl> # include " config_core . h " <nl> # endif <nl> using DataTypePtr = std : : shared_ptr < const IDataType > ; <nl> class ExpressionActions ; <nl> class CompiledExpressionCache ; <nl> <nl> + class ArrayJoinAction ; <nl> + using ArrayJoinActionPtr = std : : shared_ptr < ArrayJoinAction > ; <nl> + <nl> / * * Action on the block . <nl> * / <nl> struct ExpressionAction <nl> struct ExpressionAction <nl> <nl> APPLY_FUNCTION , <nl> <nl> - / * * Replaces the specified columns with arrays into columns with elements . <nl> - * Duplicates the values in the remaining columns by the number of elements in the arrays . <nl> - * Arrays must be parallel ( have the same lengths ) . <nl> - * / <nl> + / / / Replaces the source column with array into column with elements . <nl> + / / / Duplicates the values in the remaining columns by the number of elements in the arrays . <nl> + / / / Source column is removed from block . <nl> ARRAY_JOIN , <nl> <nl> JOIN , <nl> struct ExpressionAction <nl> <nl> Type type { } ; <nl> <nl> - / / / For ADD / REMOVE / COPY_COLUMN . <nl> + / / / For ADD / REMOVE / ARRAY_JOIN / COPY_COLUMN . <nl> std : : string source_name ; <nl> std : : string result_name ; <nl> DataTypePtr result_type ; <nl> struct ExpressionAction <nl> Names argument_names ; <nl> bool is_function_compiled = false ; <nl> <nl> - / / / For ARRAY JOIN <nl> - ArrayJoinActionPtr array_join ; <nl> - <nl> / / / For JOIN <nl> std : : shared_ptr < const TableJoin > table_join ; <nl> JoinPtr join ; <nl> struct ExpressionAction <nl> static ExpressionAction project ( const NamesWithAliases & projected_columns_ ) ; <nl> static ExpressionAction project ( const Names & projected_columns_ ) ; <nl> static ExpressionAction addAliases ( const NamesWithAliases & aliased_columns_ ) ; <nl> - static ExpressionAction arrayJoin ( ArrayJoinActionPtr array_join_ ) ; <nl> + static ExpressionAction arrayJoin ( std : : string source_name , std : : string result_name ) ; <nl> static ExpressionAction ordinaryJoin ( std : : shared_ptr < TableJoin > table_join , JoinPtr join ) ; <nl> <nl> / / / Which columns necessary to perform this action . <nl> class ExpressionActions <nl> / / / Adds to the beginning the removal of all extra columns . <nl> void prependProjectInput ( ) ; <nl> <nl> - / / / Add the specified ARRAY JOIN action to the beginning . Change the appropriate input types to arrays . <nl> - / / / If there are unknown columns in the ARRAY JOIN list , take their types from sample_block , and immediately after ARRAY JOIN remove them . <nl> - void prependArrayJoin ( const ExpressionAction & action , const Block & sample_block_before ) ; <nl> - <nl> - / / / If the last action is ARRAY JOIN , and it does not affect the columns from required_columns , discard and return it . <nl> - / / / Change the corresponding output types to arrays . <nl> - bool popUnusedArrayJoin ( const Names & required_columns , ExpressionAction & out_action ) ; <nl> - <nl> / / / Splits actions into two parts . Returned half may be swapped with ARRAY JOIN . <nl> + / / / Returns nullptr if no actions may be moved before ARRAY JOIN . <nl> ExpressionActionsPtr splitActionsBeforeArrayJoin ( const NameSet & array_joined_columns ) ; <nl> <nl> / / / - Adds actions to delete all but the specified columns . <nl> class ExpressionActions <nl> Names getRequiredColumns ( ) const <nl> { <nl> Names names ; <nl> - for ( NamesAndTypesList : : const_iterator it = input_columns . begin ( ) ; it ! = input_columns . end ( ) ; + + it ) <nl> - names . push_back ( it - > name ) ; <nl> + for ( const auto & input : input_columns ) <nl> + names . push_back ( input . name ) ; <nl> return names ; <nl> } <nl> <nl> struct ExpressionActionsChain <nl> { <nl> explicit ExpressionActionsChain ( const Context & context_ ) : context ( context_ ) { } <nl> <nl> - struct Step <nl> + struct ExpressionActionsLink <nl> { <nl> - enum class Kind <nl> - { <nl> - ACTIONS , <nl> - ARRAY_JOIN , <nl> - } ; <nl> + ExpressionActionsPtr actions ; <nl> <nl> - Kind kind ; <nl> + const NamesAndTypesList & getRequiredColumns ( ) const { return actions - > getRequiredColumnsWithTypes ( ) ; } <nl> + const ColumnsWithTypeAndName & getResultColumns ( ) const { return actions - > getSampleBlock ( ) . getColumnsWithTypeAndName ( ) ; } <nl> + void finalize ( const Names & required_output_ ) const { actions - > finalize ( required_output_ ) ; } <nl> + void prependProjectInput ( ) const { actions - > prependProjectInput ( ) ; } <nl> + std : : string dump ( ) const { return actions - > dumpActions ( ) ; } <nl> + } ; <nl> <nl> + struct ArrayJoinLink <nl> + { <nl> ArrayJoinActionPtr array_join ; <nl> NamesAndTypesList required_columns ; <nl> - ColumnsWithTypeAndName columns_after_array_join ; <nl> + ColumnsWithTypeAndName result_columns ; <nl> + <nl> + ArrayJoinLink ( ArrayJoinActionPtr array_join_ , ColumnsWithTypeAndName required_columns_ ) ; <nl> + <nl> + const NamesAndTypesList & getRequiredColumns ( ) const { return required_columns ; } <nl> + const ColumnsWithTypeAndName & getResultColumns ( ) const { return result_columns ; } <nl> + void finalize ( const Names & required_output_ ) ; <nl> + void prependProjectInput ( ) const { } / / / TODO : remove unused columns before ARRAY JOIN ? <nl> + static std : : string dump ( ) { return " ARRAY JOIN " ; } <nl> + } ; <nl> + <nl> + struct Step <nl> + { <nl> + std : : variant < ExpressionActionsLink , ArrayJoinLink > link ; <nl> <nl> - ExpressionActionsPtr actions ; <nl> / / / Columns were added to the block before current step in addition to prev step output . <nl> NameSet additional_input ; <nl> / / / Columns which are required in the result of current step . <nl> struct ExpressionActionsChain <nl> std : : vector < bool > can_remove_required_output ; <nl> <nl> public : <nl> - explicit Step ( const ExpressionActionsPtr & actions_ = nullptr , const Names & required_output_ = Names ( ) ) <nl> - : kind ( Kind : : ACTIONS ) <nl> - , actions ( actions_ ) <nl> + explicit Step ( ExpressionActionsPtr actions , const Names & required_output_ = Names ( ) ) <nl> + : link ( ExpressionActionsLink { std : : move ( actions ) } ) <nl> , required_output ( required_output_ ) <nl> { <nl> } <nl> <nl> - explicit Step ( ArrayJoinActionPtr array_join_ , ColumnsWithTypeAndName required_columns_ ) ; <nl> - <nl> - NamesAndTypesList getRequiredColumns ( ) const <nl> - { <nl> - switch ( kind ) <nl> - { <nl> - case Kind : : ACTIONS : <nl> - return actions - > getRequiredColumnsWithTypes ( ) ; <nl> - case Kind : : ARRAY_JOIN : <nl> - return required_columns ; <nl> - } <nl> - <nl> - __builtin_unreachable ( ) ; <nl> - } <nl> - <nl> - ColumnsWithTypeAndName getResultColumns ( ) const <nl> - { <nl> - switch ( kind ) <nl> - { <nl> - case Kind : : ACTIONS : <nl> - return actions - > getSampleBlock ( ) . getColumnsWithTypeAndName ( ) ; <nl> - case Kind : : ARRAY_JOIN : <nl> - return columns_after_array_join ; <nl> - } <nl> - <nl> - __builtin_unreachable ( ) ; <nl> - } <nl> + explicit Step ( ArrayJoinActionPtr array_join , ColumnsWithTypeAndName required_columns ) ; <nl> <nl> + const NamesAndTypesList & getRequiredColumns ( ) const ; <nl> + const ColumnsWithTypeAndName & getResultColumns ( ) const ; <nl> + / / / Remove unused result and update required columns <nl> void finalize ( const Names & required_output_ ) ; <nl> - <nl> + / / / Add projections to expression <nl> void prependProjectInput ( ) const ; <nl> + std : : string dump ( ) const ; <nl> <nl> - std : : string dump ( ) const <nl> - { <nl> - switch ( kind ) <nl> - { <nl> - case Kind : : ACTIONS : <nl> - { <nl> - return actions - > dumpActions ( ) ; <nl> - } <nl> - case Kind : : ARRAY_JOIN : <nl> - { <nl> - return " ARRAY JOIN " ; <nl> - } <nl> - } <nl> - <nl> - __builtin_unreachable ( ) ; <nl> - } <nl> + ExpressionActionsPtr & actions ( ) { return std : : get < ExpressionActionsLink > ( link ) . actions ; } <nl> + const ExpressionActionsPtr & actions ( ) const { return std : : get < ExpressionActionsLink > ( link ) . actions ; } <nl> } ; <nl> <nl> using Steps = std : : vector < Step > ; <nl> struct ExpressionActionsChain <nl> throw Exception ( " Empty ExpressionActionsChain " , ErrorCodes : : LOGICAL_ERROR ) ; <nl> } <nl> <nl> - return steps . back ( ) . actions ; <nl> + return steps . back ( ) . actions ( ) ; <nl> } <nl> <nl> Step & getLastStep ( ) <nl> mmm a / src / Interpreters / ExpressionAnalyzer . cpp <nl> ppp b / src / Interpreters / ExpressionAnalyzer . cpp <nl> <nl> - # include < Poco / Util / Application . h > <nl> - # include < Poco / String . h > <nl> - <nl> # include < Core / Block . h > <nl> <nl> # include < Parsers / ASTFunction . h > <nl> # include < Parsers / ASTIdentifier . h > <nl> # include < Parsers / ASTLiteral . h > <nl> - # include < Parsers / ASTQualifiedAsterisk . h > <nl> # include < Parsers / ASTExpressionList . h > <nl> # include < Parsers / ASTSelectQuery . h > <nl> - # include < Parsers / ASTSelectWithUnionQuery . h > <nl> # include < Parsers / ASTSubquery . h > <nl> # include < Parsers / ASTOrderByElement . h > <nl> - # include < Parsers / formatAST . h > <nl> # include < Parsers / DumpASTNode . h > <nl> <nl> # include < DataTypes / DataTypeNullable . h > <nl> - # include < DataTypes / NestedUtils . h > <nl> - # include < DataTypes / DataTypesNumber . h > <nl> - # include < DataTypes / DataTypeLowCardinality . h > <nl> - <nl> # include < Columns / IColumn . h > <nl> <nl> # include < Interpreters / ExpressionAnalyzer . h > <nl> # include < Interpreters / ExpressionActions . h > <nl> - # include < Interpreters / LogicalExpressionsOptimizer . h > <nl> + # include < Interpreters / ArrayJoinAction . h > <nl> # include < Interpreters / ExternalDictionariesLoader . h > <nl> # include < Interpreters / Set . h > <nl> # include < Interpreters / TableJoin . h > <nl> <nl> # include < Storages / StorageJoin . h > <nl> <nl> # include < DataStreams / copyData . h > <nl> - # include < DataStreams / IBlockInputStream . h > <nl> <nl> - # include < Dictionaries / IDictionary . h > <nl> # include < Dictionaries / DictionaryStructure . h > <nl> <nl> # include < Common / typeid_cast . h > <nl> # include < Common / StringUtils / StringUtils . h > <nl> <nl> - # include < ext / range . h > <nl> # include < DataTypes / DataTypeFactory . h > <nl> - # include < Functions / FunctionsMiscellaneous . h > <nl> - # include < Parsers / ExpressionListParsers . h > <nl> # include < Parsers / parseQuery . h > <nl> - # include < Parsers / queryToString . h > <nl> # include < Interpreters / interpretSubquery . h > <nl> # include < Interpreters / DatabaseAndTableWithAlias . h > <nl> # include < Interpreters / misc . h > <nl> void ExpressionAnalyzer : : analyzeAggregation ( ) <nl> { <nl> getRootActionsNoMakeSet ( array_join_expression_list , true , temp_actions , false ) ; <nl> if ( auto array_join = addMultipleArrayJoinAction ( temp_actions , is_array_join_left ) ) <nl> - temp_actions - > add ( ExpressionAction : : arrayJoin ( array_join ) ) ; <nl> + { <nl> + auto sample_block = temp_actions - > getSampleBlock ( ) ; <nl> + array_join - > prepare ( sample_block ) ; <nl> + temp_actions = std : : make_shared < ExpressionActions > ( sample_block . getColumnsWithTypeAndName ( ) , context ) ; <nl> + } <nl> <nl> for ( auto & column : temp_actions - > getSampleBlock ( ) . getNamesAndTypesList ( ) ) <nl> if ( syntax - > array_join_result_to_source . count ( column . name ) ) <nl> ArrayJoinActionPtr SelectQueryExpressionAnalyzer : : appendArrayJoin ( ExpressionActi <nl> <nl> ExpressionActionsChain : : Step & step = chain . lastStep ( sourceColumns ( ) ) ; <nl> <nl> - getRootActions ( array_join_expression_list , only_types , step . actions ) ; <nl> + getRootActions ( array_join_expression_list , only_types , step . actions ( ) ) ; <nl> <nl> before_array_join = chain . getLastActions ( ) ; <nl> - auto array_join = addMultipleArrayJoinAction ( step . actions , is_array_join_left ) ; <nl> + auto array_join = addMultipleArrayJoinAction ( step . actions ( ) , is_array_join_left ) ; <nl> <nl> chain . steps . push_back ( ExpressionActionsChain : : Step ( array_join , step . getResultColumns ( ) ) ) ; <nl> <nl> bool SelectQueryExpressionAnalyzer : : appendJoinLeftKeys ( ExpressionActionsChain & <nl> { <nl> ExpressionActionsChain : : Step & step = chain . lastStep ( columns_after_array_join ) ; <nl> <nl> - getRootActions ( analyzedJoin ( ) . leftKeysList ( ) , only_types , step . actions ) ; <nl> + getRootActions ( analyzedJoin ( ) . leftKeysList ( ) , only_types , step . actions ( ) ) ; <nl> return true ; <nl> } <nl> <nl> bool SelectQueryExpressionAnalyzer : : appendJoin ( ExpressionActionsChain & chain ) <nl> <nl> ExpressionActionsChain : : Step & step = chain . lastStep ( columns_after_array_join ) ; <nl> <nl> - addJoinAction ( step . actions , table_join ) ; <nl> + addJoinAction ( step . actions ( ) , table_join ) ; <nl> return true ; <nl> } <nl> <nl> bool SelectQueryExpressionAnalyzer : : appendPrewhere ( <nl> return false ; <nl> <nl> auto & step = chain . lastStep ( sourceColumns ( ) ) ; <nl> - getRootActions ( select_query - > prewhere ( ) , only_types , step . actions ) ; <nl> + getRootActions ( select_query - > prewhere ( ) , only_types , step . actions ( ) ) ; <nl> String prewhere_column_name = select_query - > prewhere ( ) - > getColumnName ( ) ; <nl> step . required_output . push_back ( prewhere_column_name ) ; <nl> step . can_remove_required_output . push_back ( true ) ; <nl> <nl> - auto filter_type = step . actions - > getSampleBlock ( ) . getByName ( prewhere_column_name ) . type ; <nl> + auto filter_type = step . actions ( ) - > getSampleBlock ( ) . getByName ( prewhere_column_name ) . type ; <nl> if ( ! filter_type - > canBeUsedInBooleanContext ( ) ) <nl> throw Exception ( " Invalid type for filter in PREWHERE : " + filter_type - > getName ( ) , <nl> ErrorCodes : : ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER ) ; <nl> bool SelectQueryExpressionAnalyzer : : appendPrewhere ( <nl> } <nl> } <nl> <nl> - auto names = step . actions - > getSampleBlock ( ) . getNames ( ) ; <nl> + auto names = step . actions ( ) - > getSampleBlock ( ) . getNames ( ) ; <nl> NameSet name_set ( names . begin ( ) , names . end ( ) ) ; <nl> <nl> for ( const auto & column : sourceColumns ( ) ) <nl> bool SelectQueryExpressionAnalyzer : : appendPrewhere ( <nl> name_set . erase ( column . name ) ; <nl> <nl> Names required_output ( name_set . begin ( ) , name_set . end ( ) ) ; <nl> - step . actions - > finalize ( required_output ) ; <nl> + step . actions ( ) - > finalize ( required_output ) ; <nl> } <nl> <nl> { <nl> bool SelectQueryExpressionAnalyzer : : appendPrewhere ( <nl> / / / 2 . Store side columns which were calculated during prewhere actions execution if they are used . <nl> / / / Example : select F ( A ) prewhere F ( A ) > 0 . F ( A ) can be saved from prewhere step . <nl> / / / 3 . Check if we can remove filter column at prewhere step . If we can , action will store single REMOVE_COLUMN . <nl> - ColumnsWithTypeAndName columns = step . actions - > getSampleBlock ( ) . getColumnsWithTypeAndName ( ) ; <nl> - auto required_columns = step . actions - > getRequiredColumns ( ) ; <nl> + ColumnsWithTypeAndName columns = step . actions ( ) - > getSampleBlock ( ) . getColumnsWithTypeAndName ( ) ; <nl> + auto required_columns = step . actions ( ) - > getRequiredColumns ( ) ; <nl> NameSet prewhere_input_names ( required_columns . begin ( ) , required_columns . end ( ) ) ; <nl> NameSet unused_source_columns ; <nl> <nl> void SelectQueryExpressionAnalyzer : : appendPreliminaryFilter ( ExpressionActionsCha <nl> ExpressionActionsChain : : Step & step = chain . lastStep ( sourceColumns ( ) ) ; <nl> <nl> / / FIXME : assert ( filter_info ) ; <nl> - step . actions = std : : move ( actions ) ; <nl> + step = ExpressionActionsChain : : Step ( std : : move ( actions ) ) ; <nl> step . required_output . push_back ( std : : move ( column_name ) ) ; <nl> step . can_remove_required_output = { true } ; <nl> <nl> bool SelectQueryExpressionAnalyzer : : appendWhere ( ExpressionActionsChain & chain , <nl> step . required_output . push_back ( where_column_name ) ; <nl> step . can_remove_required_output = { true } ; <nl> <nl> - getRootActions ( select_query - > where ( ) , only_types , step . actions ) ; <nl> + getRootActions ( select_query - > where ( ) , only_types , step . actions ( ) ) ; <nl> <nl> - auto filter_type = step . actions - > getSampleBlock ( ) . getByName ( where_column_name ) . type ; <nl> + auto filter_type = step . actions ( ) - > getSampleBlock ( ) . getByName ( where_column_name ) . type ; <nl> if ( ! filter_type - > canBeUsedInBooleanContext ( ) ) <nl> throw Exception ( " Invalid type for filter in WHERE : " + filter_type - > getName ( ) , <nl> ErrorCodes : : ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER ) ; <nl> bool SelectQueryExpressionAnalyzer : : appendGroupBy ( ExpressionActionsChain & chain <nl> for ( const auto & ast : asts ) <nl> { <nl> step . required_output . emplace_back ( ast - > getColumnName ( ) ) ; <nl> - getRootActions ( ast , only_types , step . actions ) ; <nl> + getRootActions ( ast , only_types , step . actions ( ) ) ; <nl> } <nl> <nl> if ( optimize_aggregation_in_order ) <nl> void SelectQueryExpressionAnalyzer : : appendAggregateFunctionsArguments ( Expression <nl> / / / TODO : data . aggregates - > aggregates ( ) <nl> for ( const ASTFunction * node : data . aggregates ) <nl> for ( auto & argument : node - > arguments - > children ) <nl> - getRootActions ( argument , only_types , step . actions ) ; <nl> + getRootActions ( argument , only_types , step . actions ( ) ) ; <nl> } <nl> <nl> bool SelectQueryExpressionAnalyzer : : appendHaving ( ExpressionActionsChain & chain , bool only_types ) <nl> bool SelectQueryExpressionAnalyzer : : appendHaving ( ExpressionActionsChain & chain , <nl> ExpressionActionsChain : : Step & step = chain . lastStep ( aggregated_columns ) ; <nl> <nl> step . required_output . push_back ( select_query - > having ( ) - > getColumnName ( ) ) ; <nl> - getRootActions ( select_query - > having ( ) , only_types , step . actions ) ; <nl> + getRootActions ( select_query - > having ( ) , only_types , step . actions ( ) ) ; <nl> <nl> return true ; <nl> } <nl> void SelectQueryExpressionAnalyzer : : appendSelect ( ExpressionActionsChain & chain , <nl> <nl> ExpressionActionsChain : : Step & step = chain . lastStep ( aggregated_columns ) ; <nl> <nl> - getRootActions ( select_query - > select ( ) , only_types , step . actions ) ; <nl> + getRootActions ( select_query - > select ( ) , only_types , step . actions ( ) ) ; <nl> <nl> for ( const auto & child : select_query - > select ( ) - > children ) <nl> step . required_output . push_back ( child - > getColumnName ( ) ) ; <nl> bool SelectQueryExpressionAnalyzer : : appendOrderBy ( ExpressionActionsChain & chain <nl> <nl> ExpressionActionsChain : : Step & step = chain . lastStep ( aggregated_columns ) ; <nl> <nl> - getRootActions ( select_query - > orderBy ( ) , only_types , step . actions ) ; <nl> + getRootActions ( select_query - > orderBy ( ) , only_types , step . actions ( ) ) ; <nl> <nl> for ( auto & child : select_query - > orderBy ( ) - > children ) <nl> { <nl> bool SelectQueryExpressionAnalyzer : : appendLimitBy ( ExpressionActionsChain & chain <nl> <nl> ExpressionActionsChain : : Step & step = chain . lastStep ( aggregated_columns ) ; <nl> <nl> - getRootActions ( select_query - > limitBy ( ) , only_types , step . actions ) ; <nl> + getRootActions ( select_query - > limitBy ( ) , only_types , step . actions ( ) ) ; <nl> <nl> NameSet aggregated_names ; <nl> for ( const auto & column : aggregated_columns ) <nl> void SelectQueryExpressionAnalyzer : : appendProjectResult ( ExpressionActionsChain & <nl> } <nl> } <nl> <nl> - step . actions - > add ( ExpressionAction : : project ( result_columns ) ) ; <nl> + step . actions ( ) - > add ( ExpressionAction : : project ( result_columns ) ) ; <nl> } <nl> <nl> <nl> void ExpressionAnalyzer : : appendExpression ( ExpressionActionsChain & chain , const ASTPtr & expr , bool only_types ) <nl> { <nl> ExpressionActionsChain : : Step & step = chain . lastStep ( sourceColumns ( ) ) ; <nl> - getRootActions ( expr , only_types , step . actions ) ; <nl> + getRootActions ( expr , only_types , step . actions ( ) ) ; <nl> step . required_output . push_back ( expr - > getColumnName ( ) ) ; <nl> } <nl> <nl> ExpressionAnalysisResult : : ExpressionAnalysisResult ( <nl> if ( query_analyzer . appendPrewhere ( chain , ! first_stage , additional_required_columns_after_prewhere ) ) <nl> { <nl> prewhere_info = std : : make_shared < PrewhereInfo > ( <nl> - chain . steps . front ( ) . actions , query . prewhere ( ) - > getColumnName ( ) ) ; <nl> + chain . steps . front ( ) . actions ( ) , query . prewhere ( ) - > getColumnName ( ) ) ; <nl> <nl> if ( allowEarlyConstantFolding ( * prewhere_info - > prewhere_actions , settings ) ) <nl> { <nl> mmm a / src / Interpreters / InterpreterSystemQuery . cpp <nl> ppp b / src / Interpreters / InterpreterSystemQuery . cpp <nl> <nl> # include < Interpreters / InterpreterSystemQuery . h > <nl> - # include < Interpreters / InterpreterSystemQuery . h > <nl> # include < Common / DNSResolver . h > <nl> # include < Common / ActionLock . h > <nl> # include < Common / typeid_cast . h > <nl> mmm a / src / Interpreters / MutationsInterpreter . cpp <nl> ppp b / src / Interpreters / MutationsInterpreter . cpp <nl> ASTPtr MutationsInterpreter : : prepareInterpreterSelectQuery ( std : : vector < Stage > & <nl> actions_chain . finalize ( ) ; <nl> <nl> / / / Propagate information about columns needed as input . <nl> - for ( const auto & column : actions_chain . steps . front ( ) . actions - > getRequiredColumnsWithTypes ( ) ) <nl> + for ( const auto & column : actions_chain . steps . front ( ) . actions ( ) - > getRequiredColumnsWithTypes ( ) ) <nl> prepared_stages [ i - 1 ] . output_columns . insert ( column . name ) ; <nl> } <nl> <nl> BlockInputStreamPtr MutationsInterpreter : : addStreamsForLaterStages ( const std : : ve <nl> if ( i < stage . filter_column_names . size ( ) ) <nl> { <nl> / / / Execute DELETEs . <nl> - in = std : : make_shared < FilterBlockInputStream > ( in , step . actions , stage . filter_column_names [ i ] ) ; <nl> + in = std : : make_shared < FilterBlockInputStream > ( in , step . actions ( ) , stage . filter_column_names [ i ] ) ; <nl> } <nl> else <nl> { <nl> / / / Execute UPDATE or final projection . <nl> - in = std : : make_shared < ExpressionBlockInputStream > ( in , step . actions ) ; <nl> + in = std : : make_shared < ExpressionBlockInputStream > ( in , step . actions ( ) ) ; <nl> } <nl> } <nl> <nl> mmm a / src / Processors / QueryPlan / ExpressionStep . cpp <nl> ppp b / src / Processors / QueryPlan / ExpressionStep . cpp <nl> ExpressionStep : : ExpressionStep ( const DataStream & input_stream_ , ExpressionActio <nl> updateDistinctColumns ( output_stream - > header , output_stream - > distinct_columns ) ; <nl> } <nl> <nl> - void ExpressionStep : : updateInputStream ( DataStream input_stream , Block result_header ) <nl> + void ExpressionStep : : updateInputStream ( DataStream input_stream , bool keep_header ) <nl> { <nl> + Block out_header = keep_header ? std : : move ( output_stream - > header ) <nl> + : Transform : : transformHeader ( input_stream . header , expression ) ; <nl> output_stream = createOutputStream ( <nl> input_stream , <nl> - res_header ? res_header : Transform : : transformHeader ( input_stream . header , expression ) , <nl> + std : : move ( out_header ) , <nl> getDataStreamTraits ( ) ) ; <nl> <nl> input_streams . clear ( ) ; <nl> input_streams . emplace_back ( std : : move ( input_stream ) ) ; <nl> - res_header = std : : move ( result_header ) ; <nl> } <nl> <nl> void ExpressionStep : : transformPipeline ( QueryPipeline & pipeline ) <nl> void ExpressionStep : : transformPipeline ( QueryPipeline & pipeline ) <nl> return std : : make_shared < Transform > ( header , expression , on_totals ) ; <nl> } ) ; <nl> <nl> - if ( res_header & & ! blocksHaveEqualStructure ( res_header , output_stream - > header ) ) <nl> + if ( ! blocksHaveEqualStructure ( pipeline . getHeader ( ) , output_stream - > header ) ) <nl> { <nl> pipeline . addSimpleTransform ( [ & ] ( const Block & header ) <nl> { <nl> - return std : : make_shared < ConvertingTransform > ( header , res_header , ConvertingTransform : : MatchColumnsMode : : Name ) ; <nl> + return std : : make_shared < ConvertingTransform > ( header , output_stream - > header , <nl> + ConvertingTransform : : MatchColumnsMode : : Name ) ; <nl> } ) ; <nl> } <nl> } <nl> mmm a / src / Processors / QueryPlan / ExpressionStep . h <nl> ppp b / src / Processors / QueryPlan / ExpressionStep . h <nl> class ExpressionStep : public ITransformingStep <nl> <nl> void transformPipeline ( QueryPipeline & pipeline ) override ; <nl> <nl> - void updateInputStream ( DataStream input_stream , Block result_header ) ; <nl> + void updateInputStream ( DataStream input_stream , bool keep_header ) ; <nl> <nl> void describeActions ( FormatSettings & settings ) const override ; <nl> <nl> class ExpressionStep : public ITransformingStep <nl> <nl> private : <nl> ExpressionActionsPtr expression ; <nl> - Block res_header ; <nl> } ; <nl> <nl> / / / TODO : add separate step for join . <nl> mmm a / src / Processors / QueryPlan / FilterStep . cpp <nl> ppp b / src / Processors / QueryPlan / FilterStep . cpp <nl> FilterStep : : FilterStep ( <nl> updateDistinctColumns ( output_stream - > header , output_stream - > distinct_columns ) ; <nl> } <nl> <nl> - void FilterStep : : updateInputStream ( DataStream input_stream , Block result_header ) <nl> + void FilterStep : : updateInputStream ( DataStream input_stream , bool keep_header ) <nl> { <nl> + Block out_header = std : : move ( output_stream - > header ) ; <nl> + if ( keep_header ) <nl> + out_header = FilterTransform : : transformHeader ( input_stream . header , expression , filter_column_name , remove_filter_column ) ; <nl> + <nl> output_stream = createOutputStream ( <nl> input_stream , <nl> - res_header ? res_header : FilterTransform : : transformHeader ( input_stream . header , expression , filter_column_name , remove_filter_column ) , <nl> + std : : move ( out_header ) , <nl> getDataStreamTraits ( ) ) ; <nl> <nl> input_streams . clear ( ) ; <nl> input_streams . emplace_back ( std : : move ( input_stream ) ) ; <nl> - res_header = std : : move ( result_header ) ; <nl> } <nl> <nl> void FilterStep : : transformPipeline ( QueryPipeline & pipeline ) <nl> void FilterStep : : transformPipeline ( QueryPipeline & pipeline ) <nl> return std : : make_shared < FilterTransform > ( header , expression , filter_column_name , remove_filter_column , on_totals ) ; <nl> } ) ; <nl> <nl> - if ( res_header & & ! blocksHaveEqualStructure ( res_header , output_stream - > header ) ) <nl> + if ( ! blocksHaveEqualStructure ( pipeline . getHeader ( ) , output_stream - > header ) ) <nl> { <nl> pipeline . addSimpleTransform ( [ & ] ( const Block & header ) <nl> { <nl> - return std : : make_shared < ConvertingTransform > ( header , res_header , ConvertingTransform : : MatchColumnsMode : : Name ) ; <nl> + return std : : make_shared < ConvertingTransform > ( header , output_stream - > header , ConvertingTransform : : MatchColumnsMode : : Name ) ; <nl> } ) ; <nl> } <nl> } <nl> mmm a / src / Processors / QueryPlan / FilterStep . h <nl> ppp b / src / Processors / QueryPlan / FilterStep . h <nl> class FilterStep : public ITransformingStep <nl> String getName ( ) const override { return " Filter " ; } <nl> void transformPipeline ( QueryPipeline & pipeline ) override ; <nl> <nl> - void updateInputStream ( DataStream input_stream , Block result_header ) ; <nl> + void updateInputStream ( DataStream input_stream , bool keep_header ) ; <nl> <nl> void describeActions ( FormatSettings & settings ) const override ; <nl> <nl> class FilterStep : public ITransformingStep <nl> ExpressionActionsPtr expression ; <nl> String filter_column_name ; <nl> bool remove_filter_column ; <nl> - Block res_header ; <nl> } ; <nl> <nl> } <nl> mmm a / src / Processors / QueryPlan / QueryPlan . cpp <nl> ppp b / src / Processors / QueryPlan / QueryPlan . cpp <nl> static void tryPushDownLimit ( QueryPlanStepPtr & parent , QueryPlan : : Node * child_ <nl> parent . swap ( child ) ; <nl> } <nl> <nl> + / / / Move ARRAY JOIN up if possible . <nl> static void tryLiftUpArrayJoin ( QueryPlan : : Node * parent_node , QueryPlan : : Node * child_node , QueryPlan : : Nodes & nodes ) <nl> { <nl> auto & parent = parent_node - > step ; <nl> static void tryLiftUpArrayJoin ( QueryPlan : : Node * parent_node , QueryPlan : : Node * <nl> auto split_actions = expression - > splitActionsBeforeArrayJoin ( array_join - > columns ) ; <nl> <nl> / / / No actions can be moved before ARRAY JOIN . <nl> - if ( split_actions - > getActions ( ) . empty ( ) ) <nl> + if ( ! split_actions ) <nl> return ; <nl> <nl> - auto expected_header = parent - > getOutputStream ( ) . header ; <nl> - <nl> / / / All actions was moved before ARRAY JOIN . Swap Expression and ArrayJoin . <nl> if ( expression - > getActions ( ) . empty ( ) ) <nl> { <nl> - / / / Expression - > ArrayJoin <nl> + auto expected_header = parent - > getOutputStream ( ) . header ; <nl> + <nl> + / / / Expression / Filter - > ArrayJoin <nl> std : : swap ( parent , child ) ; <nl> - / / / ArrayJoin - > Expression <nl> + / / / ArrayJoin - > Expression / Filter <nl> + <nl> if ( expression_step ) <nl> child = std : : make_unique < ExpressionStep > ( child_node - > children . at ( 0 ) - > step - > getOutputStream ( ) , <nl> std : : move ( split_actions ) ) ; <nl> static void tryLiftUpArrayJoin ( QueryPlan : : Node * parent_node , QueryPlan : : Node * <nl> node . children . swap ( child_node - > children ) ; <nl> child_node - > children . emplace_back ( & node ) ; <nl> / / / Expression / Filter - > ArrayJoin - > node - > Something <nl> - / / if ( filter_step & & split_actions - > getSampleBlock ( ) . has ( filter_step - > getFilterColumnName ( ) ) ) <nl> - / / { <nl> - / / / / / Filter - > ArrayJoin - > node - > Something <nl> - / / node . step = std : : make_unique < FilterStep > ( node . children . at ( 0 ) - > step - > getOutputStream ( ) , <nl> - / / std : : move ( split_actions ) , <nl> - / / filter_step - > getFilterColumnName ( ) , <nl> - / / filter_step - > removesFilterColumn ( ) ) ; <nl> - / / <nl> - / / array_join_step - > updateInputStream ( node . step - > getOutputStream ( ) ) ; <nl> - / / <nl> - / / parent = std : : make_unique < ExpressionStep > ( array_join_step - > getOutputStream ( ) , <nl> - / / filter_step - > getExpression ( ) ) ; <nl> - / / / / / Expression - > ArrayJoin - > Filter - > Something <nl> - / / } <nl> <nl> node . step = std : : make_unique < ExpressionStep > ( node . children . at ( 0 ) - > step - > getOutputStream ( ) , <nl> std : : move ( split_actions ) ) ; <nl> array_join_step - > updateInputStream ( node . step - > getOutputStream ( ) , { } ) ; <nl> - expression_step ? expression_step - > updateInputStream ( array_join_step - > getOutputStream ( ) , expected_header ) <nl> - : filter_step - > updateInputStream ( array_join_step - > getOutputStream ( ) , expected_header ) ; <nl> + expression_step ? expression_step - > updateInputStream ( array_join_step - > getOutputStream ( ) , true ) <nl> + : filter_step - > updateInputStream ( array_join_step - > getOutputStream ( ) , true ) ; <nl> } <nl> <nl> void QueryPlan : : optimize ( ) <nl> mmm a / src / Processors / Transforms / ArrayJoinTransform . cpp <nl> ppp b / src / Processors / Transforms / ArrayJoinTransform . cpp <nl> namespace ErrorCodes <nl> <nl> Block ArrayJoinTransform : : transformHeader ( Block header , const ArrayJoinActionPtr & array_join ) <nl> { <nl> - array_join - > execute ( header , true ) ; <nl> + array_join - > execute ( header ) ; <nl> return header ; <nl> } <nl> <nl> ArrayJoinTransform : : ArrayJoinTransform ( <nl> void ArrayJoinTransform : : transform ( Chunk & chunk ) <nl> { <nl> auto block = getInputPort ( ) . getHeader ( ) . cloneWithColumns ( chunk . detachColumns ( ) ) ; <nl> - array_join - > execute ( block , false ) ; <nl> + array_join - > execute ( block ) ; <nl> chunk . setColumns ( block . getColumns ( ) , block . rows ( ) ) ; <nl> } <nl> <nl>
|
Refactor ActionsChain .
|
ClickHouse/ClickHouse
|
8e631a98eab55a31b6f40b701b3a51c39d91df1c
|
2020-08-14T18:24:58Z
|
mmm a / arangod / Agency / Supervision . cpp <nl> ppp b / arangod / Agency / Supervision . cpp <nl> bool Supervision : : updateSnapshot ( ) { <nl> _agent - > executeLockedRead ( [ & ] ( ) { <nl> logs = _agent - > logs ( _lastUpdateIndex + 1 ) ; <nl> } ) ; <nl> - if ( logs . size ( ) > 0 ) { <nl> + if ( ! logs . empty ( ) & & ! ( logs . size ( ) = = 1 & & _lastUpdateIndex = = logs . front ( ) . index ) ) { <nl> _lastUpdateIndex = _spearhead . applyTransactions ( logs ) ; <nl> _snapshot = _spearhead . nodePtr ( _agencyPrefix ) ; <nl> } <nl>
|
fix newly created supervision bug with incremental updates ( )
|
arangodb/arangodb
|
4874cc801e6f1cbbe44ab2169c5fcbceb7800f76
|
2020-03-13T20:24:57Z
|
mmm a / qa / replace - by - fee / rbf - tests . py <nl> ppp b / qa / replace - by - fee / rbf - tests . py <nl> def branch ( prevout , initial_value , max_txs , * , tree_width = 5 , fee = 0 . 0001 * COIN , _t <nl> self . proxy . getrawtransaction ( tx . GetHash ( ) ) <nl> <nl> def test_replacement_feeperkb ( self ) : <nl> - " " " Replacement requires overall fee - per - KB to be higher " " " <nl> + " " " Replacement requires fee - per - KB to be higher " " " <nl> tx0_outpoint = self . make_txout ( 1 . 1 * COIN ) <nl> <nl> tx1a = CTransaction ( [ CTxIn ( tx0_outpoint , nSequence = 0 ) ] , <nl> mmm a / src / main . cpp <nl> ppp b / src / main . cpp <nl> bool AcceptToMemoryPool ( CTxMemPool & pool , CValidationState & state , const CTransa <nl> { <nl> LOCK ( pool . cs ) ; <nl> <nl> - / / For efficiency we simply sum up the pre - calculated <nl> - / / fees / size - with - descendants values from the mempool package <nl> - / / tracking ; this does mean the pathological case of diamond tx <nl> - / / graphs will be overcounted . <nl> + CFeeRate newFeeRate ( nFees , nSize ) ; <nl> BOOST_FOREACH ( const uint256 hashConflicting , setConflicts ) <nl> { <nl> CTxMemPool : : txiter mi = pool . mapTx . find ( hashConflicting ) ; <nl> if ( mi = = pool . mapTx . end ( ) ) <nl> continue ; <nl> + <nl> + / / Don ' t allow the replacement to reduce the feerate of the <nl> + / / mempool . <nl> + / / <nl> + / / We usually don ' t want to accept replacements with lower <nl> + / / feerates than what they replaced as that would lower the <nl> + / / feerate of the next block . Requiring that the feerate always <nl> + / / be increased is also an easy - to - reason about way to prevent <nl> + / / DoS attacks via replacements . <nl> + / / <nl> + / / The mining code doesn ' t ( currently ) take children into <nl> + / / account ( CPFP ) so we only consider the feerates of <nl> + / / transactions being directly replaced , not their indirect <nl> + / / descendants . While that does mean high feerate children are <nl> + / / ignored when deciding whether or not to replace , we do <nl> + / / require the replacement to pay more overall fees too , <nl> + / / mitigating most cases . <nl> + CFeeRate oldFeeRate ( mi - > GetFee ( ) , mi - > GetTxSize ( ) ) ; <nl> + if ( newFeeRate < = oldFeeRate ) <nl> + { <nl> + return state . DoS ( 0 , <nl> + error ( " AcceptToMemoryPool : rejecting replacement % s ; new feerate % s < = old feerate % s " , <nl> + hash . ToString ( ) , <nl> + newFeeRate . ToString ( ) , <nl> + oldFeeRate . ToString ( ) ) , <nl> + REJECT_INSUFFICIENTFEE , " insufficient fee " ) ; <nl> + } <nl> + <nl> + / / For efficiency we simply sum up the pre - calculated <nl> + / / fees / size - with - descendants values from the mempool package <nl> + / / tracking ; this does mean the pathological case of diamond tx <nl> + / / graphs will be overcounted . <nl> nConflictingFees + = mi - > GetFeesWithDescendants ( ) ; <nl> nConflictingSize + = mi - > GetSizeWithDescendants ( ) ; <nl> } <nl> <nl> - / / First of all we can ' t allow a replacement unless it pays greater <nl> - / / fees than the transactions it conflicts with - if we did the <nl> - / / bandwidth used by those conflicting transactions would not be <nl> - / / paid for <nl> + / / The replacement must pay greater fees than the transactions it <nl> + / / replaces - if we did the bandwidth used by those conflicting <nl> + / / transactions would not be paid for . <nl> if ( nFees < nConflictingFees ) <nl> { <nl> return state . DoS ( 0 , error ( " AcceptToMemoryPool : rejecting replacement % s , less fees than conflicting txs ; % s < % s " , <nl> bool AcceptToMemoryPool ( CTxMemPool & pool , CValidationState & state , const CTransa <nl> REJECT_INSUFFICIENTFEE , " insufficient fee " ) ; <nl> } <nl> <nl> - / / Secondly in addition to paying more fees than the conflicts the <nl> - / / new transaction must additionally pay for its own bandwidth . <nl> + / / Finally in addition to paying more fees than the conflicts the <nl> + / / new transaction must pay for its own bandwidth . <nl> CAmount nDeltaFees = nFees - nConflictingFees ; <nl> if ( nDeltaFees < : : minRelayTxFee . GetFee ( nSize ) ) <nl> { <nl> bool AcceptToMemoryPool ( CTxMemPool & pool , CValidationState & state , const CTransa <nl> FormatMoney ( : : minRelayTxFee . GetFee ( nSize ) ) ) , <nl> REJECT_INSUFFICIENTFEE , " insufficient fee " ) ; <nl> } <nl> - <nl> - / / Finally replace only if we end up with a larger fees - per - kb than <nl> - / / the replacements . <nl> - CFeeRate oldFeeRate ( nConflictingFees , nConflictingSize ) ; <nl> - CFeeRate newFeeRate ( nFees , nSize ) ; <nl> - if ( newFeeRate < = oldFeeRate ) <nl> - { <nl> - return state . DoS ( 0 , <nl> - error ( " AcceptToMemoryPool : rejecting replacement % s ; new feerate % s < = old feerate % s " , <nl> - hash . ToString ( ) , <nl> - newFeeRate . ToString ( ) , <nl> - oldFeeRate . ToString ( ) ) , <nl> - REJECT_INSUFFICIENTFEE , " insufficient fee " ) ; <nl> - } <nl> } <nl> <nl> / / Check against previous transactions <nl>
|
Prevent low feerate txs from ( directly ) replacing high feerate txs
|
bitcoin/bitcoin
|
fc8c19a07c20ab63f6a69f7494f486204d8f2b7a
|
2015-11-10T19:14:07Z
|
mmm a / code / data_structures / src / list / singly_linked_list / menu_interface / singly_list . c <nl> ppp b / code / data_structures / src / list / singly_linked_list / menu_interface / singly_list . c <nl> int menu ( ) <nl> display ( ) ; <nl> usleep ( 5000000 ) ; <nl> break ; <nl> - <nl> + case 13 : <nl> + reverse ( ) ; <nl> + break ; <nl> + case 14 : <nl> + sortlist ( ) ; <nl> + break ; <nl> + case 15 : <nl> + printf ( " Enter the name of file to write to : " ) ; <nl> + scanf ( " % s " , filename ) ; <nl> + writefile ( filename ) ; <nl> + break ; <nl> + case 16 : <nl> + listfile ( ) ; <nl> + printf ( " Enter the name of file to read from : " ) ; <nl> + scanf ( " % s " , filename ) ; <nl> + readfile ( filename ) ; <nl> + break ; <nl> + case 17 : <nl> + return n ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + void clear ( void ) <nl> + { <nl> + printf ( " \ 033 [ 2J " ) ; <nl> + printf ( " \ 033 [ % d ; % dH " , 0 , 0 ) ; <nl> + } <nl>
|
miscellaneous operations added
|
OpenGenus/cosmos
|
c5107bf2579c7159758b5cf68b82b9736b3ae610
|
2019-03-20T21:45:51Z
|
mmm a / swoole_http_client_coro . cc <nl> ppp b / swoole_http_client_coro . cc <nl> typedef struct <nl> zval * download_file ; <nl> off_t download_offset ; <nl> const char * request_method ; <nl> - int callback_index ; <nl> <nl> uint8_t error_flag ; <nl> uint8_t shutdown ; <nl> static int http_client_coro_send_request ( zval * zobject , http_client_coro_propert <nl> zval * value = NULL ; <nl> uint32_t header_flag = 0x0 ; <nl> <nl> - / / POST <nl> - if ( hcc - > request_method = = NULL ) <nl> + char * method ; <nl> + zval * zmethod = sw_zend_read_property_not_null ( swoole_http_client_coro_class_entry_ptr , zobject , ZEND_STRL ( " requestMethod " ) , 1 ) ; <nl> + if ( zmethod ) <nl> { <nl> - if ( post_data ) <nl> - { <nl> - hcc - > request_method = " POST " ; <nl> - } <nl> - / / GET <nl> - else <nl> - { <nl> - hcc - > request_method = " GET " ; <nl> - } <nl> + convert_to_string ( zmethod ) ; <nl> + method = Z_STRVAL_P ( zmethod ) ; <nl> } <nl> - <nl> - http - > method = swHttp_get_method ( hcc - > request_method , strlen ( hcc - > request_method ) + 1 ) ; <nl> + else <nl> + { <nl> + method = ( char * ) ( post_data ? " POST " : " GET " ) ; <nl> + } <nl> + http - > method = swHttp_get_method ( method , strlen ( method ) + 1 ) ; <nl> <nl> swString_clear ( http_client_buffer ) ; <nl> - swString_append_ptr ( http_client_buffer , ( char * ) hcc - > request_method , strlen ( hcc - > request_method ) ) ; <nl> - hcc - > request_method = NULL ; <nl> + swString_append_ptr ( http_client_buffer , method , strlen ( method ) ) ; <nl> swString_append_ptr ( http_client_buffer , ZEND_STRL ( " " ) ) ; <nl> <nl> # ifdef SW_USE_OPENSSL <nl> static PHP_METHOD ( swoole_http_client_coro , __destruct ) <nl> static PHP_METHOD ( swoole_http_client_coro , set ) <nl> { <nl> zval * zset ; <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " z " , & zset ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> - if ( Z_TYPE_P ( zset ) ! = IS_ARRAY ) <nl> - { <nl> - RETURN_FALSE ; <nl> - } <nl> + <nl> + ZEND_PARSE_PARAMETERS_START ( 1 , 1 ) <nl> + Z_PARAM_ARRAY ( zset ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> + <nl> zval * zsetting = sw_zend_read_property_array ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " setting " ) , 1 ) ; <nl> php_array_merge ( Z_ARRVAL_P ( zsetting ) , Z_ARRVAL_P ( zset ) ) ; <nl> RETURN_TRUE ; <nl> static PHP_METHOD ( swoole_http_client_coro , set ) <nl> static PHP_METHOD ( swoole_http_client_coro , setHeaders ) <nl> { <nl> zval * headers ; <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " z " , & headers ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> + <nl> + ZEND_PARSE_PARAMETERS_START ( 1 , 1 ) <nl> + Z_PARAM_ARRAY ( headers ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> + <nl> zend_update_property ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " requestHeaders " ) , headers ) ; <nl> http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> hcc - > request_header = sw_zend_read_property ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " requestHeaders " ) , 1 ) ; <nl> static PHP_METHOD ( swoole_http_client_coro , setHeaders ) <nl> static PHP_METHOD ( swoole_http_client_coro , setCookies ) <nl> { <nl> zval * cookies ; <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " z " , & cookies ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> + <nl> + ZEND_PARSE_PARAMETERS_START ( 1 , 1 ) <nl> + Z_PARAM_ARRAY ( cookies ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> + <nl> zend_update_property ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " cookies " ) , cookies ) ; <nl> http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> hcc - > cookies = sw_zend_read_property ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " cookies " ) , 1 ) ; <nl> static PHP_METHOD ( swoole_http_client_coro , setDefer ) <nl> zend_bool defer = 1 ; <nl> http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " | b " , & defer ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> + ZEND_PARSE_PARAMETERS_START ( 1 , 1 ) <nl> + Z_PARAM_OPTIONAL <nl> + Z_PARAM_BOOL ( defer ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> <nl> hcc - > defer = defer ; <nl> <nl> static PHP_METHOD ( swoole_http_client_coro , recv ) <nl> { <nl> http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> http_client * http = ( http_client * ) swoole_get_object ( getThis ( ) ) ; <nl> + double timeout = http - > timeout ; <nl> + <nl> if ( ! http ) <nl> { <nl> SwooleG . error = SW_ERROR_CLIENT_NO_CONNECTION ; <nl> zend_update_property_long ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " errCode " ) , SwooleG . error ) ; <nl> RETURN_FALSE ; <nl> } <nl> - double timeout = http - > timeout ; <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " | d " , & timeout ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> + <nl> + ZEND_PARSE_PARAMETERS_START ( 0 , 1 ) <nl> + Z_PARAM_OPTIONAL <nl> + Z_PARAM_DOUBLE ( timeout ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> <nl> if ( timeout ! = 0 ) <nl> { <nl> static PHP_METHOD ( swoole_http_client_coro , recv ) <nl> <nl> static PHP_METHOD ( swoole_http_client_coro , setData ) <nl> { <nl> - zval * data ; <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " z " , & data ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> - zend_update_property ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " requestBody " ) , data ) ; <nl> + char * data ; <nl> + size_t data_len ; <nl> + <nl> + ZEND_PARSE_PARAMETERS_START ( 1 , 1 ) <nl> + Z_PARAM_STRING ( data , data_len ) <nl> + ZEND_PARSE_PARAMETERS_END ( ) ; <nl> + <nl> + zend_update_property_stringl ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " requestBody " ) , data , data_len ) ; <nl> http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> hcc - > request_body = sw_zend_read_property ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " requestBody " ) , 1 ) ; <nl> + sw_copy_to_stack ( hcc - > request_body , hcc - > _request_body ) ; <nl> RETURN_TRUE ; <nl> } <nl> <nl> static PHP_METHOD ( swoole_http_client_coro , addFile ) <nl> zend_size_t l_type ; <nl> char * filename = NULL ; <nl> zend_size_t l_filename ; <nl> - long offset = 0 ; <nl> - long length = 0 ; <nl> + zend_long offset = 0 ; <nl> + zend_long length = 0 ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " ss | ssll " , & path , & l_path , & name , & l_name , & type , & l_type , <nl> & filename , & l_filename , & offset , & length ) = = FAILURE ) <nl> { <nl> RETURN_FALSE ; <nl> } <nl> + <nl> + ZEND_PARSE_PARAMETERS_START ( 2 , 6 ) <nl> + Z_PARAM_STRING ( path , l_path ) <nl> + Z_PARAM_STRING ( name , l_name ) <nl> + Z_PARAM_OPTIONAL <nl> + Z_PARAM_STRING ( type , l_type ) <nl> + Z_PARAM_STRING ( filename , l_filename ) <nl> + Z_PARAM_LONG ( offset ) <nl> + Z_PARAM_LONG ( length ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> + <nl> if ( offset < 0 ) <nl> { <nl> offset = 0 ; <nl> static PHP_METHOD ( swoole_http_client_coro , addFile ) <nl> add_assoc_long ( upload_file , " offset " , offset ) ; <nl> <nl> add_next_index_zval ( hcc - > request_upload_files , upload_file ) ; <nl> + <nl> RETURN_TRUE ; <nl> } <nl> <nl> static PHP_METHOD ( swoole_http_client_coro , addData ) <nl> char * filename = NULL ; <nl> zend_size_t l_filename ; <nl> <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " ss | ss " , & data , & l_data , & name , & l_name , & type , & l_type , <nl> - & filename , & l_filename ) = = FAILURE ) <nl> - { <nl> - RETURN_FALSE ; <nl> - } <nl> + ZEND_PARSE_PARAMETERS_START ( 2 , 4 ) <nl> + Z_PARAM_STRING ( data , l_data ) <nl> + Z_PARAM_STRING ( name , l_name ) <nl> + Z_PARAM_OPTIONAL <nl> + Z_PARAM_STRING ( type , l_type ) <nl> + Z_PARAM_STRING ( filename , l_filename ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> + <nl> if ( type = = NULL ) <nl> { <nl> type = ( char * ) " application / octet - stream " ; <nl> static PHP_METHOD ( swoole_http_client_coro , addData ) <nl> static PHP_METHOD ( swoole_http_client_coro , setMethod ) <nl> { <nl> zval * method ; <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " z " , & method ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> - convert_to_string ( method ) ; <nl> + <nl> + ZEND_PARSE_PARAMETERS_START ( 1 , 1 ) <nl> + Z_PARAM_ZVAL ( method ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> + <nl> zend_update_property ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " requestMethod " ) , method ) ; <nl> - http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> - hcc - > request_method = Z_STRVAL_P ( method ) ; <nl> RETURN_TRUE ; <nl> } <nl> <nl> static PHP_METHOD ( swoole_http_client_coro , execute ) <nl> { <nl> char * uri = NULL ; <nl> zend_size_t uri_len = 0 ; <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " s " , & uri , & uri_len ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> + <nl> + ZEND_PARSE_PARAMETERS_START ( 1 , 1 ) <nl> + Z_PARAM_STRING ( uri , uri_len ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> + <nl> SW_CHECK_RETURN ( http_client_coro_execute ( getThis ( ) , hcc , uri , uri_len ) ) ; <nl> } <nl> <nl> static PHP_METHOD ( swoole_http_client_coro , get ) <nl> { <nl> char * uri = NULL ; <nl> zend_size_t uri_len = 0 ; <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " s " , & uri , & uri_len ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> - <nl> http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> + <nl> + ZEND_PARSE_PARAMETERS_START ( 1 , 1 ) <nl> + Z_PARAM_STRING ( uri , uri_len ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> + <nl> SW_CHECK_RETURN ( http_client_coro_execute ( getThis ( ) , hcc , uri , uri_len ) ) ; <nl> } <nl> <nl> static PHP_METHOD ( swoole_http_client_coro , post ) <nl> char * uri = NULL ; <nl> zend_size_t uri_len = 0 ; <nl> zval * post_data ; <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " sz " , & uri , & uri_len , & post_data ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> + http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> + <nl> + ZEND_PARSE_PARAMETERS_START ( 2 , 2 ) <nl> + Z_PARAM_STRING ( uri , uri_len ) <nl> + Z_PARAM_ZVAL ( post_data ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> <nl> if ( Z_TYPE_P ( post_data ) ! = IS_ARRAY & & Z_TYPE_P ( post_data ) ! = IS_STRING ) <nl> { <nl> static PHP_METHOD ( swoole_http_client_coro , post ) <nl> RETURN_FALSE ; <nl> } <nl> <nl> - http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> zend_update_property ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " requestBody " ) , post_data ) ; <nl> hcc - > request_body = sw_zend_read_property ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " requestBody " ) , 1 ) ; <nl> sw_copy_to_stack ( hcc - > request_body , hcc - > _request_body ) ; <nl> static PHP_METHOD ( swoole_http_client_coro , download ) <nl> char * uri = NULL ; <nl> zend_size_t uri_len = 0 ; <nl> zval * download_file ; <nl> - off_t offset = 0 ; <nl> + zend_long offset = 0 ; <nl> + http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " sz | l " , & uri , & uri_len , & download_file , & offset ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> + ZEND_PARSE_PARAMETERS_START ( 2 , 3 ) <nl> + Z_PARAM_STRING ( uri , uri_len ) <nl> + Z_PARAM_ZVAL ( download_file ) <nl> + Z_PARAM_OPTIONAL <nl> + Z_PARAM_LONG ( offset ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> <nl> - http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> zend_update_property ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " downloadFile " ) , download_file ) ; <nl> hcc - > download_file = sw_zend_read_property ( swoole_http_client_coro_class_entry_ptr , getThis ( ) , ZEND_STRL ( " downloadFile " ) , 1 ) ; <nl> hcc - > download_offset = offset ; <nl> static PHP_METHOD ( swoole_http_client_coro , upgrade ) <nl> { <nl> char * uri = NULL ; <nl> zend_size_t uri_len = 0 ; <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " s " , & uri , & uri_len ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> - <nl> http_client_coro_property * hcc = ( http_client_coro_property * ) swoole_get_property ( getThis ( ) , 0 ) ; <nl> <nl> + ZEND_PARSE_PARAMETERS_START ( 1 , 1 ) <nl> + Z_PARAM_STRING ( uri , uri_len ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> + <nl> zval * headers = hcc - > request_header ; <nl> if ( hcc - > request_header = = NULL ) <nl> { <nl> static PHP_METHOD ( swoole_http_client_coro , push ) <nl> zend_long opcode = WEBSOCKET_OPCODE_TEXT ; <nl> zend_bool fin = 1 ; <nl> <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) , " z | lb " , & zdata , & opcode , & fin ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> + ZEND_PARSE_PARAMETERS_START ( 1 , 3 ) <nl> + Z_PARAM_ZVAL ( zdata ) <nl> + Z_PARAM_OPTIONAL <nl> + Z_PARAM_LONG ( opcode ) <nl> + Z_PARAM_BOOL ( fin ) <nl> + ZEND_PARSE_PARAMETERS_END_EX ( RETURN_FALSE ) ; <nl> <nl> http_client * http = ( http_client * ) swoole_get_object ( getThis ( ) ) ; <nl> <nl>
|
Use FAST_ZPP in http client coro .
|
swoole/swoole-src
|
7d9e831da424d92344a9e3da91ffcc1c407dd6d8
|
2018-10-21T11:44:03Z
|
mmm a / lib / Sema / TypeCheckDecl . cpp <nl> ppp b / lib / Sema / TypeCheckDecl . cpp <nl> static void validateAbstractStorageDecl ( TypeChecker & TC , <nl> <nl> static void finalizeAbstractStorageDecl ( TypeChecker & TC , <nl> AbstractStorageDecl * storage ) { <nl> + TC . validateDecl ( storage ) ; <nl> + <nl> for ( auto accessor : storage - > getAllAccessors ( ) ) { <nl> / / Are there accessors we can safely ignore here , like maybe observers ? <nl> TC . validateDecl ( accessor ) ; <nl> class DeclChecker : public DeclVisitor < DeclChecker > { <nl> <nl> checkUnsupportedNestedType ( ED ) ; <nl> TC . validateDecl ( ED ) ; <nl> - TC . DeclsToFinalize . remove ( ED ) ; <nl> ED - > setHasValidatedLayout ( ) ; <nl> <nl> { <nl> class DeclChecker : public DeclVisitor < DeclChecker > { <nl> checkUnsupportedNestedType ( SD ) ; <nl> <nl> TC . validateDecl ( SD ) ; <nl> - TC . DeclsToFinalize . remove ( SD ) ; <nl> SD - > setHasValidatedLayout ( ) ; <nl> <nl> TC . addImplicitConstructors ( SD ) ; <nl> class DeclChecker : public DeclVisitor < DeclChecker > { <nl> <nl> TC . validateDecl ( CD ) ; <nl> TC . requestSuperclassLayout ( CD ) ; <nl> - TC . DeclsToFinalize . remove ( CD ) ; <nl> CD - > setHasValidatedLayout ( ) ; <nl> <nl> { <nl> void TypeChecker : : requestMemberLayout ( ValueDecl * member ) { <nl> if ( auto * protocolDecl = dyn_cast < ProtocolDecl > ( dc ) ) <nl> requestNominalLayout ( protocolDecl ) ; <nl> <nl> + if ( auto ext = dyn_cast < ExtensionDecl > ( dc ) ) { <nl> + if ( ext - > getAsClassOrClassExtensionContext ( ) ) { <nl> + / / Finalize members of class extensions , to ensure we compute their <nl> + / / @ objc and dynamic state . <nl> + DeclsToFinalize . insert ( member ) ; <nl> + } <nl> + } <nl> + <nl> / / If this represents ( abstract ) storage , form the appropriate accessors . <nl> if ( auto storage = dyn_cast < AbstractStorageDecl > ( member ) ) { <nl> validateAbstractStorageDecl ( * this , storage ) ; <nl> static void finalizeType ( TypeChecker & TC , NominalTypeDecl * nominal ) { <nl> if ( ! shouldValidateMemberDuringFinalization ( nominal , VD ) ) <nl> continue ; <nl> <nl> - TC . validateDecl ( VD ) ; <nl> - <nl> - / / Compute overrides . <nl> - ( void ) VD - > getOverriddenDecls ( ) ; <nl> - <nl> - / / Check whether the member is @ objc or dynamic . <nl> - ( void ) VD - > isObjC ( ) ; <nl> - ( void ) VD - > isDynamic ( ) ; <nl> + TC . DeclsToFinalize . insert ( VD ) ; <nl> <nl> / / The only thing left to do is synthesize storage for lazy variables . <nl> auto * prop = dyn_cast < VarDecl > ( D ) ; <nl> if ( ! prop ) <nl> continue ; <nl> <nl> - if ( prop - > getAttrs ( ) . hasAttribute < LazyAttr > ( ) & & ! prop - > isStatic ( ) <nl> - & & prop - > getGetter ( ) ) { <nl> - assert ( ! prop - > getGetter ( ) - > hasBody ( ) ) ; <nl> + if ( prop - > getAttrs ( ) . hasAttribute < LazyAttr > ( ) & & ! prop - > isStatic ( ) & & <nl> + prop - > getGetter ( ) & & ! prop - > getGetter ( ) - > hasBody ( ) ) { <nl> TC . completeLazyVarImplementation ( prop ) ; <nl> } <nl> } <nl> static void finalizeType ( TypeChecker & TC , NominalTypeDecl * nominal ) { <nl> } <nl> <nl> void TypeChecker : : finalizeDecl ( ValueDecl * decl ) { <nl> + validateDecl ( decl ) ; <nl> + <nl> if ( auto nominal = dyn_cast < NominalTypeDecl > ( decl ) ) { <nl> finalizeType ( * this , nominal ) ; <nl> - } else if ( auto func = dyn_cast < AbstractFunctionDecl > ( decl ) ) { <nl> - / / We synthesize certain functions mmm mostly accessors mmm at <nl> - / / times that can be inconvenient for immediate validation . We add <nl> - / / them to the list of declarations to finalize so that we can <nl> - / / fully validate them at a more opportune time . <nl> - validateDecl ( func ) ; <nl> - } else { <nl> - auto storage = cast < AbstractStorageDecl > ( decl ) ; <nl> + } else if ( auto storage = dyn_cast < AbstractStorageDecl > ( decl ) ) { <nl> finalizeAbstractStorageDecl ( * this , storage ) ; <nl> } <nl> + <nl> + / / Compute overrides . <nl> + ( void ) decl - > getOverriddenDecls ( ) ; <nl> + <nl> + / / Check whether the member is @ objc or dynamic . <nl> + ( void ) decl - > isObjC ( ) ; <nl> + ( void ) decl - > isDynamic ( ) ; <nl> } <nl> <nl> bool swift : : isPassThroughTypealias ( TypeAliasDecl * typealias ) { <nl> mmm a / lib / Sema / TypeChecker . cpp <nl> ppp b / lib / Sema / TypeChecker . cpp <nl> static void typeCheckFunctionsAndExternalDecls ( SourceFile & SF , TypeChecker & TC ) <nl> / / Note : if we ever start putting extension members in vtables , we ' ll need <nl> / / to validate those members too . <nl> / / FIXME : If we ' re not planning to run SILGen , this is wasted effort . <nl> - while ( ! TC . DeclsToFinalize . empty ( ) ) { <nl> - auto decl = TC . DeclsToFinalize . pop_back_val ( ) ; <nl> + while ( TC . NextDeclToFinalize < TC . DeclsToFinalize . size ( ) ) { <nl> + auto decl = TC . DeclsToFinalize [ TC . NextDeclToFinalize + + ] ; <nl> if ( decl - > isInvalid ( ) | | TC . Context . hadError ( ) ) <nl> continue ; <nl> <nl> static void typeCheckFunctionsAndExternalDecls ( SourceFile & SF , TypeChecker & TC ) <nl> currentExternalDef < TC . Context . ExternalDefinitions . size ( ) | | <nl> currentSynthesizedDecl < SF . SynthesizedDecls . size ( ) | | <nl> ! TC . FunctionsToSynthesize . empty ( ) | | <nl> - ! TC . DeclsToFinalize . empty ( ) | | <nl> + TC . NextDeclToFinalize < TC . DeclsToFinalize . size ( ) | | <nl> ! TC . ConformanceContexts . empty ( ) | | <nl> ! TC . DelayedRequirementSignatures . empty ( ) | | <nl> ! TC . UsedConformances . empty ( ) | | <nl> mmm a / lib / Sema / TypeChecker . h <nl> ppp b / lib / Sema / TypeChecker . h <nl> class TypeChecker final : public LazyResolver { <nl> / / / we can hand them off to SILGen etc . <nl> llvm : : SetVector < ValueDecl * > DeclsToFinalize ; <nl> <nl> + / / / Track the index of the next declaration that needs to be finalized , <nl> + / / / from the \ c DeclsToFinalize set . <nl> + unsigned NextDeclToFinalize = 0 ; <nl> + <nl> / / / The list of functions that need to have their bodies synthesized . <nl> llvm : : MapVector < FuncDecl * , SynthesizedFunction > FunctionsToSynthesize ; <nl> <nl> new file mode 100644 <nl> index 000000000000 . . 9d8c74169ef6 <nl> mmm / dev / null <nl> ppp b / test / multifile / Inputs / require - member - layout - dynamic - bridging . h <nl> <nl> + @ import Foundation ; <nl> + <nl> + @ interface NSObject ( Testing ) <nl> + - ( void ) bar : ( nonnull NSString * ) param ; <nl> + @ end <nl> new file mode 100644 <nl> index 000000000000 . . 1d593b65dbe1 <nl> mmm / dev / null <nl> ppp b / test / multifile / Inputs / require - member - layout - dynamic - other . swift <nl> <nl> + import Foundation <nl> + <nl> + extension Foo { <nl> + open override func bar ( _ : String ) { } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . ccab41a8bf90 <nl> mmm / dev / null <nl> ppp b / test / multifile / require - member - layout - dynamic . swift <nl> <nl> + / / RUN : % target - swift - frontend - module - name test - emit - ir - primary - file % s % S / Inputs / require - member - layout - dynamic - other . swift - import - objc - header % S / Inputs / require - member - layout - dynamic - bridging . h - sdk % sdk - o % t . o <nl> + <nl> + / / REQUIRES : objc_interop <nl> + <nl> + import Foundation <nl> + <nl> + public class Foo : NSObject { <nl> + func foo ( ) { <nl> + bar ( " hello " ) <nl> + } <nl> + } <nl>
|
[ Type checker ] Finalize referenced members of class extensions .
|
apple/swift
|
c2bc23e7341862f46e5626e4ba78b1aa614f4905
|
2018-07-24T23:51:25Z
|
mmm a / include / v8 . h <nl> ppp b / include / v8 . h <nl> class Local { <nl> <nl> <nl> # if ! defined ( V8_IMMINENT_DEPRECATION_WARNINGS ) <nl> - / / Local is an alias for Local for historical reasons . <nl> + / / Handle is an alias for Local for historical reasons . <nl> template < class T > <nl> using Handle = Local < T > ; <nl> # endif <nl>
|
[ api ] Fix typo .
|
v8/v8
|
9048298d4c52406faa3f15be8edda2cc0912ebaf
|
2016-09-07T18:55:40Z
|
mmm a / core / safe_refcount . cpp <nl> ppp b / core / safe_refcount . cpp <nl> static _ALWAYS_INLINE_ T _atomic_add_impl ( register T * pw , register T val ) { <nl> return * pw ; <nl> } <nl> <nl> + template < class T > <nl> + static _ALWAYS_INLINE_ T _atomic_exchange_if_greater_impl ( register T * pw , register T val ) { <nl> + <nl> + if ( val > * pw ) <nl> + * pw = val ; <nl> + <nl> + return * pw ; <nl> + } <nl> + <nl> # elif defined ( __GNUC__ ) <nl> <nl> / * Implementation for GCC & Clang * / <nl> static _ALWAYS_INLINE_ T _atomic_add_impl ( register T * pw , register T val ) { <nl> return __sync_add_and_fetch ( pw , val ) ; <nl> } <nl> <nl> + template < class T > <nl> + static _ALWAYS_INLINE_ T _atomic_exchange_if_greater_impl ( register T * pw , register T val ) { <nl> + <nl> + while ( true ) { <nl> + T tmp = static_cast < T const volatile & > ( * pw ) ; <nl> + if ( tmp > = val ) <nl> + return tmp ; / / already greater , or equal <nl> + if ( __sync_val_compare_and_swap ( pw , tmp , val ) = = tmp ) <nl> + return val ; <nl> + } <nl> + } <nl> + <nl> # elif defined ( _MSC_VER ) <nl> <nl> / * Implementation for MSVC - Windows * / <nl> static _ALWAYS_INLINE_ T _atomic_add_impl ( register T * pw , register T val ) { <nl> return tmp + 1 ; \ <nl> } <nl> <nl> + # define ATOMIC_EXCHANGE_IF_GREATER_BODY ( m_pw , m_val , m_win_type , m_win_cmpxchg , m_cpp_type ) \ <nl> + while ( true ) { \ <nl> + m_cpp_type tmp = static_cast < m_cpp_type const volatile & > ( * ( m_pw ) ) ; \ <nl> + if ( tmp > = m_val ) \ <nl> + return tmp ; / * already greater , or equal * / \ <nl> + if ( m_win_cmpxchg ( ( m_win_type volatile * ) ( m_pw ) , m_val , tmp ) = = tmp ) \ <nl> + return m_val ; \ <nl> + } <nl> + <nl> static _ALWAYS_INLINE_ uint32_t _atomic_conditional_increment_impl ( register uint32_t * pw ) { <nl> <nl> ATOMIC_CONDITIONAL_INCREMENT_BODY ( pw , LONG , InterlockedCompareExchange , uint32_t ) <nl> static _ALWAYS_INLINE_ uint32_t _atomic_increment_impl ( register uint32_t * pw ) { <nl> <nl> static _ALWAYS_INLINE_ uint32_t _atomic_sub_impl ( register uint32_t * pw , register uint32_t val ) { <nl> <nl> - # if _WIN32_WINNT > = 0x0601 / / Windows 7 + <nl> - return InterlockedExchangeSubtract ( pw , val ) - val ; <nl> - # else <nl> return InterlockedExchangeAdd ( ( LONG volatile * ) pw , - ( int32_t ) val ) - val ; <nl> - # endif <nl> } <nl> <nl> static _ALWAYS_INLINE_ uint32_t _atomic_add_impl ( register uint32_t * pw , register uint32_t val ) { <nl> static _ALWAYS_INLINE_ uint32_t _atomic_add_impl ( register uint32_t * pw , register <nl> return InterlockedAdd ( ( LONG volatile * ) pw , val ) ; <nl> } <nl> <nl> + static _ALWAYS_INLINE_ uint32_t _atomic_exchange_if_greater_impl ( register uint32_t * pw , register uint32_t val ) { <nl> + <nl> + ATOMIC_EXCHANGE_IF_GREATER_BODY ( pw , val , LONG , InterlockedCompareExchange , uint32_t ) <nl> + } <nl> + <nl> static _ALWAYS_INLINE_ uint64_t _atomic_conditional_increment_impl ( register uint64_t * pw ) { <nl> <nl> ATOMIC_CONDITIONAL_INCREMENT_BODY ( pw , LONGLONG , InterlockedCompareExchange64 , uint64_t ) <nl> static _ALWAYS_INLINE_ uint64_t _atomic_increment_impl ( register uint64_t * pw ) { <nl> <nl> static _ALWAYS_INLINE_ uint64_t _atomic_sub_impl ( register uint64_t * pw , register uint64_t val ) { <nl> <nl> - # if _WIN32_WINNT > = 0x0601 & & ! defined ( UWP_ENABLED ) / / Windows 7 + except UWP <nl> - return InterlockedExchangeSubtract64 ( pw , val ) - val ; <nl> - # else <nl> return InterlockedExchangeAdd64 ( ( LONGLONG volatile * ) pw , - ( int64_t ) val ) - val ; <nl> - # endif <nl> } <nl> <nl> static _ALWAYS_INLINE_ uint64_t _atomic_add_impl ( register uint64_t * pw , register uint64_t val ) { <nl> static _ALWAYS_INLINE_ uint64_t _atomic_add_impl ( register uint64_t * pw , register <nl> return InterlockedAdd64 ( ( LONGLONG volatile * ) pw , val ) ; <nl> } <nl> <nl> + static _ALWAYS_INLINE_ uint64_t _atomic_exchange_if_greater_impl ( register uint64_t * pw , register uint64_t val ) { <nl> + <nl> + ATOMIC_EXCHANGE_IF_GREATER_BODY ( pw , val , LONGLONG , InterlockedCompareExchange64 , uint64_t ) <nl> + } <nl> + <nl> # else <nl> <nl> / / no threads supported ? <nl> uint32_t atomic_add ( register uint32_t * pw , register uint32_t val ) { <nl> return _atomic_add_impl ( pw , val ) ; <nl> } <nl> <nl> + uint32_t atomic_exchange_if_greater ( register uint32_t * pw , register uint32_t val ) { <nl> + return _atomic_exchange_if_greater_impl ( pw , val ) ; <nl> + } <nl> + <nl> uint64_t atomic_conditional_increment ( register uint64_t * counter ) { <nl> return _atomic_conditional_increment_impl ( counter ) ; <nl> } <nl> uint64_t atomic_sub ( register uint64_t * pw , register uint64_t val ) { <nl> uint64_t atomic_add ( register uint64_t * pw , register uint64_t val ) { <nl> return _atomic_add_impl ( pw , val ) ; <nl> } <nl> + <nl> + uint64_t atomic_exchange_if_greater ( register uint64_t * pw , register uint64_t val ) { <nl> + return _atomic_exchange_if_greater_impl ( pw , val ) ; <nl> + } <nl> mmm a / core / safe_refcount . h <nl> ppp b / core / safe_refcount . h <nl> uint32_t atomic_decrement ( register uint32_t * pw ) ; <nl> uint32_t atomic_increment ( register uint32_t * pw ) ; <nl> uint32_t atomic_sub ( register uint32_t * pw , register uint32_t val ) ; <nl> uint32_t atomic_add ( register uint32_t * pw , register uint32_t val ) ; <nl> + uint32_t atomic_exchange_if_greater ( register uint32_t * pw , register uint32_t val ) ; <nl> <nl> uint64_t atomic_conditional_increment ( register uint64_t * counter ) ; <nl> uint64_t atomic_decrement ( register uint64_t * pw ) ; <nl> uint64_t atomic_increment ( register uint64_t * pw ) ; <nl> uint64_t atomic_sub ( register uint64_t * pw , register uint64_t val ) ; <nl> uint64_t atomic_add ( register uint64_t * pw , register uint64_t val ) ; <nl> + uint64_t atomic_exchange_if_greater ( register uint64_t * pw , register uint64_t val ) ; <nl> <nl> struct SafeRefCount { <nl> <nl>
|
Merge pull request from RandomShaper / improve - atomics
|
godotengine/godot
|
597ffa03b3399240e806ee524dd3f9725eefb7ab
|
2017-07-31T21:30:07Z
|
mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / DXVAHD . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / DXVAHD . cpp <nl> bool CProcessorHD : : Render ( CRect src , CRect dst , ID3D11Resource * target , ID3D11Vi <nl> / / don ' t apply any color range conversion , this will be fixed at later stage . <nl> D3D11_VIDEO_PROCESSOR_COLOR_SPACE colorSpace = { } ; <nl> colorSpace . Usage = 0 ; / / 0 - playback , 1 - video processing <nl> - colorSpace . RGB_Range = 0 ; / / 0 - 0 - 255 , 1 - 16 - 235 <nl> + colorSpace . RGB_Range = g_Windowing . UseLimitedColor ( ) ? 1 : 0 ; / / 0 - 0 - 255 , 1 - 16 - 235 <nl> colorSpace . YCbCr_Matrix = 1 ; / / 0 - BT . 601 , 1 = BT . 709 <nl> colorSpace . YCbCr_xvYCC = 1 ; / / 0 - Conventional YCbCr , 1 - xvYCC <nl> - colorSpace . Nominal_Range = 2 ; / / 2 - 0 - 255 , 1 = 16 - 235 , 0 - undefined <nl> + colorSpace . Nominal_Range = 0 ; / / 2 - 0 - 255 , 1 = 16 - 235 , 0 - undefined <nl> <nl> m_pVideoContext - > VideoProcessorSetOutputColorSpace ( m_pVideoProcessor , & colorSpace ) ; <nl> <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / WinRenderer . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / WinRenderer . cpp <nl> int CWinRenderer : : GetImage ( YV12Image * image , int source , bool readonly ) <nl> if ( ! buf ) <nl> return - 1 ; <nl> <nl> - buf - > StartDecode ( ) ; <nl> - <nl> image - > cshift_x = 1 ; <nl> image - > cshift_y = 1 ; <nl> image - > height = m_sourceHeight ; <nl> int CWinRenderer : : GetImage ( YV12Image * image , int source , bool readonly ) <nl> <nl> void CWinRenderer : : ReleaseImage ( int source , bool preserve ) <nl> { <nl> - if ( m_VideoBuffers [ source ] ! = nullptr ) <nl> - m_VideoBuffers [ source ] - > StartRender ( ) ; <nl> } <nl> <nl> void CWinRenderer : : Reset ( ) <nl> void CWinRenderer : : RenderUpdate ( bool clear , unsigned int flags , unsigned int alp <nl> <nl> void CWinRenderer : : FlipPage ( int source ) <nl> { <nl> + if ( m_VideoBuffers [ m_iYV12RenderBuffer ] ! = nullptr ) <nl> + m_VideoBuffers [ m_iYV12RenderBuffer ] - > StartDecode ( ) ; <nl> + <nl> if ( source > = 0 & & source < m_NumYV12Buffers ) <nl> m_iYV12RenderBuffer = source ; <nl> else <nl> m_iYV12RenderBuffer = NextYV12Texture ( ) ; ; <nl> <nl> + if ( m_VideoBuffers [ m_iYV12RenderBuffer ] ! = nullptr ) <nl> + m_VideoBuffers [ m_iYV12RenderBuffer ] - > StartRender ( ) ; <nl> + <nl> return ; <nl> } <nl> <nl> void CWinRenderer : : SelectPSVideoFilter ( ) <nl> void CWinRenderer : : UpdatePSVideoFilter ( ) <nl> { <nl> RESOLUTION_INFO res = g_graphicsContext . GetResInfo ( ) ; <nl> + if ( ! res . bFullScreen ) <nl> + res = g_graphicsContext . GetResInfo ( RES_DESKTOP ) ; <nl> + <nl> m_destWidth = res . iScreenWidth ; <nl> m_destHeight = res . iScreenHeight ; <nl> <nl> void CWinRenderer : : RenderHQ ( ) <nl> { <nl> m_scalerShader - > Render ( m_IntermediateTarget , m_sourceWidth , m_sourceHeight , m_destWidth , m_destHeight <nl> , m_sourceRect , g_graphicsContext . StereoCorrection ( m_destRect ) <nl> - , ( m_renderMethod = = RENDER_DXVA & & g_Windowing . UseLimitedColor ( ) ) ) ; <nl> + , false ) ; <nl> } <nl> <nl> void CWinRenderer : : RenderHW ( DWORD flags ) <nl> void CWinRenderer : : RenderHW ( DWORD flags ) <nl> <nl> / / render frame <nl> CRect tu = { dst . x1 / m_destWidth , dst . y1 / m_destHeight , dst . x2 / m_destWidth , dst . y2 / m_destHeight } ; <nl> - CD3DTexture : : DrawQuad ( dst , 0xFFFFFF , & m_IntermediateTarget , & tu , SHADER_METHOD_RENDER_TEXTURE_BLEND ) ; <nl> + CD3DTexture : : DrawQuad ( dst , 0xFFFFFF , & m_IntermediateTarget , & tu , SHADER_METHOD_RENDER_TEXTURE_NOBLEND ) ; <nl> <nl> if ( stereoHack ) <nl> g_Windowing . SetViewPort ( oldViewPort ) ; <nl> bool CWinRenderer : : CreateYV12Texture ( int index ) <nl> <nl> m_VideoBuffers [ index ] - > StartDecode ( ) ; <nl> m_VideoBuffers [ index ] - > Clear ( ) ; <nl> - m_VideoBuffers [ index ] - > StartRender ( ) ; <nl> <nl> CLog : : Log ( LOGDEBUG , " created video buffer % i " , index ) ; <nl> return true ; <nl> mmm a / xbmc / rendering / dx / RenderSystemDX . cpp <nl> ppp b / xbmc / rendering / dx / RenderSystemDX . cpp <nl> CRenderSystemDX : : CRenderSystemDX ( ) : CRenderSystemBase ( ) <nl> ZeroMemory ( & m_viewPort , sizeof ( m_viewPort ) ) ; <nl> ZeroMemory ( & m_scissor , sizeof ( CRect ) ) ; <nl> ZeroMemory ( & m_adapterDesc , sizeof ( DXGI_ADAPTER_DESC ) ) ; <nl> + m_bDefaultStereoEnabled = false ; <nl> + m_bStereoEnabled = false ; <nl> } <nl> <nl> CRenderSystemDX : : ~ CRenderSystemDX ( ) <nl> void CRenderSystemDX : : SetFullScreenInternal ( ) <nl> toMatchMode . Format = scDesc . BufferDesc . Format ; <nl> toMatchMode . Scaling = scDesc . BufferDesc . Scaling ; <nl> toMatchMode . ScanlineOrdering = scDesc . BufferDesc . ScanlineOrdering ; <nl> - / / force switch to 1080p23 before hardware stereo <nl> - if ( RENDER_STEREO_MODE_HARDWAREBASED = = g_graphicsContext . GetStereoMode ( ) ) <nl> - { <nl> - toMatchMode . RefreshRate . Numerator = 24000 ; <nl> - toMatchMode . RefreshRate . Denominator = 1001 ; <nl> - toMatchMode . ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE ; <nl> - m_refreshRate = RATIONAL_TO_FLOAT ( toMatchMode . RefreshRate ) ; <nl> - } <nl> <nl> / / find closest mode <nl> m_pOutput - > FindClosestMatchingMode ( & toMatchMode , & matchedMode , m_pD3DDev ) ; <nl> void CRenderSystemDX : : SetFullScreenInternal ( ) <nl> } <nl> } <nl> end : <nl> - / / in windowed mode DWM uses triple buffering in any case . <nl> - / / for FSEM we use double buffering to avoid possible shuttering / tearing <nl> - SetMaximumFrameLatency ( 2 - m_useWindowedDX ) ; <nl> + SetMaximumFrameLatency ( ) ; <nl> } <nl> <nl> bool CRenderSystemDX : : IsFormatSupport ( DXGI_FORMAT format , unsigned int usage ) <nl> bool CRenderSystemDX : : DestroyRenderSystem ( ) <nl> { <nl> DeleteDevice ( ) ; <nl> <nl> + / / restore stereo setting on exit <nl> + if ( g_advancedSettings . m_useDisplayControlHWStereo ) <nl> + SetDisplayStereoEnabled ( m_bDefaultStereoEnabled ) ; <nl> + <nl> SAFE_RELEASE ( m_pOutput ) ; <nl> SAFE_RELEASE ( m_adapter ) ; <nl> SAFE_RELEASE ( m_dxgiFactory ) ; <nl> void CRenderSystemDX : : DeleteDevice ( ) <nl> m_bResizeRequred = false ; <nl> m_bHWStereoEnabled = false ; <nl> m_bRenderCreated = false ; <nl> + m_bStereoEnabled = false ; <nl> } <nl> <nl> void CRenderSystemDX : : OnDeviceLost ( ) <nl> bool CRenderSystemDX : : CreateDevice ( ) <nl> SAFE_RELEASE ( m_dxgiFactory ) ; <nl> m_adapter - > GetParent ( __uuidof ( IDXGIFactory1 ) , reinterpret_cast < void * * > ( & m_dxgiFactory ) ) ; <nl> <nl> + if ( g_advancedSettings . m_useDisplayControlHWStereo ) <nl> + UpdateDisplayStereoStatus ( true ) ; <nl> + <nl> if ( ! m_pOutput ) <nl> { <nl> HMONITOR hMonitor = MonitorFromWindow ( m_hDeviceWnd , MONITOR_DEFAULTTONULL ) ; <nl> bool CRenderSystemDX : : CreateDevice ( ) <nl> pMultiThreading - > Release ( ) ; <nl> } <nl> <nl> - / / in windowed mode DWM uses triple buffering in any case . <nl> - / / for FSEM we use double buffering <nl> - SetMaximumFrameLatency ( 2 - m_useWindowedDX ) ; <nl> + SetMaximumFrameLatency ( ) ; <nl> <nl> # ifdef _DEBUG <nl> if ( SUCCEEDED ( m_pD3DDev - > QueryInterface ( __uuidof ( ID3D11Debug ) , reinterpret_cast < void * * > ( & m_d3dDebug ) ) ) ) <nl> bool CRenderSystemDX : : CreateWindowSizeDependentResources ( ) <nl> } <nl> <nl> m_resizeInProgress = true ; <nl> - <nl> CLog : : Log ( LOGDEBUG , " % s - ( Re ) Create window size ( % dx % d ) dependent resources . " , __FUNCTION__ , m_nBackBufferWidth , m_nBackBufferHeight ) ; <nl> <nl> bool bRestoreRTView = false ; <nl> bool CRenderSystemDX : : CreateWindowSizeDependentResources ( ) <nl> if ( fullScreen ) <nl> m_pSwapChain1 - > SetFullscreenState ( false , NULL ) ; <nl> <nl> + / / disable / enable stereo 3D on system level <nl> + if ( g_advancedSettings . m_useDisplayControlHWStereo ) <nl> + SetDisplayStereoEnabled ( bHWStereoEnabled ) ; <nl> + <nl> CLog : : Log ( LOGDEBUG , " % s - Destroying swapchain in order to switch % s stereoscopic 3D . " , __FUNCTION__ , bHWStereoEnabled ? " to " : " from " ) ; <nl> <nl> SAFE_RELEASE ( m_pSwapChain ) ; <nl> SAFE_RELEASE ( m_pSwapChain1 ) ; <nl> + m_pImdContext - > ClearState ( ) ; <nl> m_pImdContext - > Flush ( ) ; <nl> <nl> / / flush command is asynchronous , so wait until destruction is completed <nl> bool CRenderSystemDX : : CreateWindowSizeDependentResources ( ) <nl> DXGI_SWAP_CHAIN_DESC1 scDesc1 = { 0 } ; <nl> scDesc1 . Width = m_nBackBufferWidth ; <nl> scDesc1 . Height = m_nBackBufferHeight ; <nl> - scDesc1 . BufferCount = 2 ; / / Use double buffering to minimize latency . <nl> + scDesc1 . BufferCount = 2 + 3 * bHWStereoEnabled ; <nl> scDesc1 . Format = DXGI_FORMAT_B8G8R8A8_UNORM ; <nl> scDesc1 . BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT ; <nl> scDesc1 . AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED ; <nl> bool CRenderSystemDX : : CreateWindowSizeDependentResources ( ) <nl> CLog : : Log ( LOGNOTICE , " % s - Fallback to monoscopic mode . " , __FUNCTION__ ) ; <nl> <nl> scDesc1 . Stereo = false ; <nl> + bHWStereoEnabled = false ; <nl> hr = dxgiFactory2 - > CreateSwapChainForHwnd ( m_pD3DDev , m_hFocusWnd , & scDesc1 , & scFSDesc , NULL , & m_pSwapChain1 ) ; <nl> <nl> / / fallback to split_horisontal mode . <nl> bool CRenderSystemDX : : CreateWindowSizeDependentResources ( ) <nl> / / - restart presenting , 0 in sync interval discards current frame also <nl> / / - wait until new frame will be drawn <nl> / / sleep value possible depends on hardware m . b . need a setting in as . xml <nl> - if ( m_useWindowedDX & & ! bHWStereoEnabled & & m_bHWStereoEnabled ) <nl> + if ( ! g_advancedSettings . m_useDisplayControlHWStereo & & m_useWindowedDX & & ! bHWStereoEnabled & & m_bHWStereoEnabled ) <nl> { <nl> - DXGI_PRESENT_PARAMETERS presentParams = { } ; <nl> - presentParams . DirtyRectsCount = 0 ; <nl> - presentParams . pDirtyRects = NULL ; <nl> - presentParams . pScrollRect = NULL ; <nl> - m_pSwapChain1 - > Present1 ( 0 , DXGI_PRESENT_RESTART , & presentParams ) ; <nl> - <nl> + m_pSwapChain1 - > Present ( 0 , DXGI_PRESENT_RESTART ) ; <nl> Sleep ( 100 ) ; <nl> } <nl> m_bHWStereoEnabled = bHWStereoEnabled ; <nl> bool CRenderSystemDX : : CreateWindowSizeDependentResources ( ) <nl> { <nl> CLog : : Log ( LOGERROR , " % s - Failed to resize buffers ( % s ) . " , __FUNCTION__ , GetErrorDescription ( hr ) . c_str ( ) ) ; <nl> if ( DXGI_ERROR_DEVICE_REMOVED = = hr ) <nl> + { <nl> OnDeviceLost ( ) ; <nl> - <nl> - return false ; <nl> + return false ; <nl> + } <nl> + / / wait a bit and try again <nl> + Sleep ( 50 ) ; <nl> + hr = m_pSwapChain - > ResizeBuffers ( scDesc . BufferCount , m_nBackBufferWidth , m_nBackBufferHeight , scDesc . BufferDesc . Format , scFlags ) ; <nl> } <nl> } <nl> <nl> bool CRenderSystemDX : : CreateWindowSizeDependentResources ( ) <nl> if ( bRestoreRTView ) <nl> m_pContext - > OMSetRenderTargets ( 1 , & m_pRenderTargetView , m_depthStencilView ) ; <nl> <nl> + / / notify about resurection of display <nl> if ( m_bResizeRequred ) <nl> OnDisplayBack ( ) ; <nl> <nl> void CRenderSystemDX : : PresentRenderImpl ( bool rendered ) <nl> } <nl> <nl> FinishCommandList ( ) ; <nl> + m_pImdContext - > Flush ( ) ; <nl> <nl> - if ( m_pSwapChain1 ) <nl> - { <nl> - / / will use optimized present with dirty regions . <nl> - DXGI_PRESENT_PARAMETERS presentParams = { } ; <nl> - presentParams . DirtyRectsCount = 0 ; <nl> - presentParams . pDirtyRects = NULL ; <nl> - presentParams . pScrollRect = NULL ; <nl> - hr = m_pSwapChain1 - > Present1 ( ( m_bVSync ? 1 : 0 ) , 0 , & presentParams ) ; <nl> - } <nl> - else <nl> - hr = m_pSwapChain - > Present ( ( m_bVSync ? 1 : 0 ) , 0 ) ; <nl> + hr = m_pSwapChain - > Present ( ( m_bVSync ? 1 : 0 ) , 0 ) ; <nl> <nl> if ( DXGI_ERROR_DEVICE_REMOVED = = hr ) <nl> { <nl> bool CRenderSystemDX : : BeginRender ( ) <nl> return false ; <nl> <nl> HRESULT oldStatus = m_nDeviceStatus ; <nl> - if ( m_pSwapChain1 ) <nl> - { <nl> - DXGI_PRESENT_PARAMETERS presentParams = { } ; <nl> - presentParams . DirtyRectsCount = 0 ; <nl> - presentParams . pDirtyRects = NULL ; <nl> - presentParams . pScrollRect = NULL ; <nl> - m_nDeviceStatus = m_pSwapChain1 - > Present1 ( 0 , DXGI_PRESENT_TEST , & presentParams ) ; <nl> - } <nl> - else <nl> - { <nl> - m_nDeviceStatus = m_pSwapChain - > Present ( 0 , DXGI_PRESENT_TEST ) ; <nl> - } <nl> + m_nDeviceStatus = m_pSwapChain - > Present ( 0 , DXGI_PRESENT_TEST ) ; <nl> <nl> / / handling of return values . <nl> switch ( m_nDeviceStatus ) <nl> bool CRenderSystemDX : : ClearBuffers ( color_t color ) <nl> / / for interlaced / checkerboard / hw clear right view <nl> else if ( m_pRenderTargetViewRight ) <nl> pRTView = m_pRenderTargetViewRight ; <nl> - <nl> - / / for hw stereo clear depth view also <nl> - if ( m_stereoMode = = RENDER_STEREO_MODE_HARDWAREBASED ) <nl> - m_pContext - > ClearDepthStencilView ( m_depthStencilView , D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL , 1 . 0 , 0 ) ; <nl> } <nl> } <nl> <nl> void CRenderSystemDX : : SetStereoMode ( RENDER_STEREO_MODE mode , RENDER_STEREO_VIEW <nl> } <nl> } <nl> <nl> - bool CRenderSystemDX : : SupportsStereo ( RENDER_STEREO_MODE mode ) const <nl> + bool CRenderSystemDX : : GetStereoEnabled ( ) const <nl> { <nl> - bool isHWStereoSupport = false ; <nl> - IDXGIFactory2 * dxgiFactory2 = NULL ; <nl> + bool result = false ; <nl> + <nl> + IDXGIFactory2 * dxgiFactory2 = nullptr ; <nl> if ( SUCCEEDED ( m_dxgiFactory - > QueryInterface ( __uuidof ( IDXGIFactory2 ) , reinterpret_cast < void * * > ( & dxgiFactory2 ) ) ) ) <nl> - { <nl> - isHWStereoSupport = dxgiFactory2 & & dxgiFactory2 - > IsWindowedStereoEnabled ( ) ; <nl> - } <nl> + result = dxgiFactory2 - > IsWindowedStereoEnabled ( ) ; <nl> SAFE_RELEASE ( dxgiFactory2 ) ; <nl> <nl> + return result ; <nl> + } <nl> + <nl> + bool CRenderSystemDX : : GetDisplayStereoEnabled ( ) const <nl> + { <nl> + bool result = false ; <nl> + <nl> + IDXGIDisplayControl * pDXGIDisplayControl = nullptr ; <nl> + if ( SUCCEEDED ( m_dxgiFactory - > QueryInterface ( __uuidof ( IDXGIDisplayControl ) , ( void * * ) & pDXGIDisplayControl ) ) ) <nl> + result = pDXGIDisplayControl - > IsStereoEnabled ( ) ; <nl> + SAFE_RELEASE ( pDXGIDisplayControl ) ; <nl> + <nl> + return result ; <nl> + } <nl> + <nl> + void CRenderSystemDX : : SetDisplayStereoEnabled ( bool enable ) <nl> + { <nl> + IDXGIDisplayControl * pDXGIDisplayControl = nullptr ; <nl> + if ( SUCCEEDED ( m_dxgiFactory - > QueryInterface ( __uuidof ( IDXGIDisplayControl ) , ( void * * ) & pDXGIDisplayControl ) ) ) <nl> + pDXGIDisplayControl - > SetStereoEnabled ( enable ) ; <nl> + SAFE_RELEASE ( pDXGIDisplayControl ) ; <nl> + } <nl> + <nl> + void CRenderSystemDX : : UpdateDisplayStereoStatus ( bool first ) <nl> + { <nl> + if ( first ) <nl> + m_bDefaultStereoEnabled = GetDisplayStereoEnabled ( ) ; <nl> + <nl> + if ( ! first | | ! m_bDefaultStereoEnabled ) <nl> + SetDisplayStereoEnabled ( true ) ; <nl> + <nl> + m_bStereoEnabled = GetStereoEnabled ( ) ; <nl> + SetDisplayStereoEnabled ( false ) ; <nl> + } <nl> + <nl> + bool CRenderSystemDX : : SupportsStereo ( RENDER_STEREO_MODE mode ) const <nl> + { <nl> switch ( mode ) <nl> { <nl> case RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN : <nl> bool CRenderSystemDX : : SupportsStereo ( RENDER_STEREO_MODE mode ) const <nl> case RENDER_STEREO_MODE_CHECKERBOARD : <nl> return true ; <nl> case RENDER_STEREO_MODE_HARDWAREBASED : <nl> - return isHWStereoSupport ; <nl> + return m_bStereoEnabled | | GetStereoEnabled ( ) ; <nl> default : <nl> return CRenderSystemBase : : SupportsStereo ( mode ) ; <nl> } <nl> void CRenderSystemDX : : FinishCommandList ( bool bExecute / * = true * / ) <nl> SAFE_RELEASE ( pCommandList ) ; <nl> } <nl> <nl> - void CRenderSystemDX : : SetMaximumFrameLatency ( uint32_t latency ) <nl> + void CRenderSystemDX : : SetMaximumFrameLatency ( uint8_t latency ) <nl> { <nl> if ( ! m_pD3DDev ) <nl> return ; <nl> void CRenderSystemDX : : SetMaximumFrameLatency ( uint32_t latency ) <nl> IDXGIDevice1 * pDXGIDevice = nullptr ; <nl> if ( SUCCEEDED ( m_pD3DDev - > QueryInterface ( __uuidof ( IDXGIDevice1 ) , reinterpret_cast < void * * > ( & pDXGIDevice ) ) ) ) <nl> { <nl> + / / in windowed mode DWM uses triple buffering in any case . <nl> + / / for FSEM we use same buffering to avoid possible shuttering / tearing <nl> + if ( latency = = - 1 ) <nl> + latency = m_useWindowedDX ? 1 : 3 ; <nl> pDXGIDevice - > SetMaximumFrameLatency ( latency ) ; <nl> SAFE_RELEASE ( pDXGIDevice ) ; <nl> } <nl> mmm a / xbmc / rendering / dx / RenderSystemDX . h <nl> ppp b / xbmc / rendering / dx / RenderSystemDX . h <nl> class CRenderSystemDX : public CRenderSystemBase <nl> void SetFullScreenInternal ( ) ; <nl> void GetClosestDisplayModeToCurrent ( IDXGIOutput * output , DXGI_MODE_DESC * outCurrentDisplayMode , bool useCached = false ) ; <nl> void CheckInterlasedStereoView ( void ) ; <nl> - void SetMaximumFrameLatency ( uint32_t latency ) ; <nl> + void SetMaximumFrameLatency ( uint8_t latency = - 1 ) ; <nl> + <nl> + bool GetStereoEnabled ( ) const ; <nl> + bool GetDisplayStereoEnabled ( ) const ; <nl> + void SetDisplayStereoEnabled ( bool enable ) ; <nl> + void UpdateDisplayStereoStatus ( bool isfirst = false ) ; <nl> <nl> virtual void Register ( ID3DResource * resource ) ; <nl> virtual void Unregister ( ID3DResource * resource ) ; <nl> class CRenderSystemDX : public CRenderSystemBase <nl> # ifdef _DEBUG <nl> ID3D11Debug * m_d3dDebug = NULL ; <nl> # endif <nl> + bool m_bDefaultStereoEnabled ; <nl> + bool m_bStereoEnabled ; <nl> } ; <nl> <nl> # endif <nl> mmm a / xbmc / settings / AdvancedSettings . cpp <nl> ppp b / xbmc / settings / AdvancedSettings . cpp <nl> void CAdvancedSettings : : Initialize ( ) <nl> m_stereoscopicregex_sbs = " [ - . _ ] h ? sbs [ - . _ ] " ; <nl> m_stereoscopicregex_tab = " [ - . _ ] h ? tab [ - . _ ] " ; <nl> <nl> + m_useDisplayControlHWStereo = false ; <nl> + <nl> m_videoAssFixedWorks = false ; <nl> <nl> m_logLevelHint = m_logLevel = LOG_LEVEL_NORMAL ; <nl> void CAdvancedSettings : : ParseSettingsFile ( const std : : string & file ) <nl> XMLUtils : : GetBoolean ( pElement , " forcedxvarenderer " , m_DXVAForceProcessorRenderer ) ; <nl> XMLUtils : : GetBoolean ( pElement , " dxvanodeintforprogressive " , m_DXVANoDeintProcForProgressive ) ; <nl> XMLUtils : : GetBoolean ( pElement , " dxvaallowhqscaling " , m_DXVAAllowHqScaling ) ; <nl> + XMLUtils : : GetBoolean ( pElement , " usedisplaycontrolhwstereo " , m_useDisplayControlHWStereo ) ; <nl> / / 0 = disable fps detect , 1 = only detect on timestamps with uniform spacing , 2 detect on all timestamps <nl> XMLUtils : : GetInt ( pElement , " fpsdetect " , m_videoFpsDetect , 0 , 2 ) ; <nl> <nl> mmm a / xbmc / settings / AdvancedSettings . h <nl> ppp b / xbmc / settings / AdvancedSettings . h <nl> class CAdvancedSettings : public ISettingCallback , public ISettingsHandler <nl> std : : string m_stereoscopicregex_sbs ; <nl> std : : string m_stereoscopicregex_tab ; <nl> <nl> + bool m_useDisplayControlHWStereo ; <nl> + <nl> / * ! < @ brief position behavior of ass subtitiles when setting " subtitle position on screen " set to " fixed " <nl> True to show at the fixed position set in video calibration <nl> False to show at the bottom of video ( default ) * / <nl> mmm a / xbmc / windowing / windows / WinSystemWin32DX . cpp <nl> ppp b / xbmc / windowing / windows / WinSystemWin32DX . cpp <nl> <nl> <nl> # include " WinSystemWin32DX . h " <nl> # include " guilib / gui3d . h " <nl> + # include " guilib / GraphicContext . h " <nl> + # include " settings / DisplaySettings . h " <nl> # include " settings / Settings . h " <nl> # include " threads / SingleLock . h " <nl> # include " utils / CharsetConverter . h " <nl> bool CWinSystemWin32DX : : SetFullScreen ( bool fullScreen , RESOLUTION_INFO & res , boo <nl> keybd_event ( VK_MENU , 0 , KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP , 0 ) ; <nl> } <nl> <nl> - / / to disable stereo mode in windowed mode we must recreate swapchain and then change display mode <nl> + / / most 3D content has 23 . 976fps , so switch for this mode <nl> + if ( g_graphicsContext . GetStereoMode ( ) = = RENDER_STEREO_MODE_HARDWAREBASED ) <nl> + res = CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( CResolutionUtils : : ChooseBestResolution ( 24 . f / 1 . 001f , res . iWidth , true ) ) ; <nl> + <nl> / / so this flags delays call SetFullScreen _after_ resetting render system <nl> - bool delaySetFS = CRenderSystemDX : : m_bHWStereoEnabled & & UseWindowedDX ( fullScreen ) ; <nl> + bool delaySetFS = CRenderSystemDX : : m_bHWStereoEnabled ; <nl> if ( ! delaySetFS ) <nl> CWinSystemWin32 : : SetFullScreen ( fullScreen , res , blankOtherDisplays ) ; <nl> <nl> / / this needed to prevent resize / move events from DXGI during changing mode <nl> CWinSystemWin32 : : m_IsAlteringWindow = true ; <nl> CRenderSystemDX : : ResetRenderSystem ( res . iWidth , res . iHeight , fullScreen , res . fRefreshRate ) ; <nl> - CWinSystemWin32 : : m_IsAlteringWindow = false ; <nl> <nl> if ( delaySetFS ) <nl> + { <nl> / / now resize window and force changing resolution if stereo mode disabled <nl> - CWinSystemWin32 : : SetFullScreenEx ( fullScreen , res , blankOtherDisplays , ! CRenderSystemDX : : m_bHWStereoEnabled ) ; <nl> + if ( UseWindowedDX ( fullScreen ) ) <nl> + CWinSystemWin32 : : SetFullScreenEx ( fullScreen , res , blankOtherDisplays , ! CRenderSystemDX : : m_bHWStereoEnabled ) ; <nl> + else <nl> + { <nl> + CRenderSystemDX : : SetFullScreenInternal ( ) ; <nl> + CRenderSystemDX : : CreateWindowSizeDependentResources ( ) ; <nl> + } <nl> + } <nl> + CWinSystemWin32 : : m_IsAlteringWindow = false ; <nl> <nl> return true ; <nl> } <nl>
|
Merge pull request from afedchin / dxx_fixes
|
xbmc/xbmc
|
752f3772523aa7fcb9398d555d351589e77cdca8
|
2016-04-15T12:44:58Z
|
mmm a / modules / canbus / canbus . cc <nl> ppp b / modules / canbus / canbus . cc <nl> using apollo : : common : : adapter : : AdapterManager ; <nl> using apollo : : common : : time : : Clock ; <nl> using apollo : : control : : ControlCommand ; <nl> using apollo : : drivers : : canbus : : CanClientFactory ; <nl> + using apollo : : guardian : : GuardianCommand ; <nl> <nl> - std : : string Canbus : : Name ( ) const { <nl> - return FLAGS_canbus_module_name ; <nl> - } <nl> + std : : string Canbus : : Name ( ) const { return FLAGS_canbus_module_name ; } <nl> <nl> Status Canbus : : Init ( ) { <nl> AdapterManager : : Init ( FLAGS_canbus_adapter_config_filename ) ; <nl> Status Canbus : : Start ( ) { <nl> const double duration = 1 . 0 / FLAGS_chassis_freq ; <nl> timer_ = AdapterManager : : CreateTimer ( ros : : Duration ( duration ) , <nl> & Canbus : : OnTimer , this ) ; <nl> - AdapterManager : : AddControlCommandCallback ( & Canbus : : OnControlCommand , this ) ; <nl> + <nl> + / / TODO ( QiL ) : depreacte this <nl> + if ( ! FLAGS_receive_guardian ) { <nl> + AdapterManager : : AddControlCommandCallback ( & Canbus : : OnControlCommand , this ) ; <nl> + } else { <nl> + AdapterManager : : AddGuardianCallback ( & Canbus : : OnGuardianCommand , this ) ; <nl> + } <nl> <nl> / / last step : publish monitor messages <nl> apollo : : common : : monitor : : MonitorLogBuffer buffer ( & monitor_logger_ ) ; <nl> void Canbus : : OnControlCommand ( const ControlCommand & control_command ) { <nl> can_sender_ . Update ( ) ; <nl> } <nl> <nl> + void Canbus : : OnGuardianCommand ( const GuardianCommand & guardian_command ) { <nl> + apollo : : control : : ControlCommand control_command ; <nl> + control_command . CopyFrom ( guardian_command . control_command ( ) ) ; <nl> + OnControlCommand ( control_command ) ; <nl> + } <nl> + <nl> / / Send the error to monitor and return it <nl> Status Canbus : : OnError ( const std : : string & error_msg ) { <nl> apollo : : common : : monitor : : MonitorLogBuffer buffer ( & monitor_logger_ ) ; <nl> mmm a / modules / canbus / canbus . h <nl> ppp b / modules / canbus / canbus . h <nl> <nl> # include " modules / drivers / canbus / can_comm / can_sender . h " <nl> # include " modules / drivers / canbus / can_comm / message_manager . h " <nl> # include " modules / drivers / canbus / proto / can_card_parameter . pb . h " <nl> + # include " modules / guardian / proto / guardian . pb . h " <nl> <nl> / * * <nl> * @ namespace apollo : : canbus <nl> namespace apollo { <nl> namespace canbus { <nl> <nl> / * * <nl> - * @ class Canbus <nl> - * <nl> - * @ brief canbus module main class . <nl> - * It processes the control data to send protocol messages to can card . <nl> - * / <nl> + * @ class Canbus <nl> + * <nl> + * @ brief canbus module main class . <nl> + * It processes the control data to send protocol messages to can card . <nl> + * / <nl> class Canbus : public apollo : : common : : ApolloApp { <nl> public : <nl> - Canbus ( ) : <nl> - monitor_logger_ ( apollo : : common : : monitor : : MonitorMessageItem : : CANBUS ) { } <nl> + Canbus ( ) <nl> + : monitor_logger_ ( apollo : : common : : monitor : : MonitorMessageItem : : CANBUS ) { } <nl> <nl> / * * <nl> - * @ brief obtain module name <nl> - * @ return module name <nl> - * / <nl> + * @ brief obtain module name <nl> + * @ return module name <nl> + * / <nl> std : : string Name ( ) const override ; <nl> <nl> / * * <nl> - * @ brief module initialization function <nl> - * @ return initialization status <nl> - * / <nl> + * @ brief module initialization function <nl> + * @ return initialization status <nl> + * / <nl> apollo : : common : : Status Init ( ) override ; <nl> <nl> / * * <nl> - * @ brief module start function <nl> - * @ return start status <nl> - * / <nl> + * @ brief module start function <nl> + * @ return start status <nl> + * / <nl> apollo : : common : : Status Start ( ) override ; <nl> <nl> / * * <nl> - * @ brief module stop function <nl> - * / <nl> + * @ brief module stop function <nl> + * / <nl> void Stop ( ) override ; <nl> <nl> private : <nl> class Canbus : public apollo : : common : : ApolloApp { <nl> void PublishChassisDetail ( ) ; <nl> void OnTimer ( const ros : : TimerEvent & event ) ; <nl> void OnControlCommand ( const apollo : : control : : ControlCommand & control_command ) ; <nl> + void OnGuardianCommand ( <nl> + const apollo : : guardian : : GuardianCommand & guardian_command ) ; <nl> apollo : : common : : Status OnError ( const std : : string & error_msg ) ; <nl> void RegisterCanClients ( ) ; <nl> <nl> mmm a / modules / canbus / common / canbus_gflags . cc <nl> ppp b / modules / canbus / common / canbus_gflags . cc <nl> DEFINE_bool ( enable_chassis_detail_pub , false , " Chassis Detail message publish " ) ; <nl> / / canbus test files <nl> DEFINE_string ( canbus_test_file , " modules / canbus / testdata / canbus_test . pb . txt " , <nl> " canbus tester input test file , in ControlCommand pb format . " ) ; <nl> + <nl> + / / enable receiving guardian command <nl> + / / TODO ( QiL ) : depreciate this after test <nl> + DEFINE_bool ( receive_guardian , false , <nl> + " Enable receiving guardian message on canbus side " ) ; <nl> mmm a / modules / canbus / common / canbus_gflags . h <nl> ppp b / modules / canbus / common / canbus_gflags . h <nl> DECLARE_bool ( enable_chassis_detail_pub ) ; <nl> <nl> / / canbus test files <nl> DECLARE_string ( canbus_test_file ) ; <nl> + <nl> + / / canbus test files <nl> + DECLARE_bool ( receive_guardian ) ; <nl> # endif <nl> mmm a / modules / guardian / guardian . cc <nl> ppp b / modules / guardian / guardian . cc <nl> void Guardian : : OnControl ( const ControlCommand & message ) { <nl> <nl> void Guardian : : ByPassControlCommand ( ) { <nl> std : : lock_guard < std : : mutex > lock ( mutex_ ) ; <nl> - guardian_cmd_ . CopyFrom ( control_cmd_ ) ; <nl> + guardian_cmd_ . mutable_control_command ( ) - > CopyFrom ( control_cmd_ ) ; <nl> } <nl> <nl> void Guardian : : TriggerSafetyMode ( ) { <nl> void Guardian : : TriggerSafetyMode ( ) { <nl> } <nl> } <nl> <nl> - guardian_cmd_ . set_throttle ( 0 . 0 ) ; <nl> - guardian_cmd_ . set_steering_target ( 0 . 0 ) ; <nl> - guardian_cmd_ . set_steering_rate ( 0 . 0 ) ; <nl> - guardian_cmd_ . set_is_in_safe_mode ( true ) ; <nl> + guardian_cmd_ . mutable_control_command ( ) - > set_throttle ( 0 . 0 ) ; <nl> + guardian_cmd_ . mutable_control_command ( ) - > set_steering_target ( 0 . 0 ) ; <nl> + guardian_cmd_ . mutable_control_command ( ) - > set_steering_rate ( 0 . 0 ) ; <nl> + guardian_cmd_ . mutable_control_command ( ) - > set_is_in_safe_mode ( true ) ; <nl> <nl> if ( system_status_ . require_emergency_stop ( ) | | sensor_malfunction | | <nl> obstacle_detected ) { <nl> AINFO < < " Emergency stop triggered ! with system status from monitor as : " <nl> < < system_status_ . require_emergency_stop ( ) ; <nl> - guardian_cmd_ . set_brake ( FLAGS_guardian_cmd_emergency_stop_percentage ) ; <nl> + guardian_cmd_ . mutable_control_command ( ) - > set_brake ( <nl> + FLAGS_guardian_cmd_emergency_stop_percentage ) ; <nl> } else { <nl> AINFO < < " Soft stop triggered ! with system status from monitor as : " <nl> < < system_status_ . require_emergency_stop ( ) ; <nl> - guardian_cmd_ . set_brake ( FLAGS_guardian_cmd_soft_stop_percentage ) ; <nl> + guardian_cmd_ . mutable_control_command ( ) - > set_brake ( <nl> + FLAGS_guardian_cmd_soft_stop_percentage ) ; <nl> } <nl> } <nl> <nl> mmm a / modules / guardian / proto / guardian . proto <nl> ppp b / modules / guardian / proto / guardian . proto <nl> <nl> syntax = " proto2 " ; <nl> package apollo . guardian ; <nl> <nl> - import " modules / canbus / proto / chassis . proto " ; <nl> import " modules / common / proto / header . proto " ; <nl> - import " modules / common / proto / vehicle_signal . proto " ; <nl> - import " modules / control / proto / pad_msg . proto " ; <nl> - import " modules / common / proto / drive_state . proto " ; <nl> + import " modules / control / proto / control_cmd . proto " ; <nl> <nl> - enum TurnSignal { <nl> - TURN_NONE = 0 ; <nl> - TURN_LEFT = 1 ; <nl> - TURN_RIGHT = 2 ; <nl> - } <nl> - <nl> - message LatencyStats { <nl> - optional double total_time_ms = 1 ; <nl> - repeated double controller_time_ms = 2 ; <nl> - optional bool total_time_exceeded = 3 ; <nl> - } <nl> - <nl> - / / next id : 27 <nl> message GuardianCommand { <nl> optional apollo . common . Header header = 1 ; <nl> - / / target throttle in percentage [ 0 , 100 ] <nl> - optional double throttle = 3 ; <nl> - <nl> - / / target brake in percentage [ 0 , 100 ] <nl> - optional double brake = 4 ; <nl> - <nl> - / / target non - directional steering rate , in percentage of full scale per second [ 0 , 100 ] <nl> - optional double steering_rate = 6 ; <nl> - <nl> - / / target steering angle , in percentage of full scale [ - 100 , 100 ] <nl> - optional double steering_target = 7 ; <nl> - <nl> - / / parking brake engage . true : engaged <nl> - optional bool parking_brake = 8 ; <nl> - <nl> - / / target speed , in m / s <nl> - optional double speed = 9 ; <nl> - <nl> - / / target acceleration in m ` s ^ - 2 <nl> - optional double acceleration = 10 ; <nl> - <nl> - / / model reset <nl> - optional bool reset_model = 16 [ deprecated = true ] ; <nl> - / / engine on / off , true : engine on <nl> - optional bool engine_on_off = 17 ; <nl> - / / completion percentage of trajectory planned in last cycle <nl> - optional double trajectory_fraction = 18 ; <nl> - optional apollo . canbus . Chassis . DrivingMode driving_mode = 19 [ deprecated = true ] ; <nl> - optional apollo . canbus . Chassis . GearPosition gear_location = 20 ; <nl> - <nl> - optional Debug debug = 22 ; <nl> - optional apollo . common . VehicleSignal signal = 23 ; <nl> - optional LatencyStats latency_stats = 24 ; <nl> - optional apollo . control . PadMessage pad_msg = 25 ; <nl> - optional apollo . common . EngageAdvice engage_advice = 26 ; <nl> - optional bool is_in_safe_mode = 27 [ default = false ] ; <nl> - <nl> - / / deprecated fields <nl> - optional bool left_turn = 13 [ deprecated = true ] ; <nl> - optional bool right_turn = 14 [ deprecated = true ] ; <nl> - optional bool high_beam = 11 [ deprecated = true ] ; <nl> - optional bool low_beam = 12 [ deprecated = true ] ; <nl> - optional bool horn = 15 [ deprecated = true ] ; <nl> - optional TurnSignal turnsignal = 21 [ deprecated = true ] ; <nl> - } <nl> - <nl> - message SimpleLongitudinalDebug { <nl> - optional double station_reference = 1 ; <nl> - optional double station_error = 2 ; <nl> - optional double station_error_limited = 3 ; <nl> - optional double preview_station_error = 4 ; <nl> - optional double speed_reference = 5 ; <nl> - optional double speed_error = 6 ; <nl> - optional double speed_controller_input_limited = 7 ; <nl> - optional double preview_speed_reference = 8 ; <nl> - optional double preview_speed_error = 9 ; <nl> - optional double preview_acceleration_reference = 10 ; <nl> - optional double acceleration_cmd_closeloop = 11 ; <nl> - optional double acceleration_cmd = 12 ; <nl> - optional double acceleration_lookup = 13 ; <nl> - optional double speed_lookup = 14 ; <nl> - optional double calibration_value = 15 ; <nl> - optional double throttle_cmd = 16 ; <nl> - optional double brake_cmd = 17 ; <nl> - optional bool is_full_stop = 18 ; <nl> - optional double slope_offset_compensation = 19 ; <nl> - optional double current_station = 20 ; <nl> - optional double path_remain = 21 ; <nl> - } <nl> - <nl> - message SimpleLateralDebug { <nl> - optional double lateral_error = 1 ; <nl> - optional double ref_heading = 2 ; <nl> - optional double heading = 3 ; <nl> - optional double heading_error = 4 ; <nl> - optional double heading_error_rate = 5 ; <nl> - optional double lateral_error_rate = 6 ; <nl> - optional double curvature = 7 ; <nl> - optional double steer_angle = 8 ; <nl> - optional double steer_angle_feedforward = 9 ; <nl> - optional double steer_angle_lateral_contribution = 10 ; <nl> - optional double steer_angle_lateral_rate_contribution = 11 ; <nl> - optional double steer_angle_heading_contribution = 12 ; <nl> - optional double steer_angle_heading_rate_contribution = 13 ; <nl> - optional double steer_angle_feedback = 14 ; <nl> - optional double steering_position = 15 ; <nl> - optional double ref_speed = 16 ; <nl> - optional double steer_angle_limited = 17 ; <nl> - } <nl> - <nl> - message SimpleMPCDebug { <nl> - optional double lateral_error = 1 ; <nl> - optional double ref_heading = 2 ; <nl> - optional double heading = 3 ; <nl> - optional double heading_error = 4 ; <nl> - optional double heading_error_rate = 5 ; <nl> - optional double lateral_error_rate = 6 ; <nl> - optional double curvature = 7 ; <nl> - optional double steer_angle = 8 ; <nl> - optional double steer_angle_feedforward = 9 ; <nl> - optional double steer_angle_lateral_contribution = 10 ; <nl> - optional double steer_angle_lateral_rate_contribution = 11 ; <nl> - optional double steer_angle_heading_contribution = 12 ; <nl> - optional double steer_angle_heading_rate_contribution = 13 ; <nl> - optional double steer_angle_feedback = 14 ; <nl> - optional double steering_position = 15 ; <nl> - optional double ref_speed = 16 ; <nl> - optional double steer_angle_limited = 17 ; <nl> - optional double station_reference = 18 ; <nl> - optional double station_error = 19 ; <nl> - optional double speed_reference = 20 ; <nl> - optional double speed_error = 21 ; <nl> - optional double acceleration_reference = 22 ; <nl> - optional bool is_full_stop = 23 ; <nl> - optional double station_feedback = 24 ; <nl> - optional double speed_feedback = 25 ; <nl> - optional double acceleration_cmd_closeloop = 26 ; <nl> - optional double acceleration_cmd = 27 ; <nl> - optional double acceleration_lookup = 28 ; <nl> - optional double speed_lookup = 29 ; <nl> - optional double calibration_value = 30 ; <nl> - repeated double matrix_q_updated = 31 ; / / matrix_q_updated_ size = 6 <nl> - repeated double matrix_r_updated = 32 ; / / matrix_r_updated_ size = 2 <nl> - } <nl> - <nl> - message InputDebug { <nl> - optional apollo . common . Header localization_header = 1 ; <nl> - optional apollo . common . Header canbus_header = 2 ; <nl> - optional apollo . common . Header trajectory_header = 3 ; <nl> + optional apollo . control . ControlCommand control_command = 2 ; <nl> } <nl> - <nl> - message Debug { <nl> - optional SimpleLongitudinalDebug simple_lon_debug = 1 ; <nl> - optional SimpleLateralDebug simple_lat_debug = 2 ; <nl> - optional InputDebug input_debug = 3 ; <nl> - optional SimpleMPCDebug simple_mpc_debug = 4 ; <nl> - } <nl>
|
Canbus & Guardian : re - org guardian and subscribed by canbus , default off by gflag ( )
|
ApolloAuto/apollo
|
a07eebeb0a11b01bd0f70622d7327057cc7596a3
|
2018-06-06T00:48:54Z
|
mmm a / src / compiler / backend / ppc / instruction - selector - ppc . cc <nl> ppp b / src / compiler / backend / ppc / instruction - selector - ppc . cc <nl> void InstructionSelector : : VisitF64x2Max ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> <nl> void InstructionSelector : : VisitLoadTransform ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> <nl> + void InstructionSelector : : VisitI8x16Abs ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> + <nl> + void InstructionSelector : : VisitI16x8Abs ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> + <nl> + void InstructionSelector : : VisitI32x4Abs ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> + <nl> / / static <nl> MachineOperatorBuilder : : Flags <nl> InstructionSelector : : SupportedMachineOperatorFlags ( ) { <nl> mmm a / src / compiler / backend / s390 / instruction - selector - s390 . cc <nl> ppp b / src / compiler / backend / s390 / instruction - selector - s390 . cc <nl> void InstructionSelector : : VisitI64x2Mul ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> <nl> void InstructionSelector : : VisitLoadTransform ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> <nl> + void InstructionSelector : : VisitI8x16Abs ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> + <nl> + void InstructionSelector : : VisitI16x8Abs ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> + <nl> + void InstructionSelector : : VisitI32x4Abs ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> + <nl> / / static <nl> MachineOperatorBuilder : : Flags <nl> InstructionSelector : : SupportedMachineOperatorFlags ( ) { <nl>
|
PPC / s390 : [ wasm - simd ] [ arm ] Implement integer absolute
|
v8/v8
|
c2e21592edd681b3662fcd60e271d355c1fbd94d
|
2020-03-03T14:24:03Z
|
mmm a / lib / libsquish / Makefile . in <nl> ppp b / lib / libsquish / Makefile . in <nl> ifeq ( @ USE_TEXTUREPACKER_NATIVE @ , 1 ) <nl> NATIVE_LIB = libsquish - native . so <nl> CLEAN_FILES + = $ ( NATIVE_LIB ) <nl> <nl> - ifeq ( $ ( findstring osx , $ ( ARCH ) ) , osx ) <nl> - ifneq ( , $ ( findstring x86_64 , $ ( CXXFLAGS ) ) ) <nl> - NATIVE_ARCH = - m32 <nl> - else <nl> - NATIVE_ARCH = - m64 <nl> - endif <nl> + ifeq ( $ ( findstring osx , $ ( ARCH ) ) , osx ) <nl> + NATIVE_ARCH = $ ( shell echo $ ( CXXFLAGS ) | grep x86_64 > / dev / null & & echo - m64 | | echo - m32 ) <nl> endif <nl> <nl> all : $ ( LIB ) $ ( NATIVE_LIB ) <nl> mmm a / tools / TexturePacker / Makefile . in <nl> ppp b / tools / TexturePacker / Makefile . in <nl> ifeq ( @ USE_TEXTUREPACKER_NATIVE @ , 1 ) <nl> NATIVE_ROOT_PATH = @ USE_TEXTUREPACKER_NATIVE_ROOT @ <nl> ifdef NATIVE_ROOT_PATH <nl> ifeq ( $ ( findstring osx , @ ARCH @ ) , osx ) <nl> - ifneq ( , $ ( findstring x86_64 , $ ( CXXFLAGS ) ) ) <nl> - CXXFLAGS + = - m32 <nl> - else <nl> - CXXFLAGS + = - m64 <nl> - endif <nl> + NATIVE_ARCH = $ ( shell echo $ ( CXXFLAGS ) | grep x86_64 > / dev / null & & echo - m64 | | echo - m32 ) <nl> endif <nl> CXXFLAGS + = - I $ ( NATIVE_ROOT_PATH ) / include <nl> LIBS + = - L $ ( NATIVE_ROOT_PATH ) / lib <nl> all : $ ( TARGET ) <nl> ifeq ( @ USE_TEXTUREPACKER_NATIVE @ , 1 ) <nl> # TexturePacker run native on build system , build it with native tools <nl> $ ( TARGET ) : $ ( SRCS ) <nl> - g + + $ ( DEFINES ) $ ( CXXFLAGS ) $ ( SRCS ) $ ( LIBS ) - o $ ( TARGET ) <nl> + g + + $ ( DEFINES ) $ ( NATIVE_ARCH ) $ ( CXXFLAGS ) $ ( SRCS ) $ ( LIBS ) - o $ ( TARGET ) <nl> clean : <nl> rm - f $ ( TARGET ) <nl> else <nl>
|
[ osx / ios ] fixed i386 / x86_64 pick for native compile of libsquash and texturepacker
|
xbmc/xbmc
|
240b7a9fe9fdbc254bbb11957dcc65f3f160ec4b
|
2012-05-13T04:06:34Z
|
mmm a / test / core / tsi / ssl_transport_security_test . cc <nl> ppp b / test / core / tsi / ssl_transport_security_test . cc <nl> <nl> * <nl> * / <nl> <nl> + # include " src / core / tsi / ssl_transport_security . h " <nl> + <nl> + # include < grpc / grpc . h > <nl> + # include < grpc / support / alloc . h > <nl> + # include < grpc / support / log . h > <nl> + # include < grpc / support / string_util . h > <nl> # include < stdbool . h > <nl> # include < stdio . h > <nl> # include < string . h > <nl> <nl> # include " src / core / lib / iomgr / load_file . h " <nl> # include " src / core / lib / security / security_connector / security_connector . h " <nl> - # include " src / core / tsi / ssl_transport_security . h " <nl> # include " src / core / tsi / transport_security . h " <nl> # include " src / core / tsi / transport_security_interface . h " <nl> # include " test / core / tsi / transport_security_test_lib . h " <nl> # include " test / core / util / test_config . h " <nl> <nl> - # include < grpc / grpc . h > <nl> - # include < grpc / support / alloc . h > <nl> - # include < grpc / support / log . h > <nl> - # include < grpc / support / string_util . h > <nl> - <nl> extern " C " { <nl> # include < openssl / crypto . h > <nl> # include < openssl / pem . h > <nl> extern " C " { <nl> # define SSL_TSI_TEST_SERVER_KEY_CERT_PAIRS_NUM 2 <nl> # define SSL_TSI_TEST_BAD_SERVER_KEY_CERT_PAIRS_NUM 1 <nl> # define SSL_TSI_TEST_CREDENTIALS_DIR " src / core / tsi / test_creds / " <nl> + # define SSL_TSI_TEST_WRONG_SNI " test . google . cn " <nl> <nl> / / OpenSSL 1 . 1 uses AES256 for encryption session ticket by default so specify <nl> / / different STEK size . <nl> static void ssl_test_check_handshaker_peers ( tsi_test_fixture * fixture ) { <nl> check_session_reusage ( ssl_fixture , & peer ) ; <nl> check_alpn ( ssl_fixture , & peer ) ; <nl> check_security_level ( & peer ) ; <nl> - if ( ssl_fixture - > server_name_indication ! = nullptr ) { <nl> - check_server1_peer ( & peer ) ; <nl> - } else { <nl> + if ( ssl_fixture - > server_name_indication = = nullptr | | <nl> + strcmp ( ssl_fixture - > server_name_indication , SSL_TSI_TEST_WRONG_SNI ) = = <nl> + 0 ) { <nl> + / / Expect server to use default server0 . pem . <nl> check_server0_peer ( & peer ) ; <nl> + } else { <nl> + / / Expect server to use server1 . pem . <nl> + check_server1_peer ( & peer ) ; <nl> } <nl> } else { <nl> GPR_ASSERT ( ssl_fixture - > base . client_result = = nullptr ) ; <nl> void ssl_tsi_test_do_handshake_with_server_name_indication_wild_star_domain ( ) { <nl> tsi_test_fixture_destroy ( fixture ) ; <nl> } <nl> <nl> + void ssl_tsi_test_do_handshake_with_wrong_server_name_indication ( ) { <nl> + gpr_log ( GPR_INFO , <nl> + " ssl_tsi_test_do_handshake_with_wrong_server_name_indication " ) ; <nl> + / * server certs do not contain " test . google . cn " . * / <nl> + tsi_test_fixture * fixture = ssl_tsi_test_fixture_create ( ) ; <nl> + ssl_tsi_test_fixture * ssl_fixture = <nl> + reinterpret_cast < ssl_tsi_test_fixture * > ( fixture ) ; <nl> + ssl_fixture - > server_name_indication = <nl> + const_cast < char * > ( SSL_TSI_TEST_WRONG_SNI ) ; <nl> + tsi_test_do_handshake ( fixture ) ; <nl> + tsi_test_fixture_destroy ( fixture ) ; <nl> + } <nl> + <nl> void ssl_tsi_test_do_handshake_with_bad_server_cert ( ) { <nl> gpr_log ( GPR_INFO , " ssl_tsi_test_do_handshake_with_bad_server_cert " ) ; <nl> tsi_test_fixture * fixture = ssl_tsi_test_fixture_create ( ) ; <nl> int main ( int argc , char * * argv ) { <nl> ssl_tsi_test_do_handshake_with_client_authentication_and_root_store ( ) ; <nl> ssl_tsi_test_do_handshake_with_server_name_indication_exact_domain ( ) ; <nl> ssl_tsi_test_do_handshake_with_server_name_indication_wild_star_domain ( ) ; <nl> + ssl_tsi_test_do_handshake_with_wrong_server_name_indication ( ) ; <nl> ssl_tsi_test_do_handshake_with_bad_server_cert ( ) ; <nl> ssl_tsi_test_do_handshake_with_bad_client_cert ( ) ; <nl> # ifdef OPENSSL_IS_BORINGSSL <nl>
|
Add a test on bad SNI and ensure handshake succeeds
|
grpc/grpc
|
b21fc9c4d4c0e144028ab5f9c199a38fd33ecc19
|
2020-03-19T01:03:54Z
|
mmm a / Telegram / SourceFiles / ui / filter_icons . cpp <nl> ppp b / Telegram / SourceFiles / ui / filter_icons . cpp <nl> const auto kIcons = std : : vector < FilterIcons > { <nl> } / / namespace <nl> <nl> const FilterIcons & LookupFilterIcon ( FilterIcon icon ) { <nl> - Expects ( static_cast < int > ( icon ) > = 0 <nl> - & & static_cast < int > ( icon ) < kIcons . size ( ) ) ; <nl> + Expects ( static_cast < int > ( icon ) < kIcons . size ( ) ) ; <nl> <nl> return kIcons [ static_cast < int > ( icon ) ] ; <nl> } <nl> mmm a / changelog . txt <nl> ppp b / changelog . txt <nl> <nl> - 1 . 9 . 22 ( 27 . 03 . 20 ) <nl> + 1 . 9 . 22 beta ( 27 . 03 . 20 ) <nl> <nl> - Organize chats into Chat Folders if you have too many chats . <nl> <nl>
|
Beta version 1 . 9 . 22 : Fix GCC build .
|
telegramdesktop/tdesktop
|
deb76f38d7362a28c2ae42bd766041e55adc903c
|
2020-03-27T18:34:25Z
|
mmm a / xbmc / interfaces / json - rpc / JSONServiceDescription . cpp <nl> ppp b / xbmc / interfaces / json - rpc / JSONServiceDescription . cpp <nl> <nl> / * <nl> - * Copyright ( C ) 2005 - 2010 Team XBMC <nl> + * Copyright ( C ) 2005 - 2012 Team XBMC <nl> * http : / / www . xbmc . org <nl> * <nl> * This Program is free software ; you can redistribute it and / or modify <nl> <nl> using namespace std ; <nl> using namespace JSONRPC ; <nl> <nl> - JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : CJsonSchemaPropertiesMap ( ) <nl> - { <nl> - m_propertiesmap = std : : map < std : : string , JSONSchemaTypeDefinition > ( ) ; <nl> - } <nl> - <nl> - void JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : add ( JSONSchemaTypeDefinition & property ) <nl> - { <nl> - CStdString name = property . name ; <nl> - name = name . ToLower ( ) ; <nl> - m_propertiesmap [ name ] = property ; <nl> - } <nl> - <nl> - JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : begin ( ) const <nl> - { <nl> - return m_propertiesmap . begin ( ) ; <nl> - } <nl> - <nl> - JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : find ( const std : : string & key ) const <nl> - { <nl> - return m_propertiesmap . find ( key ) ; <nl> - } <nl> - <nl> - JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : end ( ) const <nl> - { <nl> - return m_propertiesmap . end ( ) ; <nl> - } <nl> - <nl> - unsigned int JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : size ( ) const <nl> - { <nl> - return m_propertiesmap . size ( ) ; <nl> - } <nl> - <nl> std : : map < std : : string , CVariant > CJSONServiceDescription : : m_notifications = std : : map < std : : string , CVariant > ( ) ; <nl> CJSONServiceDescription : : CJsonRpcMethodMap CJSONServiceDescription : : m_actionMap ; <nl> std : : map < std : : string , JSONSchemaTypeDefinition > CJSONServiceDescription : : m_types = std : : map < std : : string , JSONSchemaTypeDefinition > ( ) ; <nl> + CJSONServiceDescription : : IncompleteSchemaDefinitionMap CJSONServiceDescription : : m_incompleteDefinitions = CJSONServiceDescription : : IncompleteSchemaDefinitionMap ( ) ; <nl> <nl> JsonRpcMethodMap CJSONServiceDescription : : m_methodMaps [ ] = { <nl> / / JSON - RPC <nl> JsonRpcMethodMap CJSONServiceDescription : : m_methodMaps [ ] = { <nl> { " XBMC . GetInfoBooleans " , CXBMCOperations : : GetInfoBooleans } <nl> } ; <nl> <nl> - bool CJSONServiceDescription : : prepareDescription ( std : : string & description , CVariant & descriptionObject , std : : string & name ) <nl> - { <nl> - if ( description . empty ( ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Missing JSON Schema definition for \ " % s \ " " , name . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( description . at ( 0 ) ! = ' { ' ) <nl> - { <nl> - CStdString json ; <nl> - json . Format ( " { % s } " , description ) ; <nl> - description = json ; <nl> - } <nl> + JSONSchemaTypeDefinition : : JSONSchemaTypeDefinition ( ) <nl> + : missingReference ( " " ) , <nl> + type ( AnyValue ) , minimum ( std : : numeric_limits < double > : : min ( ) ) , maximum ( std : : numeric_limits < double > : : max ( ) ) , <nl> + exclusiveMinimum ( false ) , exclusiveMaximum ( false ) , divisibleBy ( 0 ) , <nl> + minLength ( - 1 ) , maxLength ( - 1 ) , <nl> + minItems ( 0 ) , maxItems ( 0 ) , uniqueItems ( false ) , <nl> + hasAdditionalProperties ( false ) , additionalProperties ( NULL ) <nl> + { } <nl> <nl> - descriptionObject = CJSONVariantParser : : Parse ( ( const unsigned char * ) description . c_str ( ) , description . size ( ) ) ; <nl> + bool JSONSchemaTypeDefinition : : Parse ( const CVariant & value , bool isParameter / * = false * / ) <nl> + { <nl> + bool isReferenceType = false ; <nl> + bool hasReference = false ; <nl> <nl> - / / Make sure the method description actually exists and represents an object <nl> - if ( ! descriptionObject . isObject ( ) ) <nl> + / / Check if the type of the parameter defines a json reference <nl> + / / to a type defined somewhere else <nl> + if ( value . isMember ( " $ ref " ) & & value [ " $ ref " ] . isString ( ) ) <nl> { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Unable to parse JSON Schema definition for \ " % s \ " " , name . c_str ( ) ) ; <nl> - return false ; <nl> + / / Get the name of the referenced type <nl> + std : : string refType = value [ " $ ref " ] . asString ( ) ; <nl> + / / Check if the referenced type exists <nl> + JSONSchemaTypeDefinition * referencedType = CJSONServiceDescription : : GetType ( refType ) ; <nl> + if ( refType . length ( ) < = 0 | | referencedType = = NULL ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : JSON schema type % s references an unknown type % s " , name . c_str ( ) , refType . c_str ( ) ) ; <nl> + missingReference = refType ; <nl> + return false ; <nl> + } <nl> + <nl> + std : : string typeName = name ; <nl> + * this = * referencedType ; <nl> + if ( ! typeName . empty ( ) ) <nl> + name = typeName ; <nl> + hasReference = true ; <nl> } <nl> - <nl> - CVariant : : const_iterator_map member = descriptionObject . begin_map ( ) ; <nl> - if ( member ! = descriptionObject . end_map ( ) ) <nl> - name = member - > first ; <nl> - <nl> - if ( name . empty ( ) | | <nl> - ( ! descriptionObject [ name ] . isMember ( " type " ) & & ! descriptionObject [ name ] . isMember ( " $ ref " ) & & ! descriptionObject [ name ] . isMember ( " extends " ) ) ) <nl> + else if ( value . isMember ( " id " ) & & value [ " id " ] . isString ( ) ) <nl> { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON Schema definition for \ " % s \ " " , name . c_str ( ) ) ; <nl> - return false ; <nl> + ID = GetString ( value [ " id " ] , " " ) ; <nl> + isReferenceType = true ; <nl> } <nl> <nl> - return true ; <nl> - } <nl> + / / Check if the " required " field has been defined <nl> + optional = value . isMember ( " required " ) & & value [ " required " ] . isBoolean ( ) ? ! value [ " required " ] . asBoolean ( ) : true ; <nl> <nl> - bool CJSONServiceDescription : : addMethod ( std : : string & jsonMethod , MethodCall method ) <nl> - { <nl> - CVariant descriptionObject ; <nl> - std : : string methodName ; <nl> + / / Get the " description " <nl> + if ( ! hasReference | | ( value . isMember ( " description " ) & & value [ " description " ] . isString ( ) ) ) <nl> + description = GetString ( value [ " description " ] , " " ) ; <nl> <nl> - / / Make sure the method description actually exists and represents an object <nl> - if ( ! prepareDescription ( jsonMethod , descriptionObject , methodName ) ) <nl> + if ( hasReference ) <nl> { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON Schema definition for method \ " % s \ " " , methodName . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> + / / If there is a specific default value , read it <nl> + if ( value . isMember ( " default " ) & & IsType ( value [ " default " ] , type ) ) <nl> + { <nl> + bool ok = false ; <nl> + if ( enums . size ( ) < = 0 ) <nl> + ok = true ; <nl> + / / If the type has an enum definition we must make <nl> + / / sure that the default value is a valid enum value <nl> + else <nl> + { <nl> + for ( std : : vector < CVariant > : : const_iterator itr = enums . begin ( ) ; itr ! = enums . end ( ) ; itr + + ) <nl> + { <nl> + if ( value [ " default " ] = = * itr ) <nl> + { <nl> + ok = true ; <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> <nl> - if ( m_actionMap . find ( methodName ) ! = m_actionMap . end ( ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : There already is a method with the name \ " % s \ " " , methodName . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> + if ( ok ) <nl> + defaultValue = value [ " default " ] ; <nl> + } <nl> <nl> - std : : string type = GetString ( descriptionObject [ methodName ] [ " type " ] , " " ) ; <nl> - if ( type . compare ( " method " ) ! = 0 ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON type for method \ " % s \ " " , methodName . c_str ( ) ) ; <nl> - return false ; <nl> + return true ; <nl> } <nl> <nl> - if ( method = = NULL ) <nl> + / / Check whether this type extends an existing type <nl> + if ( value . isMember ( " extends " ) ) <nl> { <nl> - unsigned int size = sizeof ( m_methodMaps ) / sizeof ( JsonRpcMethodMap ) ; <nl> - for ( unsigned int index = 0 ; index < size ; index + + ) <nl> + if ( value [ " extends " ] . isString ( ) ) <nl> { <nl> - if ( methodName . compare ( m_methodMaps [ index ] . name ) = = 0 ) <nl> + std : : string extendsName = GetString ( value [ " extends " ] , " " ) ; <nl> + if ( ! extendsName . empty ( ) ) <nl> { <nl> - method = m_methodMaps [ index ] . method ; <nl> - break ; <nl> + JSONSchemaTypeDefinition * referencedType = CJSONServiceDescription : : GetType ( extendsName ) ; <nl> + if ( referencedType = = NULL ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : JSON schema type % s extends an unknown type % s " , name . c_str ( ) , extendsName . c_str ( ) ) ; <nl> + missingReference = extendsName ; <nl> + return false ; <nl> + } <nl> + <nl> + type = referencedType - > type ; <nl> + extends . push_back ( * referencedType ) ; <nl> } <nl> } <nl> - <nl> - if ( method = = NULL ) <nl> + else if ( value [ " extends " ] . isArray ( ) ) <nl> { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Missing implementation for method \ " % s \ " " , methodName . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - / / Parse the details of the method <nl> - JsonRpcMethod newMethod ; <nl> - newMethod . name = methodName ; <nl> - newMethod . method = method ; <nl> - if ( ! parseMethod ( descriptionObject [ newMethod . name ] , newMethod ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Could not parse method \ " % s \ " " , methodName . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_actionMap . add ( newMethod ) ; <nl> + JSONSchemaType extendedType = AnyValue ; <nl> + for ( unsigned int extendsIndex = 0 ; extendsIndex < value [ " extends " ] . size ( ) ; extendsIndex + + ) <nl> + { <nl> + std : : string extendsName = GetString ( value [ " extends " ] [ extendsIndex ] , " " ) ; <nl> + if ( ! extendsName . empty ( ) ) <nl> + { <nl> + JSONSchemaTypeDefinition * referencedType = CJSONServiceDescription : : GetType ( extendsName ) ; <nl> + if ( referencedType = = NULL ) <nl> + { <nl> + extends . clear ( ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : JSON schema type % s extends an unknown type % s " , name . c_str ( ) , extendsName . c_str ( ) ) ; <nl> + missingReference = extendsName ; <nl> + return false ; <nl> + } <nl> <nl> - return true ; <nl> - } <nl> + if ( extendsIndex = = 0 ) <nl> + extendedType = referencedType - > type ; <nl> + else if ( extendedType ! = referencedType - > type ) <nl> + { <nl> + extends . clear ( ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : JSON schema type % s extends multiple JSON schema types of mismatching types " , name . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> <nl> - bool CJSONServiceDescription : : AddType ( std : : string jsonType ) <nl> - { <nl> - CVariant descriptionObject ; <nl> - std : : string typeName ; <nl> + extends . push_back ( * referencedType ) ; <nl> + } <nl> + } <nl> <nl> - if ( ! prepareDescription ( jsonType , descriptionObject , typeName ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON Schema definition for type \ " % s \ " " , typeName . c_str ( ) ) ; <nl> - return false ; <nl> + type = extendedType ; <nl> + } <nl> } <nl> <nl> - if ( m_types . find ( typeName ) ! = m_types . end ( ) ) <nl> + / / Only read the " type " attribute if it ' s <nl> + / / not an extending type <nl> + if ( extends . size ( ) < = 0 ) <nl> { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : There already is a type with the name \ " % s \ " " , typeName . c_str ( ) ) ; <nl> - return false ; <nl> + / / Get the defined type of the parameter <nl> + if ( ! CJSONServiceDescription : : parseJSONSchemaType ( value [ " type " ] , unionTypes , type , missingReference ) ) <nl> + return false ; <nl> } <nl> <nl> - / / Make sure the " id " attribute is correctly populated <nl> - descriptionObject [ typeName ] [ " id " ] = typeName ; <nl> - <nl> - JSONSchemaTypeDefinition globalType ; <nl> - globalType . name = typeName ; <nl> - <nl> - if ( ! parseTypeDefinition ( descriptionObject [ typeName ] , globalType , false ) ) <nl> + if ( HasType ( type , ObjectValue ) ) <nl> { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Could not parse type \ " % s \ " " , typeName . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> + / / If the type definition is of type " object " <nl> + / / and has a " properties " definition we need <nl> + / / to handle these as well <nl> + if ( value . isMember ( " properties " ) & & value [ " properties " ] . isObject ( ) ) <nl> + { <nl> + / / Get all child elements of the " properties " <nl> + / / object and loop through them <nl> + for ( CVariant : : const_iterator_map itr = value [ " properties " ] . begin_map ( ) ; itr ! = value [ " properties " ] . end_map ( ) ; itr + + ) <nl> + { <nl> + / / Create a new type definition , store the name <nl> + / / of the current property into it , parse it <nl> + / / recursively and add its default value <nl> + / / to the current type ' s default value <nl> + JSONSchemaTypeDefinition propertyType ; <nl> + propertyType . name = itr - > first ; <nl> + if ( ! propertyType . Parse ( itr - > second ) ) <nl> + { <nl> + missingReference = propertyType . missingReference ; <nl> + return false ; <nl> + } <nl> + defaultValue [ itr - > first ] = propertyType . defaultValue ; <nl> + properties . add ( propertyType ) ; <nl> + } <nl> + } <nl> <nl> - bool CJSONServiceDescription : : AddMethod ( std : : string jsonMethod , MethodCall method ) <nl> - { <nl> - if ( method = = NULL ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSONRPC method implementation " ) ; <nl> - return false ; <nl> + hasAdditionalProperties = true ; <nl> + additionalProperties = new JSONSchemaTypeDefinition ( ) ; <nl> + if ( value . isMember ( " additionalProperties " ) ) <nl> + { <nl> + if ( value [ " additionalProperties " ] . isBoolean ( ) ) <nl> + { <nl> + hasAdditionalProperties = value [ " additionalProperties " ] . asBoolean ( ) ; <nl> + if ( ! hasAdditionalProperties ) <nl> + { <nl> + delete additionalProperties ; <nl> + additionalProperties = NULL ; <nl> + } <nl> + } <nl> + else if ( value [ " additionalProperties " ] . isObject ( ) & & ! value [ " additionalProperties " ] . isNull ( ) ) <nl> + { <nl> + if ( ! additionalProperties - > Parse ( value [ " additionalProperties " ] ) ) <nl> + { <nl> + missingReference = additionalProperties - > missingReference ; <nl> + hasAdditionalProperties = false ; <nl> + delete additionalProperties ; <nl> + additionalProperties = NULL ; <nl> + <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Invalid additionalProperties schema definition in type % s " , name . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> + } <nl> + else <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Invalid additionalProperties definition in type % s " , name . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> + } <nl> } <nl> <nl> - return addMethod ( jsonMethod , method ) ; <nl> - } <nl> - <nl> - bool CJSONServiceDescription : : AddBuiltinMethod ( std : : string jsonMethod ) <nl> - { <nl> - return addMethod ( jsonMethod , NULL ) ; <nl> - } <nl> - <nl> - bool CJSONServiceDescription : : AddNotification ( std : : string jsonNotification ) <nl> - { <nl> - CVariant descriptionObject ; <nl> - std : : string notificationName ; <nl> - <nl> - / / Make sure the notification description actually exists and represents an object <nl> - if ( ! prepareDescription ( jsonNotification , descriptionObject , notificationName ) ) <nl> + / / If the defined parameter is an array <nl> + / / we need to check for detailed definitions <nl> + / / of the array items <nl> + if ( HasType ( type , ArrayValue ) ) <nl> { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON Schema definition for notification \ " % s \ " " , notificationName . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> + / / Check for " uniqueItems " field <nl> + if ( value . isMember ( " uniqueItems " ) & & value [ " uniqueItems " ] . isBoolean ( ) ) <nl> + uniqueItems = value [ " uniqueItems " ] . asBoolean ( ) ; <nl> + else <nl> + uniqueItems = false ; <nl> <nl> - if ( m_notifications . find ( notificationName ) ! = m_notifications . end ( ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : There already is a notification with the name \ " % s \ " " , notificationName . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - std : : string type = GetString ( descriptionObject [ notificationName ] [ " type " ] , " " ) ; <nl> - if ( type . compare ( " notification " ) ! = 0 ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON type for notification \ " % s \ " " , notificationName . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_notifications [ notificationName ] = descriptionObject ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - int CJSONServiceDescription : : GetVersion ( ) <nl> - { <nl> - return JSONRPC_SERVICE_VERSION ; <nl> - } <nl> - <nl> - JSONRPC_STATUS CJSONServiceDescription : : Print ( CVariant & result , ITransportLayer * transport , IClient * client , <nl> - bool printDescriptions / * = true * / , bool printMetadata / * = false * / , bool filterByTransport / * = true * / , <nl> - std : : string filterByName / * = " " * / , std : : string filterByType / * = " " * / , bool printReferences / * = true * / ) <nl> - { <nl> - std : : map < std : : string , JSONSchemaTypeDefinition > types ; <nl> - CJsonRpcMethodMap methods ; <nl> - std : : map < std : : string , CVariant > notifications ; <nl> - <nl> - int clientPermissions = client - > GetPermissionFlags ( ) ; <nl> - int transportCapabilities = transport - > GetCapabilities ( ) ; <nl> - <nl> - if ( filterByName . size ( ) > 0 ) <nl> - { <nl> - CStdString name = filterByName ; <nl> - <nl> - if ( filterByType = = " method " ) <nl> - { <nl> - name = name . ToLower ( ) ; <nl> - <nl> - CJsonRpcMethodMap : : JsonRpcMethodIterator methodIterator = m_actionMap . find ( name ) ; <nl> - if ( methodIterator ! = m_actionMap . end ( ) & & <nl> - ( clientPermissions & methodIterator - > second . permission ) = = methodIterator - > second . permission & & ( ( transportCapabilities & methodIterator - > second . transportneed ) = = methodIterator - > second . transportneed | | ! filterByTransport ) ) <nl> - methods . add ( methodIterator - > second ) ; <nl> - else <nl> - return InvalidParams ; <nl> - } <nl> - else if ( filterByType = = " namespace " ) <nl> + / / Check for " additionalItems " field <nl> + if ( value . isMember ( " additionalItems " ) ) <nl> { <nl> - / / append a . delimiter to make sure we check for a namespace <nl> - name = name . ToLower ( ) . append ( " . " ) ; <nl> - <nl> - CJsonRpcMethodMap : : JsonRpcMethodIterator methodIterator ; <nl> - CJsonRpcMethodMap : : JsonRpcMethodIterator methodIteratorEnd = m_actionMap . end ( ) ; <nl> - for ( methodIterator = m_actionMap . begin ( ) ; methodIterator ! = methodIteratorEnd ; methodIterator + + ) <nl> + / / If it is an object , there is only one schema for it <nl> + if ( value [ " additionalItems " ] . isObject ( ) ) <nl> { <nl> - / / Check if the given name is at the very beginning of the method name <nl> - if ( methodIterator - > first . find ( name ) = = 0 & & <nl> - ( clientPermissions & methodIterator - > second . permission ) = = methodIterator - > second . permission & & ( ( transportCapabilities & methodIterator - > second . transportneed ) = = methodIterator - > second . transportneed | | ! filterByTransport ) ) <nl> - methods . add ( methodIterator - > second ) ; <nl> + JSONSchemaTypeDefinition additionalItem ; <nl> + if ( additionalItem . Parse ( value [ " additionalItems " ] ) ) <nl> + additionalItems . push_back ( additionalItem ) ; <nl> + else <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " Invalid \ " additionalItems \ " value for type % s " , name . c_str ( ) ) ; <nl> + missingReference = additionalItem . missingReference ; <nl> + return false ; <nl> + } <nl> } <nl> + / / If it is an array there may be multiple schema definitions <nl> + else if ( value [ " additionalItems " ] . isArray ( ) ) <nl> + { <nl> + for ( unsigned int itemIndex = 0 ; itemIndex < value [ " additionalItems " ] . size ( ) ; itemIndex + + ) <nl> + { <nl> + JSONSchemaTypeDefinition additionalItem ; <nl> <nl> - if ( methods . begin ( ) = = methods . end ( ) ) <nl> - return InvalidParams ; <nl> - } <nl> - else if ( filterByType = = " type " ) <nl> - { <nl> - std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIterator = m_types . find ( name ) ; <nl> - if ( typeIterator ! = m_types . end ( ) ) <nl> - types [ typeIterator - > first ] = typeIterator - > second ; <nl> - else <nl> - return InvalidParams ; <nl> - } <nl> - else if ( filterByType = = " notification " ) <nl> - { <nl> - std : : map < std : : string , CVariant > : : const_iterator notificationIterator = m_notifications . find ( name ) ; <nl> - if ( notificationIterator ! = m_notifications . end ( ) ) <nl> - notifications [ notificationIterator - > first ] = notificationIterator - > second ; <nl> - else <nl> - return InvalidParams ; <nl> + if ( additionalItem . Parse ( value [ " additionalItems " ] [ itemIndex ] ) ) <nl> + additionalItems . push_back ( additionalItem ) ; <nl> + else <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " Invalid \ " additionalItems \ " value ( item % d ) for type % s " , itemIndex , name . c_str ( ) ) ; <nl> + missingReference = additionalItem . missingReference ; <nl> + return false ; <nl> + } <nl> + } <nl> + } <nl> + / / If it is not a ( array of ) schema and not a bool ( default value is false ) <nl> + / / it has an invalid value <nl> + else if ( ! value [ " additionalItems " ] . isBoolean ( ) ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " Invalid \ " additionalItems \ " definition for type % s " , name . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> } <nl> - else <nl> - return InvalidParams ; <nl> <nl> - / / If we need to print all referenced types we have to go through all parameters etc <nl> - if ( printReferences ) <nl> + / / If the " items " field is a single object <nl> + / / we can parse that directly <nl> + if ( value . isMember ( " items " ) ) <nl> { <nl> - std : : vector < std : : string > referencedTypes ; <nl> - <nl> - / / Loop through all printed types to get all referenced types <nl> - std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIterator ; <nl> - std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIteratorEnd = types . end ( ) ; <nl> - for ( typeIterator = types . begin ( ) ; typeIterator ! = typeIteratorEnd ; typeIterator + + ) <nl> - getReferencedTypes ( typeIterator - > second , referencedTypes ) ; <nl> - <nl> - / / Loop through all printed method ' s parameters and return value to get all referenced types <nl> - CJsonRpcMethodMap : : JsonRpcMethodIterator methodIterator ; <nl> - CJsonRpcMethodMap : : JsonRpcMethodIterator methodIteratorEnd = methods . end ( ) ; <nl> - for ( methodIterator = methods . begin ( ) ; methodIterator ! = methodIteratorEnd ; methodIterator + + ) <nl> + if ( value [ " items " ] . isObject ( ) ) <nl> { <nl> - for ( unsigned int index = 0 ; index < methodIterator - > second . parameters . size ( ) ; index + + ) <nl> - getReferencedTypes ( methodIterator - > second . parameters . at ( index ) , referencedTypes ) ; <nl> - <nl> - getReferencedTypes ( methodIterator - > second . returns , referencedTypes ) ; <nl> + JSONSchemaTypeDefinition item ; <nl> + if ( ! item . Parse ( value [ " items " ] ) ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " Invalid item definition in \ " items \ " for type % s " , name . c_str ( ) ) ; <nl> + missingReference = item . missingReference ; <nl> + return false ; <nl> + } <nl> + items . push_back ( item ) ; <nl> } <nl> - <nl> - for ( unsigned int index = 0 ; index < referencedTypes . size ( ) ; index + + ) <nl> + / / Otherwise if it is an array we need to <nl> + / / parse all elements and store them <nl> + else if ( value [ " items " ] . isArray ( ) ) <nl> { <nl> - std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIterator = m_types . find ( referencedTypes . at ( index ) ) ; <nl> - if ( typeIterator ! = m_types . end ( ) ) <nl> - types [ typeIterator - > first ] = typeIterator - > second ; <nl> + for ( CVariant : : const_iterator_array itemItr = value [ " items " ] . begin_array ( ) ; itemItr ! = value [ " items " ] . end_array ( ) ; itemItr + + ) <nl> + { <nl> + JSONSchemaTypeDefinition item ; <nl> + if ( ! item . Parse ( * itemItr ) ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " Invalid item definition in \ " items \ " array for type % s " , name . c_str ( ) ) ; <nl> + missingReference = item . missingReference ; <nl> + return false ; <nl> + } <nl> + items . push_back ( item ) ; <nl> + } <nl> } <nl> } <nl> - } <nl> - else <nl> - { <nl> - types = m_types ; <nl> - methods = m_actionMap ; <nl> - notifications = m_notifications ; <nl> - } <nl> <nl> - / / Print the header <nl> - result [ " id " ] = JSONRPC_SERVICE_ID ; <nl> - result [ " version " ] = JSONRPC_SERVICE_VERSION ; <nl> - result [ " description " ] = JSONRPC_SERVICE_DESCRIPTION ; <nl> + minItems = ( unsigned int ) value [ " minItems " ] . asUnsignedInteger ( 0 ) ; <nl> + maxItems = ( unsigned int ) value [ " maxItems " ] . asUnsignedInteger ( 0 ) ; <nl> + } <nl> <nl> - std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIterator ; <nl> - std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIteratorEnd = types . end ( ) ; <nl> - for ( typeIterator = types . begin ( ) ; typeIterator ! = typeIteratorEnd ; typeIterator + + ) <nl> + if ( HasType ( type , NumberValue ) | | HasType ( type , IntegerValue ) ) <nl> { <nl> - CVariant currentType = CVariant ( CVariant : : VariantTypeObject ) ; <nl> - printType ( typeIterator - > second , false , true , true , printDescriptions , currentType ) ; <nl> + if ( ( type & NumberValue ) = = NumberValue ) <nl> + { <nl> + minimum = value [ " minimum " ] . asDouble ( - numeric_limits < double > : : max ( ) ) ; <nl> + maximum = value [ " maximum " ] . asDouble ( numeric_limits < double > : : max ( ) ) ; <nl> + } <nl> + else if ( ( type & IntegerValue ) = = IntegerValue ) <nl> + { <nl> + minimum = ( double ) value [ " minimum " ] . asInteger ( numeric_limits < int > : : min ( ) ) ; <nl> + maximum = ( double ) value [ " maximum " ] . asInteger ( numeric_limits < int > : : max ( ) ) ; <nl> + } <nl> <nl> - result [ " types " ] [ typeIterator - > first ] = currentType ; <nl> + exclusiveMinimum = value [ " exclusiveMinimum " ] . asBoolean ( false ) ; <nl> + exclusiveMaximum = value [ " exclusiveMaximum " ] . asBoolean ( false ) ; <nl> + divisibleBy = ( unsigned int ) value [ " divisibleBy " ] . asUnsignedInteger ( 0 ) ; <nl> } <nl> - <nl> - / / Iterate through all json rpc methods <nl> - CJsonRpcMethodMap : : JsonRpcMethodIterator methodIterator ; <nl> - CJsonRpcMethodMap : : JsonRpcMethodIterator methodIteratorEnd = methods . end ( ) ; <nl> - for ( methodIterator = methods . begin ( ) ; methodIterator ! = methodIteratorEnd ; methodIterator + + ) <nl> + <nl> + if ( HasType ( type , StringValue ) ) <nl> { <nl> - if ( ( clientPermissions & methodIterator - > second . permission ) ! = methodIterator - > second . permission | | ( ( transportCapabilities & methodIterator - > second . transportneed ) ! = methodIterator - > second . transportneed & & filterByTransport ) ) <nl> - continue ; <nl> - <nl> - CVariant currentMethod = CVariant ( CVariant : : VariantTypeObject ) ; <nl> + minLength = ( int ) value [ " minLength " ] . asInteger ( - 1 ) ; <nl> + maxLength = ( int ) value [ " maxLength " ] . asInteger ( - 1 ) ; <nl> + } <nl> <nl> - currentMethod [ " type " ] = " method " ; <nl> - if ( printDescriptions & & ! methodIterator - > second . description . empty ( ) ) <nl> - currentMethod [ " description " ] = methodIterator - > second . description ; <nl> - if ( printMetadata ) <nl> + / / If the type definition is neither an <nl> + / / " object " nor an " array " we can check <nl> + / / for an " enum " definition <nl> + if ( value . isMember ( " enum " ) & & value [ " enum " ] . isArray ( ) ) <nl> + { <nl> + / / Loop through all elements in the " enum " array <nl> + for ( CVariant : : const_iterator_array enumItr = value [ " enum " ] . begin_array ( ) ; enumItr ! = value [ " enum " ] . end_array ( ) ; enumItr + + ) <nl> { <nl> - CVariant permissions ( CVariant : : VariantTypeArray ) ; <nl> - for ( int i = ReadData ; i < = OPERATION_PERMISSION_ALL ; i * = 2 ) <nl> + / / Check for duplicates and eliminate them <nl> + bool approved = true ; <nl> + for ( unsigned int approvedIndex = 0 ; approvedIndex < enums . size ( ) ; approvedIndex + + ) <nl> { <nl> - if ( ( methodIterator - > second . permission & i ) = = i ) <nl> - permissions . push_back ( PermissionToString ( ( OperationPermission ) i ) ) ; <nl> + if ( * enumItr = = enums . at ( approvedIndex ) ) <nl> + { <nl> + approved = false ; <nl> + break ; <nl> + } <nl> } <nl> <nl> - if ( permissions . size ( ) = = 1 ) <nl> - currentMethod [ " permission " ] = permissions [ 0 ] ; <nl> - else <nl> - currentMethod [ " permission " ] = permissions ; <nl> - } <nl> - <nl> - currentMethod [ " params " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> - for ( unsigned int paramIndex = 0 ; paramIndex < methodIterator - > second . parameters . size ( ) ; paramIndex + + ) <nl> - { <nl> - CVariant param = CVariant ( CVariant : : VariantTypeObject ) ; <nl> - printType ( methodIterator - > second . parameters . at ( paramIndex ) , true , false , true , printDescriptions , param ) ; <nl> - currentMethod [ " params " ] . append ( param ) ; <nl> + / / Only add the current item to the enum value <nl> + / / list if it is not duplicate <nl> + if ( approved ) <nl> + enums . push_back ( * enumItr ) ; <nl> } <nl> - <nl> - printType ( methodIterator - > second . returns , false , false , false , printDescriptions , currentMethod [ " returns " ] ) ; <nl> - <nl> - result [ " methods " ] [ methodIterator - > second . name ] = currentMethod ; <nl> } <nl> <nl> - / / Print notification description <nl> - std : : map < std : : string , CVariant > : : const_iterator notificationIterator ; <nl> - std : : map < std : : string , CVariant > : : const_iterator notificationIteratorEnd = notifications . end ( ) ; <nl> - for ( notificationIterator = notifications . begin ( ) ; notificationIterator ! = notificationIteratorEnd ; notificationIterator + + ) <nl> - result [ " notifications " ] [ notificationIterator - > first ] = notificationIterator - > second [ notificationIterator - > first ] ; <nl> - <nl> - return OK ; <nl> - } <nl> - <nl> - JSONRPC_STATUS CJSONServiceDescription : : CheckCall ( const char * const method , const CVariant & requestParameters , ITransportLayer * transport , IClient * client , bool notification , MethodCall & methodCall , CVariant & outputParameters ) <nl> - { <nl> - CJsonRpcMethodMap : : JsonRpcMethodIterator iter = m_actionMap . find ( method ) ; <nl> - if ( iter ! = m_actionMap . end ( ) ) <nl> + if ( type ! = ObjectValue ) <nl> { <nl> - if ( transport ! = NULL & & ( transport - > GetCapabilities ( ) & iter - > second . transportneed ) = = iter - > second . transportneed ) <nl> + / / If there is a definition for a default value and its type <nl> + / / matches the type of the parameter we can parse it <nl> + bool ok = false ; <nl> + if ( value . isMember ( " default " ) & & IsType ( value [ " default " ] , type ) ) <nl> { <nl> - if ( client ! = NULL & & ( client - > GetPermissionFlags ( ) & iter - > second . permission ) = = iter - > second . permission & & ( ! notification | | ( iter - > second . permission & OPERATION_PERMISSION_NOTIFICATION ) = = iter - > second . permission ) ) <nl> + if ( enums . size ( ) < = 0 ) <nl> + ok = true ; <nl> + / / If the type has an enum definition we must make <nl> + / / sure that the default value is a valid enum value <nl> + else <nl> { <nl> - methodCall = iter - > second . method ; <nl> - <nl> - / / Count the number of actually handled ( present ) <nl> - / / parameters <nl> - unsigned int handled = 0 ; <nl> - CVariant errorData = CVariant ( CVariant : : VariantTypeObject ) ; <nl> - errorData [ " method " ] = iter - > second . name ; <nl> - <nl> - / / Loop through all the parameters to check <nl> - for ( unsigned int i = 0 ; i < iter - > second . parameters . size ( ) ; i + + ) <nl> + for ( std : : vector < CVariant > : : const_iterator itr = enums . begin ( ) ; itr ! = enums . end ( ) ; itr + + ) <nl> { <nl> - / / Evaluate the current parameter <nl> - JSONRPC_STATUS status = checkParameter ( requestParameters , iter - > second . parameters . at ( i ) , i , outputParameters , handled , errorData ) ; <nl> - if ( status ! = OK ) <nl> + if ( value [ " default " ] = = * itr ) <nl> { <nl> - / / Return the error data object in the outputParameters reference <nl> - outputParameters = errorData ; <nl> - return status ; <nl> + ok = true ; <nl> + break ; <nl> } <nl> } <nl> - <nl> - / / Check if there were unnecessary parameters <nl> - if ( handled < requestParameters . size ( ) ) <nl> - { <nl> - errorData [ " message " ] = " Too many parameters " ; <nl> - outputParameters = errorData ; <nl> - return InvalidParams ; <nl> - } <nl> - <nl> - return OK ; <nl> } <nl> + } <nl> + <nl> + if ( ok ) <nl> + defaultValue = value [ " default " ] ; <nl> + else <nl> + { <nl> + / / If the type of the default value definition does not <nl> + / / match the type of the parameter we have to log this <nl> + if ( value . isMember ( " default " ) & & ! IsType ( value [ " default " ] , type ) ) <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Parameter % s has an invalid default value " , name . c_str ( ) ) ; <nl> + <nl> + / / If the type contains an " enum " we need to get the <nl> + / / default value from the first enum value <nl> + if ( enums . size ( ) > 0 ) <nl> + defaultValue = enums . at ( 0 ) ; <nl> + / / otherwise set a default value instead <nl> else <nl> - return BadPermission ; <nl> + SetDefaultValue ( defaultValue , type ) ; <nl> } <nl> } <nl> <nl> - return MethodNotFound ; <nl> - } <nl> - <nl> - void CJSONServiceDescription : : printType ( const JSONSchemaTypeDefinition & type , bool isParameter , bool isGlobal , bool printDefault , bool printDescriptions , CVariant & output ) <nl> - { <nl> - bool typeReference = false ; <nl> - <nl> - / / Printing general fields <nl> - if ( isParameter ) <nl> - output [ " name " ] = type . name ; <nl> - <nl> - if ( isGlobal ) <nl> - output [ " id " ] = type . ID ; <nl> - else if ( ! type . ID . empty ( ) ) <nl> - { <nl> - output [ " $ ref " ] = type . ID ; <nl> - typeReference = true ; <nl> - } <nl> - <nl> - if ( printDescriptions & & ! type . description . empty ( ) ) <nl> - output [ " description " ] = type . description ; <nl> - <nl> - if ( isParameter | | printDefault ) <nl> - { <nl> - if ( ! type . optional ) <nl> - output [ " required " ] = true ; <nl> - if ( type . optional & & type . type ! = ObjectValue & & type . type ! = ArrayValue ) <nl> - output [ " default " ] = type . defaultValue ; <nl> - } <nl> - <nl> - if ( ! typeReference ) <nl> - { <nl> - if ( type . extends . size ( ) = = 1 ) <nl> - { <nl> - output [ " extends " ] = type . extends . at ( 0 ) . ID ; <nl> - } <nl> - else if ( type . extends . size ( ) > 1 ) <nl> - { <nl> - output [ " extends " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> - for ( unsigned int extendsIndex = 0 ; extendsIndex < type . extends . size ( ) ; extendsIndex + + ) <nl> - output [ " extends " ] . append ( type . extends . at ( extendsIndex ) . ID ) ; <nl> - } <nl> - else if ( type . unionTypes . size ( ) > 0 ) <nl> - { <nl> - output [ " type " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> - for ( unsigned int unionIndex = 0 ; unionIndex < type . unionTypes . size ( ) ; unionIndex + + ) <nl> - { <nl> - CVariant unionOutput = CVariant ( CVariant : : VariantTypeObject ) ; <nl> - printType ( type . unionTypes . at ( unionIndex ) , false , false , false , printDescriptions , unionOutput ) ; <nl> - output [ " type " ] . append ( unionOutput ) ; <nl> - } <nl> - } <nl> - else <nl> - SchemaValueTypeToJson ( type . type , output [ " type " ] ) ; <nl> - <nl> - / / Printing enum field <nl> - if ( type . enums . size ( ) > 0 ) <nl> - { <nl> - output [ " enums " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> - for ( unsigned int enumIndex = 0 ; enumIndex < type . enums . size ( ) ; enumIndex + + ) <nl> - output [ " enums " ] . append ( type . enums . at ( enumIndex ) ) ; <nl> - } <nl> - <nl> - / / Printing integer / number fields <nl> - if ( HasType ( type . type , IntegerValue ) | | HasType ( type . type , NumberValue ) ) <nl> - { <nl> - if ( HasType ( type . type , NumberValue ) ) <nl> - { <nl> - if ( type . minimum > - numeric_limits < double > : : max ( ) ) <nl> - output [ " minimum " ] = type . minimum ; <nl> - if ( type . maximum < numeric_limits < double > : : max ( ) ) <nl> - output [ " maximum " ] = type . maximum ; <nl> - } <nl> - else <nl> - { <nl> - if ( type . minimum > numeric_limits < int > : : min ( ) ) <nl> - output [ " minimum " ] = ( int ) type . minimum ; <nl> - if ( type . maximum < numeric_limits < int > : : max ( ) ) <nl> - output [ " maximum " ] = ( int ) type . maximum ; <nl> - } <nl> - <nl> - if ( type . exclusiveMinimum ) <nl> - output [ " exclusiveMinimum " ] = true ; <nl> - if ( type . exclusiveMaximum ) <nl> - output [ " exclusiveMaximum " ] = true ; <nl> - if ( type . divisibleBy > 0 ) <nl> - output [ " divisibleBy " ] = type . divisibleBy ; <nl> - } <nl> - if ( HasType ( type . type , StringValue ) ) <nl> - { <nl> - if ( type . minLength > = 0 ) <nl> - output [ " minLength " ] = type . minLength ; <nl> - if ( type . maxLength > = 0 ) <nl> - output [ " maxLength " ] = type . maxLength ; <nl> - } <nl> - <nl> - / / Print array fields <nl> - if ( HasType ( type . type , ArrayValue ) ) <nl> - { <nl> - if ( type . items . size ( ) = = 1 ) <nl> - { <nl> - printType ( type . items . at ( 0 ) , false , false , false , printDescriptions , output [ " items " ] ) ; <nl> - } <nl> - else if ( type . items . size ( ) > 1 ) <nl> - { <nl> - output [ " items " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> - for ( unsigned int itemIndex = 0 ; itemIndex < type . items . size ( ) ; itemIndex + + ) <nl> - { <nl> - CVariant item = CVariant ( CVariant : : VariantTypeObject ) ; <nl> - printType ( type . items . at ( itemIndex ) , false , false , false , printDescriptions , item ) ; <nl> - output [ " items " ] . append ( item ) ; <nl> - } <nl> - } <nl> - <nl> - if ( type . minItems > 0 ) <nl> - output [ " minItems " ] = type . minItems ; <nl> - if ( type . maxItems > 0 ) <nl> - output [ " maxItems " ] = type . maxItems ; <nl> - <nl> - if ( type . additionalItems . size ( ) = = 1 ) <nl> - { <nl> - printType ( type . additionalItems . at ( 0 ) , false , false , false , printDescriptions , output [ " additionalItems " ] ) ; <nl> - } <nl> - else if ( type . additionalItems . size ( ) > 1 ) <nl> - { <nl> - output [ " additionalItems " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> - for ( unsigned int addItemIndex = 0 ; addItemIndex < type . additionalItems . size ( ) ; addItemIndex + + ) <nl> - { <nl> - CVariant item = CVariant ( CVariant : : VariantTypeObject ) ; <nl> - printType ( type . additionalItems . at ( addItemIndex ) , false , false , false , printDescriptions , item ) ; <nl> - output [ " additionalItems " ] . append ( item ) ; <nl> - } <nl> - } <nl> - <nl> - if ( type . uniqueItems ) <nl> - output [ " uniqueItems " ] = true ; <nl> - } <nl> - <nl> - / / Print object fields <nl> - if ( HasType ( type . type , ObjectValue ) & & type . properties . size ( ) > 0 ) <nl> - { <nl> - output [ " properties " ] = CVariant ( CVariant : : VariantTypeObject ) ; <nl> - <nl> - JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator propertiesEnd = type . properties . end ( ) ; <nl> - JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator propertiesIterator ; <nl> - for ( propertiesIterator = type . properties . begin ( ) ; propertiesIterator ! = propertiesEnd ; propertiesIterator + + ) <nl> - { <nl> - printType ( propertiesIterator - > second , false , false , true , printDescriptions , output [ " properties " ] [ propertiesIterator - > first ] ) ; <nl> - } <nl> - <nl> - if ( ! type . hasAdditionalProperties ) <nl> - output [ " additionalProperties " ] = false ; <nl> - else if ( type . additionalProperties ! = NULL & & type . additionalProperties - > type ! = AnyValue ) <nl> - printType ( * ( type . additionalProperties ) , false , false , true , printDescriptions , output [ " additionalProperties " ] ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - JSONRPC_STATUS CJSONServiceDescription : : checkParameter ( const CVariant & requestParameters , const JSONSchemaTypeDefinition & type , unsigned int position , CVariant & outputParameters , unsigned int & handled , CVariant & errorData ) <nl> - { <nl> - / / Let ' s check if the parameter has been provided <nl> - if ( ParameterExists ( requestParameters , type . name , position ) ) <nl> - { <nl> - / / Get the parameter <nl> - CVariant parameterValue = GetParameter ( requestParameters , type . name , position ) ; <nl> - <nl> - / / Evaluate the type of the parameter <nl> - JSONRPC_STATUS status = checkType ( parameterValue , type , outputParameters [ type . name ] , errorData [ " stack " ] ) ; <nl> - if ( status ! = OK ) <nl> - return status ; <nl> - <nl> - / / The parameter was present and valid <nl> - handled + + ; <nl> - } <nl> - / / If the parameter has not been provided but is optional <nl> - / / we can use its default value <nl> - else if ( type . optional ) <nl> - outputParameters [ type . name ] = type . defaultValue ; <nl> - / / The parameter is required but has not been provided = > invalid <nl> - else <nl> - { <nl> - errorData [ " stack " ] [ " name " ] = type . name ; <nl> - SchemaValueTypeToJson ( type . type , errorData [ " stack " ] [ " type " ] ) ; <nl> - errorData [ " stack " ] [ " message " ] = " Missing parameter " ; <nl> - return InvalidParams ; <nl> - } <nl> + if ( isReferenceType ) <nl> + CJSONServiceDescription : : addReferenceTypeDefinition ( * this ) ; <nl> <nl> - return OK ; <nl> + return true ; <nl> } <nl> <nl> - JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const JSONSchemaTypeDefinition & type , CVariant & outputValue , CVariant & errorData ) <nl> + JSONRPC_STATUS JSONSchemaTypeDefinition : : Check ( const CVariant & value , CVariant & outputValue , CVariant & errorData ) const <nl> { <nl> - if ( ! type . name . empty ( ) ) <nl> - errorData [ " name " ] = type . name ; <nl> - SchemaValueTypeToJson ( type . type , errorData [ " type " ] ) ; <nl> + if ( ! name . empty ( ) ) <nl> + errorData [ " name " ] = name ; <nl> + SchemaValueTypeToJson ( type , errorData [ " type " ] ) ; <nl> CStdString errorMessage ; <nl> <nl> / / Let ' s check the type of the provided parameter <nl> - if ( ! IsType ( value , type . type ) ) <nl> + if ( ! IsType ( value , type ) ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Type mismatch in type % s " , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Type mismatch in type % s " , name . c_str ( ) ) ; <nl> errorMessage . Format ( " Invalid type % s received " , ValueTypeToString ( value . type ( ) ) ) ; <nl> errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> return InvalidParams ; <nl> } <nl> - else if ( value . isNull ( ) & & ! HasType ( type . type , NullValue ) ) <nl> + else if ( value . isNull ( ) & & ! HasType ( type , NullValue ) ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Value is NULL in type % s " , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Value is NULL in type % s " , name . c_str ( ) ) ; <nl> errorData [ " message " ] = " Received value is null " ; <nl> return InvalidParams ; <nl> } <nl> <nl> / / Let ' s check if we have to handle a union type <nl> - if ( type . unionTypes . size ( ) > 0 ) <nl> + if ( unionTypes . size ( ) > 0 ) <nl> { <nl> bool ok = false ; <nl> - for ( unsigned int unionIndex = 0 ; unionIndex < type . unionTypes . size ( ) ; unionIndex + + ) <nl> + for ( unsigned int unionIndex = 0 ; unionIndex < unionTypes . size ( ) ; unionIndex + + ) <nl> { <nl> CVariant dummyError ; <nl> CVariant testOutput = outputValue ; <nl> - if ( checkType ( value , type . unionTypes . at ( unionIndex ) , testOutput , dummyError ) = = OK ) <nl> + if ( unionTypes . at ( unionIndex ) . Check ( value , testOutput , dummyError ) = = OK ) <nl> { <nl> ok = true ; <nl> outputValue = testOutput ; <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> <nl> if ( ! ok ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Value in type % s does not match any of the union type definitions " , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Value in type % s does not match any of the union type definitions " , name . c_str ( ) ) ; <nl> errorData [ " message " ] = " Received value does not match any of the union type definitions " ; <nl> return InvalidParams ; <nl> } <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> / / First we need to check if this type extends another <nl> / / type and if so we need to check against the extended <nl> / / type first <nl> - if ( type . extends . size ( ) > 0 ) <nl> + if ( extends . size ( ) > 0 ) <nl> { <nl> - for ( unsigned int extendsIndex = 0 ; extendsIndex < type . extends . size ( ) ; extendsIndex + + ) <nl> + for ( unsigned int extendsIndex = 0 ; extendsIndex < extends . size ( ) ; extendsIndex + + ) <nl> { <nl> - JSONRPC_STATUS status = checkType ( value , type . extends . at ( extendsIndex ) , outputValue , errorData ) ; <nl> + JSONRPC_STATUS status = extends . at ( extendsIndex ) . Check ( value , outputValue , errorData ) ; <nl> <nl> if ( status ! = OK ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not match extended type % s of type % s " , type . extends . at ( extendsIndex ) . ID . c_str ( ) , type . name . c_str ( ) ) ; <nl> - errorMessage . Format ( " value does not match extended type % s " , type . extends . at ( extendsIndex ) . ID . c_str ( ) , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not match extended type % s of type % s " , extends . at ( extendsIndex ) . ID . c_str ( ) , name . c_str ( ) ) ; <nl> + errorMessage . Format ( " value does not match extended type % s " , extends . at ( extendsIndex ) . ID . c_str ( ) , name . c_str ( ) ) ; <nl> errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> return status ; <nl> } <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> / / If it is an array we need to <nl> / / - check the type of every element ( " items " ) <nl> / / - check if they need to be unique ( " uniqueItems " ) <nl> - if ( HasType ( type . type , ArrayValue ) & & value . isArray ( ) ) <nl> + if ( HasType ( type , ArrayValue ) & & value . isArray ( ) ) <nl> { <nl> outputValue = CVariant ( CVariant : : VariantTypeArray ) ; <nl> / / Check the number of items against minItems and maxItems <nl> - if ( ( type . minItems > 0 & & value . size ( ) < type . minItems ) | | ( type . maxItems > 0 & & value . size ( ) > type . maxItems ) ) <nl> + if ( ( minItems > 0 & & value . size ( ) < minItems ) | | ( maxItems > 0 & & value . size ( ) > maxItems ) ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Number of array elements does not match minItems and / or maxItems in type % s " , type . name . c_str ( ) ) ; <nl> - if ( type . minItems > 0 & & type . maxItems > 0 ) <nl> - errorMessage . Format ( " Between % d and % d array items expected but % d received " , type . minItems , type . maxItems , value . size ( ) ) ; <nl> - else if ( type . minItems > 0 ) <nl> - errorMessage . Format ( " At least % d array items expected but only % d received " , type . minItems , value . size ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Number of array elements does not match minItems and / or maxItems in type % s " , name . c_str ( ) ) ; <nl> + if ( minItems > 0 & & maxItems > 0 ) <nl> + errorMessage . Format ( " Between % d and % d array items expected but % d received " , minItems , maxItems , value . size ( ) ) ; <nl> + else if ( minItems > 0 ) <nl> + errorMessage . Format ( " At least % d array items expected but only % d received " , minItems , value . size ( ) ) ; <nl> else <nl> - errorMessage . Format ( " Only % d array items expected but % d received " , type . maxItems , value . size ( ) ) ; <nl> + errorMessage . Format ( " Only % d array items expected but % d received " , maxItems , value . size ( ) ) ; <nl> errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> return InvalidParams ; <nl> } <nl> <nl> - if ( type . items . size ( ) = = 0 ) <nl> - { <nl> + if ( items . size ( ) = = 0 ) <nl> outputValue = value ; <nl> - } <nl> - else if ( type . items . size ( ) = = 1 ) <nl> + else if ( items . size ( ) = = 1 ) <nl> { <nl> - JSONSchemaTypeDefinition itemType = type . items . at ( 0 ) ; <nl> + JSONSchemaTypeDefinition itemType = items . at ( 0 ) ; <nl> <nl> / / Loop through all array elements <nl> for ( unsigned int arrayIndex = 0 ; arrayIndex < value . size ( ) ; arrayIndex + + ) <nl> { <nl> CVariant temp ; <nl> - JSONRPC_STATUS status = checkType ( value [ arrayIndex ] , itemType , temp , errorData [ " property " ] ) ; <nl> + JSONRPC_STATUS status = itemType . Check ( value [ arrayIndex ] , temp , errorData [ " property " ] ) ; <nl> outputValue . push_back ( temp ) ; <nl> if ( status ! = OK ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Array element at index % u does not match in type % s " , arrayIndex , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Array element at index % u does not match in type % s " , arrayIndex , name . c_str ( ) ) ; <nl> errorMessage . Format ( " array element at index % u does not match " , arrayIndex ) ; <nl> errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> return status ; <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> / / does not match the number of elements in the <nl> / / " items " array and additional items are not <nl> / / allowed there is no need to check every element <nl> - if ( value . size ( ) < type . items . size ( ) | | ( value . size ( ) ! = type . items . size ( ) & & type . additionalItems . size ( ) = = 0 ) ) <nl> + if ( value . size ( ) < items . size ( ) | | ( value . size ( ) ! = items . size ( ) & & additionalItems . size ( ) = = 0 ) ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : One of the array elements does not match in type % s " , type . name . c_str ( ) ) ; <nl> - errorMessage . Format ( " % d array elements expected but % d received " , type . items . size ( ) , value . size ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : One of the array elements does not match in type % s " , name . c_str ( ) ) ; <nl> + errorMessage . Format ( " % d array elements expected but % d received " , items . size ( ) , value . size ( ) ) ; <nl> errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> return InvalidParams ; <nl> } <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> / / are either no more schemas in the " items " <nl> / / array or no more elements in the value ' s array <nl> unsigned int arrayIndex ; <nl> - for ( arrayIndex = 0 ; arrayIndex < min ( type . items . size ( ) , ( size_t ) value . size ( ) ) ; arrayIndex + + ) <nl> + for ( arrayIndex = 0 ; arrayIndex < min ( items . size ( ) , ( size_t ) value . size ( ) ) ; arrayIndex + + ) <nl> { <nl> - JSONRPC_STATUS status = checkType ( value [ arrayIndex ] , type . items . at ( arrayIndex ) , outputValue [ arrayIndex ] , errorData [ " property " ] ) ; <nl> + JSONRPC_STATUS status = items . at ( arrayIndex ) . Check ( value [ arrayIndex ] , outputValue [ arrayIndex ] , errorData [ " property " ] ) ; <nl> if ( status ! = OK ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Array element at index % u does not match with items schema in type % s " , arrayIndex , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Array element at index % u does not match with items schema in type % s " , arrayIndex , name . c_str ( ) ) ; <nl> return status ; <nl> } <nl> } <nl> <nl> - if ( type . additionalItems . size ( ) > 0 ) <nl> + if ( additionalItems . size ( ) > 0 ) <nl> { <nl> / / Loop through the rest of the elements <nl> / / in the array and check them against the <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> for ( ; arrayIndex < value . size ( ) ; arrayIndex + + ) <nl> { <nl> bool ok = false ; <nl> - for ( unsigned int additionalIndex = 0 ; additionalIndex < type . additionalItems . size ( ) ; additionalIndex + + ) <nl> + for ( unsigned int additionalIndex = 0 ; additionalIndex < additionalItems . size ( ) ; additionalIndex + + ) <nl> { <nl> CVariant dummyError ; <nl> - if ( checkType ( value [ arrayIndex ] , type . additionalItems . at ( additionalIndex ) , outputValue [ arrayIndex ] , dummyError ) = = OK ) <nl> + if ( additionalItems . at ( additionalIndex ) . Check ( value [ arrayIndex ] , outputValue [ arrayIndex ] , dummyError ) = = OK ) <nl> { <nl> ok = true ; <nl> break ; <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> <nl> if ( ! ok ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Array contains non - conforming additional items in type % s " , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Array contains non - conforming additional items in type % s " , name . c_str ( ) ) ; <nl> errorMessage . Format ( " Array element at index % u does not match the \ " additionalItems \ " schema " , arrayIndex ) ; <nl> errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> return InvalidParams ; <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> } <nl> <nl> / / If every array element is unique we need to check each one <nl> - if ( type . uniqueItems ) <nl> + if ( uniqueItems ) <nl> { <nl> for ( unsigned int checkingIndex = 0 ; checkingIndex < outputValue . size ( ) ; checkingIndex + + ) <nl> { <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> / / If two elements are the same they are not unique <nl> if ( outputValue [ checkingIndex ] = = outputValue [ checkedIndex ] ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Not unique array element at index % u and % u in type % s " , checkingIndex , checkedIndex , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Not unique array element at index % u and % u in type % s " , checkingIndex , checkedIndex , name . c_str ( ) ) ; <nl> errorMessage . Format ( " Array element at index % u is not unique ( same as array element at index % u ) " , checkingIndex , checkedIndex ) ; <nl> errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> return InvalidParams ; <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> <nl> / / If it is an object we need to check every element <nl> / / against the defined " properties " <nl> - if ( HasType ( type . type , ObjectValue ) & & value . isObject ( ) ) <nl> + if ( HasType ( type , ObjectValue ) & & value . isObject ( ) ) <nl> { <nl> unsigned int handled = 0 ; <nl> - JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator propertiesEnd = type . properties . end ( ) ; <nl> + JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator propertiesEnd = properties . end ( ) ; <nl> JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator propertiesIterator ; <nl> - for ( propertiesIterator = type . properties . begin ( ) ; propertiesIterator ! = propertiesEnd ; propertiesIterator + + ) <nl> + for ( propertiesIterator = properties . begin ( ) ; propertiesIterator ! = propertiesEnd ; propertiesIterator + + ) <nl> { <nl> if ( value . isMember ( propertiesIterator - > second . name ) ) <nl> { <nl> - JSONRPC_STATUS status = checkType ( value [ propertiesIterator - > second . name ] , propertiesIterator - > second , outputValue [ propertiesIterator - > second . name ] , errorData [ " property " ] ) ; <nl> + JSONRPC_STATUS status = propertiesIterator - > second . Check ( value [ propertiesIterator - > second . name ] , outputValue [ propertiesIterator - > second . name ] , errorData [ " property " ] ) ; <nl> if ( status ! = OK ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Invalid property \ " % s \ " in type % s " , propertiesIterator - > second . name . c_str ( ) , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Invalid property \ " % s \ " in type % s " , propertiesIterator - > second . name . c_str ( ) , name . c_str ( ) ) ; <nl> return status ; <nl> } <nl> handled + + ; <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> outputValue [ propertiesIterator - > second . name ] = propertiesIterator - > second . defaultValue ; <nl> else <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Missing property \ " % s \ " in type % s " , propertiesIterator - > second . name . c_str ( ) , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Missing property \ " % s \ " in type % s " , propertiesIterator - > second . name . c_str ( ) , name . c_str ( ) ) ; <nl> errorData [ " property " ] [ " name " ] = propertiesIterator - > second . name . c_str ( ) ; <nl> errorData [ " property " ] [ " type " ] = SchemaValueTypeToString ( propertiesIterator - > second . type ) ; <nl> errorData [ " message " ] = " Missing property " ; <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> { <nl> / / If additional properties are allowed we need to check if <nl> / / they match the defined schema <nl> - if ( type . hasAdditionalProperties & & type . additionalProperties ! = NULL ) <nl> + if ( hasAdditionalProperties & & additionalProperties ! = NULL ) <nl> { <nl> CVariant : : const_iterator_map iter ; <nl> CVariant : : const_iterator_map iterEnd = value . end_map ( ) ; <nl> for ( iter = value . begin_map ( ) ; iter ! = iterEnd ; iter + + ) <nl> { <nl> - if ( type . properties . find ( iter - > first ) ! = type . properties . end ( ) ) <nl> + if ( properties . find ( iter - > first ) ! = properties . end ( ) ) <nl> continue ; <nl> <nl> / / If the additional property is of type " any " <nl> / / we can simply copy its value to the output <nl> / / object <nl> - if ( type . additionalProperties - > type = = AnyValue ) <nl> + if ( additionalProperties - > type = = AnyValue ) <nl> { <nl> outputValue [ iter - > first ] = value [ iter - > first ] ; <nl> continue ; <nl> } <nl> <nl> - JSONRPC_STATUS status = checkType ( value [ iter - > first ] , * ( type . additionalProperties ) , outputValue [ iter - > first ] , errorData [ " property " ] ) ; <nl> + JSONRPC_STATUS status = additionalProperties - > Check ( value [ iter - > first ] , outputValue [ iter - > first ] , errorData [ " property " ] ) ; <nl> if ( status ! = OK ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Invalid additional property \ " % s \ " in type % s " , iter - > first . c_str ( ) , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Invalid additional property \ " % s \ " in type % s " , iter - > first . c_str ( ) , name . c_str ( ) ) ; <nl> return status ; <nl> } <nl> } <nl> } <nl> / / If we still have unchecked properties but additional <nl> / / properties are not allowed , we have invalid parameters <nl> - else if ( ! type . hasAdditionalProperties | | type . additionalProperties = = NULL ) <nl> + else if ( ! hasAdditionalProperties | | additionalProperties = = NULL ) <nl> { <nl> errorData [ " message " ] = " Unexpected additional properties received " ; <nl> errorData . erase ( " property " ) ; <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> <nl> / / If it can only take certain values ( " enum " ) <nl> / / we need to check against those <nl> - if ( type . enums . size ( ) > 0 ) <nl> + if ( enums . size ( ) > 0 ) <nl> { <nl> bool valid = false ; <nl> - for ( std : : vector < CVariant > : : const_iterator enumItr = type . enums . begin ( ) ; enumItr ! = type . enums . end ( ) ; enumItr + + ) <nl> + for ( std : : vector < CVariant > : : const_iterator enumItr = enums . begin ( ) ; enumItr ! = enums . end ( ) ; enumItr + + ) <nl> { <nl> if ( * enumItr = = value ) <nl> { <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> <nl> if ( ! valid ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not match any of the enum values in type % s " , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not match any of the enum values in type % s " , name . c_str ( ) ) ; <nl> errorData [ " message " ] = " Received value does not match any of the defined enum values " ; <nl> return InvalidParams ; <nl> } <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> <nl> / / If we have a number or an integer type , we need <nl> / / to check the minimum and maximum values <nl> - if ( ( HasType ( type . type , NumberValue ) & & value . isDouble ( ) ) | | ( HasType ( type . type , IntegerValue ) & & value . isInteger ( ) ) ) <nl> + if ( ( HasType ( type , NumberValue ) & & value . isDouble ( ) ) | | ( HasType ( type , IntegerValue ) & & value . isInteger ( ) ) ) <nl> { <nl> double numberValue ; <nl> if ( value . isDouble ( ) ) <nl> JSONRPC_STATUS CJSONServiceDescription : : checkType ( const CVariant & value , const J <nl> else <nl> numberValue = ( double ) value . asInteger ( ) ; <nl> / / Check minimum <nl> - if ( ( type . exclusiveMinimum & & numberValue < = type . minimum ) | | ( ! type . exclusiveMinimum & & numberValue < type . minimum ) | | <nl> + if ( ( exclusiveMinimum & & numberValue < = minimum ) | | ( ! exclusiveMinimum & & numberValue < minimum ) | | <nl> / / Check maximum <nl> - ( type . exclusiveMaximum & & numberValue > = type . maximum ) | | ( ! type . exclusiveMaximum & & numberValue > type . maximum ) ) <nl> + ( exclusiveMaximum & & numberValue > = maximum ) | | ( ! exclusiveMaximum & & numberValue > maximum ) ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not lay between minimum and maximum in type % s " , type . name . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not lay between minimum and maximum in type % s " , name . c_str ( ) ) ; <nl> if ( value . isDouble ( ) ) <nl> errorMessage . Format ( " Value between % f ( % s ) and % f ( % s ) expected but % f received " , <nl> - type . minimum , type . exclusiveMinimum ? " exclusive " : " inclusive " , type . maximum , type . exclusiveMaximum ? " exclusive " : " inclusive " , numberValue ) ; <nl> + minimum , exclusiveMinimum ? " exclusive " : " inclusive " , maximum , exclusiveMaximum ? " exclusive " : " inclusive " , numberValue ) ; <nl> else <nl> errorMessage . Format ( " Value between % d ( % s ) and % d ( % s ) expected but % d received " , <nl> - ( int ) type . minimum , type . exclusiveMinimum ? " exclusive " : " inclusive " , ( int ) type . maximum , type . exclusiveMaximum ? " exclusive " : " inclusive " , ( int ) numberValue ) ; <nl> + ( int ) minimum , exclusiveMinimum ? " exclusive " : " inclusive " , ( int ) maximum , exclusiveMaximum ? " exclusive " : " inclusive " , ( int ) numberValue ) ; <nl> errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> return InvalidParams ; <nl> } <nl> / / Check divisibleBy <nl> - if ( ( HasType ( type . type , IntegerValue ) & & type . divisibleBy > 0 & & ( ( int ) numberValue % type . divisibleBy ) ! = 0 ) ) <nl> + if ( ( HasType ( type , IntegerValue ) & & divisibleBy > 0 & & ( ( int ) numberValue % divisibleBy ) ! = 0 ) ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not meet divisibleBy requirements in type % s " , type . name . c_str ( ) ) ; <nl> - errorMessage . Format ( " Value should be divisible by % d but % d received " , type . divisibleBy , ( int ) numberValue ) ; <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not meet divisibleBy requirements in type % s " , name . c_str ( ) ) ; <nl> + errorMessage . Format ( " Value should be divisible by % d but % d received " , divisibleBy , ( int ) numberValue ) ; <nl> errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> return InvalidParams ; <nl> } <nl> } <nl> <nl> - / / If we have a string , we need to check the length <nl> - if ( HasType ( type . type , StringValue ) & & value . isString ( ) ) <nl> + / / If we have a string , we need to check the length <nl> + if ( HasType ( type , StringValue ) & & value . isString ( ) ) <nl> + { <nl> + int size = value . asString ( ) . size ( ) ; <nl> + if ( size < minLength ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not meet minLength requirements in type % s " , name . c_str ( ) ) ; <nl> + errorMessage . Format ( " Value should have a minimum length of % d but has a length of % d " , minLength , size ) ; <nl> + errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> + return InvalidParams ; <nl> + } <nl> + <nl> + if ( maxLength > = 0 & & size > maxLength ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not meet maxLength requirements in type % s " , name . c_str ( ) ) ; <nl> + errorMessage . Format ( " Value should have a maximum length of % d but has a length of % d " , maxLength , size ) ; <nl> + errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> + return InvalidParams ; <nl> + } <nl> + } <nl> + <nl> + / / Otherwise it can have any value <nl> + outputValue = value ; <nl> + return OK ; <nl> + } <nl> + <nl> + void JSONSchemaTypeDefinition : : Print ( bool isParameter , bool isGlobal , bool printDefault , bool printDescriptions , CVariant & output ) const <nl> + { <nl> + bool typeReference = false ; <nl> + <nl> + / / Printing general fields <nl> + if ( isParameter ) <nl> + output [ " name " ] = name ; <nl> + <nl> + if ( isGlobal ) <nl> + output [ " id " ] = ID ; <nl> + else if ( ! ID . empty ( ) ) <nl> + { <nl> + output [ " $ ref " ] = ID ; <nl> + typeReference = true ; <nl> + } <nl> + <nl> + if ( printDescriptions & & ! description . empty ( ) ) <nl> + output [ " description " ] = description ; <nl> + <nl> + if ( isParameter | | printDefault ) <nl> + { <nl> + if ( ! optional ) <nl> + output [ " required " ] = true ; <nl> + if ( optional & & type ! = ObjectValue & & type ! = ArrayValue ) <nl> + output [ " default " ] = defaultValue ; <nl> + } <nl> + <nl> + if ( ! typeReference ) <nl> + { <nl> + if ( extends . size ( ) = = 1 ) <nl> + { <nl> + output [ " extends " ] = extends . at ( 0 ) . ID ; <nl> + } <nl> + else if ( extends . size ( ) > 1 ) <nl> + { <nl> + output [ " extends " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> + for ( unsigned int extendsIndex = 0 ; extendsIndex < extends . size ( ) ; extendsIndex + + ) <nl> + output [ " extends " ] . append ( extends . at ( extendsIndex ) . ID ) ; <nl> + } <nl> + else if ( unionTypes . size ( ) > 0 ) <nl> + { <nl> + output [ " type " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> + for ( unsigned int unionIndex = 0 ; unionIndex < unionTypes . size ( ) ; unionIndex + + ) <nl> + { <nl> + CVariant unionOutput = CVariant ( CVariant : : VariantTypeObject ) ; <nl> + unionTypes . at ( unionIndex ) . Print ( false , false , false , printDescriptions , unionOutput ) ; <nl> + output [ " type " ] . append ( unionOutput ) ; <nl> + } <nl> + } <nl> + else <nl> + CJSONUtils : : SchemaValueTypeToJson ( type , output [ " type " ] ) ; <nl> + <nl> + / / Printing enum field <nl> + if ( enums . size ( ) > 0 ) <nl> + { <nl> + output [ " enums " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> + for ( unsigned int enumIndex = 0 ; enumIndex < enums . size ( ) ; enumIndex + + ) <nl> + output [ " enums " ] . append ( enums . at ( enumIndex ) ) ; <nl> + } <nl> + <nl> + / / Printing integer / number fields <nl> + if ( CJSONUtils : : HasType ( type , IntegerValue ) | | CJSONUtils : : HasType ( type , NumberValue ) ) <nl> + { <nl> + if ( CJSONUtils : : HasType ( type , NumberValue ) ) <nl> + { <nl> + if ( minimum > - numeric_limits < double > : : max ( ) ) <nl> + output [ " minimum " ] = minimum ; <nl> + if ( maximum < numeric_limits < double > : : max ( ) ) <nl> + output [ " maximum " ] = maximum ; <nl> + } <nl> + else <nl> + { <nl> + if ( minimum > numeric_limits < int > : : min ( ) ) <nl> + output [ " minimum " ] = ( int ) minimum ; <nl> + if ( maximum < numeric_limits < int > : : max ( ) ) <nl> + output [ " maximum " ] = ( int ) maximum ; <nl> + } <nl> + <nl> + if ( exclusiveMinimum ) <nl> + output [ " exclusiveMinimum " ] = true ; <nl> + if ( exclusiveMaximum ) <nl> + output [ " exclusiveMaximum " ] = true ; <nl> + if ( divisibleBy > 0 ) <nl> + output [ " divisibleBy " ] = divisibleBy ; <nl> + } <nl> + if ( CJSONUtils : : HasType ( type , StringValue ) ) <nl> + { <nl> + if ( minLength > = 0 ) <nl> + output [ " minLength " ] = minLength ; <nl> + if ( maxLength > = 0 ) <nl> + output [ " maxLength " ] = maxLength ; <nl> + } <nl> + <nl> + / / Print array fields <nl> + if ( CJSONUtils : : HasType ( type , ArrayValue ) ) <nl> + { <nl> + if ( items . size ( ) = = 1 ) <nl> + { <nl> + items . at ( 0 ) . Print ( false , false , false , printDescriptions , output [ " items " ] ) ; <nl> + } <nl> + else if ( items . size ( ) > 1 ) <nl> + { <nl> + output [ " items " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> + for ( unsigned int itemIndex = 0 ; itemIndex < items . size ( ) ; itemIndex + + ) <nl> + { <nl> + CVariant item = CVariant ( CVariant : : VariantTypeObject ) ; <nl> + items . at ( itemIndex ) . Print ( false , false , false , printDescriptions , item ) ; <nl> + output [ " items " ] . append ( item ) ; <nl> + } <nl> + } <nl> + <nl> + if ( minItems > 0 ) <nl> + output [ " minItems " ] = minItems ; <nl> + if ( maxItems > 0 ) <nl> + output [ " maxItems " ] = maxItems ; <nl> + <nl> + if ( additionalItems . size ( ) = = 1 ) <nl> + { <nl> + additionalItems . at ( 0 ) . Print ( false , false , false , printDescriptions , output [ " additionalItems " ] ) ; <nl> + } <nl> + else if ( additionalItems . size ( ) > 1 ) <nl> + { <nl> + output [ " additionalItems " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> + for ( unsigned int addItemIndex = 0 ; addItemIndex < additionalItems . size ( ) ; addItemIndex + + ) <nl> + { <nl> + CVariant item = CVariant ( CVariant : : VariantTypeObject ) ; <nl> + additionalItems . at ( addItemIndex ) . Print ( false , false , false , printDescriptions , item ) ; <nl> + output [ " additionalItems " ] . append ( item ) ; <nl> + } <nl> + } <nl> + <nl> + if ( uniqueItems ) <nl> + output [ " uniqueItems " ] = true ; <nl> + } <nl> + <nl> + / / Print object fields <nl> + if ( CJSONUtils : : HasType ( type , ObjectValue ) ) <nl> + { <nl> + if ( properties . size ( ) > 0 ) <nl> + { <nl> + output [ " properties " ] = CVariant ( CVariant : : VariantTypeObject ) ; <nl> + <nl> + JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator propertiesEnd = properties . end ( ) ; <nl> + JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator propertiesIterator ; <nl> + for ( propertiesIterator = properties . begin ( ) ; propertiesIterator ! = propertiesEnd ; propertiesIterator + + ) <nl> + { <nl> + propertiesIterator - > second . Print ( false , false , true , printDescriptions , output [ " properties " ] [ propertiesIterator - > first ] ) ; <nl> + } <nl> + } <nl> + <nl> + if ( ! hasAdditionalProperties ) <nl> + output [ " additionalProperties " ] = false ; <nl> + else if ( additionalProperties ! = NULL & & additionalProperties - > type ! = AnyValue ) <nl> + additionalProperties - > Print ( false , false , true , printDescriptions , output [ " additionalProperties " ] ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : CJsonSchemaPropertiesMap ( ) <nl> + { <nl> + m_propertiesmap = std : : map < std : : string , JSONSchemaTypeDefinition > ( ) ; <nl> + } <nl> + <nl> + void JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : add ( const JSONSchemaTypeDefinition & property ) <nl> + { <nl> + CStdString name = property . name ; <nl> + name = name . ToLower ( ) ; <nl> + m_propertiesmap [ name ] = property ; <nl> + } <nl> + <nl> + JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : begin ( ) const <nl> + { <nl> + return m_propertiesmap . begin ( ) ; <nl> + } <nl> + <nl> + JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : find ( const std : : string & key ) const <nl> + { <nl> + return m_propertiesmap . find ( key ) ; <nl> + } <nl> + <nl> + JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : JSONSchemaPropertiesIterator JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : end ( ) const <nl> + { <nl> + return m_propertiesmap . end ( ) ; <nl> + } <nl> + <nl> + unsigned int JSONSchemaTypeDefinition : : CJsonSchemaPropertiesMap : : size ( ) const <nl> + { <nl> + return m_propertiesmap . size ( ) ; <nl> + } <nl> + <nl> + JsonRpcMethod : : JsonRpcMethod ( ) <nl> + : missingReference ( " " ) , method ( NULL ) <nl> + { } <nl> + <nl> + bool JsonRpcMethod : : Parse ( const CVariant & value ) <nl> + { <nl> + / / Parse XBMC specific information about the method <nl> + if ( value . isMember ( " transport " ) & & value [ " transport " ] . isArray ( ) ) <nl> + { <nl> + int transport = 0 ; <nl> + for ( unsigned int index = 0 ; index < value [ " transport " ] . size ( ) ; index + + ) <nl> + transport | = StringToTransportLayer ( value [ " transport " ] [ index ] . asString ( ) ) ; <nl> + <nl> + transportneed = ( TransportLayerCapability ) transport ; <nl> + } <nl> + else <nl> + transportneed = StringToTransportLayer ( value . isMember ( " transport " ) ? value [ " transport " ] . asString ( ) : " " ) ; <nl> + <nl> + if ( value . isMember ( " permission " ) & & value [ " permission " ] . isArray ( ) ) <nl> + { <nl> + int permissions = 0 ; <nl> + for ( unsigned int index = 0 ; index < value [ " permission " ] . size ( ) ; index + + ) <nl> + permissions | = StringToPermission ( value [ " permission " ] [ index ] . asString ( ) ) ; <nl> + <nl> + permission = ( OperationPermission ) permissions ; <nl> + } <nl> + else <nl> + permission = StringToPermission ( value . isMember ( " permission " ) ? value [ " permission " ] . asString ( ) : " " ) ; <nl> + <nl> + description = GetString ( value [ " description " ] , " " ) ; <nl> + <nl> + / / Check whether there are parameters defined <nl> + if ( value . isMember ( " params " ) & & value [ " params " ] . isArray ( ) ) <nl> + { <nl> + / / Loop through all defined parameters <nl> + for ( unsigned int paramIndex = 0 ; paramIndex < value [ " params " ] . size ( ) ; paramIndex + + ) <nl> + { <nl> + CVariant parameter = value [ " params " ] [ paramIndex ] ; <nl> + / / If the parameter definition does not contain a valid " name " or <nl> + / / " type " element we will ignore it <nl> + if ( ! parameter . isMember ( " name " ) | | ! parameter [ " name " ] . isString ( ) | | <nl> + ( ! parameter . isMember ( " type " ) & & ! parameter . isMember ( " $ ref " ) & & ! parameter . isMember ( " extends " ) ) | | <nl> + ( parameter . isMember ( " type " ) & & ! parameter [ " type " ] . isString ( ) & & ! parameter [ " type " ] . isArray ( ) ) | | <nl> + ( parameter . isMember ( " $ ref " ) & & ! parameter [ " $ ref " ] . isString ( ) ) | | <nl> + ( parameter . isMember ( " extends " ) & & ! parameter [ " extends " ] . isString ( ) & & ! parameter [ " extends " ] . isArray ( ) ) ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " JSONRPC : Method % s has a badly defined parameter " , name . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> + <nl> + / / Parse the parameter and add it to the list <nl> + / / of defined parameters <nl> + JSONSchemaTypeDefinition param ; <nl> + if ( ! parseParameter ( parameter , param ) ) <nl> + { <nl> + missingReference = param . missingReference ; <nl> + return false ; <nl> + } <nl> + parameters . push_back ( param ) ; <nl> + } <nl> + } <nl> + <nl> + / / Parse the return value of the method <nl> + if ( ! parseReturn ( value ) ) <nl> + { <nl> + missingReference = returns . missingReference ; <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + JSONRPC_STATUS JsonRpcMethod : : Check ( const CVariant & requestParameters , ITransportLayer * transport , IClient * client , bool notification , MethodCall & methodCall , CVariant & outputParameters ) const <nl> + { <nl> + if ( transport ! = NULL & & ( transport - > GetCapabilities ( ) & transportneed ) = = transportneed ) <nl> + { <nl> + if ( client ! = NULL & & ( client - > GetPermissionFlags ( ) & permission ) = = permission & & ( ! notification | | ( permission & OPERATION_PERMISSION_NOTIFICATION ) = = permission ) ) <nl> + { <nl> + methodCall = method ; <nl> + <nl> + / / Count the number of actually handled ( present ) <nl> + / / parameters <nl> + unsigned int handled = 0 ; <nl> + CVariant errorData = CVariant ( CVariant : : VariantTypeObject ) ; <nl> + errorData [ " method " ] = name ; <nl> + <nl> + / / Loop through all the parameters to check <nl> + for ( unsigned int i = 0 ; i < parameters . size ( ) ; i + + ) <nl> + { <nl> + / / Evaluate the current parameter <nl> + JSONRPC_STATUS status = checkParameter ( requestParameters , parameters . at ( i ) , i , outputParameters , handled , errorData ) ; <nl> + if ( status ! = OK ) <nl> + { <nl> + / / Return the error data object in the outputParameters reference <nl> + outputParameters = errorData ; <nl> + return status ; <nl> + } <nl> + } <nl> + <nl> + / / Check if there were unnecessary parameters <nl> + if ( handled < requestParameters . size ( ) ) <nl> + { <nl> + errorData [ " message " ] = " Too many parameters " ; <nl> + outputParameters = errorData ; <nl> + return InvalidParams ; <nl> + } <nl> + <nl> + return OK ; <nl> + } <nl> + else <nl> + return BadPermission ; <nl> + } <nl> + <nl> + return MethodNotFound ; <nl> + } <nl> + <nl> + bool JsonRpcMethod : : parseParameter ( const CVariant & value , JSONSchemaTypeDefinition & parameter ) <nl> + { <nl> + parameter . name = GetString ( value [ " name " ] , " " ) ; <nl> + <nl> + / / Parse the type and default value of the parameter <nl> + return parameter . Parse ( value , true ) ; <nl> + } <nl> + <nl> + bool JsonRpcMethod : : parseReturn ( const CVariant & value ) <nl> + { <nl> + / / Only parse the " returns " definition if there is one <nl> + if ( ! value . isMember ( " returns " ) ) <nl> + { <nl> + returns . type = NullValue ; <nl> + return true ; <nl> + } <nl> + <nl> + / / If the type of the return value is defined as a simple string we can parse it directly <nl> + if ( value [ " returns " ] . isString ( ) ) <nl> + return CJSONServiceDescription : : parseJSONSchemaType ( value [ " returns " ] , returns . unionTypes , returns . type , missingReference ) ; <nl> + <nl> + / / otherwise we have to parse the whole type definition <nl> + if ( ! returns . Parse ( value [ " returns " ] ) ) <nl> + { <nl> + missingReference = returns . missingReference ; <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + JSONRPC_STATUS JsonRpcMethod : : checkParameter ( const CVariant & requestParameters , const JSONSchemaTypeDefinition & type , unsigned int position , CVariant & outputParameters , unsigned int & handled , CVariant & errorData ) <nl> + { <nl> + / / Let ' s check if the parameter has been provided <nl> + if ( ParameterExists ( requestParameters , type . name , position ) ) <nl> + { <nl> + / / Get the parameter <nl> + CVariant parameterValue = GetParameter ( requestParameters , type . name , position ) ; <nl> + <nl> + / / Evaluate the type of the parameter <nl> + JSONRPC_STATUS status = type . Check ( parameterValue , outputParameters [ type . name ] , errorData [ " stack " ] ) ; <nl> + if ( status ! = OK ) <nl> + return status ; <nl> + <nl> + / / The parameter was present and valid <nl> + handled + + ; <nl> + } <nl> + / / If the parameter has not been provided but is optional <nl> + / / we can use its default value <nl> + else if ( type . optional ) <nl> + outputParameters [ type . name ] = type . defaultValue ; <nl> + / / The parameter is required but has not been provided = > invalid <nl> + else <nl> + { <nl> + errorData [ " stack " ] [ " name " ] = type . name ; <nl> + SchemaValueTypeToJson ( type . type , errorData [ " stack " ] [ " type " ] ) ; <nl> + errorData [ " stack " ] [ " message " ] = " Missing parameter " ; <nl> + return InvalidParams ; <nl> + } <nl> + <nl> + return OK ; <nl> + } <nl> + <nl> + bool CJSONServiceDescription : : prepareDescription ( std : : string & description , CVariant & descriptionObject , std : : string & name ) <nl> + { <nl> + if ( description . empty ( ) ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Missing JSON Schema definition for \ " % s \ " " , name . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> + <nl> + if ( description . at ( 0 ) ! = ' { ' ) <nl> + { <nl> + CStdString json ; <nl> + json . Format ( " { % s } " , description ) ; <nl> + description = json ; <nl> + } <nl> + <nl> + descriptionObject = CJSONVariantParser : : Parse ( ( const unsigned char * ) description . c_str ( ) , description . size ( ) ) ; <nl> + <nl> + / / Make sure the method description actually exists and represents an object <nl> + if ( ! descriptionObject . isObject ( ) ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Unable to parse JSON Schema definition for \ " % s \ " " , name . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> + <nl> + CVariant : : const_iterator_map member = descriptionObject . begin_map ( ) ; <nl> + if ( member ! = descriptionObject . end_map ( ) ) <nl> + name = member - > first ; <nl> + <nl> + if ( name . empty ( ) | | <nl> + ( ! descriptionObject [ name ] . isMember ( " type " ) & & ! descriptionObject [ name ] . isMember ( " $ ref " ) & & ! descriptionObject [ name ] . isMember ( " extends " ) ) ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON Schema definition for \ " % s \ " " , name . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + bool CJSONServiceDescription : : addMethod ( const std : : string & jsonMethod , MethodCall method ) <nl> + { <nl> + CVariant descriptionObject ; <nl> + std : : string methodName ; <nl> + <nl> + std : : string modJsonMethod = jsonMethod ; <nl> + / / Make sure the method description actually exists and represents an object <nl> + if ( ! prepareDescription ( modJsonMethod , descriptionObject , methodName ) ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON Schema definition for method \ " % s \ " " , methodName . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> + <nl> + if ( m_actionMap . find ( methodName ) ! = m_actionMap . end ( ) ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " JSONRPC : There already is a method with the name \ " % s \ " " , methodName . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> + <nl> + std : : string type = GetString ( descriptionObject [ methodName ] [ " type " ] , " " ) ; <nl> + if ( type . compare ( " method " ) ! = 0 ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON type for method \ " % s \ " " , methodName . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> + <nl> + if ( method = = NULL ) <nl> { <nl> - int size = value . asString ( ) . size ( ) ; <nl> - if ( size < type . minLength ) <nl> + unsigned int size = sizeof ( m_methodMaps ) / sizeof ( JsonRpcMethodMap ) ; <nl> + for ( unsigned int index = 0 ; index < size ; index + + ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not meet minLength requirements in type % s " , type . name . c_str ( ) ) ; <nl> - errorMessage . Format ( " Value should have a minimum length of % d but has a length of % d " , type . minLength , size ) ; <nl> - errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> - return InvalidParams ; <nl> + if ( methodName . compare ( m_methodMaps [ index ] . name ) = = 0 ) <nl> + { <nl> + method = m_methodMaps [ index ] . method ; <nl> + break ; <nl> + } <nl> } <nl> <nl> - if ( type . maxLength > = 0 & & size > type . maxLength ) <nl> + if ( method = = NULL ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Value does not meet maxLength requirements in type % s " , type . name . c_str ( ) ) ; <nl> - errorMessage . Format ( " Value should have a maximum length of % d but has a length of % d " , type . maxLength , size ) ; <nl> - errorData [ " message " ] = errorMessage . c_str ( ) ; <nl> - return InvalidParams ; <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Missing implementation for method \ " % s \ " " , methodName . c_str ( ) ) ; <nl> + return false ; <nl> } <nl> } <nl> <nl> - / / Otherwise it can have any value <nl> - outputValue = value ; <nl> - return OK ; <nl> + / / Parse the details of the method <nl> + JsonRpcMethod newMethod ; <nl> + newMethod . name = methodName ; <nl> + newMethod . method = method ; <nl> + <nl> + if ( ! newMethod . Parse ( descriptionObject [ newMethod . name ] ) ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Could not parse method \ " % s \ " " , methodName . c_str ( ) ) ; <nl> + if ( ! newMethod . missingReference . empty ( ) ) <nl> + { <nl> + IncompleteSchemaDefinition incomplete ; <nl> + incomplete . Schema = modJsonMethod ; <nl> + incomplete . Type = SchemaDefinitionMethod ; <nl> + incomplete . Method = method ; <nl> + <nl> + IncompleteSchemaDefinitionMap : : iterator iter = m_incompleteDefinitions . find ( newMethod . missingReference ) ; <nl> + if ( iter = = m_incompleteDefinitions . end ( ) ) <nl> + m_incompleteDefinitions [ newMethod . missingReference ] = std : : vector < IncompleteSchemaDefinition > ( ) ; <nl> + <nl> + CLog : : Log ( LOGINFO , " JSONRPC : Adding method \ " % s \ " to list of incomplete definitions ( waiting for \ " % s \ " ) " , methodName . c_str ( ) , newMethod . missingReference . c_str ( ) ) ; <nl> + m_incompleteDefinitions [ newMethod . missingReference ] . push_back ( incomplete ) ; <nl> + } <nl> + <nl> + return false ; <nl> + } <nl> + <nl> + m_actionMap . add ( newMethod ) ; <nl> + <nl> + return true ; <nl> } <nl> <nl> - bool CJSONServiceDescription : : parseMethod ( const CVariant & value , JsonRpcMethod & method ) <nl> + bool CJSONServiceDescription : : AddType ( const std : : string & jsonType ) <nl> { <nl> - / / Parse XBMC specific information about the method <nl> - if ( value . isMember ( " transport " ) & & value [ " transport " ] . isArray ( ) ) <nl> - { <nl> - int transport = 0 ; <nl> - for ( unsigned int index = 0 ; index < value [ " transport " ] . size ( ) ; index + + ) <nl> - transport | = StringToTransportLayer ( value [ " transport " ] [ index ] . asString ( ) ) ; <nl> + CVariant descriptionObject ; <nl> + std : : string typeName ; <nl> <nl> - method . transportneed = ( TransportLayerCapability ) transport ; <nl> + std : : string modJsonType = jsonType ; <nl> + if ( ! prepareDescription ( modJsonType , descriptionObject , typeName ) ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON Schema definition for type \ " % s \ " " , typeName . c_str ( ) ) ; <nl> + return false ; <nl> } <nl> - else <nl> - method . transportneed = StringToTransportLayer ( value . isMember ( " transport " ) ? value [ " transport " ] . asString ( ) : " " ) ; <nl> <nl> - if ( value . isMember ( " permission " ) & & value [ " permission " ] . isArray ( ) ) <nl> + if ( m_types . find ( typeName ) ! = m_types . end ( ) ) <nl> { <nl> - int permissions = 0 ; <nl> - for ( unsigned int index = 0 ; index < value [ " permission " ] . size ( ) ; index + + ) <nl> - permissions | = StringToPermission ( value [ " permission " ] [ index ] . asString ( ) ) ; <nl> - <nl> - method . permission = ( OperationPermission ) permissions ; <nl> + CLog : : Log ( LOGERROR , " JSONRPC : There already is a type with the name \ " % s \ " " , typeName . c_str ( ) ) ; <nl> + return false ; <nl> } <nl> - else <nl> - method . permission = StringToPermission ( value . isMember ( " permission " ) ? value [ " permission " ] . asString ( ) : " " ) ; <nl> <nl> - method . description = GetString ( value [ " description " ] , " " ) ; <nl> + / / Make sure the " id " attribute is correctly populated <nl> + descriptionObject [ typeName ] [ " id " ] = typeName ; <nl> <nl> - / / Check whether there are parameters defined <nl> - if ( value . isMember ( " params " ) & & value [ " params " ] . isArray ( ) ) <nl> + JSONSchemaTypeDefinition globalType ; <nl> + globalType . name = typeName ; <nl> + <nl> + if ( ! globalType . Parse ( descriptionObject [ typeName ] ) ) <nl> { <nl> - / / Loop through all defined parameters <nl> - for ( unsigned int paramIndex = 0 ; paramIndex < value [ " params " ] . size ( ) ; paramIndex + + ) <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Could not parse type \ " % s \ " " , typeName . c_str ( ) ) ; <nl> + if ( ! globalType . missingReference . empty ( ) ) <nl> { <nl> - CVariant parameter = value [ " params " ] [ paramIndex ] ; <nl> - / / If the parameter definition does not contain a valid " name " or <nl> - / / " type " element we will ignore it <nl> - if ( ! parameter . isMember ( " name " ) | | ! parameter [ " name " ] . isString ( ) | | <nl> - ( ! parameter . isMember ( " type " ) & & ! parameter . isMember ( " $ ref " ) & & ! parameter . isMember ( " extends " ) ) | | <nl> - ( parameter . isMember ( " type " ) & & ! parameter [ " type " ] . isString ( ) & & ! parameter [ " type " ] . isArray ( ) ) | | <nl> - ( parameter . isMember ( " $ ref " ) & & ! parameter [ " $ ref " ] . isString ( ) ) | | <nl> - ( parameter . isMember ( " extends " ) & & ! parameter [ " extends " ] . isString ( ) & & ! parameter [ " extends " ] . isArray ( ) ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Method % s has a badly defined parameter " , method . name . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / Parse the parameter and add it to the list <nl> - / / of defined parameters <nl> - JSONSchemaTypeDefinition param ; <nl> - if ( ! parseParameter ( parameter , param ) ) <nl> - return false ; <nl> - method . parameters . push_back ( param ) ; <nl> + IncompleteSchemaDefinition incomplete ; <nl> + incomplete . Schema = modJsonType ; <nl> + incomplete . Type = SchemaDefinitionType ; <nl> + <nl> + IncompleteSchemaDefinitionMap : : iterator iter = m_incompleteDefinitions . find ( globalType . missingReference ) ; <nl> + if ( iter = = m_incompleteDefinitions . end ( ) ) <nl> + m_incompleteDefinitions [ globalType . missingReference ] = std : : vector < IncompleteSchemaDefinition > ( ) ; <nl> + <nl> + CLog : : Log ( LOGINFO , " JSONRPC : Adding type \ " % s \ " to list of incomplete definitions ( waiting for \ " % s \ " ) " , typeName . c_str ( ) , globalType . missingReference . c_str ( ) ) ; <nl> + m_incompleteDefinitions [ globalType . missingReference ] . push_back ( incomplete ) ; <nl> } <nl> - } <nl> <nl> - / / Parse the return value of the method <nl> - parseReturn ( value , method . returns ) ; <nl> + return false ; <nl> + } <nl> <nl> return true ; <nl> } <nl> <nl> - bool CJSONServiceDescription : : parseParameter ( CVariant & value , JSONSchemaTypeDefinition & parameter ) <nl> + bool CJSONServiceDescription : : AddMethod ( const std : : string & jsonMethod , MethodCall method ) <nl> { <nl> - parameter . name = GetString ( value [ " name " ] , " " ) ; <nl> + if ( method = = NULL ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSONRPC method implementation " ) ; <nl> + return false ; <nl> + } <nl> <nl> - / / Parse the type and default value of the parameter <nl> - return parseTypeDefinition ( value , parameter , true ) ; <nl> + return addMethod ( jsonMethod , method ) ; <nl> } <nl> <nl> - bool CJSONServiceDescription : : parseTypeDefinition ( const CVariant & value , JSONSchemaTypeDefinition & type , bool isParameter ) <nl> + bool CJSONServiceDescription : : AddBuiltinMethod ( const std : : string & jsonMethod ) <nl> { <nl> - bool isReferenceType = false ; <nl> - bool hasReference = false ; <nl> + return addMethod ( jsonMethod , NULL ) ; <nl> + } <nl> <nl> - / / Check if the type of the parameter defines a json reference <nl> - / / to a type defined somewhere else <nl> - if ( value . isMember ( " $ ref " ) & & value [ " $ ref " ] . isString ( ) ) <nl> + bool CJSONServiceDescription : : AddNotification ( const std : : string & jsonNotification ) <nl> + { <nl> + CVariant descriptionObject ; <nl> + std : : string notificationName ; <nl> + <nl> + std : : string modJsonNotification = jsonNotification ; <nl> + / / Make sure the notification description actually exists and represents an object <nl> + if ( ! prepareDescription ( modJsonNotification , descriptionObject , notificationName ) ) <nl> { <nl> - / / Get the name of the referenced type <nl> - std : : string refType = value [ " $ ref " ] . asString ( ) ; <nl> - / / Check if the referenced type exists <nl> - std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator iter = m_types . find ( refType ) ; <nl> - if ( refType . length ( ) < = 0 | | iter = = m_types . end ( ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : JSON schema type % s references an unknown type % s " , type . name . c_str ( ) , refType . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - std : : string typeName = type . name ; <nl> - type = iter - > second ; <nl> - if ( ! typeName . empty ( ) ) <nl> - type . name = typeName ; <nl> - hasReference = true ; <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON Schema definition for notification \ " % s \ " " , notificationName . c_str ( ) ) ; <nl> + return false ; <nl> } <nl> - else if ( value . isMember ( " id " ) & & value [ " id " ] . isString ( ) ) <nl> + <nl> + if ( m_notifications . find ( notificationName ) ! = m_notifications . end ( ) ) <nl> { <nl> - type . ID = GetString ( value [ " id " ] , " " ) ; <nl> - isReferenceType = true ; <nl> + CLog : : Log ( LOGERROR , " JSONRPC : There already is a notification with the name \ " % s \ " " , notificationName . c_str ( ) ) ; <nl> + return false ; <nl> } <nl> <nl> - / / Check if the " required " field has been defined <nl> - type . optional = value . isMember ( " required " ) & & value [ " required " ] . isBoolean ( ) ? ! value [ " required " ] . asBoolean ( ) : true ; <nl> + std : : string type = GetString ( descriptionObject [ notificationName ] [ " type " ] , " " ) ; <nl> + if ( type . compare ( " notification " ) ! = 0 ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " JSONRPC : Invalid JSON type for notification \ " % s \ " " , notificationName . c_str ( ) ) ; <nl> + return false ; <nl> + } <nl> <nl> - / / Get the " description " <nl> - if ( ! hasReference | | ( value . isMember ( " description " ) & & value [ " description " ] . isString ( ) ) ) <nl> - type . description = GetString ( value [ " description " ] , " " ) ; <nl> + m_notifications [ notificationName ] = descriptionObject ; <nl> <nl> - if ( hasReference ) <nl> - { <nl> - / / If there is a specific default value , read it <nl> - if ( value . isMember ( " default " ) & & IsType ( value [ " default " ] , type . type ) ) <nl> - { <nl> - bool ok = false ; <nl> - if ( type . enums . size ( ) < = 0 ) <nl> - ok = true ; <nl> - / / If the type has an enum definition we must make <nl> - / / sure that the default value is a valid enum value <nl> - else <nl> - { <nl> - for ( std : : vector < CVariant > : : const_iterator itr = type . enums . begin ( ) ; itr ! = type . enums . end ( ) ; itr + + ) <nl> - { <nl> - if ( value [ " default " ] = = * itr ) <nl> - { <nl> - ok = true ; <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> + return true ; <nl> + } <nl> <nl> - if ( ok ) <nl> - type . defaultValue = value [ " default " ] ; <nl> - } <nl> + bool CJSONServiceDescription : : AddEnum ( const std : : string & name , const std : : vector < CVariant > & values , CVariant : : VariantType type / * = CVariant : : VariantTypeNull * / , const CVariant & defaultValue / * = CVariant : : ConstNullVariant * / ) <nl> + { <nl> + if ( name . empty ( ) | | m_types . find ( name ) ! = m_types . end ( ) | | <nl> + values . size ( ) = = 0 ) <nl> + return false ; <nl> <nl> - return true ; <nl> + JSONSchemaTypeDefinition definition ; <nl> + definition . ID = name ; <nl> + <nl> + std : : vector < CVariant : : VariantType > types ; <nl> + bool autoType = false ; <nl> + if ( type = = CVariant : : VariantTypeNull ) <nl> + autoType = true ; <nl> + else <nl> + types . push_back ( type ) ; <nl> + <nl> + for ( unsigned int index = 0 ; index < values . size ( ) ; index + + ) <nl> + { <nl> + if ( autoType ) <nl> + types . push_back ( values [ index ] . type ( ) ) ; <nl> + else if ( type ! = CVariant : : VariantTypeConstNull & & type ! = values [ index ] . type ( ) ) <nl> + return false ; <nl> } <nl> + definition . enums . insert ( definition . enums . begin ( ) , values . begin ( ) , values . end ( ) ) ; <nl> <nl> - / / Check whether this type extends an existing type <nl> - if ( value . isMember ( " extends " ) ) <nl> + int schemaType = ( int ) AnyValue ; <nl> + for ( unsigned int index = 0 ; index < types . size ( ) ; index + + ) <nl> { <nl> - if ( value [ " extends " ] . isString ( ) ) <nl> + JSONSchemaType currentType ; <nl> + switch ( type ) <nl> { <nl> - std : : string extends = GetString ( value [ " extends " ] , " " ) ; <nl> - if ( ! extends . empty ( ) ) <nl> - { <nl> - std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator iter = m_types . find ( extends ) ; <nl> - if ( iter = = m_types . end ( ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : JSON schema type % s extends an unknown type % s " , type . name . c_str ( ) , extends . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - type . type = iter - > second . type ; <nl> - type . extends . push_back ( iter - > second ) ; <nl> - } <nl> + case CVariant : : VariantTypeString : <nl> + currentType = StringValue ; <nl> + break ; <nl> + case CVariant : : VariantTypeDouble : <nl> + currentType = NumberValue ; <nl> + break ; <nl> + case CVariant : : VariantTypeInteger : <nl> + case CVariant : : VariantTypeUnsignedInteger : <nl> + currentType = IntegerValue ; <nl> + break ; <nl> + case CVariant : : VariantTypeBoolean : <nl> + currentType = BooleanValue ; <nl> + break ; <nl> + case CVariant : : VariantTypeArray : <nl> + currentType = ArrayValue ; <nl> + break ; <nl> + case CVariant : : VariantTypeObject : <nl> + currentType = ObjectValue ; <nl> + break ; <nl> + case CVariant : : VariantTypeConstNull : <nl> + currentType = AnyValue ; <nl> + break ; <nl> + default : <nl> + case CVariant : : VariantTypeNull : <nl> + return false ; <nl> } <nl> - else if ( value [ " extends " ] . isArray ( ) ) <nl> - { <nl> - std : : string extends ; <nl> - JSONSchemaType extendedType = AnyValue ; <nl> - for ( unsigned int extendsIndex = 0 ; extendsIndex < value [ " extends " ] . size ( ) ; extendsIndex + + ) <nl> - { <nl> - extends = GetString ( value [ " extends " ] [ extendsIndex ] , " " ) ; <nl> - if ( ! extends . empty ( ) ) <nl> - { <nl> - std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator iter = m_types . find ( extends ) ; <nl> - if ( iter = = m_types . end ( ) ) <nl> - { <nl> - type . extends . clear ( ) ; <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : JSON schema type % s extends an unknown type % s " , type . name . c_str ( ) , extends . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> <nl> - if ( extendsIndex = = 0 ) <nl> - extendedType = iter - > second . type ; <nl> - else if ( extendedType ! = iter - > second . type ) <nl> - { <nl> - type . extends . clear ( ) ; <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : JSON schema type % s extends multiple JSON schema types of mismatching types " , type . name . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> + if ( index = = 0 ) <nl> + schemaType = currentType ; <nl> + else <nl> + schemaType | = ( int ) currentType ; <nl> + } <nl> + definition . type = ( JSONSchemaType ) schemaType ; <nl> + <nl> + if ( defaultValue . type ( ) = = CVariant : : VariantTypeConstNull ) <nl> + definition . defaultValue = definition . enums . at ( 0 ) ; <nl> + else <nl> + definition . defaultValue = defaultValue ; <nl> <nl> - type . extends . push_back ( iter - > second ) ; <nl> - } <nl> - } <nl> + addReferenceTypeDefinition ( definition ) ; <nl> <nl> - type . type = extendedType ; <nl> - } <nl> - } <nl> + return true ; <nl> + } <nl> <nl> - / / Only read the " type " attribute if it ' s <nl> - / / not an extending type <nl> - if ( type . extends . size ( ) < = 0 ) <nl> - { <nl> - / / Get the defined type of the parameter <nl> - type . type = parseJSONSchemaType ( value [ " type " ] , type . unionTypes ) ; <nl> - } <nl> + bool CJSONServiceDescription : : AddEnum ( const std : : string & name , const std : : vector < std : : string > & values ) <nl> + { <nl> + std : : vector < CVariant > enums ; <nl> + for ( std : : vector < std : : string > : : const_iterator it = values . begin ( ) ; it ! = values . end ( ) ; it + + ) <nl> + enums . push_back ( CVariant ( * it ) ) ; <nl> <nl> - if ( HasType ( type . type , ObjectValue ) ) <nl> + return AddEnum ( name , enums , CVariant : : VariantTypeString ) ; <nl> + } <nl> + <nl> + bool CJSONServiceDescription : : AddEnum ( const std : : string & name , const std : : vector < int > & values ) <nl> + { <nl> + std : : vector < CVariant > enums ; <nl> + for ( std : : vector < int > : : const_iterator it = values . begin ( ) ; it ! = values . end ( ) ; it + + ) <nl> + enums . push_back ( CVariant ( * it ) ) ; <nl> + <nl> + return AddEnum ( name , enums , CVariant : : VariantTypeInteger ) ; <nl> + } <nl> + <nl> + int CJSONServiceDescription : : GetVersion ( ) <nl> + { <nl> + return JSONRPC_SERVICE_VERSION ; <nl> + } <nl> + <nl> + JSONRPC_STATUS CJSONServiceDescription : : Print ( CVariant & result , ITransportLayer * transport , IClient * client , <nl> + bool printDescriptions / * = true * / , bool printMetadata / * = false * / , bool filterByTransport / * = true * / , <nl> + const std : : string & filterByName / * = " " * / , const std : : string & filterByType / * = " " * / , bool printReferences / * = true * / ) <nl> + { <nl> + std : : map < std : : string , JSONSchemaTypeDefinition > types ; <nl> + CJsonRpcMethodMap methods ; <nl> + std : : map < std : : string , CVariant > notifications ; <nl> + <nl> + int clientPermissions = client - > GetPermissionFlags ( ) ; <nl> + int transportCapabilities = transport - > GetCapabilities ( ) ; <nl> + <nl> + if ( filterByName . size ( ) > 0 ) <nl> { <nl> - / / If the type definition is of type " object " <nl> - / / and has a " properties " definition we need <nl> - / / to handle these as well <nl> - if ( value . isMember ( " properties " ) & & value [ " properties " ] . isObject ( ) ) <nl> + CStdString name = filterByName ; <nl> + <nl> + if ( filterByType = = " method " ) <nl> + { <nl> + name = name . ToLower ( ) ; <nl> + <nl> + CJsonRpcMethodMap : : JsonRpcMethodIterator methodIterator = m_actionMap . find ( name ) ; <nl> + if ( methodIterator ! = m_actionMap . end ( ) & & <nl> + ( clientPermissions & methodIterator - > second . permission ) = = methodIterator - > second . permission & & ( ( transportCapabilities & methodIterator - > second . transportneed ) = = methodIterator - > second . transportneed | | ! filterByTransport ) ) <nl> + methods . add ( methodIterator - > second ) ; <nl> + else <nl> + return InvalidParams ; <nl> + } <nl> + else if ( filterByType = = " namespace " ) <nl> { <nl> - / / Get all child elements of the " properties " <nl> - / / object and loop through them <nl> - for ( CVariant : : const_iterator_map itr = value [ " properties " ] . begin_map ( ) ; itr ! = value [ " properties " ] . end_map ( ) ; itr + + ) <nl> + / / append a . delimiter to make sure we check for a namespace <nl> + name = name . ToLower ( ) . append ( " . " ) ; <nl> + <nl> + CJsonRpcMethodMap : : JsonRpcMethodIterator methodIterator ; <nl> + CJsonRpcMethodMap : : JsonRpcMethodIterator methodIteratorEnd = m_actionMap . end ( ) ; <nl> + for ( methodIterator = m_actionMap . begin ( ) ; methodIterator ! = methodIteratorEnd ; methodIterator + + ) <nl> { <nl> - / / Create a new type definition , store the name <nl> - / / of the current property into it , parse it <nl> - / / recursively and add its default value <nl> - / / to the current type ' s default value <nl> - JSONSchemaTypeDefinition propertyType ; <nl> - propertyType . name = itr - > first ; <nl> - if ( ! parseTypeDefinition ( itr - > second , propertyType , false ) ) <nl> - return false ; <nl> - type . defaultValue [ itr - > first ] = propertyType . defaultValue ; <nl> - type . properties . add ( propertyType ) ; <nl> + / / Check if the given name is at the very beginning of the method name <nl> + if ( methodIterator - > first . find ( name ) = = 0 & & <nl> + ( clientPermissions & methodIterator - > second . permission ) = = methodIterator - > second . permission & & ( ( transportCapabilities & methodIterator - > second . transportneed ) = = methodIterator - > second . transportneed | | ! filterByTransport ) ) <nl> + methods . add ( methodIterator - > second ) ; <nl> } <nl> - } <nl> <nl> - type . hasAdditionalProperties = true ; <nl> - type . additionalProperties = new JSONSchemaTypeDefinition ( ) ; <nl> - if ( value . isMember ( " additionalProperties " ) ) <nl> + if ( methods . begin ( ) = = methods . end ( ) ) <nl> + return InvalidParams ; <nl> + } <nl> + else if ( filterByType = = " type " ) <nl> { <nl> - if ( value [ " additionalProperties " ] . isBoolean ( ) ) <nl> - { <nl> - type . hasAdditionalProperties = value [ " additionalProperties " ] . asBoolean ( ) ; <nl> - if ( ! type . hasAdditionalProperties ) <nl> - { <nl> - delete type . additionalProperties ; <nl> - type . additionalProperties = NULL ; <nl> - } <nl> - } <nl> - else if ( value [ " additionalProperties " ] . isObject ( ) & & ! value [ " additionalProperties " ] . isNull ( ) ) <nl> - { <nl> - if ( ! parseTypeDefinition ( value [ " additionalProperties " ] , * ( type . additionalProperties ) , false ) ) <nl> - { <nl> - type . hasAdditionalProperties = false ; <nl> - delete type . additionalProperties ; <nl> - type . additionalProperties = NULL ; <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Invalid additionalProperties schema definition in type % s " , type . name . c_str ( ) ) ; <nl> - } <nl> - } <nl> + std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIterator = m_types . find ( name ) ; <nl> + if ( typeIterator ! = m_types . end ( ) ) <nl> + types [ typeIterator - > first ] = typeIterator - > second ; <nl> else <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Invalid additionalProperties definition in type % s " , type . name . c_str ( ) ) ; <nl> + return InvalidParams ; <nl> + } <nl> + else if ( filterByType = = " notification " ) <nl> + { <nl> + std : : map < std : : string , CVariant > : : const_iterator notificationIterator = m_notifications . find ( name ) ; <nl> + if ( notificationIterator ! = m_notifications . end ( ) ) <nl> + notifications [ notificationIterator - > first ] = notificationIterator - > second ; <nl> + else <nl> + return InvalidParams ; <nl> } <nl> - } <nl> - <nl> - / / If the defined parameter is an array <nl> - / / we need to check for detailed definitions <nl> - / / of the array items <nl> - if ( HasType ( type . type , ArrayValue ) ) <nl> - { <nl> - / / Check for " uniqueItems " field <nl> - if ( value . isMember ( " uniqueItems " ) & & value [ " uniqueItems " ] . isBoolean ( ) ) <nl> - type . uniqueItems = value [ " uniqueItems " ] . asBoolean ( ) ; <nl> else <nl> - type . uniqueItems = false ; <nl> + return InvalidParams ; <nl> <nl> - / / Check for " additionalItems " field <nl> - if ( value . isMember ( " additionalItems " ) ) <nl> + / / If we need to print all referenced types we have to go through all parameters etc <nl> + if ( printReferences ) <nl> { <nl> - / / If it is an object , there is only one schema for it <nl> - if ( value [ " additionalItems " ] . isObject ( ) ) <nl> - { <nl> - JSONSchemaTypeDefinition additionalItem ; <nl> - <nl> - if ( parseTypeDefinition ( value [ " additionalItems " ] , additionalItem , false ) ) <nl> - type . additionalItems . push_back ( additionalItem ) ; <nl> - } <nl> - / / If it is an array there may be multiple schema definitions <nl> - else if ( value [ " additionalItems " ] . isArray ( ) ) <nl> - { <nl> - for ( unsigned int itemIndex = 0 ; itemIndex < value [ " additionalItems " ] . size ( ) ; itemIndex + + ) <nl> - { <nl> - JSONSchemaTypeDefinition additionalItem ; <nl> + std : : vector < std : : string > referencedTypes ; <nl> <nl> - if ( parseTypeDefinition ( value [ " additionalItems " ] [ itemIndex ] , additionalItem , false ) ) <nl> - type . additionalItems . push_back ( additionalItem ) ; <nl> - } <nl> - } <nl> - / / If it is not a ( array of ) schema and not a bool ( default value is false ) <nl> - / / it has an invalid value <nl> - else if ( ! value [ " additionalItems " ] . isBoolean ( ) ) <nl> - CLog : : Log ( LOGDEBUG , " Invalid \ " additionalItems \ " value for type % s " , type . name . c_str ( ) ) ; <nl> - } <nl> + / / Loop through all printed types to get all referenced types <nl> + std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIterator ; <nl> + std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIteratorEnd = types . end ( ) ; <nl> + for ( typeIterator = types . begin ( ) ; typeIterator ! = typeIteratorEnd ; typeIterator + + ) <nl> + getReferencedTypes ( typeIterator - > second , referencedTypes ) ; <nl> <nl> - / / If the " items " field is a single object <nl> - / / we can parse that directly <nl> - if ( value . isMember ( " items " ) ) <nl> - { <nl> - if ( value [ " items " ] . isObject ( ) ) <nl> + / / Loop through all printed method ' s parameters and return value to get all referenced types <nl> + CJsonRpcMethodMap : : JsonRpcMethodIterator methodIterator ; <nl> + CJsonRpcMethodMap : : JsonRpcMethodIterator methodIteratorEnd = methods . end ( ) ; <nl> + for ( methodIterator = methods . begin ( ) ; methodIterator ! = methodIteratorEnd ; methodIterator + + ) <nl> { <nl> - JSONSchemaTypeDefinition item ; <nl> + for ( unsigned int index = 0 ; index < methodIterator - > second . parameters . size ( ) ; index + + ) <nl> + getReferencedTypes ( methodIterator - > second . parameters . at ( index ) , referencedTypes ) ; <nl> <nl> - if ( ! parseTypeDefinition ( value [ " items " ] , item , false ) ) <nl> - return false ; <nl> - type . items . push_back ( item ) ; <nl> + getReferencedTypes ( methodIterator - > second . returns , referencedTypes ) ; <nl> } <nl> - / / Otherwise if it is an array we need to <nl> - / / parse all elements and store them <nl> - else if ( value [ " items " ] . isArray ( ) ) <nl> - { <nl> - for ( CVariant : : const_iterator_array itemItr = value [ " items " ] . begin_array ( ) ; itemItr ! = value [ " items " ] . end_array ( ) ; itemItr + + ) <nl> - { <nl> - JSONSchemaTypeDefinition item ; <nl> <nl> - if ( ! parseTypeDefinition ( * itemItr , item , false ) ) <nl> - return false ; <nl> - type . items . push_back ( item ) ; <nl> - } <nl> + for ( unsigned int index = 0 ; index < referencedTypes . size ( ) ; index + + ) <nl> + { <nl> + std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIterator = m_types . find ( referencedTypes . at ( index ) ) ; <nl> + if ( typeIterator ! = m_types . end ( ) ) <nl> + types [ typeIterator - > first ] = typeIterator - > second ; <nl> } <nl> } <nl> - <nl> - type . minItems = ( unsigned int ) value [ " minItems " ] . asUnsignedInteger ( 0 ) ; <nl> - type . maxItems = ( unsigned int ) value [ " maxItems " ] . asUnsignedInteger ( 0 ) ; <nl> - } <nl> - <nl> - if ( HasType ( type . type , NumberValue ) | | HasType ( type . type , IntegerValue ) ) <nl> - { <nl> - if ( ( type . type & NumberValue ) = = NumberValue ) <nl> - { <nl> - type . minimum = value [ " minimum " ] . asDouble ( - numeric_limits < double > : : max ( ) ) ; <nl> - type . maximum = value [ " maximum " ] . asDouble ( numeric_limits < double > : : max ( ) ) ; <nl> - } <nl> - else if ( ( type . type & IntegerValue ) = = IntegerValue ) <nl> - { <nl> - type . minimum = ( double ) value [ " minimum " ] . asInteger ( numeric_limits < int > : : min ( ) ) ; <nl> - type . maximum = ( double ) value [ " maximum " ] . asInteger ( numeric_limits < int > : : max ( ) ) ; <nl> - } <nl> - <nl> - type . exclusiveMinimum = value [ " exclusiveMinimum " ] . asBoolean ( false ) ; <nl> - type . exclusiveMaximum = value [ " exclusiveMaximum " ] . asBoolean ( false ) ; <nl> - type . divisibleBy = ( unsigned int ) value [ " divisibleBy " ] . asUnsignedInteger ( 0 ) ; <nl> } <nl> - <nl> - if ( HasType ( type . type , StringValue ) ) <nl> + else <nl> { <nl> - type . minLength = ( int ) value [ " minLength " ] . asInteger ( - 1 ) ; <nl> - type . maxLength = ( int ) value [ " maxLength " ] . asInteger ( - 1 ) ; <nl> + types = m_types ; <nl> + methods = m_actionMap ; <nl> + notifications = m_notifications ; <nl> } <nl> <nl> - / / If the type definition is neither an <nl> - / / " object " nor an " array " we can check <nl> - / / for an " enum " definition <nl> - if ( value . isMember ( " enum " ) & & value [ " enum " ] . isArray ( ) ) <nl> + / / Print the header <nl> + result [ " id " ] = JSONRPC_SERVICE_ID ; <nl> + result [ " version " ] = JSONRPC_SERVICE_VERSION ; <nl> + result [ " description " ] = JSONRPC_SERVICE_DESCRIPTION ; <nl> + <nl> + std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIterator ; <nl> + std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator typeIteratorEnd = types . end ( ) ; <nl> + for ( typeIterator = types . begin ( ) ; typeIterator ! = typeIteratorEnd ; typeIterator + + ) <nl> { <nl> - / / Loop through all elements in the " enum " array <nl> - for ( CVariant : : const_iterator_array enumItr = value [ " enum " ] . begin_array ( ) ; enumItr ! = value [ " enum " ] . end_array ( ) ; enumItr + + ) <nl> - { <nl> - / / Check for duplicates and eliminate them <nl> - bool approved = true ; <nl> - for ( unsigned int approvedIndex = 0 ; approvedIndex < type . enums . size ( ) ; approvedIndex + + ) <nl> - { <nl> - if ( * enumItr = = type . enums . at ( approvedIndex ) ) <nl> - { <nl> - approved = false ; <nl> - break ; <nl> - } <nl> - } <nl> + CVariant currentType = CVariant ( CVariant : : VariantTypeObject ) ; <nl> + typeIterator - > second . Print ( false , true , true , printDescriptions , currentType ) ; <nl> <nl> - / / Only add the current item to the enum value <nl> - / / list if it is not duplicate <nl> - if ( approved ) <nl> - type . enums . push_back ( * enumItr ) ; <nl> - } <nl> + result [ " types " ] [ typeIterator - > first ] = currentType ; <nl> } <nl> <nl> - if ( type . type ! = ObjectValue ) <nl> + / / Iterate through all json rpc methods <nl> + CJsonRpcMethodMap : : JsonRpcMethodIterator methodIterator ; <nl> + CJsonRpcMethodMap : : JsonRpcMethodIterator methodIteratorEnd = methods . end ( ) ; <nl> + for ( methodIterator = methods . begin ( ) ; methodIterator ! = methodIteratorEnd ; methodIterator + + ) <nl> { <nl> - / / If there is a definition for a default value and its type <nl> - / / matches the type of the parameter we can parse it <nl> - bool ok = false ; <nl> - if ( value . isMember ( " default " ) & & IsType ( value [ " default " ] , type . type ) ) <nl> + if ( ( clientPermissions & methodIterator - > second . permission ) ! = methodIterator - > second . permission | | ( ( transportCapabilities & methodIterator - > second . transportneed ) ! = methodIterator - > second . transportneed & & filterByTransport ) ) <nl> + continue ; <nl> + <nl> + CVariant currentMethod = CVariant ( CVariant : : VariantTypeObject ) ; <nl> + <nl> + currentMethod [ " type " ] = " method " ; <nl> + if ( printDescriptions & & ! methodIterator - > second . description . empty ( ) ) <nl> + currentMethod [ " description " ] = methodIterator - > second . description ; <nl> + if ( printMetadata ) <nl> { <nl> - if ( type . enums . size ( ) < = 0 ) <nl> - ok = true ; <nl> - / / If the type has an enum definition we must make <nl> - / / sure that the default value is a valid enum value <nl> - else <nl> + CVariant permissions ( CVariant : : VariantTypeArray ) ; <nl> + for ( int i = ReadData ; i < = OPERATION_PERMISSION_ALL ; i * = 2 ) <nl> { <nl> - for ( std : : vector < CVariant > : : const_iterator itr = type . enums . begin ( ) ; itr ! = type . enums . end ( ) ; itr + + ) <nl> - { <nl> - if ( value [ " default " ] = = * itr ) <nl> - { <nl> - ok = true ; <nl> - break ; <nl> - } <nl> - } <nl> + if ( ( methodIterator - > second . permission & i ) = = i ) <nl> + permissions . push_back ( PermissionToString ( ( OperationPermission ) i ) ) ; <nl> } <nl> + <nl> + if ( permissions . size ( ) = = 1 ) <nl> + currentMethod [ " permission " ] = permissions [ 0 ] ; <nl> + else <nl> + currentMethod [ " permission " ] = permissions ; <nl> } <nl> <nl> - if ( ok ) <nl> - type . defaultValue = value [ " default " ] ; <nl> - else <nl> + currentMethod [ " params " ] = CVariant ( CVariant : : VariantTypeArray ) ; <nl> + for ( unsigned int paramIndex = 0 ; paramIndex < methodIterator - > second . parameters . size ( ) ; paramIndex + + ) <nl> { <nl> - / / If the type of the default value definition does not <nl> - / / match the type of the parameter we have to log this <nl> - if ( value . isMember ( " default " ) & & ! IsType ( value [ " default " ] , type . type ) ) <nl> - CLog : : Log ( LOGDEBUG , " JSONRPC : Parameter % s has an invalid default value " , type . name . c_str ( ) ) ; <nl> - <nl> - / / If the type contains an " enum " we need to get the <nl> - / / default value from the first enum value <nl> - if ( type . enums . size ( ) > 0 ) <nl> - type . defaultValue = type . enums . at ( 0 ) ; <nl> - / / otherwise set a default value instead <nl> - else <nl> - SetDefaultValue ( type . defaultValue , type . type ) ; <nl> + CVariant param = CVariant ( CVariant : : VariantTypeObject ) ; <nl> + methodIterator - > second . parameters . at ( paramIndex ) . Print ( true , false , true , printDescriptions , param ) ; <nl> + currentMethod [ " params " ] . append ( param ) ; <nl> } <nl> + <nl> + methodIterator - > second . returns . Print ( false , false , false , printDescriptions , currentMethod [ " returns " ] ) ; <nl> + <nl> + result [ " methods " ] [ methodIterator - > second . name ] = currentMethod ; <nl> } <nl> <nl> - if ( isReferenceType ) <nl> - addReferenceTypeDefinition ( type ) ; <nl> + / / Print notification description <nl> + std : : map < std : : string , CVariant > : : const_iterator notificationIterator ; <nl> + std : : map < std : : string , CVariant > : : const_iterator notificationIteratorEnd = notifications . end ( ) ; <nl> + for ( notificationIterator = notifications . begin ( ) ; notificationIterator ! = notificationIteratorEnd ; notificationIterator + + ) <nl> + result [ " notifications " ] [ notificationIterator - > first ] = notificationIterator - > second [ notificationIterator - > first ] ; <nl> <nl> - return true ; <nl> + return OK ; <nl> } <nl> <nl> - void CJSONServiceDescription : : parseReturn ( const CVariant & value , JSONSchemaTypeDefinition & returns ) <nl> + JSONRPC_STATUS CJSONServiceDescription : : CheckCall ( const char * const method , const CVariant & requestParameters , ITransportLayer * transport , IClient * client , bool notification , MethodCall & methodCall , CVariant & outputParameters ) <nl> { <nl> - / / Only parse the " returns " definition if there is one <nl> - if ( ! value . isMember ( " returns " ) ) <nl> - { <nl> - returns . type = NullValue ; <nl> - return ; <nl> - } <nl> + CJsonRpcMethodMap : : JsonRpcMethodIterator iter = m_actionMap . find ( method ) ; <nl> + if ( iter ! = m_actionMap . end ( ) ) <nl> + return iter - > second . Check ( requestParameters , transport , client , notification , methodCall , outputParameters ) ; <nl> + <nl> + return MethodNotFound ; <nl> + } <nl> + <nl> + JSONSchemaTypeDefinition * CJSONServiceDescription : : GetType ( const std : : string & identification ) <nl> + { <nl> + std : : map < std : : string , JSONSchemaTypeDefinition > : : iterator iter = m_types . find ( identification ) ; <nl> + if ( iter = = m_types . end ( ) ) <nl> + return NULL ; <nl> <nl> - / / If the type of the return value is defined as a simple string we can parse it directly <nl> - if ( value [ " returns " ] . isString ( ) ) <nl> - { <nl> - returns . type = parseJSONSchemaType ( value [ " returns " ] , returns . unionTypes ) ; <nl> - } <nl> - / / otherwise we have to parse the whole type definition <nl> - else <nl> - parseTypeDefinition ( value [ " returns " ] , returns , false ) ; <nl> + return & ( iter - > second ) ; <nl> } <nl> <nl> - JSONSchemaType CJSONServiceDescription : : parseJSONSchemaType ( const CVariant & value , std : : vector < JSONSchemaTypeDefinition > & typeDefinitions ) <nl> + bool CJSONServiceDescription : : parseJSONSchemaType ( const CVariant & value , std : : vector < JSONSchemaTypeDefinition > & typeDefinitions , JSONSchemaType & schemaType , std : : string & missingReference ) <nl> { <nl> + missingReference . clear ( ) ; <nl> + schemaType = AnyValue ; <nl> + <nl> if ( value . isArray ( ) ) <nl> { <nl> int parsedType = 0 ; <nl> JSONSchemaType CJSONServiceDescription : : parseJSONSchemaType ( const CVariant & valu <nl> definition . type = StringToSchemaValueType ( value [ typeIndex ] . asString ( ) ) ; <nl> else if ( value [ typeIndex ] . isObject ( ) ) <nl> { <nl> - if ( ! parseTypeDefinition ( value [ typeIndex ] , definition , false ) ) <nl> + if ( ! definition . Parse ( value [ typeIndex ] ) ) <nl> { <nl> + missingReference = definition . missingReference ; <nl> CLog : : Log ( LOGERROR , " JSONRPC : Invalid type schema in union type definition " ) ; <nl> - continue ; <nl> + return false ; <nl> } <nl> } <nl> else <nl> { <nl> CLog : : Log ( LOGWARNING , " JSONRPC : Invalid type in union type definition " ) ; <nl> - continue ; <nl> + return false ; <nl> } <nl> <nl> definition . optional = false ; <nl> JSONSchemaType CJSONServiceDescription : : parseJSONSchemaType ( const CVariant & valu <nl> } <nl> <nl> / / If the type has not been set yet set it to " any " <nl> - if ( parsedType = = 0 ) <nl> - return AnyValue ; <nl> + if ( parsedType ! = 0 ) <nl> + schemaType = ( JSONSchemaType ) parsedType ; <nl> <nl> - return ( JSONSchemaType ) parsedType ; <nl> + return true ; <nl> } <nl> - else <nl> - return value . isString ( ) ? StringToSchemaValueType ( value . asString ( ) ) : AnyValue ; <nl> + <nl> + if ( value . isString ( ) ) <nl> + { <nl> + schemaType = StringToSchemaValueType ( value . asString ( ) ) ; <nl> + return true ; <nl> + } <nl> + <nl> + return false ; <nl> } <nl> <nl> - void CJSONServiceDescription : : addReferenceTypeDefinition ( JSONSchemaTypeDefinition & typeDefinition ) <nl> + void CJSONServiceDescription : : addReferenceTypeDefinition ( const JSONSchemaTypeDefinition & typeDefinition ) <nl> { <nl> / / If the given json value is no object or does not contain an " id " field <nl> / / of type string it is no valid type definition <nl> void CJSONServiceDescription : : addReferenceTypeDefinition ( JSONSchemaTypeDefinitio <nl> <nl> / / Add the type to the list of type definitions <nl> m_types [ typeDefinition . ID ] = typeDefinition ; <nl> + <nl> + IncompleteSchemaDefinitionMap : : iterator iter = m_incompleteDefinitions . find ( typeDefinition . ID ) ; <nl> + if ( iter = = m_incompleteDefinitions . end ( ) ) <nl> + return ; <nl> + <nl> + CLog : : Log ( LOGINFO , " JSONRPC : Resolving incomplete types / methods referencing % s " , typeDefinition . ID . c_str ( ) ) ; <nl> + for ( unsigned int index = 0 ; index < iter - > second . size ( ) ; index + + ) <nl> + { <nl> + if ( iter - > second [ index ] . Type = = SchemaDefinitionType ) <nl> + AddType ( iter - > second [ index ] . Schema ) ; <nl> + else <nl> + AddMethod ( iter - > second [ index ] . Schema , iter - > second [ index ] . Method ) ; <nl> + } <nl> + <nl> + m_incompleteDefinitions . erase ( typeDefinition . ID ) ; <nl> } <nl> <nl> void CJSONServiceDescription : : getReferencedTypes ( const JSONSchemaTypeDefinition & type , std : : vector < std : : string > & referencedTypes ) <nl> mmm a / xbmc / interfaces / json - rpc / JSONServiceDescription . h <nl> ppp b / xbmc / interfaces / json - rpc / JSONServiceDescription . h <nl> namespace JSONRPC <nl> { <nl> / * ! <nl> \ ingroup jsonrpc <nl> - \ brief Structure for a parameter of a <nl> + \ brief Class for a parameter of a <nl> json rpc method . <nl> <nl> Represents a parameter of a defined <nl> namespace JSONRPC <nl> and extract the value of the parameter <nl> in a method call . <nl> * / <nl> - typedef struct JSONSchemaTypeDefinition <nl> + class JSONSchemaTypeDefinition : protected CJSONUtils <nl> { <nl> - JSONSchemaTypeDefinition ( ) <nl> - : type ( AnyValue ) , minimum ( std : : numeric_limits < double > : : min ( ) ) , maximum ( std : : numeric_limits < double > : : max ( ) ) , <nl> - exclusiveMinimum ( false ) , exclusiveMaximum ( false ) , divisibleBy ( 0 ) , <nl> - minLength ( - 1 ) , maxLength ( - 1 ) , <nl> - minItems ( 0 ) , maxItems ( 0 ) , uniqueItems ( false ) , <nl> - hasAdditionalProperties ( false ) , additionalProperties ( NULL ) <nl> - { } <nl> + public : <nl> + JSONSchemaTypeDefinition ( ) ; <nl> + <nl> + bool Parse ( const CVariant & value , bool isParameter = false ) ; <nl> + JSONRPC_STATUS Check ( const CVariant & value , CVariant & outputValue , CVariant & errorData ) const ; <nl> + void Print ( bool isParameter , bool isGlobal , bool printDefault , bool printDescriptions , CVariant & output ) const ; <nl> + <nl> + std : : string missingReference ; <nl> <nl> / * ! <nl> \ brief Name of the parameter ( for <nl> namespace JSONRPC <nl> public : <nl> CJsonSchemaPropertiesMap ( ) ; <nl> <nl> - void add ( JSONSchemaTypeDefinition & property ) ; <nl> + void add ( const JSONSchemaTypeDefinition & property ) ; <nl> <nl> typedef std : : map < std : : string , JSONSchemaTypeDefinition > : : const_iterator JSONSchemaPropertiesIterator ; <nl> JSONSchemaPropertiesIterator begin ( ) const ; <nl> namespace JSONRPC <nl> \ brief Type definition for additional properties <nl> * / <nl> JSONSchemaTypeDefinition * additionalProperties ; <nl> - } JSONSchemaTypeDefinition ; <nl> + } ; <nl> <nl> / * ! <nl> \ ingroup jsonrpc <nl> namespace JSONRPC <nl> and is used to verify an incoming json <nl> rpc request against a defined method . <nl> * / <nl> - typedef struct <nl> + class JsonRpcMethod : protected CJSONUtils <nl> { <nl> + public : <nl> + JsonRpcMethod ( ) ; <nl> + <nl> + bool Parse ( const CVariant & value ) ; <nl> + JSONRPC_STATUS Check ( const CVariant & requestParameters , ITransportLayer * transport , IClient * client , bool notification , MethodCall & methodCall , CVariant & outputParameters ) const ; <nl> + <nl> + std : : string missingReference ; <nl> + <nl> / * ! <nl> \ brief Name of the represented method <nl> * / <nl> namespace JSONRPC <nl> \ brief Definition of the return value <nl> * / <nl> JSONSchemaTypeDefinition returns ; <nl> - } JsonRpcMethod ; <nl> + <nl> + private : <nl> + bool parseParameter ( const CVariant & value , JSONSchemaTypeDefinition & parameter ) ; <nl> + bool parseReturn ( const CVariant & value ) ; <nl> + static JSONRPC_STATUS checkParameter ( const CVariant & requestParameters , const JSONSchemaTypeDefinition & type , unsigned int position , CVariant & outputParameters , unsigned int & handled , CVariant & errorData ) ; <nl> + } ; <nl> <nl> / * ! <nl> \ ingroup jsonrpc <nl> namespace JSONRPC <nl> * / <nl> class CJSONServiceDescription : public CJSONUtils <nl> { <nl> + friend class JSONSchemaTypeDefinition ; <nl> + friend class JsonRpcMethod ; <nl> public : <nl> / * ! <nl> \ brief Parses the given json schema description and evaluates <nl> namespace JSONRPC <nl> \ param jsonType json schema description to parse <nl> \ return True if the json schema description has been parsed sucessfully otherwise false <nl> * / <nl> - static bool AddType ( std : : string jsonType ) ; <nl> + static bool AddType ( const std : : string & jsonType ) ; <nl> <nl> / * ! <nl> \ brief Parses the given json schema description and evaluates <nl> namespace JSONRPC <nl> \ param method pointer to the implementation <nl> \ return True if the json schema description has been parsed sucessfully otherwise false <nl> * / <nl> - static bool AddMethod ( std : : string jsonMethod , MethodCall method ) ; <nl> + static bool AddMethod ( const std : : string & jsonMethod , MethodCall method ) ; <nl> <nl> / * ! <nl> \ brief Parses the given json schema description and evaluates <nl> namespace JSONRPC <nl> \ param jsonMethod json schema description to parse <nl> \ return True if the json schema description has been parsed sucessfully otherwise false <nl> * / <nl> - static bool AddBuiltinMethod ( std : : string jsonMethod ) ; <nl> + static bool AddBuiltinMethod ( const std : : string & jsonMethod ) ; <nl> <nl> / * ! <nl> \ brief Parses the given json schema description and evaluates <nl> namespace JSONRPC <nl> \ param jsonNotification json schema description to parse <nl> \ return True if the json schema description has been parsed sucessfully otherwise false <nl> * / <nl> - static bool AddNotification ( std : : string jsonNotification ) ; <nl> + static bool AddNotification ( const std : : string & jsonNotification ) ; <nl> + <nl> + static bool AddEnum ( const std : : string & name , const std : : vector < CVariant > & values , CVariant : : VariantType type = CVariant : : VariantTypeNull , const CVariant & defaultValue = CVariant : : ConstNullVariant ) ; <nl> + static bool AddEnum ( const std : : string & name , const std : : vector < std : : string > & values ) ; <nl> + static bool AddEnum ( const std : : string & name , const std : : vector < int > & values ) ; <nl> <nl> / * ! <nl> \ brief Gets the version of the json <nl> namespace JSONRPC <nl> \ param printMetadata Whether to print XBMC specific data or not <nl> \ param filterByTransport Whether to filter by transport or not <nl> * / <nl> - static JSONRPC_STATUS Print ( CVariant & result , ITransportLayer * transport , IClient * client , bool printDescriptions = true , bool printMetadata = false , bool filterByTransport = true , std : : string filterByName = " " , std : : string filterByType = " " , bool printReferences = true ) ; <nl> + static JSONRPC_STATUS Print ( CVariant & result , ITransportLayer * transport , IClient * client , bool printDescriptions = true , bool printMetadata = false , bool filterByTransport = true , const std : : string & filterByName = " " , const std : : string & filterByType = " " , bool printReferences = true ) ; <nl> <nl> / * ! <nl> \ brief Checks the given parameters from the request against the <nl> namespace JSONRPC <nl> actual C / C + + implementation of the method to the " methodCall " parameter and checks the <nl> given parameters from the request against the json schema description for the given method . <nl> * / <nl> - static JSONRPC_STATUS CheckCall ( const char * const method , const CVariant & requestParameters , ITransportLayer * transport , IClient * client , bool notification , MethodCall & methodCall , CVariant & outputParameters ) ; <nl> + static JSONRPC_STATUS CheckCall ( const char * method , const CVariant & requestParameters , ITransportLayer * transport , IClient * client , bool notification , MethodCall & methodCall , CVariant & outputParameters ) ; <nl> + <nl> + static JSONSchemaTypeDefinition * GetType ( const std : : string & identification ) ; <nl> <nl> private : <nl> static bool prepareDescription ( std : : string & description , CVariant & descriptionObject , std : : string & name ) ; <nl> - static bool addMethod ( std : : string & jsonMethod , MethodCall method ) ; <nl> - static void printType ( const JSONSchemaTypeDefinition & type , bool isParameter , bool isGlobal , bool printDefault , bool printDescriptions , CVariant & output ) ; <nl> - static JSONRPC_STATUS checkParameter ( const CVariant & requestParameters , const JSONSchemaTypeDefinition & type , unsigned int position , CVariant & outputParameters , unsigned int & handled , CVariant & errorData ) ; <nl> - static JSONRPC_STATUS checkType ( const CVariant & value , const JSONSchemaTypeDefinition & type , CVariant & outputValue , CVariant & errorData ) ; <nl> + static bool addMethod ( const std : : string & jsonMethod , MethodCall method ) ; <nl> static void parseHeader ( const CVariant & descriptionObject ) ; <nl> - static bool parseMethod ( const CVariant & value , JsonRpcMethod & method ) ; <nl> - static bool parseParameter ( CVariant & value , JSONSchemaTypeDefinition & parameter ) ; <nl> - static bool parseTypeDefinition ( const CVariant & value , JSONSchemaTypeDefinition & type , bool isParameter ) ; <nl> - static void parseReturn ( const CVariant & value , JSONSchemaTypeDefinition & returns ) ; <nl> - static JSONSchemaType parseJSONSchemaType ( const CVariant & value , std : : vector < JSONSchemaTypeDefinition > & typeDefinitions ) ; <nl> - static void addReferenceTypeDefinition ( JSONSchemaTypeDefinition & typeDefinition ) ; <nl> + static bool parseJSONSchemaType ( const CVariant & value , std : : vector < JSONSchemaTypeDefinition > & typeDefinitions , JSONSchemaType & schemaType , std : : string & missingReference ) ; <nl> + static void addReferenceTypeDefinition ( const JSONSchemaTypeDefinition & typeDefinition ) ; <nl> <nl> static void getReferencedTypes ( const JSONSchemaTypeDefinition & type , std : : vector < std : : string > & referencedTypes ) ; <nl> <nl> namespace JSONRPC <nl> static std : : map < std : : string , JSONSchemaTypeDefinition > m_types ; <nl> static std : : map < std : : string , CVariant > m_notifications ; <nl> static JsonRpcMethodMap m_methodMaps [ ] ; <nl> + <nl> + typedef enum SchemaDefinition <nl> + { <nl> + SchemaDefinitionType , <nl> + SchemaDefinitionMethod <nl> + } SchemaDefinition ; <nl> + <nl> + typedef struct IncompleteSchemaDefinition <nl> + { <nl> + std : : string Schema ; <nl> + SchemaDefinition Type ; <nl> + MethodCall Method ; <nl> + } IncompleteSchemaDefinition ; <nl> + <nl> + typedef std : : map < std : : string , std : : vector < IncompleteSchemaDefinition > > IncompleteSchemaDefinitionMap ; <nl> + static IncompleteSchemaDefinitionMap m_incompleteDefinitions ; <nl> } ; <nl> } <nl> mmm a / xbmc / utils / Variant . h <nl> ppp b / xbmc / utils / Variant . h <nl> class CVariant <nl> <nl> bool isMember ( const std : : string & key ) const ; <nl> <nl> + static CVariant ConstNullVariant ; <nl> + <nl> private : <nl> union VariantUnion <nl> { <nl> class CVariant <nl> std : : string m_string ; <nl> VariantArray m_array ; <nl> VariantMap m_map ; <nl> - <nl> - static CVariant ConstNullVariant ; <nl> } ; <nl>
|
Merge pull request from Montellese / jsonrpc_runtime_enums
|
xbmc/xbmc
|
980e06a3ed6589b65c21a2208373f813ca38ae1d
|
2012-05-08T07:13:55Z
|
mmm a / lib / SILGen / SILGenApply . cpp <nl> ppp b / lib / SILGen / SILGenApply . cpp <nl> namespace { <nl> SILParameterInfo param ) { <nl> / / If we ' re bridging a concrete type to ` id ` via Any , skip the Any <nl> / / boxing . <nl> + <nl> / / TODO : Generalize . Similarly , when bridging from NSFoo - > Foo - > NSFoo , <nl> / / we should elide the bridge altogether and pass the original object . <nl> auto paramObjTy = param . getType ( ) ; <nl> namespace { <nl> origParamType , param ) ; <nl> <nl> return SGF . emitNativeToBridgedValue ( emitted . loc , <nl> - std : : move ( emitted . value ) . getScalarValue ( ) , <nl> - Rep , param . getType ( ) ) ; <nl> - <nl> + std : : move ( emitted . value ) . getAsSingleValue ( SGF , emitted . loc ) , <nl> + Rep , param . getType ( ) ) ; <nl> } <nl> <nl> enum class ExistentialPeepholeOptionality { <nl> namespace { <nl> AbstractionPattern origParamType , <nl> SILParameterInfo param ) { <nl> auto origArgExpr = argExpr ; <nl> - ( void ) origArgExpr ; <nl> / / Look through existential erasures . <nl> ExistentialPeepholeOptionality optionality ; <nl> std : : tie ( argExpr , optionality ) = lookThroughExistentialErasures ( argExpr ) ; <nl> <nl> + / / TODO : Only do the peephole for trivially - lowered types , since we <nl> + / / unfortunately don ' t plumb formal types through <nl> + / / emitNativeToBridgedValue , so can ' t correctly construct the <nl> + / / substitution for the call to _bridgeAnythingToObjectiveC for function <nl> + / / or metatype values . <nl> + if ( ! argExpr - > getType ( ) - > isLegalSILType ( ) ) { <nl> + argExpr = origArgExpr ; <nl> + optionality = ExistentialPeepholeOptionality : : Nonoptional ; <nl> + } <nl> + <nl> / / Emit the argument . <nl> auto contexts = getRValueEmissionContexts ( loweredSubstArgType , param ) ; <nl> ManagedValue emittedArg = SGF . emitRValue ( argExpr , contexts . ForEmission ) <nl> - . getScalarValue ( ) ; <nl> + . getAsSingleValue ( SGF , argExpr ) ; <nl> <nl> / / Early exit if we already exactly match the parameter type . <nl> if ( emittedArg . getType ( ) = = param . getSILType ( ) ) { <nl> mmm a / test / SILGen / objc_bridging_any . swift <nl> ppp b / test / SILGen / objc_bridging_any . swift <nl> func passingToId < T : CP , U > ( receiver : NSIdLover , <nl> receiver . takesId ( optionalC ) <nl> <nl> / / TODO : Property and subscript setters <nl> + <nl> + } <nl> + <nl> + / / Workaround for rdar : / / problem / 28318984 . Skip the peephole for types with <nl> + / / nontrivial SIL lowerings because we don ' t correctly form the substitutions <nl> + / / for a generic _bridgeAnythingToObjectiveC call . <nl> + func zim ( ) { } <nl> + struct Zang { } <nl> + / / CHECK - LABEL : sil hidden @ _TF17objc_bridging_any27typesWithNontrivialLoweringFT8receiverCSo9NSIdLover_T_ <nl> + func typesWithNontrivialLowering ( receiver : NSIdLover ) { <nl> + / / CHECK : init_existential_addr { { % . * } } : $ * Any , $ ( ) - > ( ) <nl> + receiver . takesId ( zim ) <nl> + / / CHECK : init_existential_addr { { % . * } } : $ * Any , $ Zang . Type <nl> + receiver . takesId ( Zang . self ) <nl> + / / CHECK : init_existential_addr { { % . * } } : $ * Any , $ ( ( ) - > ( ) , Zang . Type ) <nl> + receiver . takesId ( ( zim , Zang . self ) ) <nl> + / / CHECK : apply { { % . * } } < ( Int , String ) > <nl> + receiver . takesId ( ( 0 , " one " ) ) <nl> } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF17objc_bridging_any19passingToNullableId <nl>
|
SILGen : Skip the value - to - id peephole for types with nontrivial SIL lowering .
|
apple/swift
|
cf5134ad6f1c1a9bdc61a0460fe9329d06fc18f2
|
2016-11-02T01:19:07Z
|
mmm a / stdlib / public / core / Bool . swift <nl> ppp b / stdlib / public / core / Bool . swift <nl> extension Bool { <nl> / / / - Parameters : <nl> / / / - lhs : The left - hand side of the operation . <nl> / / / - rhs : The right - hand side of the operation . <nl> + @ _transparent <nl> @ inline ( __always ) <nl> public static func & & ( lhs : Bool , rhs : @ autoclosure ( ) throws - > Bool ) rethrows <nl> - > Bool { <nl> extension Bool { <nl> / / / - Parameters : <nl> / / / - lhs : The left - hand side of the operation . <nl> / / / - rhs : The right - hand side of the operation . <nl> + @ _transparent <nl> @ inline ( __always ) <nl> public static func | | ( lhs : Bool , rhs : @ autoclosure ( ) throws - > Bool ) rethrows <nl> - > Bool { <nl>
|
Boolean | | and & & operators should be declared as @ _transparent .
|
apple/swift
|
e155caedd365f2a9320d8faa0fe7e3e6abcef0ce
|
2016-08-02T01:10:34Z
|
mmm a / test / IRGen / objc . swift <nl> ppp b / test / IRGen / objc . swift <nl> class WeakObjC { <nl> / / CHECK : metadata ! { i32 1 , metadata ! " Swift Version " , i32 2 } <nl> / / CHECK : metadata ! { i32 1 , metadata ! " Objective - C Image Info Version " , i32 0 } <nl> / / CHECK : metadata ! { i32 1 , metadata ! " Objective - C Image Info Section " , metadata ! " __DATA , __objc_imageinfo , regular , no_dead_strip " } <nl> - / / 256 = = ( 1 < < 8 ) . 1 is the Swift ABI version . <nl> - / / CHECK : metadata ! { i32 4 , metadata ! " Objective - C Garbage Collection " , i32 256 } <nl> + / / 512 = = ( 2 < < 8 ) . 1 is the Swift ABI version . <nl> + / / CHECK : metadata ! { i32 4 , metadata ! " Objective - C Garbage Collection " , i32 512 } <nl>
|
Update test for ABI version . Not certain why testing did not catch this before .
|
apple/swift
|
5e607b5e13e408af531dc603eb24cd0f3a39037e
|
2014-09-10T23:15:40Z
|
mmm a / Android / MMKV / mmkvdemo / build . gradle <nl> ppp b / Android / MMKV / mmkvdemo / build . gradle <nl> android { <nl> } <nl> <nl> repositories { <nl> - / / maven { <nl> - / / url uri ( ' / tmp / localmvn / ' ) <nl> - / / url " http : / / maven . oa . com / nexus / content / repositories / thirdparty " <nl> - / / url " http : / / maven . oa . com / nexus / content / repositories / thirdparty - snapshots " <nl> - / / url " https : / / dl . bintray . com / wemobiledev / maven " <nl> - / / } <nl> jcenter ( ) <nl> mavenCentral ( ) <nl> / / mavenLocal ( ) <nl> mmm a / flutter / example / ios / Podfile . lock <nl> ppp b / flutter / example / ios / Podfile . lock <nl> <nl> PODS : <nl> - Flutter ( 1 . 0 . 0 ) <nl> - - MMKV ( 1 . 2 . 6 ) : <nl> - - MMKVCore ( ~ > 1 . 2 . 6 ) <nl> - - MMKVCore ( 1 . 2 . 6 ) <nl> - - mmkvflutter ( 1 . 2 . 6 ) : <nl> + - MMKV ( 1 . 2 . 7 ) : <nl> + - MMKVCore ( ~ > 1 . 2 . 7 ) <nl> + - MMKVCore ( 1 . 2 . 7 ) <nl> + - mmkvflutter ( 1 . 2 . 8 ) : <nl> - Flutter <nl> - - MMKV ( > = 1 . 2 . 6 ) <nl> + - MMKV ( > = 1 . 2 . 7 ) <nl> - path_provider ( 0 . 0 . 1 ) : <nl> - Flutter <nl> <nl> EXTERNAL SOURCES : <nl> <nl> SPEC CHECKSUMS : <nl> Flutter : 0e3d915762c693b495b44d77113d4970485de6ec <nl> - MMKV : 27f6b9e34849e77e78c5a1cc8f7f513e37f5fa15 <nl> - MMKVCore : c301b04fd2ab9957e6e4d4465b9b60e443b0bb6b <nl> - mmkvflutter : 65612ee6250669d8d5715246c07662a6033529a7 <nl> + MMKV : 22e5136f7d00197bc0fc9694b7f71519f0d1ca12 <nl> + MMKVCore : 607b7b05f2c2140056b5d338e45f2c14bf3f4232 <nl> + mmkvflutter : 2c306eaf1d620dc7c6ad06265e085b4a8f4c9d0a <nl> path_provider : abfe2b5c733d04e238b0d8691db0cfd63a27a93c <nl> <nl> PODFILE CHECKSUM : 56a04502099a98f6f9fd2c6f8055159cd69b1375 <nl> mmm a / flutter / example / pubspec . lock <nl> ppp b / flutter / example / pubspec . lock <nl> packages : <nl> path : " . . " <nl> relative : true <nl> source : path <nl> - version : " 1 . 2 . 7 " <nl> + version : " 1 . 2 . 8 " <nl> path : <nl> dependency : transitive <nl> description : <nl> mmm a / flutter / mmkv . iml <nl> ppp b / flutter / mmkv . iml <nl> <nl> < excludeFolder url = " file : / / $ MODULE_DIR $ / example / ios / . symlinks / plugins / mmkv / . dart_tool " / > <nl> < excludeFolder url = " file : / / $ MODULE_DIR $ / example / ios / . symlinks / plugins / mmkv / . pub " / > <nl> < excludeFolder url = " file : / / $ MODULE_DIR $ / example / ios / . symlinks / plugins / mmkv / build " / > <nl> + < excludeFolder url = " file : / / $ MODULE_DIR $ / example / ios / . symlinks / plugins / mmkvflutter / . dart_tool " / > <nl> + < excludeFolder url = " file : / / $ MODULE_DIR $ / example / ios / . symlinks / plugins / mmkvflutter / . pub " / > <nl> + < excludeFolder url = " file : / / $ MODULE_DIR $ / example / ios / . symlinks / plugins / mmkvflutter / build " / > <nl> < / content > <nl> < orderEntry type = " sourceFolder " forTests = " false " / > <nl> < orderEntry type = " library " name = " Dart SDK " level = " project " / > <nl> < orderEntry type = " library " name = " Flutter Plugins " level = " project " / > <nl> < / component > <nl> - < / module > <nl> + < / module > <nl> \ No newline at end of file <nl>
|
Merge pull request from Tencent / dev
|
Tencent/MMKV
|
d5691933c23f0010fa6014995b2be8ccf30dc0ad
|
2020-12-25T06:54:53Z
|
new file mode 100644 <nl> index 000000000000 . . 9ab51141dc89 <nl> mmm / dev / null <nl> ppp b / validation - test / compiler_crashers / 28593 - unreachable - executed - at - swift - lib - ast - type - cpp - 3771 . swift <nl> <nl> + / / This source file is part of the Swift . org open source project <nl> + / / Copyright ( c ) 2014 - 2016 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + <nl> + / / RUN : not - - crash % target - swift - frontend % s - emit - ir <nl> + [ { _ = # keyPath ( t > w <nl>
|
[ swiftc ( 92 vs . 5314 ) ] Add crasher in swift : : Type : : transform
|
apple/swift
|
6dad55f41269ad2d863c76a8c11a423e91a06606
|
2016-12-20T09:12:57Z
|
mmm a / modules / viz / include / opencv2 / viz / widgets . hpp <nl> ppp b / modules / viz / include / opencv2 / viz / widgets . hpp <nl> namespace cv <nl> public : <nl> / * * @ brief Constructs a WCube . <nl> <nl> - @ param min_point Specifies minimum point of the bounding box . <nl> - @ param max_point Specifies maximum point of the bounding box . <nl> + @ param min_point Specifies minimum ( or maximum ) point of the bounding box . <nl> + @ param max_point Specifies maximum ( or minimum ) point of the bounding box , opposite to the first parameter . <nl> @ param wire_frame If true , cube is represented as wireframe . <nl> @ param color Color of the cube . <nl> <nl>
|
Added to description of WCube constructor
|
opencv/opencv
|
f64d8078635a44b5bb78c097598304c5db8ced50
|
2020-04-15T22:06:14Z
|
mmm a / cocos / 2d / CCActionCatmullRom . cpp <nl> ppp b / cocos / 2d / CCActionCatmullRom . cpp <nl> void PointArray : : addControlPoint ( const Vec2 & controlPoint ) <nl> _controlPoints - > push_back ( new Vec2 ( controlPoint . x , controlPoint . y ) ) ; <nl> } <nl> <nl> - void PointArray : : insertControlPoint ( Vec2 & controlPoint , ssize_t index ) <nl> + void PointArray : : insertControlPoint ( const Vec2 & controlPoint , ssize_t index ) <nl> { <nl> Vec2 * temp = new ( std : : nothrow ) Vec2 ( controlPoint . x , controlPoint . y ) ; <nl> _controlPoints - > insert ( _controlPoints - > begin ( ) + index , temp ) ; <nl> Vec2 PointArray : : getControlPointAtIndex ( ssize_t index ) <nl> return * ( _controlPoints - > at ( index ) ) ; <nl> } <nl> <nl> - void PointArray : : replaceControlPoint ( cocos2d : : Vec2 & controlPoint , ssize_t index ) <nl> + void PointArray : : replaceControlPoint ( const Vec2 & controlPoint , ssize_t index ) <nl> { <nl> Vec2 * temp = _controlPoints - > at ( index ) ; <nl> temp - > x = controlPoint . x ; <nl> void PointArray : : reverseInline ( ) <nl> } <nl> <nl> / / CatmullRom Spline formula : <nl> - Vec2 ccCardinalSplineAt ( Vec2 & p0 , Vec2 & p1 , Vec2 & p2 , Vec2 & p3 , float tension , float t ) <nl> + Vec2 ccCardinalSplineAt ( const Vec2 & p0 , const Vec2 & p1 , const Vec2 & p2 , const Vec2 & p3 , float tension , float t ) <nl> { <nl> float t2 = t * t ; <nl> float t3 = t2 * t ; <nl> Vec2 ccCardinalSplineAt ( Vec2 & p0 , Vec2 & p1 , Vec2 & p2 , Vec2 & p3 , float tension , f <nl> / * Implementation of CardinalSplineTo <nl> * / <nl> <nl> - CardinalSplineTo * CardinalSplineTo : : create ( float duration , cocos2d : : PointArray * points , float tension ) <nl> + CardinalSplineTo * CardinalSplineTo : : create ( float duration , PointArray * points , float tension ) <nl> { <nl> CardinalSplineTo * ret = new ( std : : nothrow ) CardinalSplineTo ( ) ; <nl> if ( ret ) <nl> CardinalSplineTo * CardinalSplineTo : : create ( float duration , cocos2d : : PointArray * <nl> return ret ; <nl> } <nl> <nl> - bool CardinalSplineTo : : initWithDuration ( float duration , cocos2d : : PointArray * points , float tension ) <nl> + bool CardinalSplineTo : : initWithDuration ( float duration , PointArray * points , float tension ) <nl> { <nl> CCASSERT ( points - > count ( ) > 0 , " Invalid configuration . It must at least have one control point " ) ; <nl> <nl> CardinalSplineTo : : CardinalSplineTo ( ) <nl> { <nl> } <nl> <nl> - void CardinalSplineTo : : startWithTarget ( cocos2d : : Node * target ) <nl> + void CardinalSplineTo : : startWithTarget ( Node * target ) <nl> { <nl> ActionInterval : : startWithTarget ( target ) ; <nl> <nl> void CardinalSplineTo : : update ( float time ) <nl> this - > updatePosition ( newPos ) ; <nl> } <nl> <nl> - void CardinalSplineTo : : updatePosition ( cocos2d : : Vec2 & newPos ) <nl> + void CardinalSplineTo : : updatePosition ( const Vec2 & newPos ) <nl> { <nl> _target - > setPosition ( newPos ) ; <nl> _previousPosition = newPos ; <nl> CardinalSplineTo * CardinalSplineTo : : reverse ( ) const <nl> / * CardinalSplineBy <nl> * / <nl> <nl> - CardinalSplineBy * CardinalSplineBy : : create ( float duration , cocos2d : : PointArray * points , float tension ) <nl> + CardinalSplineBy * CardinalSplineBy : : create ( float duration , PointArray * points , float tension ) <nl> { <nl> CardinalSplineBy * ret = new ( std : : nothrow ) CardinalSplineBy ( ) ; <nl> if ( ret ) <nl> CardinalSplineBy : : CardinalSplineBy ( ) : _startPosition ( 0 , 0 ) <nl> { <nl> } <nl> <nl> - void CardinalSplineBy : : updatePosition ( cocos2d : : Vec2 & newPos ) <nl> + void CardinalSplineBy : : updatePosition ( const Vec2 & newPos ) <nl> { <nl> Vec2 p = newPos + _startPosition ; <nl> _target - > setPosition ( p ) ; <nl> CardinalSplineBy * CardinalSplineBy : : reverse ( ) const <nl> return CardinalSplineBy : : create ( _duration , pReverse , _tension ) ; <nl> } <nl> <nl> - void CardinalSplineBy : : startWithTarget ( cocos2d : : Node * target ) <nl> + void CardinalSplineBy : : startWithTarget ( Node * target ) <nl> { <nl> CardinalSplineTo : : startWithTarget ( target ) ; <nl> _startPosition = target - > getPosition ( ) ; <nl> CardinalSplineBy * CardinalSplineBy : : clone ( ) const <nl> / * CatmullRomTo <nl> * / <nl> <nl> - CatmullRomTo * CatmullRomTo : : create ( float dt , cocos2d : : PointArray * points ) <nl> + CatmullRomTo * CatmullRomTo : : create ( float dt , PointArray * points ) <nl> { <nl> CatmullRomTo * ret = new ( std : : nothrow ) CatmullRomTo ( ) ; <nl> if ( ret ) <nl> CatmullRomTo * CatmullRomTo : : create ( float dt , cocos2d : : PointArray * points ) <nl> return ret ; <nl> } <nl> <nl> - bool CatmullRomTo : : initWithDuration ( float dt , cocos2d : : PointArray * points ) <nl> + bool CatmullRomTo : : initWithDuration ( float dt , PointArray * points ) <nl> { <nl> if ( CardinalSplineTo : : initWithDuration ( dt , points , 0 . 5f ) ) <nl> { <nl> CatmullRomTo * CatmullRomTo : : reverse ( ) const <nl> / * CatmullRomBy <nl> * / <nl> <nl> - CatmullRomBy * CatmullRomBy : : create ( float dt , cocos2d : : PointArray * points ) <nl> + CatmullRomBy * CatmullRomBy : : create ( float dt , PointArray * points ) <nl> { <nl> CatmullRomBy * ret = new ( std : : nothrow ) CatmullRomBy ( ) ; <nl> if ( ret ) <nl> CatmullRomBy * CatmullRomBy : : create ( float dt , cocos2d : : PointArray * points ) <nl> return ret ; <nl> } <nl> <nl> - bool CatmullRomBy : : initWithDuration ( float dt , cocos2d : : PointArray * points ) <nl> + bool CatmullRomBy : : initWithDuration ( float dt , PointArray * points ) <nl> { <nl> if ( CardinalSplineTo : : initWithDuration ( dt , points , 0 . 5f ) ) <nl> { <nl> mmm a / cocos / 2d / CCActionCatmullRom . h <nl> ppp b / cocos / 2d / CCActionCatmullRom . h <nl> class CC_DLL PointArray : public Ref , public Clonable <nl> * @ param controlPoint A control point . <nl> * @ param index Insert the point to array in index . <nl> * / <nl> - void insertControlPoint ( Vec2 & controlPoint , ssize_t index ) ; <nl> + void insertControlPoint ( const Vec2 & controlPoint , ssize_t index ) ; <nl> <nl> / * * Replaces an existing controlPoint at index . <nl> * <nl> class CC_DLL PointArray : public Ref , public Clonable <nl> * @ param controlPoint A control point . <nl> * @ param index Replace the point to array in index . <nl> * / <nl> - void replaceControlPoint ( Vec2 & controlPoint , ssize_t index ) ; <nl> + void replaceControlPoint ( const Vec2 & controlPoint , ssize_t index ) ; <nl> <nl> / * * Get the value of a controlPoint at a given index . <nl> * <nl> class CC_DLL CardinalSplineTo : public ActionInterval <nl> * <nl> * @ param newPos The new position . <nl> * / <nl> - virtual void updatePosition ( Vec2 & newPos ) ; <nl> + virtual void updatePosition ( const Vec2 & newPos ) ; <nl> / * * Return a PointArray . <nl> * <nl> * @ return A PointArray . <nl> class CC_DLL CardinalSplineBy : public CardinalSplineTo <nl> <nl> / / Overrides <nl> virtual void startWithTarget ( Node * target ) override ; <nl> - virtual void updatePosition ( Vec2 & newPos ) override ; <nl> + virtual void updatePosition ( const Vec2 & newPos ) override ; <nl> virtual CardinalSplineBy * clone ( ) const override ; <nl> virtual CardinalSplineBy * reverse ( ) const override ; <nl> <nl> class CC_DLL CatmullRomBy : public CardinalSplineBy <nl> } ; <nl> <nl> / * * Returns the Cardinal Spline position for a given set of control points , tension and time * / <nl> - extern CC_DLL Vec2 ccCardinalSplineAt ( Vec2 & p0 , Vec2 & p1 , Vec2 & p2 , Vec2 & p3 , float tension , float t ) ; <nl> + extern CC_DLL Vec2 ccCardinalSplineAt ( const Vec2 & p0 , const Vec2 & p1 , const Vec2 & p2 , const Vec2 & p3 , float tension , float t ) ; <nl> <nl> / / end of actions group <nl> / / / @ } <nl>
|
Use const reference where possible . Dropped unnecessary namespace specifier ( )
|
cocos2d/cocos2d-x
|
a23924c95b8fb424050097df27a02c4fb0aeb790
|
2017-06-20T01:03:35Z
|
mmm a / private <nl> ppp b / private <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit 27aa9e91c23fab09b5f27174be89cd09f975aaa7 <nl> + Subproject commit 85feb681b57ec10809e0da5d70b1824a9eef00dd <nl>
|
Updated submodule [ # METR - 21501 ] .
|
ClickHouse/ClickHouse
|
62867ee0f35bb5d0394e4aef69180098c59229a2
|
2016-06-03T18:22:33Z
|
mmm a / caffe2 / python / test / executor_test . py <nl> ppp b / caffe2 / python / test / executor_test . py <nl> <nl> run_resnet50_epoch , <nl> ExecutorTestBase ) <nl> <nl> - from hypothesis import given <nl> + from hypothesis import given , settings <nl> import hypothesis . strategies as st <nl> <nl> + from caffe2 . python import hypothesis_test_util as hu <nl> + <nl> import unittest <nl> <nl> <nl> EXECUTORS = [ " dag " , " async_dag " ] <nl> ITERATIONS = 2 <nl> + SANDCASTLE_MAX_EXAMPLES = 2 <nl> + SANDCASTLE_TIMEOUT = 600 <nl> + <nl> + <nl> + def sandcastle_settings ( func ) : <nl> + if hu . is_sandcastle ( ) : <nl> + return settings ( <nl> + max_examples = SANDCASTLE_MAX_EXAMPLES , <nl> + timeout = SANDCASTLE_TIMEOUT <nl> + ) ( func ) <nl> + else : <nl> + return func <nl> <nl> <nl> class ExecutorCPUConvNetTest ( ExecutorTestBase ) : <nl> class ExecutorCPUConvNetTest ( ExecutorTestBase ) : <nl> model_name = st . sampled_from ( conv_model_generators ( ) . keys ( ) ) , <nl> batch_size = st . sampled_from ( [ 8 ] ) , <nl> num_workers = st . sampled_from ( [ 8 ] ) ) <nl> + @ sandcastle_settings <nl> def test_executor ( self , executor , model_name , batch_size , num_workers ) : <nl> model = build_conv_model ( model_name , batch_size ) <nl> model . Proto ( ) . num_workers = num_workers <nl> def run_model ( ) : <nl> class ExecutorGPUResNetTest ( ExecutorTestBase ) : <nl> @ given ( executor = st . sampled_from ( EXECUTORS ) , <nl> num_workers = st . sampled_from ( [ 8 ] ) ) <nl> + @ sandcastle_settings <nl> def test_executor ( self , executor , num_workers ) : <nl> model = build_resnet50_dataparallel_model ( <nl> num_gpus = workspace . NumCudaDevices ( ) , batch_size = 32 , epoch_size = 32 ) <nl>
|
Adjust test thresholds
|
pytorch/pytorch
|
1f3424b78f6258c1a00f1b32427ad5f775a7add8
|
2017-10-02T19:59:20Z
|
mmm a / xbmc / cores / RetroPlayer / RetroPlayer . cpp <nl> ppp b / xbmc / cores / RetroPlayer / RetroPlayer . cpp <nl> using namespace KODI ; <nl> using namespace GAME ; <nl> using namespace RETRO ; <nl> <nl> - CRetroPlayer : : CRetroPlayer ( IPlayerCallback & callback ) : <nl> - IPlayer ( callback ) , <nl> - m_gameServices ( CServiceBroker : : GetGameServices ( ) ) <nl> + CRetroPlayer : : CRetroPlayer ( IPlayerCallback & callback ) <nl> + : IPlayer ( callback ) , m_gameServices ( CServiceBroker : : GetGameServices ( ) ) <nl> { <nl> ResetPlayback ( ) ; <nl> CServiceBroker : : GetWinSystem ( ) - > RegisterRenderLoop ( this ) ; <nl> bool CRetroPlayer : : OpenFile ( const CFileItem & file , const CPlayerOptions & options <nl> / / Currently this may prompt the user , the goal is to figure this out silently <nl> if ( ! GAME : : CGameUtils : : FillInGameClient ( fileCopy , true ) ) <nl> { <nl> - CLog : : Log ( LOGINFO , " RetroPlayer [ PLAYER ] : No compatible game client selected , aborting playback " ) ; <nl> + CLog : : Log ( LOGINFO , <nl> + " RetroPlayer [ PLAYER ] : No compatible game client selected , aborting playback " ) ; <nl> return false ; <nl> } <nl> <nl> bool CRetroPlayer : : OpenFile ( const CFileItem & file , const CPlayerOptions & options <nl> } <nl> else if ( ! CServiceBroker : : GetAddonMgr ( ) . GetAddon ( gameClientId , addon , ADDON : : ADDON_GAMEDLL ) ) <nl> { <nl> - CLog : : Log ( LOGERROR , " RetroPlayer [ PLAYER ] : Can ' t find add - on % s for game file ! " , gameClientId . c_str ( ) ) ; <nl> + CLog : : Log ( LOGERROR , " RetroPlayer [ PLAYER ] : Can ' t find add - on % s for game file ! " , <nl> + gameClientId . c_str ( ) ) ; <nl> } <nl> else <nl> { <nl> bool CRetroPlayer : : OpenFile ( const CFileItem & file , const CPlayerOptions & options <nl> if ( bSuccess ) <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : Using game client % s " , gameClientId . c_str ( ) ) ; <nl> else <nl> - CLog : : Log ( LOGERROR , " RetroPlayer [ PLAYER ] : Failed to open file using % s " , gameClientId . c_str ( ) ) ; <nl> + CLog : : Log ( LOGERROR , " RetroPlayer [ PLAYER ] : Failed to open file using % s " , <nl> + gameClientId . c_str ( ) ) ; <nl> } <nl> else <nl> CLog : : Log ( LOGERROR , " RetroPlayer [ PLAYER ] : Failed to initialize % s " , gameClientId . c_str ( ) ) ; <nl> bool CRetroPlayer : : OpenFile ( const CFileItem & file , const CPlayerOptions & options <nl> / / Warn the user that continuing with a different game client will <nl> / / overwrite the save <nl> bool dummy ; <nl> - if ( ! CGUIDialogYesNo : : ShowAndGetInput ( 438 , StringUtils : : Format ( g_localizeStrings . Get ( 35217 ) , addon - > Name ( ) ) , dummy , 222 , 35218 , 0 ) ) <nl> + if ( ! CGUIDialogYesNo : : ShowAndGetInput ( <nl> + 438 , StringUtils : : Format ( g_localizeStrings . Get ( 35217 ) , addon - > Name ( ) ) , dummy , 222 , <nl> + 35218 , 0 ) ) <nl> bSuccess = false ; <nl> } <nl> } <nl> bool CRetroPlayer : : CloseFile ( bool reopen / * = false * / ) <nl> { <nl> std : : string savePath = m_playback - > CreateSavestate ( ) ; <nl> if ( ! savePath . empty ( ) ) <nl> - CLog : : Log ( LOGDEBUG , " RetroPlayer [ SAVE ] : Saved state to % s " , CURL : : GetRedacted ( savePath ) . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " RetroPlayer [ SAVE ] : Saved state to % s " , <nl> + CURL : : GetRedacted ( savePath ) . c_str ( ) ) ; <nl> else <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ SAVE ] : Failed to save state at close " ) ; <nl> } <nl> void CRetroPlayer : : SeekPercentage ( float fPercent / * = 0 * / ) <nl> if ( ! CanSeek ( ) ) <nl> return ; <nl> <nl> - if ( fPercent < 0 . 0f ) <nl> + if ( fPercent < 0 . 0f ) <nl> fPercent = 0 . 0f ; <nl> else if ( fPercent > 100 . 0f ) <nl> fPercent = 100 . 0f ; <nl> void CRetroPlayer : : SetSpeed ( float speed ) <nl> } <nl> } <nl> <nl> - bool CRetroPlayer : : OnAction ( const CAction & action ) <nl> + bool CRetroPlayer : : OnAction ( const CAction & action ) <nl> { <nl> switch ( action . GetID ( ) ) <nl> { <nl> - case ACTION_PLAYER_RESET : <nl> - { <nl> - if ( m_gameClient ) <nl> + case ACTION_PLAYER_RESET : <nl> { <nl> - float speed = static_cast < float > ( m_playback - > GetSpeed ( ) ) ; <nl> + if ( m_gameClient ) <nl> + { <nl> + float speed = static_cast < float > ( m_playback - > GetSpeed ( ) ) ; <nl> <nl> - m_playback - > SetSpeed ( 0 . 0 ) ; <nl> + m_playback - > SetSpeed ( 0 . 0 ) ; <nl> <nl> - CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : Sending reset command via ACTION_PLAYER_RESET " ) ; <nl> - m_gameClient - > Input ( ) . HardwareReset ( ) ; <nl> + CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : Sending reset command via ACTION_PLAYER_RESET " ) ; <nl> + m_gameClient - > Input ( ) . HardwareReset ( ) ; <nl> <nl> - / / If rewinding or paused , begin playback <nl> - if ( speed < = 0 . 0f ) <nl> - speed = 1 . 0f ; <nl> + / / If rewinding or paused , begin playback <nl> + if ( speed < = 0 . 0f ) <nl> + speed = 1 . 0f ; <nl> <nl> - SetSpeed ( speed ) ; <nl> + SetSpeed ( speed ) ; <nl> + } <nl> + return true ; <nl> } <nl> - return true ; <nl> - } <nl> - case ACTION_SHOW_OSD : <nl> - { <nl> - if ( m_gameClient ) <nl> + case ACTION_SHOW_OSD : <nl> { <nl> - CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : Closing OSD via ACTION_SHOW_OSD " ) ; <nl> - CloseOSD ( ) ; <nl> - return true ; <nl> + if ( m_gameClient ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : Closing OSD via ACTION_SHOW_OSD " ) ; <nl> + CloseOSD ( ) ; <nl> + return true ; <nl> + } <nl> } <nl> - } <nl> - default : <nl> - break ; <nl> + default : <nl> + break ; <nl> } <nl> <nl> return false ; <nl> void CRetroPlayer : : SetPlaybackSpeed ( double speed ) <nl> { <nl> if ( speed = = 1 . 0 ) <nl> { <nl> - IPlayerCallback * callback = & m_callback ; <nl> - CJobManager : : GetInstance ( ) . Submit ( [ callback ] ( ) <nl> - { <nl> - callback - > OnPlayBackResumed ( ) ; <nl> - } , CJob : : PRIORITY_NORMAL ) ; <nl> + IPlayerCallback * callback = & m_callback ; <nl> + CJobManager : : GetInstance ( ) . Submit ( [ callback ] ( ) { callback - > OnPlayBackResumed ( ) ; } , <nl> + CJob : : PRIORITY_NORMAL ) ; <nl> } <nl> else if ( speed = = 0 . 0 ) <nl> { <nl> - IPlayerCallback * callback = & m_callback ; <nl> - CJobManager : : GetInstance ( ) . Submit ( [ callback ] ( ) <nl> - { <nl> - callback - > OnPlayBackPaused ( ) ; <nl> - } , CJob : : PRIORITY_NORMAL ) ; <nl> + IPlayerCallback * callback = & m_callback ; <nl> + CJobManager : : GetInstance ( ) . Submit ( [ callback ] ( ) { callback - > OnPlayBackPaused ( ) ; } , <nl> + CJob : : PRIORITY_NORMAL ) ; <nl> } <nl> } <nl> } <nl> void CRetroPlayer : : CreatePlayback ( bool bRestoreState ) <nl> if ( m_gameClient - > RequiresGameLoop ( ) ) <nl> { <nl> m_playback - > Deinitialize ( ) ; <nl> - m_playback . reset ( new CReversiblePlayback ( m_gameClient . get ( ) , m_gameClient - > GetFrameRate ( ) , m_gameClient - > GetSerializeSize ( ) ) ) ; <nl> + m_playback . reset ( new CReversiblePlayback ( m_gameClient . get ( ) , m_gameClient - > GetFrameRate ( ) , <nl> + m_gameClient - > GetSerializeSize ( ) ) ) ; <nl> } <nl> else <nl> ResetPlayback ( ) ; <nl> void CRetroPlayer : : CloseOSD ( ) <nl> void CRetroPlayer : : RegisterWindowCallbacks ( ) <nl> { <nl> m_gameServices . GameRenderManager ( ) . RegisterPlayer ( m_renderManager - > GetGUIRenderTargetFactory ( ) , <nl> - m_renderManager . get ( ) , <nl> - this ) ; <nl> + m_renderManager . get ( ) , this ) ; <nl> } <nl> <nl> void CRetroPlayer : : UnregisterWindowCallbacks ( ) <nl> void CRetroPlayer : : UnregisterWindowCallbacks ( ) <nl> m_gameServices . GameRenderManager ( ) . UnregisterPlayer ( ) ; <nl> } <nl> <nl> - void CRetroPlayer : : PrintGameInfo ( const CFileItem & file ) const <nl> + void CRetroPlayer : : PrintGameInfo ( const CFileItem & file ) const <nl> { <nl> - const CGameInfoTag * tag = file . GetGameInfoTag ( ) ; <nl> + const CGameInfoTag * tag = file . GetGameInfoTag ( ) ; <nl> if ( tag ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm " ) ; <nl> void CRetroPlayer : : PrintGameInfo ( const CFileItem & file ) const <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : URL : % s " , tag - > GetURL ( ) . c_str ( ) ) ; <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : Title : % s " , tag - > GetTitle ( ) . c_str ( ) ) ; <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : Platform : % s " , tag - > GetPlatform ( ) . c_str ( ) ) ; <nl> - CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : Genres : % s " , StringUtils : : Join ( tag - > GetGenres ( ) , " , " ) . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : Genres : % s " , <nl> + StringUtils : : Join ( tag - > GetGenres ( ) , " , " ) . c_str ( ) ) ; <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : Developer : % s " , tag - > GetDeveloper ( ) . c_str ( ) ) ; <nl> if ( tag - > GetYear ( ) > 0 ) <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ PLAYER ] : Year : % u " , tag - > GetYear ( ) ) ; <nl> mmm a / xbmc / cores / RetroPlayer / RetroPlayer . h <nl> ppp b / xbmc / cores / RetroPlayer / RetroPlayer . h <nl> namespace KODI <nl> { <nl> namespace GAME <nl> { <nl> - class CGameServices ; <nl> + class CGameServices ; <nl> } <nl> <nl> namespace RETRO <nl> { <nl> - class CRetroPlayerInput ; <nl> - class CRPProcessInfo ; <nl> - class CRPRenderManager ; <nl> - class CRPStreamManager ; <nl> - class IPlayback ; <nl> - <nl> - class CRetroPlayer : public IPlayer , <nl> - public IRenderLoop , <nl> - public IGameCallback , <nl> - public IPlaybackCallback , <nl> - public IAutoSaveCallback <nl> - { <nl> - public : <nl> - explicit CRetroPlayer ( IPlayerCallback & callback ) ; <nl> - ~ CRetroPlayer ( ) override ; <nl> - <nl> - / / implementation of IPlayer <nl> - bool OpenFile ( const CFileItem & file , const CPlayerOptions & options ) override ; <nl> - bool CloseFile ( bool reopen = false ) override ; <nl> - bool IsPlaying ( ) const override ; <nl> - bool CanPause ( ) override ; <nl> - void Pause ( ) override ; <nl> - bool HasVideo ( ) const override { return true ; } <nl> - bool HasAudio ( ) const override { return true ; } <nl> - bool HasGame ( ) const override { return true ; } <nl> - bool CanSeek ( ) override ; <nl> - void Seek ( bool bPlus = true , bool bLargeStep = false , bool bChapterOverride = false ) override ; <nl> - void SeekPercentage ( float fPercent = 0 ) override ; <nl> - float GetCachePercentage ( ) override ; <nl> - void SetMute ( bool bOnOff ) override ; <nl> - void SeekTime ( int64_t iTime = 0 ) override ; <nl> - bool SeekTimeRelative ( int64_t iTime ) override ; <nl> - void SetSpeed ( float speed ) override ; <nl> - bool OnAction ( const CAction & action ) override ; <nl> - std : : string GetPlayerState ( ) override ; <nl> - bool SetPlayerState ( const std : : string & state ) override ; <nl> - void FrameMove ( ) override ; <nl> - void Render ( bool clear , uint32_t alpha = 255 , bool gui = true ) override ; <nl> - bool IsRenderingVideo ( ) override ; <nl> - bool HasGameAgent ( ) override ; <nl> - <nl> - / / Implementation of IGameCallback <nl> - std : : string GameClientID ( ) const override ; <nl> - <nl> - / / Implementation of IPlaybackCallback <nl> - void SetPlaybackSpeed ( double speed ) override ; <nl> - void EnableInput ( bool bEnable ) override ; <nl> - <nl> - / / Implementation of IAutoSaveCallback <nl> - bool IsAutoSaveEnabled ( ) const override ; <nl> - std : : string CreateSavestate ( ) override ; <nl> - <nl> - private : <nl> - void SetSpeedInternal ( double speed ) ; <nl> - <nl> - / * ! <nl> - * \ brief Called when the speed changes <nl> - * \ param newSpeed The new speed , possibly equal to the previous speed <nl> - * / <nl> - void OnSpeedChange ( double newSpeed ) ; <nl> - <nl> - / / Playback functions <nl> - void CreatePlayback ( bool bRestoreState ) ; <nl> - void ResetPlayback ( ) ; <nl> - <nl> - / * ! <nl> - * \ brief Opens the OSD <nl> - * / <nl> - void OpenOSD ( ) ; <nl> - <nl> - / * ! <nl> - * \ brief Closes the OSD and shows the FullscreenGame window <nl> - * / <nl> - void CloseOSD ( ) ; <nl> - <nl> - void RegisterWindowCallbacks ( ) ; <nl> - void UnregisterWindowCallbacks ( ) ; <nl> - <nl> - / * * <nl> - * \ brief Dump game information ( if any ) to the debug log . <nl> - * / <nl> - void PrintGameInfo ( const CFileItem & file ) const ; <nl> - <nl> - uint64_t GetTime ( ) ; <nl> - uint64_t GetTotalTime ( ) ; <nl> - <nl> - / / Construction parameters <nl> - GAME : : CGameServices & m_gameServices ; <nl> - <nl> - / / Subsystems <nl> - std : : unique_ptr < CRPProcessInfo > m_processInfo ; <nl> - std : : unique_ptr < CRPRenderManager > m_renderManager ; <nl> - std : : unique_ptr < CRPStreamManager > m_streamManager ; <nl> - std : : unique_ptr < CRetroPlayerInput > m_input ; <nl> - std : : unique_ptr < IPlayback > m_playback ; <nl> - std : : unique_ptr < IPlaybackControl > m_playbackControl ; <nl> - std : : unique_ptr < CRetroPlayerAutoSave > m_autoSave ; <nl> - <nl> - / / Game parameters <nl> - GAME : : GameClientPtr m_gameClient ; <nl> - <nl> - / / Synchronization parameters <nl> - CCriticalSection m_mutex ; <nl> - } ; <nl> - } <nl> - } <nl> + class CRetroPlayerInput ; <nl> + class CRPProcessInfo ; <nl> + class CRPRenderManager ; <nl> + class CRPStreamManager ; <nl> + class IPlayback ; <nl> + <nl> + class CRetroPlayer : public IPlayer , <nl> + public IRenderLoop , <nl> + public IGameCallback , <nl> + public IPlaybackCallback , <nl> + public IAutoSaveCallback <nl> + { <nl> + public : <nl> + explicit CRetroPlayer ( IPlayerCallback & callback ) ; <nl> + ~ CRetroPlayer ( ) override ; <nl> + <nl> + / / implementation of IPlayer <nl> + bool OpenFile ( const CFileItem & file , const CPlayerOptions & options ) override ; <nl> + bool CloseFile ( bool reopen = false ) override ; <nl> + bool IsPlaying ( ) const override ; <nl> + bool CanPause ( ) override ; <nl> + void Pause ( ) override ; <nl> + bool HasVideo ( ) const override { return true ; } <nl> + bool HasAudio ( ) const override { return true ; } <nl> + bool HasGame ( ) const override { return true ; } <nl> + bool CanSeek ( ) override ; <nl> + void Seek ( bool bPlus = true , bool bLargeStep = false , bool bChapterOverride = false ) override ; <nl> + void SeekPercentage ( float fPercent = 0 ) override ; <nl> + float GetCachePercentage ( ) override ; <nl> + void SetMute ( bool bOnOff ) override ; <nl> + void SeekTime ( int64_t iTime = 0 ) override ; <nl> + bool SeekTimeRelative ( int64_t iTime ) override ; <nl> + void SetSpeed ( float speed ) override ; <nl> + bool OnAction ( const CAction & action ) override ; <nl> + std : : string GetPlayerState ( ) override ; <nl> + bool SetPlayerState ( const std : : string & state ) override ; <nl> + void FrameMove ( ) override ; <nl> + void Render ( bool clear , uint32_t alpha = 255 , bool gui = true ) override ; <nl> + bool IsRenderingVideo ( ) override ; <nl> + bool HasGameAgent ( ) override ; <nl> + <nl> + / / Implementation of IGameCallback <nl> + std : : string GameClientID ( ) const override ; <nl> + <nl> + / / Implementation of IPlaybackCallback <nl> + void SetPlaybackSpeed ( double speed ) override ; <nl> + void EnableInput ( bool bEnable ) override ; <nl> + <nl> + / / Implementation of IAutoSaveCallback <nl> + bool IsAutoSaveEnabled ( ) const override ; <nl> + std : : string CreateSavestate ( ) override ; <nl> + <nl> + private : <nl> + void SetSpeedInternal ( double speed ) ; <nl> + <nl> + / * ! <nl> + * \ brief Called when the speed changes <nl> + * \ param newSpeed The new speed , possibly equal to the previous speed <nl> + * / <nl> + void OnSpeedChange ( double newSpeed ) ; <nl> + <nl> + / / Playback functions <nl> + void CreatePlayback ( bool bRestoreState ) ; <nl> + void ResetPlayback ( ) ; <nl> + <nl> + / * ! <nl> + * \ brief Opens the OSD <nl> + * / <nl> + void OpenOSD ( ) ; <nl> + <nl> + / * ! <nl> + * \ brief Closes the OSD and shows the FullscreenGame window <nl> + * / <nl> + void CloseOSD ( ) ; <nl> + <nl> + void RegisterWindowCallbacks ( ) ; <nl> + void UnregisterWindowCallbacks ( ) ; <nl> + <nl> + / * * <nl> + * \ brief Dump game information ( if any ) to the debug log . <nl> + * / <nl> + void PrintGameInfo ( const CFileItem & file ) const ; <nl> + <nl> + uint64_t GetTime ( ) ; <nl> + uint64_t GetTotalTime ( ) ; <nl> + <nl> + / / Construction parameters <nl> + GAME : : CGameServices & m_gameServices ; <nl> + <nl> + / / Subsystems <nl> + std : : unique_ptr < CRPProcessInfo > m_processInfo ; <nl> + std : : unique_ptr < CRPRenderManager > m_renderManager ; <nl> + std : : unique_ptr < CRPStreamManager > m_streamManager ; <nl> + std : : unique_ptr < CRetroPlayerInput > m_input ; <nl> + std : : unique_ptr < IPlayback > m_playback ; <nl> + std : : unique_ptr < IPlaybackControl > m_playbackControl ; <nl> + std : : unique_ptr < CRetroPlayerAutoSave > m_autoSave ; <nl> + <nl> + / / Game parameters <nl> + GAME : : GameClientPtr m_gameClient ; <nl> + <nl> + / / Synchronization parameters <nl> + CCriticalSection m_mutex ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / RetroPlayerAutoSave . cpp <nl> ppp b / xbmc / cores / RetroPlayer / RetroPlayerAutoSave . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - # define AUTOSAVE_DURATION_SECS 10 / / Auto - save every 10 seconds <nl> + # define AUTOSAVE_DURATION_SECS 10 / / Auto - save every 10 seconds <nl> <nl> - CRetroPlayerAutoSave : : CRetroPlayerAutoSave ( IAutoSaveCallback & callback , <nl> - GAME : : CGameSettings & settings ) : <nl> - CThread ( " CRetroPlayerAutoSave " ) , <nl> - m_callback ( callback ) , <nl> - m_settings ( settings ) <nl> + CRetroPlayerAutoSave : : CRetroPlayerAutoSave ( IAutoSaveCallback & callback , <nl> + GAME : : CGameSettings & settings ) <nl> + : CThread ( " CRetroPlayerAutoSave " ) , m_callback ( callback ) , m_settings ( settings ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ SAVE ] : Initializing autosave " ) ; <nl> <nl> void CRetroPlayerAutoSave : : Process ( ) <nl> { <nl> std : : string savePath = m_callback . CreateSavestate ( ) ; <nl> if ( ! savePath . empty ( ) ) <nl> - CLog : : Log ( LOGDEBUG , " RetroPlayer [ SAVE ] : Saved state to % s " , CURL : : GetRedacted ( savePath ) . c_str ( ) ) ; <nl> + CLog : : Log ( LOGDEBUG , " RetroPlayer [ SAVE ] : Saved state to % s " , <nl> + CURL : : GetRedacted ( savePath ) . c_str ( ) ) ; <nl> } <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / RetroPlayerAutoSave . h <nl> ppp b / xbmc / cores / RetroPlayer / RetroPlayerAutoSave . h <nl> namespace KODI <nl> { <nl> namespace GAME <nl> { <nl> - class CGameClient ; <nl> - class CGameSettings ; <nl> - } <nl> + class CGameClient ; <nl> + class CGameSettings ; <nl> + } / / namespace GAME <nl> <nl> namespace RETRO <nl> { <nl> - class IAutoSaveCallback <nl> - { <nl> - public : <nl> - virtual ~ IAutoSaveCallback ( ) = default ; <nl> - <nl> - virtual bool IsAutoSaveEnabled ( ) const = 0 ; <nl> - virtual std : : string CreateSavestate ( ) = 0 ; <nl> - } ; <nl> - <nl> - class CRetroPlayerAutoSave : protected CThread <nl> - { <nl> - public : <nl> - explicit CRetroPlayerAutoSave ( IAutoSaveCallback & callback , <nl> - GAME : : CGameSettings & settings ) ; <nl> - <nl> - ~ CRetroPlayerAutoSave ( ) override ; <nl> - <nl> - protected : <nl> - / / implementation of CThread <nl> - void Process ( ) override ; <nl> - <nl> - private : <nl> - / / Construction parameters <nl> - IAutoSaveCallback & m_callback ; <nl> - GAME : : CGameSettings & m_settings ; <nl> - } ; <nl> - } <nl> - } <nl> + class IAutoSaveCallback <nl> + { <nl> + public : <nl> + virtual ~ IAutoSaveCallback ( ) = default ; <nl> + <nl> + virtual bool IsAutoSaveEnabled ( ) const = 0 ; <nl> + virtual std : : string CreateSavestate ( ) = 0 ; <nl> + } ; <nl> + <nl> + class CRetroPlayerAutoSave : protected CThread <nl> + { <nl> + public : <nl> + explicit CRetroPlayerAutoSave ( IAutoSaveCallback & callback , GAME : : CGameSettings & settings ) ; <nl> + <nl> + ~ CRetroPlayerAutoSave ( ) override ; <nl> + <nl> + protected : <nl> + / / implementation of CThread <nl> + void Process ( ) override ; <nl> + <nl> + private : <nl> + / / Construction parameters <nl> + IAutoSaveCallback & m_callback ; <nl> + GAME : : CGameSettings & m_settings ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / RetroPlayerDefines . h <nl> ppp b / xbmc / cores / RetroPlayer / RetroPlayerDefines . h <nl> <nl> <nl> # pragma once <nl> <nl> - # define GAME_STREAM_VIDEO_ID 1 <nl> - # define GAME_STREAM_AUDIO_ID 2 <nl> + # define GAME_STREAM_VIDEO_ID 1 <nl> + # define GAME_STREAM_AUDIO_ID 2 <nl> mmm a / xbmc / cores / RetroPlayer / RetroPlayerInput . cpp <nl> ppp b / xbmc / cores / RetroPlayer / RetroPlayerInput . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRetroPlayerInput : : CRetroPlayerInput ( PERIPHERALS : : CPeripherals & peripheralManager ) : <nl> - m_peripheralManager ( peripheralManager ) <nl> + CRetroPlayerInput : : CRetroPlayerInput ( PERIPHERALS : : CPeripherals & peripheralManager ) <nl> + : m_peripheralManager ( peripheralManager ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ INPUT ] : Initializing input " ) ; <nl> <nl> mmm a / xbmc / cores / RetroPlayer / RetroPlayerInput . h <nl> ppp b / xbmc / cores / RetroPlayer / RetroPlayerInput . h <nl> <nl> <nl> namespace PERIPHERALS <nl> { <nl> - class CPeripherals ; <nl> + class CPeripherals ; <nl> } <nl> <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRetroPlayerInput : public GAME : : IGameInputCallback <nl> - { <nl> - public : <nl> - CRetroPlayerInput ( PERIPHERALS : : CPeripherals & peripheralManager ) ; <nl> - ~ CRetroPlayerInput ( ) override ; <nl> - <nl> - void SetSpeed ( double speed ) ; <nl> - void EnableInput ( bool bEnabled ) ; <nl> - <nl> - / / implementation of IGameInputCallback <nl> - bool AcceptsInput ( ) const override { return m_bEnabled ; } <nl> - void PollInput ( ) override ; <nl> - <nl> - private : <nl> - / / Construction parameters <nl> - PERIPHERALS : : CPeripherals & m_peripheralManager ; <nl> - <nl> - / / Input variables <nl> - PERIPHERALS : : EventPollHandlePtr m_inputPollHandle ; <nl> - bool m_bEnabled = false ; <nl> - } ; <nl> - } <nl> - } <nl> + class CRetroPlayerInput : public GAME : : IGameInputCallback <nl> + { <nl> + public : <nl> + CRetroPlayerInput ( PERIPHERALS : : CPeripherals & peripheralManager ) ; <nl> + ~ CRetroPlayerInput ( ) override ; <nl> + <nl> + void SetSpeed ( double speed ) ; <nl> + void EnableInput ( bool bEnabled ) ; <nl> + <nl> + / / implementation of IGameInputCallback <nl> + bool AcceptsInput ( ) const override { return m_bEnabled ; } <nl> + void PollInput ( ) override ; <nl> + <nl> + private : <nl> + / / Construction parameters <nl> + PERIPHERALS : : CPeripherals & m_peripheralManager ; <nl> + <nl> + / / Input variables <nl> + PERIPHERALS : : EventPollHandlePtr m_inputPollHandle ; <nl> + bool m_bEnabled = false ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / RetroPlayerTypes . h <nl> ppp b / xbmc / cores / RetroPlayer / RetroPlayerTypes . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class IRenderBufferPool ; <nl> - using RenderBufferPoolPtr = std : : shared_ptr < IRenderBufferPool > ; <nl> - using RenderBufferPoolVector = std : : vector < RenderBufferPoolPtr > ; <nl> - } <nl> - } <nl> + class IRenderBufferPool ; <nl> + using RenderBufferPoolPtr = std : : shared_ptr < IRenderBufferPool > ; <nl> + using RenderBufferPoolVector = std : : vector < RenderBufferPoolPtr > ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / RetroPlayerUtils . cpp <nl> ppp b / xbmc / cores / RetroPlayer / RetroPlayerUtils . cpp <nl> const char * CRetroPlayerUtils : : StretchModeToIdentifier ( STRETCHMODE stretchMode ) <nl> return " " ; <nl> } <nl> <nl> - STRETCHMODE CRetroPlayerUtils : : IdentifierToStretchMode ( const std : : string & stretchMode ) <nl> + STRETCHMODE CRetroPlayerUtils : : IdentifierToStretchMode ( const std : : string & stretchMode ) <nl> { <nl> if ( stretchMode = = STRETCHMODE_NORMAL_ID ) <nl> return STRETCHMODE : : Normal ; <nl> mmm a / xbmc / cores / RetroPlayer / RetroPlayerUtils . h <nl> ppp b / xbmc / cores / RetroPlayer / RetroPlayerUtils . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRetroPlayerUtils <nl> - { <nl> - public : <nl> - / * ! <nl> - * \ brief Convert a stretch mode enum to a short string identifier <nl> - * <nl> - * \ param stretchMode The stretch mode <nl> - * <nl> - * \ return A short string identifier specified by GameSettings . h , or an <nl> - * empty string if the stretch mode is invalid <nl> - * / <nl> - static const char * StretchModeToIdentifier ( STRETCHMODE stretchMode ) ; <nl> + class CRetroPlayerUtils <nl> + { <nl> + public : <nl> + / * ! <nl> + * \ brief Convert a stretch mode enum to a short string identifier <nl> + * <nl> + * \ param stretchMode The stretch mode <nl> + * <nl> + * \ return A short string identifier specified by GameSettings . h , or an <nl> + * empty string if the stretch mode is invalid <nl> + * / <nl> + static const char * StretchModeToIdentifier ( STRETCHMODE stretchMode ) ; <nl> <nl> - / * ! <nl> - * \ brief Convert a stretch mode identifier to an enum <nl> - * <nl> - * \ param stretchMode The short string identifier , from GameSettings . h , <nl> - * representing the stretch mode <nl> - * <nl> - * \ return The stretch mode enum , or STRETCHMODE : : Normal if the identifier <nl> - * is invalid <nl> - * / <nl> - static STRETCHMODE IdentifierToStretchMode ( const std : : string & stretchMode ) ; <nl> - } ; <nl> - } <nl> - } <nl> + / * ! <nl> + * \ brief Convert a stretch mode identifier to an enum <nl> + * <nl> + * \ param stretchMode The short string identifier , from GameSettings . h , <nl> + * representing the stretch mode <nl> + * <nl> + * \ return The stretch mode enum , or STRETCHMODE : : Normal if the identifier <nl> + * is invalid <nl> + * / <nl> + static STRETCHMODE IdentifierToStretchMode ( const std : : string & stretchMode ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / audio / AudioTranslator . cpp <nl> ppp b / xbmc / cores / RetroPlayer / audio / AudioTranslator . cpp <nl> AEDataFormat CAudioTranslator : : TranslatePCMFormat ( PCMFormat format ) <nl> { <nl> switch ( format ) <nl> { <nl> - case PCMFormat : : FMT_S16NE : return AE_FMT_S16NE ; <nl> - default : <nl> - break ; <nl> + case PCMFormat : : FMT_S16NE : <nl> + return AE_FMT_S16NE ; <nl> + default : <nl> + break ; <nl> } <nl> return AE_FMT_INVALID ; <nl> } <nl> AEChannel CAudioTranslator : : TranslateAudioChannel ( AudioChannel channel ) <nl> { <nl> switch ( channel ) <nl> { <nl> - case AudioChannel : : CH_FL : return AE_CH_FL ; <nl> - case AudioChannel : : CH_FR : return AE_CH_FR ; <nl> - case AudioChannel : : CH_FC : return AE_CH_FC ; <nl> - case AudioChannel : : CH_LFE : return AE_CH_LFE ; <nl> - case AudioChannel : : CH_BL : return AE_CH_BL ; <nl> - case AudioChannel : : CH_BR : return AE_CH_BR ; <nl> - case AudioChannel : : CH_FLOC : return AE_CH_FLOC ; <nl> - case AudioChannel : : CH_FROC : return AE_CH_FROC ; <nl> - case AudioChannel : : CH_BC : return AE_CH_BC ; <nl> - case AudioChannel : : CH_SL : return AE_CH_SL ; <nl> - case AudioChannel : : CH_SR : return AE_CH_SR ; <nl> - case AudioChannel : : CH_TFL : return AE_CH_TFL ; <nl> - case AudioChannel : : CH_TFR : return AE_CH_TFR ; <nl> - case AudioChannel : : CH_TFC : return AE_CH_TFC ; <nl> - case AudioChannel : : CH_TC : return AE_CH_TC ; <nl> - case AudioChannel : : CH_TBL : return AE_CH_TBL ; <nl> - case AudioChannel : : CH_TBR : return AE_CH_TBR ; <nl> - case AudioChannel : : CH_TBC : return AE_CH_TBC ; <nl> - case AudioChannel : : CH_BLOC : return AE_CH_BLOC ; <nl> - case AudioChannel : : CH_BROC : return AE_CH_BROC ; <nl> - default : <nl> - break ; <nl> + case AudioChannel : : CH_FL : <nl> + return AE_CH_FL ; <nl> + case AudioChannel : : CH_FR : <nl> + return AE_CH_FR ; <nl> + case AudioChannel : : CH_FC : <nl> + return AE_CH_FC ; <nl> + case AudioChannel : : CH_LFE : <nl> + return AE_CH_LFE ; <nl> + case AudioChannel : : CH_BL : <nl> + return AE_CH_BL ; <nl> + case AudioChannel : : CH_BR : <nl> + return AE_CH_BR ; <nl> + case AudioChannel : : CH_FLOC : <nl> + return AE_CH_FLOC ; <nl> + case AudioChannel : : CH_FROC : <nl> + return AE_CH_FROC ; <nl> + case AudioChannel : : CH_BC : <nl> + return AE_CH_BC ; <nl> + case AudioChannel : : CH_SL : <nl> + return AE_CH_SL ; <nl> + case AudioChannel : : CH_SR : <nl> + return AE_CH_SR ; <nl> + case AudioChannel : : CH_TFL : <nl> + return AE_CH_TFL ; <nl> + case AudioChannel : : CH_TFR : <nl> + return AE_CH_TFR ; <nl> + case AudioChannel : : CH_TFC : <nl> + return AE_CH_TFC ; <nl> + case AudioChannel : : CH_TC : <nl> + return AE_CH_TC ; <nl> + case AudioChannel : : CH_TBL : <nl> + return AE_CH_TBL ; <nl> + case AudioChannel : : CH_TBR : <nl> + return AE_CH_TBR ; <nl> + case AudioChannel : : CH_TBC : <nl> + return AE_CH_TBC ; <nl> + case AudioChannel : : CH_BLOC : <nl> + return AE_CH_BLOC ; <nl> + case AudioChannel : : CH_BROC : <nl> + return AE_CH_BROC ; <nl> + default : <nl> + break ; <nl> } <nl> return AE_CH_NULL ; <nl> } <nl> mmm a / xbmc / cores / RetroPlayer / audio / AudioTranslator . h <nl> ppp b / xbmc / cores / RetroPlayer / audio / AudioTranslator . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CAudioTranslator <nl> - { <nl> - public : <nl> - / * ! <nl> - * \ brief Translate audio PCM format ( Game API to AudioEngine ) . <nl> - * \ param format The audio PCM format to translate . <nl> - * \ return Translated audio PCM format . <nl> - * / <nl> - static AEDataFormat TranslatePCMFormat ( PCMFormat format ) ; <nl> + class CAudioTranslator <nl> + { <nl> + public : <nl> + / * ! <nl> + * \ brief Translate audio PCM format ( Game API to AudioEngine ) . <nl> + * \ param format The audio PCM format to translate . <nl> + * \ return Translated audio PCM format . <nl> + * / <nl> + static AEDataFormat TranslatePCMFormat ( PCMFormat format ) ; <nl> <nl> - / * ! <nl> - * \ brief Translate audio channels ( Game API to AudioEngine ) . <nl> - * \ param format The audio channels to translate . <nl> - * \ return Translated audio channels . <nl> - * / <nl> - static AEChannel TranslateAudioChannel ( AudioChannel channel ) ; <nl> - } ; <nl> - } <nl> - } <nl> + / * ! <nl> + * \ brief Translate audio channels ( Game API to AudioEngine ) . <nl> + * \ param format The audio channels to translate . <nl> + * \ return Translated audio channels . <nl> + * / <nl> + static AEChannel TranslateAudioChannel ( AudioChannel channel ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / BaseRenderBuffer . cpp <nl> ppp b / xbmc / cores / RetroPlayer / buffers / BaseRenderBuffer . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CBaseRenderBuffer : : CBaseRenderBuffer ( ) : <nl> - m_refCount ( 0 ) <nl> + CBaseRenderBuffer : : CBaseRenderBuffer ( ) : m_refCount ( 0 ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / buffers / BaseRenderBuffer . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / BaseRenderBuffer . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CBaseRenderBuffer : public IRenderBuffer <nl> - { <nl> - public : <nl> - CBaseRenderBuffer ( ) ; <nl> - ~ CBaseRenderBuffer ( ) override = default ; <nl> + class CBaseRenderBuffer : public IRenderBuffer <nl> + { <nl> + public : <nl> + CBaseRenderBuffer ( ) ; <nl> + ~ CBaseRenderBuffer ( ) override = default ; <nl> <nl> - / / Partial implementation of IRenderBuffer <nl> - void Acquire ( ) override ; <nl> - void Acquire ( std : : shared_ptr < IRenderBufferPool > pool ) override ; <nl> - void Release ( ) override ; <nl> - IRenderBufferPool * GetPool ( ) override { return m_pool . get ( ) ; } <nl> + / / Partial implementation of IRenderBuffer <nl> + void Acquire ( ) override ; <nl> + void Acquire ( std : : shared_ptr < IRenderBufferPool > pool ) override ; <nl> + void Release ( ) override ; <nl> + IRenderBufferPool * GetPool ( ) override { return m_pool . get ( ) ; } <nl> <nl> - protected : <nl> - / / Reference counting <nl> - std : : atomic_int m_refCount ; <nl> + protected : <nl> + / / Reference counting <nl> + std : : atomic_int m_refCount ; <nl> <nl> - / / Pool callback <nl> - std : : shared_ptr < IRenderBufferPool > m_pool ; <nl> - } ; <nl> - } <nl> - } <nl> + / / Pool callback <nl> + std : : shared_ptr < IRenderBufferPool > m_pool ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / BaseRenderBufferPool . cpp <nl> ppp b / xbmc / cores / RetroPlayer / buffers / BaseRenderBufferPool . cpp <nl> CBaseRenderBufferPool : : ~ CBaseRenderBufferPool ( ) <nl> Flush ( ) ; <nl> } <nl> <nl> - void CBaseRenderBufferPool : : RegisterRenderer ( CRPBaseRenderer * renderer ) <nl> + void CBaseRenderBufferPool : : RegisterRenderer ( CRPBaseRenderer * renderer ) <nl> { <nl> CSingleLock lock ( m_rendererMutex ) ; <nl> <nl> m_renderers . push_back ( renderer ) ; <nl> } <nl> <nl> - void CBaseRenderBufferPool : : UnregisterRenderer ( CRPBaseRenderer * renderer ) <nl> + void CBaseRenderBufferPool : : UnregisterRenderer ( CRPBaseRenderer * renderer ) <nl> { <nl> CSingleLock lock ( m_rendererMutex ) ; <nl> <nl> - m_renderers . erase ( std : : remove ( m_renderers . begin ( ) , m_renderers . end ( ) , renderer ) , m_renderers . end ( ) ) ; <nl> + m_renderers . erase ( std : : remove ( m_renderers . begin ( ) , m_renderers . end ( ) , renderer ) , <nl> + m_renderers . end ( ) ) ; <nl> } <nl> <nl> bool CBaseRenderBufferPool : : HasVisibleRenderer ( ) const <nl> bool CBaseRenderBufferPool : : Configure ( AVPixelFormat format ) <nl> return m_bConfigured ; <nl> } <nl> <nl> - IRenderBuffer * CBaseRenderBufferPool : : GetBuffer ( unsigned int width , unsigned int height ) <nl> + IRenderBuffer * CBaseRenderBufferPool : : GetBuffer ( unsigned int width , unsigned int height ) <nl> { <nl> if ( ! m_bConfigured ) <nl> return nullptr ; <nl> <nl> - IRenderBuffer * renderBuffer = nullptr ; <nl> + IRenderBuffer * renderBuffer = nullptr ; <nl> <nl> - void * header = nullptr ; <nl> + void * header = nullptr ; <nl> <nl> if ( GetHeaderWithTimeout ( header ) ) <nl> { <nl> IRenderBuffer * CBaseRenderBufferPool : : GetBuffer ( unsigned int width , unsigned int <nl> <nl> for ( auto it = m_free . begin ( ) ; it ! = m_free . end ( ) ; + + it ) <nl> { <nl> - std : : unique_ptr < IRenderBuffer > & buffer = * it ; <nl> + std : : unique_ptr < IRenderBuffer > & buffer = * it ; <nl> <nl> / / Only return buffers of the same dimensions <nl> const unsigned int bufferWidth = buffer - > GetWidth ( ) ; <nl> IRenderBuffer * CBaseRenderBufferPool : : GetBuffer ( unsigned int width , unsigned int <nl> <nl> if ( renderBuffer = = nullptr ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " RetroPlayer [ RENDER ] : Creating render buffer of size % ux % u for buffer pool " , <nl> - width , <nl> + CLog : : Log ( LOGDEBUG , <nl> + " RetroPlayer [ RENDER ] : Creating render buffer of size % ux % u for buffer pool " , width , <nl> height ) ; <nl> <nl> std : : unique_ptr < IRenderBuffer > renderBufferPtr ( CreateRenderBuffer ( header ) ) ; <nl> IRenderBuffer * CBaseRenderBufferPool : : GetBuffer ( unsigned int width , unsigned int <nl> return renderBuffer ; <nl> } <nl> <nl> - void CBaseRenderBufferPool : : Return ( IRenderBuffer * buffer ) <nl> + void CBaseRenderBufferPool : : Return ( IRenderBuffer * buffer ) <nl> { <nl> CSingleLock lock ( m_bufferMutex ) ; <nl> <nl> void CBaseRenderBufferPool : : Prime ( unsigned int width , unsigned int height ) <nl> <nl> for ( unsigned int i = 0 ; i < bufferCount ; i + + ) <nl> { <nl> - IRenderBuffer * buffer = GetBuffer ( width , height ) ; <nl> + IRenderBuffer * buffer = GetBuffer ( width , height ) ; <nl> if ( buffer = = nullptr ) <nl> break ; <nl> <nl> mmm a / xbmc / cores / RetroPlayer / buffers / BaseRenderBufferPool . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / BaseRenderBufferPool . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CBaseRenderBufferPool : public IRenderBufferPool <nl> - { <nl> - public : <nl> - CBaseRenderBufferPool ( ) = default ; <nl> - ~ CBaseRenderBufferPool ( ) override ; <nl> + class CBaseRenderBufferPool : public IRenderBufferPool <nl> + { <nl> + public : <nl> + CBaseRenderBufferPool ( ) = default ; <nl> + ~ CBaseRenderBufferPool ( ) override ; <nl> <nl> - / / Partial implementation of IRenderBufferPool <nl> - void RegisterRenderer ( CRPBaseRenderer * renderer ) override ; <nl> - void UnregisterRenderer ( CRPBaseRenderer * renderer ) override ; <nl> - bool HasVisibleRenderer ( ) const override ; <nl> - bool Configure ( AVPixelFormat format ) override ; <nl> - bool IsConfigured ( ) const override { return m_bConfigured ; } <nl> - IRenderBuffer * GetBuffer ( unsigned int width , unsigned int height ) override ; <nl> - void Return ( IRenderBuffer * buffer ) override ; <nl> - void Prime ( unsigned int width , unsigned int height ) override ; <nl> - void Flush ( ) override ; <nl> + / / Partial implementation of IRenderBufferPool <nl> + void RegisterRenderer ( CRPBaseRenderer * renderer ) override ; <nl> + void UnregisterRenderer ( CRPBaseRenderer * renderer ) override ; <nl> + bool HasVisibleRenderer ( ) const override ; <nl> + bool Configure ( AVPixelFormat format ) override ; <nl> + bool IsConfigured ( ) const override { return m_bConfigured ; } <nl> + IRenderBuffer * GetBuffer ( unsigned int width , unsigned int height ) override ; <nl> + void Return ( IRenderBuffer * buffer ) override ; <nl> + void Prime ( unsigned int width , unsigned int height ) override ; <nl> + void Flush ( ) override ; <nl> <nl> - / / Buffer properties <nl> - AVPixelFormat Format ( ) const { return m_format ; } <nl> + / / Buffer properties <nl> + AVPixelFormat Format ( ) const { return m_format ; } <nl> <nl> - protected : <nl> - virtual IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) = 0 ; <nl> - virtual bool ConfigureInternal ( ) { return true ; } <nl> - virtual void * GetHeader ( unsigned int timeoutMs = 0 ) { return nullptr ; } <nl> - virtual bool GetHeaderWithTimeout ( void * & header ) <nl> - { <nl> - header = nullptr ; <nl> - return true ; <nl> - } <nl> - virtual bool SendBuffer ( IRenderBuffer * buffer ) { return false ; } <nl> + protected : <nl> + virtual IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) = 0 ; <nl> + virtual bool ConfigureInternal ( ) { return true ; } <nl> + virtual void * GetHeader ( unsigned int timeoutMs = 0 ) { return nullptr ; } <nl> + virtual bool GetHeaderWithTimeout ( void * & header ) <nl> + { <nl> + header = nullptr ; <nl> + return true ; <nl> + } <nl> + virtual bool SendBuffer ( IRenderBuffer * buffer ) { return false ; } <nl> <nl> - / / Configuration parameters <nl> - bool m_bConfigured = false ; <nl> - AVPixelFormat m_format = AV_PIX_FMT_NONE ; <nl> + / / Configuration parameters <nl> + bool m_bConfigured = false ; <nl> + AVPixelFormat m_format = AV_PIX_FMT_NONE ; <nl> <nl> - private : <nl> - / / Buffer properties <nl> - std : : deque < std : : unique_ptr < IRenderBuffer > > m_free ; <nl> + private : <nl> + / / Buffer properties <nl> + std : : deque < std : : unique_ptr < IRenderBuffer > > m_free ; <nl> <nl> - std : : vector < CRPBaseRenderer * > m_renderers ; <nl> - mutable CCriticalSection m_rendererMutex ; <nl> - CCriticalSection m_bufferMutex ; <nl> - } ; <nl> - } <nl> - } <nl> + std : : vector < CRPBaseRenderer * > m_renderers ; <nl> + mutable CCriticalSection m_rendererMutex ; <nl> + CCriticalSection m_bufferMutex ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / IRenderBuffer . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / IRenderBuffer . h <nl> <nl> <nl> # pragma once <nl> <nl> - extern " C " { <nl> + extern " C " <nl> + { <nl> # include < libavutil / pixfmt . h > <nl> } <nl> <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class IRenderBufferPool ; <nl> + class IRenderBufferPool ; <nl> <nl> - class IRenderBuffer <nl> - { <nl> - public : <nl> - virtual ~ IRenderBuffer ( ) = default ; <nl> + class IRenderBuffer <nl> + { <nl> + public : <nl> + virtual ~ IRenderBuffer ( ) = default ; <nl> <nl> - / / Pool functions <nl> - virtual void Acquire ( ) = 0 ; <nl> - virtual void Acquire ( std : : shared_ptr < IRenderBufferPool > pool ) = 0 ; <nl> - virtual void Release ( ) = 0 ; <nl> - virtual IRenderBufferPool * GetPool ( ) = 0 ; <nl> + / / Pool functions <nl> + virtual void Acquire ( ) = 0 ; <nl> + virtual void Acquire ( std : : shared_ptr < IRenderBufferPool > pool ) = 0 ; <nl> + virtual void Release ( ) = 0 ; <nl> + virtual IRenderBufferPool * GetPool ( ) = 0 ; <nl> <nl> - / / Buffer functions <nl> - virtual bool Allocate ( AVPixelFormat format , unsigned int width , unsigned int height ) = 0 ; <nl> - virtual void Update ( ) { } / / ! @ todo Remove me <nl> - virtual size_t GetFrameSize ( ) const = 0 ; <nl> - virtual uint8_t * GetMemory ( ) = 0 ; <nl> - virtual void ReleaseMemory ( ) { } <nl> - virtual bool UploadTexture ( ) = 0 ; <nl> - virtual void BindToUnit ( unsigned int unit ) { } <nl> - virtual void SetHeader ( void * header ) { } <nl> + / / Buffer functions <nl> + virtual bool Allocate ( AVPixelFormat format , unsigned int width , unsigned int height ) = 0 ; <nl> + virtual void Update ( ) { } / / ! @ todo Remove me <nl> + virtual size_t GetFrameSize ( ) const = 0 ; <nl> + virtual uint8_t * GetMemory ( ) = 0 ; <nl> + virtual void ReleaseMemory ( ) { } <nl> + virtual bool UploadTexture ( ) = 0 ; <nl> + virtual void BindToUnit ( unsigned int unit ) { } <nl> + virtual void SetHeader ( void * header ) { } <nl> <nl> - / / Buffer properties <nl> - AVPixelFormat GetFormat ( ) const { return m_format ; } <nl> - unsigned int GetWidth ( ) const { return m_width ; } <nl> - unsigned int GetHeight ( ) const { return m_height ; } <nl> - bool IsLoaded ( ) const { return m_bLoaded ; } <nl> - void SetLoaded ( bool bLoaded ) { m_bLoaded = bLoaded ; } <nl> - bool IsRendered ( ) const { return m_bRendered ; } <nl> - void SetRendered ( bool bRendered ) { m_bRendered = bRendered ; } <nl> - unsigned int GetRotation ( ) const { return m_rotationDegCCW ; } <nl> - void SetRotation ( unsigned int rotationDegCCW ) { m_rotationDegCCW = rotationDegCCW ; } <nl> + / / Buffer properties <nl> + AVPixelFormat GetFormat ( ) const { return m_format ; } <nl> + unsigned int GetWidth ( ) const { return m_width ; } <nl> + unsigned int GetHeight ( ) const { return m_height ; } <nl> + bool IsLoaded ( ) const { return m_bLoaded ; } <nl> + void SetLoaded ( bool bLoaded ) { m_bLoaded = bLoaded ; } <nl> + bool IsRendered ( ) const { return m_bRendered ; } <nl> + void SetRendered ( bool bRendered ) { m_bRendered = bRendered ; } <nl> + unsigned int GetRotation ( ) const { return m_rotationDegCCW ; } <nl> + void SetRotation ( unsigned int rotationDegCCW ) { m_rotationDegCCW = rotationDegCCW ; } <nl> <nl> - protected : <nl> - AVPixelFormat m_format = AV_PIX_FMT_NONE ; <nl> - unsigned int m_width = 0 ; <nl> - unsigned int m_height = 0 ; <nl> - bool m_bLoaded = false ; <nl> - bool m_bRendered = false ; <nl> - unsigned int m_rotationDegCCW = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + protected : <nl> + AVPixelFormat m_format = AV_PIX_FMT_NONE ; <nl> + unsigned int m_width = 0 ; <nl> + unsigned int m_height = 0 ; <nl> + bool m_bLoaded = false ; <nl> + bool m_bRendered = false ; <nl> + unsigned int m_rotationDegCCW = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / IRenderBufferPool . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / IRenderBufferPool . h <nl> <nl> <nl> # pragma once <nl> <nl> - extern " C " { <nl> + extern " C " <nl> + { <nl> # include < libavutil / pixfmt . h > <nl> } <nl> <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderBufferManager ; <nl> - class CRenderVideoSettings ; <nl> - class CRPBaseRenderer ; <nl> - class IRenderBuffer ; <nl> + class CRenderBufferManager ; <nl> + class CRenderVideoSettings ; <nl> + class CRPBaseRenderer ; <nl> + class IRenderBuffer ; <nl> <nl> - class IRenderBufferPool : public std : : enable_shared_from_this < IRenderBufferPool > <nl> - { <nl> - public : <nl> - virtual ~ IRenderBufferPool ( ) = default ; <nl> + class IRenderBufferPool : public std : : enable_shared_from_this < IRenderBufferPool > <nl> + { <nl> + public : <nl> + virtual ~ IRenderBufferPool ( ) = default ; <nl> <nl> - virtual void RegisterRenderer ( CRPBaseRenderer * renderer ) = 0 ; <nl> - virtual void UnregisterRenderer ( CRPBaseRenderer * renderer ) = 0 ; <nl> - virtual bool HasVisibleRenderer ( ) const = 0 ; <nl> + virtual void RegisterRenderer ( CRPBaseRenderer * renderer ) = 0 ; <nl> + virtual void UnregisterRenderer ( CRPBaseRenderer * renderer ) = 0 ; <nl> + virtual bool HasVisibleRenderer ( ) const = 0 ; <nl> <nl> - virtual bool Configure ( AVPixelFormat format ) = 0 ; <nl> + virtual bool Configure ( AVPixelFormat format ) = 0 ; <nl> <nl> - virtual bool IsConfigured ( ) const = 0 ; <nl> + virtual bool IsConfigured ( ) const = 0 ; <nl> <nl> - virtual bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const = 0 ; <nl> + virtual bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const = 0 ; <nl> <nl> - / * ! <nl> - * \ brief Get a free buffer from the pool , sets ref count to 1 <nl> - * <nl> - * \ param width The horizontal pixel count of the buffer <nl> - * \ param height The vertical pixel could of the buffer <nl> - * <nl> - * \ return The allocated buffer , or nullptr on failure <nl> - * / <nl> - virtual IRenderBuffer * GetBuffer ( unsigned int width , unsigned int height ) = 0 ; <nl> + / * ! <nl> + * \ brief Get a free buffer from the pool , sets ref count to 1 <nl> + * <nl> + * \ param width The horizontal pixel count of the buffer <nl> + * \ param height The vertical pixel could of the buffer <nl> + * <nl> + * \ return The allocated buffer , or nullptr on failure <nl> + * / <nl> + virtual IRenderBuffer * GetBuffer ( unsigned int width , unsigned int height ) = 0 ; <nl> <nl> - / * ! <nl> - * \ brief Called by buffer when ref count goes to zero <nl> - * <nl> - * \ param buffer A fully dereferenced buffer <nl> - * / <nl> - virtual void Return ( IRenderBuffer * buffer ) = 0 ; <nl> + / * ! <nl> + * \ brief Called by buffer when ref count goes to zero <nl> + * <nl> + * \ param buffer A fully dereferenced buffer <nl> + * / <nl> + virtual void Return ( IRenderBuffer * buffer ) = 0 ; <nl> <nl> - virtual void Prime ( unsigned int width , unsigned int height ) = 0 ; <nl> + virtual void Prime ( unsigned int width , unsigned int height ) = 0 ; <nl> <nl> - virtual void Flush ( ) = 0 ; <nl> + virtual void Flush ( ) = 0 ; <nl> <nl> - / * ! <nl> - * \ brief Call in GetBuffer ( ) before returning buffer to caller <nl> - * / <nl> - virtual std : : shared_ptr < IRenderBufferPool > GetPtr ( ) { return shared_from_this ( ) ; } <nl> - } ; <nl> - } <nl> - } <nl> + / * ! <nl> + * \ brief Call in GetBuffer ( ) before returning buffer to caller <nl> + * / <nl> + virtual std : : shared_ptr < IRenderBufferPool > GetPtr ( ) { return shared_from_this ( ) ; } <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferDMA . cpp <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferDMA . cpp <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> CRenderBufferDMA : : CRenderBufferDMA ( CRenderContext & context , int fourcc ) <nl> - : m_context ( context ) , <nl> - m_fourcc ( fourcc ) , <nl> - m_bo ( CBufferObject : : GetBufferObject ( false ) ) <nl> + : m_context ( context ) , m_fourcc ( fourcc ) , m_bo ( CBufferObject : : GetBufferObject ( false ) ) <nl> { <nl> auto winSystemEGL = <nl> dynamic_cast < KODI : : WINDOWING : : LINUX : : CWinSystemEGL * > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferDMA . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferDMA . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderContext ; <nl> + class CRenderContext ; <nl> <nl> - / * * <nl> - * @ brief Special IRenderBuffer implementation for use with CBufferObject . <nl> - * This buffer type uses Direct Memory Access ( DMA ) sharing via file <nl> - * descriptors ( fds ) . The file descriptor is then used to create an <nl> - * EGL image . <nl> - * <nl> - * / <nl> - class CRenderBufferDMA : public CBaseRenderBuffer <nl> - { <nl> - public : <nl> - CRenderBufferDMA ( CRenderContext & context , int fourcc ) ; <nl> - ~ CRenderBufferDMA ( ) override ; <nl> + / * * <nl> + * @ brief Special IRenderBuffer implementation for use with CBufferObject . <nl> + * This buffer type uses Direct Memory Access ( DMA ) sharing via file <nl> + * descriptors ( fds ) . The file descriptor is then used to create an <nl> + * EGL image . <nl> + * <nl> + * / <nl> + class CRenderBufferDMA : public CBaseRenderBuffer <nl> + { <nl> + public : <nl> + CRenderBufferDMA ( CRenderContext & context , int fourcc ) ; <nl> + ~ CRenderBufferDMA ( ) override ; <nl> <nl> - / / implementation of IRenderBuffer via CRenderBufferSysMem <nl> - bool Allocate ( AVPixelFormat format , unsigned int width , unsigned int height ) override ; <nl> - size_t GetFrameSize ( ) const override ; <nl> - uint8_t * GetMemory ( ) override ; <nl> - void ReleaseMemory ( ) override ; <nl> + / / implementation of IRenderBuffer via CRenderBufferSysMem <nl> + bool Allocate ( AVPixelFormat format , unsigned int width , unsigned int height ) override ; <nl> + size_t GetFrameSize ( ) const override ; <nl> + uint8_t * GetMemory ( ) override ; <nl> + void ReleaseMemory ( ) override ; <nl> <nl> - / / implementation of IRenderBuffer <nl> - bool UploadTexture ( ) override ; <nl> + / / implementation of IRenderBuffer <nl> + bool UploadTexture ( ) override ; <nl> <nl> - GLuint TextureID ( ) const { return m_textureId ; } <nl> + GLuint TextureID ( ) const { return m_textureId ; } <nl> <nl> - protected : <nl> - / / Construction parameters <nl> - CRenderContext & m_context ; <nl> - const int m_fourcc = 0 ; <nl> + protected : <nl> + / / Construction parameters <nl> + CRenderContext & m_context ; <nl> + const int m_fourcc = 0 ; <nl> <nl> - const GLenum m_textureTarget = GL_TEXTURE_2D ; <nl> - GLuint m_textureId = 0 ; <nl> + const GLenum m_textureTarget = GL_TEXTURE_2D ; <nl> + GLuint m_textureId = 0 ; <nl> <nl> - private : <nl> - void CreateTexture ( ) ; <nl> - void DeleteTexture ( ) ; <nl> + private : <nl> + void CreateTexture ( ) ; <nl> + void DeleteTexture ( ) ; <nl> <nl> - std : : unique_ptr < CEGLImage > m_egl ; <nl> - std : : unique_ptr < IBufferObject > m_bo ; <nl> - } ; <nl> - } <nl> - } <nl> + std : : unique_ptr < CEGLImage > m_egl ; <nl> + std : : unique_ptr < IBufferObject > m_bo ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferManager . cpp <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferManager . cpp <nl> CRenderBufferManager : : ~ CRenderBufferManager ( ) <nl> FlushPools ( ) ; <nl> } <nl> <nl> - void CRenderBufferManager : : RegisterPools ( IRendererFactory * factory , RenderBufferPoolVector pools ) <nl> + void CRenderBufferManager : : RegisterPools ( IRendererFactory * factory , RenderBufferPoolVector pools ) <nl> { <nl> CSingleLock lock ( m_critSection ) ; <nl> <nl> m_pools . emplace_back ( RenderBufferPools { factory , std : : move ( pools ) } ) ; <nl> } <nl> <nl> - RenderBufferPoolVector CRenderBufferManager : : GetPools ( IRendererFactory * factory ) <nl> + RenderBufferPoolVector CRenderBufferManager : : GetPools ( IRendererFactory * factory ) <nl> { <nl> RenderBufferPoolVector bufferPools ; <nl> <nl> CSingleLock lock ( m_critSection ) ; <nl> <nl> - auto it = std : : find_if ( m_pools . begin ( ) , m_pools . end ( ) , <nl> - [ factory ] ( const RenderBufferPools & pools ) <nl> - { <nl> - return pools . factory = = factory ; <nl> - } ) ; <nl> + auto it = std : : find_if ( m_pools . begin ( ) , m_pools . end ( ) , [ factory ] ( const RenderBufferPools & pools ) { <nl> + return pools . factory = = factory ; <nl> + } ) ; <nl> <nl> if ( it ! = m_pools . end ( ) ) <nl> bufferPools = it - > pools ; <nl> std : : vector < IRenderBufferPool * > CRenderBufferManager : : GetBufferPools ( ) <nl> <nl> CSingleLock lock ( m_critSection ) ; <nl> <nl> - for ( const auto & pools : m_pools ) <nl> + for ( const auto & pools : m_pools ) <nl> { <nl> - for ( const auto & pool : pools . pools ) <nl> + for ( const auto & pool : pools . pools ) <nl> bufferPools . emplace_back ( pool . get ( ) ) ; <nl> } <nl> <nl> void CRenderBufferManager : : FlushPools ( ) <nl> { <nl> CSingleLock lock ( m_critSection ) ; <nl> <nl> - for ( const auto & pools : m_pools ) <nl> + for ( const auto & pools : m_pools ) <nl> { <nl> - for ( const auto & pool : pools . pools ) <nl> + for ( const auto & pool : pools . pools ) <nl> pool - > Flush ( ) ; <nl> } <nl> } <nl> <nl> - std : : string CRenderBufferManager : : GetRenderSystemName ( IRenderBufferPool * renderBufferPool ) const <nl> + std : : string CRenderBufferManager : : GetRenderSystemName ( IRenderBufferPool * renderBufferPool ) const <nl> { <nl> CSingleLock lock ( m_critSection ) ; <nl> <nl> - for ( const auto & pools : m_pools ) <nl> + for ( const auto & pools : m_pools ) <nl> { <nl> - for ( const auto & pool : pools . pools ) <nl> + for ( const auto & pool : pools . pools ) <nl> { <nl> if ( pool . get ( ) = = renderBufferPool ) <nl> return pools . factory - > RenderSystemName ( ) ; <nl> bool CRenderBufferManager : : HasScalingMethod ( SCALINGMETHOD scalingMethod ) const <nl> CRenderVideoSettings videoSettings ; <nl> videoSettings . SetScalingMethod ( scalingMethod ) ; <nl> <nl> - for ( const auto & pools : m_pools ) <nl> + for ( const auto & pools : m_pools ) <nl> { <nl> - for ( const auto & pool : pools . pools ) <nl> + for ( const auto & pool : pools . pools ) <nl> if ( pool - > IsCompatible ( videoSettings ) ) <nl> return true ; <nl> } <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferManager . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferManager . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class IRendererFactory ; <nl> - class IRenderBufferPools ; <nl> + class IRendererFactory ; <nl> + class IRenderBufferPools ; <nl> <nl> - class CRenderBufferManager <nl> - { <nl> - public : <nl> - CRenderBufferManager ( ) = default ; <nl> - ~ CRenderBufferManager ( ) ; <nl> - <nl> - void RegisterPools ( IRendererFactory * factory , RenderBufferPoolVector pools ) ; <nl> - RenderBufferPoolVector GetPools ( IRendererFactory * factory ) ; <nl> - std : : vector < IRenderBufferPool * > GetBufferPools ( ) ; <nl> - void FlushPools ( ) ; <nl> + class CRenderBufferManager <nl> + { <nl> + public : <nl> + CRenderBufferManager ( ) = default ; <nl> + ~ CRenderBufferManager ( ) ; <nl> <nl> - std : : string GetRenderSystemName ( IRenderBufferPool * renderBufferPool ) const ; <nl> + void RegisterPools ( IRendererFactory * factory , RenderBufferPoolVector pools ) ; <nl> + RenderBufferPoolVector GetPools ( IRendererFactory * factory ) ; <nl> + std : : vector < IRenderBufferPool * > GetBufferPools ( ) ; <nl> + void FlushPools ( ) ; <nl> <nl> - bool HasScalingMethod ( SCALINGMETHOD scalingMethod ) const ; <nl> + std : : string GetRenderSystemName ( IRenderBufferPool * renderBufferPool ) const ; <nl> <nl> - protected : <nl> - struct RenderBufferPools <nl> - { <nl> - IRendererFactory * factory ; <nl> - RenderBufferPoolVector pools ; <nl> - } ; <nl> + bool HasScalingMethod ( SCALINGMETHOD scalingMethod ) const ; <nl> <nl> - std : : vector < RenderBufferPools > m_pools ; <nl> - mutable CCriticalSection m_critSection ; <nl> + protected : <nl> + struct RenderBufferPools <nl> + { <nl> + IRendererFactory * factory ; <nl> + RenderBufferPoolVector pools ; <nl> } ; <nl> - } <nl> - } <nl> + <nl> + std : : vector < RenderBufferPools > m_pools ; <nl> + mutable CCriticalSection m_critSection ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferOpenGL . cpp <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferOpenGL . cpp <nl> using namespace RETRO ; <nl> CRenderBufferOpenGL : : CRenderBufferOpenGL ( GLuint pixeltype , <nl> GLuint internalformat , <nl> GLuint pixelformat , <nl> - GLuint bpp ) : <nl> - m_pixeltype ( pixeltype ) , <nl> - m_internalformat ( internalformat ) , <nl> - m_pixelformat ( pixelformat ) , <nl> - m_bpp ( bpp ) <nl> + GLuint bpp ) <nl> + : m_pixeltype ( pixeltype ) , m_internalformat ( internalformat ) , m_pixelformat ( pixelformat ) , m_bpp ( bpp ) <nl> { <nl> } <nl> <nl> void CRenderBufferOpenGL : : CreateTexture ( ) <nl> <nl> glBindTexture ( m_textureTarget , m_textureId ) ; <nl> <nl> - glTexImage2D ( m_textureTarget , 0 , m_internalformat , m_width , m_height , 0 , m_pixelformat , m_pixeltype , NULL ) ; <nl> + glTexImage2D ( m_textureTarget , 0 , m_internalformat , m_width , m_height , 0 , m_pixelformat , <nl> + m_pixeltype , NULL ) ; <nl> <nl> glTexParameteri ( m_textureTarget , GL_TEXTURE_MIN_FILTER , GL_LINEAR ) ; <nl> glTexParameteri ( m_textureTarget , GL_TEXTURE_MAG_FILTER , GL_LINEAR ) ; <nl> bool CRenderBufferOpenGL : : UploadTexture ( ) <nl> / / ! We want to use PBO ' s instead of glTexSubImage2D ! <nl> / / ! This code has been borrowed from OpenGL ES in order <nl> / / ! to remove GL dependencies on GLES . <nl> - glTexSubImage2D ( m_textureTarget , 0 , 0 , 0 , m_width , m_height , m_pixelformat , m_pixeltype , m_data . data ( ) ) ; <nl> + glTexSubImage2D ( m_textureTarget , 0 , 0 , 0 , m_width , m_height , m_pixelformat , m_pixeltype , <nl> + m_data . data ( ) ) ; <nl> glPixelStorei ( GL_UNPACK_ROW_LENGTH , 0 ) ; <nl> <nl> return true ; <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferOpenGL . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferOpenGL . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderContext ; <nl> - <nl> - class CRenderBufferOpenGL : public CRenderBufferSysMem <nl> - { <nl> - public : <nl> - CRenderBufferOpenGL ( GLuint pixeltype , <nl> - GLuint internalformat , <nl> - GLuint pixelformat , <nl> - GLuint bpp ) ; <nl> - ~ CRenderBufferOpenGL ( ) override ; <nl> - <nl> - bool UploadTexture ( ) override ; <nl> - GLuint TextureID ( ) const { return m_textureId ; } <nl> - <nl> - private : <nl> - / / Construction parameters <nl> - const GLuint m_pixeltype ; <nl> - const GLuint m_internalformat ; <nl> - const GLuint m_pixelformat ; <nl> - const GLuint m_bpp ; <nl> - <nl> - const GLenum m_textureTarget = GL_TEXTURE_2D ; / / ! @ todo <nl> - GLuint m_textureId = 0 ; <nl> - <nl> - void CreateTexture ( ) ; <nl> - void DeleteTexture ( ) ; <nl> - } ; <nl> - } <nl> - } <nl> + class CRenderContext ; <nl> + <nl> + class CRenderBufferOpenGL : public CRenderBufferSysMem <nl> + { <nl> + public : <nl> + CRenderBufferOpenGL ( GLuint pixeltype , GLuint internalformat , GLuint pixelformat , GLuint bpp ) ; <nl> + ~ CRenderBufferOpenGL ( ) override ; <nl> + <nl> + bool UploadTexture ( ) override ; <nl> + GLuint TextureID ( ) const { return m_textureId ; } <nl> + <nl> + private : <nl> + / / Construction parameters <nl> + const GLuint m_pixeltype ; <nl> + const GLuint m_internalformat ; <nl> + const GLuint m_pixelformat ; <nl> + const GLuint m_bpp ; <nl> + <nl> + const GLenum m_textureTarget = GL_TEXTURE_2D ; / / ! @ todo <nl> + GLuint m_textureId = 0 ; <nl> + <nl> + void CreateTexture ( ) ; <nl> + void DeleteTexture ( ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferOpenGLES . cpp <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferOpenGLES . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRenderBufferOpenGLES : : CRenderBufferOpenGLES ( CRenderContext & context , <nl> + CRenderBufferOpenGLES : : CRenderBufferOpenGLES ( CRenderContext & context , <nl> GLuint pixeltype , <nl> GLuint internalformat , <nl> GLuint pixelformat , <nl> - GLuint bpp ) : <nl> - m_context ( context ) , <nl> - m_pixeltype ( pixeltype ) , <nl> - m_internalformat ( internalformat ) , <nl> - m_pixelformat ( pixelformat ) , <nl> - m_bpp ( bpp ) <nl> + GLuint bpp ) <nl> + : m_context ( context ) , <nl> + m_pixeltype ( pixeltype ) , <nl> + m_internalformat ( internalformat ) , <nl> + m_pixelformat ( pixelformat ) , <nl> + m_bpp ( bpp ) <nl> { <nl> } <nl> <nl> void CRenderBufferOpenGLES : : CreateTexture ( ) <nl> <nl> glBindTexture ( m_textureTarget , m_textureId ) ; <nl> <nl> - glTexImage2D ( m_textureTarget , 0 , m_internalformat , m_width , m_height , 0 , m_pixelformat , m_pixeltype , NULL ) ; <nl> + glTexImage2D ( m_textureTarget , 0 , m_internalformat , m_width , m_height , 0 , m_pixelformat , <nl> + m_pixeltype , NULL ) ; <nl> <nl> glTexParameteri ( m_textureTarget , GL_TEXTURE_MIN_FILTER , GL_LINEAR ) ; <nl> glTexParameteri ( m_textureTarget , GL_TEXTURE_MAG_FILTER , GL_LINEAR ) ; <nl> bool CRenderBufferOpenGLES : : UploadTexture ( ) <nl> { <nl> # ifdef GL_UNPACK_ROW_LENGTH_EXT <nl> glPixelStorei ( GL_UNPACK_ROW_LENGTH_EXT , stride / m_bpp ) ; <nl> - glTexSubImage2D ( m_textureTarget , 0 , 0 , 0 , m_width , m_height , m_pixelformat , m_pixeltype , m_data . data ( ) ) ; <nl> + glTexSubImage2D ( m_textureTarget , 0 , 0 , 0 , m_width , m_height , m_pixelformat , m_pixeltype , <nl> + m_data . data ( ) ) ; <nl> glPixelStorei ( GL_UNPACK_ROW_LENGTH_EXT , 0 ) ; <nl> # endif <nl> } <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferOpenGLES . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferOpenGLES . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderContext ; <nl> - <nl> - class CRenderBufferOpenGLES : public CRenderBufferSysMem <nl> - { <nl> - public : <nl> - CRenderBufferOpenGLES ( CRenderContext & context , <nl> - GLuint pixeltype , <nl> - GLuint internalformat , <nl> - GLuint pixelformat , <nl> - GLuint bpp ) ; <nl> - ~ CRenderBufferOpenGLES ( ) override ; <nl> - <nl> - / / implementation of IRenderBuffer via CRenderBufferSysMem <nl> - bool UploadTexture ( ) override ; <nl> - <nl> - GLuint TextureID ( ) const { return m_textureId ; } <nl> - <nl> - private : <nl> - / / Construction parameters <nl> - CRenderContext & m_context ; <nl> - const GLuint m_pixeltype ; <nl> - const GLuint m_internalformat ; <nl> - const GLuint m_pixelformat ; <nl> - const GLuint m_bpp ; <nl> - <nl> - const GLenum m_textureTarget = GL_TEXTURE_2D ; / / ! @ todo <nl> - GLuint m_textureId = 0 ; <nl> - <nl> - void CreateTexture ( ) ; <nl> - void DeleteTexture ( ) ; <nl> - } ; <nl> - } <nl> - } <nl> + class CRenderContext ; <nl> + <nl> + class CRenderBufferOpenGLES : public CRenderBufferSysMem <nl> + { <nl> + public : <nl> + CRenderBufferOpenGLES ( CRenderContext & context , <nl> + GLuint pixeltype , <nl> + GLuint internalformat , <nl> + GLuint pixelformat , <nl> + GLuint bpp ) ; <nl> + ~ CRenderBufferOpenGLES ( ) override ; <nl> + <nl> + / / implementation of IRenderBuffer via CRenderBufferSysMem <nl> + bool UploadTexture ( ) override ; <nl> + <nl> + GLuint TextureID ( ) const { return m_textureId ; } <nl> + <nl> + private : <nl> + / / Construction parameters <nl> + CRenderContext & m_context ; <nl> + const GLuint m_pixeltype ; <nl> + const GLuint m_internalformat ; <nl> + const GLuint m_pixelformat ; <nl> + const GLuint m_bpp ; <nl> + <nl> + const GLenum m_textureTarget = GL_TEXTURE_2D ; / / ! @ todo <nl> + GLuint m_textureId = 0 ; <nl> + <nl> + void CreateTexture ( ) ; <nl> + void DeleteTexture ( ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferPoolDMA . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferPoolDMA . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderContext ; <nl> - <nl> - / * * <nl> - * @ brief Special IRenderBufferPool implementation that converts <nl> - * AVPixelFormat to DRM_FORMAT_ * for use with CRenderBufferDMA . <nl> - * <nl> - * / <nl> - class CRenderBufferPoolDMA : public CBaseRenderBufferPool <nl> - { <nl> - public : <nl> - CRenderBufferPoolDMA ( CRenderContext & context ) ; <nl> - ~ CRenderBufferPoolDMA ( ) override = default ; <nl> - <nl> - / / implementation of IRenderBufferPool via CBaseRenderBufferPool <nl> - bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const override ; <nl> - <nl> - protected : <nl> - / / implementation of CBaseRenderBufferPool <nl> - IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) override ; <nl> - bool ConfigureInternal ( ) override ; <nl> - <nl> - / / Construction parameters <nl> - CRenderContext & m_context ; <nl> - <nl> - / / Configuration parameters <nl> - int m_fourcc = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + class CRenderContext ; <nl> + <nl> + / * * <nl> + * @ brief Special IRenderBufferPool implementation that converts <nl> + * AVPixelFormat to DRM_FORMAT_ * for use with CRenderBufferDMA . <nl> + * <nl> + * / <nl> + class CRenderBufferPoolDMA : public CBaseRenderBufferPool <nl> + { <nl> + public : <nl> + CRenderBufferPoolDMA ( CRenderContext & context ) ; <nl> + ~ CRenderBufferPoolDMA ( ) override = default ; <nl> + <nl> + / / implementation of IRenderBufferPool via CBaseRenderBufferPool <nl> + bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const override ; <nl> + <nl> + protected : <nl> + / / implementation of CBaseRenderBufferPool <nl> + IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) override ; <nl> + bool ConfigureInternal ( ) override ; <nl> + <nl> + / / Construction parameters <nl> + CRenderContext & m_context ; <nl> + <nl> + / / Configuration parameters <nl> + int m_fourcc = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferPoolOpenGL . cpp <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferPoolOpenGL . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - bool CRenderBufferPoolOpenGL : : IsCompatible ( const CRenderVideoSettings & renderSettings ) const <nl> + bool CRenderBufferPoolOpenGL : : IsCompatible ( const CRenderVideoSettings & renderSettings ) const <nl> { <nl> return CRPRendererOpenGL : : SupportsScalingMethod ( renderSettings . GetScalingMethod ( ) ) ; <nl> } <nl> <nl> - IRenderBuffer * CRenderBufferPoolOpenGL : : CreateRenderBuffer ( void * header / * = nullptr * / ) <nl> + IRenderBuffer * CRenderBufferPoolOpenGL : : CreateRenderBuffer ( void * header / * = nullptr * / ) <nl> { <nl> - return new CRenderBufferOpenGL ( m_pixeltype , <nl> - m_internalformat , <nl> - m_pixelformat , <nl> - m_bpp ) ; <nl> + return new CRenderBufferOpenGL ( m_pixeltype , m_internalformat , m_pixelformat , m_bpp ) ; <nl> } <nl> <nl> bool CRenderBufferPoolOpenGL : : ConfigureInternal ( ) <nl> bool CRenderBufferPoolOpenGL : : ConfigureInternal ( ) <nl> / / Configure CRenderBufferPoolOpenGLES <nl> switch ( m_format ) <nl> { <nl> - case AV_PIX_FMT_0RGB32 : <nl> - { <nl> - m_pixeltype = GL_UNSIGNED_BYTE ; <nl> - m_internalformat = GL_RGBA ; <nl> - m_pixelformat = GL_BGRA ; <nl> - m_bpp = sizeof ( uint32_t ) ; <nl> - return true ; <nl> - } <nl> - case AV_PIX_FMT_RGB555 : <nl> - { <nl> - m_pixeltype = GL_UNSIGNED_SHORT_5_5_5_1 ; <nl> - m_internalformat = GL_RGB ; <nl> - m_pixelformat = GL_RGB ; <nl> - m_bpp = sizeof ( uint16_t ) ; <nl> - return true ; <nl> - } <nl> - case AV_PIX_FMT_RGB565 : <nl> - { <nl> - m_pixeltype = GL_UNSIGNED_SHORT_5_6_5 ; <nl> - m_internalformat = GL_RGB ; <nl> - m_pixelformat = GL_RGB ; <nl> - m_bpp = sizeof ( uint16_t ) ; <nl> - return true ; <nl> - } <nl> - default : <nl> - break ; <nl> + case AV_PIX_FMT_0RGB32 : <nl> + { <nl> + m_pixeltype = GL_UNSIGNED_BYTE ; <nl> + m_internalformat = GL_RGBA ; <nl> + m_pixelformat = GL_BGRA ; <nl> + m_bpp = sizeof ( uint32_t ) ; <nl> + return true ; <nl> + } <nl> + case AV_PIX_FMT_RGB555 : <nl> + { <nl> + m_pixeltype = GL_UNSIGNED_SHORT_5_5_5_1 ; <nl> + m_internalformat = GL_RGB ; <nl> + m_pixelformat = GL_RGB ; <nl> + m_bpp = sizeof ( uint16_t ) ; <nl> + return true ; <nl> + } <nl> + case AV_PIX_FMT_RGB565 : <nl> + { <nl> + m_pixeltype = GL_UNSIGNED_SHORT_5_6_5 ; <nl> + m_internalformat = GL_RGB ; <nl> + m_pixelformat = GL_RGB ; <nl> + m_bpp = sizeof ( uint16_t ) ; <nl> + return true ; <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> <nl> return false ; <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferPoolOpenGL . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferPoolOpenGL . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderContext ; <nl> - class CRenderVideoSettings ; <nl> - <nl> - class CRenderBufferPoolOpenGL : public CBaseRenderBufferPool <nl> - { <nl> - public : <nl> - CRenderBufferPoolOpenGL ( ) = default ; <nl> - ~ CRenderBufferPoolOpenGL ( ) override = default ; <nl> - <nl> - / / implementation of IRenderBufferPool via CBaseRenderBufferPool <nl> - bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const override ; <nl> - <nl> - protected : <nl> - / / implementation of CBaseRenderBufferPool <nl> - IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) override ; <nl> - bool ConfigureInternal ( ) override ; <nl> - <nl> - private : <nl> - / / Configuration parameters <nl> - GLuint m_pixeltype = 0 ; <nl> - GLuint m_internalformat = 0 ; <nl> - GLuint m_pixelformat = 0 ; <nl> - GLuint m_bpp = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + class CRenderContext ; <nl> + class CRenderVideoSettings ; <nl> + <nl> + class CRenderBufferPoolOpenGL : public CBaseRenderBufferPool <nl> + { <nl> + public : <nl> + CRenderBufferPoolOpenGL ( ) = default ; <nl> + ~ CRenderBufferPoolOpenGL ( ) override = default ; <nl> + <nl> + / / implementation of IRenderBufferPool via CBaseRenderBufferPool <nl> + bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const override ; <nl> + <nl> + protected : <nl> + / / implementation of CBaseRenderBufferPool <nl> + IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) override ; <nl> + bool ConfigureInternal ( ) override ; <nl> + <nl> + private : <nl> + / / Configuration parameters <nl> + GLuint m_pixeltype = 0 ; <nl> + GLuint m_internalformat = 0 ; <nl> + GLuint m_pixelformat = 0 ; <nl> + GLuint m_bpp = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferPoolOpenGLES . cpp <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferPoolOpenGLES . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRenderBufferPoolOpenGLES : : CRenderBufferPoolOpenGLES ( CRenderContext & context ) <nl> - : m_context ( context ) <nl> + CRenderBufferPoolOpenGLES : : CRenderBufferPoolOpenGLES ( CRenderContext & context ) : m_context ( context ) <nl> { <nl> } <nl> <nl> - bool CRenderBufferPoolOpenGLES : : IsCompatible ( const CRenderVideoSettings & renderSettings ) const <nl> + bool CRenderBufferPoolOpenGLES : : IsCompatible ( const CRenderVideoSettings & renderSettings ) const <nl> { <nl> return CRPRendererOpenGLES : : SupportsScalingMethod ( renderSettings . GetScalingMethod ( ) ) ; <nl> } <nl> <nl> - IRenderBuffer * CRenderBufferPoolOpenGLES : : CreateRenderBuffer ( void * header / * = nullptr * / ) <nl> + IRenderBuffer * CRenderBufferPoolOpenGLES : : CreateRenderBuffer ( void * header / * = nullptr * / ) <nl> { <nl> - return new CRenderBufferOpenGLES ( m_context , <nl> - m_pixeltype , <nl> - m_internalformat , <nl> - m_pixelformat , <nl> - m_bpp ) ; <nl> + return new CRenderBufferOpenGLES ( m_context , m_pixeltype , m_internalformat , m_pixelformat , m_bpp ) ; <nl> } <nl> <nl> bool CRenderBufferPoolOpenGLES : : ConfigureInternal ( ) <nl> { <nl> switch ( m_format ) <nl> { <nl> - case AV_PIX_FMT_0RGB32 : <nl> - { <nl> - m_pixeltype = GL_UNSIGNED_BYTE ; <nl> - if ( m_context . IsExtSupported ( " GL_EXT_texture_format_BGRA8888 " ) | | <nl> - m_context . IsExtSupported ( " GL_IMG_texture_format_BGRA8888 " ) ) <nl> - { <nl> - m_internalformat = GL_BGRA_EXT ; <nl> - m_pixelformat = GL_BGRA_EXT ; <nl> - } <nl> - else if ( m_context . IsExtSupported ( " GL_APPLE_texture_format_BGRA8888 " ) ) <nl> + case AV_PIX_FMT_0RGB32 : <nl> { <nl> - / / Apple ' s implementation does not conform to spec . Instead , they require <nl> - / / differing format / internalformat , more like GL . <nl> - m_internalformat = GL_RGBA ; <nl> - m_pixelformat = GL_BGRA_EXT ; <nl> + m_pixeltype = GL_UNSIGNED_BYTE ; <nl> + if ( m_context . IsExtSupported ( " GL_EXT_texture_format_BGRA8888 " ) | | <nl> + m_context . IsExtSupported ( " GL_IMG_texture_format_BGRA8888 " ) ) <nl> + { <nl> + m_internalformat = GL_BGRA_EXT ; <nl> + m_pixelformat = GL_BGRA_EXT ; <nl> + } <nl> + else if ( m_context . IsExtSupported ( " GL_APPLE_texture_format_BGRA8888 " ) ) <nl> + { <nl> + / / Apple ' s implementation does not conform to spec . Instead , they require <nl> + / / differing format / internalformat , more like GL . <nl> + m_internalformat = GL_RGBA ; <nl> + m_pixelformat = GL_BGRA_EXT ; <nl> + } <nl> + else <nl> + { <nl> + m_internalformat = GL_RGBA ; <nl> + m_pixelformat = GL_RGBA ; <nl> + } <nl> + m_bpp = sizeof ( uint32_t ) ; <nl> + return true ; <nl> } <nl> - else <nl> + case AV_PIX_FMT_RGB555 : <nl> + case AV_PIX_FMT_RGB565 : <nl> { <nl> - m_internalformat = GL_RGBA ; <nl> - m_pixelformat = GL_RGBA ; <nl> + m_pixeltype = GL_UNSIGNED_SHORT_5_6_5 ; <nl> + m_internalformat = GL_RGB ; <nl> + m_pixelformat = GL_RGB ; <nl> + m_bpp = sizeof ( uint16_t ) ; <nl> + return true ; <nl> } <nl> - m_bpp = sizeof ( uint32_t ) ; <nl> - return true ; <nl> - } <nl> - case AV_PIX_FMT_RGB555 : <nl> - case AV_PIX_FMT_RGB565 : <nl> - { <nl> - m_pixeltype = GL_UNSIGNED_SHORT_5_6_5 ; <nl> - m_internalformat = GL_RGB ; <nl> - m_pixelformat = GL_RGB ; <nl> - m_bpp = sizeof ( uint16_t ) ; <nl> - return true ; <nl> - } <nl> - default : <nl> - break ; <nl> + default : <nl> + break ; <nl> } <nl> <nl> return false ; <nl> mmm a / xbmc / cores / RetroPlayer / buffers / RenderBufferPoolOpenGLES . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / RenderBufferPoolOpenGLES . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderContext ; <nl> - class CRenderVideoSettings ; <nl> - <nl> - class CRenderBufferPoolOpenGLES : public CBaseRenderBufferPool <nl> - { <nl> - public : <nl> - CRenderBufferPoolOpenGLES ( CRenderContext & context ) ; <nl> - ~ CRenderBufferPoolOpenGLES ( ) override = default ; <nl> - <nl> - / / implementation of IRenderBufferPool via CBaseRenderBufferPool <nl> - bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const override ; <nl> - <nl> - private : <nl> - / / implementation of CBaseRenderBufferPool <nl> - IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) override ; <nl> - bool ConfigureInternal ( ) override ; <nl> - <nl> - / / Construction parameters <nl> - CRenderContext & m_context ; <nl> - <nl> - / / Configuration parameters <nl> - GLuint m_pixeltype = 0 ; <nl> - GLuint m_internalformat = 0 ; <nl> - GLuint m_pixelformat = 0 ; <nl> - GLuint m_bpp = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + class CRenderContext ; <nl> + class CRenderVideoSettings ; <nl> + <nl> + class CRenderBufferPoolOpenGLES : public CBaseRenderBufferPool <nl> + { <nl> + public : <nl> + CRenderBufferPoolOpenGLES ( CRenderContext & context ) ; <nl> + ~ CRenderBufferPoolOpenGLES ( ) override = default ; <nl> + <nl> + / / implementation of IRenderBufferPool via CBaseRenderBufferPool <nl> + bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const override ; <nl> + <nl> + private : <nl> + / / implementation of CBaseRenderBufferPool <nl> + IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) override ; <nl> + bool ConfigureInternal ( ) override ; <nl> + <nl> + / / Construction parameters <nl> + CRenderContext & m_context ; <nl> + <nl> + / / Configuration parameters <nl> + GLuint m_pixeltype = 0 ; <nl> + GLuint m_internalformat = 0 ; <nl> + GLuint m_pixelformat = 0 ; <nl> + GLuint m_bpp = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / video / RenderBufferGuiTexture . cpp <nl> ppp b / xbmc / cores / RetroPlayer / buffers / video / RenderBufferGuiTexture . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRenderBufferGuiTexture : : CRenderBufferGuiTexture ( SCALINGMETHOD scalingMethod ) : <nl> - m_scalingMethod ( scalingMethod ) <nl> + CRenderBufferGuiTexture : : CRenderBufferGuiTexture ( SCALINGMETHOD scalingMethod ) <nl> + : m_scalingMethod ( scalingMethod ) <nl> { <nl> m_textureFormat = XB_FMT_A8R8G8B8 ; <nl> } <nl> <nl> - bool CRenderBufferGuiTexture : : Allocate ( AVPixelFormat format , unsigned int width , unsigned int height ) <nl> + bool CRenderBufferGuiTexture : : Allocate ( AVPixelFormat format , <nl> + unsigned int width , <nl> + unsigned int height ) <nl> { <nl> / / Initialize IRenderBuffer <nl> m_format = TranslateFormat ( m_textureFormat ) ; <nl> size_t CRenderBufferGuiTexture : : GetFrameSize ( ) const <nl> return 0 ; <nl> } <nl> <nl> - uint8_t * CRenderBufferGuiTexture : : GetMemory ( ) <nl> + uint8_t * CRenderBufferGuiTexture : : GetMemory ( ) <nl> { <nl> if ( m_texture ) <nl> return m_texture - > GetPixels ( ) ; <nl> AVPixelFormat CRenderBufferGuiTexture : : TranslateFormat ( unsigned int textureForma <nl> { <nl> switch ( textureFormat ) <nl> { <nl> - case XB_FMT_RGBA8 : <nl> - case XB_FMT_A8R8G8B8 : <nl> - return AV_PIX_FMT_BGRA ; <nl> - default : <nl> - break ; <nl> + case XB_FMT_RGBA8 : <nl> + case XB_FMT_A8R8G8B8 : <nl> + return AV_PIX_FMT_BGRA ; <nl> + default : <nl> + break ; <nl> } <nl> <nl> return AV_PIX_FMT_NONE ; <nl> TEXTURE_SCALING CRenderBufferGuiTexture : : TranslateScalingMethod ( SCALINGMETHOD sc <nl> { <nl> switch ( scalingMethod ) <nl> { <nl> - case SCALINGMETHOD : : NEAREST : <nl> - return TEXTURE_SCALING : : NEAREST ; <nl> - case SCALINGMETHOD : : LINEAR : <nl> - return TEXTURE_SCALING : : LINEAR ; <nl> - default : <nl> - break ; <nl> + case SCALINGMETHOD : : NEAREST : <nl> + return TEXTURE_SCALING : : NEAREST ; <nl> + case SCALINGMETHOD : : LINEAR : <nl> + return TEXTURE_SCALING : : LINEAR ; <nl> + default : <nl> + break ; <nl> } <nl> <nl> return TEXTURE_SCALING : : NEAREST ; <nl> mmm a / xbmc / cores / RetroPlayer / buffers / video / RenderBufferGuiTexture . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / video / RenderBufferGuiTexture . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderBufferGuiTexture : public CBaseRenderBuffer <nl> - { <nl> - public : <nl> - CRenderBufferGuiTexture ( SCALINGMETHOD scalingMethod ) ; <nl> - ~ CRenderBufferGuiTexture ( ) override = default ; <nl> - <nl> - / / implementation of IRenderBuffer via CBaseRenderBuffer <nl> - bool Allocate ( AVPixelFormat format , unsigned int width , unsigned int height ) override ; <nl> - size_t GetFrameSize ( ) const override ; <nl> - uint8_t * GetMemory ( ) override ; <nl> - bool UploadTexture ( ) override ; <nl> - void BindToUnit ( unsigned int unit ) override ; <nl> - <nl> - / / GUI texture interface <nl> - CTexture * GetTexture ( ) { return m_texture . get ( ) ; } <nl> - <nl> - protected : <nl> - AVPixelFormat TranslateFormat ( unsigned int textureFormat ) ; <nl> - TEXTURE_SCALING TranslateScalingMethod ( SCALINGMETHOD scalingMethod ) ; <nl> - <nl> - / / Texture parameters <nl> - SCALINGMETHOD m_scalingMethod ; <nl> - unsigned int m_textureFormat = XB_FMT_UNKNOWN ; <nl> - std : : unique_ptr < CTexture > m_texture ; <nl> - } ; <nl> - <nl> - } <nl> - } <nl> + class CRenderBufferGuiTexture : public CBaseRenderBuffer <nl> + { <nl> + public : <nl> + CRenderBufferGuiTexture ( SCALINGMETHOD scalingMethod ) ; <nl> + ~ CRenderBufferGuiTexture ( ) override = default ; <nl> + <nl> + / / implementation of IRenderBuffer via CBaseRenderBuffer <nl> + bool Allocate ( AVPixelFormat format , unsigned int width , unsigned int height ) override ; <nl> + size_t GetFrameSize ( ) const override ; <nl> + uint8_t * GetMemory ( ) override ; <nl> + bool UploadTexture ( ) override ; <nl> + void BindToUnit ( unsigned int unit ) override ; <nl> + <nl> + / / GUI texture interface <nl> + CTexture * GetTexture ( ) { return m_texture . get ( ) ; } <nl> + <nl> + protected : <nl> + AVPixelFormat TranslateFormat ( unsigned int textureFormat ) ; <nl> + TEXTURE_SCALING TranslateScalingMethod ( SCALINGMETHOD scalingMethod ) ; <nl> + <nl> + / / Texture parameters <nl> + SCALINGMETHOD m_scalingMethod ; <nl> + unsigned int m_textureFormat = XB_FMT_UNKNOWN ; <nl> + std : : unique_ptr < CTexture > m_texture ; <nl> + } ; <nl> + <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / buffers / video / RenderBufferSysMem . cpp <nl> ppp b / xbmc / cores / RetroPlayer / buffers / video / RenderBufferSysMem . cpp <nl> size_t CRenderBufferSysMem : : GetFrameSize ( ) const <nl> return m_data . size ( ) ; <nl> } <nl> <nl> - uint8_t * CRenderBufferSysMem : : GetMemory ( ) <nl> + uint8_t * CRenderBufferSysMem : : GetMemory ( ) <nl> { <nl> return m_data . data ( ) ; <nl> } <nl> <nl> - size_t CRenderBufferSysMem : : GetBufferSize ( AVPixelFormat format , unsigned int width , unsigned int height ) <nl> + size_t CRenderBufferSysMem : : GetBufferSize ( AVPixelFormat format , <nl> + unsigned int width , <nl> + unsigned int height ) <nl> { <nl> const size_t bufferStride = CRenderTranslator : : TranslateWidthToBytes ( width , format ) ; <nl> const size_t bufferSize = bufferStride * height ; <nl> mmm a / xbmc / cores / RetroPlayer / buffers / video / RenderBufferSysMem . h <nl> ppp b / xbmc / cores / RetroPlayer / buffers / video / RenderBufferSysMem . h <nl> <nl> # include < stdint . h > <nl> # include < vector > <nl> <nl> - extern " C " { <nl> + extern " C " <nl> + { <nl> # include < libavutil / pixfmt . h > <nl> } <nl> <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderBufferSysMem : public CBaseRenderBuffer <nl> - { <nl> - public : <nl> - CRenderBufferSysMem ( ) = default ; <nl> - ~ CRenderBufferSysMem ( ) override = default ; <nl> + class CRenderBufferSysMem : public CBaseRenderBuffer <nl> + { <nl> + public : <nl> + CRenderBufferSysMem ( ) = default ; <nl> + ~ CRenderBufferSysMem ( ) override = default ; <nl> <nl> - / / implementation of IRenderBuffer <nl> - bool Allocate ( AVPixelFormat format , unsigned int width , unsigned int height ) override ; <nl> - size_t GetFrameSize ( ) const override ; <nl> - uint8_t * GetMemory ( ) override ; <nl> + / / implementation of IRenderBuffer <nl> + bool Allocate ( AVPixelFormat format , unsigned int width , unsigned int height ) override ; <nl> + size_t GetFrameSize ( ) const override ; <nl> + uint8_t * GetMemory ( ) override ; <nl> <nl> - / / Utility functions <nl> - static size_t GetBufferSize ( AVPixelFormat format , unsigned int width , unsigned int height ) ; <nl> + / / Utility functions <nl> + static size_t GetBufferSize ( AVPixelFormat format , unsigned int width , unsigned int height ) ; <nl> <nl> - protected : <nl> - std : : vector < uint8_t > m_data ; <nl> - } ; <nl> + protected : <nl> + std : : vector < uint8_t > m_data ; <nl> + } ; <nl> <nl> - } <nl> - } <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIGameRenderManager . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIGameRenderManager . cpp <nl> using namespace RETRO ; <nl> <nl> CGUIGameRenderManager : : ~ CGUIGameRenderManager ( ) = default ; <nl> <nl> - void CGUIGameRenderManager : : RegisterPlayer ( CGUIRenderTargetFactory * factory , <nl> - IRenderCallback * callback , <nl> - IGameCallback * gameCallback ) <nl> + void CGUIGameRenderManager : : RegisterPlayer ( CGUIRenderTargetFactory * factory , <nl> + IRenderCallback * callback , <nl> + IGameCallback * gameCallback ) <nl> { <nl> / / Set factory <nl> { <nl> void CGUIGameRenderManager : : UnregisterPlayer ( ) <nl> } <nl> } <nl> <nl> - std : : shared_ptr < CGUIRenderHandle > CGUIGameRenderManager : : RegisterControl ( CGUIGameControl & control ) <nl> + std : : shared_ptr < CGUIRenderHandle > CGUIGameRenderManager : : RegisterControl ( CGUIGameControl & control ) <nl> { <nl> CSingleLock lock ( m_targetMutex ) ; <nl> <nl> std : : shared_ptr < CGUIRenderHandle > CGUIGameRenderManager : : RegisterControl ( CGUIGam <nl> return renderHandle ; <nl> } <nl> <nl> - std : : shared_ptr < CGUIRenderHandle > CGUIGameRenderManager : : RegisterWindow ( CGameWindowFullScreen & window ) <nl> + std : : shared_ptr < CGUIRenderHandle > CGUIGameRenderManager : : RegisterWindow ( <nl> + CGameWindowFullScreen & window ) <nl> { <nl> CSingleLock lock ( m_targetMutex ) ; <nl> <nl> std : : shared_ptr < CGUIRenderHandle > CGUIGameRenderManager : : RegisterWindow ( CGameWin <nl> return renderHandle ; <nl> } <nl> <nl> - std : : shared_ptr < CGUIGameVideoHandle > CGUIGameRenderManager : : RegisterDialog ( GAME : : CDialogGameVideoSelect & dialog ) <nl> + std : : shared_ptr < CGUIGameVideoHandle > CGUIGameRenderManager : : RegisterDialog ( <nl> + GAME : : CDialogGameVideoSelect & dialog ) <nl> { <nl> return std : : make_shared < CGUIGameVideoHandle > ( * this ) ; <nl> } <nl> std : : shared_ptr < CGUIGameSettingsHandle > CGUIGameRenderManager : : RegisterGameSetti <nl> return std : : make_shared < CGUIGameSettingsHandle > ( * this ) ; <nl> } <nl> <nl> - void CGUIGameRenderManager : : UnregisterHandle ( CGUIRenderHandle * handle ) <nl> + void CGUIGameRenderManager : : UnregisterHandle ( CGUIRenderHandle * handle ) <nl> { <nl> CSingleLock lock ( m_targetMutex ) ; <nl> <nl> m_renderTargets . erase ( handle ) ; <nl> } <nl> <nl> - void CGUIGameRenderManager : : Render ( CGUIRenderHandle * handle ) <nl> + void CGUIGameRenderManager : : Render ( CGUIRenderHandle * handle ) <nl> { <nl> CSingleLock lock ( m_targetMutex ) ; <nl> <nl> auto it = m_renderTargets . find ( handle ) ; <nl> if ( it ! = m_renderTargets . end ( ) ) <nl> { <nl> - const std : : shared_ptr < CGUIRenderTarget > & renderTarget = it - > second ; <nl> + const std : : shared_ptr < CGUIRenderTarget > & renderTarget = it - > second ; <nl> if ( renderTarget ) <nl> renderTarget - > Render ( ) ; <nl> } <nl> } <nl> <nl> - void CGUIGameRenderManager : : RenderEx ( CGUIRenderHandle * handle ) <nl> + void CGUIGameRenderManager : : RenderEx ( CGUIRenderHandle * handle ) <nl> { <nl> CSingleLock lock ( m_targetMutex ) ; <nl> <nl> auto it = m_renderTargets . find ( handle ) ; <nl> if ( it ! = m_renderTargets . end ( ) ) <nl> { <nl> - const std : : shared_ptr < CGUIRenderTarget > & renderTarget = it - > second ; <nl> + const std : : shared_ptr < CGUIRenderTarget > & renderTarget = it - > second ; <nl> if ( renderTarget ) <nl> renderTarget - > RenderEx ( ) ; <nl> } <nl> } <nl> <nl> - void CGUIGameRenderManager : : ClearBackground ( CGUIRenderHandle * handle ) <nl> + void CGUIGameRenderManager : : ClearBackground ( CGUIRenderHandle * handle ) <nl> { <nl> CSingleLock lock ( m_targetMutex ) ; <nl> <nl> auto it = m_renderTargets . find ( handle ) ; <nl> if ( it ! = m_renderTargets . end ( ) ) <nl> { <nl> - const std : : shared_ptr < CGUIRenderTarget > & renderTarget = it - > second ; <nl> + const std : : shared_ptr < CGUIRenderTarget > & renderTarget = it - > second ; <nl> if ( renderTarget ) <nl> renderTarget - > ClearBackground ( ) ; <nl> } <nl> } <nl> <nl> - bool CGUIGameRenderManager : : IsDirty ( CGUIRenderHandle * handle ) <nl> + bool CGUIGameRenderManager : : IsDirty ( CGUIRenderHandle * handle ) <nl> { <nl> CSingleLock lock ( m_targetMutex ) ; <nl> <nl> auto it = m_renderTargets . find ( handle ) ; <nl> if ( it ! = m_renderTargets . end ( ) ) <nl> { <nl> - const std : : shared_ptr < CGUIRenderTarget > & renderTarget = it - > second ; <nl> + const std : : shared_ptr < CGUIRenderTarget > & renderTarget = it - > second ; <nl> if ( renderTarget ) <nl> return renderTarget - > IsDirty ( ) ; <nl> } <nl> void CGUIGameRenderManager : : UpdateRenderTargets ( ) <nl> { <nl> if ( m_factory ! = nullptr ) <nl> { <nl> - for ( auto & it : m_renderTargets ) <nl> + for ( auto & it : m_renderTargets ) <nl> { <nl> - CGUIRenderHandle * handle = it . first ; <nl> - std : : shared_ptr < CGUIRenderTarget > & renderTarget = it . second ; <nl> + CGUIRenderHandle * handle = it . first ; <nl> + std : : shared_ptr < CGUIRenderTarget > & renderTarget = it . second ; <nl> <nl> if ( ! renderTarget ) <nl> renderTarget . reset ( CreateRenderTarget ( handle ) ) ; <nl> void CGUIGameRenderManager : : UpdateRenderTargets ( ) <nl> } <nl> else <nl> { <nl> - for ( auto & it : m_renderTargets ) <nl> + for ( auto & it : m_renderTargets ) <nl> it . second . reset ( ) ; <nl> } <nl> } <nl> <nl> - CGUIRenderTarget * CGUIGameRenderManager : : CreateRenderTarget ( CGUIRenderHandle * handle ) <nl> + CGUIRenderTarget * CGUIGameRenderManager : : CreateRenderTarget ( CGUIRenderHandle * handle ) <nl> { <nl> switch ( handle - > Type ( ) ) <nl> { <nl> - case RENDER_HANDLE : : CONTROL : <nl> - { <nl> - CGUIRenderControlHandle * controlHandle = static_cast < CGUIRenderControlHandle * > ( handle ) ; <nl> - return m_factory - > CreateRenderControl ( controlHandle - > GetControl ( ) ) ; <nl> - } <nl> - case RENDER_HANDLE : : WINDOW : <nl> - { <nl> - CGUIRenderFullScreenHandle * fullScreenHandle = static_cast < CGUIRenderFullScreenHandle * > ( handle ) ; <nl> - return m_factory - > CreateRenderFullScreen ( fullScreenHandle - > GetWindow ( ) ) ; <nl> - } <nl> - default : <nl> - break ; <nl> + case RENDER_HANDLE : : CONTROL : <nl> + { <nl> + CGUIRenderControlHandle * controlHandle = static_cast < CGUIRenderControlHandle * > ( handle ) ; <nl> + return m_factory - > CreateRenderControl ( controlHandle - > GetControl ( ) ) ; <nl> + } <nl> + case RENDER_HANDLE : : WINDOW : <nl> + { <nl> + CGUIRenderFullScreenHandle * fullScreenHandle = <nl> + static_cast < CGUIRenderFullScreenHandle * > ( handle ) ; <nl> + return m_factory - > CreateRenderFullScreen ( fullScreenHandle - > GetWindow ( ) ) ; <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> <nl> return nullptr ; <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIGameRenderManager . h <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIGameRenderManager . h <nl> namespace KODI <nl> { <nl> namespace GAME <nl> { <nl> - class CDialogGameAdvancedSettings ; <nl> - class CDialogGameVideoSelect ; <nl> - } <nl> + class CDialogGameAdvancedSettings ; <nl> + class CDialogGameVideoSelect ; <nl> + } / / namespace GAME <nl> <nl> namespace RETRO <nl> { <nl> - class CGameWindowFullScreen ; <nl> - class CGUIGameControl ; <nl> - class CGUIGameSettingsHandle ; <nl> - class CGUIGameVideoHandle ; <nl> - class CGUIRenderTargetFactory ; <nl> - class CGUIRenderHandle ; <nl> - class CGUIRenderTarget ; <nl> - class IGameCallback ; <nl> - class IRenderCallback ; <nl> + class CGameWindowFullScreen ; <nl> + class CGUIGameControl ; <nl> + class CGUIGameSettingsHandle ; <nl> + class CGUIGameVideoHandle ; <nl> + class CGUIRenderTargetFactory ; <nl> + class CGUIRenderHandle ; <nl> + class CGUIRenderTarget ; <nl> + class IGameCallback ; <nl> + class IRenderCallback ; <nl> + <nl> + / * ! <nl> + * \ brief Class to safely route commands between the GUI and RetroPlayer <nl> + * <nl> + * This class is brought up before the GUI and player core factory . It <nl> + * provides the GUI with safe access to a registered player . <nl> + * <nl> + * Access to the player is done through handles . When a handle is no <nl> + * longer needed , it should be destroyed . <nl> + * <nl> + * Two kinds of handles are provided : <nl> + * <nl> + * - CGUIRenderHandle <nl> + * Allows the holder to invoke render events <nl> + * <nl> + * - CGUIGameVideoHandle <nl> + * Allows the holder to query video properties , such as the filter <nl> + * or view mode . <nl> + * <nl> + * Each manager fulfills the following design requirements : <nl> + * <nl> + * 1 . No assumption of player lifetimes <nl> + * <nl> + * 2 . No assumption of GUI element lifetimes , as long as handles are <nl> + * destroyed before this class is destructed <nl> + * <nl> + * 3 . No limit on the number of handles <nl> + * / <nl> + class CGUIGameRenderManager <nl> + { <nl> + friend class CGUIGameSettingsHandle ; <nl> + friend class CGUIGameVideoHandle ; <nl> + friend class CGUIRenderHandle ; <nl> + <nl> + public : <nl> + CGUIGameRenderManager ( ) = default ; <nl> + ~ CGUIGameRenderManager ( ) ; <nl> <nl> / * ! <nl> - * \ brief Class to safely route commands between the GUI and RetroPlayer <nl> + * \ brief Register a RetroPlayer instance <nl> * <nl> - * This class is brought up before the GUI and player core factory . It <nl> - * provides the GUI with safe access to a registered player . <nl> + * \ param factory The interface for creating render targets exposed to the GUI <nl> + * \ param callback The interface for querying video properties <nl> + * \ param gameCallback The interface for querying game properties <nl> + * / <nl> + void RegisterPlayer ( CGUIRenderTargetFactory * factory , <nl> + IRenderCallback * callback , <nl> + IGameCallback * gameCallback ) ; <nl> + <nl> + / * ! <nl> + * \ brief Unregister a RetroPlayer instance <nl> + * / <nl> + void UnregisterPlayer ( ) ; <nl> + <nl> + / * ! <nl> + * \ brief Register a GUI game control ( " gamewindow " skin control ) <nl> + * <nl> + * \ param control The game control <nl> * <nl> - * Access to the player is done through handles . When a handle is no <nl> - * longer needed , it should be destroyed . <nl> + * \ return A handle to invoke render events <nl> + * / <nl> + std : : shared_ptr < CGUIRenderHandle > RegisterControl ( CGUIGameControl & control ) ; <nl> + <nl> + / * ! <nl> + * \ brief Register a fullscreen game window ( " FullscreenGame " window ) <nl> * <nl> - * Two kinds of handles are provided : <nl> + * \ param window The game window <nl> * <nl> - * - CGUIRenderHandle <nl> - * Allows the holder to invoke render events <nl> + * \ return A handle to invoke render events <nl> + * / <nl> + std : : shared_ptr < CGUIRenderHandle > RegisterWindow ( CGameWindowFullScreen & window ) ; <nl> + <nl> + / * ! <nl> + * \ brief Register a video select dialog ( for selecting video filters , <nl> + * view modes , etc . ) <nl> * <nl> - * - CGUIGameVideoHandle <nl> - * Allows the holder to query video properties , such as the filter <nl> - * or view mode . <nl> + * \ param dialog The video select dialog <nl> * <nl> - * Each manager fulfills the following design requirements : <nl> + * \ return A handle to query game and video properties <nl> + * / <nl> + std : : shared_ptr < CGUIGameVideoHandle > RegisterDialog ( GAME : : CDialogGameVideoSelect & dialog ) ; <nl> + <nl> + / * ! <nl> + * \ brief Register a game settings dialog <nl> * <nl> - * 1 . No assumption of player lifetimes <nl> + * \ return A handle to query game properties <nl> + * / <nl> + std : : shared_ptr < CGUIGameSettingsHandle > RegisterGameSettingsDialog ( ) ; <nl> + <nl> + protected : <nl> + / / Functions exposed to friend class CGUIRenderHandle <nl> + void UnregisterHandle ( CGUIRenderHandle * handle ) ; <nl> + void Render ( CGUIRenderHandle * handle ) ; <nl> + void RenderEx ( CGUIRenderHandle * handle ) ; <nl> + void ClearBackground ( CGUIRenderHandle * handle ) ; <nl> + bool IsDirty ( CGUIRenderHandle * handle ) ; <nl> + <nl> + / / Functions exposed to friend class CGUIGameVideoHandle <nl> + void UnregisterHandle ( CGUIGameVideoHandle * handle ) { } <nl> + bool IsPlayingGame ( ) ; <nl> + bool SupportsRenderFeature ( RENDERFEATURE feature ) ; <nl> + bool SupportsScalingMethod ( SCALINGMETHOD method ) ; <nl> + <nl> + / / Functions exposed to CGUIGameSettingsHandle <nl> + void UnregisterHandle ( CGUIGameSettingsHandle * handle ) { } <nl> + std : : string GameClientID ( ) ; <nl> + <nl> + private : <nl> + / * ! <nl> + * \ brief Helper function to create or destroy render targets when a <nl> + * factory is registered / unregistered <nl> + * / <nl> + void UpdateRenderTargets ( ) ; <nl> + <nl> + / * ! <nl> + * \ brief Helper function to create a render target <nl> * <nl> - * 2 . No assumption of GUI element lifetimes , as long as handles are <nl> - * destroyed before this class is destructed <nl> + * \ param handle The handle given to the registered GUI element <nl> * <nl> - * 3 . No limit on the number of handles <nl> + * \ return A target to receive rendering commands <nl> * / <nl> - class CGUIGameRenderManager <nl> - { <nl> - friend class CGUIGameSettingsHandle ; <nl> - friend class CGUIGameVideoHandle ; <nl> - friend class CGUIRenderHandle ; <nl> - <nl> - public : <nl> - CGUIGameRenderManager ( ) = default ; <nl> - ~ CGUIGameRenderManager ( ) ; <nl> - <nl> - / * ! <nl> - * \ brief Register a RetroPlayer instance <nl> - * <nl> - * \ param factory The interface for creating render targets exposed to the GUI <nl> - * \ param callback The interface for querying video properties <nl> - * \ param gameCallback The interface for querying game properties <nl> - * / <nl> - void RegisterPlayer ( CGUIRenderTargetFactory * factory , <nl> - IRenderCallback * callback , <nl> - IGameCallback * gameCallback ) ; <nl> - <nl> - / * ! <nl> - * \ brief Unregister a RetroPlayer instance <nl> - * / <nl> - void UnregisterPlayer ( ) ; <nl> - <nl> - / * ! <nl> - * \ brief Register a GUI game control ( " gamewindow " skin control ) <nl> - * <nl> - * \ param control The game control <nl> - * <nl> - * \ return A handle to invoke render events <nl> - * / <nl> - std : : shared_ptr < CGUIRenderHandle > RegisterControl ( CGUIGameControl & control ) ; <nl> - <nl> - / * ! <nl> - * \ brief Register a fullscreen game window ( " FullscreenGame " window ) <nl> - * <nl> - * \ param window The game window <nl> - * <nl> - * \ return A handle to invoke render events <nl> - * / <nl> - std : : shared_ptr < CGUIRenderHandle > RegisterWindow ( CGameWindowFullScreen & window ) ; <nl> - <nl> - / * ! <nl> - * \ brief Register a video select dialog ( for selecting video filters , <nl> - * view modes , etc . ) <nl> - * <nl> - * \ param dialog The video select dialog <nl> - * <nl> - * \ return A handle to query game and video properties <nl> - * / <nl> - std : : shared_ptr < CGUIGameVideoHandle > RegisterDialog ( GAME : : CDialogGameVideoSelect & dialog ) ; <nl> - <nl> - / * ! <nl> - * \ brief Register a game settings dialog <nl> - * <nl> - * \ return A handle to query game properties <nl> - * / <nl> - std : : shared_ptr < CGUIGameSettingsHandle > RegisterGameSettingsDialog ( ) ; <nl> - <nl> - protected : <nl> - / / Functions exposed to friend class CGUIRenderHandle <nl> - void UnregisterHandle ( CGUIRenderHandle * handle ) ; <nl> - void Render ( CGUIRenderHandle * handle ) ; <nl> - void RenderEx ( CGUIRenderHandle * handle ) ; <nl> - void ClearBackground ( CGUIRenderHandle * handle ) ; <nl> - bool IsDirty ( CGUIRenderHandle * handle ) ; <nl> - <nl> - / / Functions exposed to friend class CGUIGameVideoHandle <nl> - void UnregisterHandle ( CGUIGameVideoHandle * handle ) { } <nl> - bool IsPlayingGame ( ) ; <nl> - bool SupportsRenderFeature ( RENDERFEATURE feature ) ; <nl> - bool SupportsScalingMethod ( SCALINGMETHOD method ) ; <nl> - <nl> - / / Functions exposed to CGUIGameSettingsHandle <nl> - void UnregisterHandle ( CGUIGameSettingsHandle * handle ) { } <nl> - std : : string GameClientID ( ) ; <nl> - <nl> - private : <nl> - / * ! <nl> - * \ brief Helper function to create or destroy render targets when a <nl> - * factory is registered / unregistered <nl> - * / <nl> - void UpdateRenderTargets ( ) ; <nl> - <nl> - / * ! <nl> - * \ brief Helper function to create a render target <nl> - * <nl> - * \ param handle The handle given to the registered GUI element <nl> - * <nl> - * \ return A target to receive rendering commands <nl> - * / <nl> - CGUIRenderTarget * CreateRenderTarget ( CGUIRenderHandle * handle ) ; <nl> - <nl> - / / Render events <nl> - CGUIRenderTargetFactory * m_factory = nullptr ; <nl> - std : : map < CGUIRenderHandle * , std : : shared_ptr < CGUIRenderTarget > > m_renderTargets ; <nl> - CCriticalSection m_targetMutex ; <nl> - <nl> - / / Video properties <nl> - IRenderCallback * m_callback = nullptr ; <nl> - CCriticalSection m_callbackMutex ; <nl> - <nl> - / / Game properties <nl> - IGameCallback * m_gameCallback = nullptr ; <nl> - CCriticalSection m_gameCallbackMutex ; <nl> - } ; <nl> - } <nl> - } <nl> + CGUIRenderTarget * CreateRenderTarget ( CGUIRenderHandle * handle ) ; <nl> + <nl> + / / Render events <nl> + CGUIRenderTargetFactory * m_factory = nullptr ; <nl> + std : : map < CGUIRenderHandle * , std : : shared_ptr < CGUIRenderTarget > > m_renderTargets ; <nl> + CCriticalSection m_targetMutex ; <nl> + <nl> + / / Video properties <nl> + IRenderCallback * m_callback = nullptr ; <nl> + CCriticalSection m_callbackMutex ; <nl> + <nl> + / / Game properties <nl> + IGameCallback * m_gameCallback = nullptr ; <nl> + CCriticalSection m_gameCallbackMutex ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIGameSettings . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIGameSettings . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CGUIGameSettings : : CGUIGameSettings ( CRPProcessInfo & processInfo ) : <nl> - m_processInfo ( processInfo ) , <nl> - m_guiSettings ( processInfo . GetRenderContext ( ) . GetGameSettings ( ) ) <nl> + CGUIGameSettings : : CGUIGameSettings ( CRPProcessInfo & processInfo ) <nl> + : m_processInfo ( processInfo ) , m_guiSettings ( processInfo . GetRenderContext ( ) . GetGameSettings ( ) ) <nl> { <nl> / / Reset game settings <nl> m_guiSettings = m_processInfo . GetRenderContext ( ) . GetDefaultGameSettings ( ) ; <nl> CRenderSettings CGUIGameSettings : : GetSettings ( ) const <nl> return m_renderSettings ; <nl> } <nl> <nl> - void CGUIGameSettings : : Notify ( const Observable & obs , const ObservableMessage msg ) <nl> + void CGUIGameSettings : : Notify ( const Observable & obs , const ObservableMessage msg ) <nl> { <nl> switch ( msg ) <nl> { <nl> - case ObservableMessageSettingsChanged : <nl> - { <nl> - UpdateSettings ( ) ; <nl> - break ; <nl> - } <nl> - default : <nl> - break ; <nl> + case ObservableMessageSettingsChanged : <nl> + { <nl> + UpdateSettings ( ) ; <nl> + break ; <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIGameSettings . h <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIGameSettings . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRPProcessInfo ; <nl> + class CRPProcessInfo ; <nl> <nl> - class CGUIGameSettings : public IGUIRenderSettings , <nl> - public Observer <nl> - { <nl> - public : <nl> - CGUIGameSettings ( CRPProcessInfo & processInfo ) ; <nl> - ~ CGUIGameSettings ( ) override ; <nl> + class CGUIGameSettings : public IGUIRenderSettings , public Observer <nl> + { <nl> + public : <nl> + CGUIGameSettings ( CRPProcessInfo & processInfo ) ; <nl> + ~ CGUIGameSettings ( ) override ; <nl> <nl> - / / implementation of IGUIRenderSettings <nl> - CRenderSettings GetSettings ( ) const override ; <nl> + / / implementation of IGUIRenderSettings <nl> + CRenderSettings GetSettings ( ) const override ; <nl> <nl> - / / implementation of Observer <nl> - void Notify ( const Observable & obs , const ObservableMessage msg ) override ; <nl> + / / implementation of Observer <nl> + void Notify ( const Observable & obs , const ObservableMessage msg ) override ; <nl> <nl> - private : <nl> - void UpdateSettings ( ) ; <nl> + private : <nl> + void UpdateSettings ( ) ; <nl> <nl> - / / Construction parameters <nl> - CRPProcessInfo & m_processInfo ; <nl> + / / Construction parameters <nl> + CRPProcessInfo & m_processInfo ; <nl> <nl> - / / GUI parameters <nl> - CGameSettings & m_guiSettings ; <nl> + / / GUI parameters <nl> + CGameSettings & m_guiSettings ; <nl> <nl> - / / Render parameters <nl> - CRenderSettings m_renderSettings ; <nl> + / / Render parameters <nl> + CRenderSettings m_renderSettings ; <nl> <nl> - / / Synchronization parameters <nl> - mutable CCriticalSection m_mutex ; <nl> - } ; <nl> - } <nl> - } <nl> + / / Synchronization parameters <nl> + mutable CCriticalSection m_mutex ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIGameSettingsHandle . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIGameSettingsHandle . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CGUIGameSettingsHandle : : CGUIGameSettingsHandle ( CGUIGameRenderManager & renderManager ) : <nl> - m_renderManager ( renderManager ) <nl> + CGUIGameSettingsHandle : : CGUIGameSettingsHandle ( CGUIGameRenderManager & renderManager ) <nl> + : m_renderManager ( renderManager ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIGameSettingsHandle . h <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIGameSettingsHandle . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CGUIGameRenderManager ; <nl> + class CGUIGameRenderManager ; <nl> <nl> - class CGUIGameSettingsHandle <nl> - { <nl> - public : <nl> - CGUIGameSettingsHandle ( CGUIGameRenderManager & renderManager ) ; <nl> - virtual ~ CGUIGameSettingsHandle ( ) ; <nl> + class CGUIGameSettingsHandle <nl> + { <nl> + public : <nl> + CGUIGameSettingsHandle ( CGUIGameRenderManager & renderManager ) ; <nl> + virtual ~ CGUIGameSettingsHandle ( ) ; <nl> <nl> - std : : string GameClientID ( ) ; <nl> + std : : string GameClientID ( ) ; <nl> <nl> - private : <nl> - / / Construction parameters <nl> - CGUIGameRenderManager & m_renderManager ; <nl> - } ; <nl> - } <nl> - } <nl> + private : <nl> + / / Construction parameters <nl> + CGUIGameRenderManager & m_renderManager ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIGameVideoHandle . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIGameVideoHandle . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CGUIGameVideoHandle : : CGUIGameVideoHandle ( CGUIGameRenderManager & renderManager ) : <nl> - m_renderManager ( renderManager ) <nl> + CGUIGameVideoHandle : : CGUIGameVideoHandle ( CGUIGameRenderManager & renderManager ) <nl> + : m_renderManager ( renderManager ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIGameVideoHandle . h <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIGameVideoHandle . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CGUIGameRenderManager ; <nl> + class CGUIGameRenderManager ; <nl> <nl> - class CGUIGameVideoHandle <nl> - { <nl> - public : <nl> - CGUIGameVideoHandle ( CGUIGameRenderManager & renderManager ) ; <nl> - virtual ~ CGUIGameVideoHandle ( ) ; <nl> + class CGUIGameVideoHandle <nl> + { <nl> + public : <nl> + CGUIGameVideoHandle ( CGUIGameRenderManager & renderManager ) ; <nl> + virtual ~ CGUIGameVideoHandle ( ) ; <nl> <nl> - bool IsPlayingGame ( ) ; <nl> - bool SupportsRenderFeature ( RENDERFEATURE feature ) ; <nl> - bool SupportsScalingMethod ( SCALINGMETHOD method ) ; <nl> + bool IsPlayingGame ( ) ; <nl> + bool SupportsRenderFeature ( RENDERFEATURE feature ) ; <nl> + bool SupportsScalingMethod ( SCALINGMETHOD method ) ; <nl> <nl> - private : <nl> - / / Construction parameters <nl> - CGUIGameRenderManager & m_renderManager ; <nl> - } ; <nl> - } <nl> - } <nl> + private : <nl> + / / Construction parameters <nl> + CGUIGameRenderManager & m_renderManager ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIRenderHandle . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIRenderHandle . cpp <nl> using namespace RETRO ; <nl> <nl> / / mmm CGUIRenderHandle mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> - CGUIRenderHandle : : CGUIRenderHandle ( CGUIGameRenderManager & renderManager , RENDER_HANDLE type ) : <nl> - m_renderManager ( renderManager ) , <nl> - m_type ( type ) <nl> + CGUIRenderHandle : : CGUIRenderHandle ( CGUIGameRenderManager & renderManager , RENDER_HANDLE type ) <nl> + : m_renderManager ( renderManager ) , m_type ( type ) <nl> { <nl> } <nl> <nl> void CGUIRenderHandle : : ClearBackground ( ) <nl> <nl> / / mmm CGUIRenderControlHandle mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - CGUIRenderControlHandle : : CGUIRenderControlHandle ( CGUIGameRenderManager & renderManager , CGUIGameControl & control ) : <nl> - CGUIRenderHandle ( renderManager , RENDER_HANDLE : : CONTROL ) , <nl> - m_control ( control ) <nl> + CGUIRenderControlHandle : : CGUIRenderControlHandle ( CGUIGameRenderManager & renderManager , <nl> + CGUIGameControl & control ) <nl> + : CGUIRenderHandle ( renderManager , RENDER_HANDLE : : CONTROL ) , m_control ( control ) <nl> { <nl> } <nl> <nl> / / mmm CGUIRenderFullScreenHandle mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - CGUIRenderFullScreenHandle : : CGUIRenderFullScreenHandle ( CGUIGameRenderManager & renderManager , CGameWindowFullScreen & window ) : <nl> - CGUIRenderHandle ( renderManager , RENDER_HANDLE : : WINDOW ) , <nl> - m_window ( window ) <nl> + CGUIRenderFullScreenHandle : : CGUIRenderFullScreenHandle ( CGUIGameRenderManager & renderManager , <nl> + CGameWindowFullScreen & window ) <nl> + : CGUIRenderHandle ( renderManager , RENDER_HANDLE : : WINDOW ) , m_window ( window ) <nl> { <nl> } <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIRenderHandle . h <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIRenderHandle . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CGameWindowFullScreen ; <nl> - class CGUIGameControl ; <nl> - class CGUIGameRenderManager ; <nl> - <nl> - enum class RENDER_HANDLE <nl> - { <nl> - CONTROL , <nl> - WINDOW , <nl> - } ; <nl> - <nl> - / / mmm CGUIRenderHandle mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> - <nl> - class CGUIRenderHandle <nl> - { <nl> - public : <nl> - CGUIRenderHandle ( CGUIGameRenderManager & renderManager , RENDER_HANDLE type ) ; <nl> - virtual ~ CGUIRenderHandle ( ) ; <nl> - <nl> - RENDER_HANDLE Type ( ) const { return m_type ; } <nl> - <nl> - void Render ( ) ; <nl> - void RenderEx ( ) ; <nl> - bool IsDirty ( ) ; <nl> - void ClearBackground ( ) ; <nl> - <nl> - private : <nl> - / / Construction parameters <nl> - CGUIGameRenderManager & m_renderManager ; <nl> - const RENDER_HANDLE m_type ; <nl> - } ; <nl> - <nl> - / / mmm CGUIRenderControlHandle mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - class CGUIRenderControlHandle : public CGUIRenderHandle <nl> - { <nl> - public : <nl> - CGUIRenderControlHandle ( CGUIGameRenderManager & renderManager , CGUIGameControl & control ) ; <nl> - ~ CGUIRenderControlHandle ( ) override = default ; <nl> - <nl> - CGUIGameControl & GetControl ( ) { return m_control ; } <nl> - <nl> - private : <nl> - / / Construction parameters <nl> - CGUIGameControl & m_control ; <nl> - } ; <nl> - <nl> - / / mmm CGUIRenderFullScreenHandle mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - class CGUIRenderFullScreenHandle : public CGUIRenderHandle <nl> - { <nl> - public : <nl> - CGUIRenderFullScreenHandle ( CGUIGameRenderManager & renderManager , CGameWindowFullScreen & window ) ; <nl> - ~ CGUIRenderFullScreenHandle ( ) override = default ; <nl> - <nl> - CGameWindowFullScreen & GetWindow ( ) { return m_window ; } <nl> - <nl> - private : <nl> - / / Construction parameters <nl> - CGameWindowFullScreen & m_window ; <nl> - } ; <nl> - } <nl> - } <nl> + class CGameWindowFullScreen ; <nl> + class CGUIGameControl ; <nl> + class CGUIGameRenderManager ; <nl> + <nl> + enum class RENDER_HANDLE <nl> + { <nl> + CONTROL , <nl> + WINDOW , <nl> + } ; <nl> + <nl> + / / mmm CGUIRenderHandle mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + <nl> + class CGUIRenderHandle <nl> + { <nl> + public : <nl> + CGUIRenderHandle ( CGUIGameRenderManager & renderManager , RENDER_HANDLE type ) ; <nl> + virtual ~ CGUIRenderHandle ( ) ; <nl> + <nl> + RENDER_HANDLE Type ( ) const { return m_type ; } <nl> + <nl> + void Render ( ) ; <nl> + void RenderEx ( ) ; <nl> + bool IsDirty ( ) ; <nl> + void ClearBackground ( ) ; <nl> + <nl> + private : <nl> + / / Construction parameters <nl> + CGUIGameRenderManager & m_renderManager ; <nl> + const RENDER_HANDLE m_type ; <nl> + } ; <nl> + <nl> + / / mmm CGUIRenderControlHandle mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + class CGUIRenderControlHandle : public CGUIRenderHandle <nl> + { <nl> + public : <nl> + CGUIRenderControlHandle ( CGUIGameRenderManager & renderManager , CGUIGameControl & control ) ; <nl> + ~ CGUIRenderControlHandle ( ) override = default ; <nl> + <nl> + CGUIGameControl & GetControl ( ) { return m_control ; } <nl> + <nl> + private : <nl> + / / Construction parameters <nl> + CGUIGameControl & m_control ; <nl> + } ; <nl> + <nl> + / / mmm CGUIRenderFullScreenHandle mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + class CGUIRenderFullScreenHandle : public CGUIRenderHandle <nl> + { <nl> + public : <nl> + CGUIRenderFullScreenHandle ( CGUIGameRenderManager & renderManager , CGameWindowFullScreen & window ) ; <nl> + ~ CGUIRenderFullScreenHandle ( ) override = default ; <nl> + <nl> + CGameWindowFullScreen & GetWindow ( ) { return m_window ; } <nl> + <nl> + private : <nl> + / / Construction parameters <nl> + CGameWindowFullScreen & m_window ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIRenderTarget . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIRenderTarget . cpp <nl> using namespace RETRO ; <nl> <nl> / / mmm CGUIRenderTarget mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> - CGUIRenderTarget : : CGUIRenderTarget ( IRenderManager * renderManager ) : <nl> - m_renderManager ( renderManager ) <nl> + CGUIRenderTarget : : CGUIRenderTarget ( IRenderManager * renderManager ) : m_renderManager ( renderManager ) <nl> { <nl> } <nl> <nl> / / mmm CGUIRenderControl mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - CGUIRenderControl : : CGUIRenderControl ( IRenderManager * renderManager , CGUIGameControl & gameControl ) : <nl> - CGUIRenderTarget ( renderManager ) , <nl> - m_gameControl ( gameControl ) <nl> + CGUIRenderControl : : CGUIRenderControl ( IRenderManager * renderManager , CGUIGameControl & gameControl ) <nl> + : CGUIRenderTarget ( renderManager ) , m_gameControl ( gameControl ) <nl> { <nl> } <nl> <nl> void CGUIRenderControl : : Render ( ) <nl> { <nl> - m_renderManager - > RenderControl ( true , true , m_gameControl . GetRenderRegion ( ) , m_gameControl . GetRenderSettings ( ) ) ; <nl> + m_renderManager - > RenderControl ( true , true , m_gameControl . GetRenderRegion ( ) , <nl> + m_gameControl . GetRenderSettings ( ) ) ; <nl> } <nl> <nl> void CGUIRenderControl : : RenderEx ( ) <nl> { <nl> / / ! @ todo <nl> - / / m_renderManager - > RenderControl ( false , false , m_gameControl . GetRenderRegion ( ) , m_gameControl . GetRenderSettings ( ) ) ; <nl> + / / m_renderManager - > RenderControl ( false , false , m_gameControl . GetRenderRegion ( ) , <nl> + / / m_gameControl . GetRenderSettings ( ) ) ; <nl> } <nl> <nl> / / mmm CGUIRenderFullScreen mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - CGUIRenderFullScreen : : CGUIRenderFullScreen ( IRenderManager * renderManager , CGameWindowFullScreen & window ) : <nl> - CGUIRenderTarget ( renderManager ) , <nl> - m_window ( window ) <nl> + CGUIRenderFullScreen : : CGUIRenderFullScreen ( IRenderManager * renderManager , <nl> + CGameWindowFullScreen & window ) <nl> + : CGUIRenderTarget ( renderManager ) , m_window ( window ) <nl> { <nl> } <nl> <nl> void CGUIRenderFullScreen : : Render ( ) <nl> void CGUIRenderFullScreen : : RenderEx ( ) <nl> { <nl> / / ! @ todo <nl> - / / m_renderManager - > RenderWindow ( false , m_window . GetCoordsRes ( ) ) ; <nl> + / / m_renderManager - > RenderWindow ( false , m_window . GetCoordsRes ( ) ) ; <nl> } <nl> <nl> void CGUIRenderFullScreen : : ClearBackground ( ) <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIRenderTarget . h <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIRenderTarget . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CGameWindowFullScreen ; <nl> - class CGUIGameControl ; <nl> - class IRenderManager ; <nl> + class CGameWindowFullScreen ; <nl> + class CGUIGameControl ; <nl> + class IRenderManager ; <nl> <nl> - / / mmm CGUIRenderTarget mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + / / mmm CGUIRenderTarget mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + <nl> + / * ! <nl> + * \ brief A target of rendering commands <nl> + * <nl> + * This class abstracts the destination of rendering commands . As a result , <nl> + * controls and windows are given a unified API . <nl> + * / <nl> + class CGUIRenderTarget <nl> + { <nl> + public : <nl> + CGUIRenderTarget ( IRenderManager * renderManager ) ; <nl> + <nl> + virtual ~ CGUIRenderTarget ( ) = default ; <nl> + <nl> + / * ! <nl> + * \ brief Draw the frame to the rendering area <nl> + * / <nl> + virtual void Render ( ) = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Draw the frame to the rendering area differently somehow <nl> + * / <nl> + virtual void RenderEx ( ) = 0 ; <nl> <nl> / * ! <nl> - * \ brief A target of rendering commands <nl> - * <nl> - * This class abstracts the destination of rendering commands . As a result , <nl> - * controls and windows are given a unified API . <nl> + * \ brief Clear the background of the rendering area <nl> * / <nl> - class CGUIRenderTarget <nl> - { <nl> - public : <nl> - CGUIRenderTarget ( IRenderManager * renderManager ) ; <nl> - <nl> - virtual ~ CGUIRenderTarget ( ) = default ; <nl> - <nl> - / * ! <nl> - * \ brief Draw the frame to the rendering area <nl> - * / <nl> - virtual void Render ( ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Draw the frame to the rendering area differently somehow <nl> - * / <nl> - virtual void RenderEx ( ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Clear the background of the rendering area <nl> - * / <nl> - virtual void ClearBackground ( ) { } / / ! @ todo <nl> - <nl> - / * ! <nl> - * \ brief Check of the rendering area is dirty <nl> - * / <nl> - virtual bool IsDirty ( ) { return true ; } / / ! @ todo <nl> - <nl> - protected : <nl> - / / Construction parameters <nl> - IRenderManager * const m_renderManager ; <nl> - } ; <nl> - <nl> - / / mmm CGUIRenderControl mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - class CGUIRenderControl : public CGUIRenderTarget <nl> - { <nl> - public : <nl> - CGUIRenderControl ( IRenderManager * renderManager , CGUIGameControl & gameControl ) ; <nl> - ~ CGUIRenderControl ( ) override = default ; <nl> - <nl> - / / implementation of CGUIRenderTarget <nl> - void Render ( ) override ; <nl> - void RenderEx ( ) override ; <nl> - <nl> - private : <nl> - / / Construction parameters <nl> - CGUIGameControl & m_gameControl ; <nl> - } ; <nl> - <nl> - / / mmm CGUIRenderFullScreen mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - class CGUIRenderFullScreen : public CGUIRenderTarget <nl> - { <nl> - public : <nl> - CGUIRenderFullScreen ( IRenderManager * renderManager , CGameWindowFullScreen & window ) ; <nl> - ~ CGUIRenderFullScreen ( ) override = default ; <nl> - <nl> - / / implementation of CGUIRenderTarget <nl> - void Render ( ) override ; <nl> - void RenderEx ( ) override ; <nl> - void ClearBackground ( ) override ; <nl> - <nl> - private : <nl> - / / Construction parameters <nl> - CGameWindowFullScreen & m_window ; <nl> - } ; <nl> - } <nl> - } <nl> + virtual void ClearBackground ( ) { } / / ! @ todo <nl> + <nl> + / * ! <nl> + * \ brief Check of the rendering area is dirty <nl> + * / <nl> + virtual bool IsDirty ( ) { return true ; } / / ! @ todo <nl> + <nl> + protected : <nl> + / / Construction parameters <nl> + IRenderManager * const m_renderManager ; <nl> + } ; <nl> + <nl> + / / mmm CGUIRenderControl mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + class CGUIRenderControl : public CGUIRenderTarget <nl> + { <nl> + public : <nl> + CGUIRenderControl ( IRenderManager * renderManager , CGUIGameControl & gameControl ) ; <nl> + ~ CGUIRenderControl ( ) override = default ; <nl> + <nl> + / / implementation of CGUIRenderTarget <nl> + void Render ( ) override ; <nl> + void RenderEx ( ) override ; <nl> + <nl> + private : <nl> + / / Construction parameters <nl> + CGUIGameControl & m_gameControl ; <nl> + } ; <nl> + <nl> + / / mmm CGUIRenderFullScreen mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + class CGUIRenderFullScreen : public CGUIRenderTarget <nl> + { <nl> + public : <nl> + CGUIRenderFullScreen ( IRenderManager * renderManager , CGameWindowFullScreen & window ) ; <nl> + ~ CGUIRenderFullScreen ( ) override = default ; <nl> + <nl> + / / implementation of CGUIRenderTarget <nl> + void Render ( ) override ; <nl> + void RenderEx ( ) override ; <nl> + void ClearBackground ( ) override ; <nl> + <nl> + private : <nl> + / / Construction parameters <nl> + CGameWindowFullScreen & m_window ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIRenderTargetFactory . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIRenderTargetFactory . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CGUIRenderTargetFactory : : CGUIRenderTargetFactory ( IRenderManager * renderManager ) : <nl> - m_renderManager ( renderManager ) <nl> + CGUIRenderTargetFactory : : CGUIRenderTargetFactory ( IRenderManager * renderManager ) <nl> + : m_renderManager ( renderManager ) <nl> { <nl> } <nl> <nl> - CGUIRenderTarget * CGUIRenderTargetFactory : : CreateRenderFullScreen ( CGameWindowFullScreen & window ) <nl> + CGUIRenderTarget * CGUIRenderTargetFactory : : CreateRenderFullScreen ( CGameWindowFullScreen & window ) <nl> { <nl> return new CGUIRenderFullScreen ( m_renderManager , window ) ; <nl> } <nl> <nl> - CGUIRenderTarget * CGUIRenderTargetFactory : : CreateRenderControl ( CGUIGameControl & gameControl ) <nl> + CGUIRenderTarget * CGUIRenderTargetFactory : : CreateRenderControl ( CGUIGameControl & gameControl ) <nl> { <nl> return new CGUIRenderControl ( m_renderManager , gameControl ) ; <nl> } <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / GUIRenderTargetFactory . h <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / GUIRenderTargetFactory . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CGameWindowFullScreen ; <nl> - class CGUIGameControl ; <nl> - class IRenderManager ; <nl> - class CGUIRenderTarget ; <nl> + class CGameWindowFullScreen ; <nl> + class CGUIGameControl ; <nl> + class IRenderManager ; <nl> + class CGUIRenderTarget ; <nl> <nl> - class CGUIRenderTargetFactory <nl> - { <nl> - public : <nl> - CGUIRenderTargetFactory ( IRenderManager * renderManager ) ; <nl> + class CGUIRenderTargetFactory <nl> + { <nl> + public : <nl> + CGUIRenderTargetFactory ( IRenderManager * renderManager ) ; <nl> <nl> - / * ! <nl> - * \ brief Create a render target for the fullscreen window <nl> - * / <nl> - CGUIRenderTarget * CreateRenderFullScreen ( CGameWindowFullScreen & window ) ; <nl> + / * ! <nl> + * \ brief Create a render target for the fullscreen window <nl> + * / <nl> + CGUIRenderTarget * CreateRenderFullScreen ( CGameWindowFullScreen & window ) ; <nl> <nl> - / * ! <nl> - * \ brief Create a render target for a game control <nl> - * / <nl> - CGUIRenderTarget * CreateRenderControl ( CGUIGameControl & gameControl ) ; <nl> + / * ! <nl> + * \ brief Create a render target for a game control <nl> + * / <nl> + CGUIRenderTarget * CreateRenderControl ( CGUIGameControl & gameControl ) ; <nl> <nl> - private : <nl> - / / Construction parameters <nl> - IRenderManager * m_renderManager ; <nl> - } ; <nl> - } <nl> - } <nl> + private : <nl> + / / Construction parameters <nl> + IRenderManager * m_renderManager ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / IGUIRenderSettings . h <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / IGUIRenderSettings . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> + / * ! <nl> + * \ brief Interface to pass render settings from the GUI to the renderer <nl> + * / <nl> + class IGUIRenderSettings <nl> + { <nl> + public : <nl> + virtual ~ IGUIRenderSettings ( ) = default ; <nl> + <nl> + / * ! <nl> + * \ brief Returns true if this render target has a video filter set <nl> + * / <nl> + virtual bool HasVideoFilter ( ) const { return true ; } <nl> + <nl> + / * ! <nl> + * \ brief Returns true if this render target has a stretch mode set <nl> + * / <nl> + virtual bool HasStretchMode ( ) const { return true ; } <nl> + <nl> + / * ! <nl> + * \ brief Returns true if this render target has a video rotation set <nl> + * / <nl> + virtual bool HasRotation ( ) const { return true ; } <nl> + <nl> + / * ! <nl> + * \ brief Get the settings used to render this target <nl> + * <nl> + * \ return The render settings <nl> + * / <nl> + virtual CRenderSettings GetSettings ( ) const = 0 ; <nl> + <nl> / * ! <nl> - * \ brief Interface to pass render settings from the GUI to the renderer <nl> + * \ brief Get the dimensions of this target <nl> + * <nl> + * Dimensions are ignored for fullscreen windows . <nl> + * <nl> + * \ return The destination dimensions , or unused for fullscreen window <nl> * / <nl> - class IGUIRenderSettings <nl> - { <nl> - public : <nl> - virtual ~ IGUIRenderSettings ( ) = default ; <nl> - <nl> - / * ! <nl> - * \ brief Returns true if this render target has a video filter set <nl> - * / <nl> - virtual bool HasVideoFilter ( ) const { return true ; } <nl> - <nl> - / * ! <nl> - * \ brief Returns true if this render target has a stretch mode set <nl> - * / <nl> - virtual bool HasStretchMode ( ) const { return true ; } <nl> - <nl> - / * ! <nl> - * \ brief Returns true if this render target has a video rotation set <nl> - * / <nl> - virtual bool HasRotation ( ) const { return true ; } <nl> - <nl> - / * ! <nl> - * \ brief Get the settings used to render this target <nl> - * <nl> - * \ return The render settings <nl> - * / <nl> - virtual CRenderSettings GetSettings ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Get the dimensions of this target <nl> - * <nl> - * Dimensions are ignored for fullscreen windows . <nl> - * <nl> - * \ return The destination dimensions , or unused for fullscreen window <nl> - * / <nl> - virtual CRect GetDimensions ( ) const { return CRect { } ; } <nl> - } ; <nl> - } <nl> - } <nl> + virtual CRect GetDimensions ( ) const { return CRect { } ; } <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / IGameCallback . h <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / IGameCallback . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class IGameCallback <nl> - { <nl> - public : <nl> - virtual ~ IGameCallback ( ) = default ; <nl> + class IGameCallback <nl> + { <nl> + public : <nl> + virtual ~ IGameCallback ( ) = default ; <nl> <nl> - / * ! <nl> - * \ brief Get the game client being used to play the game <nl> - * <nl> - * \ return The game client ' s ID , or empty if no game is being played <nl> - * / <nl> - virtual std : : string GameClientID ( ) const = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + / * ! <nl> + * \ brief Get the game client being used to play the game <nl> + * <nl> + * \ return The game client ' s ID , or empty if no game is being played <nl> + * / <nl> + virtual std : : string GameClientID ( ) const = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guibridge / IRenderCallback . h <nl> ppp b / xbmc / cores / RetroPlayer / guibridge / IRenderCallback . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class IRenderCallback <nl> - { <nl> - public : <nl> - virtual ~ IRenderCallback ( ) = default ; <nl> + class IRenderCallback <nl> + { <nl> + public : <nl> + virtual ~ IRenderCallback ( ) = default ; <nl> <nl> - virtual bool SupportsRenderFeature ( RENDERFEATURE feature ) const = 0 ; <nl> - virtual bool SupportsScalingMethod ( SCALINGMETHOD method ) const = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + virtual bool SupportsRenderFeature ( RENDERFEATURE feature ) const = 0 ; <nl> + virtual bool SupportsScalingMethod ( SCALINGMETHOD method ) const = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guicontrols / GUIGameControl . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guicontrols / GUIGameControl . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CGUIGameControl : : CGUIGameControl ( int parentID , int controlID , float posX , float posY , float width , float height ) : <nl> - CGUIControl ( parentID , controlID , posX , posY , width , height ) , <nl> - m_renderSettings ( new CGUIRenderSettings ( * this ) ) <nl> + CGUIGameControl : : CGUIGameControl ( <nl> + int parentID , int controlID , float posX , float posY , float width , float height ) <nl> + : CGUIControl ( parentID , controlID , posX , posY , width , height ) , <nl> + m_renderSettings ( new CGUIRenderSettings ( * this ) ) <nl> { <nl> / / Initialize CGUIControl <nl> ControlType = GUICONTROL_GAME ; <nl> CGUIGameControl : : CGUIGameControl ( int parentID , int controlID , float posX , float <nl> RegisterControl ( ) ; <nl> } <nl> <nl> - CGUIGameControl : : CGUIGameControl ( const CGUIGameControl & other ) : <nl> - CGUIControl ( other ) , <nl> - m_videoFilterInfo ( other . m_videoFilterInfo ) , <nl> - m_stretchModeInfo ( other . m_stretchModeInfo ) , <nl> - m_rotationInfo ( other . m_rotationInfo ) , <nl> - m_bHasVideoFilter ( other . m_bHasVideoFilter ) , <nl> - m_bHasStretchMode ( other . m_bHasStretchMode ) , <nl> - m_bHasRotation ( other . m_bHasRotation ) , <nl> - m_renderSettings ( new CGUIRenderSettings ( * this ) ) <nl> + CGUIGameControl : : CGUIGameControl ( const CGUIGameControl & other ) <nl> + : CGUIControl ( other ) , <nl> + m_videoFilterInfo ( other . m_videoFilterInfo ) , <nl> + m_stretchModeInfo ( other . m_stretchModeInfo ) , <nl> + m_rotationInfo ( other . m_rotationInfo ) , <nl> + m_bHasVideoFilter ( other . m_bHasVideoFilter ) , <nl> + m_bHasStretchMode ( other . m_bHasStretchMode ) , <nl> + m_bHasRotation ( other . m_bHasRotation ) , <nl> + m_renderSettings ( new CGUIRenderSettings ( * this ) ) <nl> { <nl> m_renderSettings - > SetSettings ( other . m_renderSettings - > GetSettings ( ) ) ; <nl> m_renderSettings - > SetDimensions ( CRect ( CPoint ( m_posX , m_posY ) , CSize ( m_width , m_height ) ) ) ; <nl> CGUIGameControl : : ~ CGUIGameControl ( ) <nl> UnregisterControl ( ) ; <nl> } <nl> <nl> - void CGUIGameControl : : SetVideoFilter ( const GUILIB : : GUIINFO : : CGUIInfoLabel & videoFilter ) <nl> + void CGUIGameControl : : SetVideoFilter ( const GUILIB : : GUIINFO : : CGUIInfoLabel & videoFilter ) <nl> { <nl> m_videoFilterInfo = videoFilter ; <nl> } <nl> <nl> - void CGUIGameControl : : SetStretchMode ( const GUILIB : : GUIINFO : : CGUIInfoLabel & stretchMode ) <nl> + void CGUIGameControl : : SetStretchMode ( const GUILIB : : GUIINFO : : CGUIInfoLabel & stretchMode ) <nl> { <nl> m_stretchModeInfo = stretchMode ; <nl> } <nl> <nl> - void CGUIGameControl : : SetRotation ( const KODI : : GUILIB : : GUIINFO : : CGUIInfoLabel & rotation ) <nl> + void CGUIGameControl : : SetRotation ( const KODI : : GUILIB : : GUIINFO : : CGUIInfoLabel & rotation ) <nl> { <nl> m_rotationInfo = rotation ; <nl> } <nl> <nl> - IGUIRenderSettings * CGUIGameControl : : GetRenderSettings ( ) const <nl> + IGUIRenderSettings * CGUIGameControl : : GetRenderSettings ( ) const <nl> { <nl> return m_renderSettings . get ( ) ; <nl> } <nl> <nl> - void CGUIGameControl : : Process ( unsigned int currentTime , CDirtyRegionList & dirtyregions ) <nl> + void CGUIGameControl : : Process ( unsigned int currentTime , CDirtyRegionList & dirtyregions ) <nl> { <nl> / / ! @ todo Proper processing which marks when its actually changed <nl> if ( m_renderHandle - > IsDirty ( ) ) <nl> void CGUIGameControl : : SetHeight ( float height ) <nl> m_renderSettings - > SetDimensions ( CRect ( CPoint ( m_posX , m_posY ) , CSize ( m_width , height ) ) ) ; <nl> } <nl> <nl> - void CGUIGameControl : : UpdateInfo ( const CGUIListItem * item / * = nullptr * / ) <nl> + void CGUIGameControl : : UpdateInfo ( const CGUIListItem * item / * = nullptr * / ) <nl> { <nl> Reset ( ) ; <nl> <nl> mmm a / xbmc / cores / RetroPlayer / guicontrols / GUIGameControl . h <nl> ppp b / xbmc / cores / RetroPlayer / guicontrols / GUIGameControl . h <nl> class CGUIGameControl : public CGUIControl <nl> { <nl> public : <nl> CGUIGameControl ( int parentID , int controlID , float posX , float posY , float width , float height ) ; <nl> - CGUIGameControl ( const CGUIGameControl & other ) ; <nl> + CGUIGameControl ( const CGUIGameControl & other ) ; <nl> ~ CGUIGameControl ( ) override ; <nl> <nl> / / GUI functions <nl> - void SetVideoFilter ( const KODI : : GUILIB : : GUIINFO : : CGUIInfoLabel & videoFilter ) ; <nl> - void SetStretchMode ( const KODI : : GUILIB : : GUIINFO : : CGUIInfoLabel & stretchMode ) ; <nl> - void SetRotation ( const KODI : : GUILIB : : GUIINFO : : CGUIInfoLabel & rotation ) ; <nl> + void SetVideoFilter ( const KODI : : GUILIB : : GUIINFO : : CGUIInfoLabel & videoFilter ) ; <nl> + void SetStretchMode ( const KODI : : GUILIB : : GUIINFO : : CGUIInfoLabel & stretchMode ) ; <nl> + void SetRotation ( const KODI : : GUILIB : : GUIINFO : : CGUIInfoLabel & rotation ) ; <nl> <nl> / / Rendering functions <nl> bool HasVideoFilter ( ) const { return m_bHasVideoFilter ; } <nl> bool HasStretchMode ( ) const { return m_bHasStretchMode ; } <nl> bool HasRotation ( ) const { return m_bHasRotation ; } <nl> - IGUIRenderSettings * GetRenderSettings ( ) const ; <nl> + IGUIRenderSettings * GetRenderSettings ( ) const ; <nl> <nl> / / implementation of CGUIControl <nl> - CGUIGameControl * Clone ( ) const override { return new CGUIGameControl ( * this ) ; } ; <nl> - void Process ( unsigned int currentTime , CDirtyRegionList & dirtyregions ) override ; <nl> + CGUIGameControl * Clone ( ) const override { return new CGUIGameControl ( * this ) ; } ; <nl> + void Process ( unsigned int currentTime , CDirtyRegionList & dirtyregions ) override ; <nl> void Render ( ) override ; <nl> void RenderEx ( ) override ; <nl> bool CanFocus ( ) const override ; <nl> void SetPosition ( float posX , float posY ) override ; <nl> void SetWidth ( float width ) override ; <nl> void SetHeight ( float height ) override ; <nl> - void UpdateInfo ( const CGUIListItem * item = nullptr ) override ; <nl> + void UpdateInfo ( const CGUIListItem * item = nullptr ) override ; <nl> <nl> private : <nl> void Reset ( ) ; <nl> class CGUIGameControl : public CGUIControl <nl> std : : shared_ptr < CGUIRenderHandle > m_renderHandle ; <nl> } ; <nl> <nl> - } <nl> - } <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guicontrols / GUIRenderSettings . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guicontrols / GUIRenderSettings . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CGUIRenderSettings : : CGUIRenderSettings ( CGUIGameControl & guiControl ) : <nl> - m_guiControl ( guiControl ) <nl> + CGUIRenderSettings : : CGUIRenderSettings ( CGUIGameControl & guiControl ) : m_guiControl ( guiControl ) <nl> { <nl> } <nl> <nl> void CGUIRenderSettings : : SetSettings ( CRenderSettings settings ) <nl> m_renderSettings = std : : move ( settings ) ; <nl> } <nl> <nl> - void CGUIRenderSettings : : SetDimensions ( const CRect & dimensions ) <nl> + void CGUIRenderSettings : : SetDimensions ( const CRect & dimensions ) <nl> { <nl> CSingleLock lock ( m_mutex ) ; <nl> <nl> m_renderDimensions = dimensions ; <nl> } <nl> <nl> - void CGUIRenderSettings : : SetVideoFilter ( const std : : string & videoFilter ) <nl> + void CGUIRenderSettings : : SetVideoFilter ( const std : : string & videoFilter ) <nl> { <nl> CSingleLock lock ( m_mutex ) ; <nl> <nl> mmm a / xbmc / cores / RetroPlayer / guicontrols / GUIRenderSettings . h <nl> ppp b / xbmc / cores / RetroPlayer / guicontrols / GUIRenderSettings . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CGUIGameControl ; <nl> - <nl> - class CGUIRenderSettings : public IGUIRenderSettings <nl> - { <nl> - public : <nl> - CGUIRenderSettings ( CGUIGameControl & guiControl ) ; <nl> - ~ CGUIRenderSettings ( ) override = default ; <nl> - <nl> - / / implementation of IGUIRenderSettings <nl> - bool HasVideoFilter ( ) const override ; <nl> - bool HasStretchMode ( ) const override ; <nl> - bool HasRotation ( ) const override ; <nl> - CRenderSettings GetSettings ( ) const override ; <nl> - CRect GetDimensions ( ) const override ; <nl> - <nl> - / / Render functions <nl> - void Reset ( ) ; <nl> - void SetSettings ( CRenderSettings settings ) ; <nl> - void SetDimensions ( const CRect & dimensions ) ; <nl> - void SetVideoFilter ( const std : : string & videoFilter ) ; <nl> - void SetStretchMode ( STRETCHMODE stretchMode ) ; <nl> - void SetRotationDegCCW ( unsigned int rotationDegCCW ) ; <nl> - <nl> - private : <nl> - / / Construction parameters <nl> - CGUIGameControl & m_guiControl ; <nl> - <nl> - / / Render parameters <nl> - CRenderSettings m_renderSettings ; <nl> - CRect m_renderDimensions ; <nl> - <nl> - / / Synchronization parameters <nl> - mutable CCriticalSection m_mutex ; <nl> - } ; <nl> - } <nl> - } <nl> + class CGUIGameControl ; <nl> + <nl> + class CGUIRenderSettings : public IGUIRenderSettings <nl> + { <nl> + public : <nl> + CGUIRenderSettings ( CGUIGameControl & guiControl ) ; <nl> + ~ CGUIRenderSettings ( ) override = default ; <nl> + <nl> + / / implementation of IGUIRenderSettings <nl> + bool HasVideoFilter ( ) const override ; <nl> + bool HasStretchMode ( ) const override ; <nl> + bool HasRotation ( ) const override ; <nl> + CRenderSettings GetSettings ( ) const override ; <nl> + CRect GetDimensions ( ) const override ; <nl> + <nl> + / / Render functions <nl> + void Reset ( ) ; <nl> + void SetSettings ( CRenderSettings settings ) ; <nl> + void SetDimensions ( const CRect & dimensions ) ; <nl> + void SetVideoFilter ( const std : : string & videoFilter ) ; <nl> + void SetStretchMode ( STRETCHMODE stretchMode ) ; <nl> + void SetRotationDegCCW ( unsigned int rotationDegCCW ) ; <nl> + <nl> + private : <nl> + / / Construction parameters <nl> + CGUIGameControl & m_guiControl ; <nl> + <nl> + / / Render parameters <nl> + CRenderSettings m_renderSettings ; <nl> + CRect m_renderDimensions ; <nl> + <nl> + / / Synchronization parameters <nl> + mutable CCriticalSection m_mutex ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guiplayback / GUIPlaybackControl . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guiplayback / GUIPlaybackControl . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CGUIPlaybackControl : : CGUIPlaybackControl ( IPlaybackCallback & callback ) : <nl> - m_callback ( callback ) <nl> + CGUIPlaybackControl : : CGUIPlaybackControl ( IPlaybackCallback & callback ) : m_callback ( callback ) <nl> { <nl> } <nl> <nl> CGUIPlaybackControl : : ~ CGUIPlaybackControl ( ) = default ; <nl> <nl> void CGUIPlaybackControl : : FrameMove ( ) <nl> { <nl> - CGUIComponent * gui = CServiceBroker : : GetGUI ( ) ; <nl> + CGUIComponent * gui = CServiceBroker : : GetGUI ( ) ; <nl> if ( gui = = nullptr ) <nl> return ; <nl> <nl> void CGUIPlaybackControl : : FrameMove ( ) <nl> } <nl> } <nl> <nl> - CGUIPlaybackControl : : GuiState CGUIPlaybackControl : : NextState ( bool bFullscreen , bool bInMenu , bool bInBackground ) <nl> + CGUIPlaybackControl : : GuiState CGUIPlaybackControl : : NextState ( bool bFullscreen , <nl> + bool bInMenu , <nl> + bool bInBackground ) <nl> { <nl> GuiState newState = m_state ; <nl> <nl> switch ( m_state ) <nl> { <nl> - case GuiState : : UNKNOWN : <nl> - { <nl> - / / Wait for game to enter fullscreen <nl> - if ( bFullscreen ) <nl> - newState = GuiState : : FULLSCREEN ; <nl> - break ; <nl> - } <nl> - case GuiState : : FULLSCREEN : <nl> - { <nl> - if ( bInMenu ) <nl> + case GuiState : : UNKNOWN : <nl> { <nl> - if ( bInBackground ) <nl> - newState = GuiState : : MENU_PLAYING ; <nl> - else <nl> - newState = GuiState : : MENU_PAUSED ; <nl> + / / Wait for game to enter fullscreen <nl> + if ( bFullscreen ) <nl> + newState = GuiState : : FULLSCREEN ; <nl> + break ; <nl> } <nl> - break ; <nl> - } <nl> - case GuiState : : MENU_PAUSED : <nl> - { <nl> - if ( ! bInMenu ) <nl> - newState = GuiState : : FULLSCREEN ; <nl> - else if ( bInBackground ) <nl> - newState = GuiState : : MENU_PLAYING ; <nl> - break ; <nl> - } <nl> - case GuiState : : MENU_PLAYING : <nl> - { <nl> - if ( ! bInBackground ) <nl> + case GuiState : : FULLSCREEN : <nl> + { <nl> + if ( bInMenu ) <nl> + { <nl> + if ( bInBackground ) <nl> + newState = GuiState : : MENU_PLAYING ; <nl> + else <nl> + newState = GuiState : : MENU_PAUSED ; <nl> + } <nl> + break ; <nl> + } <nl> + case GuiState : : MENU_PAUSED : <nl> { <nl> if ( ! bInMenu ) <nl> newState = GuiState : : FULLSCREEN ; <nl> - else <nl> - newState = GuiState : : MENU_PAUSED ; <nl> + else if ( bInBackground ) <nl> + newState = GuiState : : MENU_PLAYING ; <nl> + break ; <nl> } <nl> - break ; <nl> - } <nl> - default : <nl> - break ; <nl> + case GuiState : : MENU_PLAYING : <nl> + { <nl> + if ( ! bInBackground ) <nl> + { <nl> + if ( ! bInMenu ) <nl> + newState = GuiState : : FULLSCREEN ; <nl> + else <nl> + newState = GuiState : : MENU_PAUSED ; <nl> + } <nl> + break ; <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> <nl> return newState ; <nl> double CGUIPlaybackControl : : GetTargetSpeed ( GuiState state ) <nl> <nl> switch ( state ) <nl> { <nl> - case GuiState : : FULLSCREEN : <nl> - { <nl> - targetSpeed = 1 . 0 ; <nl> - break ; <nl> - } <nl> - case GuiState : : MENU_PAUSED : <nl> - { <nl> - targetSpeed = 0 . 0 ; <nl> - break ; <nl> - } <nl> - case GuiState : : MENU_PLAYING : <nl> - { <nl> - targetSpeed = 1 . 0 ; <nl> - break ; <nl> - } <nl> - default : <nl> - break ; <nl> + case GuiState : : FULLSCREEN : <nl> + { <nl> + targetSpeed = 1 . 0 ; <nl> + break ; <nl> + } <nl> + case GuiState : : MENU_PAUSED : <nl> + { <nl> + targetSpeed = 0 . 0 ; <nl> + break ; <nl> + } <nl> + case GuiState : : MENU_PLAYING : <nl> + { <nl> + targetSpeed = 1 . 0 ; <nl> + break ; <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> <nl> return targetSpeed ; <nl> mmm a / xbmc / cores / RetroPlayer / guiplayback / GUIPlaybackControl . h <nl> ppp b / xbmc / cores / RetroPlayer / guiplayback / GUIPlaybackControl . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - / * ! <nl> - * \ brief Class to control playback by monitoring OSD status <nl> - * / <nl> - class CGUIPlaybackControl : public IPlaybackControl <nl> + / * ! <nl> + * \ brief Class to control playback by monitoring OSD status <nl> + * / <nl> + class CGUIPlaybackControl : public IPlaybackControl <nl> + { <nl> + public : <nl> + CGUIPlaybackControl ( IPlaybackCallback & callback ) ; <nl> + <nl> + ~ CGUIPlaybackControl ( ) override ; <nl> + <nl> + / / Implementation of IPlaybackControl <nl> + void FrameMove ( ) override ; <nl> + <nl> + private : <nl> + enum class GuiState <nl> { <nl> - public : <nl> - CGUIPlaybackControl ( IPlaybackCallback & callback ) ; <nl> - <nl> - ~ CGUIPlaybackControl ( ) override ; <nl> - <nl> - / / Implementation of IPlaybackControl <nl> - void FrameMove ( ) override ; <nl> - <nl> - private : <nl> - enum class GuiState <nl> - { <nl> - UNKNOWN , <nl> - FULLSCREEN , <nl> - MENU_PAUSED , <nl> - MENU_PLAYING , <nl> - } ; <nl> - <nl> - / / Helper functions <nl> - GuiState NextState ( bool bFullscreen , bool bInMenu , bool bInBackground ) ; <nl> - static double GetTargetSpeed ( GuiState state ) ; <nl> - static bool AcceptsInput ( GuiState state ) ; <nl> - <nl> - / / Construction parameters <nl> - IPlaybackCallback & m_callback ; <nl> - <nl> - / / State parameters <nl> - GuiState m_state = GuiState : : UNKNOWN ; <nl> - double m_previousSpeed = 0 . 0 ; <nl> + UNKNOWN , <nl> + FULLSCREEN , <nl> + MENU_PAUSED , <nl> + MENU_PLAYING , <nl> } ; <nl> - } <nl> - } <nl> + <nl> + / / Helper functions <nl> + GuiState NextState ( bool bFullscreen , bool bInMenu , bool bInBackground ) ; <nl> + static double GetTargetSpeed ( GuiState state ) ; <nl> + static bool AcceptsInput ( GuiState state ) ; <nl> + <nl> + / / Construction parameters <nl> + IPlaybackCallback & m_callback ; <nl> + <nl> + / / State parameters <nl> + GuiState m_state = GuiState : : UNKNOWN ; <nl> + double m_previousSpeed = 0 . 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guiwindows / GameWindowFullScreen . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guiwindows / GameWindowFullScreen . cpp <nl> using namespace KODI ; <nl> using namespace KODI : : GUILIB ; <nl> using namespace RETRO ; <nl> <nl> - CGameWindowFullScreen : : CGameWindowFullScreen ( void ) : <nl> - CGUIWindow ( WINDOW_FULLSCREEN_GAME , " VideoFullScreen . xml " ) , <nl> - m_fullscreenText ( new CGameWindowFullScreenText ( * this ) ) <nl> + CGameWindowFullScreen : : CGameWindowFullScreen ( void ) <nl> + : CGUIWindow ( WINDOW_FULLSCREEN_GAME , " VideoFullScreen . xml " ) , <nl> + m_fullscreenText ( new CGameWindowFullScreenText ( * this ) ) <nl> { <nl> / / initialize CGUIControl <nl> m_controlStats = new GUICONTROLSTATS ; <nl> CGameWindowFullScreen : : ~ CGameWindowFullScreen ( ) <nl> delete m_controlStats ; <nl> } <nl> <nl> - void CGameWindowFullScreen : : Process ( unsigned int currentTime , CDirtyRegionList & dirtyregion ) <nl> + void CGameWindowFullScreen : : Process ( unsigned int currentTime , CDirtyRegionList & dirtyregion ) <nl> { <nl> if ( m_renderHandle - > IsDirty ( ) ) <nl> MarkDirtyRegion ( ) ; <nl> void CGameWindowFullScreen : : Process ( unsigned int currentTime , CDirtyRegionList & <nl> <nl> / / ! @ todo This isn ' t quite optimal - ideally we ' d only be dirtying up the actual video render rect <nl> / / ! which is probably the job of the renderer as it can more easily track resizing etc . <nl> - m_renderRegion . SetRect ( 0 , 0 , static_cast < float > ( CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetWidth ( ) ) , static_cast < float > ( CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetHeight ( ) ) ) ; <nl> + m_renderRegion . SetRect ( <nl> + 0 , 0 , static_cast < float > ( CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetWidth ( ) ) , <nl> + static_cast < float > ( CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetHeight ( ) ) ) ; <nl> } <nl> <nl> void CGameWindowFullScreen : : Render ( ) <nl> void CGameWindowFullScreen : : RenderEx ( ) <nl> m_renderHandle - > RenderEx ( ) ; <nl> } <nl> <nl> - bool CGameWindowFullScreen : : OnAction ( const CAction & action ) <nl> + bool CGameWindowFullScreen : : OnAction ( const CAction & action ) <nl> { <nl> switch ( action . GetID ( ) ) <nl> { <nl> - case ACTION_SHOW_OSD : <nl> - case ACTION_TRIGGER_OSD : <nl> - { <nl> - TriggerOSD ( ) ; <nl> - return true ; <nl> - } <nl> - case ACTION_MOUSE_MOVE : <nl> - { <nl> - if ( action . GetAmount ( 2 ) | | action . GetAmount ( 3 ) ) <nl> + case ACTION_SHOW_OSD : <nl> + case ACTION_TRIGGER_OSD : <nl> { <nl> TriggerOSD ( ) ; <nl> return true ; <nl> } <nl> - break ; <nl> - } <nl> - case ACTION_MOUSE_LEFT_CLICK : <nl> - { <nl> - TriggerOSD ( ) ; <nl> - return true ; <nl> - } <nl> - case ACTION_SHOW_GUI : <nl> - { <nl> - / / Switch back to the menu <nl> - CServiceBroker : : GetGUI ( ) - > GetWindowManager ( ) . PreviousWindow ( ) ; <nl> - return true ; <nl> - } <nl> - case ACTION_ASPECT_RATIO : <nl> - { <nl> - / / Toggle the aspect ratio mode ( only if the info is onscreen ) <nl> - / / g_application . GetAppPlayer ( ) . SetRenderViewMode ( CViewModeSettings : : GetNextQuickCycleViewMode ( CMediaSettings : : GetInstance ( ) . GetCurrentVideoSettings ( ) . m_ViewMode ) ) ; <nl> - return true ; <nl> - } <nl> - default : <nl> - break ; <nl> + case ACTION_MOUSE_MOVE : <nl> + { <nl> + if ( action . GetAmount ( 2 ) | | action . GetAmount ( 3 ) ) <nl> + { <nl> + TriggerOSD ( ) ; <nl> + return true ; <nl> + } <nl> + break ; <nl> + } <nl> + case ACTION_MOUSE_LEFT_CLICK : <nl> + { <nl> + TriggerOSD ( ) ; <nl> + return true ; <nl> + } <nl> + case ACTION_SHOW_GUI : <nl> + { <nl> + / / Switch back to the menu <nl> + CServiceBroker : : GetGUI ( ) - > GetWindowManager ( ) . PreviousWindow ( ) ; <nl> + return true ; <nl> + } <nl> + case ACTION_ASPECT_RATIO : <nl> + { <nl> + / / Toggle the aspect ratio mode ( only if the info is onscreen ) <nl> + / / g_application . GetAppPlayer ( ) . SetRenderViewMode ( CViewModeSettings : : GetNextQuickCycleViewMode ( CMediaSettings : : GetInstance ( ) . GetCurrentVideoSettings ( ) . m_ViewMode ) ) ; <nl> + return true ; <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> <nl> return CGUIWindow : : OnAction ( action ) ; <nl> bool CGameWindowFullScreen : : OnMessage ( CGUIMessage & message ) <nl> { <nl> switch ( message . GetMessage ( ) ) <nl> { <nl> - case GUI_MSG_SETFOCUS : <nl> - case GUI_MSG_LOSTFOCUS : <nl> - { <nl> - if ( message . GetSenderId ( ) ! = WINDOW_FULLSCREEN_GAME ) <nl> - return true ; <nl> - break ; <nl> - } <nl> - default : <nl> - break ; <nl> + case GUI_MSG_SETFOCUS : <nl> + case GUI_MSG_LOSTFOCUS : <nl> + { <nl> + if ( message . GetSenderId ( ) ! = WINDOW_FULLSCREEN_GAME ) <nl> + return true ; <nl> + break ; <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> <nl> return CGUIWindow : : OnMessage ( message ) ; <nl> void CGameWindowFullScreen : : OnWindowLoaded ( ) <nl> <nl> void CGameWindowFullScreen : : OnInitWindow ( ) <nl> { <nl> - GUIINFO : : CPlayerGUIInfo & guiInfo = CServiceBroker : : GetGUI ( ) - > GetInfoManager ( ) . GetInfoProviders ( ) . GetPlayerInfoProvider ( ) ; <nl> + GUIINFO : : CPlayerGUIInfo & guiInfo = <nl> + CServiceBroker : : GetGUI ( ) - > GetInfoManager ( ) . GetInfoProviders ( ) . GetPlayerInfoProvider ( ) ; <nl> guiInfo . SetShowInfo ( false ) ; <nl> guiInfo . SetDisplayAfterSeek ( 0 ) ; / / Make sure display after seek is off <nl> <nl> void CGameWindowFullScreen : : OnInitWindow ( ) <nl> CGUIWindow : : OnInitWindow ( ) ; <nl> <nl> / / Show OSD help <nl> - GAME : : CGameSettings & gameSettings = CServiceBroker : : GetGameServices ( ) . GameSettings ( ) ; <nl> + GAME : : CGameSettings & gameSettings = CServiceBroker : : GetGameServices ( ) . GameSettings ( ) ; <nl> if ( gameSettings . ShowOSDHelp ( ) ) <nl> TriggerOSD ( ) ; <nl> else <nl> void CGameWindowFullScreen : : OnDeinitWindow ( int nextWindowID ) <nl> <nl> void CGameWindowFullScreen : : TriggerOSD ( ) <nl> { <nl> - CGUIDialog * pOSD = GetOSD ( ) ; <nl> + CGUIDialog * pOSD = GetOSD ( ) ; <nl> if ( pOSD ! = nullptr ) <nl> { <nl> if ( ! pOSD - > IsDialogRunning ( ) ) <nl> void CGameWindowFullScreen : : TriggerOSD ( ) <nl> } <nl> } <nl> <nl> - CGUIDialog * CGameWindowFullScreen : : GetOSD ( ) <nl> + CGUIDialog * CGameWindowFullScreen : : GetOSD ( ) <nl> { <nl> return CServiceBroker : : GetGUI ( ) - > GetWindowManager ( ) . GetDialog ( WINDOW_DIALOG_GAME_OSD ) ; <nl> } <nl> mmm a / xbmc / cores / RetroPlayer / guiwindows / GameWindowFullScreen . h <nl> ppp b / xbmc / cores / RetroPlayer / guiwindows / GameWindowFullScreen . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CGameWindowFullScreenText ; <nl> - class CGUIRenderHandle ; <nl> - <nl> - class CGameWindowFullScreen : public CGUIWindow <nl> - { <nl> - public : <nl> - CGameWindowFullScreen ( ) ; <nl> - ~ CGameWindowFullScreen ( ) override ; <nl> - <nl> - / / implementation of CGUIControl via CGUIWindow <nl> - void Process ( unsigned int currentTime , CDirtyRegionList & dirtyregion ) override ; <nl> - void Render ( ) override ; <nl> - void RenderEx ( ) override ; <nl> - bool OnAction ( const CAction & action ) override ; <nl> - bool OnMessage ( CGUIMessage & message ) override ; <nl> - <nl> - / / implementation of CGUIWindow <nl> - void FrameMove ( ) override ; <nl> - void ClearBackground ( ) override ; <nl> - bool HasVisibleControls ( ) override ; <nl> - void OnWindowLoaded ( ) override ; <nl> - void OnDeinitWindow ( int nextWindowID ) override ; <nl> - <nl> - protected : <nl> - / / implementation of CGUIWindow <nl> - void OnInitWindow ( ) override ; <nl> - <nl> - private : <nl> - void TriggerOSD ( ) ; <nl> - CGUIDialog * GetOSD ( ) ; <nl> - <nl> - void RegisterWindow ( ) ; <nl> - void UnregisterWindow ( ) ; <nl> - <nl> - / / GUI parameters <nl> - std : : unique_ptr < CGameWindowFullScreenText > m_fullscreenText ; <nl> - <nl> - / / Rendering parameters <nl> - std : : shared_ptr < CGUIRenderHandle > m_renderHandle ; <nl> - } ; <nl> - } <nl> - } <nl> + class CGameWindowFullScreenText ; <nl> + class CGUIRenderHandle ; <nl> + <nl> + class CGameWindowFullScreen : public CGUIWindow <nl> + { <nl> + public : <nl> + CGameWindowFullScreen ( ) ; <nl> + ~ CGameWindowFullScreen ( ) override ; <nl> + <nl> + / / implementation of CGUIControl via CGUIWindow <nl> + void Process ( unsigned int currentTime , CDirtyRegionList & dirtyregion ) override ; <nl> + void Render ( ) override ; <nl> + void RenderEx ( ) override ; <nl> + bool OnAction ( const CAction & action ) override ; <nl> + bool OnMessage ( CGUIMessage & message ) override ; <nl> + <nl> + / / implementation of CGUIWindow <nl> + void FrameMove ( ) override ; <nl> + void ClearBackground ( ) override ; <nl> + bool HasVisibleControls ( ) override ; <nl> + void OnWindowLoaded ( ) override ; <nl> + void OnDeinitWindow ( int nextWindowID ) override ; <nl> + <nl> + protected : <nl> + / / implementation of CGUIWindow <nl> + void OnInitWindow ( ) override ; <nl> + <nl> + private : <nl> + void TriggerOSD ( ) ; <nl> + CGUIDialog * GetOSD ( ) ; <nl> + <nl> + void RegisterWindow ( ) ; <nl> + void UnregisterWindow ( ) ; <nl> + <nl> + / / GUI parameters <nl> + std : : unique_ptr < CGameWindowFullScreenText > m_fullscreenText ; <nl> + <nl> + / / Rendering parameters <nl> + std : : shared_ptr < CGUIRenderHandle > m_renderHandle ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / guiwindows / GameWindowFullScreenText . cpp <nl> ppp b / xbmc / cores / RetroPlayer / guiwindows / GameWindowFullScreenText . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CGameWindowFullScreenText : : CGameWindowFullScreenText ( CGUIWindow & fullscreenWindow ) : <nl> - m_fullscreenWindow ( fullscreenWindow ) <nl> + CGameWindowFullScreenText : : CGameWindowFullScreenText ( CGUIWindow & fullscreenWindow ) <nl> + : m_fullscreenWindow ( fullscreenWindow ) <nl> { <nl> } <nl> <nl> void CGameWindowFullScreenText : : FrameMove ( ) <nl> } <nl> } <nl> <nl> - const std : : string & CGameWindowFullScreenText : : GetText ( unsigned int lineIndex ) const <nl> + const std : : string & CGameWindowFullScreenText : : GetText ( unsigned int lineIndex ) const <nl> { <nl> if ( lineIndex < m_lines . size ( ) ) <nl> return m_lines [ lineIndex ] ; <nl> void CGameWindowFullScreenText : : SetText ( unsigned int lineIndex , std : : string line <nl> m_lines [ lineIndex ] = std : : move ( line ) ; <nl> } <nl> <nl> - const std : : vector < std : : string > & CGameWindowFullScreenText : : GetText ( ) const <nl> + const std : : vector < std : : string > & CGameWindowFullScreenText : : GetText ( ) const <nl> { <nl> return m_lines ; <nl> } <nl> int CGameWindowFullScreenText : : GetID ( ) const <nl> return m_fullscreenWindow . GetID ( ) ; <nl> } <nl> <nl> - bool CGameWindowFullScreenText : : OnMessage ( CGUIMessage & message ) <nl> + bool CGameWindowFullScreenText : : OnMessage ( CGUIMessage & message ) <nl> { <nl> return m_fullscreenWindow . OnMessage ( message ) ; <nl> } <nl> int CGameWindowFullScreenText : : GetControlID ( unsigned int lineIndex ) <nl> { <nl> switch ( lineIndex ) <nl> { <nl> - case 0 : return LABEL_ROW1 ; <nl> - case 1 : return LABEL_ROW2 ; <nl> - case 2 : return LABEL_ROW3 ; <nl> - default : <nl> - break ; <nl> + case 0 : <nl> + return LABEL_ROW1 ; <nl> + case 1 : <nl> + return LABEL_ROW2 ; <nl> + case 2 : <nl> + return LABEL_ROW3 ; <nl> + default : <nl> + break ; <nl> } <nl> <nl> return - 1 ; <nl> mmm a / xbmc / cores / RetroPlayer / guiwindows / GameWindowFullScreenText . h <nl> ppp b / xbmc / cores / RetroPlayer / guiwindows / GameWindowFullScreenText . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CGameWindowFullScreenText <nl> - { <nl> - public : <nl> - CGameWindowFullScreenText ( CGUIWindow & fullscreenWindow ) ; <nl> - ~ CGameWindowFullScreenText ( ) = default ; <nl> + class CGameWindowFullScreenText <nl> + { <nl> + public : <nl> + CGameWindowFullScreenText ( CGUIWindow & fullscreenWindow ) ; <nl> + ~ CGameWindowFullScreenText ( ) = default ; <nl> <nl> - / / Window functions <nl> - void OnWindowLoaded ( ) ; <nl> - void FrameMove ( ) ; <nl> + / / Window functions <nl> + void OnWindowLoaded ( ) ; <nl> + void FrameMove ( ) ; <nl> <nl> - / * ! <nl> - * \ brief Get a line of text <nl> - * / <nl> - const std : : string & GetText ( unsigned int lineIndex ) const ; <nl> + / * ! <nl> + * \ brief Get a line of text <nl> + * / <nl> + const std : : string & GetText ( unsigned int lineIndex ) const ; <nl> <nl> - / * ! <nl> - * \ brief Set a line of text <nl> - * / <nl> - void SetText ( unsigned int lineIndex , std : : string line ) ; <nl> + / * ! <nl> + * \ brief Set a line of text <nl> + * / <nl> + void SetText ( unsigned int lineIndex , std : : string line ) ; <nl> <nl> - / * ! <nl> - * \ brief Get entire text <nl> - * / <nl> - const std : : vector < std : : string > & GetText ( ) const ; <nl> + / * ! <nl> + * \ brief Get entire text <nl> + * / <nl> + const std : : vector < std : : string > & GetText ( ) const ; <nl> <nl> - / * ! <nl> - * \ brief Set entire text <nl> - * / <nl> - void SetText ( std : : vector < std : : string > text ) ; <nl> + / * ! <nl> + * \ brief Set entire text <nl> + * / <nl> + void SetText ( std : : vector < std : : string > text ) ; <nl> <nl> - private : <nl> - / / Window functions <nl> - void UploadText ( ) ; <nl> - void Show ( ) ; <nl> - void Hide ( ) ; <nl> + private : <nl> + / / Window functions <nl> + void UploadText ( ) ; <nl> + void Show ( ) ; <nl> + void Hide ( ) ; <nl> <nl> - / * ! <nl> - * \ brief Translate line index to the control ID in the skin <nl> - * <nl> - * \ param lineIndex The line in the string vector <nl> - * <nl> - * \ return The ID of the line ' s label control in the skin <nl> - * / <nl> - static int GetControlID ( unsigned int lineIndex ) ; <nl> + / * ! <nl> + * \ brief Translate line index to the control ID in the skin <nl> + * <nl> + * \ param lineIndex The line in the string vector <nl> + * <nl> + * \ return The ID of the line ' s label control in the skin <nl> + * / <nl> + static int GetControlID ( unsigned int lineIndex ) ; <nl> <nl> - / / Window functions required by GUIMessage macros <nl> - / / ! @ todo Change macros into functions <nl> - int GetID ( ) const ; <nl> - bool OnMessage ( CGUIMessage & message ) ; <nl> + / / Window functions required by GUIMessage macros <nl> + / / ! @ todo Change macros into functions <nl> + int GetID ( ) const ; <nl> + bool OnMessage ( CGUIMessage & message ) ; <nl> <nl> - / / Construction parameters <nl> - CGUIWindow & m_fullscreenWindow ; <nl> + / / Construction parameters <nl> + CGUIWindow & m_fullscreenWindow ; <nl> <nl> - / / Window state <nl> - bool m_bShowText = false ; <nl> - bool m_bTextChanged = true ; <nl> - bool m_bTextVisibilityChanged = true ; <nl> + / / Window state <nl> + bool m_bShowText = false ; <nl> + bool m_bTextChanged = true ; <nl> + bool m_bTextVisibilityChanged = true ; <nl> <nl> - / / Text <nl> - std : : vector < std : : string > m_lines ; <nl> - } ; <nl> - } <nl> - } <nl> + / / Text <nl> + std : : vector < std : : string > m_lines ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / playback / GameLoop . cpp <nl> ppp b / xbmc / cores / RetroPlayer / playback / GameLoop . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - # define DEFAULT_FPS 60 / / In case fps is 0 ( shouldn ' t happen ) <nl> - # define FOREVER_MS ( 7 * 24 * 60 * 60 * 1000 ) / / 1 week is large enough <nl> - <nl> - CGameLoop : : CGameLoop ( IGameLoopCallback * callback , double fps ) : <nl> - CThread ( " GameLoop " ) , <nl> - m_callback ( callback ) , <nl> - m_fps ( fps ? fps : DEFAULT_FPS ) , <nl> - m_speedFactor ( 0 . 0 ) , <nl> - m_lastFrameMs ( 0 . 0 ) , <nl> - m_adjustTime ( 0 . 0 ) <nl> + # define DEFAULT_FPS 60 / / In case fps is 0 ( shouldn ' t happen ) <nl> + # define FOREVER_MS ( 7 * 24 * 60 * 60 * 1000 ) / / 1 week is large enough <nl> + <nl> + CGameLoop : : CGameLoop ( IGameLoopCallback * callback , double fps ) <nl> + : CThread ( " GameLoop " ) , <nl> + m_callback ( callback ) , <nl> + m_fps ( fps ? fps : DEFAULT_FPS ) , <nl> + m_speedFactor ( 0 . 0 ) , <nl> + m_lastFrameMs ( 0 . 0 ) , <nl> + m_adjustTime ( 0 . 0 ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / playback / GameLoop . h <nl> ppp b / xbmc / cores / RetroPlayer / playback / GameLoop . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class IGameLoopCallback <nl> - { <nl> - public : <nl> - virtual ~ IGameLoopCallback ( ) = default ; <nl> + class IGameLoopCallback <nl> + { <nl> + public : <nl> + virtual ~ IGameLoopCallback ( ) = default ; <nl> <nl> - / * ! <nl> - * \ brief The next frame is being shown <nl> - * / <nl> - virtual void FrameEvent ( ) = 0 ; <nl> + / * ! <nl> + * \ brief The next frame is being shown <nl> + * / <nl> + virtual void FrameEvent ( ) = 0 ; <nl> <nl> - / * ! <nl> - * \ brief The prior frame is being shown <nl> - * / <nl> - virtual void RewindEvent ( ) = 0 ; <nl> - } ; <nl> + / * ! <nl> + * \ brief The prior frame is being shown <nl> + * / <nl> + virtual void RewindEvent ( ) = 0 ; <nl> + } ; <nl> <nl> - class CGameLoop : protected CThread <nl> - { <nl> - public : <nl> - CGameLoop ( IGameLoopCallback * callback , double fps ) ; <nl> + class CGameLoop : protected CThread <nl> + { <nl> + public : <nl> + CGameLoop ( IGameLoopCallback * callback , double fps ) ; <nl> <nl> - ~ CGameLoop ( ) override ; <nl> + ~ CGameLoop ( ) override ; <nl> <nl> - void Start ( ) ; <nl> - void Stop ( ) ; <nl> + void Start ( ) ; <nl> + void Stop ( ) ; <nl> <nl> - double FPS ( ) const { return m_fps ; } <nl> + double FPS ( ) const { return m_fps ; } <nl> <nl> - double GetSpeed ( ) const { return m_speedFactor ; } <nl> - void SetSpeed ( double speedFactor ) ; <nl> - void PauseAsync ( ) ; <nl> + double GetSpeed ( ) const { return m_speedFactor ; } <nl> + void SetSpeed ( double speedFactor ) ; <nl> + void PauseAsync ( ) ; <nl> <nl> - protected : <nl> - / / implementation of CThread <nl> - void Process ( ) override ; <nl> + protected : <nl> + / / implementation of CThread <nl> + void Process ( ) override ; <nl> <nl> - private : <nl> - double FrameTimeMs ( ) const ; <nl> - double SleepTimeMs ( ) const ; <nl> - double NowMs ( ) const ; <nl> + private : <nl> + double FrameTimeMs ( ) const ; <nl> + double SleepTimeMs ( ) const ; <nl> + double NowMs ( ) const ; <nl> <nl> - IGameLoopCallback * const m_callback ; <nl> - const double m_fps ; <nl> - std : : atomic < double > m_speedFactor ; <nl> - double m_lastFrameMs ; <nl> - mutable double m_adjustTime ; <nl> - CEvent m_sleepEvent ; <nl> - } ; <nl> - } <nl> - } <nl> + IGameLoopCallback * const m_callback ; <nl> + const double m_fps ; <nl> + std : : atomic < double > m_speedFactor ; <nl> + double m_lastFrameMs ; <nl> + mutable double m_adjustTime ; <nl> + CEvent m_sleepEvent ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / playback / IPlayback . h <nl> ppp b / xbmc / cores / RetroPlayer / playback / IPlayback . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class IPlayback <nl> - { <nl> - public : <nl> - virtual ~ IPlayback ( ) = default ; <nl> + class IPlayback <nl> + { <nl> + public : <nl> + virtual ~ IPlayback ( ) = default ; <nl> <nl> - / / Lifetime management <nl> - virtual void Initialize ( ) = 0 ; <nl> - virtual void Deinitialize ( ) = 0 ; <nl> + / / Lifetime management <nl> + virtual void Initialize ( ) = 0 ; <nl> + virtual void Deinitialize ( ) = 0 ; <nl> <nl> - / / Playback capabilities <nl> - virtual bool CanPause ( ) const = 0 ; <nl> - virtual bool CanSeek ( ) const = 0 ; <nl> + / / Playback capabilities <nl> + virtual bool CanPause ( ) const = 0 ; <nl> + virtual bool CanSeek ( ) const = 0 ; <nl> <nl> - / / Control playback <nl> - virtual unsigned int GetTimeMs ( ) const = 0 ; <nl> - virtual unsigned int GetTotalTimeMs ( ) const = 0 ; <nl> - virtual unsigned int GetCacheTimeMs ( ) const = 0 ; <nl> - virtual void SeekTimeMs ( unsigned int timeMs ) = 0 ; <nl> - virtual double GetSpeed ( ) const = 0 ; <nl> - virtual void SetSpeed ( double speedFactor ) = 0 ; <nl> - virtual void PauseAsync ( ) = 0 ; / / Pauses after the following frame <nl> + / / Control playback <nl> + virtual unsigned int GetTimeMs ( ) const = 0 ; <nl> + virtual unsigned int GetTotalTimeMs ( ) const = 0 ; <nl> + virtual unsigned int GetCacheTimeMs ( ) const = 0 ; <nl> + virtual void SeekTimeMs ( unsigned int timeMs ) = 0 ; <nl> + virtual double GetSpeed ( ) const = 0 ; <nl> + virtual void SetSpeed ( double speedFactor ) = 0 ; <nl> + virtual void PauseAsync ( ) = 0 ; / / Pauses after the following frame <nl> <nl> - / / Savestates <nl> - virtual std : : string CreateSavestate ( ) = 0 ; / / Returns the path of savestate on success <nl> - virtual bool LoadSavestate ( const std : : string & path ) = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + / / Savestates <nl> + virtual std : : string CreateSavestate ( ) = 0 ; / / Returns the path of savestate on success <nl> + virtual bool LoadSavestate ( const std : : string & path ) = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / playback / IPlaybackControl . h <nl> ppp b / xbmc / cores / RetroPlayer / playback / IPlaybackControl . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> + / * ! <nl> + * \ brief The playback client being controlled <nl> + * / <nl> + class IPlaybackCallback <nl> + { <nl> + public : <nl> + virtual ~ IPlaybackCallback ( ) = default ; <nl> + <nl> / * ! <nl> - * \ brief The playback client being controlled <nl> + * \ brief Set the playback speed <nl> + * <nl> + * \ param speed The new speed <nl> * / <nl> - class IPlaybackCallback <nl> - { <nl> - public : <nl> - virtual ~ IPlaybackCallback ( ) = default ; <nl> + virtual void SetPlaybackSpeed ( double speed ) = 0 ; <nl> <nl> - / * ! <nl> - * \ brief Set the playback speed <nl> - * <nl> - * \ param speed The new speed <nl> - * / <nl> - virtual void SetPlaybackSpeed ( double speed ) = 0 ; <nl> + / * ! <nl> + * \ brief Enable / disable game input <nl> + * <nl> + * \ param bEnable True to enable input , false to disable input <nl> + * / <nl> + virtual void EnableInput ( bool bEnable ) = 0 ; <nl> + } ; <nl> <nl> - / * ! <nl> - * \ brief Enable / disable game input <nl> - * <nl> - * \ param bEnable True to enable input , false to disable input <nl> - * / <nl> - virtual void EnableInput ( bool bEnable ) = 0 ; <nl> - } ; <nl> + / * ! <nl> + * \ brief Class that can control playback and input <nl> + * / <nl> + class IPlaybackControl <nl> + { <nl> + public : <nl> + virtual ~ IPlaybackControl ( ) = default ; <nl> <nl> / * ! <nl> - * \ brief Class that can control playback and input <nl> + * \ brief Called every frame <nl> * / <nl> - class IPlaybackControl <nl> - { <nl> - public : <nl> - virtual ~ IPlaybackControl ( ) = default ; <nl> - <nl> - / * ! <nl> - * \ brief Called every frame <nl> - * / <nl> - virtual void FrameMove ( ) = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + virtual void FrameMove ( ) = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / playback / RealtimePlayback . h <nl> ppp b / xbmc / cores / RetroPlayer / playback / RealtimePlayback . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRealtimePlayback : public IPlayback <nl> - { <nl> - public : <nl> - ~ CRealtimePlayback ( ) override = default ; <nl> + class CRealtimePlayback : public IPlayback <nl> + { <nl> + public : <nl> + ~ CRealtimePlayback ( ) override = default ; <nl> <nl> - / / implementation of IPlayback <nl> - void Initialize ( ) override { } <nl> - void Deinitialize ( ) override { } <nl> - bool CanPause ( ) const override { return false ; } <nl> - bool CanSeek ( ) const override { return false ; } <nl> - unsigned int GetTimeMs ( ) const override { return 0 ; } <nl> - unsigned int GetTotalTimeMs ( ) const override { return 0 ; } <nl> - unsigned int GetCacheTimeMs ( ) const override { return 0 ; } <nl> - void SeekTimeMs ( unsigned int timeMs ) override { } <nl> - double GetSpeed ( ) const override { return 1 . 0 ; } <nl> - void SetSpeed ( double speedFactor ) override { } <nl> - void PauseAsync ( ) override { } <nl> - std : : string CreateSavestate ( ) override { return " " ; } <nl> - bool LoadSavestate ( const std : : string & path ) override { return false ; } <nl> - } ; <nl> - } <nl> - } <nl> + / / implementation of IPlayback <nl> + void Initialize ( ) override { } <nl> + void Deinitialize ( ) override { } <nl> + bool CanPause ( ) const override { return false ; } <nl> + bool CanSeek ( ) const override { return false ; } <nl> + unsigned int GetTimeMs ( ) const override { return 0 ; } <nl> + unsigned int GetTotalTimeMs ( ) const override { return 0 ; } <nl> + unsigned int GetCacheTimeMs ( ) const override { return 0 ; } <nl> + void SeekTimeMs ( unsigned int timeMs ) override { } <nl> + double GetSpeed ( ) const override { return 1 . 0 ; } <nl> + void SetSpeed ( double speedFactor ) override { } <nl> + void PauseAsync ( ) override { } <nl> + std : : string CreateSavestate ( ) override { return " " ; } <nl> + bool LoadSavestate ( const std : : string & path ) override { return false ; } <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / playback / ReversiblePlayback . cpp <nl> ppp b / xbmc / cores / RetroPlayer / playback / ReversiblePlayback . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - # define REWIND_FACTOR 0 . 25 / / Rewind at 25 % of gameplay speed <nl> - <nl> - CReversiblePlayback : : CReversiblePlayback ( GAME : : CGameClient * gameClient , double fps , size_t serializeSize ) : <nl> - m_gameClient ( gameClient ) , <nl> - m_gameLoop ( this , fps ) , <nl> - m_savestateDatabase ( new CSavestateDatabase ) , <nl> - m_totalFrameCount ( 0 ) , <nl> - m_pastFrameCount ( 0 ) , <nl> - m_futureFrameCount ( 0 ) , <nl> - m_playTimeMs ( 0 ) , <nl> - m_totalTimeMs ( 0 ) , <nl> - m_cacheTimeMs ( 0 ) <nl> + # define REWIND_FACTOR 0 . 25 / / Rewind at 25 % of gameplay speed <nl> + <nl> + CReversiblePlayback : : CReversiblePlayback ( GAME : : CGameClient * gameClient , <nl> + double fps , <nl> + size_t serializeSize ) <nl> + : m_gameClient ( gameClient ) , <nl> + m_gameLoop ( this , fps ) , <nl> + m_savestateDatabase ( new CSavestateDatabase ) , <nl> + m_totalFrameCount ( 0 ) , <nl> + m_pastFrameCount ( 0 ) , <nl> + m_futureFrameCount ( 0 ) , <nl> + m_playTimeMs ( 0 ) , <nl> + m_totalTimeMs ( 0 ) , <nl> + m_cacheTimeMs ( 0 ) <nl> { <nl> UpdateMemoryStream ( ) ; <nl> <nl> - GAME : : CGameSettings & gameSettings = CServiceBroker : : GetGameServices ( ) . GameSettings ( ) ; <nl> + GAME : : CGameSettings & gameSettings = CServiceBroker : : GetGameServices ( ) . GameSettings ( ) ; <nl> gameSettings . RegisterObserver ( this ) ; <nl> } <nl> <nl> CReversiblePlayback : : ~ CReversiblePlayback ( ) <nl> { <nl> - GAME : : CGameSettings & gameSettings = CServiceBroker : : GetGameServices ( ) . GameSettings ( ) ; <nl> + GAME : : CGameSettings & gameSettings = CServiceBroker : : GetGameServices ( ) . GameSettings ( ) ; <nl> gameSettings . UnregisterObserver ( this ) ; <nl> <nl> Deinitialize ( ) ; <nl> std : : string CReversiblePlayback : : CreateSavestate ( ) <nl> const std : : string label = now . GetAsLocalizedDateTime ( ) ; <nl> const std : : string gameFileName = URIUtils : : GetFileName ( m_gameClient - > GetGamePath ( ) ) ; <nl> const uint64_t timestampFrames = m_totalFrameCount ; <nl> - const double timestampWallClock = ( m_totalFrameCount / m_gameClient - > GetFrameRate ( ) ) ; / / ! @ todo Accumulate playtime instead of deriving it <nl> + const double timestampWallClock = <nl> + ( m_totalFrameCount / <nl> + m_gameClient - > GetFrameRate ( ) ) ; / / ! @ todo Accumulate playtime instead of deriving it <nl> const std : : string gameClientId = m_gameClient - > ID ( ) ; <nl> const std : : string gameClientVersion = m_gameClient - > Version ( ) . asString ( ) ; <nl> <nl> std : : string CReversiblePlayback : : CreateSavestate ( ) <nl> savestate - > SetGameClientID ( gameClientId ) ; <nl> savestate - > SetGameClientVersion ( gameClientVersion ) ; <nl> <nl> - uint8_t * memoryData = savestate - > GetMemoryBuffer ( memorySize ) ; <nl> + uint8_t * memoryData = savestate - > GetMemoryBuffer ( memorySize ) ; <nl> <nl> { <nl> CSingleLock lock ( m_mutex ) ; <nl> bool CReversiblePlayback : : LoadSavestate ( const std : : string & path ) <nl> bool bSuccess = false ; <nl> <nl> std : : unique_ptr < ISavestate > savestate = m_savestateDatabase - > CreateSavestate ( ) ; <nl> - if ( m_savestateDatabase - > GetSavestate ( path , * savestate ) & & savestate - > GetMemorySize ( ) = = memorySize ) <nl> + if ( m_savestateDatabase - > GetSavestate ( path , * savestate ) & & <nl> + savestate - > GetMemorySize ( ) = = memorySize ) <nl> { <nl> { <nl> CSingleLock lock ( m_mutex ) ; <nl> void CReversiblePlayback : : UpdatePlaybackStats ( ) <nl> m_cacheTimeMs = MathUtils : : round_int ( 1000 . 0 * cached / m_gameLoop . FPS ( ) ) ; <nl> } <nl> <nl> - void CReversiblePlayback : : Notify ( const Observable & obs , const ObservableMessage msg ) <nl> + void CReversiblePlayback : : Notify ( const Observable & obs , const ObservableMessage msg ) <nl> { <nl> switch ( msg ) <nl> { <nl> - case ObservableMessageSettingsChanged : <nl> - UpdateMemoryStream ( ) ; <nl> - break ; <nl> - default : <nl> - break ; <nl> + case ObservableMessageSettingsChanged : <nl> + UpdateMemoryStream ( ) ; <nl> + break ; <nl> + default : <nl> + break ; <nl> } <nl> } <nl> <nl> void CReversiblePlayback : : UpdateMemoryStream ( ) <nl> <nl> bool bRewindEnabled = false ; <nl> <nl> - GAME : : CGameSettings & gameSettings = CServiceBroker : : GetGameServices ( ) . GameSettings ( ) ; <nl> + GAME : : CGameSettings & gameSettings = CServiceBroker : : GetGameServices ( ) . GameSettings ( ) ; <nl> <nl> if ( m_gameClient - > SerializeSize ( ) > 0 ) <nl> bRewindEnabled = gameSettings . RewindEnabled ( ) ; <nl> mmm a / xbmc / cores / RetroPlayer / playback / ReversiblePlayback . h <nl> ppp b / xbmc / cores / RetroPlayer / playback / ReversiblePlayback . h <nl> namespace KODI <nl> { <nl> namespace GAME <nl> { <nl> - class CGameClient ; <nl> + class CGameClient ; <nl> } <nl> <nl> namespace RETRO <nl> { <nl> - class CSavestateDatabase ; <nl> - class IMemoryStream ; <nl> + class CSavestateDatabase ; <nl> + class IMemoryStream ; <nl> <nl> - class CReversiblePlayback : public IPlayback , <nl> - public IGameLoopCallback , <nl> - public Observer <nl> - { <nl> - public : <nl> - CReversiblePlayback ( GAME : : CGameClient * gameClient , double fps , size_t serializeSize ) ; <nl> + class CReversiblePlayback : public IPlayback , public IGameLoopCallback , public Observer <nl> + { <nl> + public : <nl> + CReversiblePlayback ( GAME : : CGameClient * gameClient , double fps , size_t serializeSize ) ; <nl> <nl> - ~ CReversiblePlayback ( ) override ; <nl> + ~ CReversiblePlayback ( ) override ; <nl> <nl> - / / implementation of IPlayback <nl> - void Initialize ( ) override ; <nl> - void Deinitialize ( ) override ; <nl> - bool CanPause ( ) const override { return true ; } <nl> - bool CanSeek ( ) const override { return true ; } <nl> - unsigned int GetTimeMs ( ) const override { return m_playTimeMs ; } <nl> - unsigned int GetTotalTimeMs ( ) const override { return m_totalTimeMs ; } <nl> - unsigned int GetCacheTimeMs ( ) const override { return m_cacheTimeMs ; } <nl> - void SeekTimeMs ( unsigned int timeMs ) override ; <nl> - double GetSpeed ( ) const override ; <nl> - void SetSpeed ( double speedFactor ) override ; <nl> - void PauseAsync ( ) override ; <nl> - std : : string CreateSavestate ( ) override ; <nl> - bool LoadSavestate ( const std : : string & path ) override ; <nl> + / / implementation of IPlayback <nl> + void Initialize ( ) override ; <nl> + void Deinitialize ( ) override ; <nl> + bool CanPause ( ) const override { return true ; } <nl> + bool CanSeek ( ) const override { return true ; } <nl> + unsigned int GetTimeMs ( ) const override { return m_playTimeMs ; } <nl> + unsigned int GetTotalTimeMs ( ) const override { return m_totalTimeMs ; } <nl> + unsigned int GetCacheTimeMs ( ) const override { return m_cacheTimeMs ; } <nl> + void SeekTimeMs ( unsigned int timeMs ) override ; <nl> + double GetSpeed ( ) const override ; <nl> + void SetSpeed ( double speedFactor ) override ; <nl> + void PauseAsync ( ) override ; <nl> + std : : string CreateSavestate ( ) override ; <nl> + bool LoadSavestate ( const std : : string & path ) override ; <nl> <nl> - / / implementation of IGameLoopCallback <nl> - void FrameEvent ( ) override ; <nl> - void RewindEvent ( ) override ; <nl> + / / implementation of IGameLoopCallback <nl> + void FrameEvent ( ) override ; <nl> + void RewindEvent ( ) override ; <nl> <nl> - / / implementation of Observer <nl> - void Notify ( const Observable & obs , const ObservableMessage msg ) override ; <nl> + / / implementation of Observer <nl> + void Notify ( const Observable & obs , const ObservableMessage msg ) override ; <nl> <nl> - private : <nl> - void AddFrame ( ) ; <nl> - void RewindFrames ( uint64_t frames ) ; <nl> - void AdvanceFrames ( uint64_t frames ) ; <nl> - void UpdatePlaybackStats ( ) ; <nl> - void UpdateMemoryStream ( ) ; <nl> + private : <nl> + void AddFrame ( ) ; <nl> + void RewindFrames ( uint64_t frames ) ; <nl> + void AdvanceFrames ( uint64_t frames ) ; <nl> + void UpdatePlaybackStats ( ) ; <nl> + void UpdateMemoryStream ( ) ; <nl> <nl> - / / Construction parameter <nl> - GAME : : CGameClient * const m_gameClient ; <nl> + / / Construction parameter <nl> + GAME : : CGameClient * const m_gameClient ; <nl> <nl> - / / Gameplay functionality <nl> - CGameLoop m_gameLoop ; <nl> - std : : unique_ptr < IMemoryStream > m_memoryStream ; <nl> - CCriticalSection m_mutex ; <nl> + / / Gameplay functionality <nl> + CGameLoop m_gameLoop ; <nl> + std : : unique_ptr < IMemoryStream > m_memoryStream ; <nl> + CCriticalSection m_mutex ; <nl> <nl> - / / Savestate functionality <nl> - std : : unique_ptr < CSavestateDatabase > m_savestateDatabase ; <nl> + / / Savestate functionality <nl> + std : : unique_ptr < CSavestateDatabase > m_savestateDatabase ; <nl> <nl> - / / Playback stats <nl> - uint64_t m_totalFrameCount ; <nl> - uint64_t m_pastFrameCount ; <nl> - uint64_t m_futureFrameCount ; <nl> - unsigned int m_playTimeMs ; <nl> - unsigned int m_totalTimeMs ; <nl> - unsigned int m_cacheTimeMs ; <nl> - } ; <nl> - } <nl> - } <nl> + / / Playback stats <nl> + uint64_t m_totalFrameCount ; <nl> + uint64_t m_pastFrameCount ; <nl> + uint64_t m_futureFrameCount ; <nl> + unsigned int m_playTimeMs ; <nl> + unsigned int m_totalTimeMs ; <nl> + unsigned int m_cacheTimeMs ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / process / RPProcessInfo . cpp <nl> ppp b / xbmc / cores / RetroPlayer / process / RPProcessInfo . cpp <nl> <nl> * / <nl> <nl> # include " RPProcessInfo . h " <nl> + <nl> # include " ServiceBroker . h " <nl> + # include " cores / DataCacheCore . h " <nl> # include " cores / RetroPlayer / buffers / RenderBufferManager . h " <nl> # include " cores / RetroPlayer / rendering / RenderContext . h " <nl> - # include " cores / DataCacheCore . h " <nl> - # include " windowing / GraphicContext . h " <nl> # include " settings / DisplaySettings . h " <nl> # include " settings / MediaSettings . h " <nl> # include " threads / SingleLock . h " <nl> # include " utils / log . h " <nl> + # include " windowing / GraphicContext . h " <nl> # include " windowing / WinSystem . h " <nl> <nl> - extern " C " { <nl> + extern " C " <nl> + { <nl> # include < libavutil / pixdesc . h > <nl> } <nl> <nl> CreateRPProcessControl CRPProcessInfo : : m_processControl = nullptr ; <nl> std : : vector < std : : unique_ptr < IRendererFactory > > CRPProcessInfo : : m_rendererFactories ; <nl> CCriticalSection CRPProcessInfo : : m_createSection ; <nl> <nl> - CRPProcessInfo : : CRPProcessInfo ( std : : string platformName ) : <nl> - m_platformName ( std : : move ( platformName ) ) , <nl> - m_renderBufferManager ( new CRenderBufferManager ) , <nl> - m_renderContext ( new CRenderContext ( CServiceBroker : : GetRenderSystem ( ) , <nl> - CServiceBroker : : GetWinSystem ( ) , <nl> - CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) , <nl> - CDisplaySettings : : GetInstance ( ) , <nl> - CMediaSettings : : GetInstance ( ) ) ) <nl> + CRPProcessInfo : : CRPProcessInfo ( std : : string platformName ) <nl> + : m_platformName ( std : : move ( platformName ) ) , <nl> + m_renderBufferManager ( new CRenderBufferManager ) , <nl> + m_renderContext ( new CRenderContext ( CServiceBroker : : GetRenderSystem ( ) , <nl> + CServiceBroker : : GetWinSystem ( ) , <nl> + CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) , <nl> + CDisplaySettings : : GetInstance ( ) , <nl> + CMediaSettings : : GetInstance ( ) ) ) <nl> { <nl> - for ( auto & rendererFactory : m_rendererFactories ) <nl> + for ( auto & rendererFactory : m_rendererFactories ) <nl> { <nl> RenderBufferPoolVector bufferPools = rendererFactory - > CreateBufferPools ( * m_renderContext ) ; <nl> if ( ! bufferPools . empty ( ) ) <nl> CRPProcessInfo : : ~ CRPProcessInfo ( ) = default ; <nl> <nl> CRPProcessInfo * CRPProcessInfo : : CreateInstance ( ) <nl> { <nl> - CRPProcessInfo * processInfo = nullptr ; <nl> + CRPProcessInfo * processInfo = nullptr ; <nl> <nl> CSingleLock lock ( m_createSection ) ; <nl> <nl> CRPProcessInfo * CRPProcessInfo : : CreateInstance ( ) <nl> processInfo = m_processControl ( ) ; <nl> <nl> if ( processInfo ! = nullptr ) <nl> - CLog : : Log ( LOGINFO , " RetroPlayer [ PROCESS ] : Created process info for % s " , processInfo - > GetPlatformName ( ) . c_str ( ) ) ; <nl> + CLog : : Log ( LOGINFO , " RetroPlayer [ PROCESS ] : Created process info for % s " , <nl> + processInfo - > GetPlatformName ( ) . c_str ( ) ) ; <nl> else <nl> CLog : : Log ( LOGERROR , " RetroPlayer [ PROCESS ] : Failed to create process info " ) ; <nl> } <nl> void CRPProcessInfo : : RegisterProcessControl ( CreateRPProcessControl createFunc ) <nl> } <nl> } <nl> <nl> - void CRPProcessInfo : : RegisterRendererFactory ( IRendererFactory * factory ) <nl> + void CRPProcessInfo : : RegisterRendererFactory ( IRendererFactory * factory ) <nl> { <nl> CSingleLock lock ( m_createSection ) ; <nl> <nl> void CRPProcessInfo : : RegisterRendererFactory ( IRendererFactory * factory ) <nl> m_rendererFactories . emplace_back ( factory ) ; <nl> } <nl> <nl> - std : : string CRPProcessInfo : : GetRenderSystemName ( IRenderBufferPool * renderBufferPool ) const <nl> + std : : string CRPProcessInfo : : GetRenderSystemName ( IRenderBufferPool * renderBufferPool ) const <nl> { <nl> return m_renderBufferManager - > GetRenderSystemName ( renderBufferPool ) ; <nl> } <nl> <nl> - CRPBaseRenderer * CRPProcessInfo : : CreateRenderer ( IRenderBufferPool * renderBufferPool , const CRenderSettings & renderSettings ) <nl> + CRPBaseRenderer * CRPProcessInfo : : CreateRenderer ( IRenderBufferPool * renderBufferPool , <nl> + const CRenderSettings & renderSettings ) <nl> { <nl> CSingleLock lock ( m_createSection ) ; <nl> <nl> - for ( auto & rendererFactory : m_rendererFactories ) <nl> + for ( auto & rendererFactory : m_rendererFactories ) <nl> { <nl> RenderBufferPoolVector bufferPools = m_renderBufferManager - > GetPools ( rendererFactory . get ( ) ) ; <nl> - for ( auto & bufferPool : bufferPools ) <nl> + for ( auto & bufferPool : bufferPools ) <nl> { <nl> if ( bufferPool . get ( ) = = renderBufferPool ) <nl> - return rendererFactory - > CreateRenderer ( renderSettings , * m_renderContext , std : : move ( bufferPool ) ) ; <nl> + return rendererFactory - > CreateRenderer ( renderSettings , * m_renderContext , <nl> + std : : move ( bufferPool ) ) ; <nl> } <nl> } <nl> <nl> CRPBaseRenderer * CRPProcessInfo : : CreateRenderer ( IRenderBufferPool * renderBufferP <nl> return nullptr ; <nl> } <nl> <nl> - void CRPProcessInfo : : SetDataCache ( CDataCacheCore * cache ) <nl> + void CRPProcessInfo : : SetDataCache ( CDataCacheCore * cache ) <nl> { <nl> - m_dataCache = cache ; ; <nl> + m_dataCache = cache ; <nl> + ; <nl> } <nl> <nl> void CRPProcessInfo : : ResetInfo ( ) <nl> bool CRPProcessInfo : : HasScalingMethod ( SCALINGMETHOD scalingMethod ) const <nl> std : : vector < SCALINGMETHOD > CRPProcessInfo : : GetScalingMethods ( ) <nl> { <nl> return { <nl> - SCALINGMETHOD : : NEAREST , <nl> - SCALINGMETHOD : : LINEAR , <nl> + SCALINGMETHOD : : NEAREST , <nl> + SCALINGMETHOD : : LINEAR , <nl> } ; <nl> } <nl> <nl> std : : vector < SCALINGMETHOD > CRPProcessInfo : : GetScalingMethods ( ) <nl> / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> void CRPProcessInfo : : SetVideoPixelFormat ( AVPixelFormat pixFormat ) <nl> { <nl> - const char * videoPixelFormat = av_get_pix_fmt_name ( pixFormat ) ; <nl> + const char * videoPixelFormat = av_get_pix_fmt_name ( pixFormat ) ; <nl> <nl> if ( m_dataCache ! = nullptr ) <nl> m_dataCache - > SetVideoPixelFormat ( videoPixelFormat ! = nullptr ? videoPixelFormat : " " ) ; <nl> void CRPProcessInfo : : SetVideoFps ( float fps ) <nl> / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> / / player audio info <nl> / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - void CRPProcessInfo : : SetAudioChannels ( const std : : string & channels ) <nl> + void CRPProcessInfo : : SetAudioChannels ( const std : : string & channels ) <nl> { <nl> if ( m_dataCache ! = nullptr ) <nl> m_dataCache - > SetAudioChannels ( channels ) ; <nl> mmm a / xbmc / cores / RetroPlayer / process / RPProcessInfo . h <nl> ppp b / xbmc / cores / RetroPlayer / process / RPProcessInfo . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderBufferManager ; <nl> - class CRenderContext ; <nl> - class CRenderSettings ; <nl> - class CRPBaseRenderer ; <nl> - class CRPProcessInfo ; <nl> - class IRenderBufferPool ; <nl> + class CRenderBufferManager ; <nl> + class CRenderContext ; <nl> + class CRenderSettings ; <nl> + class CRPBaseRenderer ; <nl> + class CRPProcessInfo ; <nl> + class IRenderBufferPool ; <nl> + <nl> + / * ! <nl> + * \ brief Process info factory <nl> + * / <nl> + using CreateRPProcessControl = CRPProcessInfo * ( * ) ( ) ; <nl> + <nl> + / * ! <nl> + * \ brief Rendering factory <nl> + * / <nl> + class IRendererFactory <nl> + { <nl> + public : <nl> + virtual ~ IRendererFactory ( ) = default ; <nl> + <nl> + / * ! <nl> + * \ brief Get a description name of the rendering system <nl> + * / <nl> + virtual std : : string RenderSystemName ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Create a renderer <nl> + * <nl> + * \ param settings The renderer ' s initial settings <nl> + * \ param context The rendering context <nl> + * \ param bufferPool The buffer pool to which buffers are returned <nl> + * / <nl> + virtual CRPBaseRenderer * CreateRenderer ( const CRenderSettings & settings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Create buffer pools to manager buffers <nl> + * <nl> + * \ param context The rendering context shared with the buffer pools <nl> + * <nl> + * \ return The buffer pools supported by the rendering system <nl> + * / <nl> + virtual RenderBufferPoolVector CreateBufferPools ( CRenderContext & context ) = 0 ; <nl> + } ; <nl> + <nl> + / * ! <nl> + * \ brief Player process info <nl> + * / <nl> + class CRPProcessInfo <nl> + { <nl> + public : <nl> + static CRPProcessInfo * CreateInstance ( ) ; <nl> + static void RegisterProcessControl ( CreateRPProcessControl createFunc ) ; <nl> + static void RegisterRendererFactory ( IRendererFactory * factory ) ; <nl> + <nl> + virtual ~ CRPProcessInfo ( ) ; <nl> + <nl> + / * ! <nl> + * \ brief Get the descriptive name of the platform <nl> + * <nl> + * \ return The name of the platform as set by windowing <nl> + * / <nl> + const std : : string & GetPlatformName ( ) const { return m_platformName ; } <nl> + <nl> + / * ! <nl> + * \ brief Get the descriptive name of the rendering system <nl> + * <nl> + * \ param renderBufferPool A pool belonging to the rendering system <nl> + * <nl> + * \ return The name of the rendering system as set by windowing <nl> + * / <nl> + std : : string GetRenderSystemName ( IRenderBufferPool * renderBufferPool ) const ; <nl> <nl> / * ! <nl> - * \ brief Process info factory <nl> + * \ brief Create a renderer <nl> + * <nl> + * \ param renderBufferPool The buffer pool used to return render buffers <nl> + * \ param renderSettings The settings for this renderer <nl> + * <nl> + * \ return The renderer , or nullptr on failure <nl> * / <nl> - using CreateRPProcessControl = CRPProcessInfo * ( * ) ( ) ; <nl> + CRPBaseRenderer * CreateRenderer ( IRenderBufferPool * renderBufferPool , <nl> + const CRenderSettings & renderSettings ) ; <nl> <nl> / * ! <nl> - * \ brief Rendering factory <nl> + * \ brief Set data cache <nl> * / <nl> - class IRendererFactory <nl> - { <nl> - public : <nl> - virtual ~ IRendererFactory ( ) = default ; <nl> - <nl> - / * ! <nl> - * \ brief Get a description name of the rendering system <nl> - * / <nl> - virtual std : : string RenderSystemName ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Create a renderer <nl> - * <nl> - * \ param settings The renderer ' s initial settings <nl> - * \ param context The rendering context <nl> - * \ param bufferPool The buffer pool to which buffers are returned <nl> - * / <nl> - virtual CRPBaseRenderer * CreateRenderer ( const CRenderSettings & settings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Create buffer pools to manager buffers <nl> - * <nl> - * \ param context The rendering context shared with the buffer pools <nl> - * <nl> - * \ return The buffer pools supported by the rendering system <nl> - * / <nl> - virtual RenderBufferPoolVector CreateBufferPools ( CRenderContext & context ) = 0 ; <nl> - } ; <nl> + void SetDataCache ( CDataCacheCore * cache ) ; <nl> <nl> / * ! <nl> - * \ brief Player process info <nl> + * \ brief Reset data cache info <nl> * / <nl> - class CRPProcessInfo <nl> - { <nl> - public : <nl> - static CRPProcessInfo * CreateInstance ( ) ; <nl> - static void RegisterProcessControl ( CreateRPProcessControl createFunc ) ; <nl> - static void RegisterRendererFactory ( IRendererFactory * factory ) ; <nl> - <nl> - virtual ~ CRPProcessInfo ( ) ; <nl> - <nl> - / * ! <nl> - * \ brief Get the descriptive name of the platform <nl> - * <nl> - * \ return The name of the platform as set by windowing <nl> - * / <nl> - const std : : string & GetPlatformName ( ) const { return m_platformName ; } <nl> - <nl> - / * ! <nl> - * \ brief Get the descriptive name of the rendering system <nl> - * <nl> - * \ param renderBufferPool A pool belonging to the rendering system <nl> - * <nl> - * \ return The name of the rendering system as set by windowing <nl> - * / <nl> - std : : string GetRenderSystemName ( IRenderBufferPool * renderBufferPool ) const ; <nl> - <nl> - / * ! <nl> - * \ brief Create a renderer <nl> - * <nl> - * \ param renderBufferPool The buffer pool used to return render buffers <nl> - * \ param renderSettings The settings for this renderer <nl> - * <nl> - * \ return The renderer , or nullptr on failure <nl> - * / <nl> - CRPBaseRenderer * CreateRenderer ( IRenderBufferPool * renderBufferPool , const CRenderSettings & renderSettings ) ; <nl> - <nl> - / * ! <nl> - * \ brief Set data cache <nl> - * / <nl> - void SetDataCache ( CDataCacheCore * cache ) ; <nl> - <nl> - / * ! <nl> - * \ brief Reset data cache info <nl> - * / <nl> - void ResetInfo ( ) ; <nl> - <nl> - / / / @ name Rendering functions <nl> - / / / { <nl> - <nl> - / * ! <nl> - * \ brief Get the context shared by the rendering system <nl> - * / <nl> - CRenderContext & GetRenderContext ( ) { return * m_renderContext ; } <nl> - <nl> - / * ! <nl> - * \ brief Get the buffer manager that owns the buffer pools <nl> - * / <nl> - CRenderBufferManager & GetBufferManager ( ) { return * m_renderBufferManager ; } <nl> - <nl> - / * ! <nl> - * \ brief Check if a buffer pool supports the given scaling method <nl> - * / <nl> - bool HasScalingMethod ( SCALINGMETHOD scalingMethod ) const ; <nl> - <nl> - / * ! <nl> - * \ brief Get the default scaling method for this rendering system <nl> - * / <nl> - SCALINGMETHOD GetDefaultScalingMethod ( ) const { return m_defaultScalingMethod ; } <nl> - <nl> - / / / } <nl> - <nl> - / / / @ name Player video info <nl> - / / / { <nl> - void SetVideoPixelFormat ( AVPixelFormat pixFormat ) ; <nl> - void SetVideoDimensions ( int width , int height ) ; <nl> - void SetVideoFps ( float fps ) ; <nl> - / / / } <nl> - <nl> - / / / @ name Player audio info <nl> - / / / { <nl> - void SetAudioChannels ( const std : : string & channels ) ; <nl> - void SetAudioSampleRate ( int sampleRate ) ; <nl> - void SetAudioBitsPerSample ( int bitsPerSample ) ; <nl> - / / / } <nl> - <nl> - / / / @ name Player states <nl> - / / / { <nl> - void SetSpeed ( float speed ) ; <nl> - void SetPlayTimes ( time_t start , int64_t current , int64_t min , int64_t max ) ; <nl> - / / / } <nl> - <nl> - protected : <nl> - / * ! <nl> - * \ brief Constructor <nl> - * <nl> - * \ param platformName A descriptive name of the platform <nl> - * / <nl> - CRPProcessInfo ( std : : string platformName ) ; <nl> - <nl> - / * ! <nl> - * \ brief Get all scaling methods available to the rendering system <nl> - * / <nl> - static std : : vector < SCALINGMETHOD > GetScalingMethods ( ) ; <nl> - <nl> - / / Static factories <nl> - static CreateRPProcessControl m_processControl ; <nl> - static std : : vector < std : : unique_ptr < IRendererFactory > > m_rendererFactories ; <nl> - static CCriticalSection m_createSection ; <nl> - <nl> - / / Construction parameters <nl> - const std : : string m_platformName ; <nl> - <nl> - / / Info parameters <nl> - CDataCacheCore * m_dataCache = nullptr ; <nl> - <nl> - / / Rendering parameters <nl> - std : : unique_ptr < CRenderBufferManager > m_renderBufferManager ; <nl> - <nl> - private : <nl> - / / Rendering parameters <nl> - std : : unique_ptr < CRenderContext > m_renderContext ; <nl> - SCALINGMETHOD m_defaultScalingMethod = SCALINGMETHOD : : AUTO ; <nl> - } ; <nl> - <nl> - } <nl> - } <nl> + void ResetInfo ( ) ; <nl> + <nl> + / / / @ name Rendering functions <nl> + / / / { <nl> + <nl> + / * ! <nl> + * \ brief Get the context shared by the rendering system <nl> + * / <nl> + CRenderContext & GetRenderContext ( ) { return * m_renderContext ; } <nl> + <nl> + / * ! <nl> + * \ brief Get the buffer manager that owns the buffer pools <nl> + * / <nl> + CRenderBufferManager & GetBufferManager ( ) { return * m_renderBufferManager ; } <nl> + <nl> + / * ! <nl> + * \ brief Check if a buffer pool supports the given scaling method <nl> + * / <nl> + bool HasScalingMethod ( SCALINGMETHOD scalingMethod ) const ; <nl> + <nl> + / * ! <nl> + * \ brief Get the default scaling method for this rendering system <nl> + * / <nl> + SCALINGMETHOD GetDefaultScalingMethod ( ) const { return m_defaultScalingMethod ; } <nl> + <nl> + / / / } <nl> + <nl> + / / / @ name Player video info <nl> + / / / { <nl> + void SetVideoPixelFormat ( AVPixelFormat pixFormat ) ; <nl> + void SetVideoDimensions ( int width , int height ) ; <nl> + void SetVideoFps ( float fps ) ; <nl> + / / / } <nl> + <nl> + / / / @ name Player audio info <nl> + / / / { <nl> + void SetAudioChannels ( const std : : string & channels ) ; <nl> + void SetAudioSampleRate ( int sampleRate ) ; <nl> + void SetAudioBitsPerSample ( int bitsPerSample ) ; <nl> + / / / } <nl> + <nl> + / / / @ name Player states <nl> + / / / { <nl> + void SetSpeed ( float speed ) ; <nl> + void SetPlayTimes ( time_t start , int64_t current , int64_t min , int64_t max ) ; <nl> + / / / } <nl> + <nl> + protected : <nl> + / * ! <nl> + * \ brief Constructor <nl> + * <nl> + * \ param platformName A descriptive name of the platform <nl> + * / <nl> + CRPProcessInfo ( std : : string platformName ) ; <nl> + <nl> + / * ! <nl> + * \ brief Get all scaling methods available to the rendering system <nl> + * / <nl> + static std : : vector < SCALINGMETHOD > GetScalingMethods ( ) ; <nl> + <nl> + / / Static factories <nl> + static CreateRPProcessControl m_processControl ; <nl> + static std : : vector < std : : unique_ptr < IRendererFactory > > m_rendererFactories ; <nl> + static CCriticalSection m_createSection ; <nl> + <nl> + / / Construction parameters <nl> + const std : : string m_platformName ; <nl> + <nl> + / / Info parameters <nl> + CDataCacheCore * m_dataCache = nullptr ; <nl> + <nl> + / / Rendering parameters <nl> + std : : unique_ptr < CRenderBufferManager > m_renderBufferManager ; <nl> + <nl> + private : <nl> + / / Rendering parameters <nl> + std : : unique_ptr < CRenderContext > m_renderContext ; <nl> + SCALINGMETHOD m_defaultScalingMethod = SCALINGMETHOD : : AUTO ; <nl> + } ; <nl> + <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / process / X11 / RPProcessInfoX11 . cpp <nl> ppp b / xbmc / cores / RetroPlayer / process / X11 / RPProcessInfoX11 . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRPProcessInfoX11 : : CRPProcessInfoX11 ( ) : <nl> - CRPProcessInfo ( " X11 " ) <nl> + CRPProcessInfoX11 : : CRPProcessInfoX11 ( ) : CRPProcessInfo ( " X11 " ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / process / X11 / RPProcessInfoX11 . h <nl> ppp b / xbmc / cores / RetroPlayer / process / X11 / RPProcessInfoX11 . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRPProcessInfoX11 : public CRPProcessInfo <nl> - { <nl> - public : <nl> - CRPProcessInfoX11 ( ) ; <nl> + class CRPProcessInfoX11 : public CRPProcessInfo <nl> + { <nl> + public : <nl> + CRPProcessInfoX11 ( ) ; <nl> <nl> - static CRPProcessInfo * Create ( ) ; <nl> - static void Register ( ) ; <nl> - } ; <nl> - } <nl> - } <nl> + static CRPProcessInfo * Create ( ) ; <nl> + static void Register ( ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / process / android / RPProcessInfoAndroid . cpp <nl> ppp b / xbmc / cores / RetroPlayer / process / android / RPProcessInfoAndroid . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRPProcessInfoAndroid : : CRPProcessInfoAndroid ( ) : <nl> - CRPProcessInfo ( " Android " ) <nl> + CRPProcessInfoAndroid : : CRPProcessInfoAndroid ( ) : CRPProcessInfo ( " Android " ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / process / android / RPProcessInfoAndroid . h <nl> ppp b / xbmc / cores / RetroPlayer / process / android / RPProcessInfoAndroid . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRPProcessInfoAndroid : public CRPProcessInfo <nl> - { <nl> - public : <nl> - CRPProcessInfoAndroid ( ) ; <nl> + class CRPProcessInfoAndroid : public CRPProcessInfo <nl> + { <nl> + public : <nl> + CRPProcessInfoAndroid ( ) ; <nl> <nl> - static CRPProcessInfo * Create ( ) ; <nl> - static void Register ( ) ; <nl> - } ; <nl> - } <nl> - } <nl> + static CRPProcessInfo * Create ( ) ; <nl> + static void Register ( ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / process / gbm / RPProcessInfoGbm . cpp <nl> ppp b / xbmc / cores / RetroPlayer / process / gbm / RPProcessInfoGbm . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRPProcessInfoGbm : : CRPProcessInfoGbm ( ) : <nl> - CRPProcessInfo ( " GBM " ) <nl> + CRPProcessInfoGbm : : CRPProcessInfoGbm ( ) : CRPProcessInfo ( " GBM " ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / process / gbm / RPProcessInfoGbm . h <nl> ppp b / xbmc / cores / RetroPlayer / process / gbm / RPProcessInfoGbm . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRPProcessInfoGbm : public CRPProcessInfo <nl> - { <nl> - public : <nl> - CRPProcessInfoGbm ( ) ; <nl> + class CRPProcessInfoGbm : public CRPProcessInfo <nl> + { <nl> + public : <nl> + CRPProcessInfoGbm ( ) ; <nl> <nl> - static CRPProcessInfo * Create ( ) ; <nl> - static void Register ( ) ; <nl> - } ; <nl> - } <nl> - } <nl> + static CRPProcessInfo * Create ( ) ; <nl> + static void Register ( ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / process / ios / RPProcessInfoIOS . cpp <nl> ppp b / xbmc / cores / RetroPlayer / process / ios / RPProcessInfoIOS . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRPProcessInfoIOS : : CRPProcessInfoIOS ( ) : <nl> - CRPProcessInfo ( " iOS " ) <nl> + CRPProcessInfoIOS : : CRPProcessInfoIOS ( ) : CRPProcessInfo ( " iOS " ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / process / ios / RPProcessInfoIOS . h <nl> ppp b / xbmc / cores / RetroPlayer / process / ios / RPProcessInfoIOS . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRPProcessInfoIOS : public CRPProcessInfo <nl> - { <nl> - public : <nl> - CRPProcessInfoIOS ( ) ; <nl> + class CRPProcessInfoIOS : public CRPProcessInfo <nl> + { <nl> + public : <nl> + CRPProcessInfoIOS ( ) ; <nl> <nl> - static CRPProcessInfo * Create ( ) ; <nl> - static void Register ( ) ; <nl> - } ; <nl> - } <nl> - } <nl> + static CRPProcessInfo * Create ( ) ; <nl> + static void Register ( ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / process / osx / RPProcessInfoOSX . cpp <nl> ppp b / xbmc / cores / RetroPlayer / process / osx / RPProcessInfoOSX . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRPProcessInfoOSX : : CRPProcessInfoOSX ( ) : <nl> - CRPProcessInfo ( " macOS " ) <nl> + CRPProcessInfoOSX : : CRPProcessInfoOSX ( ) : CRPProcessInfo ( " macOS " ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / process / osx / RPProcessInfoOSX . h <nl> ppp b / xbmc / cores / RetroPlayer / process / osx / RPProcessInfoOSX . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRPProcessInfoOSX : public CRPProcessInfo <nl> - { <nl> - public : <nl> - CRPProcessInfoOSX ( ) ; <nl> + class CRPProcessInfoOSX : public CRPProcessInfo <nl> + { <nl> + public : <nl> + CRPProcessInfoOSX ( ) ; <nl> <nl> - static CRPProcessInfo * Create ( ) ; <nl> - static void Register ( ) ; <nl> - } ; <nl> - } <nl> - } <nl> + static CRPProcessInfo * Create ( ) ; <nl> + static void Register ( ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / process / rbpi / RPProcessInfoPi . cpp <nl> ppp b / xbmc / cores / RetroPlayer / process / rbpi / RPProcessInfoPi . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRPProcessInfoPi : : CRPProcessInfoPi ( ) : <nl> - CRPProcessInfo ( " RPi " ) <nl> + CRPProcessInfoPi : : CRPProcessInfoPi ( ) : CRPProcessInfo ( " RPi " ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / process / rbpi / RPProcessInfoPi . h <nl> ppp b / xbmc / cores / RetroPlayer / process / rbpi / RPProcessInfoPi . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRPProcessInfoPi : public CRPProcessInfo <nl> - { <nl> - public : <nl> - CRPProcessInfoPi ( ) ; <nl> + class CRPProcessInfoPi : public CRPProcessInfo <nl> + { <nl> + public : <nl> + CRPProcessInfoPi ( ) ; <nl> <nl> - static CRPProcessInfo * Create ( ) ; <nl> - static void Register ( ) ; <nl> - } ; <nl> - } <nl> - } <nl> + static CRPProcessInfo * Create ( ) ; <nl> + static void Register ( ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / process / wayland / RPProcessInfoWayland . cpp <nl> ppp b / xbmc / cores / RetroPlayer / process / wayland / RPProcessInfoWayland . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRPProcessInfoWayland : : CRPProcessInfoWayland ( ) : <nl> - CRPProcessInfo ( " Wayland " ) <nl> + CRPProcessInfoWayland : : CRPProcessInfoWayland ( ) : CRPProcessInfo ( " Wayland " ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / process / wayland / RPProcessInfoWayland . h <nl> ppp b / xbmc / cores / RetroPlayer / process / wayland / RPProcessInfoWayland . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRPProcessInfoWayland : public CRPProcessInfo <nl> - { <nl> - public : <nl> - CRPProcessInfoWayland ( ) ; <nl> + class CRPProcessInfoWayland : public CRPProcessInfo <nl> + { <nl> + public : <nl> + CRPProcessInfoWayland ( ) ; <nl> <nl> - static CRPProcessInfo * Create ( ) ; <nl> - static void Register ( ) ; <nl> - } ; <nl> - } <nl> - } <nl> + static CRPProcessInfo * Create ( ) ; <nl> + static void Register ( ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / process / windows / RPProcessInfoWin . cpp <nl> ppp b / xbmc / cores / RetroPlayer / process / windows / RPProcessInfoWin . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRPProcessInfoWin : : CRPProcessInfoWin ( ) : <nl> - CRPProcessInfo ( " Windows " ) <nl> + CRPProcessInfoWin : : CRPProcessInfoWin ( ) : CRPProcessInfo ( " Windows " ) <nl> { <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / process / windows / RPProcessInfoWin . h <nl> ppp b / xbmc / cores / RetroPlayer / process / windows / RPProcessInfoWin . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRPProcessInfoWin : public CRPProcessInfo <nl> - { <nl> - public : <nl> - CRPProcessInfoWin ( ) ; <nl> + class CRPProcessInfoWin : public CRPProcessInfo <nl> + { <nl> + public : <nl> + CRPProcessInfoWin ( ) ; <nl> <nl> - static CRPProcessInfo * Create ( ) ; <nl> - static void Register ( ) ; <nl> - } ; <nl> - } <nl> - } <nl> + static CRPProcessInfo * Create ( ) ; <nl> + static void Register ( ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / IRenderManager . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / IRenderManager . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class IGUIRenderSettings ; <nl> + class IGUIRenderSettings ; <nl> + <nl> + / * ! <nl> + * \ brief Interface to expose rendering functions to GUI components <nl> + * / <nl> + class IRenderManager <nl> + { <nl> + public : <nl> + virtual ~ IRenderManager ( ) = default ; <nl> + <nl> + / * ! <nl> + * \ brief Render a fullscreen window <nl> + * <nl> + * \ param bClear Whether the render area should be cleared <nl> + * \ param coordsRes Resolution that the window coordinates are in <nl> + * / <nl> + virtual void RenderWindow ( bool bClear , const RESOLUTION_INFO & coordsRes ) = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Render a game control <nl> + * <nl> + * \ param bClear Whether the render area should be cleared <nl> + * \ param bUseAlpha Whether the graphics context ' s alpha should be used <nl> + * \ param renderRegion The region of the control being rendered <nl> + * \ param renderSettings The settings used to render the control <nl> + * / <nl> + virtual void RenderControl ( bool bClear , <nl> + bool bUseAlpha , <nl> + const CRect & renderRegion , <nl> + const IGUIRenderSettings * renderSettings ) = 0 ; <nl> <nl> / * ! <nl> - * \ brief Interface to expose rendering functions to GUI components <nl> + * \ brief Clear the background of a fullscreen window <nl> * / <nl> - class IRenderManager <nl> - { <nl> - public : <nl> - virtual ~ IRenderManager ( ) = default ; <nl> - <nl> - / * ! <nl> - * \ brief Render a fullscreen window <nl> - * <nl> - * \ param bClear Whether the render area should be cleared <nl> - * \ param coordsRes Resolution that the window coordinates are in <nl> - * / <nl> - virtual void RenderWindow ( bool bClear , const RESOLUTION_INFO & coordsRes ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Render a game control <nl> - * <nl> - * \ param bClear Whether the render area should be cleared <nl> - * \ param bUseAlpha Whether the graphics context ' s alpha should be used <nl> - * \ param renderRegion The region of the control being rendered <nl> - * \ param renderSettings The settings used to render the control <nl> - * / <nl> - virtual void RenderControl ( bool bClear , bool bUseAlpha , const CRect & renderRegion , const IGUIRenderSettings * renderSettings ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Clear the background of a fullscreen window <nl> - * / <nl> - virtual void ClearBackground ( ) = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + virtual void ClearBackground ( ) = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RPRenderManager . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RPRenderManager . cpp <nl> <nl> * / <nl> <nl> # include " RPRenderManager . h " <nl> + <nl> # include " RenderContext . h " <nl> # include " RenderSettings . h " <nl> # include " RenderTranslator . h " <nl> <nl> # include " cores / RetroPlayer / guibridge / IGUIRenderSettings . h " <nl> # include " cores / RetroPlayer / process / RPProcessInfo . h " <nl> # include " cores / RetroPlayer / rendering / VideoRenderers / RPBaseRenderer . h " <nl> - # include " utils / TransformMatrix . h " <nl> # include " threads / SingleLock . h " <nl> # include " utils / Color . h " <nl> + # include " utils / TransformMatrix . h " <nl> # include " utils / log . h " <nl> <nl> - extern " C " { <nl> + extern " C " <nl> + { <nl> # include < libswscale / swscale . h > <nl> } <nl> <nl> extern " C " { <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRPRenderManager : : CRPRenderManager ( CRPProcessInfo & processInfo ) : <nl> - m_processInfo ( processInfo ) , <nl> - m_renderContext ( processInfo . GetRenderContext ( ) ) , <nl> - m_renderSettings ( new CGUIGameSettings ( processInfo ) ) , <nl> - m_renderControlFactory ( new CGUIRenderTargetFactory ( this ) ) <nl> + CRPRenderManager : : CRPRenderManager ( CRPProcessInfo & processInfo ) <nl> + : m_processInfo ( processInfo ) , <nl> + m_renderContext ( processInfo . GetRenderContext ( ) ) , <nl> + m_renderSettings ( new CGUIGameSettings ( processInfo ) ) , <nl> + m_renderControlFactory ( new CGUIRenderTargetFactory ( this ) ) <nl> { <nl> } <nl> <nl> void CRPRenderManager : : Deinitialize ( ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ RENDER ] : Deinitializing render manager " ) ; <nl> <nl> - for ( auto & pixelScaler : m_scalers ) <nl> + for ( auto & pixelScaler : m_scalers ) <nl> { <nl> if ( pixelScaler . second ! = nullptr ) <nl> sws_freeContext ( pixelScaler . second ) ; <nl> void CRPRenderManager : : Deinitialize ( ) <nl> m_state = RENDER_STATE : : UNCONFIGURED ; <nl> } <nl> <nl> - bool CRPRenderManager : : Configure ( AVPixelFormat format , unsigned int nominalWidth , unsigned int nominalHeight , unsigned int maxWidth , unsigned int maxHeight ) <nl> + bool CRPRenderManager : : Configure ( AVPixelFormat format , <nl> + unsigned int nominalWidth , <nl> + unsigned int nominalHeight , <nl> + unsigned int maxWidth , <nl> + unsigned int maxHeight ) <nl> { <nl> CLog : : Log ( LOGINFO , " RetroPlayer [ RENDER ] : Configuring format % s , nominal % ux % u , max % ux % u " , <nl> - CRenderTranslator : : TranslatePixelFormat ( format ) , <nl> - nominalWidth , <nl> - nominalHeight , <nl> - maxWidth , <nl> + CRenderTranslator : : TranslatePixelFormat ( format ) , nominalWidth , nominalHeight , maxWidth , <nl> maxHeight ) ; <nl> <nl> / / Immutable parameters <nl> bool CRPRenderManager : : Configure ( AVPixelFormat format , unsigned int nominalWidth <nl> return true ; <nl> } <nl> <nl> - bool CRPRenderManager : : GetVideoBuffer ( unsigned int width , unsigned int height , AVPixelFormat & format , uint8_t * & data , size_t & size ) <nl> + bool CRPRenderManager : : GetVideoBuffer ( <nl> + unsigned int width , unsigned int height , AVPixelFormat & format , uint8_t * & data , size_t & size ) <nl> { <nl> - for ( IRenderBuffer * buffer : m_pendingBuffers ) <nl> + for ( IRenderBuffer * buffer : m_pendingBuffers ) <nl> buffer - > Release ( ) ; <nl> m_pendingBuffers . clear ( ) ; <nl> <nl> bool CRPRenderManager : : GetVideoBuffer ( unsigned int width , unsigned int height , A <nl> return false ; <nl> <nl> / / Get buffers from visible renderers <nl> - for ( IRenderBufferPool * bufferPool : m_processInfo . GetBufferManager ( ) . GetBufferPools ( ) ) <nl> + for ( IRenderBufferPool * bufferPool : m_processInfo . GetBufferManager ( ) . GetBufferPools ( ) ) <nl> { <nl> if ( ! bufferPool - > HasVisibleRenderer ( ) ) <nl> continue ; <nl> <nl> - IRenderBuffer * renderBuffer = bufferPool - > GetBuffer ( width , height ) ; <nl> + IRenderBuffer * renderBuffer = bufferPool - > GetBuffer ( width , height ) ; <nl> if ( renderBuffer ! = nullptr ) <nl> m_pendingBuffers . emplace_back ( renderBuffer ) ; <nl> else <nl> bool CRPRenderManager : : GetVideoBuffer ( unsigned int width , unsigned int height , A <nl> return false ; <nl> <nl> / / ! @ todo Handle multiple buffers <nl> - IRenderBuffer * renderBuffer = m_pendingBuffers . at ( 0 ) ; <nl> + IRenderBuffer * renderBuffer = m_pendingBuffers . at ( 0 ) ; <nl> <nl> format = renderBuffer - > GetFormat ( ) ; <nl> data = renderBuffer - > GetMemory ( ) ; <nl> bool CRPRenderManager : : GetVideoBuffer ( unsigned int width , unsigned int height , A <nl> return true ; <nl> } <nl> <nl> - void CRPRenderManager : : AddFrame ( const uint8_t * data , size_t size , unsigned int width , unsigned int height , unsigned int orientationDegCCW ) <nl> + void CRPRenderManager : : AddFrame ( const uint8_t * data , <nl> + size_t size , <nl> + unsigned int width , <nl> + unsigned int height , <nl> + unsigned int orientationDegCCW ) <nl> { <nl> if ( m_bFlush | | m_state ! = RENDER_STATE : : CONFIGURED ) <nl> return ; <nl> void CRPRenderManager : : AddFrame ( const uint8_t * data , size_t size , unsigned int w <nl> std : : vector < IRenderBuffer * > renderBuffers ; <nl> <nl> / / Check pending buffers <nl> - for ( IRenderBuffer * buffer : m_pendingBuffers ) <nl> + for ( IRenderBuffer * buffer : m_pendingBuffers ) <nl> { <nl> if ( buffer - > GetMemory ( ) = = data ) <nl> { <nl> void CRPRenderManager : : AddFrame ( const uint8_t * data , size_t size , unsigned int w <nl> if ( renderBuffers . empty ( ) ) <nl> { <nl> / / Copy frame to buffers with visible renderers <nl> - for ( IRenderBufferPool * bufferPool : m_processInfo . GetBufferManager ( ) . GetBufferPools ( ) ) <nl> + for ( IRenderBufferPool * bufferPool : m_processInfo . GetBufferManager ( ) . GetBufferPools ( ) ) <nl> { <nl> if ( ! bufferPool - > HasVisibleRenderer ( ) ) <nl> continue ; <nl> <nl> - IRenderBuffer * renderBuffer = bufferPool - > GetBuffer ( width , height ) ; <nl> + IRenderBuffer * renderBuffer = bufferPool - > GetBuffer ( width , height ) ; <nl> if ( renderBuffer ! = nullptr ) <nl> { <nl> CopyFrame ( renderBuffer , m_format , data , size , width , height ) ; <nl> void CRPRenderManager : : FrameMove ( ) <nl> <nl> if ( bIsConfigured ) <nl> { <nl> - for ( auto & renderer : m_renderers ) <nl> + for ( auto & renderer : m_renderers ) <nl> renderer - > FrameMove ( ) ; <nl> } <nl> } <nl> void CRPRenderManager : : CheckFlush ( ) <nl> m_bHasCachedFrame = false ; <nl> } <nl> <nl> - for ( const auto & renderer : m_renderers ) <nl> + for ( const auto & renderer : m_renderers ) <nl> renderer - > Flush ( ) ; <nl> <nl> m_processInfo . GetBufferManager ( ) . FlushPools ( ) ; <nl> void CRPRenderManager : : Flush ( ) <nl> m_bFlush = true ; <nl> } <nl> <nl> - void CRPRenderManager : : RenderWindow ( bool bClear , const RESOLUTION_INFO & coordsRes ) <nl> + void CRPRenderManager : : RenderWindow ( bool bClear , const RESOLUTION_INFO & coordsRes ) <nl> { <nl> std : : shared_ptr < CRPBaseRenderer > renderer = GetRenderer ( nullptr ) ; <nl> if ( ! renderer ) <nl> void CRPRenderManager : : RenderWindow ( bool bClear , const RESOLUTION_INFO & coordsRe <nl> m_renderContext . SetRenderingResolution ( coordsRes , false ) ; <nl> } <nl> <nl> - void CRPRenderManager : : RenderControl ( bool bClear , bool bUseAlpha , const CRect & renderRegion , const IGUIRenderSettings * renderSettings ) <nl> + void CRPRenderManager : : RenderControl ( bool bClear , <nl> + bool bUseAlpha , <nl> + const CRect & renderRegion , <nl> + const IGUIRenderSettings * renderSettings ) <nl> { <nl> std : : shared_ptr < CRPBaseRenderer > renderer = GetRenderer ( renderSettings ) ; <nl> if ( ! renderer ) <nl> void CRPRenderManager : : ClearBackground ( ) <nl> bool CRPRenderManager : : SupportsRenderFeature ( RENDERFEATURE feature ) const <nl> { <nl> / / ! @ todo Move to ProcessInfo <nl> - for ( const auto & renderer : m_renderers ) <nl> + for ( const auto & renderer : m_renderers ) <nl> { <nl> if ( renderer - > Supports ( feature ) ) <nl> return true ; <nl> bool CRPRenderManager : : SupportsRenderFeature ( RENDERFEATURE feature ) const <nl> bool CRPRenderManager : : SupportsScalingMethod ( SCALINGMETHOD method ) const <nl> { <nl> / / ! @ todo Move to ProcessInfo <nl> - for ( IRenderBufferPool * bufferPool : m_processInfo . GetBufferManager ( ) . GetBufferPools ( ) ) <nl> + for ( IRenderBufferPool * bufferPool : m_processInfo . GetBufferManager ( ) . GetBufferPools ( ) ) <nl> { <nl> CRenderVideoSettings renderSettings ; <nl> renderSettings . SetScalingMethod ( method ) ; <nl> bool CRPRenderManager : : SupportsScalingMethod ( SCALINGMETHOD method ) const <nl> return false ; <nl> } <nl> <nl> - void CRPRenderManager : : RenderInternal ( const std : : shared_ptr < CRPBaseRenderer > & renderer , bool bClear , uint32_t alpha ) <nl> + void CRPRenderManager : : RenderInternal ( const std : : shared_ptr < CRPBaseRenderer > & renderer , <nl> + bool bClear , <nl> + uint32_t alpha ) <nl> { <nl> renderer - > PreRender ( bClear ) ; <nl> <nl> CSingleExit exitLock ( m_renderContext . GraphicsMutex ( ) ) ; <nl> <nl> - IRenderBuffer * renderBuffer = GetRenderBuffer ( renderer - > GetBufferPool ( ) ) ; <nl> + IRenderBuffer * renderBuffer = GetRenderBuffer ( renderer - > GetBufferPool ( ) ) ; <nl> <nl> / / If our renderer has no buffer , try to create one from paused frame now <nl> if ( renderBuffer = = nullptr ) <nl> void CRPRenderManager : : RenderInternal ( const std : : shared_ptr < CRPBaseRenderer > & re <nl> renderer - > RenderFrame ( bClear , alpha ) ; <nl> } <nl> <nl> - std : : shared_ptr < CRPBaseRenderer > CRPRenderManager : : GetRenderer ( const IGUIRenderSettings * renderSettings ) <nl> + std : : shared_ptr < CRPBaseRenderer > CRPRenderManager : : GetRenderer ( <nl> + const IGUIRenderSettings * renderSettings ) <nl> { <nl> std : : shared_ptr < CRPBaseRenderer > renderer ; <nl> <nl> std : : shared_ptr < CRPBaseRenderer > CRPRenderManager : : GetRenderer ( const IGUIRenderS <nl> effectiveRenderSettings . VideoSettings ( ) = GetEffectiveSettings ( renderSettings ) ; <nl> <nl> / / Check renderers in order of buffer pools <nl> - for ( IRenderBufferPool * bufferPool : m_processInfo . GetBufferManager ( ) . GetBufferPools ( ) ) <nl> + for ( IRenderBufferPool * bufferPool : m_processInfo . GetBufferManager ( ) . GetBufferPools ( ) ) <nl> { <nl> renderer = GetRenderer ( bufferPool , effectiveRenderSettings ) ; <nl> if ( renderer ) <nl> std : : shared_ptr < CRPBaseRenderer > CRPRenderManager : : GetRenderer ( const IGUIRenderS <nl> return renderer ; <nl> } <nl> <nl> - std : : shared_ptr < CRPBaseRenderer > CRPRenderManager : : GetRenderer ( IRenderBufferPool * bufferPool , const CRenderSettings & renderSettings ) <nl> + std : : shared_ptr < CRPBaseRenderer > CRPRenderManager : : GetRenderer ( <nl> + IRenderBufferPool * bufferPool , const CRenderSettings & renderSettings ) <nl> { <nl> std : : shared_ptr < CRPBaseRenderer > renderer ; <nl> <nl> std : : shared_ptr < CRPBaseRenderer > CRPRenderManager : : GetRenderer ( IRenderBufferPool <nl> } <nl> <nl> / / Get compatible renderer for this buffer pool <nl> - for ( const auto & it : m_renderers ) <nl> + for ( const auto & it : m_renderers ) <nl> { <nl> if ( it - > GetBufferPool ( ) ! = bufferPool ) <nl> continue ; <nl> std : : shared_ptr < CRPBaseRenderer > CRPRenderManager : : GetRenderer ( IRenderBufferPool <nl> return renderer ; <nl> } <nl> <nl> - bool CRPRenderManager : : HasRenderBuffer ( IRenderBufferPool * bufferPool ) <nl> + bool CRPRenderManager : : HasRenderBuffer ( IRenderBufferPool * bufferPool ) <nl> { <nl> bool bHasRenderBuffer = false ; <nl> <nl> CSingleLock lock ( m_bufferMutex ) ; <nl> <nl> - auto it = std : : find_if ( m_renderBuffers . begin ( ) , m_renderBuffers . end ( ) , <nl> - [ bufferPool ] ( IRenderBuffer * renderBuffer ) <nl> - { <nl> - return renderBuffer - > GetPool ( ) = = bufferPool ; <nl> - } ) ; <nl> + auto it = std : : find_if ( <nl> + m_renderBuffers . begin ( ) , m_renderBuffers . end ( ) , <nl> + [ bufferPool ] ( IRenderBuffer * renderBuffer ) { return renderBuffer - > GetPool ( ) = = bufferPool ; } ) ; <nl> <nl> if ( it ! = m_renderBuffers . end ( ) ) <nl> bHasRenderBuffer = true ; <nl> bool CRPRenderManager : : HasRenderBuffer ( IRenderBufferPool * bufferPool ) <nl> return bHasRenderBuffer ; <nl> } <nl> <nl> - IRenderBuffer * CRPRenderManager : : GetRenderBuffer ( IRenderBufferPool * bufferPool ) <nl> + IRenderBuffer * CRPRenderManager : : GetRenderBuffer ( IRenderBufferPool * bufferPool ) <nl> { <nl> if ( m_bFlush | | m_state ! = RENDER_STATE : : CONFIGURED ) <nl> return nullptr ; <nl> <nl> - IRenderBuffer * renderBuffer = nullptr ; <nl> + IRenderBuffer * renderBuffer = nullptr ; <nl> <nl> CSingleLock lock ( m_bufferMutex ) ; <nl> <nl> - auto it = std : : find_if ( m_renderBuffers . begin ( ) , m_renderBuffers . end ( ) , <nl> - [ bufferPool ] ( IRenderBuffer * renderBuffer ) <nl> - { <nl> - return renderBuffer - > GetPool ( ) = = bufferPool ; <nl> - } ) ; <nl> + auto it = std : : find_if ( <nl> + m_renderBuffers . begin ( ) , m_renderBuffers . end ( ) , <nl> + [ bufferPool ] ( IRenderBuffer * renderBuffer ) { return renderBuffer - > GetPool ( ) = = bufferPool ; } ) ; <nl> <nl> if ( it ! = m_renderBuffers . end ( ) ) <nl> { <nl> IRenderBuffer * CRPRenderManager : : GetRenderBuffer ( IRenderBufferPool * bufferPool ) <nl> return renderBuffer ; <nl> } <nl> <nl> - void CRPRenderManager : : CreateRenderBuffer ( IRenderBufferPool * bufferPool ) <nl> + void CRPRenderManager : : CreateRenderBuffer ( IRenderBufferPool * bufferPool ) <nl> { <nl> if ( m_bFlush | | m_state ! = RENDER_STATE : : CONFIGURED ) <nl> return ; <nl> void CRPRenderManager : : CreateRenderBuffer ( IRenderBufferPool * bufferPool ) <nl> <nl> if ( ! HasRenderBuffer ( bufferPool ) & & m_bHasCachedFrame ) <nl> { <nl> - IRenderBuffer * renderBuffer = CreateFromCache ( m_cachedFrame , m_cachedWidth , m_cachedHeight , bufferPool , m_bufferMutex ) ; <nl> + IRenderBuffer * renderBuffer = <nl> + CreateFromCache ( m_cachedFrame , m_cachedWidth , m_cachedHeight , bufferPool , m_bufferMutex ) ; <nl> if ( renderBuffer ! = nullptr ) <nl> m_renderBuffers . emplace_back ( renderBuffer ) ; <nl> } <nl> } <nl> <nl> - IRenderBuffer * CRPRenderManager : : CreateFromCache ( std : : vector < uint8_t > & cachedFrame , unsigned int width , unsigned int height , IRenderBufferPool * bufferPool , CCriticalSection & mutex ) <nl> + IRenderBuffer * CRPRenderManager : : CreateFromCache ( std : : vector < uint8_t > & cachedFrame , <nl> + unsigned int width , <nl> + unsigned int height , <nl> + IRenderBufferPool * bufferPool , <nl> + CCriticalSection & mutex ) <nl> { <nl> / / Take ownership of cached frame <nl> std : : vector < uint8_t > ownedFrame = std : : move ( cachedFrame ) ; <nl> IRenderBuffer * CRPRenderManager : : CreateFromCache ( std : : vector < uint8_t > & cachedFra <nl> { <nl> CLog : : Log ( LOGERROR , " RetroPlayer [ RENDER ] : Creating render buffer for renderer " ) ; <nl> <nl> - IRenderBuffer * renderBuffer = bufferPool - > GetBuffer ( width , height ) ; <nl> + IRenderBuffer * renderBuffer = bufferPool - > GetBuffer ( width , height ) ; <nl> if ( renderBuffer ! = nullptr ) <nl> { <nl> CSingleExit exit ( mutex ) ; <nl> IRenderBuffer * CRPRenderManager : : CreateFromCache ( std : : vector < uint8_t > & cachedFra <nl> return nullptr ; <nl> } <nl> <nl> - void CRPRenderManager : : CopyFrame ( IRenderBuffer * renderBuffer , AVPixelFormat format , const uint8_t * data , size_t size , unsigned int width , unsigned int height ) <nl> + void CRPRenderManager : : CopyFrame ( IRenderBuffer * renderBuffer , <nl> + AVPixelFormat format , <nl> + const uint8_t * data , <nl> + size_t size , <nl> + unsigned int width , <nl> + unsigned int height ) <nl> { <nl> - const uint8_t * source = data ; <nl> - uint8_t * target = renderBuffer - > GetMemory ( ) ; <nl> + const uint8_t * source = data ; <nl> + uint8_t * target = renderBuffer - > GetMemory ( ) ; <nl> <nl> if ( target ! = nullptr ) <nl> { <nl> const unsigned int sourceStride = static_cast < unsigned int > ( size / height ) ; <nl> - const unsigned int targetStride = static_cast < unsigned int > ( renderBuffer - > GetFrameSize ( ) / renderBuffer - > GetHeight ( ) ) ; <nl> + const unsigned int targetStride = <nl> + static_cast < unsigned int > ( renderBuffer - > GetFrameSize ( ) / renderBuffer - > GetHeight ( ) ) ; <nl> <nl> if ( m_format = = renderBuffer - > GetFormat ( ) ) <nl> { <nl> void CRPRenderManager : : CopyFrame ( IRenderBuffer * renderBuffer , AVPixelFormat form <nl> } <nl> else <nl> { <nl> - SwsContext * & scalerContext = m_scalers [ renderBuffer - > GetFormat ( ) ] ; <nl> - scalerContext = sws_getCachedContext ( scalerContext , <nl> - width , height , format , <nl> - renderBuffer - > GetWidth ( ) , renderBuffer - > GetHeight ( ) , renderBuffer - > GetFormat ( ) , <nl> - SWS_FAST_BILINEAR , nullptr , nullptr , nullptr ) ; <nl> + SwsContext * & scalerContext = m_scalers [ renderBuffer - > GetFormat ( ) ] ; <nl> + scalerContext = sws_getCachedContext ( <nl> + scalerContext , width , height , format , renderBuffer - > GetWidth ( ) , renderBuffer - > GetHeight ( ) , <nl> + renderBuffer - > GetFormat ( ) , SWS_FAST_BILINEAR , nullptr , nullptr , nullptr ) ; <nl> <nl> if ( scalerContext ! = nullptr ) <nl> { <nl> - uint8_t * src [ ] = { const_cast < uint8_t * > ( source ) , nullptr , nullptr , nullptr } ; <nl> - int srcStride [ ] = { static_cast < int > ( sourceStride ) , 0 , 0 , 0 } ; <nl> - uint8_t * dst [ ] = { target , nullptr , nullptr , nullptr } ; <nl> - int dstStride [ ] = { static_cast < int > ( targetStride ) , 0 , 0 , 0 } ; <nl> + uint8_t * src [ ] = { const_cast < uint8_t * > ( source ) , nullptr , nullptr , nullptr } ; <nl> + int srcStride [ ] = { static_cast < int > ( sourceStride ) , 0 , 0 , 0 } ; <nl> + uint8_t * dst [ ] = { target , nullptr , nullptr , nullptr } ; <nl> + int dstStride [ ] = { static_cast < int > ( targetStride ) , 0 , 0 , 0 } ; <nl> <nl> sws_scale ( scalerContext , src , srcStride , 0 , height , dst , dstStride ) ; <nl> } <nl> void CRPRenderManager : : CopyFrame ( IRenderBuffer * renderBuffer , AVPixelFormat form <nl> renderBuffer - > ReleaseMemory ( ) ; <nl> } <nl> <nl> - CRenderVideoSettings CRPRenderManager : : GetEffectiveSettings ( const IGUIRenderSettings * settings ) const <nl> + CRenderVideoSettings CRPRenderManager : : GetEffectiveSettings ( <nl> + const IGUIRenderSettings * settings ) const <nl> { <nl> CRenderVideoSettings effectiveSettings = m_renderSettings - > GetSettings ( ) . VideoSettings ( ) ; <nl> <nl> CRenderVideoSettings CRPRenderManager : : GetEffectiveSettings ( const IGUIRenderSett <nl> if ( settings - > HasVideoFilter ( ) ) <nl> effectiveSettings . SetVideoFilter ( settings - > GetSettings ( ) . VideoSettings ( ) . GetVideoFilter ( ) ) ; <nl> if ( settings - > HasStretchMode ( ) ) <nl> - effectiveSettings . SetRenderStretchMode ( settings - > GetSettings ( ) . VideoSettings ( ) . GetRenderStretchMode ( ) ) ; <nl> + effectiveSettings . SetRenderStretchMode ( <nl> + settings - > GetSettings ( ) . VideoSettings ( ) . GetRenderStretchMode ( ) ) ; <nl> if ( settings - > HasRotation ( ) ) <nl> - effectiveSettings . SetRenderRotation ( settings - > GetSettings ( ) . VideoSettings ( ) . GetRenderRotation ( ) ) ; <nl> + effectiveSettings . SetRenderRotation ( <nl> + settings - > GetSettings ( ) . VideoSettings ( ) . GetRenderRotation ( ) ) ; <nl> } <nl> <nl> / / Sanitize settings <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RPRenderManager . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RPRenderManager . h <nl> <nl> # include " cores / RetroPlayer / guibridge / IRenderCallback . h " <nl> # include " threads / CriticalSection . h " <nl> <nl> - extern " C " { <nl> + extern " C " <nl> + { <nl> # include < libavutil / pixfmt . h > <nl> } <nl> <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CGUIRenderTargetFactory ; <nl> - class CRenderContext ; <nl> - class CRenderSettings ; <nl> - class CRPBaseRenderer ; <nl> - class CRPProcessInfo ; <nl> - class IGUIRenderSettings ; <nl> - class IRenderBuffer ; <nl> - class IRenderBufferPool ; <nl> + class CGUIRenderTargetFactory ; <nl> + class CRenderContext ; <nl> + class CRenderSettings ; <nl> + class CRPBaseRenderer ; <nl> + class CRPProcessInfo ; <nl> + class IGUIRenderSettings ; <nl> + class IRenderBuffer ; <nl> + class IRenderBufferPool ; <nl> + <nl> + / * ! <nl> + * \ brief Renders video frames provided by the game loop <nl> + * <nl> + * Generally , buffer pools are registered by the windowing subsystem . A buffer <nl> + * pool provides a software or hardware buffer to store the added frame . When <nl> + * RenderManager is created , it instantiates all registered buffer pools . <nl> + * <nl> + * When a frame arrives , it is copied into a buffer from each buffer pool with <nl> + * a visible renderer . For example , if a GLES and MMAL renderer are both <nl> + * visible in the GUI , then the frame will be copied into two buffers . <nl> + * <nl> + * When it is time to render the frame , the GUI control or window calls into <nl> + * this class through the IRenderManager interface . RenderManager selects an <nl> + * appropriate renderer to use to render the frame . The renderer is then <nl> + * given the buffer that came from its buffer pool . <nl> + * <nl> + * Special behavior is needed when the game is paused . As no new frames are <nl> + * delivered , a newly created renderer will stay black . For this scenario , <nl> + * when we detect a pause event , the frame is preemptively cached so that a <nl> + * newly created renderer will have something to display . <nl> + * / <nl> + class CRPRenderManager : public IRenderManager , public IRenderCallback <nl> + { <nl> + public : <nl> + CRPRenderManager ( CRPProcessInfo & processInfo ) ; <nl> + ~ CRPRenderManager ( ) override = default ; <nl> + <nl> + void Initialize ( ) ; <nl> + void Deinitialize ( ) ; <nl> + <nl> + / * ! <nl> + * \ brief Access the factory for creating GUI render targets <nl> + * / <nl> + CGUIRenderTargetFactory * GetGUIRenderTargetFactory ( ) { return m_renderControlFactory . get ( ) ; } <nl> + <nl> + / / Functions called from game loop <nl> + bool Configure ( AVPixelFormat format , <nl> + unsigned int nominalWidth , <nl> + unsigned int nominalHeight , <nl> + unsigned int maxWidth , <nl> + unsigned int maxHeight ) ; <nl> + bool GetVideoBuffer ( <nl> + unsigned int width , unsigned int height , AVPixelFormat & format , uint8_t * & data , size_t & size ) ; <nl> + void AddFrame ( const uint8_t * data , <nl> + size_t size , <nl> + unsigned int width , <nl> + unsigned int height , <nl> + unsigned int orientationDegCW ) ; <nl> + void Flush ( ) ; <nl> + <nl> + / / Functions called from the player <nl> + void SetSpeed ( double speed ) ; <nl> + <nl> + / / Functions called from render thread <nl> + void FrameMove ( ) ; <nl> + <nl> + / / Implementation of IRenderManager <nl> + void RenderWindow ( bool bClear , const RESOLUTION_INFO & coordsRes ) override ; <nl> + void RenderControl ( bool bClear , <nl> + bool bUseAlpha , <nl> + const CRect & renderRegion , <nl> + const IGUIRenderSettings * renderSettings ) override ; <nl> + void ClearBackground ( ) override ; <nl> + <nl> + / / Implementation of IRenderCallback <nl> + bool SupportsRenderFeature ( RENDERFEATURE feature ) const override ; <nl> + bool SupportsScalingMethod ( SCALINGMETHOD method ) const override ; <nl> + <nl> + private : <nl> + / * ! <nl> + * \ brief Get or create a renderer compatible with the given render settings <nl> + * / <nl> + std : : shared_ptr < CRPBaseRenderer > GetRenderer ( const IGUIRenderSettings * renderSettings ) ; <nl> + <nl> + / * ! <nl> + * \ brief Get or create a renderer for the given buffer pool and render settings <nl> + * / <nl> + std : : shared_ptr < CRPBaseRenderer > GetRenderer ( IRenderBufferPool * bufferPool , <nl> + const CRenderSettings & renderSettings ) ; <nl> + <nl> + / * ! <nl> + * \ brief Render a frame using the given renderer <nl> + * / <nl> + void RenderInternal ( const std : : shared_ptr < CRPBaseRenderer > & renderer , <nl> + bool bClear , <nl> + uint32_t alpha ) ; <nl> + <nl> + / * ! <nl> + * \ brief Return true if we have a render buffer belonging to the specified pool <nl> + * / <nl> + bool HasRenderBuffer ( IRenderBufferPool * bufferPool ) ; <nl> <nl> / * ! <nl> - * \ brief Renders video frames provided by the game loop <nl> + * \ brief Get a render buffer belonging to the specified pool <nl> + * / <nl> + IRenderBuffer * GetRenderBuffer ( IRenderBufferPool * bufferPool ) ; <nl> + <nl> + / * ! <nl> + * \ brief Create a render buffer for the specified pool from a cached frame <nl> + * / <nl> + void CreateRenderBuffer ( IRenderBufferPool * bufferPool ) ; <nl> + <nl> + / * ! <nl> + * \ brief Create a render buffer and copy the cached data into it <nl> * <nl> - * Generally , buffer pools are registered by the windowing subsystem . A buffer <nl> - * pool provides a software or hardware buffer to store the added frame . When <nl> - * RenderManager is created , it instantiates all registered buffer pools . <nl> + * The cached frame is accessed by both the game and rendering threads , <nl> + * and therefore requires synchronization . <nl> * <nl> - * When a frame arrives , it is copied into a buffer from each buffer pool with <nl> - * a visible renderer . For example , if a GLES and MMAL renderer are both <nl> - * visible in the GUI , then the frame will be copied into two buffers . <nl> + * However , assuming the memory copy is expensive , we must avoid holding <nl> + * the mutex during the copy . <nl> * <nl> - * When it is time to render the frame , the GUI control or window calls into <nl> - * this class through the IRenderManager interface . RenderManager selects an <nl> - * appropriate renderer to use to render the frame . The renderer is then <nl> - * given the buffer that came from its buffer pool . <nl> + * To allow for this , the function is permitted to invalidate its <nl> + * cachedFrame parameter , as long as it is restored upon exit . While the <nl> + * mutex is exited inside this function , cachedFrame is guaranteed to be <nl> + * empty . <nl> * <nl> - * Special behavior is needed when the game is paused . As no new frames are <nl> - * delivered , a newly created renderer will stay black . For this scenario , <nl> - * when we detect a pause event , the frame is preemptively cached so that a <nl> - * newly created renderer will have something to display . <nl> + * \ param cachedFrame The cached frame <nl> + * \ param width The width of the cached frame <nl> + * \ param height The height of the cached frame <nl> + * \ param bufferPool The buffer pool used to create the render buffer <nl> + * \ param mutex The locked mutex , to be unlocked during memory copy <nl> + * <nl> + * \ return The render buffer if one was created from the cached frame , <nl> + * otherwise nullptr <nl> + * / <nl> + IRenderBuffer * CreateFromCache ( std : : vector < uint8_t > & cachedFrame , <nl> + unsigned int width , <nl> + unsigned int height , <nl> + IRenderBufferPool * bufferPool , <nl> + CCriticalSection & mutex ) ; <nl> + <nl> + / * ! <nl> + * \ brief Utility function to copy a frame and rescale pixels if necessary <nl> * / <nl> - class CRPRenderManager : public IRenderManager , <nl> - public IRenderCallback <nl> + void CopyFrame ( IRenderBuffer * renderBuffer , <nl> + AVPixelFormat format , <nl> + const uint8_t * data , <nl> + size_t size , <nl> + unsigned int width , <nl> + unsigned int height ) ; <nl> + <nl> + CRenderVideoSettings GetEffectiveSettings ( const IGUIRenderSettings * settings ) const ; <nl> + <nl> + void CheckFlush ( ) ; <nl> + <nl> + / / Construction parameters <nl> + CRPProcessInfo & m_processInfo ; <nl> + CRenderContext & m_renderContext ; <nl> + <nl> + / / Subsystems <nl> + std : : shared_ptr < IGUIRenderSettings > m_renderSettings ; <nl> + std : : shared_ptr < CGUIRenderTargetFactory > m_renderControlFactory ; <nl> + <nl> + / / Stream properties <nl> + AVPixelFormat m_format = AV_PIX_FMT_NONE ; <nl> + unsigned int m_maxWidth = 0 ; <nl> + unsigned int m_maxHeight = 0 ; <nl> + <nl> + / / Render resources <nl> + std : : set < std : : shared_ptr < CRPBaseRenderer > > m_renderers ; <nl> + std : : vector < IRenderBuffer * > m_pendingBuffers ; / / Only access from game thread <nl> + std : : vector < IRenderBuffer * > m_renderBuffers ; <nl> + std : : map < AVPixelFormat , SwsContext * > m_scalers ; <nl> + std : : vector < uint8_t > m_cachedFrame ; <nl> + unsigned int m_cachedWidth = 0 ; <nl> + unsigned int m_cachedHeight = 0 ; <nl> + <nl> + / / State parameters <nl> + enum class RENDER_STATE <nl> { <nl> - public : <nl> - CRPRenderManager ( CRPProcessInfo & processInfo ) ; <nl> - ~ CRPRenderManager ( ) override = default ; <nl> - <nl> - void Initialize ( ) ; <nl> - void Deinitialize ( ) ; <nl> - <nl> - / * ! <nl> - * \ brief Access the factory for creating GUI render targets <nl> - * / <nl> - CGUIRenderTargetFactory * GetGUIRenderTargetFactory ( ) { return m_renderControlFactory . get ( ) ; } <nl> - <nl> - / / Functions called from game loop <nl> - bool Configure ( AVPixelFormat format , unsigned int nominalWidth , unsigned int nominalHeight , unsigned int maxWidth , unsigned int maxHeight ) ; <nl> - bool GetVideoBuffer ( unsigned int width , unsigned int height , AVPixelFormat & format , uint8_t * & data , size_t & size ) ; <nl> - void AddFrame ( const uint8_t * data , size_t size , unsigned int width , unsigned int height , unsigned int orientationDegCW ) ; <nl> - void Flush ( ) ; <nl> - <nl> - / / Functions called from the player <nl> - void SetSpeed ( double speed ) ; <nl> - <nl> - / / Functions called from render thread <nl> - void FrameMove ( ) ; <nl> - <nl> - / / Implementation of IRenderManager <nl> - void RenderWindow ( bool bClear , const RESOLUTION_INFO & coordsRes ) override ; <nl> - void RenderControl ( bool bClear , bool bUseAlpha , const CRect & renderRegion , const IGUIRenderSettings * renderSettings ) override ; <nl> - void ClearBackground ( ) override ; <nl> - <nl> - / / Implementation of IRenderCallback <nl> - bool SupportsRenderFeature ( RENDERFEATURE feature ) const override ; <nl> - bool SupportsScalingMethod ( SCALINGMETHOD method ) const override ; <nl> - <nl> - private : <nl> - / * ! <nl> - * \ brief Get or create a renderer compatible with the given render settings <nl> - * / <nl> - std : : shared_ptr < CRPBaseRenderer > GetRenderer ( const IGUIRenderSettings * renderSettings ) ; <nl> - <nl> - / * ! <nl> - * \ brief Get or create a renderer for the given buffer pool and render settings <nl> - * / <nl> - std : : shared_ptr < CRPBaseRenderer > GetRenderer ( IRenderBufferPool * bufferPool , const CRenderSettings & renderSettings ) ; <nl> - <nl> - / * ! <nl> - * \ brief Render a frame using the given renderer <nl> - * / <nl> - void RenderInternal ( const std : : shared_ptr < CRPBaseRenderer > & renderer , bool bClear , uint32_t alpha ) ; <nl> - <nl> - / * ! <nl> - * \ brief Return true if we have a render buffer belonging to the specified pool <nl> - * / <nl> - bool HasRenderBuffer ( IRenderBufferPool * bufferPool ) ; <nl> - <nl> - / * ! <nl> - * \ brief Get a render buffer belonging to the specified pool <nl> - * / <nl> - IRenderBuffer * GetRenderBuffer ( IRenderBufferPool * bufferPool ) ; <nl> - <nl> - / * ! <nl> - * \ brief Create a render buffer for the specified pool from a cached frame <nl> - * / <nl> - void CreateRenderBuffer ( IRenderBufferPool * bufferPool ) ; <nl> - <nl> - / * ! <nl> - * \ brief Create a render buffer and copy the cached data into it <nl> - * <nl> - * The cached frame is accessed by both the game and rendering threads , <nl> - * and therefore requires synchronization . <nl> - * <nl> - * However , assuming the memory copy is expensive , we must avoid holding <nl> - * the mutex during the copy . <nl> - * <nl> - * To allow for this , the function is permitted to invalidate its <nl> - * cachedFrame parameter , as long as it is restored upon exit . While the <nl> - * mutex is exited inside this function , cachedFrame is guaranteed to be <nl> - * empty . <nl> - * <nl> - * \ param cachedFrame The cached frame <nl> - * \ param width The width of the cached frame <nl> - * \ param height The height of the cached frame <nl> - * \ param bufferPool The buffer pool used to create the render buffer <nl> - * \ param mutex The locked mutex , to be unlocked during memory copy <nl> - * <nl> - * \ return The render buffer if one was created from the cached frame , <nl> - * otherwise nullptr <nl> - * / <nl> - IRenderBuffer * CreateFromCache ( std : : vector < uint8_t > & cachedFrame , unsigned int width , unsigned int height , IRenderBufferPool * bufferPool , CCriticalSection & mutex ) ; <nl> - <nl> - / * ! <nl> - * \ brief Utility function to copy a frame and rescale pixels if necessary <nl> - * / <nl> - void CopyFrame ( IRenderBuffer * renderBuffer , AVPixelFormat format , const uint8_t * data , size_t size , unsigned int width , unsigned int height ) ; <nl> - <nl> - CRenderVideoSettings GetEffectiveSettings ( const IGUIRenderSettings * settings ) const ; <nl> - <nl> - void CheckFlush ( ) ; <nl> - <nl> - / / Construction parameters <nl> - CRPProcessInfo & m_processInfo ; <nl> - CRenderContext & m_renderContext ; <nl> - <nl> - / / Subsystems <nl> - std : : shared_ptr < IGUIRenderSettings > m_renderSettings ; <nl> - std : : shared_ptr < CGUIRenderTargetFactory > m_renderControlFactory ; <nl> - <nl> - / / Stream properties <nl> - AVPixelFormat m_format = AV_PIX_FMT_NONE ; <nl> - unsigned int m_maxWidth = 0 ; <nl> - unsigned int m_maxHeight = 0 ; <nl> - <nl> - / / Render resources <nl> - std : : set < std : : shared_ptr < CRPBaseRenderer > > m_renderers ; <nl> - std : : vector < IRenderBuffer * > m_pendingBuffers ; / / Only access from game thread <nl> - std : : vector < IRenderBuffer * > m_renderBuffers ; <nl> - std : : map < AVPixelFormat , SwsContext * > m_scalers ; <nl> - std : : vector < uint8_t > m_cachedFrame ; <nl> - unsigned int m_cachedWidth = 0 ; <nl> - unsigned int m_cachedHeight = 0 ; <nl> - <nl> - / / State parameters <nl> - enum class RENDER_STATE <nl> - { <nl> - UNCONFIGURED , <nl> - CONFIGURING , <nl> - CONFIGURED , <nl> - } ; <nl> - RENDER_STATE m_state = RENDER_STATE : : UNCONFIGURED ; <nl> - bool m_bHasCachedFrame = false ; / / Invariant : m_cachedFrame is empty if false <nl> - std : : set < std : : string > m_failedShaderPresets ; <nl> - std : : atomic < bool > m_bFlush = { false } ; <nl> - <nl> - / / Playback parameters <nl> - std : : atomic < double > m_speed = { 1 . 0 } ; <nl> - <nl> - / / Synchronization parameters <nl> - CCriticalSection m_stateMutex ; <nl> - CCriticalSection m_bufferMutex ; <nl> + UNCONFIGURED , <nl> + CONFIGURING , <nl> + CONFIGURED , <nl> } ; <nl> - } <nl> - } <nl> + RENDER_STATE m_state = RENDER_STATE : : UNCONFIGURED ; <nl> + bool m_bHasCachedFrame = false ; / / Invariant : m_cachedFrame is empty if false <nl> + std : : set < std : : string > m_failedShaderPresets ; <nl> + std : : atomic < bool > m_bFlush = { false } ; <nl> + <nl> + / / Playback parameters <nl> + std : : atomic < double > m_speed = { 1 . 0 } ; <nl> + <nl> + / / Synchronization parameters <nl> + CCriticalSection m_stateMutex ; <nl> + CCriticalSection m_bufferMutex ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RenderContext . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RenderContext . cpp <nl> <nl> * / <nl> <nl> # include " RenderContext . h " <nl> - # include " windowing / GraphicContext . h " <nl> + <nl> # include " rendering / RenderSystem . h " <nl> # include " settings / DisplaySettings . h " <nl> # include " settings / MediaSettings . h " <nl> + # include " windowing / GraphicContext . h " <nl> # include " windowing / WinSystem . h " <nl> + <nl> # include " system_gl . h " <nl> <nl> # if defined ( HAS_GL ) <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRenderContext : : CRenderContext ( CRenderSystemBase * rendering , <nl> - CWinSystemBase * windowing , <nl> - CGraphicContext & graphicsContext , <nl> - CDisplaySettings & displaySettings , <nl> - CMediaSettings & mediaSettings ) : <nl> - m_rendering ( rendering ) , <nl> - m_windowing ( windowing ) , <nl> - m_graphicsContext ( graphicsContext ) , <nl> - m_displaySettings ( displaySettings ) , <nl> - m_mediaSettings ( mediaSettings ) <nl> + CRenderContext : : CRenderContext ( CRenderSystemBase * rendering , <nl> + CWinSystemBase * windowing , <nl> + CGraphicContext & graphicsContext , <nl> + CDisplaySettings & displaySettings , <nl> + CMediaSettings & mediaSettings ) <nl> + : m_rendering ( rendering ) , <nl> + m_windowing ( windowing ) , <nl> + m_graphicsContext ( graphicsContext ) , <nl> + m_displaySettings ( displaySettings ) , <nl> + m_mediaSettings ( mediaSettings ) <nl> { <nl> } <nl> <nl> void CRenderContext : : SetViewPort ( const CRect & viewPort ) <nl> m_rendering - > SetViewPort ( viewPort ) ; <nl> } <nl> <nl> - void CRenderContext : : GetViewPort ( CRect & viewPort ) <nl> + void CRenderContext : : GetViewPort ( CRect & viewPort ) <nl> { <nl> m_rendering - > GetViewPort ( viewPort ) ; <nl> } <nl> <nl> - void CRenderContext : : SetScissors ( const CRect & rect ) <nl> + void CRenderContext : : SetScissors ( const CRect & rect ) <nl> { <nl> m_rendering - > SetScissors ( rect ) ; <nl> } <nl> static ESHADERMETHOD TranslateShaderMethod ( GL_SHADER_METHOD method ) <nl> { <nl> switch ( method ) <nl> { <nl> - case GL_SHADER_METHOD : : DEFAULT : return SM_DEFAULT ; <nl> - case GL_SHADER_METHOD : : TEXTURE : return SM_TEXTURE ; <nl> + case GL_SHADER_METHOD : : DEFAULT : <nl> + return SM_DEFAULT ; <nl> + case GL_SHADER_METHOD : : TEXTURE : <nl> + return SM_TEXTURE ; <nl> # if defined ( HAS_GLES ) <nl> - case GL_SHADER_METHOD : : TEXTURE_NOALPHA : <nl> - return SM_TEXTURE_NOALPHA ; <nl> + case GL_SHADER_METHOD : : TEXTURE_NOALPHA : <nl> + return SM_TEXTURE_NOALPHA ; <nl> # endif <nl> - default : <nl> - break ; <nl> + default : <nl> + break ; <nl> } <nl> <nl> return SM_DEFAULT ; <nl> } <nl> - } <nl> + } / / namespace <nl> # endif <nl> <nl> void CRenderContext : : EnableGUIShader ( GL_SHADER_METHOD method ) <nl> { <nl> # if defined ( HAS_GL ) <nl> - CRenderSystemGL * rendering = dynamic_cast < CRenderSystemGL * > ( m_rendering ) ; <nl> + CRenderSystemGL * rendering = dynamic_cast < CRenderSystemGL * > ( m_rendering ) ; <nl> if ( rendering ! = nullptr ) <nl> rendering - > EnableShader ( TranslateShaderMethod ( method ) ) ; <nl> # elif HAS_GLES > = 2 <nl> - CRenderSystemGLES * renderingGLES = dynamic_cast < CRenderSystemGLES * > ( m_rendering ) ; <nl> + CRenderSystemGLES * renderingGLES = dynamic_cast < CRenderSystemGLES * > ( m_rendering ) ; <nl> if ( renderingGLES ! = nullptr ) <nl> renderingGLES - > EnableGUIShader ( TranslateShaderMethod ( method ) ) ; <nl> # endif <nl> void CRenderContext : : EnableGUIShader ( GL_SHADER_METHOD method ) <nl> void CRenderContext : : DisableGUIShader ( ) <nl> { <nl> # if defined ( HAS_GL ) <nl> - CRenderSystemGL * renderingGL = dynamic_cast < CRenderSystemGL * > ( m_rendering ) ; <nl> + CRenderSystemGL * renderingGL = dynamic_cast < CRenderSystemGL * > ( m_rendering ) ; <nl> if ( renderingGL ! = nullptr ) <nl> renderingGL - > DisableShader ( ) ; <nl> # elif HAS_GLES > = 2 <nl> - CRenderSystemGLES * renderingGLES = dynamic_cast < CRenderSystemGLES * > ( m_rendering ) ; <nl> + CRenderSystemGLES * renderingGLES = dynamic_cast < CRenderSystemGLES * > ( m_rendering ) ; <nl> if ( renderingGLES ! = nullptr ) <nl> renderingGLES - > DisableGUIShader ( ) ; <nl> # endif <nl> void CRenderContext : : DisableGUIShader ( ) <nl> int CRenderContext : : GUIShaderGetPos ( ) <nl> { <nl> # if defined ( HAS_GL ) <nl> - CRenderSystemGL * renderingGL = dynamic_cast < CRenderSystemGL * > ( m_rendering ) ; <nl> + CRenderSystemGL * renderingGL = dynamic_cast < CRenderSystemGL * > ( m_rendering ) ; <nl> if ( renderingGL ! = nullptr ) <nl> return static_cast < int > ( renderingGL - > ShaderGetPos ( ) ) ; <nl> # elif HAS_GLES > = 2 <nl> - CRenderSystemGLES * renderingGLES = dynamic_cast < CRenderSystemGLES * > ( m_rendering ) ; <nl> + CRenderSystemGLES * renderingGLES = dynamic_cast < CRenderSystemGLES * > ( m_rendering ) ; <nl> if ( renderingGLES ! = nullptr ) <nl> return static_cast < int > ( renderingGLES - > GUIShaderGetPos ( ) ) ; <nl> # endif <nl> int CRenderContext : : GUIShaderGetPos ( ) <nl> int CRenderContext : : GUIShaderGetCoord0 ( ) <nl> { <nl> # if defined ( HAS_GL ) <nl> - CRenderSystemGL * renderingGL = dynamic_cast < CRenderSystemGL * > ( m_rendering ) ; <nl> + CRenderSystemGL * renderingGL = dynamic_cast < CRenderSystemGL * > ( m_rendering ) ; <nl> if ( renderingGL ! = nullptr ) <nl> return static_cast < int > ( renderingGL - > ShaderGetCoord0 ( ) ) ; <nl> # elif HAS_GLES > = 2 <nl> - CRenderSystemGLES * renderingGLES = dynamic_cast < CRenderSystemGLES * > ( m_rendering ) ; <nl> + CRenderSystemGLES * renderingGLES = dynamic_cast < CRenderSystemGLES * > ( m_rendering ) ; <nl> if ( renderingGLES ! = nullptr ) <nl> return static_cast < int > ( renderingGLES - > GUIShaderGetCoord0 ( ) ) ; <nl> # endif <nl> int CRenderContext : : GUIShaderGetCoord0 ( ) <nl> int CRenderContext : : GUIShaderGetUniCol ( ) <nl> { <nl> # if defined ( HAS_GL ) <nl> - CRenderSystemGL * renderingGL = dynamic_cast < CRenderSystemGL * > ( m_rendering ) ; <nl> + CRenderSystemGL * renderingGL = dynamic_cast < CRenderSystemGL * > ( m_rendering ) ; <nl> if ( renderingGL ! = nullptr ) <nl> return static_cast < int > ( renderingGL - > ShaderGetUniCol ( ) ) ; <nl> # elif HAS_GLES > = 2 <nl> - CRenderSystemGLES * renderingGLES = dynamic_cast < CRenderSystemGLES * > ( m_rendering ) ; <nl> + CRenderSystemGLES * renderingGLES = dynamic_cast < CRenderSystemGLES * > ( m_rendering ) ; <nl> if ( renderingGLES ! = nullptr ) <nl> return static_cast < int > ( renderingGLES - > GUIShaderGetUniCol ( ) ) ; <nl> # endif <nl> int CRenderContext : : GUIShaderGetUniCol ( ) <nl> CGUIShaderDX * CRenderContext : : GetGUIShader ( ) <nl> { <nl> # if defined ( HAS_DX ) <nl> - CRenderSystemDX * renderingDX = dynamic_cast < CRenderSystemDX * > ( m_rendering ) ; <nl> + CRenderSystemDX * renderingDX = dynamic_cast < CRenderSystemDX * > ( m_rendering ) ; <nl> if ( renderingDX ! = nullptr ) <nl> return renderingDX - > GetGUIShader ( ) ; <nl> # endif <nl> int CRenderContext : : GetScreenHeight ( ) <nl> return m_graphicsContext . GetHeight ( ) ; <nl> } <nl> <nl> - const CRect & CRenderContext : : GetScissors ( ) <nl> + const CRect & CRenderContext : : GetScissors ( ) <nl> { <nl> return m_graphicsContext . GetScissors ( ) ; <nl> } <nl> RESOLUTION_INFO CRenderContext : : GetResInfo ( ) <nl> return m_graphicsContext . GetResInfo ( ) ; <nl> } <nl> <nl> - void CRenderContext : : SetRenderingResolution ( const RESOLUTION_INFO & res , bool needsScaling ) <nl> + void CRenderContext : : SetRenderingResolution ( const RESOLUTION_INFO & res , bool needsScaling ) <nl> { <nl> m_graphicsContext . SetRenderingResolution ( res , needsScaling ) ; <nl> } <nl> UTILS : : Color CRenderContext : : MergeAlpha ( UTILS : : Color color ) <nl> return m_graphicsContext . MergeAlpha ( color ) ; <nl> } <nl> <nl> - void CRenderContext : : SetTransform ( const TransformMatrix & matrix , float scaleX , float scaleY ) <nl> + void CRenderContext : : SetTransform ( const TransformMatrix & matrix , float scaleX , float scaleY ) <nl> { <nl> m_graphicsContext . SetTransform ( matrix , scaleX , scaleY ) ; <nl> } <nl> void CRenderContext : : RemoveTransform ( ) <nl> m_graphicsContext . RemoveTransform ( ) ; <nl> } <nl> <nl> - CRect CRenderContext : : StereoCorrection ( const CRect & rect ) <nl> + CRect CRenderContext : : StereoCorrection ( const CRect & rect ) <nl> { <nl> return m_graphicsContext . StereoCorrection ( rect ) ; <nl> } <nl> <nl> - CCriticalSection & CRenderContext : : GraphicsMutex ( ) <nl> + CCriticalSection & CRenderContext : : GraphicsMutex ( ) <nl> { <nl> return m_graphicsContext ; <nl> } <nl> <nl> - RESOLUTION_INFO & CRenderContext : : GetResolutionInfo ( RESOLUTION resolution ) <nl> + RESOLUTION_INFO & CRenderContext : : GetResolutionInfo ( RESOLUTION resolution ) <nl> { <nl> return m_displaySettings . GetResolutionInfo ( resolution ) ; <nl> } <nl> <nl> - CGameSettings & CRenderContext : : GetGameSettings ( ) <nl> + CGameSettings & CRenderContext : : GetGameSettings ( ) <nl> { <nl> return m_mediaSettings . GetCurrentGameSettings ( ) ; <nl> } <nl> <nl> - CGameSettings & CRenderContext : : GetDefaultGameSettings ( ) <nl> + CGameSettings & CRenderContext : : GetDefaultGameSettings ( ) <nl> { <nl> return m_mediaSettings . GetDefaultGameSettings ( ) ; <nl> } <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RenderContext . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RenderContext . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderContext <nl> - { <nl> - public : <nl> - CRenderContext ( CRenderSystemBase * rendering , <nl> - CWinSystemBase * windowing , <nl> - CGraphicContext & graphicsContext , <nl> - CDisplaySettings & displaySettings , <nl> - CMediaSettings & mediaSettings ) ; <nl> + class CRenderContext <nl> + { <nl> + public : <nl> + CRenderContext ( CRenderSystemBase * rendering , <nl> + CWinSystemBase * windowing , <nl> + CGraphicContext & graphicsContext , <nl> + CDisplaySettings & displaySettings , <nl> + CMediaSettings & mediaSettings ) ; <nl> <nl> - CRenderSystemBase * Rendering ( ) { return m_rendering ; } <nl> - CWinSystemBase * Windowing ( ) { return m_windowing ; } <nl> - CGraphicContext & GraphicsContext ( ) { return m_graphicsContext ; } <nl> + CRenderSystemBase * Rendering ( ) { return m_rendering ; } <nl> + CWinSystemBase * Windowing ( ) { return m_windowing ; } <nl> + CGraphicContext & GraphicsContext ( ) { return m_graphicsContext ; } <nl> <nl> - / / Rendering functions <nl> - void SetViewPort ( const CRect & viewPort ) ; <nl> - void GetViewPort ( CRect & viewPort ) ; <nl> - void SetScissors ( const CRect & rect ) ; <nl> - void ApplyStateBlock ( ) ; <nl> - bool IsExtSupported ( const char * extension ) ; <nl> + / / Rendering functions <nl> + void SetViewPort ( const CRect & viewPort ) ; <nl> + void GetViewPort ( CRect & viewPort ) ; <nl> + void SetScissors ( const CRect & rect ) ; <nl> + void ApplyStateBlock ( ) ; <nl> + bool IsExtSupported ( const char * extension ) ; <nl> <nl> - / / OpenGL ( ES ) rendering functions <nl> - void EnableGUIShader ( GL_SHADER_METHOD method ) ; <nl> - void DisableGUIShader ( ) ; <nl> - int GUIShaderGetPos ( ) ; <nl> - int GUIShaderGetCoord0 ( ) ; <nl> - int GUIShaderGetUniCol ( ) ; <nl> + / / OpenGL ( ES ) rendering functions <nl> + void EnableGUIShader ( GL_SHADER_METHOD method ) ; <nl> + void DisableGUIShader ( ) ; <nl> + int GUIShaderGetPos ( ) ; <nl> + int GUIShaderGetCoord0 ( ) ; <nl> + int GUIShaderGetUniCol ( ) ; <nl> <nl> - / / DirectX rendering functions <nl> - CGUIShaderDX * GetGUIShader ( ) ; <nl> + / / DirectX rendering functions <nl> + CGUIShaderDX * GetGUIShader ( ) ; <nl> <nl> - / / Windowing functions <nl> - bool UseLimitedColor ( ) ; <nl> + / / Windowing functions <nl> + bool UseLimitedColor ( ) ; <nl> <nl> - / / Graphics functions <nl> - int GetScreenWidth ( ) ; <nl> - int GetScreenHeight ( ) ; <nl> - const CRect & GetScissors ( ) ; <nl> - CRect GetViewWindow ( ) ; <nl> - void SetViewWindow ( float left , float top , float right , float bottom ) ; <nl> - void SetFullScreenVideo ( bool bOnOff ) ; <nl> - bool IsFullScreenVideo ( ) ; <nl> - bool IsCalibrating ( ) ; <nl> - RESOLUTION GetVideoResolution ( ) ; <nl> - void Clear ( UTILS : : Color color = 0 ) ; <nl> - RESOLUTION_INFO GetResInfo ( ) ; <nl> - void SetRenderingResolution ( const RESOLUTION_INFO & res , bool needsScaling ) ; <nl> - UTILS : : Color MergeAlpha ( UTILS : : Color color ) ; <nl> - void SetTransform ( const TransformMatrix & matrix , float scaleX , float scaleY ) ; <nl> - void RemoveTransform ( ) ; <nl> - CRect StereoCorrection ( const CRect & rect ) ; <nl> - CCriticalSection & GraphicsMutex ( ) ; <nl> + / / Graphics functions <nl> + int GetScreenWidth ( ) ; <nl> + int GetScreenHeight ( ) ; <nl> + const CRect & GetScissors ( ) ; <nl> + CRect GetViewWindow ( ) ; <nl> + void SetViewWindow ( float left , float top , float right , float bottom ) ; <nl> + void SetFullScreenVideo ( bool bOnOff ) ; <nl> + bool IsFullScreenVideo ( ) ; <nl> + bool IsCalibrating ( ) ; <nl> + RESOLUTION GetVideoResolution ( ) ; <nl> + void Clear ( UTILS : : Color color = 0 ) ; <nl> + RESOLUTION_INFO GetResInfo ( ) ; <nl> + void SetRenderingResolution ( const RESOLUTION_INFO & res , bool needsScaling ) ; <nl> + UTILS : : Color MergeAlpha ( UTILS : : Color color ) ; <nl> + void SetTransform ( const TransformMatrix & matrix , float scaleX , float scaleY ) ; <nl> + void RemoveTransform ( ) ; <nl> + CRect StereoCorrection ( const CRect & rect ) ; <nl> + CCriticalSection & GraphicsMutex ( ) ; <nl> <nl> - / / Display settings <nl> - RESOLUTION_INFO & GetResolutionInfo ( RESOLUTION resolution ) ; <nl> + / / Display settings <nl> + RESOLUTION_INFO & GetResolutionInfo ( RESOLUTION resolution ) ; <nl> <nl> - / / Media settings <nl> - CGameSettings & GetGameSettings ( ) ; <nl> - CGameSettings & GetDefaultGameSettings ( ) ; <nl> + / / Media settings <nl> + CGameSettings & GetGameSettings ( ) ; <nl> + CGameSettings & GetDefaultGameSettings ( ) ; <nl> <nl> - private : <nl> - / / Construction parameters <nl> - CRenderSystemBase * const m_rendering ; <nl> - CWinSystemBase * const m_windowing ; <nl> - CGraphicContext & m_graphicsContext ; <nl> - CDisplaySettings & m_displaySettings ; <nl> - CMediaSettings & m_mediaSettings ; <nl> - } ; <nl> - } <nl> - } <nl> + private : <nl> + / / Construction parameters <nl> + CRenderSystemBase * const m_rendering ; <nl> + CWinSystemBase * const m_windowing ; <nl> + CGraphicContext & m_graphicsContext ; <nl> + CDisplaySettings & m_displaySettings ; <nl> + CMediaSettings & m_mediaSettings ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RenderSettings . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RenderSettings . cpp <nl> void CRenderSettings : : Reset ( ) <nl> m_videoSettings . Reset ( ) ; <nl> } <nl> <nl> - bool CRenderSettings : : operator = = ( const CRenderSettings & rhs ) const <nl> + bool CRenderSettings : : operator = = ( const CRenderSettings & rhs ) const <nl> { <nl> return m_videoSettings = = rhs . m_videoSettings ; <nl> } <nl> <nl> - bool CRenderSettings : : operator < ( const CRenderSettings & rhs ) const <nl> + bool CRenderSettings : : operator < ( const CRenderSettings & rhs ) const <nl> { <nl> - if ( m_videoSettings < rhs . m_videoSettings ) return true ; <nl> - if ( m_videoSettings > rhs . m_videoSettings ) return false ; <nl> + if ( m_videoSettings < rhs . m_videoSettings ) <nl> + return true ; <nl> + if ( m_videoSettings > rhs . m_videoSettings ) <nl> + return false ; <nl> <nl> return false ; <nl> } <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RenderSettings . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RenderSettings . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderSettings <nl> - { <nl> - public : <nl> - CRenderSettings ( ) { Reset ( ) ; } <nl> + class CRenderSettings <nl> + { <nl> + public : <nl> + CRenderSettings ( ) { Reset ( ) ; } <nl> <nl> - void Reset ( ) ; <nl> + void Reset ( ) ; <nl> <nl> - bool operator = = ( const CRenderSettings & rhs ) const ; <nl> - bool operator < ( const CRenderSettings & rhs ) const ; <nl> + bool operator = = ( const CRenderSettings & rhs ) const ; <nl> + bool operator < ( const CRenderSettings & rhs ) const ; <nl> <nl> - CRenderVideoSettings & VideoSettings ( ) { return m_videoSettings ; } <nl> - const CRenderVideoSettings & VideoSettings ( ) const { return m_videoSettings ; } <nl> + CRenderVideoSettings & VideoSettings ( ) { return m_videoSettings ; } <nl> + const CRenderVideoSettings & VideoSettings ( ) const { return m_videoSettings ; } <nl> <nl> - private : <nl> - CRenderVideoSettings m_videoSettings ; <nl> - } ; <nl> - } <nl> - } <nl> + private : <nl> + CRenderVideoSettings m_videoSettings ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RenderTranslator . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RenderTranslator . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - const char * CRenderTranslator : : TranslatePixelFormat ( AVPixelFormat format ) <nl> + const char * CRenderTranslator : : TranslatePixelFormat ( AVPixelFormat format ) <nl> { <nl> switch ( format ) <nl> { <nl> - case AV_PIX_FMT_0RGB32 : <nl> - return " 0RGB32 " ; <nl> - case AV_PIX_FMT_RGB565 : <nl> - return " RGB565 " ; <nl> - case AV_PIX_FMT_RGB555 : <nl> - return " RGB555 " ; <nl> - default : <nl> - break ; <nl> + case AV_PIX_FMT_0RGB32 : <nl> + return " 0RGB32 " ; <nl> + case AV_PIX_FMT_RGB565 : <nl> + return " RGB565 " ; <nl> + case AV_PIX_FMT_RGB555 : <nl> + return " RGB555 " ; <nl> + default : <nl> + break ; <nl> } <nl> <nl> return " unknown " ; <nl> } <nl> <nl> - const char * CRenderTranslator : : TranslateScalingMethod ( SCALINGMETHOD scalingMethod ) <nl> + const char * CRenderTranslator : : TranslateScalingMethod ( SCALINGMETHOD scalingMethod ) <nl> { <nl> switch ( scalingMethod ) <nl> { <nl> - case SCALINGMETHOD : : NEAREST : <nl> - return " nearest " ; <nl> - case SCALINGMETHOD : : LINEAR : <nl> - return " linear " ; <nl> - default : <nl> - break ; <nl> + case SCALINGMETHOD : : NEAREST : <nl> + return " nearest " ; <nl> + case SCALINGMETHOD : : LINEAR : <nl> + return " linear " ; <nl> + default : <nl> + break ; <nl> } <nl> <nl> return " " ; <nl> unsigned int CRenderTranslator : : TranslateWidthToBytes ( unsigned int width , AVPixe <nl> <nl> switch ( format ) <nl> { <nl> - case AV_PIX_FMT_0RGB32 : <nl> - { <nl> - bpp = sizeof ( uint32_t ) ; <nl> - break ; <nl> - } <nl> - case AV_PIX_FMT_RGB555 : <nl> - { <nl> - bpp = sizeof ( uint16_t ) ; <nl> - break ; <nl> - } <nl> - case AV_PIX_FMT_RGB565 : <nl> - { <nl> - bpp = sizeof ( uint16_t ) ; <nl> - break ; <nl> - } <nl> - default : <nl> - break ; <nl> + case AV_PIX_FMT_0RGB32 : <nl> + { <nl> + bpp = sizeof ( uint32_t ) ; <nl> + break ; <nl> + } <nl> + case AV_PIX_FMT_RGB555 : <nl> + { <nl> + bpp = sizeof ( uint16_t ) ; <nl> + break ; <nl> + } <nl> + case AV_PIX_FMT_RGB565 : <nl> + { <nl> + bpp = sizeof ( uint16_t ) ; <nl> + break ; <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> <nl> return width * bpp ; <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RenderTranslator . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RenderTranslator . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderTranslator <nl> - { <nl> - public : <nl> - / * ! <nl> - * \ brief Translate a pixel format to a string suitable for logging <nl> - * / <nl> - static const char * TranslatePixelFormat ( AVPixelFormat format ) ; <nl> + class CRenderTranslator <nl> + { <nl> + public : <nl> + / * ! <nl> + * \ brief Translate a pixel format to a string suitable for logging <nl> + * / <nl> + static const char * TranslatePixelFormat ( AVPixelFormat format ) ; <nl> <nl> - / * ! <nl> - * \ brief Translate a scaling method to a string suitable for logging <nl> - * / <nl> - static const char * TranslateScalingMethod ( SCALINGMETHOD scalingMethod ) ; <nl> + / * ! <nl> + * \ brief Translate a scaling method to a string suitable for logging <nl> + * / <nl> + static const char * TranslateScalingMethod ( SCALINGMETHOD scalingMethod ) ; <nl> <nl> - / * ! <nl> - * \ brief Translate a width in pixels to a width in bytes <nl> - * <nl> - * \ param width The width in pixels <nl> - * \ param format The pixel format <nl> - * <nl> - * \ return The width in bytes , or 0 if unknown <nl> - * / <nl> - static unsigned int TranslateWidthToBytes ( unsigned int width , AVPixelFormat format ) ; <nl> - } ; <nl> - } <nl> - } <nl> + / * ! <nl> + * \ brief Translate a width in pixels to a width in bytes <nl> + * <nl> + * \ param width The width in pixels <nl> + * \ param format The pixel format <nl> + * <nl> + * \ return The width in bytes , or 0 if unknown <nl> + * / <nl> + static unsigned int TranslateWidthToBytes ( unsigned int width , AVPixelFormat format ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RenderUtils . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RenderUtils . cpp <nl> void CRenderUtils : : CalculateStretchMode ( STRETCHMODE stretchMode , <nl> unsigned int sourceHeight , <nl> float screenWidth , <nl> float screenHeight , <nl> - float & pixelRatio , <nl> - float & zoomAmount ) <nl> + float & pixelRatio , <nl> + float & zoomAmount ) <nl> { <nl> const float sourceFrameRatio = static_cast < float > ( sourceWidth ) / static_cast < float > ( sourceHeight ) ; <nl> <nl> switch ( stretchMode ) <nl> { <nl> - case STRETCHMODE : : Normal : <nl> - { <nl> - switch ( rotationDegCCW ) <nl> + case STRETCHMODE : : Normal : <nl> { <nl> - case 90 : <nl> - case 270 : <nl> + switch ( rotationDegCCW ) <nl> { <nl> - pixelRatio = 1 . 0f / ( sourceFrameRatio * sourceFrameRatio ) ; <nl> - break ; <nl> + case 90 : <nl> + case 270 : <nl> + { <nl> + pixelRatio = 1 . 0f / ( sourceFrameRatio * sourceFrameRatio ) ; <nl> + break ; <nl> + } <nl> + default : <nl> + pixelRatio = 1 . 0f ; <nl> + break ; <nl> } <nl> - default : <nl> - pixelRatio = 1 . 0f ; <nl> - break ; <nl> - } <nl> - zoomAmount = 1 . 0f ; <nl> + zoomAmount = 1 . 0f ; <nl> <nl> - break ; <nl> - } <nl> - case STRETCHMODE : : Stretch4x3 : <nl> - { <nl> - / / Stretch to 4 : 3 ratio <nl> - pixelRatio = ( 4 . 0f / 3 . 0f ) / sourceFrameRatio ; <nl> - zoomAmount = 1 . 0f ; <nl> + break ; <nl> + } <nl> + case STRETCHMODE : : Stretch4x3 : <nl> + { <nl> + / / Stretch to 4 : 3 ratio <nl> + pixelRatio = ( 4 . 0f / 3 . 0f ) / sourceFrameRatio ; <nl> + zoomAmount = 1 . 0f ; <nl> <nl> - break ; <nl> - } <nl> - case STRETCHMODE : : Fullscreen : <nl> - { <nl> - / / Stretch to the limits of the screen <nl> - pixelRatio = ( screenWidth / screenHeight ) / sourceFrameRatio ; <nl> - zoomAmount = 1 . 0f ; <nl> + break ; <nl> + } <nl> + case STRETCHMODE : : Fullscreen : <nl> + { <nl> + / / Stretch to the limits of the screen <nl> + pixelRatio = ( screenWidth / screenHeight ) / sourceFrameRatio ; <nl> + zoomAmount = 1 . 0f ; <nl> <nl> - break ; <nl> - } <nl> - case STRETCHMODE : : Original : <nl> - { <nl> - switch ( rotationDegCCW ) <nl> + break ; <nl> + } <nl> + case STRETCHMODE : : Original : <nl> { <nl> - case 90 : <nl> - case 270 : <nl> + switch ( rotationDegCCW ) <nl> { <nl> - pixelRatio = 1 . 0f / ( sourceFrameRatio * sourceFrameRatio ) ; <nl> - break ; <nl> + case 90 : <nl> + case 270 : <nl> + { <nl> + pixelRatio = 1 . 0f / ( sourceFrameRatio * sourceFrameRatio ) ; <nl> + break ; <nl> + } <nl> + default : <nl> + pixelRatio = 1 . 0f ; <nl> + break ; <nl> } <nl> - default : <nl> - pixelRatio = 1 . 0f ; <nl> - break ; <nl> - } <nl> <nl> - / / Calculate the correct zoom amount <nl> - / / First zoom to full width <nl> - float newHeight = screenWidth / pixelRatio ; <nl> - if ( newHeight > screenHeight ) <nl> - { <nl> - / / Zoom to full height <nl> - newHeight = screenHeight ; <nl> - } <nl> + / / Calculate the correct zoom amount <nl> + / / First zoom to full width <nl> + float newHeight = screenWidth / pixelRatio ; <nl> + if ( newHeight > screenHeight ) <nl> + { <nl> + / / Zoom to full height <nl> + newHeight = screenHeight ; <nl> + } <nl> <nl> - / / Now work out the zoom amount so that no zoom is done <nl> - zoomAmount = sourceHeight / newHeight ; <nl> + / / Now work out the zoom amount so that no zoom is done <nl> + zoomAmount = sourceHeight / newHeight ; <nl> <nl> - switch ( rotationDegCCW ) <nl> - { <nl> - case 90 : <nl> - case 270 : <nl> + switch ( rotationDegCCW ) <nl> { <nl> - zoomAmount * = sourceFrameRatio ; <nl> - break ; <nl> + case 90 : <nl> + case 270 : <nl> + { <nl> + zoomAmount * = sourceFrameRatio ; <nl> + break ; <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> - default : <nl> - break ; <nl> - } <nl> <nl> - break ; <nl> - } <nl> - default : <nl> - break ; <nl> + break ; <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> } <nl> <nl> - void CRenderUtils : : CalcNormalRenderRect ( const CRect & viewRect , <nl> + void CRenderUtils : : CalcNormalRenderRect ( const CRect & viewRect , <nl> float outputFrameRatio , <nl> float zoomAmount , <nl> - CRect & destRect ) <nl> + CRect & destRect ) <nl> { <nl> const float offsetX = viewRect . x1 ; <nl> const float offsetY = viewRect . y1 ; <nl> void CRenderUtils : : CalcNormalRenderRect ( const CRect & viewRect , <nl> destRect . y2 = destRect . y1 + MathUtils : : round_int ( newHeight ) ; <nl> } <nl> <nl> - void CRenderUtils : : ClipRect ( const CRect & viewRect , <nl> - CRect & sourceRect , <nl> - CRect & destRect ) <nl> + void CRenderUtils : : ClipRect ( const CRect & viewRect , CRect & sourceRect , CRect & destRect ) <nl> { <nl> const float offsetX = viewRect . x1 ; <nl> const float offsetY = viewRect . y1 ; <nl> void CRenderUtils : : ClipRect ( const CRect & viewRect , <nl> } <nl> } <nl> <nl> - std : : array < CPoint , 4 > CRenderUtils : : ReorderDrawPoints ( const CRect & destRect , <nl> + std : : array < CPoint , 4 > CRenderUtils : : ReorderDrawPoints ( const CRect & destRect , <nl> unsigned int orientationDegCCW ) <nl> { <nl> std : : array < CPoint , 4 > rotatedDestCoords { } ; <nl> <nl> switch ( orientationDegCCW ) <nl> { <nl> - case 0 : <nl> - { <nl> - rotatedDestCoords [ 0 ] = CPoint { destRect . x1 , destRect . y1 } ; / / Top left <nl> - rotatedDestCoords [ 1 ] = CPoint { destRect . x2 , destRect . y1 } ; / / Top right <nl> - rotatedDestCoords [ 2 ] = CPoint { destRect . x2 , destRect . y2 } ; / / Bottom right <nl> - rotatedDestCoords [ 3 ] = CPoint { destRect . x1 , destRect . y2 } ; / / Bottom left <nl> - break ; <nl> - } <nl> - case 90 : <nl> - { <nl> - rotatedDestCoords [ 0 ] = CPoint { destRect . x1 , destRect . y2 } ; / / Bottom left <nl> - rotatedDestCoords [ 1 ] = CPoint { destRect . x1 , destRect . y1 } ; / / Top left <nl> - rotatedDestCoords [ 2 ] = CPoint { destRect . x2 , destRect . y1 } ; / / Top right <nl> - rotatedDestCoords [ 3 ] = CPoint { destRect . x2 , destRect . y2 } ; / / Bottom right <nl> - break ; <nl> - } <nl> - case 180 : <nl> - { <nl> - rotatedDestCoords [ 0 ] = CPoint { destRect . x2 , destRect . y2 } ; / / Bottom right <nl> - rotatedDestCoords [ 1 ] = CPoint { destRect . x1 , destRect . y2 } ; / / Bottom left <nl> - rotatedDestCoords [ 2 ] = CPoint { destRect . x1 , destRect . y1 } ; / / Top left <nl> - rotatedDestCoords [ 3 ] = CPoint { destRect . x2 , destRect . y1 } ; / / Top right <nl> - break ; <nl> - } <nl> - case 270 : <nl> - { <nl> - rotatedDestCoords [ 0 ] = CPoint { destRect . x2 , destRect . y1 } ; / / Top right <nl> - rotatedDestCoords [ 1 ] = CPoint { destRect . x2 , destRect . y2 } ; / / Bottom right <nl> - rotatedDestCoords [ 2 ] = CPoint { destRect . x1 , destRect . y2 } ; / / Bottom left <nl> - rotatedDestCoords [ 3 ] = CPoint { destRect . x1 , destRect . y1 } ; / / Top left <nl> - break ; <nl> - } <nl> - default : <nl> - break ; <nl> + case 0 : <nl> + { <nl> + rotatedDestCoords [ 0 ] = CPoint { destRect . x1 , destRect . y1 } ; / / Top left <nl> + rotatedDestCoords [ 1 ] = CPoint { destRect . x2 , destRect . y1 } ; / / Top right <nl> + rotatedDestCoords [ 2 ] = CPoint { destRect . x2 , destRect . y2 } ; / / Bottom right <nl> + rotatedDestCoords [ 3 ] = CPoint { destRect . x1 , destRect . y2 } ; / / Bottom left <nl> + break ; <nl> + } <nl> + case 90 : <nl> + { <nl> + rotatedDestCoords [ 0 ] = CPoint { destRect . x1 , destRect . y2 } ; / / Bottom left <nl> + rotatedDestCoords [ 1 ] = CPoint { destRect . x1 , destRect . y1 } ; / / Top left <nl> + rotatedDestCoords [ 2 ] = CPoint { destRect . x2 , destRect . y1 } ; / / Top right <nl> + rotatedDestCoords [ 3 ] = CPoint { destRect . x2 , destRect . y2 } ; / / Bottom right <nl> + break ; <nl> + } <nl> + case 180 : <nl> + { <nl> + rotatedDestCoords [ 0 ] = CPoint { destRect . x2 , destRect . y2 } ; / / Bottom right <nl> + rotatedDestCoords [ 1 ] = CPoint { destRect . x1 , destRect . y2 } ; / / Bottom left <nl> + rotatedDestCoords [ 2 ] = CPoint { destRect . x1 , destRect . y1 } ; / / Top left <nl> + rotatedDestCoords [ 3 ] = CPoint { destRect . x2 , destRect . y1 } ; / / Top right <nl> + break ; <nl> + } <nl> + case 270 : <nl> + { <nl> + rotatedDestCoords [ 0 ] = CPoint { destRect . x2 , destRect . y1 } ; / / Top right <nl> + rotatedDestCoords [ 1 ] = CPoint { destRect . x2 , destRect . y2 } ; / / Bottom right <nl> + rotatedDestCoords [ 2 ] = CPoint { destRect . x1 , destRect . y2 } ; / / Bottom left <nl> + rotatedDestCoords [ 3 ] = CPoint { destRect . x1 , destRect . y1 } ; / / Top left <nl> + break ; <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> <nl> return rotatedDestCoords ; <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RenderUtils . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RenderUtils . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderUtils <nl> - { <nl> - public : <nl> - static void CalculateStretchMode ( STRETCHMODE stretchMode , <nl> - unsigned int rotationDegCCW , <nl> - unsigned int sourceWidth , <nl> - unsigned int sourceHeight , <nl> - float screenWidth , <nl> - float screenHeight , <nl> - float & pixelRatio , <nl> - float & zoomAmount ) ; <nl> + class CRenderUtils <nl> + { <nl> + public : <nl> + static void CalculateStretchMode ( STRETCHMODE stretchMode , <nl> + unsigned int rotationDegCCW , <nl> + unsigned int sourceWidth , <nl> + unsigned int sourceHeight , <nl> + float screenWidth , <nl> + float screenHeight , <nl> + float & pixelRatio , <nl> + float & zoomAmount ) ; <nl> + <nl> + static void CalcNormalRenderRect ( const CRect & viewRect , <nl> + float outputFrameRatio , <nl> + float zoomAmount , <nl> + CRect & destRect ) ; <nl> <nl> - static void CalcNormalRenderRect ( const CRect & viewRect , <nl> - float outputFrameRatio , <nl> - float zoomAmount , <nl> - CRect & destRect ) ; <nl> - <nl> - static void ClipRect ( const CRect & viewRect , <nl> - CRect & sourceRect , <nl> - CRect & destRect ) ; <nl> + static void ClipRect ( const CRect & viewRect , CRect & sourceRect , CRect & destRect ) ; <nl> <nl> - static std : : array < CPoint , 4 > ReorderDrawPoints ( const CRect & destRect , <nl> - unsigned int orientationDegCCW ) ; <nl> - } ; <nl> - } <nl> - } <nl> + static std : : array < CPoint , 4 > ReorderDrawPoints ( const CRect & destRect , <nl> + unsigned int orientationDegCCW ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RenderVideoSettings . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RenderVideoSettings . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - # define VIDEO_FILTER_NEAREST " nearest " <nl> - # define VIDEO_FILTER_LINEAR " linear " <nl> + # define VIDEO_FILTER_NEAREST " nearest " <nl> + # define VIDEO_FILTER_LINEAR " linear " <nl> <nl> void CRenderVideoSettings : : Reset ( ) <nl> { <nl> void CRenderVideoSettings : : Reset ( ) <nl> m_rotationDegCCW = 0 ; <nl> } <nl> <nl> - bool CRenderVideoSettings : : operator = = ( const CRenderVideoSettings & rhs ) const <nl> + bool CRenderVideoSettings : : operator = = ( const CRenderVideoSettings & rhs ) const <nl> { <nl> - return m_scalingMethod = = rhs . m_scalingMethod & & <nl> - m_stretchMode = = rhs . m_stretchMode & & <nl> + return m_scalingMethod = = rhs . m_scalingMethod & & m_stretchMode = = rhs . m_stretchMode & & <nl> m_rotationDegCCW = = rhs . m_rotationDegCCW ; <nl> } <nl> <nl> - bool CRenderVideoSettings : : operator < ( const CRenderVideoSettings & rhs ) const <nl> + bool CRenderVideoSettings : : operator < ( const CRenderVideoSettings & rhs ) const <nl> { <nl> - if ( m_scalingMethod < rhs . m_scalingMethod ) return true ; <nl> - if ( m_scalingMethod > rhs . m_scalingMethod ) return false ; <nl> + if ( m_scalingMethod < rhs . m_scalingMethod ) <nl> + return true ; <nl> + if ( m_scalingMethod > rhs . m_scalingMethod ) <nl> + return false ; <nl> <nl> - if ( m_stretchMode < rhs . m_stretchMode ) return true ; <nl> - if ( m_stretchMode > rhs . m_stretchMode ) return false ; <nl> + if ( m_stretchMode < rhs . m_stretchMode ) <nl> + return true ; <nl> + if ( m_stretchMode > rhs . m_stretchMode ) <nl> + return false ; <nl> <nl> - if ( m_rotationDegCCW < rhs . m_rotationDegCCW ) return true ; <nl> - if ( m_rotationDegCCW > rhs . m_rotationDegCCW ) return false ; <nl> + if ( m_rotationDegCCW < rhs . m_rotationDegCCW ) <nl> + return true ; <nl> + if ( m_rotationDegCCW > rhs . m_rotationDegCCW ) <nl> + return false ; <nl> <nl> return false ; <nl> } <nl> std : : string CRenderVideoSettings : : GetVideoFilter ( ) const <nl> { <nl> switch ( m_scalingMethod ) <nl> { <nl> - case SCALINGMETHOD : : NEAREST : <nl> - return VIDEO_FILTER_NEAREST ; <nl> - case SCALINGMETHOD : : LINEAR : <nl> - return VIDEO_FILTER_LINEAR ; <nl> - default : <nl> - break ; <nl> + case SCALINGMETHOD : : NEAREST : <nl> + return VIDEO_FILTER_NEAREST ; <nl> + case SCALINGMETHOD : : LINEAR : <nl> + return VIDEO_FILTER_LINEAR ; <nl> + default : <nl> + break ; <nl> } <nl> <nl> return " " ; <nl> } <nl> <nl> - void CRenderVideoSettings : : SetVideoFilter ( const std : : string & videoFilter ) <nl> + void CRenderVideoSettings : : SetVideoFilter ( const std : : string & videoFilter ) <nl> { <nl> if ( videoFilter = = VIDEO_FILTER_NEAREST ) <nl> { <nl> mmm a / xbmc / cores / RetroPlayer / rendering / RenderVideoSettings . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / RenderVideoSettings . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> + / * ! <nl> + * \ brief Video settings provided by the rendering system <nl> + * / <nl> + class CRenderVideoSettings <nl> + { <nl> + public : <nl> + CRenderVideoSettings ( ) { Reset ( ) ; } <nl> + <nl> + void Reset ( ) ; <nl> + <nl> + bool operator = = ( const CRenderVideoSettings & rhs ) const ; <nl> + bool operator ! = ( const CRenderVideoSettings & rhs ) const { return ! ( * this = = rhs ) ; } <nl> + bool operator < ( const CRenderVideoSettings & rhs ) const ; <nl> + bool operator > ( const CRenderVideoSettings & rhs ) const { return ! ( * this = = rhs | | * this < rhs ) ; } <nl> + <nl> / * ! <nl> - * \ brief Video settings provided by the rendering system <nl> + * \ brief Get a string representation of the video filter parameters <nl> * / <nl> - class CRenderVideoSettings <nl> - { <nl> - public : <nl> - CRenderVideoSettings ( ) { Reset ( ) ; } <nl> - <nl> - void Reset ( ) ; <nl> - <nl> - bool operator = = ( const CRenderVideoSettings & rhs ) const ; <nl> - bool operator ! = ( const CRenderVideoSettings & rhs ) const { return ! ( * this = = rhs ) ; } <nl> - bool operator < ( const CRenderVideoSettings & rhs ) const ; <nl> - bool operator > ( const CRenderVideoSettings & rhs ) const { return ! ( * this = = rhs | | * this < rhs ) ; } <nl> - <nl> - / * ! <nl> - * \ brief Get a string representation of the video filter parameters <nl> - * / <nl> - std : : string GetVideoFilter ( ) const ; <nl> - void SetVideoFilter ( const std : : string & videoFilter ) ; <nl> - <nl> - SCALINGMETHOD GetScalingMethod ( ) const { return m_scalingMethod ; } <nl> - void SetScalingMethod ( SCALINGMETHOD method ) { m_scalingMethod = method ; } <nl> - <nl> - STRETCHMODE GetRenderStretchMode ( ) const { return m_stretchMode ; } <nl> - void SetRenderStretchMode ( STRETCHMODE mode ) { m_stretchMode = mode ; } <nl> - <nl> - unsigned int GetRenderRotation ( ) const { return m_rotationDegCCW ; } <nl> - void SetRenderRotation ( unsigned int rotationDegCCW ) { m_rotationDegCCW = rotationDegCCW ; } <nl> - <nl> - private : <nl> - SCALINGMETHOD m_scalingMethod ; <nl> - STRETCHMODE m_stretchMode ; <nl> - unsigned int m_rotationDegCCW ; <nl> - } ; <nl> - } <nl> - } <nl> + std : : string GetVideoFilter ( ) const ; <nl> + void SetVideoFilter ( const std : : string & videoFilter ) ; <nl> + <nl> + SCALINGMETHOD GetScalingMethod ( ) const { return m_scalingMethod ; } <nl> + void SetScalingMethod ( SCALINGMETHOD method ) { m_scalingMethod = method ; } <nl> + <nl> + STRETCHMODE GetRenderStretchMode ( ) const { return m_stretchMode ; } <nl> + void SetRenderStretchMode ( STRETCHMODE mode ) { m_stretchMode = mode ; } <nl> + <nl> + unsigned int GetRenderRotation ( ) const { return m_rotationDegCCW ; } <nl> + void SetRenderRotation ( unsigned int rotationDegCCW ) { m_rotationDegCCW = rotationDegCCW ; } <nl> + <nl> + private : <nl> + SCALINGMETHOD m_scalingMethod ; <nl> + STRETCHMODE m_stretchMode ; <nl> + unsigned int m_rotationDegCCW ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPBaseRenderer . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPBaseRenderer . cpp <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> / / Consider renderer visible until this many frames have passed without rendering <nl> - # define VISIBLE_DURATION_FRAME_COUNT 1 <nl> + # define VISIBLE_DURATION_FRAME_COUNT 1 <nl> <nl> - CRPBaseRenderer : : CRPBaseRenderer ( const CRenderSettings & renderSettings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) : <nl> - m_context ( context ) , <nl> - m_bufferPool ( std : : move ( bufferPool ) ) , <nl> - m_renderSettings ( renderSettings ) <nl> + CRPBaseRenderer : : CRPBaseRenderer ( const CRenderSettings & renderSettings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> + : m_context ( context ) , m_bufferPool ( std : : move ( bufferPool ) ) , m_renderSettings ( renderSettings ) <nl> { <nl> m_bufferPool - > RegisterRenderer ( this ) ; <nl> } <nl> CRPBaseRenderer : : ~ CRPBaseRenderer ( ) <nl> m_bufferPool - > UnregisterRenderer ( this ) ; <nl> } <nl> <nl> - bool CRPBaseRenderer : : IsCompatible ( const CRenderVideoSettings & settings ) const <nl> + bool CRPBaseRenderer : : IsCompatible ( const CRenderVideoSettings & settings ) const <nl> { <nl> return m_bufferPool - > IsCompatible ( settings ) ; <nl> } <nl> bool CRPBaseRenderer : : IsVisible ( ) const <nl> return m_renderFrameCount < = m_lastRender + VISIBLE_DURATION_FRAME_COUNT ; <nl> } <nl> <nl> - void CRPBaseRenderer : : SetBuffer ( IRenderBuffer * buffer ) <nl> + void CRPBaseRenderer : : SetBuffer ( IRenderBuffer * buffer ) <nl> { <nl> if ( m_renderBuffer ! = buffer ) <nl> { <nl> void CRPBaseRenderer : : SetRenderRotation ( unsigned int rotationDegCCW ) <nl> m_renderSettings . VideoSettings ( ) . SetRenderRotation ( rotationDegCCW ) ; <nl> } <nl> <nl> - void CRPBaseRenderer : : ManageRenderArea ( const IRenderBuffer & renderBuffer ) <nl> + void CRPBaseRenderer : : ManageRenderArea ( const IRenderBuffer & renderBuffer ) <nl> { <nl> / / Get texture parameters <nl> const unsigned int sourceWidth = renderBuffer . GetWidth ( ) ; <nl> const unsigned int sourceHeight = renderBuffer . GetHeight ( ) ; <nl> const unsigned int sourceRotationDegCCW = renderBuffer . GetRotation ( ) ; <nl> - const float sourceAspectRatio = static_cast < float > ( sourceWidth ) / static_cast < float > ( sourceHeight ) ; <nl> + const float sourceAspectRatio = <nl> + static_cast < float > ( sourceWidth ) / static_cast < float > ( sourceHeight ) ; <nl> <nl> const STRETCHMODE stretchMode = m_renderSettings . VideoSettings ( ) . GetRenderStretchMode ( ) ; <nl> - const unsigned int rotationDegCCW = ( sourceRotationDegCCW + m_renderSettings . VideoSettings ( ) . GetRenderRotation ( ) ) % 360 ; <nl> + const unsigned int rotationDegCCW = <nl> + ( sourceRotationDegCCW + m_renderSettings . VideoSettings ( ) . GetRenderRotation ( ) ) % 360 ; <nl> <nl> / / Get screen parameters <nl> float screenWidth ; <nl> void CRPBaseRenderer : : ManageRenderArea ( const IRenderBuffer & renderBuffer ) <nl> / / Calculate pixel ratio and zoom amount <nl> float pixelRatio = 1 . 0f ; <nl> float zoomAmount = 1 . 0f ; <nl> - CRenderUtils : : CalculateStretchMode ( stretchMode , <nl> - rotationDegCCW , <nl> - sourceWidth , <nl> - sourceHeight , <nl> - screenWidth , <nl> - screenHeight , <nl> - pixelRatio , <nl> - zoomAmount ) ; <nl> + CRenderUtils : : CalculateStretchMode ( stretchMode , rotationDegCCW , sourceWidth , sourceHeight , <nl> + screenWidth , screenHeight , pixelRatio , zoomAmount ) ; <nl> <nl> / / Calculate destination dimensions <nl> CRect destRect ; <nl> - CRenderUtils : : CalcNormalRenderRect ( viewRect , <nl> - sourceAspectRatio * pixelRatio , <nl> - zoomAmount , <nl> + CRenderUtils : : CalcNormalRenderRect ( viewRect , sourceAspectRatio * pixelRatio , zoomAmount , <nl> destRect ) ; <nl> <nl> m_sourceRect . x1 = 0 . 0f ; <nl> void CRPBaseRenderer : : ManageRenderArea ( const IRenderBuffer & renderBuffer ) <nl> <nl> void CRPBaseRenderer : : MarkDirty ( ) <nl> { <nl> - / / CServiceBroker : : GetGUI ( ) - > GetWindowManager ( ) . MarkDirty ( m_dimensions ) ; / / ! @ todo <nl> + / / CServiceBroker : : GetGUI ( ) - > GetWindowManager ( ) . MarkDirty ( m_dimensions ) ; / / ! @ todo <nl> } <nl> <nl> void CRPBaseRenderer : : PreRender ( bool clear ) <nl> void CRPBaseRenderer : : PostRender ( ) <nl> m_context . ApplyStateBlock ( ) ; <nl> } <nl> <nl> - void CRPBaseRenderer : : GetScreenDimensions ( float & screenWidth , float & screenHeight , float & screenPixelRatio ) <nl> + void CRPBaseRenderer : : GetScreenDimensions ( float & screenWidth , <nl> + float & screenHeight , <nl> + float & screenPixelRatio ) <nl> { <nl> / / Get our calibrated full screen resolution <nl> RESOLUTION_INFO info = m_context . GetResInfo ( ) ; <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPBaseRenderer . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPBaseRenderer . h <nl> <nl> <nl> # pragma once <nl> <nl> - # include " cores / RetroPlayer / rendering / RenderSettings . h " <nl> # include " cores / GameSettings . h " <nl> + # include " cores / RetroPlayer / rendering / RenderSettings . h " <nl> # include " utils / Geometry . h " <nl> <nl> - extern " C " { <nl> + extern " C " <nl> + { <nl> # include < libavutil / pixfmt . h > <nl> } <nl> <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderContext ; <nl> - class IRenderBuffer ; <nl> - class IRenderBufferPool ; <nl> - <nl> - class CRPBaseRenderer <nl> - { <nl> - public : <nl> - CRPBaseRenderer ( const CRenderSettings & renderSettings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> - virtual ~ CRPBaseRenderer ( ) ; <nl> - <nl> - / * ! <nl> - * \ brief Get the buffer pool used by this renderer <nl> - * / <nl> - IRenderBufferPool * GetBufferPool ( ) { return m_bufferPool . get ( ) ; } <nl> - <nl> - / / Player functions <nl> - bool Configure ( AVPixelFormat format ) ; <nl> - void FrameMove ( ) ; <nl> - / * ! <nl> - * \ brief Performs whatever necessary before rendering the frame <nl> - * / <nl> - void PreRender ( bool clear ) ; <nl> - void SetBuffer ( IRenderBuffer * buffer ) ; <nl> - void RenderFrame ( bool clear , uint8_t alpha ) ; <nl> - <nl> - / / Feature support <nl> - virtual bool Supports ( RENDERFEATURE feature ) const = 0 ; <nl> - bool IsCompatible ( const CRenderVideoSettings & settings ) const ; <nl> - virtual SCALINGMETHOD GetDefaultScalingMethod ( ) const = 0 ; <nl> - <nl> - / / Public renderer interface <nl> - virtual void Flush ( ) ; <nl> - <nl> - / / Get render settings <nl> - const CRenderSettings & GetRenderSettings ( ) const { return m_renderSettings ; } <nl> - <nl> - / / Set render settings <nl> - void SetScalingMethod ( SCALINGMETHOD method ) ; <nl> - void SetStretchMode ( STRETCHMODE stretchMode ) ; <nl> - void SetRenderRotation ( unsigned int rotationDegCCW ) ; <nl> - <nl> - bool IsVisible ( ) const ; <nl> - <nl> - protected : <nl> - / / Protected renderer interface <nl> - virtual bool ConfigureInternal ( ) { return true ; } <nl> - virtual void RenderInternal ( bool clear , uint8_t alpha ) = 0 ; <nl> - virtual void FlushInternal ( ) { } <nl> - <nl> - / / Construction parameters <nl> - CRenderContext & m_context ; <nl> - std : : shared_ptr < IRenderBufferPool > m_bufferPool ; <nl> - <nl> - / / Stream properties <nl> - bool m_bConfigured = false ; <nl> - AVPixelFormat m_format = AV_PIX_FMT_NONE ; <nl> - <nl> - / / Rendering properties <nl> - CRenderSettings m_renderSettings ; <nl> - IRenderBuffer * m_renderBuffer = nullptr ; <nl> - <nl> - / / Geometry properties <nl> - CRect m_sourceRect ; <nl> - std : : array < CPoint , 4 > m_rotatedDestCoords { } ; <nl> - <nl> - private : <nl> - / * ! <nl> - * \ brief Calculate driven dimensions <nl> - * / <nl> - virtual void ManageRenderArea ( const IRenderBuffer & renderBuffer ) ; <nl> - <nl> - / * ! <nl> - * \ brief Performs whatever nessesary after a frame has been rendered <nl> - * / <nl> - void PostRender ( ) ; <nl> - <nl> - void MarkDirty ( ) ; <nl> - <nl> - / / Utility functions <nl> - void GetScreenDimensions ( float & screenWidth , float & screenHeight , float & screenPixelRatio ) ; <nl> - <nl> - uint64_t m_renderFrameCount = 0 ; <nl> - uint64_t m_lastRender = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + class CRenderContext ; <nl> + class IRenderBuffer ; <nl> + class IRenderBufferPool ; <nl> + <nl> + class CRPBaseRenderer <nl> + { <nl> + public : <nl> + CRPBaseRenderer ( const CRenderSettings & renderSettings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> + virtual ~ CRPBaseRenderer ( ) ; <nl> + <nl> + / * ! <nl> + * \ brief Get the buffer pool used by this renderer <nl> + * / <nl> + IRenderBufferPool * GetBufferPool ( ) { return m_bufferPool . get ( ) ; } <nl> + <nl> + / / Player functions <nl> + bool Configure ( AVPixelFormat format ) ; <nl> + void FrameMove ( ) ; <nl> + / * ! <nl> + * \ brief Performs whatever necessary before rendering the frame <nl> + * / <nl> + void PreRender ( bool clear ) ; <nl> + void SetBuffer ( IRenderBuffer * buffer ) ; <nl> + void RenderFrame ( bool clear , uint8_t alpha ) ; <nl> + <nl> + / / Feature support <nl> + virtual bool Supports ( RENDERFEATURE feature ) const = 0 ; <nl> + bool IsCompatible ( const CRenderVideoSettings & settings ) const ; <nl> + virtual SCALINGMETHOD GetDefaultScalingMethod ( ) const = 0 ; <nl> + <nl> + / / Public renderer interface <nl> + virtual void Flush ( ) ; <nl> + <nl> + / / Get render settings <nl> + const CRenderSettings & GetRenderSettings ( ) const { return m_renderSettings ; } <nl> + <nl> + / / Set render settings <nl> + void SetScalingMethod ( SCALINGMETHOD method ) ; <nl> + void SetStretchMode ( STRETCHMODE stretchMode ) ; <nl> + void SetRenderRotation ( unsigned int rotationDegCCW ) ; <nl> + <nl> + bool IsVisible ( ) const ; <nl> + <nl> + protected : <nl> + / / Protected renderer interface <nl> + virtual bool ConfigureInternal ( ) { return true ; } <nl> + virtual void RenderInternal ( bool clear , uint8_t alpha ) = 0 ; <nl> + virtual void FlushInternal ( ) { } <nl> + <nl> + / / Construction parameters <nl> + CRenderContext & m_context ; <nl> + std : : shared_ptr < IRenderBufferPool > m_bufferPool ; <nl> + <nl> + / / Stream properties <nl> + bool m_bConfigured = false ; <nl> + AVPixelFormat m_format = AV_PIX_FMT_NONE ; <nl> + <nl> + / / Rendering properties <nl> + CRenderSettings m_renderSettings ; <nl> + IRenderBuffer * m_renderBuffer = nullptr ; <nl> + <nl> + / / Geometry properties <nl> + CRect m_sourceRect ; <nl> + std : : array < CPoint , 4 > m_rotatedDestCoords { } ; <nl> + <nl> + private : <nl> + / * ! <nl> + * \ brief Calculate driven dimensions <nl> + * / <nl> + virtual void ManageRenderArea ( const IRenderBuffer & renderBuffer ) ; <nl> + <nl> + / * ! <nl> + * \ brief Performs whatever nessesary after a frame has been rendered <nl> + * / <nl> + void PostRender ( ) ; <nl> + <nl> + void MarkDirty ( ) ; <nl> + <nl> + / / Utility functions <nl> + void GetScreenDimensions ( float & screenWidth , float & screenHeight , float & screenPixelRatio ) ; <nl> + <nl> + uint64_t m_renderFrameCount = 0 ; <nl> + uint64_t m_lastRender = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererDMA . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererDMA . cpp <nl> void CRPRendererDMA : : Render ( uint8_t alpha ) <nl> vertex [ 2 ] . v1 = vertex [ 3 ] . v1 = rect . y2 ; <nl> <nl> glBindBuffer ( GL_ARRAY_BUFFER , m_mainVertexVBO ) ; <nl> - glBufferData ( GL_ARRAY_BUFFER , sizeof ( PackedVertex ) * 4 , & vertex [ 0 ] , GL_STATIC_DRAW ) ; <nl> + glBufferData ( GL_ARRAY_BUFFER , sizeof ( PackedVertex ) * 4 , & vertex [ 0 ] , GL_STATIC_DRAW ) ; <nl> <nl> - glVertexAttribPointer ( vertLoc , 3 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , reinterpret_cast < const GLuint * > ( offsetof ( PackedVertex , x ) ) ) ; <nl> - glVertexAttribPointer ( loc , 2 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , reinterpret_cast < const GLuint * > ( offsetof ( PackedVertex , u1 ) ) ) ; <nl> + glVertexAttribPointer ( vertLoc , 3 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , <nl> + reinterpret_cast < const GLuint * > ( offsetof ( PackedVertex , x ) ) ) ; <nl> + glVertexAttribPointer ( loc , 2 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , <nl> + reinterpret_cast < const GLuint * > ( offsetof ( PackedVertex , u1 ) ) ) ; <nl> <nl> glEnableVertexAttribArray ( vertLoc ) ; <nl> glEnableVertexAttribArray ( loc ) ; <nl> <nl> glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER , m_mainIndexVBO ) ; <nl> - glBufferData ( GL_ELEMENT_ARRAY_BUFFER , sizeof ( GLubyte ) * 4 , idx , GL_STATIC_DRAW ) ; <nl> + glBufferData ( GL_ELEMENT_ARRAY_BUFFER , sizeof ( GLubyte ) * 4 , idx , GL_STATIC_DRAW ) ; <nl> <nl> - glUniform4f ( uniColLoc , ( colour [ 0 ] / 255 . 0f ) , ( colour [ 1 ] / 255 . 0f ) , ( colour [ 2 ] / 255 . 0f ) , ( colour [ 3 ] / 255 . 0f ) ) ; <nl> + glUniform4f ( uniColLoc , ( colour [ 0 ] / 255 . 0f ) , ( colour [ 1 ] / 255 . 0f ) , ( colour [ 2 ] / 255 . 0f ) , <nl> + ( colour [ 3 ] / 255 . 0f ) ) ; <nl> glDrawElements ( GL_TRIANGLE_STRIP , 4 , GL_UNSIGNED_BYTE , 0 ) ; <nl> <nl> glDisableVertexAttribArray ( vertLoc ) ; <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererDMA . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererDMA . h <nl> class CRendererFactoryDMA : public IRendererFactory <nl> CRenderContext & context , <nl> std : : shared_ptr < IRenderBufferPool > bufferPool ) override ; <nl> RenderBufferPoolVector CreateBufferPools ( CRenderContext & context ) override ; <nl> - } ; <nl> + } ; <nl> <nl> - / * * <nl> - * @ brief Special CRPBaseRenderer implementation to handle Direct Memory <nl> - * Access ( DMA ) buffer types . For specific use with <nl> - * CRenderBufferPoolDMA and CRenderBufferDMA . A windowing system <nl> - * must register use of this renderer and register at least one <nl> - * CBufferObject types . <nl> - * <nl> - * / <nl> - class CRPRendererDMA : public CRPRendererOpenGLES <nl> - { <nl> - public : <nl> - CRPRendererDMA ( const CRenderSettings & renderSettings , <nl> - CRenderContext & context , <nl> - std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> - ~ CRPRendererDMA ( ) override = default ; <nl> + / * * <nl> + * @ brief Special CRPBaseRenderer implementation to handle Direct Memory <nl> + * Access ( DMA ) buffer types . For specific use with <nl> + * CRenderBufferPoolDMA and CRenderBufferDMA . A windowing system <nl> + * must register use of this renderer and register at least one <nl> + * CBufferObject types . <nl> + * <nl> + * / <nl> + class CRPRendererDMA : public CRPRendererOpenGLES <nl> + { <nl> + public : <nl> + CRPRendererDMA ( const CRenderSettings & renderSettings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> + ~ CRPRendererDMA ( ) override = default ; <nl> <nl> - protected : <nl> - / / implementation of CRPRendererOpenGLES <nl> - void Render ( uint8_t alpha ) override ; <nl> - } ; <nl> - } <nl> - } <nl> + protected : <nl> + / / implementation of CRPRendererOpenGLES <nl> + void Render ( uint8_t alpha ) override ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererGuiTexture . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererGuiTexture . cpp <nl> <nl> * / <nl> <nl> # include " RPRendererGuiTexture . h " <nl> + <nl> # include " cores / RetroPlayer / buffers / video / RenderBufferGuiTexture . h " <nl> # include " cores / RetroPlayer / rendering / RenderContext . h " <nl> # include " cores / RetroPlayer / rendering / RenderVideoSettings . h " <nl> <nl> # if defined ( HAS_DX ) <nl> # include " guilib / GUIShaderDX . h " <nl> + <nl> # include < DirectXMath . h > <nl> using namespace DirectX ; <nl> # endif <nl> std : : string CRendererFactoryGuiTexture : : RenderSystemName ( ) const <nl> return " GUITexture " ; <nl> } <nl> <nl> - CRPBaseRenderer * CRendererFactoryGuiTexture : : CreateRenderer ( const CRenderSettings & settings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> + CRPBaseRenderer * CRendererFactoryGuiTexture : : CreateRenderer ( <nl> + const CRenderSettings & settings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> { <nl> return new CRPRendererGuiTexture ( settings , context , std : : move ( bufferPool ) ) ; <nl> } <nl> <nl> - RenderBufferPoolVector CRendererFactoryGuiTexture : : CreateBufferPools ( CRenderContext & context ) <nl> + RenderBufferPoolVector CRendererFactoryGuiTexture : : CreateBufferPools ( CRenderContext & context ) <nl> { <nl> - return { <nl> + return <nl> + { <nl> # if ! defined ( HAS_DX ) <nl> std : : make_shared < CRenderBufferPoolGuiTexture > ( SCALINGMETHOD : : NEAREST ) , <nl> # endif <nl> - std : : make_shared < CRenderBufferPoolGuiTexture > ( SCALINGMETHOD : : LINEAR ) , <nl> + std : : make_shared < CRenderBufferPoolGuiTexture > ( SCALINGMETHOD : : LINEAR ) , <nl> } ; <nl> } <nl> <nl> / / mmm CRenderBufferPoolGuiTexture mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> - CRenderBufferPoolGuiTexture : : CRenderBufferPoolGuiTexture ( SCALINGMETHOD scalingMethod ) : <nl> - m_scalingMethod ( scalingMethod ) <nl> + CRenderBufferPoolGuiTexture : : CRenderBufferPoolGuiTexture ( SCALINGMETHOD scalingMethod ) <nl> + : m_scalingMethod ( scalingMethod ) <nl> { <nl> } <nl> <nl> - bool CRenderBufferPoolGuiTexture : : IsCompatible ( const CRenderVideoSettings & renderSettings ) const <nl> + bool CRenderBufferPoolGuiTexture : : IsCompatible ( const CRenderVideoSettings & renderSettings ) const <nl> { <nl> return renderSettings . GetScalingMethod ( ) = = m_scalingMethod ; <nl> } <nl> <nl> - IRenderBuffer * CRenderBufferPoolGuiTexture : : CreateRenderBuffer ( void * header / * = nullptr * / ) <nl> + IRenderBuffer * CRenderBufferPoolGuiTexture : : CreateRenderBuffer ( void * header / * = nullptr * / ) <nl> { <nl> return new CRenderBufferGuiTexture ( m_scalingMethod ) ; <nl> } <nl> <nl> / / mmm CRPRendererGuiTexture mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> - CRPRendererGuiTexture : : CRPRendererGuiTexture ( const CRenderSettings & renderSettings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) : <nl> - CRPBaseRenderer ( renderSettings , context , std : : move ( bufferPool ) ) <nl> + CRPRendererGuiTexture : : CRPRendererGuiTexture ( const CRenderSettings & renderSettings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> + : CRPBaseRenderer ( renderSettings , context , std : : move ( bufferPool ) ) <nl> { <nl> } <nl> <nl> bool CRPRendererGuiTexture : : Supports ( RENDERFEATURE feature ) const <nl> { <nl> - return feature = = RENDERFEATURE : : STRETCH | | <nl> - feature = = RENDERFEATURE : : ZOOM | | <nl> - feature = = RENDERFEATURE : : PIXEL_RATIO | | <nl> - feature = = RENDERFEATURE : : ROTATION ; <nl> + return feature = = RENDERFEATURE : : STRETCH | | feature = = RENDERFEATURE : : ZOOM | | <nl> + feature = = RENDERFEATURE : : PIXEL_RATIO | | feature = = RENDERFEATURE : : ROTATION ; <nl> } <nl> <nl> void CRPRendererGuiTexture : : RenderInternal ( bool clear , uint8_t alpha ) <nl> { <nl> - CRenderBufferGuiTexture * renderBuffer = static_cast < CRenderBufferGuiTexture * > ( m_renderBuffer ) ; <nl> + CRenderBufferGuiTexture * renderBuffer = static_cast < CRenderBufferGuiTexture * > ( m_renderBuffer ) ; <nl> <nl> CRect rect = m_sourceRect ; <nl> <nl> void CRPRendererGuiTexture : : RenderInternal ( bool clear , uint8_t alpha ) <nl> <nl> vertex [ 4 ] = vertex [ 0 ] ; / / Not used when renderBuffer ! = nullptr <nl> <nl> - CGUIShaderDX * pGUIShader = m_context . GetGUIShader ( ) ; <nl> + CGUIShaderDX * pGUIShader = m_context . GetGUIShader ( ) ; <nl> if ( pGUIShader ! = nullptr ) <nl> { <nl> pGUIShader - > Begin ( SHADER_METHOD_RENDER_TEXTURE_BLEND ) ; <nl> <nl> / / Set state to render the image <nl> - CTexture * dxTexture = renderBuffer - > GetTexture ( ) ; <nl> - ID3D11ShaderResourceView * shaderRes = dxTexture - > GetShaderResource ( ) ; <nl> + CTexture * dxTexture = renderBuffer - > GetTexture ( ) ; <nl> + ID3D11ShaderResourceView * shaderRes = dxTexture - > GetShaderResource ( ) ; <nl> pGUIShader - > SetShaderViews ( 1 , & shaderRes ) ; <nl> pGUIShader - > DrawQuad ( vertex [ 0 ] , vertex [ 1 ] , vertex [ 2 ] , vertex [ 3 ] ) ; <nl> } <nl> void CRPRendererGuiTexture : : RenderInternal ( bool clear , uint8_t alpha ) <nl> glBindBuffer ( GL_ARRAY_BUFFER , vertexVBO ) ; <nl> glBufferData ( GL_ARRAY_BUFFER , sizeof ( PackedVertex ) * 4 , & vertex [ 0 ] , GL_STATIC_DRAW ) ; <nl> <nl> - glVertexAttribPointer ( posLoc , 3 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , BUFFER_OFFSET ( offsetof ( PackedVertex , x ) ) ) ; <nl> - glVertexAttribPointer ( tex0Loc , 2 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , BUFFER_OFFSET ( offsetof ( PackedVertex , u1 ) ) ) ; <nl> + glVertexAttribPointer ( posLoc , 3 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , <nl> + BUFFER_OFFSET ( offsetof ( PackedVertex , x ) ) ) ; <nl> + glVertexAttribPointer ( tex0Loc , 2 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , <nl> + BUFFER_OFFSET ( offsetof ( PackedVertex , u1 ) ) ) ; <nl> <nl> glEnableVertexAttribArray ( posLoc ) ; <nl> glEnableVertexAttribArray ( tex0Loc ) ; <nl> void CRPRendererGuiTexture : : RenderInternal ( bool clear , uint8_t alpha ) <nl> colour [ 2 ] = ( 235 - 16 ) * colour [ 2 ] / 255 + 16 ; <nl> } <nl> <nl> - glUniform4f ( uniColLoc , ( colour [ 0 ] / 255 . 0f ) , ( colour [ 1 ] / 255 . 0f ) , <nl> - ( colour [ 2 ] / 255 . 0f ) , ( colour [ 3 ] / 255 . 0f ) ) ; <nl> + glUniform4f ( uniColLoc , ( colour [ 0 ] / 255 . 0f ) , ( colour [ 1 ] / 255 . 0f ) , ( colour [ 2 ] / 255 . 0f ) , <nl> + ( colour [ 3 ] / 255 . 0f ) ) ; <nl> <nl> glGenBuffers ( 1 , & indexVBO ) ; <nl> glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER , indexVBO ) ; <nl> void CRPRendererGuiTexture : : RenderInternal ( bool clear , uint8_t alpha ) <nl> <nl> renderBuffer - > BindToUnit ( 0 ) ; <nl> <nl> - glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ) ; <nl> + glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ) ; <nl> glEnable ( GL_BLEND ) ; / / Turn blending On <nl> <nl> m_context . EnableGUIShader ( GL_SHADER_METHOD : : TEXTURE ) ; <nl> void CRPRendererGuiTexture : : RenderInternal ( bool clear , uint8_t alpha ) <nl> tex [ 1 ] [ 0 ] = tex [ 2 ] [ 0 ] = u2 ; <nl> tex [ 2 ] [ 1 ] = tex [ 3 ] [ 1 ] = v2 ; <nl> <nl> - glUniform4f ( uniColLoc , ( col [ 0 ] / 255 . 0f ) , ( col [ 1 ] / 255 . 0f ) , ( col [ 2 ] / 255 . 0f ) , ( col [ 3 ] / 255 . 0f ) ) ; <nl> + glUniform4f ( uniColLoc , ( col [ 0 ] / 255 . 0f ) , ( col [ 1 ] / 255 . 0f ) , ( col [ 2 ] / 255 . 0f ) , <nl> + ( col [ 3 ] / 255 . 0f ) ) ; <nl> glDrawElements ( GL_TRIANGLE_STRIP , 4 , GL_UNSIGNED_BYTE , idx ) ; <nl> <nl> glDisableVertexAttribArray ( posLoc ) ; <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererGuiTexture . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererGuiTexture . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRendererFactoryGuiTexture : public IRendererFactory <nl> - { <nl> - public : <nl> - ~ CRendererFactoryGuiTexture ( ) override = default ; <nl> - <nl> - / / implementation of IRendererFactory <nl> - std : : string RenderSystemName ( ) const override ; <nl> - CRPBaseRenderer * CreateRenderer ( const CRenderSettings & settings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) override ; <nl> - RenderBufferPoolVector CreateBufferPools ( CRenderContext & context ) override ; <nl> - } ; <nl> - <nl> - class CRenderBufferPoolGuiTexture : public CBaseRenderBufferPool <nl> - { <nl> - public : <nl> - CRenderBufferPoolGuiTexture ( SCALINGMETHOD scalingMethod ) ; <nl> - ~ CRenderBufferPoolGuiTexture ( ) override = default ; <nl> - <nl> - / / implementation of IRenderBufferPool via CBaseRenderBufferPool <nl> - bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const override ; <nl> - <nl> - / / implementation of CBaseRenderBufferPool <nl> - IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) override ; <nl> - <nl> - private : <nl> - SCALINGMETHOD m_scalingMethod ; <nl> - } ; <nl> - <nl> - class CRPRendererGuiTexture : public CRPBaseRenderer <nl> - { <nl> - public : <nl> - CRPRendererGuiTexture ( const CRenderSettings & renderSettings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> - ~ CRPRendererGuiTexture ( ) override = default ; <nl> - <nl> - / / public implementation of CRPBaseRenderer <nl> - bool Supports ( RENDERFEATURE feature ) const override ; <nl> - SCALINGMETHOD GetDefaultScalingMethod ( ) const override { return SCALINGMETHOD : : NEAREST ; } <nl> - <nl> - protected : <nl> - / / protected implementation of CRPBaseRenderer <nl> - void RenderInternal ( bool clear , uint8_t alpha ) override ; <nl> - } ; <nl> - } <nl> - } <nl> + class CRendererFactoryGuiTexture : public IRendererFactory <nl> + { <nl> + public : <nl> + ~ CRendererFactoryGuiTexture ( ) override = default ; <nl> + <nl> + / / implementation of IRendererFactory <nl> + std : : string RenderSystemName ( ) const override ; <nl> + CRPBaseRenderer * CreateRenderer ( const CRenderSettings & settings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) override ; <nl> + RenderBufferPoolVector CreateBufferPools ( CRenderContext & context ) override ; <nl> + } ; <nl> + <nl> + class CRenderBufferPoolGuiTexture : public CBaseRenderBufferPool <nl> + { <nl> + public : <nl> + CRenderBufferPoolGuiTexture ( SCALINGMETHOD scalingMethod ) ; <nl> + ~ CRenderBufferPoolGuiTexture ( ) override = default ; <nl> + <nl> + / / implementation of IRenderBufferPool via CBaseRenderBufferPool <nl> + bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const override ; <nl> + <nl> + / / implementation of CBaseRenderBufferPool <nl> + IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) override ; <nl> + <nl> + private : <nl> + SCALINGMETHOD m_scalingMethod ; <nl> + } ; <nl> + <nl> + class CRPRendererGuiTexture : public CRPBaseRenderer <nl> + { <nl> + public : <nl> + CRPRendererGuiTexture ( const CRenderSettings & renderSettings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> + ~ CRPRendererGuiTexture ( ) override = default ; <nl> + <nl> + / / public implementation of CRPBaseRenderer <nl> + bool Supports ( RENDERFEATURE feature ) const override ; <nl> + SCALINGMETHOD GetDefaultScalingMethod ( ) const override { return SCALINGMETHOD : : NEAREST ; } <nl> + <nl> + protected : <nl> + / / protected implementation of CRPBaseRenderer <nl> + void RenderInternal ( bool clear , uint8_t alpha ) override ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererOpenGL . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererOpenGL . cpp <nl> <nl> # include " cores / RetroPlayer / rendering / RenderContext . h " <nl> # include " utils / log . h " <nl> <nl> - # define BUFFER_OFFSET ( i ) ( static_cast < char * > ( NULL ) + ( i ) ) <nl> + # define BUFFER_OFFSET ( i ) ( static_cast < char * > ( NULL ) + ( i ) ) <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> std : : string CRendererFactoryOpenGL : : RenderSystemName ( ) const <nl> return " OpenGL " ; <nl> } <nl> <nl> - CRPBaseRenderer * CRendererFactoryOpenGL : : CreateRenderer ( const CRenderSettings & settings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> + CRPBaseRenderer * CRendererFactoryOpenGL : : CreateRenderer ( <nl> + const CRenderSettings & settings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> { <nl> return new CRPRendererOpenGL ( settings , context , std : : move ( bufferPool ) ) ; <nl> } <nl> <nl> - RenderBufferPoolVector CRendererFactoryOpenGL : : CreateBufferPools ( CRenderContext & context ) <nl> + RenderBufferPoolVector CRendererFactoryOpenGL : : CreateBufferPools ( CRenderContext & context ) <nl> { <nl> - return { std : : make_shared < CRenderBufferPoolOpenGL > ( ) } ; <nl> + return { std : : make_shared < CRenderBufferPoolOpenGL > ( ) } ; <nl> } <nl> <nl> / / mmm CRPRendererOpenGL mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - CRPRendererOpenGL : : CRPRendererOpenGL ( const CRenderSettings & renderSettings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) : <nl> - CRPBaseRenderer ( renderSettings , context , std : : move ( bufferPool ) ) <nl> + CRPRendererOpenGL : : CRPRendererOpenGL ( const CRenderSettings & renderSettings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> + : CRPBaseRenderer ( renderSettings , context , std : : move ( bufferPool ) ) <nl> { <nl> / / Initialize CRPRendererOpenGL <nl> m_clearColour = m_context . UseLimitedColor ( ) ? ( 16 . 0f / 0xff ) : 0 . 0f ; <nl> CRPRendererOpenGL : : CRPRendererOpenGL ( const CRenderSettings & renderSettings , CRen <nl> glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER , m_mainIndexVBO ) ; <nl> glBindBuffer ( GL_ARRAY_BUFFER , m_mainVertexVBO ) ; <nl> glEnableVertexAttribArray ( vertLoc ) ; <nl> - glVertexAttribPointer ( vertLoc , 3 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , BUFFER_OFFSET ( offsetof ( PackedVertex , x ) ) ) ; <nl> + glVertexAttribPointer ( vertLoc , 3 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , <nl> + BUFFER_OFFSET ( offsetof ( PackedVertex , x ) ) ) ; <nl> glEnableVertexAttribArray ( loc ) ; <nl> - glVertexAttribPointer ( loc , 2 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , BUFFER_OFFSET ( offsetof ( PackedVertex , u1 ) ) ) ; <nl> + glVertexAttribPointer ( loc , 2 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , <nl> + BUFFER_OFFSET ( offsetof ( PackedVertex , u1 ) ) ) ; <nl> <nl> / / Set up black bars VAO / VBO <nl> glGenVertexArrays ( 1 , & m_blackbarsVAO ) ; <nl> void CRPRendererOpenGL : : FlushInternal ( ) <nl> <nl> bool CRPRendererOpenGL : : Supports ( RENDERFEATURE feature ) const <nl> { <nl> - return feature = = RENDERFEATURE : : STRETCH | | <nl> - feature = = RENDERFEATURE : : ZOOM | | <nl> - feature = = RENDERFEATURE : : PIXEL_RATIO | | <nl> - feature = = RENDERFEATURE : : ROTATION ; <nl> + return feature = = RENDERFEATURE : : STRETCH | | feature = = RENDERFEATURE : : ZOOM | | <nl> + feature = = RENDERFEATURE : : PIXEL_RATIO | | feature = = RENDERFEATURE : : ROTATION ; <nl> } <nl> <nl> bool CRPRendererOpenGL : : SupportsScalingMethod ( SCALINGMETHOD method ) <nl> { <nl> - return method = = SCALINGMETHOD : : NEAREST | | <nl> - method = = SCALINGMETHOD : : LINEAR ; <nl> + return method = = SCALINGMETHOD : : NEAREST | | method = = SCALINGMETHOD : : LINEAR ; <nl> } <nl> <nl> void CRPRendererOpenGL : : ClearBackBuffer ( ) <nl> void CRPRendererOpenGL : : DrawBlackBars ( ) <nl> <nl> glUniform4f ( uniCol , m_clearColour / 255 . 0f , m_clearColour / 255 . 0f , m_clearColour / 255 . 0f , 1 . 0f ) ; <nl> <nl> - / / top quad <nl> + / / top quad <nl> if ( m_rotatedDestCoords [ 0 ] . y > 0 . 0 ) <nl> { <nl> GLubyte quad = count ; <nl> vertices [ quad ] . x = 0 . 0 ; <nl> vertices [ quad ] . y = 0 . 0 ; <nl> vertices [ quad ] . z = 0 ; <nl> - vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 1 ] . y = 0 ; <nl> - vertices [ quad + 1 ] . z = 0 ; <nl> - vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> - vertices [ quad + 2 ] . z = 0 ; <nl> - vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> - vertices [ quad + 4 ] . x = 0 ; <nl> - vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> - vertices [ quad + 4 ] . z = 0 ; <nl> - vertices [ quad + 5 ] = vertices [ quad ] ; <nl> + vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 1 ] . y = 0 ; <nl> + vertices [ quad + 1 ] . z = 0 ; <nl> + vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> + vertices [ quad + 2 ] . z = 0 ; <nl> + vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> + vertices [ quad + 4 ] . x = 0 ; <nl> + vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> + vertices [ quad + 4 ] . z = 0 ; <nl> + vertices [ quad + 5 ] = vertices [ quad ] ; <nl> count + = 6 ; <nl> } <nl> <nl> - / / bottom quad <nl> + / / bottom quad <nl> if ( m_rotatedDestCoords [ 2 ] . y < m_context . GetScreenHeight ( ) ) <nl> { <nl> GLubyte quad = count ; <nl> vertices [ quad ] . x = 0 . 0 ; <nl> vertices [ quad ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> vertices [ quad ] . z = 0 ; <nl> - vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> - vertices [ quad + 1 ] . z = 0 ; <nl> - vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 2 ] . y = m_context . GetScreenHeight ( ) ; <nl> - vertices [ quad + 2 ] . z = 0 ; <nl> - vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> - vertices [ quad + 4 ] . x = 0 ; <nl> - vertices [ quad + 4 ] . y = m_context . GetScreenHeight ( ) ; <nl> - vertices [ quad + 4 ] . z = 0 ; <nl> - vertices [ quad + 5 ] = vertices [ quad ] ; <nl> + vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> + vertices [ quad + 1 ] . z = 0 ; <nl> + vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 2 ] . y = m_context . GetScreenHeight ( ) ; <nl> + vertices [ quad + 2 ] . z = 0 ; <nl> + vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> + vertices [ quad + 4 ] . x = 0 ; <nl> + vertices [ quad + 4 ] . y = m_context . GetScreenHeight ( ) ; <nl> + vertices [ quad + 4 ] . z = 0 ; <nl> + vertices [ quad + 5 ] = vertices [ quad ] ; <nl> count + = 6 ; <nl> } <nl> <nl> - / / left quad <nl> + / / left quad <nl> if ( m_rotatedDestCoords [ 0 ] . x > 0 . 0 ) <nl> { <nl> GLubyte quad = count ; <nl> vertices [ quad ] . x = 0 . 0 ; <nl> vertices [ quad ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> vertices [ quad ] . z = 0 ; <nl> - vertices [ quad + 1 ] . x = m_rotatedDestCoords [ 0 ] . x ; <nl> - vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> - vertices [ quad + 1 ] . z = 0 ; <nl> - vertices [ quad + 2 ] . x = m_rotatedDestCoords [ 3 ] . x ; <nl> - vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 3 ] . y ; <nl> - vertices [ quad + 2 ] . z = 0 ; <nl> - vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> - vertices [ quad + 4 ] . x = 0 ; <nl> - vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 3 ] . y ; <nl> - vertices [ quad + 4 ] . z = 0 ; <nl> - vertices [ quad + 5 ] = vertices [ quad ] ; <nl> + vertices [ quad + 1 ] . x = m_rotatedDestCoords [ 0 ] . x ; <nl> + vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> + vertices [ quad + 1 ] . z = 0 ; <nl> + vertices [ quad + 2 ] . x = m_rotatedDestCoords [ 3 ] . x ; <nl> + vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 3 ] . y ; <nl> + vertices [ quad + 2 ] . z = 0 ; <nl> + vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> + vertices [ quad + 4 ] . x = 0 ; <nl> + vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 3 ] . y ; <nl> + vertices [ quad + 4 ] . z = 0 ; <nl> + vertices [ quad + 5 ] = vertices [ quad ] ; <nl> count + = 6 ; <nl> } <nl> <nl> - / / right quad <nl> + / / right quad <nl> if ( m_rotatedDestCoords [ 2 ] . x < m_context . GetScreenWidth ( ) ) <nl> { <nl> GLubyte quad = count ; <nl> vertices [ quad ] . x = m_rotatedDestCoords [ 1 ] . x ; <nl> vertices [ quad ] . y = m_rotatedDestCoords [ 1 ] . y ; <nl> vertices [ quad ] . z = 0 ; <nl> - vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 1 ] . y ; <nl> - vertices [ quad + 1 ] . z = 0 ; <nl> - vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> - vertices [ quad + 2 ] . z = 0 ; <nl> - vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> - vertices [ quad + 4 ] . x = m_rotatedDestCoords [ 1 ] . x ; <nl> - vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> - vertices [ quad + 4 ] . z = 0 ; <nl> - vertices [ quad + 5 ] = vertices [ quad ] ; <nl> + vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 1 ] . y ; <nl> + vertices [ quad + 1 ] . z = 0 ; <nl> + vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> + vertices [ quad + 2 ] . z = 0 ; <nl> + vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> + vertices [ quad + 4 ] . x = m_rotatedDestCoords [ 1 ] . x ; <nl> + vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> + vertices [ quad + 4 ] . z = 0 ; <nl> + vertices [ quad + 5 ] = vertices [ quad ] ; <nl> count + = 6 ; <nl> } <nl> <nl> glBindVertexArray ( m_blackbarsVAO ) ; <nl> <nl> glBindBuffer ( GL_ARRAY_BUFFER , m_blackbarsVertexVBO ) ; <nl> - glBufferData ( GL_ARRAY_BUFFER , sizeof ( Svertex ) * count , & vertices [ 0 ] , GL_STATIC_DRAW ) ; <nl> + glBufferData ( GL_ARRAY_BUFFER , sizeof ( Svertex ) * count , & vertices [ 0 ] , GL_STATIC_DRAW ) ; <nl> <nl> glDrawArrays ( GL_TRIANGLES , 0 , count ) ; <nl> <nl> void CRPRendererOpenGL : : DrawBlackBars ( ) <nl> <nl> void CRPRendererOpenGL : : Render ( uint8_t alpha ) <nl> { <nl> - CRenderBufferOpenGL * renderBuffer = static_cast < CRenderBufferOpenGL * > ( m_renderBuffer ) ; <nl> + CRenderBufferOpenGL * renderBuffer = static_cast < CRenderBufferOpenGL * > ( m_renderBuffer ) ; <nl> <nl> if ( renderBuffer = = nullptr ) <nl> return ; <nl> void CRPRendererOpenGL : : Render ( uint8_t alpha ) <nl> vertex [ 2 ] . v1 = vertex [ 3 ] . v1 = rect . y2 ; <nl> <nl> glBindVertexArray ( m_mainVAO ) ; <nl> - <nl> + <nl> glBindBuffer ( GL_ARRAY_BUFFER , m_mainVertexVBO ) ; <nl> - glBufferData ( GL_ARRAY_BUFFER , sizeof ( PackedVertex ) * 4 , & vertex [ 0 ] , GL_STATIC_DRAW ) ; <nl> + glBufferData ( GL_ARRAY_BUFFER , sizeof ( PackedVertex ) * 4 , & vertex [ 0 ] , GL_STATIC_DRAW ) ; <nl> <nl> / / No need to bind the index VBO , it ' s part of VAO state <nl> - glBufferData ( GL_ELEMENT_ARRAY_BUFFER , sizeof ( GLubyte ) * 4 , idx , GL_STATIC_DRAW ) ; <nl> + glBufferData ( GL_ELEMENT_ARRAY_BUFFER , sizeof ( GLubyte ) * 4 , idx , GL_STATIC_DRAW ) ; <nl> <nl> - glUniform4f ( uniColLoc , ( colour [ 0 ] / 255 . 0f ) , ( colour [ 1 ] / 255 . 0f ) , ( colour [ 2 ] / 255 . 0f ) , ( colour [ 3 ] / 255 . 0f ) ) ; <nl> + glUniform4f ( uniColLoc , ( colour [ 0 ] / 255 . 0f ) , ( colour [ 1 ] / 255 . 0f ) , ( colour [ 2 ] / 255 . 0f ) , <nl> + ( colour [ 3 ] / 255 . 0f ) ) ; <nl> <nl> glDrawElements ( GL_TRIANGLE_STRIP , 4 , GL_UNSIGNED_BYTE , 0 ) ; <nl> <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererOpenGL . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererOpenGL . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderContext ; <nl> + class CRenderContext ; <nl> <nl> - class CRendererFactoryOpenGL : public IRendererFactory <nl> - { <nl> - public : <nl> - ~ CRendererFactoryOpenGL ( ) override = default ; <nl> + class CRendererFactoryOpenGL : public IRendererFactory <nl> + { <nl> + public : <nl> + ~ CRendererFactoryOpenGL ( ) override = default ; <nl> <nl> - / / implementation of IRendererFactory <nl> - std : : string RenderSystemName ( ) const override ; <nl> - CRPBaseRenderer * CreateRenderer ( const CRenderSettings & settings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) override ; <nl> - RenderBufferPoolVector CreateBufferPools ( CRenderContext & context ) override ; <nl> - } ; <nl> + / / implementation of IRendererFactory <nl> + std : : string RenderSystemName ( ) const override ; <nl> + CRPBaseRenderer * CreateRenderer ( const CRenderSettings & settings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) override ; <nl> + RenderBufferPoolVector CreateBufferPools ( CRenderContext & context ) override ; <nl> + } ; <nl> + <nl> + class CRPRendererOpenGL : public CRPBaseRenderer <nl> + { <nl> + public : <nl> + CRPRendererOpenGL ( const CRenderSettings & renderSettings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> + ~ CRPRendererOpenGL ( ) override ; <nl> + <nl> + / / implementation of CRPBaseRenderer <nl> + bool Supports ( RENDERFEATURE feature ) const override ; <nl> + SCALINGMETHOD GetDefaultScalingMethod ( ) const override { return SCALINGMETHOD : : NEAREST ; } <nl> <nl> - class CRPRendererOpenGL : public CRPBaseRenderer <nl> + static bool SupportsScalingMethod ( SCALINGMETHOD method ) ; <nl> + <nl> + protected : <nl> + struct PackedVertex <nl> + { <nl> + float x , y , z ; <nl> + float u1 , v1 ; <nl> + } ; <nl> + struct Svertex <nl> { <nl> - public : <nl> - CRPRendererOpenGL ( const CRenderSettings & renderSettings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> - ~ CRPRendererOpenGL ( ) override ; <nl> - <nl> - / / implementation of CRPBaseRenderer <nl> - bool Supports ( RENDERFEATURE feature ) const override ; <nl> - SCALINGMETHOD GetDefaultScalingMethod ( ) const override { return SCALINGMETHOD : : NEAREST ; } <nl> - <nl> - static bool SupportsScalingMethod ( SCALINGMETHOD method ) ; <nl> - <nl> - protected : <nl> - struct PackedVertex <nl> - { <nl> - float x , y , z ; <nl> - float u1 , v1 ; <nl> - } ; <nl> - struct Svertex <nl> - { <nl> - float x ; <nl> - float y ; <nl> - float z ; <nl> - } ; <nl> - <nl> - / / implementation of CRPBaseRenderer <nl> - void RenderInternal ( bool clear , uint8_t alpha ) override ; <nl> - void FlushInternal ( ) override ; <nl> - <nl> - / * ! <nl> - * \ brief Set the entire backbuffer to black <nl> - * / <nl> - void ClearBackBuffer ( ) ; <nl> - <nl> - / * ! <nl> - * \ brief Draw black bars around the video quad <nl> - * <nl> - * This is more efficient than glClear ( ) since it only sets pixels to <nl> - * black that aren ' t going to be overwritten by the game . <nl> - * / <nl> - void DrawBlackBars ( ) ; <nl> - <nl> - virtual void Render ( uint8_t alpha ) ; <nl> - <nl> - GLuint m_mainVAO ; <nl> - GLuint m_mainVertexVBO ; <nl> - GLuint m_mainIndexVBO ; <nl> - <nl> - GLuint m_blackbarsVAO ; <nl> - GLuint m_blackbarsVertexVBO ; <nl> - <nl> - GLenum m_textureTarget = GL_TEXTURE_2D ; <nl> - float m_clearColour = 0 . 0f ; <nl> + float x ; <nl> + float y ; <nl> + float z ; <nl> } ; <nl> - } <nl> - } <nl> + <nl> + / / implementation of CRPBaseRenderer <nl> + void RenderInternal ( bool clear , uint8_t alpha ) override ; <nl> + void FlushInternal ( ) override ; <nl> + <nl> + / * ! <nl> + * \ brief Set the entire backbuffer to black <nl> + * / <nl> + void ClearBackBuffer ( ) ; <nl> + <nl> + / * ! <nl> + * \ brief Draw black bars around the video quad <nl> + * <nl> + * This is more efficient than glClear ( ) since it only sets pixels to <nl> + * black that aren ' t going to be overwritten by the game . <nl> + * / <nl> + void DrawBlackBars ( ) ; <nl> + <nl> + virtual void Render ( uint8_t alpha ) ; <nl> + <nl> + GLuint m_mainVAO ; <nl> + GLuint m_mainVertexVBO ; <nl> + GLuint m_mainIndexVBO ; <nl> + <nl> + GLuint m_blackbarsVAO ; <nl> + GLuint m_blackbarsVertexVBO ; <nl> + <nl> + GLenum m_textureTarget = GL_TEXTURE_2D ; <nl> + float m_clearColour = 0 . 0f ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererOpenGLES . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererOpenGLES . cpp <nl> <nl> # include < cstring > <nl> # include < stddef . h > <nl> <nl> - # define BUFFER_OFFSET ( i ) ( ( char * ) NULL + ( i ) ) <nl> + # define BUFFER_OFFSET ( i ) ( ( char * ) NULL + ( i ) ) <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> std : : string CRendererFactoryOpenGLES : : RenderSystemName ( ) const <nl> return " OpenGLES " ; <nl> } <nl> <nl> - CRPBaseRenderer * CRendererFactoryOpenGLES : : CreateRenderer ( const CRenderSettings & settings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> + CRPBaseRenderer * CRendererFactoryOpenGLES : : CreateRenderer ( <nl> + const CRenderSettings & settings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> { <nl> return new CRPRendererOpenGLES ( settings , context , std : : move ( bufferPool ) ) ; <nl> } <nl> <nl> - RenderBufferPoolVector CRendererFactoryOpenGLES : : CreateBufferPools ( CRenderContext & context ) <nl> + RenderBufferPoolVector CRendererFactoryOpenGLES : : CreateBufferPools ( CRenderContext & context ) <nl> { <nl> - return { std : : make_shared < CRenderBufferPoolOpenGLES > ( context ) } ; <nl> + return { std : : make_shared < CRenderBufferPoolOpenGLES > ( context ) } ; <nl> } <nl> <nl> / / mmm CRPRendererOpenGLES mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> - CRPRendererOpenGLES : : CRPRendererOpenGLES ( const CRenderSettings & renderSettings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) : <nl> - CRPBaseRenderer ( renderSettings , context , std : : move ( bufferPool ) ) <nl> + CRPRendererOpenGLES : : CRPRendererOpenGLES ( const CRenderSettings & renderSettings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> + : CRPBaseRenderer ( renderSettings , context , std : : move ( bufferPool ) ) <nl> { <nl> glGenBuffers ( 1 , & m_mainIndexVBO ) ; <nl> glGenBuffers ( 1 , & m_mainVertexVBO ) ; <nl> void CRPRendererOpenGLES : : FlushInternal ( ) <nl> <nl> bool CRPRendererOpenGLES : : Supports ( RENDERFEATURE feature ) const <nl> { <nl> - return feature = = RENDERFEATURE : : STRETCH | | <nl> - feature = = RENDERFEATURE : : ZOOM | | <nl> - feature = = RENDERFEATURE : : PIXEL_RATIO | | <nl> - feature = = RENDERFEATURE : : ROTATION ; <nl> + return feature = = RENDERFEATURE : : STRETCH | | feature = = RENDERFEATURE : : ZOOM | | <nl> + feature = = RENDERFEATURE : : PIXEL_RATIO | | feature = = RENDERFEATURE : : ROTATION ; <nl> } <nl> <nl> bool CRPRendererOpenGLES : : SupportsScalingMethod ( SCALINGMETHOD method ) <nl> { <nl> - return method = = SCALINGMETHOD : : NEAREST | | <nl> - method = = SCALINGMETHOD : : LINEAR ; <nl> + return method = = SCALINGMETHOD : : NEAREST | | method = = SCALINGMETHOD : : LINEAR ; <nl> } <nl> <nl> void CRPRendererOpenGLES : : ClearBackBuffer ( ) <nl> void CRPRendererOpenGLES : : DrawBlackBars ( ) <nl> <nl> glUniform4f ( uniCol , m_clearColour / 255 . 0f , m_clearColour / 255 . 0f , m_clearColour / 255 . 0f , 1 . 0f ) ; <nl> <nl> - / / top quad <nl> + / / top quad <nl> if ( m_rotatedDestCoords [ 0 ] . y > 0 . 0 ) <nl> { <nl> GLubyte quad = count ; <nl> vertices [ quad ] . x = 0 . 0 ; <nl> vertices [ quad ] . y = 0 . 0 ; <nl> vertices [ quad ] . z = 0 ; <nl> - vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 1 ] . y = 0 ; <nl> - vertices [ quad + 1 ] . z = 0 ; <nl> - vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> - vertices [ quad + 2 ] . z = 0 ; <nl> - vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> - vertices [ quad + 4 ] . x = 0 ; <nl> - vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> - vertices [ quad + 4 ] . z = 0 ; <nl> - vertices [ quad + 5 ] = vertices [ quad ] ; <nl> + vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 1 ] . y = 0 ; <nl> + vertices [ quad + 1 ] . z = 0 ; <nl> + vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> + vertices [ quad + 2 ] . z = 0 ; <nl> + vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> + vertices [ quad + 4 ] . x = 0 ; <nl> + vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> + vertices [ quad + 4 ] . z = 0 ; <nl> + vertices [ quad + 5 ] = vertices [ quad ] ; <nl> count + = 6 ; <nl> } <nl> <nl> - / / bottom quad <nl> + / / bottom quad <nl> if ( m_rotatedDestCoords [ 2 ] . y < m_context . GetScreenHeight ( ) ) <nl> { <nl> GLubyte quad = count ; <nl> vertices [ quad ] . x = 0 . 0 ; <nl> vertices [ quad ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> vertices [ quad ] . z = 0 ; <nl> - vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> - vertices [ quad + 1 ] . z = 0 ; <nl> - vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 2 ] . y = m_context . GetScreenHeight ( ) ; <nl> - vertices [ quad + 2 ] . z = 0 ; <nl> - vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> - vertices [ quad + 4 ] . x = 0 ; <nl> - vertices [ quad + 4 ] . y = m_context . GetScreenHeight ( ) ; <nl> - vertices [ quad + 4 ] . z = 0 ; <nl> - vertices [ quad + 5 ] = vertices [ quad ] ; <nl> + vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> + vertices [ quad + 1 ] . z = 0 ; <nl> + vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 2 ] . y = m_context . GetScreenHeight ( ) ; <nl> + vertices [ quad + 2 ] . z = 0 ; <nl> + vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> + vertices [ quad + 4 ] . x = 0 ; <nl> + vertices [ quad + 4 ] . y = m_context . GetScreenHeight ( ) ; <nl> + vertices [ quad + 4 ] . z = 0 ; <nl> + vertices [ quad + 5 ] = vertices [ quad ] ; <nl> count + = 6 ; <nl> } <nl> <nl> - / / left quad <nl> + / / left quad <nl> if ( m_rotatedDestCoords [ 0 ] . x > 0 . 0 ) <nl> { <nl> GLubyte quad = count ; <nl> vertices [ quad ] . x = 0 . 0 ; <nl> vertices [ quad ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> vertices [ quad ] . z = 0 ; <nl> - vertices [ quad + 1 ] . x = m_rotatedDestCoords [ 0 ] . x ; <nl> - vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> - vertices [ quad + 1 ] . z = 0 ; <nl> - vertices [ quad + 2 ] . x = m_rotatedDestCoords [ 3 ] . x ; <nl> - vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 3 ] . y ; <nl> - vertices [ quad + 2 ] . z = 0 ; <nl> - vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> - vertices [ quad + 4 ] . x = 0 ; <nl> - vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 3 ] . y ; <nl> - vertices [ quad + 4 ] . z = 0 ; <nl> - vertices [ quad + 5 ] = vertices [ quad ] ; <nl> + vertices [ quad + 1 ] . x = m_rotatedDestCoords [ 0 ] . x ; <nl> + vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 0 ] . y ; <nl> + vertices [ quad + 1 ] . z = 0 ; <nl> + vertices [ quad + 2 ] . x = m_rotatedDestCoords [ 3 ] . x ; <nl> + vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 3 ] . y ; <nl> + vertices [ quad + 2 ] . z = 0 ; <nl> + vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> + vertices [ quad + 4 ] . x = 0 ; <nl> + vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 3 ] . y ; <nl> + vertices [ quad + 4 ] . z = 0 ; <nl> + vertices [ quad + 5 ] = vertices [ quad ] ; <nl> count + = 6 ; <nl> } <nl> <nl> - / / right quad <nl> + / / right quad <nl> if ( m_rotatedDestCoords [ 2 ] . x < m_context . GetScreenWidth ( ) ) <nl> { <nl> GLubyte quad = count ; <nl> vertices [ quad ] . x = m_rotatedDestCoords [ 1 ] . x ; <nl> vertices [ quad ] . y = m_rotatedDestCoords [ 1 ] . y ; <nl> vertices [ quad ] . z = 0 ; <nl> - vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 1 ] . y ; <nl> - vertices [ quad + 1 ] . z = 0 ; <nl> - vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> - vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> - vertices [ quad + 2 ] . z = 0 ; <nl> - vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> - vertices [ quad + 4 ] . x = m_rotatedDestCoords [ 1 ] . x ; <nl> - vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> - vertices [ quad + 4 ] . z = 0 ; <nl> - vertices [ quad + 5 ] = vertices [ quad ] ; <nl> + vertices [ quad + 1 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 1 ] . y = m_rotatedDestCoords [ 1 ] . y ; <nl> + vertices [ quad + 1 ] . z = 0 ; <nl> + vertices [ quad + 2 ] . x = m_context . GetScreenWidth ( ) ; <nl> + vertices [ quad + 2 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> + vertices [ quad + 2 ] . z = 0 ; <nl> + vertices [ quad + 3 ] = vertices [ quad + 2 ] ; <nl> + vertices [ quad + 4 ] . x = m_rotatedDestCoords [ 1 ] . x ; <nl> + vertices [ quad + 4 ] . y = m_rotatedDestCoords [ 2 ] . y ; <nl> + vertices [ quad + 4 ] . z = 0 ; <nl> + vertices [ quad + 5 ] = vertices [ quad ] ; <nl> count + = 6 ; <nl> } <nl> <nl> glBindBuffer ( GL_ARRAY_BUFFER , m_blackbarsVertexVBO ) ; <nl> - glBufferData ( GL_ARRAY_BUFFER , sizeof ( Svertex ) * count , & vertices [ 0 ] , GL_STATIC_DRAW ) ; <nl> + glBufferData ( GL_ARRAY_BUFFER , sizeof ( Svertex ) * count , & vertices [ 0 ] , GL_STATIC_DRAW ) ; <nl> <nl> glVertexAttribPointer ( posLoc , 3 , GL_FLOAT , GL_FALSE , sizeof ( Svertex ) , 0 ) ; <nl> glEnableVertexAttribArray ( posLoc ) ; <nl> void CRPRendererOpenGLES : : DrawBlackBars ( ) <nl> <nl> void CRPRendererOpenGLES : : Render ( uint8_t alpha ) <nl> { <nl> - CRenderBufferOpenGLES * renderBuffer = static_cast < CRenderBufferOpenGLES * > ( m_renderBuffer ) ; <nl> + CRenderBufferOpenGLES * renderBuffer = static_cast < CRenderBufferOpenGLES * > ( m_renderBuffer ) ; <nl> <nl> if ( renderBuffer = = nullptr ) <nl> return ; <nl> void CRPRendererOpenGLES : : Render ( uint8_t alpha ) <nl> vertex [ 2 ] . v1 = vertex [ 3 ] . v1 = rect . y2 ; <nl> <nl> glBindBuffer ( GL_ARRAY_BUFFER , m_mainVertexVBO ) ; <nl> - glBufferData ( GL_ARRAY_BUFFER , sizeof ( PackedVertex ) * 4 , & vertex [ 0 ] , GL_STATIC_DRAW ) ; <nl> + glBufferData ( GL_ARRAY_BUFFER , sizeof ( PackedVertex ) * 4 , & vertex [ 0 ] , GL_STATIC_DRAW ) ; <nl> <nl> - glVertexAttribPointer ( vertLoc , 3 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , BUFFER_OFFSET ( offsetof ( PackedVertex , x ) ) ) ; <nl> - glVertexAttribPointer ( loc , 2 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , BUFFER_OFFSET ( offsetof ( PackedVertex , u1 ) ) ) ; <nl> + glVertexAttribPointer ( vertLoc , 3 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , <nl> + BUFFER_OFFSET ( offsetof ( PackedVertex , x ) ) ) ; <nl> + glVertexAttribPointer ( loc , 2 , GL_FLOAT , 0 , sizeof ( PackedVertex ) , <nl> + BUFFER_OFFSET ( offsetof ( PackedVertex , u1 ) ) ) ; <nl> <nl> glEnableVertexAttribArray ( vertLoc ) ; <nl> glEnableVertexAttribArray ( loc ) ; <nl> <nl> glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER , m_mainIndexVBO ) ; <nl> - glBufferData ( GL_ELEMENT_ARRAY_BUFFER , sizeof ( GLubyte ) * 4 , idx , GL_STATIC_DRAW ) ; <nl> + glBufferData ( GL_ELEMENT_ARRAY_BUFFER , sizeof ( GLubyte ) * 4 , idx , GL_STATIC_DRAW ) ; <nl> <nl> - glUniform4f ( uniColLoc , ( colour [ 0 ] / 255 . 0f ) , ( colour [ 1 ] / 255 . 0f ) , ( colour [ 2 ] / 255 . 0f ) , ( colour [ 3 ] / 255 . 0f ) ) ; <nl> + glUniform4f ( uniColLoc , ( colour [ 0 ] / 255 . 0f ) , ( colour [ 1 ] / 255 . 0f ) , ( colour [ 2 ] / 255 . 0f ) , <nl> + ( colour [ 3 ] / 255 . 0f ) ) ; <nl> glDrawElements ( GL_TRIANGLE_STRIP , 4 , GL_UNSIGNED_BYTE , 0 ) ; <nl> <nl> glDisableVertexAttribArray ( vertLoc ) ; <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererOpenGLES . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPRendererOpenGLES . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRendererFactoryOpenGLES : public IRendererFactory <nl> - { <nl> - public : <nl> - ~ CRendererFactoryOpenGLES ( ) override = default ; <nl> + class CRendererFactoryOpenGLES : public IRendererFactory <nl> + { <nl> + public : <nl> + ~ CRendererFactoryOpenGLES ( ) override = default ; <nl> <nl> - / / implementation of IRendererFactory <nl> - std : : string RenderSystemName ( ) const override ; <nl> - CRPBaseRenderer * CreateRenderer ( const CRenderSettings & settings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) override ; <nl> - RenderBufferPoolVector CreateBufferPools ( CRenderContext & context ) override ; <nl> - } ; <nl> + / / implementation of IRendererFactory <nl> + std : : string RenderSystemName ( ) const override ; <nl> + CRPBaseRenderer * CreateRenderer ( const CRenderSettings & settings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) override ; <nl> + RenderBufferPoolVector CreateBufferPools ( CRenderContext & context ) override ; <nl> + } ; <nl> <nl> - class CRPRendererOpenGLES : public CRPBaseRenderer <nl> - { <nl> - public : <nl> - CRPRendererOpenGLES ( const CRenderSettings & renderSettings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> - ~ CRPRendererOpenGLES ( ) override ; <nl> + class CRPRendererOpenGLES : public CRPBaseRenderer <nl> + { <nl> + public : <nl> + CRPRendererOpenGLES ( const CRenderSettings & renderSettings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> + ~ CRPRendererOpenGLES ( ) override ; <nl> <nl> - / / implementation of CRPBaseRenderer <nl> - bool Supports ( RENDERFEATURE feature ) const override ; <nl> - SCALINGMETHOD GetDefaultScalingMethod ( ) const override { return SCALINGMETHOD : : NEAREST ; } <nl> + / / implementation of CRPBaseRenderer <nl> + bool Supports ( RENDERFEATURE feature ) const override ; <nl> + SCALINGMETHOD GetDefaultScalingMethod ( ) const override { return SCALINGMETHOD : : NEAREST ; } <nl> <nl> - static bool SupportsScalingMethod ( SCALINGMETHOD method ) ; <nl> + static bool SupportsScalingMethod ( SCALINGMETHOD method ) ; <nl> <nl> - protected : <nl> - / / implementation of CRPBaseRenderer <nl> - void RenderInternal ( bool clear , uint8_t alpha ) override ; <nl> - void FlushInternal ( ) override ; <nl> + protected : <nl> + / / implementation of CRPBaseRenderer <nl> + void RenderInternal ( bool clear , uint8_t alpha ) override ; <nl> + void FlushInternal ( ) override ; <nl> <nl> - / * ! <nl> - * \ brief Set the entire backbuffer to black <nl> - * / <nl> - void ClearBackBuffer ( ) ; <nl> + / * ! <nl> + * \ brief Set the entire backbuffer to black <nl> + * / <nl> + void ClearBackBuffer ( ) ; <nl> <nl> - / * ! <nl> - * \ brief Draw black bars around the video quad <nl> - * <nl> - * This is more efficient than glClear ( ) since it only sets pixels to <nl> - * black that aren ' t going to be overwritten by the game . <nl> - * / <nl> - void DrawBlackBars ( ) ; <nl> + / * ! <nl> + * \ brief Draw black bars around the video quad <nl> + * <nl> + * This is more efficient than glClear ( ) since it only sets pixels to <nl> + * black that aren ' t going to be overwritten by the game . <nl> + * / <nl> + void DrawBlackBars ( ) ; <nl> <nl> - virtual void Render ( uint8_t alpha ) ; <nl> + virtual void Render ( uint8_t alpha ) ; <nl> <nl> - GLuint m_mainIndexVBO ; <nl> - GLuint m_mainVertexVBO ; <nl> - GLuint m_blackbarsVertexVBO ; <nl> - GLenum m_textureTarget = GL_TEXTURE_2D ; <nl> - float m_clearColour = 0 . 0f ; <nl> - } ; <nl> - } <nl> - } <nl> + GLuint m_mainIndexVBO ; <nl> + GLuint m_mainVertexVBO ; <nl> + GLuint m_blackbarsVertexVBO ; <nl> + GLenum m_textureTarget = GL_TEXTURE_2D ; <nl> + float m_clearColour = 0 . 0f ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPWinRenderer . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPWinRenderer . cpp <nl> <nl> * / <nl> <nl> # include " RPWinRenderer . h " <nl> + <nl> # include " cores / RetroPlayer / rendering / RenderContext . h " <nl> # include " cores / RetroPlayer / rendering / RenderTranslator . h " <nl> # include " cores / RetroPlayer / rendering / RenderVideoSettings . h " <nl> std : : string CWinRendererFactory : : RenderSystemName ( ) const <nl> return " DirectX " ; <nl> } <nl> <nl> - CRPBaseRenderer * CWinRendererFactory : : CreateRenderer ( const CRenderSettings & settings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> + CRPBaseRenderer * CWinRendererFactory : : CreateRenderer ( const CRenderSettings & settings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> { <nl> return new CRPWinRenderer ( settings , context , std : : move ( bufferPool ) ) ; <nl> } <nl> <nl> - RenderBufferPoolVector CWinRendererFactory : : CreateBufferPools ( CRenderContext & context ) <nl> + RenderBufferPoolVector CWinRendererFactory : : CreateBufferPools ( CRenderContext & context ) <nl> { <nl> - return { std : : make_shared < CWinRenderBufferPool > ( ) } ; <nl> + return { std : : make_shared < CWinRenderBufferPool > ( ) } ; <nl> } <nl> <nl> / / mmm CWinRenderBuffer mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> - CWinRenderBuffer : : CWinRenderBuffer ( AVPixelFormat pixFormat , DXGI_FORMAT dxFormat ) : <nl> - m_pixFormat ( pixFormat ) , <nl> - m_targetDxFormat ( dxFormat ) , <nl> - m_targetPixFormat ( GetPixFormat ( dxFormat ) ) <nl> + CWinRenderBuffer : : CWinRenderBuffer ( AVPixelFormat pixFormat , DXGI_FORMAT dxFormat ) <nl> + : m_pixFormat ( pixFormat ) , m_targetDxFormat ( dxFormat ) , m_targetPixFormat ( GetPixFormat ( dxFormat ) ) <nl> { <nl> } <nl> <nl> bool CWinRenderBuffer : : UploadTexture ( ) <nl> } <nl> } <nl> <nl> - uint8_t * destData = nullptr ; <nl> + uint8_t * destData = nullptr ; <nl> unsigned int destStride = 0 ; <nl> if ( ! GetTexture ( destData , destStride ) ) <nl> return false ; <nl> bool CWinRenderBuffer : : CreateScalingContext ( ) <nl> { <nl> if ( m_swsContext = = nullptr ) <nl> { <nl> - m_swsContext = sws_getContext ( m_width , m_height , m_pixFormat , m_width , m_height , m_targetPixFormat , <nl> - SWS_FAST_BILINEAR , NULL , NULL , NULL ) ; <nl> + m_swsContext = sws_getContext ( m_width , m_height , m_pixFormat , m_width , m_height , <nl> + m_targetPixFormat , SWS_FAST_BILINEAR , NULL , NULL , NULL ) ; <nl> <nl> if ( m_swsContext = = nullptr ) <nl> { <nl> bool CWinRenderBuffer : : CreateScalingContext ( ) <nl> return true ; <nl> } <nl> <nl> - void CWinRenderBuffer : : ScalePixels ( uint8_t * source , unsigned int sourceStride , uint8_t * target , unsigned int targetStride ) <nl> + void CWinRenderBuffer : : ScalePixels ( uint8_t * source , <nl> + unsigned int sourceStride , <nl> + uint8_t * target , <nl> + unsigned int targetStride ) <nl> { <nl> - uint8_t * src [ ] = { source , nullptr , nullptr , nullptr } ; <nl> - int srcStride [ ] = { static_cast < int > ( sourceStride ) , 0 , 0 , 0 } ; <nl> - uint8_t * dst [ ] = { target , nullptr , nullptr , nullptr } ; <nl> - int dstStride [ ] = { static_cast < int > ( targetStride ) , 0 , 0 , 0 } ; <nl> + uint8_t * src [ ] = { source , nullptr , nullptr , nullptr } ; <nl> + int srcStride [ ] = { static_cast < int > ( sourceStride ) , 0 , 0 , 0 } ; <nl> + uint8_t * dst [ ] = { target , nullptr , nullptr , nullptr } ; <nl> + int dstStride [ ] = { static_cast < int > ( targetStride ) , 0 , 0 , 0 } ; <nl> <nl> sws_scale ( m_swsContext , src , srcStride , 0 , m_height , dst , dstStride ) ; <nl> } <nl> CWinRenderBufferPool : : CWinRenderBufferPool ( ) <nl> CompileOutputShaders ( ) ; <nl> } <nl> <nl> - bool CWinRenderBufferPool : : IsCompatible ( const CRenderVideoSettings & renderSettings ) const <nl> + bool CWinRenderBufferPool : : IsCompatible ( const CRenderVideoSettings & renderSettings ) const <nl> { <nl> return GetShader ( renderSettings . GetScalingMethod ( ) ) ! = nullptr ; <nl> } <nl> <nl> - IRenderBuffer * CWinRenderBufferPool : : CreateRenderBuffer ( void * header / * = nullptr * / ) <nl> + IRenderBuffer * CWinRenderBufferPool : : CreateRenderBuffer ( void * header / * = nullptr * / ) <nl> { <nl> return new CWinRenderBuffer ( m_format , m_targetDxFormat ) ; <nl> } <nl> bool CWinRenderBufferPool : : ConfigureDX ( DXGI_FORMAT dxFormat ) <nl> return true ; <nl> } <nl> <nl> - CRPWinOutputShader * CWinRenderBufferPool : : GetShader ( SCALINGMETHOD scalingMethod ) const <nl> + CRPWinOutputShader * CWinRenderBufferPool : : GetShader ( SCALINGMETHOD scalingMethod ) const <nl> { <nl> auto it = m_outputShaders . find ( scalingMethod ) ; <nl> <nl> CRPWinOutputShader * CWinRenderBufferPool : : GetShader ( SCALINGMETHOD scalingMethod ) <nl> return nullptr ; <nl> } <nl> <nl> - const std : : vector < SCALINGMETHOD > & CWinRenderBufferPool : : GetScalingMethods ( ) <nl> + const std : : vector < SCALINGMETHOD > & CWinRenderBufferPool : : GetScalingMethods ( ) <nl> { <nl> static std : : vector < SCALINGMETHOD > scalingMethods = { <nl> - SCALINGMETHOD : : NEAREST , <nl> - SCALINGMETHOD : : LINEAR , <nl> + SCALINGMETHOD : : NEAREST , <nl> + SCALINGMETHOD : : LINEAR , <nl> } ; <nl> <nl> return scalingMethods ; <nl> void CWinRenderBufferPool : : CompileOutputShaders ( ) <nl> m_outputShaders [ scalingMethod ] = std : : move ( outputShader ) ; <nl> else <nl> CLog : : Log ( LOGERROR , " RPWinRenderer : Unable to create output shader ( % s ) " , <nl> - CRenderTranslator : : TranslateScalingMethod ( scalingMethod ) ) ; <nl> + CRenderTranslator : : TranslateScalingMethod ( scalingMethod ) ) ; <nl> } <nl> } <nl> <nl> / / mmm CRPWinRenderer mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - CRPWinRenderer : : CRPWinRenderer ( const CRenderSettings & renderSettings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) : <nl> - CRPBaseRenderer ( renderSettings , context , std : : move ( bufferPool ) ) <nl> + CRPWinRenderer : : CRPWinRenderer ( const CRenderSettings & renderSettings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) <nl> + : CRPBaseRenderer ( renderSettings , context , std : : move ( bufferPool ) ) <nl> { <nl> } <nl> <nl> bool CRPWinRenderer : : ConfigureInternal ( ) <nl> { <nl> - CRenderSystemDX * renderingDx = static_cast < CRenderSystemDX * > ( m_context . Rendering ( ) ) ; <nl> + CRenderSystemDX * renderingDx = static_cast < CRenderSystemDX * > ( m_context . Rendering ( ) ) ; <nl> <nl> DXGI_FORMAT targetDxFormat = renderingDx - > GetBackBuffer ( ) . GetFormat ( ) ; <nl> <nl> bool CRPWinRenderer : : ConfigureInternal ( ) <nl> <nl> void CRPWinRenderer : : RenderInternal ( bool clear , uint8_t alpha ) <nl> { <nl> - CRenderSystemDX * renderingDx = static_cast < CRenderSystemDX * > ( m_context . Rendering ( ) ) ; <nl> + CRenderSystemDX * renderingDx = static_cast < CRenderSystemDX * > ( m_context . Rendering ( ) ) ; <nl> <nl> / / Set alpha blend state <nl> renderingDx - > SetAlphaBlendEnable ( alpha < 0xFF ) ; <nl> void CRPWinRenderer : : RenderInternal ( bool clear , uint8_t alpha ) <nl> <nl> bool CRPWinRenderer : : Supports ( RENDERFEATURE feature ) const <nl> { <nl> - if ( feature = = RENDERFEATURE : : STRETCH | | <nl> - feature = = RENDERFEATURE : : ZOOM | | <nl> - feature = = RENDERFEATURE : : PIXEL_RATIO | | <nl> - feature = = RENDERFEATURE : : ROTATION ) <nl> + if ( feature = = RENDERFEATURE : : STRETCH | | feature = = RENDERFEATURE : : ZOOM | | <nl> + feature = = RENDERFEATURE : : PIXEL_RATIO | | feature = = RENDERFEATURE : : ROTATION ) <nl> return true ; <nl> <nl> return false ; <nl> bool CRPWinRenderer : : Supports ( RENDERFEATURE feature ) const <nl> <nl> bool CRPWinRenderer : : SupportsScalingMethod ( SCALINGMETHOD method ) <nl> { <nl> - if ( method = = SCALINGMETHOD : : LINEAR | | <nl> - method = = SCALINGMETHOD : : NEAREST ) <nl> + if ( method = = SCALINGMETHOD : : LINEAR | | method = = SCALINGMETHOD : : NEAREST ) <nl> return true ; <nl> <nl> return false ; <nl> bool CRPWinRenderer : : SupportsScalingMethod ( SCALINGMETHOD method ) <nl> <nl> void CRPWinRenderer : : Render ( CD3DTexture & target ) <nl> { <nl> - const CPoint destPoints [ 4 ] = { <nl> - m_rotatedDestCoords [ 0 ] , <nl> - m_rotatedDestCoords [ 1 ] , <nl> - m_rotatedDestCoords [ 2 ] , <nl> - m_rotatedDestCoords [ 3 ] <nl> - } ; <nl> + const CPoint destPoints [ 4 ] = { m_rotatedDestCoords [ 0 ] , m_rotatedDestCoords [ 1 ] , <nl> + m_rotatedDestCoords [ 2 ] , m_rotatedDestCoords [ 3 ] } ; <nl> <nl> if ( m_renderBuffer ! = nullptr ) <nl> { <nl> - CD3DTexture * intermediateTarget = static_cast < CWinRenderBuffer * > ( m_renderBuffer ) - > GetTarget ( ) ; <nl> + CD3DTexture * intermediateTarget = static_cast < CWinRenderBuffer * > ( m_renderBuffer ) - > GetTarget ( ) ; <nl> if ( intermediateTarget ! = nullptr ) <nl> { <nl> CRect viewPort ; <nl> void CRPWinRenderer : : Render ( CD3DTexture & target ) <nl> / / Pick appropriate output shader depending on the scaling method of the renderer <nl> SCALINGMETHOD scalingMethod = m_renderSettings . VideoSettings ( ) . GetScalingMethod ( ) ; <nl> <nl> - CWinRenderBufferPool * bufferPool = static_cast < CWinRenderBufferPool * > ( m_bufferPool . get ( ) ) ; <nl> - CRPWinOutputShader * outputShader = bufferPool - > GetShader ( scalingMethod ) ; <nl> + CWinRenderBufferPool * bufferPool = static_cast < CWinRenderBufferPool * > ( m_bufferPool . get ( ) ) ; <nl> + CRPWinOutputShader * outputShader = bufferPool - > GetShader ( scalingMethod ) ; <nl> <nl> / / Use the picked output shader to render to the target <nl> if ( outputShader ! = nullptr ) <nl> { <nl> - outputShader - > Render ( * intermediateTarget , <nl> - m_sourceRect , destPoints , viewPort , & target , <nl> - m_context . UseLimitedColor ( ) ? 1 : 0 ) ; <nl> + outputShader - > Render ( * intermediateTarget , m_sourceRect , destPoints , viewPort , & target , <nl> + m_context . UseLimitedColor ( ) ? 1 : 0 ) ; <nl> } <nl> } <nl> } <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPWinRenderer . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoRenderers / RPWinRenderer . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRenderContext ; <nl> - class CRPWinOutputShader ; <nl> + class CRenderContext ; <nl> + class CRPWinOutputShader ; <nl> <nl> - class CWinRendererFactory : public IRendererFactory <nl> - { <nl> - public : <nl> - virtual ~ CWinRendererFactory ( ) = default ; <nl> - <nl> - / / implementation of IRendererFactory <nl> - std : : string RenderSystemName ( ) const override ; <nl> - CRPBaseRenderer * CreateRenderer ( const CRenderSettings & settings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) override ; <nl> - RenderBufferPoolVector CreateBufferPools ( CRenderContext & context ) override ; <nl> - } ; <nl> - <nl> - class CWinRenderBuffer : public CRenderBufferSysMem <nl> - { <nl> - public : <nl> - CWinRenderBuffer ( AVPixelFormat pixFormat , DXGI_FORMAT dxFormat ) ; <nl> - ~ CWinRenderBuffer ( ) override = default ; <nl> - <nl> - / / implementation of IRenderBuffer via CRenderBufferSysMem <nl> - bool UploadTexture ( ) override ; <nl> - <nl> - CD3DTexture * GetTarget ( ) { return m_intermediateTarget . get ( ) ; } <nl> - <nl> - private : <nl> - bool CreateTexture ( ) ; <nl> - bool GetTexture ( uint8_t * & data , unsigned int & stride ) ; <nl> - bool ReleaseTexture ( ) ; <nl> - <nl> - bool CreateScalingContext ( ) ; <nl> - void ScalePixels ( uint8_t * source , unsigned int sourceStride , uint8_t * target , unsigned int targetStride ) ; <nl> - <nl> - static AVPixelFormat GetPixFormat ( DXGI_FORMAT dxFormat ) ; <nl> + class CWinRendererFactory : public IRendererFactory <nl> + { <nl> + public : <nl> + virtual ~ CWinRendererFactory ( ) = default ; <nl> + <nl> + / / implementation of IRendererFactory <nl> + std : : string RenderSystemName ( ) const override ; <nl> + CRPBaseRenderer * CreateRenderer ( const CRenderSettings & settings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) override ; <nl> + RenderBufferPoolVector CreateBufferPools ( CRenderContext & context ) override ; <nl> + } ; <nl> + <nl> + class CWinRenderBuffer : public CRenderBufferSysMem <nl> + { <nl> + public : <nl> + CWinRenderBuffer ( AVPixelFormat pixFormat , DXGI_FORMAT dxFormat ) ; <nl> + ~ CWinRenderBuffer ( ) override = default ; <nl> <nl> - / / Construction parameters <nl> - const AVPixelFormat m_pixFormat ; <nl> - const DXGI_FORMAT m_targetDxFormat ; <nl> + / / implementation of IRenderBuffer via CRenderBufferSysMem <nl> + bool UploadTexture ( ) override ; <nl> <nl> - AVPixelFormat m_targetPixFormat ; <nl> - std : : unique_ptr < CD3DTexture > m_intermediateTarget ; <nl> + CD3DTexture * GetTarget ( ) { return m_intermediateTarget . get ( ) ; } <nl> <nl> - SwsContext * m_swsContext = nullptr ; <nl> - } ; <nl> + private : <nl> + bool CreateTexture ( ) ; <nl> + bool GetTexture ( uint8_t * & data , unsigned int & stride ) ; <nl> + bool ReleaseTexture ( ) ; <nl> <nl> - class CWinRenderBufferPool : public CBaseRenderBufferPool <nl> - { <nl> - public : <nl> - CWinRenderBufferPool ( ) ; <nl> - ~ CWinRenderBufferPool ( ) override = default ; <nl> + bool CreateScalingContext ( ) ; <nl> + void ScalePixels ( uint8_t * source , <nl> + unsigned int sourceStride , <nl> + uint8_t * target , <nl> + unsigned int targetStride ) ; <nl> <nl> - / / implementation of IRenderBufferPool via CRenderBufferPoolSysMem <nl> - bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const override ; <nl> + static AVPixelFormat GetPixFormat ( DXGI_FORMAT dxFormat ) ; <nl> <nl> - / / implementation of CBaseRenderBufferPool via CRenderBufferPoolSysMem <nl> - IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) override ; <nl> + / / Construction parameters <nl> + const AVPixelFormat m_pixFormat ; <nl> + const DXGI_FORMAT m_targetDxFormat ; <nl> <nl> - / / DirectX interface <nl> - bool ConfigureDX ( DXGI_FORMAT dxFormat ) ; <nl> - CRPWinOutputShader * GetShader ( SCALINGMETHOD scalingMethod ) const ; <nl> + AVPixelFormat m_targetPixFormat ; <nl> + std : : unique_ptr < CD3DTexture > m_intermediateTarget ; <nl> <nl> - private : <nl> - static const std : : vector < SCALINGMETHOD > & GetScalingMethods ( ) ; <nl> + SwsContext * m_swsContext = nullptr ; <nl> + } ; <nl> <nl> - void CompileOutputShaders ( ) ; <nl> + class CWinRenderBufferPool : public CBaseRenderBufferPool <nl> + { <nl> + public : <nl> + CWinRenderBufferPool ( ) ; <nl> + ~ CWinRenderBufferPool ( ) override = default ; <nl> <nl> - DXGI_FORMAT m_targetDxFormat = DXGI_FORMAT_UNKNOWN ; <nl> - std : : map < SCALINGMETHOD , std : : unique_ptr < CRPWinOutputShader > > m_outputShaders ; <nl> - } ; <nl> + / / implementation of IRenderBufferPool via CRenderBufferPoolSysMem <nl> + bool IsCompatible ( const CRenderVideoSettings & renderSettings ) const override ; <nl> <nl> - class CRPWinRenderer : public CRPBaseRenderer <nl> - { <nl> - public : <nl> - CRPWinRenderer ( const CRenderSettings & renderSettings , CRenderContext & context , std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> - ~ CRPWinRenderer ( ) override = default ; <nl> + / / implementation of CBaseRenderBufferPool via CRenderBufferPoolSysMem <nl> + IRenderBuffer * CreateRenderBuffer ( void * header = nullptr ) override ; <nl> <nl> - / / implementation of CRPBaseRenderer <nl> - bool Supports ( RENDERFEATURE feature ) const override ; <nl> - SCALINGMETHOD GetDefaultScalingMethod ( ) const override { return DEFAULT_SCALING_METHOD ; } <nl> + / / DirectX interface <nl> + bool ConfigureDX ( DXGI_FORMAT dxFormat ) ; <nl> + CRPWinOutputShader * GetShader ( SCALINGMETHOD scalingMethod ) const ; <nl> <nl> - static bool SupportsScalingMethod ( SCALINGMETHOD method ) ; <nl> + private : <nl> + static const std : : vector < SCALINGMETHOD > & GetScalingMethods ( ) ; <nl> <nl> - / * ! <nl> - * \ brief The default scaling method of the renderer <nl> - * / <nl> - static const SCALINGMETHOD DEFAULT_SCALING_METHOD = SCALINGMETHOD : : NEAREST ; <nl> + void CompileOutputShaders ( ) ; <nl> <nl> - protected : <nl> - / / implementation of CRPBaseRenderer <nl> - bool ConfigureInternal ( ) override ; <nl> - void RenderInternal ( bool clear , uint8_t alpha ) override ; <nl> + DXGI_FORMAT m_targetDxFormat = DXGI_FORMAT_UNKNOWN ; <nl> + std : : map < SCALINGMETHOD , std : : unique_ptr < CRPWinOutputShader > > m_outputShaders ; <nl> + } ; <nl> <nl> - private : <nl> - void Render ( CD3DTexture & target ) ; <nl> - } ; <nl> - } <nl> - } <nl> + class CRPWinRenderer : public CRPBaseRenderer <nl> + { <nl> + public : <nl> + CRPWinRenderer ( const CRenderSettings & renderSettings , <nl> + CRenderContext & context , <nl> + std : : shared_ptr < IRenderBufferPool > bufferPool ) ; <nl> + ~ CRPWinRenderer ( ) override = default ; <nl> + <nl> + / / implementation of CRPBaseRenderer <nl> + bool Supports ( RENDERFEATURE feature ) const override ; <nl> + SCALINGMETHOD GetDefaultScalingMethod ( ) const override { return DEFAULT_SCALING_METHOD ; } <nl> + <nl> + static bool SupportsScalingMethod ( SCALINGMETHOD method ) ; <nl> + <nl> + / * ! <nl> + * \ brief The default scaling method of the renderer <nl> + * / <nl> + static const SCALINGMETHOD DEFAULT_SCALING_METHOD = SCALINGMETHOD : : NEAREST ; <nl> + <nl> + protected : <nl> + / / implementation of CRPBaseRenderer <nl> + bool ConfigureInternal ( ) override ; <nl> + void RenderInternal ( bool clear , uint8_t alpha ) override ; <nl> + <nl> + private : <nl> + void Render ( CD3DTexture & target ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoShaders / windows / RPWinOutputShader . cpp <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoShaders / windows / RPWinOutputShader . cpp <nl> bool CRPWinOutputShader : : Create ( SCALINGMETHOD scalingMethod ) <nl> DefinesMap defines ; <nl> switch ( scalingMethod ) <nl> { <nl> - case SCALINGMETHOD : : NEAREST : <nl> - defines [ " SAMP_NEAREST " ] = " " ; <nl> - break ; <nl> - case SCALINGMETHOD : : LINEAR : <nl> - default : <nl> - break ; <nl> + case SCALINGMETHOD : : NEAREST : <nl> + defines [ " SAMP_NEAREST " ] = " " ; <nl> + break ; <nl> + case SCALINGMETHOD : : LINEAR : <nl> + default : <nl> + break ; <nl> } <nl> <nl> std : : string effectPath ( " special : / / xbmc / system / shaders / rp_output_d3d . fx " ) ; <nl> bool CRPWinOutputShader : : Create ( SCALINGMETHOD scalingMethod ) <nl> } <nl> <nl> / / Create input layout <nl> - D3D11_INPUT_ELEMENT_DESC layout [ ] = <nl> - { <nl> - { " POSITION " , 0 , DXGI_FORMAT_R32G32B32_FLOAT , 0 , 0 , D3D11_INPUT_PER_VERTEX_DATA , 0 } , <nl> - { " TEXCOORD " , 0 , DXGI_FORMAT_R32G32_FLOAT , 0 , 12 , D3D11_INPUT_PER_VERTEX_DATA , 0 } , <nl> + D3D11_INPUT_ELEMENT_DESC layout [ ] = { <nl> + { " POSITION " , 0 , DXGI_FORMAT_R32G32B32_FLOAT , 0 , 0 , D3D11_INPUT_PER_VERTEX_DATA , 0 } , <nl> + { " TEXCOORD " , 0 , DXGI_FORMAT_R32G32_FLOAT , 0 , 12 , D3D11_INPUT_PER_VERTEX_DATA , 0 } , <nl> } ; <nl> return CWinShader : : CreateInputLayout ( layout , ARRAYSIZE ( layout ) ) ; <nl> } <nl> <nl> - void CRPWinOutputShader : : Render ( CD3DTexture & sourceTexture , CRect sourceRect , const CPoint points [ 4 ] <nl> - , CRect & viewPort , CD3DTexture * target , unsigned range ) <nl> + void CRPWinOutputShader : : Render ( CD3DTexture & sourceTexture , <nl> + CRect sourceRect , <nl> + const CPoint points [ 4 ] , <nl> + CRect & viewPort , <nl> + CD3DTexture * target , <nl> + unsigned range ) <nl> { <nl> PrepareParameters ( sourceTexture . GetWidth ( ) , sourceTexture . GetHeight ( ) , sourceRect , points ) ; <nl> SetShaderParameters ( sourceTexture , range , viewPort ) ; <nl> - Execute ( { target } , 4 ) ; <nl> + Execute ( { target } , 4 ) ; <nl> } <nl> <nl> - void CRPWinOutputShader : : PrepareParameters ( unsigned sourceWidth , unsigned sourceHeight , CRect sourceRect , const CPoint points [ 4 ] ) <nl> + void CRPWinOutputShader : : PrepareParameters ( unsigned sourceWidth , <nl> + unsigned sourceHeight , <nl> + CRect sourceRect , <nl> + const CPoint points [ 4 ] ) <nl> { <nl> bool changed = false ; <nl> for ( int i = 0 ; i < 4 & & ! changed ; + + i ) <nl> changed = points [ i ] ! = m_destPoints [ i ] ; <nl> <nl> - if ( m_sourceWidth ! = sourceWidth | | <nl> - m_sourceHeight ! = sourceHeight | | <nl> - m_sourceRect ! = sourceRect | | <nl> - changed ) <nl> + if ( m_sourceWidth ! = sourceWidth | | m_sourceHeight ! = sourceHeight | | <nl> + m_sourceRect ! = sourceRect | | changed ) <nl> { <nl> m_sourceWidth = sourceWidth ; <nl> m_sourceHeight = sourceHeight ; <nl> void CRPWinOutputShader : : PrepareParameters ( unsigned sourceWidth , unsigned source <nl> } <nl> } <nl> <nl> - void CRPWinOutputShader : : SetShaderParameters ( CD3DTexture & sourceTexture , unsigned range , CRect & viewPort ) <nl> + void CRPWinOutputShader : : SetShaderParameters ( CD3DTexture & sourceTexture , <nl> + unsigned range , <nl> + CRect & viewPort ) <nl> { <nl> m_effect . SetTechnique ( " OUTPUT_T " ) ; <nl> m_effect . SetResources ( " g_Texture " , sourceTexture . GetAddressOfSRV ( ) , 1 ) ; <nl> <nl> - float viewPortArray [ 2 ] = { viewPort . Width ( ) , viewPort . Height ( ) } ; <nl> + float viewPortArray [ 2 ] = { viewPort . Width ( ) , viewPort . Height ( ) } ; <nl> m_effect . SetFloatArray ( " g_viewPort " , viewPortArray , 2 ) ; <nl> <nl> - float params [ 3 ] = { static_cast < float > ( range ) } ; <nl> + float params [ 3 ] = { static_cast < float > ( range ) } ; <nl> m_effect . SetFloatArray ( " m_params " , params , 1 ) ; <nl> } <nl> mmm a / xbmc / cores / RetroPlayer / rendering / VideoShaders / windows / RPWinOutputShader . h <nl> ppp b / xbmc / cores / RetroPlayer / rendering / VideoShaders / windows / RPWinOutputShader . h <nl> class CRPWinOutputShader : public CWinShader <nl> ~ CRPWinOutputShader ( ) = default ; <nl> <nl> bool Create ( SCALINGMETHOD scalingMethod ) ; <nl> - void Render ( CD3DTexture & sourceTexture , CRect sourceRect , const CPoint points [ 4 ] <nl> - , CRect & viewPort , CD3DTexture * target , unsigned range = 0 ) ; <nl> + void Render ( CD3DTexture & sourceTexture , <nl> + CRect sourceRect , <nl> + const CPoint points [ 4 ] , <nl> + CRect & viewPort , <nl> + CD3DTexture * target , <nl> + unsigned range = 0 ) ; <nl> <nl> private : <nl> - void PrepareParameters ( unsigned sourceWidth , unsigned sourceHeight , CRect sourceRect , const CPoint points [ 4 ] ) ; <nl> - void SetShaderParameters ( CD3DTexture & sourceTexture , unsigned range , CRect & viewPort ) ; <nl> - <nl> - unsigned m_sourceWidth { 0 } ; <nl> - unsigned m_sourceHeight { 0 } ; <nl> - CRect m_sourceRect { 0 . f , 0 . f , 0 . f , 0 . f } ; <nl> - CPoint m_destPoints [ 4 ] = <nl> - { <nl> - { 0 . f , 0 . f } , <nl> - { 0 . f , 0 . f } , <nl> - { 0 . f , 0 . f } , <nl> - { 0 . f , 0 . f } , <nl> + void PrepareParameters ( unsigned sourceWidth , <nl> + unsigned sourceHeight , <nl> + CRect sourceRect , <nl> + const CPoint points [ 4 ] ) ; <nl> + void SetShaderParameters ( CD3DTexture & sourceTexture , unsigned range , CRect & viewPort ) ; <nl> + <nl> + unsigned m_sourceWidth { 0 } ; <nl> + unsigned m_sourceHeight { 0 } ; <nl> + CRect m_sourceRect { 0 . f , 0 . f , 0 . f , 0 . f } ; <nl> + CPoint m_destPoints [ 4 ] = { <nl> + { 0 . f , 0 . f } , <nl> + { 0 . f , 0 . f } , <nl> + { 0 . f , 0 . f } , <nl> + { 0 . f , 0 . f } , <nl> } ; <nl> <nl> - struct CUSTOMVERTEX { <nl> + struct CUSTOMVERTEX <nl> + { <nl> FLOAT x ; <nl> FLOAT y ; <nl> FLOAT z ; <nl> mmm a / xbmc / cores / RetroPlayer / savestates / ISavestate . h <nl> ppp b / xbmc / cores / RetroPlayer / savestates / ISavestate . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class ISavestate <nl> - { <nl> - public : <nl> - virtual ~ ISavestate ( ) = default ; <nl> - <nl> - / * ! <nl> - * \ brief Reset to the initial state <nl> - * / <nl> - virtual void Reset ( ) = 0 ; <nl> - <nl> - / * ! <nl> - * Access the data representation of this savestate <nl> - * / <nl> - virtual bool Serialize ( const uint8_t * & data , size_t & size ) const = 0 ; <nl> - <nl> - / / / @ name Savestate properties <nl> - / / / { <nl> - / * ! <nl> - * \ brief The type of save action that created this savestate , either <nl> - * manual or automatic <nl> - * / <nl> - virtual SAVE_TYPE Type ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief The slot this savestate was saved into , or 0 for no slot <nl> - * <nl> - * This allows for keyboard access of saved games using the number keys 1 - 9 . <nl> - * / <nl> - virtual uint8_t Slot ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief The label shown in the GUI for this savestate <nl> - * / <nl> - virtual std : : string Label ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief The timestamp of this savestate ' s creation <nl> - * / <nl> - virtual CDateTime Created ( ) const = 0 ; <nl> - / / / } <nl> - <nl> - / / / @ name Game properties <nl> - / / / { <nl> - / * ! <nl> - * \ brief The name of the file beloning to this savestate ' s game <nl> - * / <nl> - virtual std : : string GameFileName ( ) const = 0 ; <nl> - / / / } <nl> - <nl> - / / / @ name Environment properties <nl> - / / / { <nl> - / * ! <nl> - * \ brief The number of frames in the entire gameplay history <nl> - * / <nl> - virtual uint64_t TimestampFrames ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief The duration of the entire gameplay history as seen by a wall clock <nl> - * / <nl> - virtual double TimestampWallClock ( ) const = 0 ; <nl> - / / / } <nl> - <nl> - / / / @ name Game client properties <nl> - / / / { <nl> - / * ! <nl> - * \ brief The game client add - on ID that created this savestate <nl> - * / <nl> - virtual std : : string GameClientID ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief The semantic version of the game client <nl> - * / <nl> - virtual std : : string GameClientVersion ( ) const = 0 ; <nl> - / / / } <nl> - <nl> - / / / @ name Memory properties <nl> - / / / { <nl> - / * ! <nl> - * \ brief A pointer to the internal memory ( SRAM ) of the frame <nl> - * / <nl> - virtual const uint8_t * GetMemoryData ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief The size of the memory region returned by GetMemoryData ( ) <nl> - * / <nl> - virtual size_t GetMemorySize ( ) const = 0 ; <nl> - / / / } <nl> - <nl> - / / Build flatbuffer by setting individual fields <nl> - virtual void SetType ( SAVE_TYPE type ) = 0 ; <nl> - virtual void SetSlot ( uint8_t slot ) = 0 ; <nl> - virtual void SetLabel ( const std : : string & label ) = 0 ; <nl> - virtual void SetCreated ( const CDateTime & created ) = 0 ; <nl> - virtual void SetGameFileName ( const std : : string & gameFileName ) = 0 ; <nl> - virtual void SetTimestampFrames ( uint64_t timestampFrames ) = 0 ; <nl> - virtual void SetTimestampWallClock ( double timestampWallClock ) = 0 ; <nl> - virtual void SetGameClientID ( const std : : string & gameClient ) = 0 ; <nl> - virtual void SetGameClientVersion ( const std : : string & gameClient ) = 0 ; <nl> - virtual uint8_t * GetMemoryBuffer ( size_t size ) = 0 ; <nl> - virtual void Finalize ( ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Take ownership and initialize the flatbuffer with the given vector <nl> - * / <nl> - virtual bool Deserialize ( std : : vector < uint8_t > data ) = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + class ISavestate <nl> + { <nl> + public : <nl> + virtual ~ ISavestate ( ) = default ; <nl> + <nl> + / * ! <nl> + * \ brief Reset to the initial state <nl> + * / <nl> + virtual void Reset ( ) = 0 ; <nl> + <nl> + / * ! <nl> + * Access the data representation of this savestate <nl> + * / <nl> + virtual bool Serialize ( const uint8_t * & data , size_t & size ) const = 0 ; <nl> + <nl> + / / / @ name Savestate properties <nl> + / / / { <nl> + / * ! <nl> + * \ brief The type of save action that created this savestate , either <nl> + * manual or automatic <nl> + * / <nl> + virtual SAVE_TYPE Type ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief The slot this savestate was saved into , or 0 for no slot <nl> + * <nl> + * This allows for keyboard access of saved games using the number keys 1 - 9 . <nl> + * / <nl> + virtual uint8_t Slot ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief The label shown in the GUI for this savestate <nl> + * / <nl> + virtual std : : string Label ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief The timestamp of this savestate ' s creation <nl> + * / <nl> + virtual CDateTime Created ( ) const = 0 ; <nl> + / / / } <nl> + <nl> + / / / @ name Game properties <nl> + / / / { <nl> + / * ! <nl> + * \ brief The name of the file beloning to this savestate ' s game <nl> + * / <nl> + virtual std : : string GameFileName ( ) const = 0 ; <nl> + / / / } <nl> + <nl> + / / / @ name Environment properties <nl> + / / / { <nl> + / * ! <nl> + * \ brief The number of frames in the entire gameplay history <nl> + * / <nl> + virtual uint64_t TimestampFrames ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief The duration of the entire gameplay history as seen by a wall clock <nl> + * / <nl> + virtual double TimestampWallClock ( ) const = 0 ; <nl> + / / / } <nl> + <nl> + / / / @ name Game client properties <nl> + / / / { <nl> + / * ! <nl> + * \ brief The game client add - on ID that created this savestate <nl> + * / <nl> + virtual std : : string GameClientID ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief The semantic version of the game client <nl> + * / <nl> + virtual std : : string GameClientVersion ( ) const = 0 ; <nl> + / / / } <nl> + <nl> + / / / @ name Memory properties <nl> + / / / { <nl> + / * ! <nl> + * \ brief A pointer to the internal memory ( SRAM ) of the frame <nl> + * / <nl> + virtual const uint8_t * GetMemoryData ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief The size of the memory region returned by GetMemoryData ( ) <nl> + * / <nl> + virtual size_t GetMemorySize ( ) const = 0 ; <nl> + / / / } <nl> + <nl> + / / Build flatbuffer by setting individual fields <nl> + virtual void SetType ( SAVE_TYPE type ) = 0 ; <nl> + virtual void SetSlot ( uint8_t slot ) = 0 ; <nl> + virtual void SetLabel ( const std : : string & label ) = 0 ; <nl> + virtual void SetCreated ( const CDateTime & created ) = 0 ; <nl> + virtual void SetGameFileName ( const std : : string & gameFileName ) = 0 ; <nl> + virtual void SetTimestampFrames ( uint64_t timestampFrames ) = 0 ; <nl> + virtual void SetTimestampWallClock ( double timestampWallClock ) = 0 ; <nl> + virtual void SetGameClientID ( const std : : string & gameClient ) = 0 ; <nl> + virtual void SetGameClientVersion ( const std : : string & gameClient ) = 0 ; <nl> + virtual uint8_t * GetMemoryBuffer ( size_t size ) = 0 ; <nl> + virtual void Finalize ( ) = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Take ownership and initialize the flatbuffer with the given vector <nl> + * / <nl> + virtual bool Deserialize ( std : : vector < uint8_t > data ) = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / savestates / SavestateDatabase . cpp <nl> ppp b / xbmc / cores / RetroPlayer / savestates / SavestateDatabase . cpp <nl> std : : unique_ptr < ISavestate > CSavestateDatabase : : CreateSavestate ( ) <nl> return savestate ; <nl> } <nl> <nl> - bool CSavestateDatabase : : AddSavestate ( const std : : string & gamePath , const ISavestate & save ) <nl> + bool CSavestateDatabase : : AddSavestate ( const std : : string & gamePath , const ISavestate & save ) <nl> { <nl> bool bSuccess = false ; <nl> <nl> bool CSavestateDatabase : : AddSavestate ( const std : : string & gamePath , const ISavest <nl> <nl> CLog : : Log ( LOGDEBUG , " Saving savestate to % s " , CURL : : GetRedacted ( savestatePath ) . c_str ( ) ) ; <nl> <nl> - const uint8_t * data = nullptr ; <nl> + const uint8_t * data = nullptr ; <nl> size_t size = 0 ; <nl> if ( save . Serialize ( data , size ) ) <nl> { <nl> bool CSavestateDatabase : : GetSavestate ( const std : : string & gamePath , ISavestate & s <nl> if ( readLength ! = static_cast < ssize_t > ( savestateData . size ( ) ) ) <nl> { <nl> CLog : : Log ( LOGERROR , " Failed to read savestate % s of size % d bytes " , <nl> - CURL : : GetRedacted ( savestatePath ) . c_str ( ) , <nl> - size ) ; <nl> + CURL : : GetRedacted ( savestatePath ) . c_str ( ) , size ) ; <nl> savestateData . clear ( ) ; <nl> } <nl> } <nl> else <nl> - CLog : : Log ( LOGERROR , " Failed to get savestate length : % s " , CURL : : GetRedacted ( savestatePath ) . c_str ( ) ) ; <nl> + CLog : : Log ( LOGERROR , " Failed to get savestate length : % s " , <nl> + CURL : : GetRedacted ( savestatePath ) . c_str ( ) ) ; <nl> } <nl> else <nl> - CLog : : Log ( LOGERROR , " Failed to open savestate file % s " , CURL : : GetRedacted ( savestatePath ) . c_str ( ) ) ; <nl> + CLog : : Log ( LOGERROR , " Failed to open savestate file % s " , <nl> + CURL : : GetRedacted ( savestatePath ) . c_str ( ) ) ; <nl> <nl> if ( ! savestateData . empty ( ) ) <nl> bSuccess = save . Deserialize ( std : : move ( savestateData ) ) ; <nl> bool CSavestateDatabase : : GetSavestate ( const std : : string & gamePath , ISavestate & s <nl> return bSuccess ; <nl> } <nl> <nl> - bool CSavestateDatabase : : GetSavestatesNav ( CFileItemList & items , const std : : string & gamePath , const std : : string & gameClient / * = " " * / ) <nl> + bool CSavestateDatabase : : GetSavestatesNav ( CFileItemList & items , <nl> + const std : : string & gamePath , <nl> + const std : : string & gameClient / * = " " * / ) <nl> { <nl> / / ! @ todo <nl> return false ; <nl> bool CSavestateDatabase : : DeleteSavestate ( const std : : string & path ) <nl> return false ; <nl> } <nl> <nl> - bool CSavestateDatabase : : ClearSavestatesOfGame ( const std : : string & gamePath , const std : : string & gameClient / * = " " * / ) <nl> + bool CSavestateDatabase : : ClearSavestatesOfGame ( const std : : string & gamePath , <nl> + const std : : string & gameClient / * = " " * / ) <nl> { <nl> / / ! @ todo <nl> return false ; <nl> mmm a / xbmc / cores / RetroPlayer / savestates / SavestateDatabase . h <nl> ppp b / xbmc / cores / RetroPlayer / savestates / SavestateDatabase . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class ISavestate ; <nl> + class ISavestate ; <nl> <nl> - class CSavestateDatabase <nl> - { <nl> - public : <nl> - CSavestateDatabase ( ) ; <nl> - virtual ~ CSavestateDatabase ( ) = default ; <nl> + class CSavestateDatabase <nl> + { <nl> + public : <nl> + CSavestateDatabase ( ) ; <nl> + virtual ~ CSavestateDatabase ( ) = default ; <nl> <nl> - std : : unique_ptr < ISavestate > CreateSavestate ( ) ; <nl> + std : : unique_ptr < ISavestate > CreateSavestate ( ) ; <nl> <nl> - bool AddSavestate ( const std : : string & gamePath , const ISavestate & save ) ; <nl> + bool AddSavestate ( const std : : string & gamePath , const ISavestate & save ) ; <nl> <nl> - bool GetSavestate ( const std : : string & gamePath , ISavestate & save ) ; <nl> + bool GetSavestate ( const std : : string & gamePath , ISavestate & save ) ; <nl> <nl> - bool GetSavestatesNav ( CFileItemList & items , const std : : string & gamePath , const std : : string & gameClient = " " ) ; <nl> + bool GetSavestatesNav ( CFileItemList & items , <nl> + const std : : string & gamePath , <nl> + const std : : string & gameClient = " " ) ; <nl> <nl> - bool RenameSavestate ( const std : : string & path , const std : : string & label ) ; <nl> + bool RenameSavestate ( const std : : string & path , const std : : string & label ) ; <nl> <nl> - bool DeleteSavestate ( const std : : string & path ) ; <nl> + bool DeleteSavestate ( const std : : string & path ) ; <nl> <nl> - bool ClearSavestatesOfGame ( const std : : string & gamePath , const std : : string & gameClient = " " ) ; <nl> - } ; <nl> - } <nl> - } <nl> + bool ClearSavestatesOfGame ( const std : : string & gamePath , const std : : string & gameClient = " " ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / savestates / SavestateFlatBuffer . cpp <nl> ppp b / xbmc / cores / RetroPlayer / savestates / SavestateFlatBuffer . cpp <nl> using namespace RETRO ; <nl> <nl> namespace <nl> { <nl> - const uint8_t SCHEMA_VERSION = 1 ; <nl> - <nl> - / * ! <nl> - * \ brief The initial size of the FlatBuffer ' s memory buffer <nl> - * <nl> - * 1024 is the default size in the FlatBuffers header . We might as well use <nl> - * this until our size requirements are more known . <nl> - * / <nl> - const size_t INITIAL_FLATBUFFER_SIZE = 1024 ; <nl> - <nl> - / * ! <nl> - * \ brief Translate the save type ( RetroPlayer to FlatBuffers ) <nl> - * / <nl> - SaveType TranslateType ( SAVE_TYPE type ) <nl> + const uint8_t SCHEMA_VERSION = 1 ; <nl> + <nl> + / * ! <nl> + * \ brief The initial size of the FlatBuffer ' s memory buffer <nl> + * <nl> + * 1024 is the default size in the FlatBuffers header . We might as well use <nl> + * this until our size requirements are more known . <nl> + * / <nl> + const size_t INITIAL_FLATBUFFER_SIZE = 1024 ; <nl> + <nl> + / * ! <nl> + * \ brief Translate the save type ( RetroPlayer to FlatBuffers ) <nl> + * / <nl> + SaveType TranslateType ( SAVE_TYPE type ) <nl> + { <nl> + switch ( type ) <nl> { <nl> - switch ( type ) <nl> - { <nl> case SAVE_TYPE : : AUTO : <nl> return SaveType_Auto ; <nl> case SAVE_TYPE : : MANUAL : <nl> return SaveType_Manual ; <nl> default : <nl> break ; <nl> - } <nl> - <nl> - return SaveType_Unknown ; <nl> } <nl> <nl> - / * ! <nl> - * \ brief Translate the save type ( FlatBuffers to RetroPlayer ) <nl> - * / <nl> - SAVE_TYPE TranslateType ( SaveType type ) <nl> + return SaveType_Unknown ; <nl> + } <nl> + <nl> + / * ! <nl> + * \ brief Translate the save type ( FlatBuffers to RetroPlayer ) <nl> + * / <nl> + SAVE_TYPE TranslateType ( SaveType type ) <nl> + { <nl> + switch ( type ) <nl> { <nl> - switch ( type ) <nl> - { <nl> case SaveType_Auto : <nl> return SAVE_TYPE : : AUTO ; <nl> case SaveType_Manual : <nl> return SAVE_TYPE : : MANUAL ; <nl> default : <nl> break ; <nl> - } <nl> - <nl> - return SAVE_TYPE : : UNKNOWN ; <nl> } <nl> + <nl> + return SAVE_TYPE : : UNKNOWN ; <nl> } <nl> + } / / namespace <nl> <nl> CSavestateFlatBuffer : : CSavestateFlatBuffer ( ) <nl> { <nl> void CSavestateFlatBuffer : : Reset ( ) <nl> m_savestate = nullptr ; <nl> } <nl> <nl> - bool CSavestateFlatBuffer : : Serialize ( const uint8_t * & data , size_t & size ) const <nl> + bool CSavestateFlatBuffer : : Serialize ( const uint8_t * & data , size_t & size ) const <nl> { <nl> / / Check if savestate was deserialized from vector or built with FlatBuffers <nl> if ( ! m_data . empty ( ) ) <nl> std : : string CSavestateFlatBuffer : : Label ( ) const <nl> return label ; <nl> } <nl> <nl> - void CSavestateFlatBuffer : : SetLabel ( const std : : string & label ) <nl> + void CSavestateFlatBuffer : : SetLabel ( const std : : string & label ) <nl> { <nl> - m_labelOffset . reset ( new StringOffset { m_builder - > CreateString ( label ) } ) ; <nl> + m_labelOffset . reset ( new StringOffset { m_builder - > CreateString ( label ) } ) ; <nl> } <nl> <nl> CDateTime CSavestateFlatBuffer : : Created ( ) const <nl> CDateTime CSavestateFlatBuffer : : Created ( ) const <nl> return created ; <nl> } <nl> <nl> - void CSavestateFlatBuffer : : SetCreated ( const CDateTime & created ) <nl> + void CSavestateFlatBuffer : : SetCreated ( const CDateTime & created ) <nl> { <nl> - m_createdOffset . reset ( new StringOffset { m_builder - > CreateString ( created . GetAsRFC1123DateTime ( ) ) } ) ; <nl> + m_createdOffset . reset ( new StringOffset { m_builder - > CreateString ( created . GetAsRFC1123DateTime ( ) ) } ) ; <nl> } <nl> <nl> std : : string CSavestateFlatBuffer : : GameFileName ( ) const <nl> std : : string CSavestateFlatBuffer : : GameFileName ( ) const <nl> return gameFileName ; <nl> } <nl> <nl> - void CSavestateFlatBuffer : : SetGameFileName ( const std : : string & gameFileName ) <nl> + void CSavestateFlatBuffer : : SetGameFileName ( const std : : string & gameFileName ) <nl> { <nl> - m_gameFileNameOffset . reset ( new StringOffset { m_builder - > CreateString ( gameFileName ) } ) ; <nl> + m_gameFileNameOffset . reset ( new StringOffset { m_builder - > CreateString ( gameFileName ) } ) ; <nl> } <nl> <nl> uint64_t CSavestateFlatBuffer : : TimestampFrames ( ) const <nl> std : : string CSavestateFlatBuffer : : GameClientID ( ) const <nl> return gameClientId ; <nl> } <nl> <nl> - void CSavestateFlatBuffer : : SetGameClientID ( const std : : string & gameClientId ) <nl> + void CSavestateFlatBuffer : : SetGameClientID ( const std : : string & gameClientId ) <nl> { <nl> - m_emulatorAddonIdOffset . reset ( new StringOffset { m_builder - > CreateString ( gameClientId ) } ) ; <nl> + m_emulatorAddonIdOffset . reset ( new StringOffset { m_builder - > CreateString ( gameClientId ) } ) ; <nl> } <nl> <nl> std : : string CSavestateFlatBuffer : : GameClientVersion ( ) const <nl> std : : string CSavestateFlatBuffer : : GameClientVersion ( ) const <nl> return gameClientVersion ; <nl> } <nl> <nl> - void CSavestateFlatBuffer : : SetGameClientVersion ( const std : : string & gameClientVersion ) <nl> + void CSavestateFlatBuffer : : SetGameClientVersion ( const std : : string & gameClientVersion ) <nl> { <nl> - m_emulatorVersionOffset . reset ( new StringOffset { m_builder - > CreateString ( gameClientVersion ) } ) ; <nl> + m_emulatorVersionOffset . reset ( new StringOffset { m_builder - > CreateString ( gameClientVersion ) } ) ; <nl> } <nl> <nl> - const uint8_t * CSavestateFlatBuffer : : GetMemoryData ( ) const <nl> + const uint8_t * CSavestateFlatBuffer : : GetMemoryData ( ) const <nl> { <nl> if ( m_savestate ! = nullptr & & m_savestate - > memory_data ( ) ) <nl> return m_savestate - > memory_data ( ) - > data ( ) ; <nl> size_t CSavestateFlatBuffer : : GetMemorySize ( ) const <nl> return 0 ; <nl> } <nl> <nl> - uint8_t * CSavestateFlatBuffer : : GetMemoryBuffer ( size_t size ) <nl> + uint8_t * CSavestateFlatBuffer : : GetMemoryBuffer ( size_t size ) <nl> { <nl> - uint8_t * memoryBuffer = nullptr ; <nl> + uint8_t * memoryBuffer = nullptr ; <nl> <nl> - m_memoryDataOffset . reset ( new VectorOffset { m_builder - > CreateUninitializedVector ( size , & memoryBuffer ) } ) ; <nl> + m_memoryDataOffset . reset ( <nl> + new VectorOffset { m_builder - > CreateUninitializedVector ( size , & memoryBuffer ) } ) ; <nl> <nl> return memoryBuffer ; <nl> } <nl> void CSavestateFlatBuffer : : Finalize ( ) <nl> <nl> savestateBuilder . add_timestamp_frames ( m_timestampFrames ) ; <nl> <nl> - const uint64_t wallClockNs = static_cast < uint64_t > ( m_timestampWallClock * 1000 . 0 * 1000 . 0 * 1000 . 0 ) ; <nl> + const uint64_t wallClockNs = <nl> + static_cast < uint64_t > ( m_timestampWallClock * 1000 . 0 * 1000 . 0 * 1000 . 0 ) ; <nl> savestateBuilder . add_timestamp_wall_clock_ns ( wallClockNs ) ; <nl> <nl> if ( m_emulatorAddonIdOffset ) <nl> bool CSavestateFlatBuffer : : Deserialize ( std : : vector < uint8_t > data ) <nl> flatbuffers : : Verifier verifier ( data . data ( ) , data . size ( ) ) ; <nl> if ( VerifySavestateBuffer ( verifier ) ) <nl> { <nl> - const Savestate * savestate = GetSavestate ( data . data ( ) ) ; <nl> + const Savestate * savestate = GetSavestate ( data . data ( ) ) ; <nl> <nl> if ( savestate - > version ( ) ! = SCHEMA_VERSION ) <nl> { <nl> CLog : : Log ( LOGERROR , " RetroPlayer [ SAVE ) : Schema version % u not supported , must be version % u " , <nl> - savestate - > version ( ) , <nl> - SCHEMA_VERSION ) ; <nl> + savestate - > version ( ) , SCHEMA_VERSION ) ; <nl> } <nl> else <nl> { <nl> mmm a / xbmc / cores / RetroPlayer / savestates / SavestateFlatBuffer . h <nl> ppp b / xbmc / cores / RetroPlayer / savestates / SavestateFlatBuffer . h <nl> <nl> <nl> namespace flatbuffers <nl> { <nl> - class FlatBufferBuilder ; <nl> + class FlatBufferBuilder ; <nl> } <nl> <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - struct Savestate ; <nl> - struct SavestateBuilder ; <nl> + struct Savestate ; <nl> + struct SavestateBuilder ; <nl> <nl> - class CSavestateFlatBuffer : public ISavestate <nl> - { <nl> - public : <nl> - CSavestateFlatBuffer ( ) ; <nl> - ~ CSavestateFlatBuffer ( ) override ; <nl> + class CSavestateFlatBuffer : public ISavestate <nl> + { <nl> + public : <nl> + CSavestateFlatBuffer ( ) ; <nl> + ~ CSavestateFlatBuffer ( ) override ; <nl> <nl> - / / Implementation of ISavestate <nl> - void Reset ( ) override ; <nl> - bool Serialize ( const uint8_t * & data , size_t & size ) const override ; <nl> - SAVE_TYPE Type ( ) const override ; <nl> - uint8_t Slot ( ) const override ; <nl> - std : : string Label ( ) const override ; <nl> - CDateTime Created ( ) const override ; <nl> - std : : string GameFileName ( ) const override ; <nl> - uint64_t TimestampFrames ( ) const override ; <nl> - double TimestampWallClock ( ) const override ; <nl> - std : : string GameClientID ( ) const override ; <nl> - std : : string GameClientVersion ( ) const override ; <nl> - const uint8_t * GetMemoryData ( ) const override ; <nl> - size_t GetMemorySize ( ) const override ; <nl> - void SetType ( SAVE_TYPE type ) override ; <nl> - void SetSlot ( uint8_t slot ) override ; <nl> - void SetLabel ( const std : : string & label ) override ; <nl> - void SetCreated ( const CDateTime & created ) override ; <nl> - void SetGameFileName ( const std : : string & gameFileName ) override ; <nl> - void SetTimestampFrames ( uint64_t timestampFrames ) override ; <nl> - void SetTimestampWallClock ( double timestampWallClock ) override ; <nl> - void SetGameClientID ( const std : : string & gameClient ) override ; <nl> - void SetGameClientVersion ( const std : : string & gameClient ) override ; <nl> - uint8_t * GetMemoryBuffer ( size_t size ) override ; <nl> - void Finalize ( ) override ; <nl> - bool Deserialize ( std : : vector < uint8_t > data ) override ; <nl> + / / Implementation of ISavestate <nl> + void Reset ( ) override ; <nl> + bool Serialize ( const uint8_t * & data , size_t & size ) const override ; <nl> + SAVE_TYPE Type ( ) const override ; <nl> + uint8_t Slot ( ) const override ; <nl> + std : : string Label ( ) const override ; <nl> + CDateTime Created ( ) const override ; <nl> + std : : string GameFileName ( ) const override ; <nl> + uint64_t TimestampFrames ( ) const override ; <nl> + double TimestampWallClock ( ) const override ; <nl> + std : : string GameClientID ( ) const override ; <nl> + std : : string GameClientVersion ( ) const override ; <nl> + const uint8_t * GetMemoryData ( ) const override ; <nl> + size_t GetMemorySize ( ) const override ; <nl> + void SetType ( SAVE_TYPE type ) override ; <nl> + void SetSlot ( uint8_t slot ) override ; <nl> + void SetLabel ( const std : : string & label ) override ; <nl> + void SetCreated ( const CDateTime & created ) override ; <nl> + void SetGameFileName ( const std : : string & gameFileName ) override ; <nl> + void SetTimestampFrames ( uint64_t timestampFrames ) override ; <nl> + void SetTimestampWallClock ( double timestampWallClock ) override ; <nl> + void SetGameClientID ( const std : : string & gameClient ) override ; <nl> + void SetGameClientVersion ( const std : : string & gameClient ) override ; <nl> + uint8_t * GetMemoryBuffer ( size_t size ) override ; <nl> + void Finalize ( ) override ; <nl> + bool Deserialize ( std : : vector < uint8_t > data ) override ; <nl> <nl> - private : <nl> - / * ! <nl> - * \ brief Helper class to hold data needed in creation of a FlatBuffer <nl> - * <nl> - * The builder is used when deserializing from individual fields . <nl> - * / <nl> - std : : unique_ptr < flatbuffers : : FlatBufferBuilder > m_builder ; <nl> + private : <nl> + / * ! <nl> + * \ brief Helper class to hold data needed in creation of a FlatBuffer <nl> + * <nl> + * The builder is used when deserializing from individual fields . <nl> + * / <nl> + std : : unique_ptr < flatbuffers : : FlatBufferBuilder > m_builder ; <nl> <nl> - / * ! <nl> - * \ brief System memory storage ( for deserializing savestates ) <nl> - * <nl> - * This memory is used when deserializing from a vector . <nl> - * / <nl> - std : : vector < uint8_t > m_data ; <nl> + / * ! <nl> + * \ brief System memory storage ( for deserializing savestates ) <nl> + * <nl> + * This memory is used when deserializing from a vector . <nl> + * / <nl> + std : : vector < uint8_t > m_data ; <nl> <nl> - / * ! <nl> - * \ brief FlatBuffer struct used for accessing data <nl> - * / <nl> - const Savestate * m_savestate = nullptr ; <nl> + / * ! <nl> + * \ brief FlatBuffer struct used for accessing data <nl> + * / <nl> + const Savestate * m_savestate = nullptr ; <nl> <nl> - using StringOffset = flatbuffers : : Offset < flatbuffers : : String > ; <nl> - using VectorOffset = flatbuffers : : Offset < flatbuffers : : Vector < uint8_t > > ; <nl> + using StringOffset = flatbuffers : : Offset < flatbuffers : : String > ; <nl> + using VectorOffset = flatbuffers : : Offset < flatbuffers : : Vector < uint8_t > > ; <nl> <nl> - / / Temporary deserialization variables <nl> - SAVE_TYPE m_type = SAVE_TYPE : : UNKNOWN ; <nl> - uint8_t m_slot = 0 ; <nl> - std : : unique_ptr < StringOffset > m_labelOffset ; <nl> - std : : unique_ptr < StringOffset > m_createdOffset ; <nl> - std : : unique_ptr < StringOffset > m_gameFileNameOffset ; <nl> - uint64_t m_timestampFrames = 0 ; <nl> - double m_timestampWallClock = 0 . 0 ; <nl> - std : : unique_ptr < StringOffset > m_emulatorAddonIdOffset ; <nl> - std : : unique_ptr < StringOffset > m_emulatorVersionOffset ; <nl> - std : : unique_ptr < VectorOffset > m_memoryDataOffset ; <nl> - } ; <nl> - } <nl> - } <nl> + / / Temporary deserialization variables <nl> + SAVE_TYPE m_type = SAVE_TYPE : : UNKNOWN ; <nl> + uint8_t m_slot = 0 ; <nl> + std : : unique_ptr < StringOffset > m_labelOffset ; <nl> + std : : unique_ptr < StringOffset > m_createdOffset ; <nl> + std : : unique_ptr < StringOffset > m_gameFileNameOffset ; <nl> + uint64_t m_timestampFrames = 0 ; <nl> + double m_timestampWallClock = 0 . 0 ; <nl> + std : : unique_ptr < StringOffset > m_emulatorAddonIdOffset ; <nl> + std : : unique_ptr < StringOffset > m_emulatorVersionOffset ; <nl> + std : : unique_ptr < VectorOffset > m_memoryDataOffset ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / savestates / SavestateTypes . h <nl> ppp b / xbmc / cores / RetroPlayer / savestates / SavestateTypes . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - / * ! <nl> - * \ brief Type of save action , either : <nl> - * <nl> - * - automatic ( saving was not prompted by the user ) <nl> - * - manual ( user manually prompted the save ) <nl> - * / <nl> - enum class SAVE_TYPE <nl> - { <nl> - UNKNOWN , <nl> - AUTO , <nl> - MANUAL , <nl> - } ; <nl> - } <nl> - } <nl> + / * ! <nl> + * \ brief Type of save action , either : <nl> + * <nl> + * - automatic ( saving was not prompted by the user ) <nl> + * - manual ( user manually prompted the save ) <nl> + * / <nl> + enum class SAVE_TYPE <nl> + { <nl> + UNKNOWN , <nl> + AUTO , <nl> + MANUAL , <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / savestates / SavestateUtils . cpp <nl> ppp b / xbmc / cores / RetroPlayer / savestates / SavestateUtils . cpp <nl> <nl> <nl> # include " utils / URIUtils . h " <nl> <nl> - # define SAVESTATE_EXTENSION " . sav " <nl> + # define SAVESTATE_EXTENSION " . sav " <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - std : : string CSavestateUtils : : MakePath ( const std : : string & gamePath ) <nl> + std : : string CSavestateUtils : : MakePath ( const std : : string & gamePath ) <nl> { <nl> return URIUtils : : ReplaceExtension ( gamePath , SAVESTATE_EXTENSION ) ; <nl> } <nl> mmm a / xbmc / cores / RetroPlayer / savestates / SavestateUtils . h <nl> ppp b / xbmc / cores / RetroPlayer / savestates / SavestateUtils . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CSavestateUtils <nl> - { <nl> - public : <nl> - / * ! <nl> - * \ brief Calculate a savestate path for the specified game <nl> - * <nl> - * The savestate path is the game path with the extension replaced <nl> - * by " . sav " . <nl> - * / <nl> - static std : : string MakePath ( const std : : string & gamePath ) ; <nl> - } ; <nl> - } <nl> - } <nl> + class CSavestateUtils <nl> + { <nl> + public : <nl> + / * ! <nl> + * \ brief Calculate a savestate path for the specified game <nl> + * <nl> + * The savestate path is the game path with the extension replaced <nl> + * by " . sav " . <nl> + * / <nl> + static std : : string MakePath ( const std : : string & gamePath ) ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / streams / IRetroPlayerStream . h <nl> ppp b / xbmc / cores / RetroPlayer / streams / IRetroPlayerStream . h <nl> class IRetroPlayerStream <nl> virtual void CloseStream ( ) = 0 ; <nl> } ; <nl> <nl> - } <nl> - } <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / streams / IStreamManager . h <nl> ppp b / xbmc / cores / RetroPlayer / streams / IStreamManager . h <nl> class IStreamManager <nl> virtual void CloseStream ( StreamPtr stream ) = 0 ; <nl> } ; <nl> <nl> - } <nl> - } <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / streams / RPStreamManager . cpp <nl> ppp b / xbmc / cores / RetroPlayer / streams / RPStreamManager . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRPStreamManager : : CRPStreamManager ( CRPRenderManager & renderManager , CRPProcessInfo & processInfo ) : <nl> - m_renderManager ( renderManager ) , <nl> - m_processInfo ( processInfo ) <nl> + CRPStreamManager : : CRPStreamManager ( CRPRenderManager & renderManager , CRPProcessInfo & processInfo ) <nl> + : m_renderManager ( renderManager ) , m_processInfo ( processInfo ) <nl> { <nl> } <nl> <nl> StreamPtr CRPStreamManager : : CreateStream ( StreamType streamType ) <nl> { <nl> switch ( streamType ) <nl> { <nl> - case StreamType : : AUDIO : <nl> - { <nl> - / / Save pointer to audio stream <nl> - m_audioStream = new CRetroPlayerAudio ( m_processInfo ) ; <nl> + case StreamType : : AUDIO : <nl> + { <nl> + / / Save pointer to audio stream <nl> + m_audioStream = new CRetroPlayerAudio ( m_processInfo ) ; <nl> <nl> - return StreamPtr ( m_audioStream ) ; <nl> - } <nl> - case StreamType : : VIDEO : <nl> - case StreamType : : SW_BUFFER : <nl> - { <nl> - return StreamPtr ( new CRetroPlayerVideo ( m_renderManager , m_processInfo ) ) ; <nl> - } <nl> - case StreamType : : HW_BUFFER : <nl> - { <nl> - / / return StreamPtr ( new CRetroPlayerHardware ( m_renderManager , m_processInfo ) ) ; / / ! @ todo <nl> - } <nl> - default : <nl> - break ; <nl> + return StreamPtr ( m_audioStream ) ; <nl> + } <nl> + case StreamType : : VIDEO : <nl> + case StreamType : : SW_BUFFER : <nl> + { <nl> + return StreamPtr ( new CRetroPlayerVideo ( m_renderManager , m_processInfo ) ) ; <nl> + } <nl> + case StreamType : : HW_BUFFER : <nl> + { <nl> + / / return StreamPtr ( new CRetroPlayerHardware ( m_renderManager , m_processInfo ) ) ; / / ! @ todo <nl> + } <nl> + default : <nl> + break ; <nl> } <nl> <nl> return StreamPtr ( ) ; <nl> mmm a / xbmc / cores / RetroPlayer / streams / RPStreamManager . h <nl> ppp b / xbmc / cores / RetroPlayer / streams / RPStreamManager . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRetroPlayerAudio ; <nl> - class CRPProcessInfo ; <nl> - class CRPRenderManager ; <nl> - <nl> - class CRPStreamManager : public IStreamManager <nl> - { <nl> - public : <nl> - CRPStreamManager ( CRPRenderManager & renderManager , CRPProcessInfo & processInfo ) ; <nl> - ~ CRPStreamManager ( ) override = default ; <nl> - <nl> - void EnableAudio ( bool bEnable ) ; <nl> - <nl> - / / Implementation of IStreamManager <nl> - StreamPtr CreateStream ( StreamType streamType ) override ; <nl> - void CloseStream ( StreamPtr stream ) override ; <nl> - <nl> - private : <nl> - / / Construction parameters <nl> - CRPRenderManager & m_renderManager ; <nl> - CRPProcessInfo & m_processInfo ; <nl> - <nl> - / / Stream parameters <nl> - CRetroPlayerAudio * m_audioStream = nullptr ; <nl> - } ; <nl> - } <nl> - } <nl> + class CRetroPlayerAudio ; <nl> + class CRPProcessInfo ; <nl> + class CRPRenderManager ; <nl> + <nl> + class CRPStreamManager : public IStreamManager <nl> + { <nl> + public : <nl> + CRPStreamManager ( CRPRenderManager & renderManager , CRPProcessInfo & processInfo ) ; <nl> + ~ CRPStreamManager ( ) override = default ; <nl> + <nl> + void EnableAudio ( bool bEnable ) ; <nl> + <nl> + / / Implementation of IStreamManager <nl> + StreamPtr CreateStream ( StreamType streamType ) override ; <nl> + void CloseStream ( StreamPtr stream ) override ; <nl> + <nl> + private : <nl> + / / Construction parameters <nl> + CRPRenderManager & m_renderManager ; <nl> + CRPProcessInfo & m_processInfo ; <nl> + <nl> + / / Stream parameters <nl> + CRetroPlayerAudio * m_audioStream = nullptr ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / streams / RetroPlayerAudio . cpp <nl> ppp b / xbmc / cores / RetroPlayer / streams / RetroPlayerAudio . cpp <nl> using namespace RETRO ; <nl> <nl> const double MAX_DELAY = 0 . 3 ; / / seconds <nl> <nl> - CRetroPlayerAudio : : CRetroPlayerAudio ( CRPProcessInfo & processInfo ) : <nl> - m_processInfo ( processInfo ) , <nl> - m_pAudioStream ( nullptr ) , <nl> - m_bAudioEnabled ( true ) <nl> + CRetroPlayerAudio : : CRetroPlayerAudio ( CRPProcessInfo & processInfo ) <nl> + : m_processInfo ( processInfo ) , m_pAudioStream ( nullptr ) , m_bAudioEnabled ( true ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ AUDIO ] : Initializing audio " ) ; <nl> } <nl> CRetroPlayerAudio : : ~ CRetroPlayerAudio ( ) <nl> <nl> bool CRetroPlayerAudio : : OpenStream ( const StreamProperties & properties ) <nl> { <nl> - const AudioStreamProperties & audioProperties = static_cast < const AudioStreamProperties & > ( properties ) ; <nl> + const AudioStreamProperties & audioProperties = <nl> + static_cast < const AudioStreamProperties & > ( properties ) ; <nl> <nl> const AEDataFormat pcmFormat = CAudioTranslator : : TranslatePCMFormat ( audioProperties . format ) ; <nl> if ( pcmFormat = = AE_FMT_INVALID ) <nl> { <nl> - CLog : : Log ( LOGERROR , " RetroPlayer [ AUDIO ] : Unknown PCM format : % d " , static_cast < int > ( audioProperties . format ) ) ; <nl> + CLog : : Log ( LOGERROR , " RetroPlayer [ AUDIO ] : Unknown PCM format : % d " , <nl> + static_cast < int > ( audioProperties . format ) ) ; <nl> return false ; <nl> } <nl> <nl> bool CRetroPlayerAudio : : OpenStream ( const StreamProperties & properties ) <nl> if ( audioEngine = = nullptr ) <nl> return false ; <nl> <nl> - CLog : : Log ( LOGINFO , " RetroPlayer [ AUDIO ] : Creating audio stream , format = % s , sample rate = % d , channels = % d " , <nl> - CAEUtil : : DataFormatToStr ( pcmFormat ) <nl> - , iSampleRate <nl> - , channelLayout . Count ( ) ) ; <nl> + CLog : : Log ( <nl> + LOGINFO , <nl> + " RetroPlayer [ AUDIO ] : Creating audio stream , format = % s , sample rate = % d , channels = % d " , <nl> + CAEUtil : : DataFormatToStr ( pcmFormat ) , iSampleRate , channelLayout . Count ( ) ) ; <nl> <nl> AEAudioFormat audioFormat ; <nl> audioFormat . m_dataFormat = pcmFormat ; <nl> bool CRetroPlayerAudio : : OpenStream ( const StreamProperties & properties ) <nl> return true ; <nl> } <nl> <nl> - void CRetroPlayerAudio : : AddStreamData ( const StreamPacket & packet ) <nl> + void CRetroPlayerAudio : : AddStreamData ( const StreamPacket & packet ) <nl> { <nl> const AudioStreamPacket & audioPacket = static_cast < const AudioStreamPacket & > ( packet ) ; <nl> <nl> void CRetroPlayerAudio : : AddStreamData ( const StreamPacket & packet ) <nl> { <nl> const double delaySecs = m_pAudioStream - > GetDelay ( ) ; <nl> <nl> - const size_t frameSize = m_pAudioStream - > GetChannelCount ( ) * ( CAEUtil : : DataFormatToBits ( m_pAudioStream - > GetDataFormat ( ) ) > > 3 ) ; <nl> + const size_t frameSize = m_pAudioStream - > GetChannelCount ( ) * <nl> + ( CAEUtil : : DataFormatToBits ( m_pAudioStream - > GetDataFormat ( ) ) > > 3 ) ; <nl> <nl> const unsigned int frameCount = static_cast < unsigned int > ( audioPacket . size / frameSize ) ; <nl> <nl> if ( delaySecs > MAX_DELAY ) <nl> { <nl> m_pAudioStream - > Flush ( ) ; <nl> - CLog : : Log ( LOGDEBUG , " RetroPlayer [ AUDIO ] : Audio delay ( % 0 . 2f ms ) is too high - flushing " , delaySecs * 1000 ) ; <nl> + CLog : : Log ( LOGDEBUG , " RetroPlayer [ AUDIO ] : Audio delay ( % 0 . 2f ms ) is too high - flushing " , <nl> + delaySecs * 1000 ) ; <nl> } <nl> <nl> m_pAudioStream - > AddData ( & audioPacket . data , 0 , frameCount , nullptr ) ; <nl> mmm a / xbmc / cores / RetroPlayer / streams / RetroPlayerAudio . h <nl> ppp b / xbmc / cores / RetroPlayer / streams / RetroPlayerAudio . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRPProcessInfo ; <nl> + class CRPProcessInfo ; <nl> <nl> - struct AudioStreamProperties : public StreamProperties <nl> + struct AudioStreamProperties : public StreamProperties <nl> + { <nl> + AudioStreamProperties ( PCMFormat format , double sampleRate , AudioChannelMap channelMap ) <nl> + : format ( format ) , sampleRate ( sampleRate ) , channelMap ( channelMap ) <nl> { <nl> - AudioStreamProperties ( PCMFormat format , double sampleRate , AudioChannelMap channelMap ) : <nl> - format ( format ) , <nl> - sampleRate ( sampleRate ) , <nl> - channelMap ( channelMap ) <nl> - { <nl> - } <nl> + } <nl> <nl> - PCMFormat format ; <nl> - double sampleRate ; <nl> - AudioChannelMap channelMap ; <nl> - } ; <nl> + PCMFormat format ; <nl> + double sampleRate ; <nl> + AudioChannelMap channelMap ; <nl> + } ; <nl> <nl> - struct AudioStreamPacket : public StreamPacket <nl> - { <nl> - AudioStreamPacket ( const uint8_t * data , size_t size ) : <nl> - data ( data ) , <nl> - size ( size ) <nl> - { <nl> - } <nl> + struct AudioStreamPacket : public StreamPacket <nl> + { <nl> + AudioStreamPacket ( const uint8_t * data , size_t size ) : data ( data ) , size ( size ) { } <nl> <nl> - const uint8_t * data ; <nl> - size_t size ; <nl> - } ; <nl> + const uint8_t * data ; <nl> + size_t size ; <nl> + } ; <nl> <nl> - class CRetroPlayerAudio : public IRetroPlayerStream <nl> - { <nl> - public : <nl> - explicit CRetroPlayerAudio ( CRPProcessInfo & processInfo ) ; <nl> - ~ CRetroPlayerAudio ( ) override ; <nl> + class CRetroPlayerAudio : public IRetroPlayerStream <nl> + { <nl> + public : <nl> + explicit CRetroPlayerAudio ( CRPProcessInfo & processInfo ) ; <nl> + ~ CRetroPlayerAudio ( ) override ; <nl> <nl> - void Enable ( bool bEnabled ) { m_bAudioEnabled = bEnabled ; } <nl> + void Enable ( bool bEnabled ) { m_bAudioEnabled = bEnabled ; } <nl> <nl> - / / implementation of IRetroPlayerStream <nl> - bool OpenStream ( const StreamProperties & properties ) override ; <nl> - bool GetStreamBuffer ( unsigned int width , unsigned int height , StreamBuffer & buffer ) override { return false ; } <nl> - void AddStreamData ( const StreamPacket & packet ) override ; <nl> - void CloseStream ( ) override ; <nl> + / / implementation of IRetroPlayerStream <nl> + bool OpenStream ( const StreamProperties & properties ) override ; <nl> + bool GetStreamBuffer ( unsigned int width , unsigned int height , StreamBuffer & buffer ) override <nl> + { <nl> + return false ; <nl> + } <nl> + void AddStreamData ( const StreamPacket & packet ) override ; <nl> + void CloseStream ( ) override ; <nl> <nl> - private : <nl> - CRPProcessInfo & m_processInfo ; <nl> - IAEStream * m_pAudioStream ; <nl> - bool m_bAudioEnabled ; <nl> - } ; <nl> - } <nl> - } <nl> + private : <nl> + CRPProcessInfo & m_processInfo ; <nl> + IAEStream * m_pAudioStream ; <nl> + bool m_bAudioEnabled ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / streams / RetroPlayerStreamTypes . h <nl> ppp b / xbmc / cores / RetroPlayer / streams / RetroPlayerStreamTypes . h <nl> enum class StreamType <nl> <nl> enum class PCMFormat <nl> { <nl> - FMT_UNKNOWN , <nl> - FMT_S16NE , <nl> + FMT_UNKNOWN , <nl> + FMT_S16NE , <nl> } ; <nl> <nl> enum class AudioChannel <nl> enum class VideoRotation <nl> ROTATION_270_CCW , <nl> } ; <nl> <nl> - } <nl> - } <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / streams / RetroPlayerVideo . cpp <nl> ppp b / xbmc / cores / RetroPlayer / streams / RetroPlayerVideo . cpp <nl> <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> - CRetroPlayerVideo : : CRetroPlayerVideo ( CRPRenderManager & renderManager , CRPProcessInfo & processInfo ) : <nl> - m_renderManager ( renderManager ) , <nl> - m_processInfo ( processInfo ) <nl> + CRetroPlayerVideo : : CRetroPlayerVideo ( CRPRenderManager & renderManager , CRPProcessInfo & processInfo ) <nl> + : m_renderManager ( renderManager ) , m_processInfo ( processInfo ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " RetroPlayer [ VIDEO ] : Initializing video " ) ; <nl> <nl> CRetroPlayerVideo : : ~ CRetroPlayerVideo ( ) <nl> <nl> bool CRetroPlayerVideo : : OpenStream ( const StreamProperties & properties ) <nl> { <nl> - const VideoStreamProperties & videoProperties = static_cast < const VideoStreamProperties & > ( properties ) ; <nl> + const VideoStreamProperties & videoProperties = <nl> + static_cast < const VideoStreamProperties & > ( properties ) ; <nl> <nl> if ( m_bOpen ) <nl> { <nl> bool CRetroPlayerVideo : : OpenStream ( const StreamProperties & properties ) <nl> const unsigned int nominalHeight = videoProperties . nominalHeight ; <nl> const unsigned int maxWidth = videoProperties . maxWidth ; <nl> const unsigned int maxHeight = videoProperties . maxHeight ; <nl> - / / const float pixelAspectRatio = videoProperties . pixelAspectRatio ; / / ! @ todo <nl> + / / const float pixelAspectRatio = videoProperties . pixelAspectRatio ; / / ! @ todo <nl> <nl> - CLog : : Log ( LOGDEBUG , " RetroPlayer [ VIDEO ] : Creating video stream - format % s , nominal % ux % u , max % ux % u " , <nl> - CRenderTranslator : : TranslatePixelFormat ( pixfmt ) , <nl> - nominalWidth , <nl> - nominalHeight , <nl> - maxWidth , <nl> - maxHeight ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " RetroPlayer [ VIDEO ] : Creating video stream - format % s , nominal % ux % u , max % ux % u " , <nl> + CRenderTranslator : : TranslatePixelFormat ( pixfmt ) , nominalWidth , nominalHeight , maxWidth , <nl> + maxHeight ) ; <nl> <nl> m_processInfo . SetVideoPixelFormat ( pixfmt ) ; <nl> m_processInfo . SetVideoDimensions ( nominalWidth , nominalHeight ) ; / / Report nominal height for now <nl> bool CRetroPlayerVideo : : OpenStream ( const StreamProperties & properties ) <nl> return m_bOpen ; <nl> } <nl> <nl> - bool CRetroPlayerVideo : : GetStreamBuffer ( unsigned int width , unsigned int height , StreamBuffer & buffer ) <nl> + bool CRetroPlayerVideo : : GetStreamBuffer ( unsigned int width , <nl> + unsigned int height , <nl> + StreamBuffer & buffer ) <nl> { <nl> VideoStreamBuffer & videoBuffer = static_cast < VideoStreamBuffer & > ( buffer ) ; <nl> <nl> if ( m_bOpen ) <nl> { <nl> - return m_renderManager . GetVideoBuffer ( width , <nl> - height , <nl> - videoBuffer . pixfmt , <nl> - videoBuffer . data , <nl> + return m_renderManager . GetVideoBuffer ( width , height , videoBuffer . pixfmt , videoBuffer . data , <nl> videoBuffer . size ) ; <nl> } <nl> <nl> return false ; <nl> } <nl> <nl> - void CRetroPlayerVideo : : AddStreamData ( const StreamPacket & packet ) <nl> + void CRetroPlayerVideo : : AddStreamData ( const StreamPacket & packet ) <nl> { <nl> const VideoStreamPacket & videoPacket = static_cast < const VideoStreamPacket & > ( packet ) ; <nl> <nl> void CRetroPlayerVideo : : AddStreamData ( const StreamPacket & packet ) <nl> unsigned int orientationDegCCW = 0 ; <nl> switch ( videoPacket . rotation ) <nl> { <nl> - case VideoRotation : : ROTATION_90_CCW : <nl> - orientationDegCCW = 90 ; <nl> - break ; <nl> - case VideoRotation : : ROTATION_180_CCW : <nl> - orientationDegCCW = 180 ; <nl> - break ; <nl> - case VideoRotation : : ROTATION_270_CCW : <nl> - orientationDegCCW = 270 ; <nl> - break ; <nl> - default : <nl> - break ; <nl> + case VideoRotation : : ROTATION_90_CCW : <nl> + orientationDegCCW = 90 ; <nl> + break ; <nl> + case VideoRotation : : ROTATION_180_CCW : <nl> + orientationDegCCW = 180 ; <nl> + break ; <nl> + case VideoRotation : : ROTATION_270_CCW : <nl> + orientationDegCCW = 270 ; <nl> + break ; <nl> + default : <nl> + break ; <nl> } <nl> <nl> - m_renderManager . AddFrame ( videoPacket . data , <nl> - videoPacket . size , <nl> - videoPacket . width , <nl> - videoPacket . height , <nl> - orientationDegCCW ) ; <nl> + m_renderManager . AddFrame ( videoPacket . data , videoPacket . size , videoPacket . width , <nl> + videoPacket . height , orientationDegCCW ) ; <nl> } <nl> } <nl> <nl> mmm a / xbmc / cores / RetroPlayer / streams / RetroPlayerVideo . h <nl> ppp b / xbmc / cores / RetroPlayer / streams / RetroPlayerVideo . h <nl> <nl> <nl> # include " IRetroPlayerStream . h " <nl> <nl> - extern " C " { <nl> + extern " C " <nl> + { <nl> # include < libavutil / pixfmt . h > <nl> } <nl> <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CRPProcessInfo ; <nl> - class CRPRenderManager ; <nl> + class CRPProcessInfo ; <nl> + class CRPRenderManager ; <nl> <nl> - struct VideoStreamProperties : public StreamProperties <nl> - { <nl> - VideoStreamProperties ( AVPixelFormat pixfmt , unsigned int nominalWidth , unsigned int nominalHeight , unsigned int maxWidth , unsigned int maxHeight , float pixelAspectRatio ) : <nl> - pixfmt ( pixfmt ) , <nl> + struct VideoStreamProperties : public StreamProperties <nl> + { <nl> + VideoStreamProperties ( AVPixelFormat pixfmt , <nl> + unsigned int nominalWidth , <nl> + unsigned int nominalHeight , <nl> + unsigned int maxWidth , <nl> + unsigned int maxHeight , <nl> + float pixelAspectRatio ) <nl> + : pixfmt ( pixfmt ) , <nl> nominalWidth ( nominalWidth ) , <nl> nominalHeight ( nominalHeight ) , <nl> maxWidth ( maxWidth ) , <nl> maxHeight ( maxHeight ) , <nl> pixelAspectRatio ( pixelAspectRatio ) <nl> - { <nl> - } <nl> + { <nl> + } <nl> <nl> - AVPixelFormat pixfmt ; <nl> - unsigned int nominalWidth ; <nl> - unsigned int nominalHeight ; <nl> - unsigned int maxWidth ; <nl> - unsigned int maxHeight ; <nl> - float pixelAspectRatio ; <nl> - } ; <nl> + AVPixelFormat pixfmt ; <nl> + unsigned int nominalWidth ; <nl> + unsigned int nominalHeight ; <nl> + unsigned int maxWidth ; <nl> + unsigned int maxHeight ; <nl> + float pixelAspectRatio ; <nl> + } ; <nl> <nl> - struct VideoStreamBuffer : public StreamBuffer <nl> - { <nl> - AVPixelFormat pixfmt ; <nl> - uint8_t * data ; <nl> - size_t size ; <nl> - } ; <nl> + struct VideoStreamBuffer : public StreamBuffer <nl> + { <nl> + AVPixelFormat pixfmt ; <nl> + uint8_t * data ; <nl> + size_t size ; <nl> + } ; <nl> <nl> - struct VideoStreamPacket : public StreamPacket <nl> + struct VideoStreamPacket : public StreamPacket <nl> + { <nl> + VideoStreamPacket ( unsigned int width , <nl> + unsigned int height , <nl> + VideoRotation rotation , <nl> + const uint8_t * data , <nl> + size_t size ) <nl> + : width ( width ) , height ( height ) , rotation ( rotation ) , data ( data ) , size ( size ) <nl> { <nl> - VideoStreamPacket ( unsigned int width , unsigned int height , VideoRotation rotation , const uint8_t * data , size_t size ) : <nl> - width ( width ) , <nl> - height ( height ) , <nl> - rotation ( rotation ) , <nl> - data ( data ) , <nl> - size ( size ) <nl> - { <nl> - } <nl> + } <nl> <nl> - unsigned int width ; <nl> - unsigned int height ; <nl> - VideoRotation rotation ; <nl> - const uint8_t * data ; <nl> - size_t size ; <nl> - } ; <nl> + unsigned int width ; <nl> + unsigned int height ; <nl> + VideoRotation rotation ; <nl> + const uint8_t * data ; <nl> + size_t size ; <nl> + } ; <nl> <nl> - / * ! <nl> - * \ brief Renders video frames provided by the game loop <nl> - * <nl> - * \ sa CRPRenderManager <nl> - * / <nl> - class CRetroPlayerVideo : public IRetroPlayerStream <nl> - { <nl> - public : <nl> - CRetroPlayerVideo ( CRPRenderManager & m_renderManager , CRPProcessInfo & m_processInfo ) ; <nl> - ~ CRetroPlayerVideo ( ) override ; <nl> + / * ! <nl> + * \ brief Renders video frames provided by the game loop <nl> + * <nl> + * \ sa CRPRenderManager <nl> + * / <nl> + class CRetroPlayerVideo : public IRetroPlayerStream <nl> + { <nl> + public : <nl> + CRetroPlayerVideo ( CRPRenderManager & m_renderManager , CRPProcessInfo & m_processInfo ) ; <nl> + ~ CRetroPlayerVideo ( ) override ; <nl> <nl> - / / implementation of IRetroPlayerStream <nl> - bool OpenStream ( const StreamProperties & properties ) override ; <nl> - bool GetStreamBuffer ( unsigned int width , unsigned int height , StreamBuffer & buffer ) override ; <nl> - void AddStreamData ( const StreamPacket & packet ) override ; <nl> - void CloseStream ( ) override ; <nl> + / / implementation of IRetroPlayerStream <nl> + bool OpenStream ( const StreamProperties & properties ) override ; <nl> + bool GetStreamBuffer ( unsigned int width , unsigned int height , StreamBuffer & buffer ) override ; <nl> + void AddStreamData ( const StreamPacket & packet ) override ; <nl> + void CloseStream ( ) override ; <nl> <nl> - private : <nl> - / / Construction parameters <nl> - CRPRenderManager & m_renderManager ; <nl> - CRPProcessInfo & m_processInfo ; <nl> + private : <nl> + / / Construction parameters <nl> + CRPRenderManager & m_renderManager ; <nl> + CRPProcessInfo & m_processInfo ; <nl> <nl> - / / Stream properties <nl> - bool m_bOpen = false ; <nl> - } ; <nl> - } <nl> - } <nl> + / / Stream properties <nl> + bool m_bOpen = false ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / streams / memory / BasicMemoryStream . h <nl> ppp b / xbmc / cores / RetroPlayer / streams / memory / BasicMemoryStream . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CBasicMemoryStream : public IMemoryStream <nl> - { <nl> - public : <nl> - CBasicMemoryStream ( ) ; <nl> + class CBasicMemoryStream : public IMemoryStream <nl> + { <nl> + public : <nl> + CBasicMemoryStream ( ) ; <nl> <nl> - ~ CBasicMemoryStream ( ) override = default ; <nl> + ~ CBasicMemoryStream ( ) override = default ; <nl> <nl> - / / implementation of IMemoryStream <nl> - void Init ( size_t frameSize , uint64_t maxFrameCount ) override ; <nl> - void Reset ( ) override ; <nl> - size_t FrameSize ( ) const override { return m_frameSize ; } <nl> - uint64_t MaxFrameCount ( ) const override { return 1 ; } <nl> - void SetMaxFrameCount ( uint64_t maxFrameCount ) override { } <nl> - uint8_t * BeginFrame ( ) override ; <nl> - void SubmitFrame ( ) override ; <nl> - const uint8_t * CurrentFrame ( ) const override ; <nl> - uint64_t FutureFramesAvailable ( ) const override { return 0 ; } <nl> - uint64_t AdvanceFrames ( uint64_t frameCount ) override { return 0 ; } <nl> - uint64_t PastFramesAvailable ( ) const override { return 0 ; } <nl> - uint64_t RewindFrames ( uint64_t frameCount ) override { return 0 ; } <nl> - uint64_t GetFrameCounter ( ) const override { return 0 ; } <nl> - void SetFrameCounter ( uint64_t frameCount ) override { } ; <nl> + / / implementation of IMemoryStream <nl> + void Init ( size_t frameSize , uint64_t maxFrameCount ) override ; <nl> + void Reset ( ) override ; <nl> + size_t FrameSize ( ) const override { return m_frameSize ; } <nl> + uint64_t MaxFrameCount ( ) const override { return 1 ; } <nl> + void SetMaxFrameCount ( uint64_t maxFrameCount ) override { } <nl> + uint8_t * BeginFrame ( ) override ; <nl> + void SubmitFrame ( ) override ; <nl> + const uint8_t * CurrentFrame ( ) const override ; <nl> + uint64_t FutureFramesAvailable ( ) const override { return 0 ; } <nl> + uint64_t AdvanceFrames ( uint64_t frameCount ) override { return 0 ; } <nl> + uint64_t PastFramesAvailable ( ) const override { return 0 ; } <nl> + uint64_t RewindFrames ( uint64_t frameCount ) override { return 0 ; } <nl> + uint64_t GetFrameCounter ( ) const override { return 0 ; } <nl> + void SetFrameCounter ( uint64_t frameCount ) override { } ; <nl> <nl> - private : <nl> - size_t m_frameSize ; <nl> - std : : unique_ptr < uint8_t [ ] > m_frameBuffer ; <nl> - bool m_bHasFrame ; <nl> - } ; <nl> - } <nl> - } <nl> + private : <nl> + size_t m_frameSize ; <nl> + std : : unique_ptr < uint8_t [ ] > m_frameBuffer ; <nl> + bool m_bHasFrame ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / streams / memory / DeltaPairMemoryStream . cpp <nl> ppp b / xbmc / cores / RetroPlayer / streams / memory / DeltaPairMemoryStream . cpp <nl> void CDeltaPairMemoryStream : : SubmitFrameInternal ( ) <nl> uint32_t xor_val = currentFrame [ i ] ^ nextFrame [ i ] ; <nl> if ( xor_val ) <nl> { <nl> - DeltaPair pair = { i , xor_val } ; <nl> + DeltaPair pair = { i , xor_val } ; <nl> frame . buffer . push_back ( pair ) ; <nl> } <nl> } <nl> void CDeltaPairMemoryStream : : CullPastFrames ( uint64_t frameCount ) <nl> { <nl> if ( m_rewindBuffer . empty ( ) ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " CDeltaPairMemoryStream : Tried to cull % d frames too many . Check your math ! " , frameCount - removedCount ) ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " CDeltaPairMemoryStream : Tried to cull % d frames too many . Check your math ! " , <nl> + frameCount - removedCount ) ; <nl> break ; <nl> } <nl> m_rewindBuffer . pop_front ( ) ; <nl> mmm a / xbmc / cores / RetroPlayer / streams / memory / DeltaPairMemoryStream . h <nl> ppp b / xbmc / cores / RetroPlayer / streams / memory / DeltaPairMemoryStream . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - / * ! <nl> - * \ brief Implementation of a linear memory stream using XOR deltas <nl> - * / <nl> - class CDeltaPairMemoryStream : public CLinearMemoryStream <nl> - { <nl> - public : <nl> - CDeltaPairMemoryStream ( ) = default ; <nl> - <nl> - ~ CDeltaPairMemoryStream ( ) override = default ; <nl> + / * ! <nl> + * \ brief Implementation of a linear memory stream using XOR deltas <nl> + * / <nl> + class CDeltaPairMemoryStream : public CLinearMemoryStream <nl> + { <nl> + public : <nl> + CDeltaPairMemoryStream ( ) = default ; <nl> <nl> - / / implementation of IMemoryStream via CLinearMemoryStream <nl> - void Reset ( ) override ; <nl> - uint64_t PastFramesAvailable ( ) const override ; <nl> - uint64_t RewindFrames ( uint64_t frameCount ) override ; <nl> + ~ CDeltaPairMemoryStream ( ) override = default ; <nl> <nl> - protected : <nl> - / / implementation of CLinearMemoryStream <nl> - void SubmitFrameInternal ( ) override ; <nl> - void CullPastFrames ( uint64_t frameCount ) override ; <nl> + / / implementation of IMemoryStream via CLinearMemoryStream <nl> + void Reset ( ) override ; <nl> + uint64_t PastFramesAvailable ( ) const override ; <nl> + uint64_t RewindFrames ( uint64_t frameCount ) override ; <nl> <nl> - / * ! <nl> - * Rewinding is implemented by applying XOR deltas on the specific parts of <nl> - * the save state buffer which have changed . In practice , this is very fast <nl> - * and simple ( linear scan ) and allows deltas to be compressed down to 1 - 3 % <nl> - * of original save state size depending on the system . The algorithm runs <nl> - * on 32 bits at a time for speed . <nl> - * <nl> - * Use std : : deque here to achieve amortized O ( 1 ) on pop / push to front and <nl> - * back . <nl> - * / <nl> - struct DeltaPair <nl> - { <nl> - size_t pos ; <nl> - uint32_t delta ; <nl> - } ; <nl> + protected : <nl> + / / implementation of CLinearMemoryStream <nl> + void SubmitFrameInternal ( ) override ; <nl> + void CullPastFrames ( uint64_t frameCount ) override ; <nl> <nl> - using DeltaPairVector = std : : vector < DeltaPair > ; <nl> + / * ! <nl> + * Rewinding is implemented by applying XOR deltas on the specific parts of <nl> + * the save state buffer which have changed . In practice , this is very fast <nl> + * and simple ( linear scan ) and allows deltas to be compressed down to 1 - 3 % <nl> + * of original save state size depending on the system . The algorithm runs <nl> + * on 32 bits at a time for speed . <nl> + * <nl> + * Use std : : deque here to achieve amortized O ( 1 ) on pop / push to front and <nl> + * back . <nl> + * / <nl> + struct DeltaPair <nl> + { <nl> + size_t pos ; <nl> + uint32_t delta ; <nl> + } ; <nl> <nl> - struct MemoryFrame <nl> - { <nl> - DeltaPairVector buffer ; <nl> - uint64_t frameHistoryCount ; <nl> - } ; <nl> + using DeltaPairVector = std : : vector < DeltaPair > ; <nl> <nl> - std : : deque < MemoryFrame > m_rewindBuffer ; <nl> + struct MemoryFrame <nl> + { <nl> + DeltaPairVector buffer ; <nl> + uint64_t frameHistoryCount ; <nl> } ; <nl> - } <nl> - } <nl> + <nl> + std : : deque < MemoryFrame > m_rewindBuffer ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / streams / memory / IMemoryStream . h <nl> ppp b / xbmc / cores / RetroPlayer / streams / memory / IMemoryStream . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> + / * ! <nl> + * \ brief Stream of serialized states from game clients <nl> + * <nl> + * A memory stream is composed of " frames " of memory representing serialized <nl> + * states of the game client . For each video frame run by the game loop , the <nl> + * game client ' s state is serialized into a buffer provided by this interface . <nl> + * <nl> + * Implementation of three types of memory streams are provided : <nl> + * <nl> + * - Basic memory stream : has only a current frame , and supports neither <nl> + * rewind nor forward seeking . <nl> + * <nl> + * \ sa CBasicMemoryStream <nl> + * <nl> + * - Linear memory stream : can grow in one direction . It is possible to <nl> + * rewind , but not fast - forward . <nl> + * <nl> + * \ sa CLinearMemoryStream <nl> + * <nl> + * - Nonlinear memory stream : can have frames both ahead of and behind <nl> + * the current frame . If a stream is rewound , it is possible to <nl> + * recover these frames by seeking forward again . <nl> + * <nl> + * \ sa CNonlinearMemoryStream ( TODO ) <nl> + * / <nl> + class IMemoryStream <nl> + { <nl> + public : <nl> + virtual ~ IMemoryStream ( ) = default ; <nl> + <nl> + / * ! <nl> + * \ brief Initialize memory stream <nl> + * <nl> + * \ param frameSize The size of the serialized memory state <nl> + * \ param maxFrameCount The maximum number of frames this stream can hold <nl> + * / <nl> + virtual void Init ( size_t frameSize , uint64_t maxFrameCount ) = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Free any resources used by this stream <nl> + * / <nl> + virtual void Reset ( ) = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Return the frame size passed to Init ( ) <nl> + * / <nl> + virtual size_t FrameSize ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Return the current max frame count <nl> + * / <nl> + virtual uint64_t MaxFrameCount ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Update the max frame count <nl> + * <nl> + * Old frames may be deleted if the max frame count is reduced . <nl> + * / <nl> + virtual void SetMaxFrameCount ( uint64_t maxFrameCount ) = 0 ; <nl> + <nl> / * ! <nl> - * \ brief Stream of serialized states from game clients <nl> + * \ brief Get a pointer to which FrameSize ( ) bytes can be written <nl> * <nl> - * A memory stream is composed of " frames " of memory representing serialized <nl> - * states of the game client . For each video frame run by the game loop , the <nl> - * game client ' s state is serialized into a buffer provided by this interface . <nl> + * The buffer exposed by this function is passed to the game client , which <nl> + * fills it with a serialization of its current state . <nl> + * / <nl> + virtual uint8_t * BeginFrame ( ) = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Indicate that a frame of size FrameSize ( ) has been written to the <nl> + * location returned from BeginFrame ( ) <nl> + * / <nl> + virtual void SubmitFrame ( ) = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Get a pointer to the current frame <nl> * <nl> - * Implementation of three types of memory streams are provided : <nl> + * This function must have no side effects . The pointer is valid until the <nl> + * stream is modified . <nl> * <nl> - * - Basic memory stream : has only a current frame , and supports neither <nl> - * rewind nor forward seeking . <nl> + * \ return A buffer of size FrameSize ( ) , or nullptr if the stream is empty <nl> + * / <nl> + virtual const uint8_t * CurrentFrame ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Return the number of frames ahead of the current frame <nl> * <nl> - * \ sa CBasicMemoryStream <nl> + * If the stream supports forward seeking , frames that are passed over <nl> + * during a " rewind " operation can be recovered again . <nl> + * / <nl> + virtual uint64_t FutureFramesAvailable ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Seek ahead the specified number of frames <nl> * <nl> - * - Linear memory stream : can grow in one direction . It is possible to <nl> - * rewind , but not fast - forward . <nl> + * \ return The number of frames advanced <nl> + * / <nl> + virtual uint64_t AdvanceFrames ( uint64_t frameCount ) = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Return the number of frames behind the current frame <nl> + * / <nl> + virtual uint64_t PastFramesAvailable ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Seek backwards the specified number of frames <nl> * <nl> - * \ sa CLinearMemoryStream <nl> + * \ return The number of frames rewound <nl> + * / <nl> + virtual uint64_t RewindFrames ( uint64_t frameCount ) = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Get the total number of frames played until the current frame <nl> * <nl> - * - Nonlinear memory stream : can have frames both ahead of and behind <nl> - * the current frame . If a stream is rewound , it is possible to <nl> - * recover these frames by seeking forward again . <nl> + * \ return The history of the current frame , or 0 for unknown <nl> + * / <nl> + virtual uint64_t GetFrameCounter ( ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Set the total number of frames played until the current frame <nl> * <nl> - * \ sa CNonlinearMemoryStream ( TODO ) <nl> + * \ param frameCount The history of the current frame <nl> * / <nl> - class IMemoryStream <nl> - { <nl> - public : <nl> - virtual ~ IMemoryStream ( ) = default ; <nl> - <nl> - / * ! <nl> - * \ brief Initialize memory stream <nl> - * <nl> - * \ param frameSize The size of the serialized memory state <nl> - * \ param maxFrameCount The maximum number of frames this stream can hold <nl> - * / <nl> - virtual void Init ( size_t frameSize , uint64_t maxFrameCount ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Free any resources used by this stream <nl> - * / <nl> - virtual void Reset ( ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Return the frame size passed to Init ( ) <nl> - * / <nl> - virtual size_t FrameSize ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Return the current max frame count <nl> - * / <nl> - virtual uint64_t MaxFrameCount ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Update the max frame count <nl> - * <nl> - * Old frames may be deleted if the max frame count is reduced . <nl> - * / <nl> - virtual void SetMaxFrameCount ( uint64_t maxFrameCount ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Get a pointer to which FrameSize ( ) bytes can be written <nl> - * <nl> - * The buffer exposed by this function is passed to the game client , which <nl> - * fills it with a serialization of its current state . <nl> - * / <nl> - virtual uint8_t * BeginFrame ( ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Indicate that a frame of size FrameSize ( ) has been written to the <nl> - * location returned from BeginFrame ( ) <nl> - * / <nl> - virtual void SubmitFrame ( ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Get a pointer to the current frame <nl> - * <nl> - * This function must have no side effects . The pointer is valid until the <nl> - * stream is modified . <nl> - * <nl> - * \ return A buffer of size FrameSize ( ) , or nullptr if the stream is empty <nl> - * / <nl> - virtual const uint8_t * CurrentFrame ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Return the number of frames ahead of the current frame <nl> - * <nl> - * If the stream supports forward seeking , frames that are passed over <nl> - * during a " rewind " operation can be recovered again . <nl> - * / <nl> - virtual uint64_t FutureFramesAvailable ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Seek ahead the specified number of frames <nl> - * <nl> - * \ return The number of frames advanced <nl> - * / <nl> - virtual uint64_t AdvanceFrames ( uint64_t frameCount ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Return the number of frames behind the current frame <nl> - * / <nl> - virtual uint64_t PastFramesAvailable ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Seek backwards the specified number of frames <nl> - * <nl> - * \ return The number of frames rewound <nl> - * / <nl> - virtual uint64_t RewindFrames ( uint64_t frameCount ) = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Get the total number of frames played until the current frame <nl> - * <nl> - * \ return The history of the current frame , or 0 for unknown <nl> - * / <nl> - virtual uint64_t GetFrameCounter ( ) const = 0 ; <nl> - <nl> - / * ! <nl> - * \ brief Set the total number of frames played until the current frame <nl> - * <nl> - * \ param frameCount The history of the current frame <nl> - * / <nl> - virtual void SetFrameCounter ( uint64_t frameCount ) = 0 ; <nl> - } ; <nl> - } <nl> - } <nl> + virtual void SetFrameCounter ( uint64_t frameCount ) = 0 ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl> mmm a / xbmc / cores / RetroPlayer / streams / memory / LinearMemoryStream . cpp <nl> ppp b / xbmc / cores / RetroPlayer / streams / memory / LinearMemoryStream . cpp <nl> using namespace KODI ; <nl> using namespace RETRO ; <nl> <nl> / / Pad forward to nearest boundary of bytes <nl> - # define PAD_TO_CEIL ( x , bytes ) ( ( ( ( x ) + ( bytes ) - 1 ) / ( bytes ) ) * ( bytes ) ) <nl> + # define PAD_TO_CEIL ( x , bytes ) ( ( ( ( x ) + ( bytes ) - 1 ) / ( bytes ) ) * ( bytes ) ) <nl> <nl> CLinearMemoryStream : : CLinearMemoryStream ( ) <nl> { <nl> mmm a / xbmc / cores / RetroPlayer / streams / memory / LinearMemoryStream . h <nl> ppp b / xbmc / cores / RetroPlayer / streams / memory / LinearMemoryStream . h <nl> namespace KODI <nl> { <nl> namespace RETRO <nl> { <nl> - class CLinearMemoryStream : public IMemoryStream <nl> - { <nl> - public : <nl> - CLinearMemoryStream ( ) ; <nl> + class CLinearMemoryStream : public IMemoryStream <nl> + { <nl> + public : <nl> + CLinearMemoryStream ( ) ; <nl> <nl> - ~ CLinearMemoryStream ( ) override = default ; <nl> + ~ CLinearMemoryStream ( ) override = default ; <nl> <nl> - / / partial implementation of IMemoryStream <nl> - void Init ( size_t frameSize , uint64_t maxFrameCount ) override ; <nl> - void Reset ( ) override ; <nl> - size_t FrameSize ( ) const override { return m_frameSize ; } <nl> - uint64_t MaxFrameCount ( ) const override { return m_maxFrames ; } <nl> - void SetMaxFrameCount ( uint64_t maxFrameCount ) override ; <nl> - uint8_t * BeginFrame ( ) override ; <nl> - void SubmitFrame ( ) override ; <nl> - const uint8_t * CurrentFrame ( ) const override ; <nl> - uint64_t FutureFramesAvailable ( ) const override { return 0 ; } <nl> - uint64_t AdvanceFrames ( uint64_t frameCount ) override { return 0 ; } <nl> - uint64_t PastFramesAvailable ( ) const override = 0 ; <nl> - uint64_t RewindFrames ( uint64_t frameCount ) override = 0 ; <nl> - uint64_t GetFrameCounter ( ) const override { return m_currentFrameHistory ; } <nl> - void SetFrameCounter ( uint64_t frameCount ) override { m_currentFrameHistory = frameCount ; } <nl> + / / partial implementation of IMemoryStream <nl> + void Init ( size_t frameSize , uint64_t maxFrameCount ) override ; <nl> + void Reset ( ) override ; <nl> + size_t FrameSize ( ) const override { return m_frameSize ; } <nl> + uint64_t MaxFrameCount ( ) const override { return m_maxFrames ; } <nl> + void SetMaxFrameCount ( uint64_t maxFrameCount ) override ; <nl> + uint8_t * BeginFrame ( ) override ; <nl> + void SubmitFrame ( ) override ; <nl> + const uint8_t * CurrentFrame ( ) const override ; <nl> + uint64_t FutureFramesAvailable ( ) const override { return 0 ; } <nl> + uint64_t AdvanceFrames ( uint64_t frameCount ) override { return 0 ; } <nl> + uint64_t PastFramesAvailable ( ) const override = 0 ; <nl> + uint64_t RewindFrames ( uint64_t frameCount ) override = 0 ; <nl> + uint64_t GetFrameCounter ( ) const override { return m_currentFrameHistory ; } <nl> + void SetFrameCounter ( uint64_t frameCount ) override { m_currentFrameHistory = frameCount ; } <nl> <nl> - protected : <nl> - virtual void SubmitFrameInternal ( ) = 0 ; <nl> - virtual void CullPastFrames ( uint64_t frameCount ) = 0 ; <nl> + protected : <nl> + virtual void SubmitFrameInternal ( ) = 0 ; <nl> + virtual void CullPastFrames ( uint64_t frameCount ) = 0 ; <nl> <nl> - / / Helper function <nl> - uint64_t BufferSize ( ) const ; <nl> + / / Helper function <nl> + uint64_t BufferSize ( ) const ; <nl> <nl> - size_t m_paddedFrameSize ; <nl> - uint64_t m_maxFrames ; <nl> + size_t m_paddedFrameSize ; <nl> + uint64_t m_maxFrames ; <nl> <nl> - / * * <nl> - * Simple double - buffering . After XORing the two states , the next becomes <nl> - * the current , and the current becomes a buffer for the next call to <nl> - * CGameClient : : Serialize ( ) . <nl> - * / <nl> - std : : unique_ptr < uint32_t [ ] > m_currentFrame ; <nl> - std : : unique_ptr < uint32_t [ ] > m_nextFrame ; <nl> - bool m_bHasCurrentFrame ; <nl> - bool m_bHasNextFrame ; <nl> + / * * <nl> + * Simple double - buffering . After XORing the two states , the next becomes <nl> + * the current , and the current becomes a buffer for the next call to <nl> + * CGameClient : : Serialize ( ) . <nl> + * / <nl> + std : : unique_ptr < uint32_t [ ] > m_currentFrame ; <nl> + std : : unique_ptr < uint32_t [ ] > m_nextFrame ; <nl> + bool m_bHasCurrentFrame ; <nl> + bool m_bHasNextFrame ; <nl> <nl> - uint64_t m_currentFrameHistory ; <nl> + uint64_t m_currentFrameHistory ; <nl> <nl> - private : <nl> - size_t m_frameSize ; <nl> - } ; <nl> - } <nl> - } <nl> + private : <nl> + size_t m_frameSize ; <nl> + } ; <nl> + } / / namespace RETRO <nl> + } / / namespace KODI <nl>
|
RetroPlayer : Clang - format files
|
xbmc/xbmc
|
838cf16f17a7fcf5d49ac0b3d51d9826a9fb7a6e
|
2020-05-27T00:43:55Z
|
mmm a / jstests / unix_socket1 . js <nl> ppp b / jstests / unix_socket1 . js <nl> if ( ! _isWindows ( ) ) { <nl> } else { <nl> port = hoststring . substr ( index + 1 ) <nl> } <nl> - / * <nl> + <nl> sock = new Mongo ( ' / tmp / mongodb - ' + port + ' . sock ' ) <nl> sockdb = sock . getDB ( db . getName ( ) ) <nl> assert ( sockdb . runCommand ( ' ping ' ) . ok ) <nl> - * / <nl> + <nl> } else { <nl> print ( " Not testing unix sockets on Windows " ) ; <nl> } <nl>
|
turn test back on
|
mongodb/mongo
|
49c775f025a45e0dbecd73a3ba9bad915d126332
|
2010-09-29T15:22:07Z
|
mmm a / Code / CryEngine / CryAction / MaterialEffects / MaterialEffects . cpp <nl> ppp b / Code / CryEngine / CryAction / MaterialEffects / MaterialEffects . cpp <nl> TMFXEffectId CMaterialEffects : : GetEffectId ( int surfaceIndex1 , int surfaceIndex2 ) <nl> { <nl> m_pVisualDebug - > AddLastSearchHint ( effectId , surfaceIndex1 , surfaceIndex2 ) ; <nl> } <nl> + else <nl> + { <nl> + GameWarning ( " Could not find a valid effect at row % i and column % i of libs / materialeffects / materialeffects . xml " , idx1 , idx2 ) ; <nl> + } <nl> } <nl> <nl> return effectId ; <nl> TMFXEffectId CMaterialEffects : : GetEffectId ( const char * customName , int surfaceIn <nl> { <nl> m_pVisualDebug - > AddLastSearchHint ( effectId , customName , surfaceIndex2 ) ; <nl> } <nl> + else <nl> + { <nl> + GameWarning ( " Could not find a valid effect at row % i and column % i of libs / materialeffects / materialeffects . xml " , idx1 , idx2 ) ; <nl> + } <nl> } <nl> <nl> return effectId ; <nl> TMFXEffectId CMaterialEffects : : GetEffectId ( IEntityClass * pEntityClass , int surfa <nl> { <nl> m_pVisualDebug - > AddLastSearchHint ( effectId , pEntityClass , surfaceIndex2 ) ; <nl> } <nl> + else <nl> + { <nl> + GameWarning ( " Could not find a valid effect at row % i and column % i of libs / materialeffects / materialeffects . xml " , idx1 , idx2 ) ; <nl> + } <nl> } <nl> <nl> return effectId ; <nl>
|
! T Adding a warning if the MFX fails to find a valid effect
|
CRYTEK/CRYENGINE
|
01fc0687579a58c2a17c748255ad2b29ffa81321
|
2017-11-30T17:11:12Z
|
mmm a / tensorflow / compiler / mlir / lite / tests / optimize . mlir <nl> ppp b / tensorflow / compiler / mlir / lite / tests / optimize . mlir <nl> func @ FusingdivRelu ( % arg0 : tensor < 1xf32 > , % arg1 : tensor < 1xf32 > ) - > tensor < 1xf32 > <nl> / / Fusing : % [ [ div2 : [ 0 - 9 ] . * ] ] = tfl . div % [ [ relu ] ] , % [ [ div1 ] ] { fused_activation_function = " RELU6 " } : tensor < 1xf32 > <nl> / / Fusing : return <nl> } <nl> + <nl> + func @ ReorderAddWithConstant ( % arg0 : tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > { <nl> + % cst = constant dense < 1 . 0 > : tensor < 2x2xf32 > <nl> + % cst_1 = constant dense < 2 . 0 > : tensor < 2x2xf32 > <nl> + % 0 = " tfl . add " ( % arg0 , % cst ) { fused_activation_function = " NONE " } : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + % 1 = " tfl . add " ( % 0 , % cst_1 ) { fused_activation_function = " NONE " } : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + return % 1 : tensor < 2x2xf32 > <nl> + <nl> + / / CHECK - LABEL : ReorderAddWithConstant <nl> + / / CHECK : % [ [ CONST : . * ] ] = constant dense < 3 . 000000e + 00 > : tensor < 2x2xf32 > <nl> + / / CHECK : % [ [ RESULT : . * ] ] = tfl . add % arg0 , % [ [ CONST ] ] { fused_activation_function = " NONE " } : tensor < 2x2xf32 > <nl> + } <nl> + <nl> mmm a / tensorflow / compiler / mlir / lite / transforms / optimize_patterns . td <nl> ppp b / tensorflow / compiler / mlir / lite / transforms / optimize_patterns . td <nl> def : Pat < ( TFL_AddOp <nl> / / The constant folding in this pass might produce constant in the tf dialect . <nl> / / This rule is to legalize these constant to the tfl dialect . <nl> def : Pat < ( TF_ConstOp ElementsAttr : $ value ) , ( TFL_ConstOp $ value ) > ; <nl> + <nl> + / / Reorders adds to allow constant folding . <nl> + / / Add - - > Add $ input , $ constantA <nl> + / / \ - - > $ constantB <nl> + / / To <nl> + / / Add - - > $ input <nl> + / / \ - - > Add ( $ constantA , $ constantB ) <nl> + foreach ActFun = [ TFL_AF_Relu , TFL_AF_Relu6 , TFL_AF_Relu1 , TFL_AF_None ] in { <nl> + def : Pat < ( TFL_AddOp <nl> + ( TFL_AddOp : $ first_output $ input , ( ConstantOp $ a ) , TFL_AF_None ) , <nl> + ( ConstantOp $ b ) , ActFun ) , <nl> + ( TFL_AddOp $ input , <nl> + ( TFL_AddOp ( ConstantOp $ a ) , ( ConstantOp $ b ) , TFL_AF_None ) , <nl> + ActFun ) , <nl> + [ ( HasOneUse $ first_output ) ] > ; <nl> + } <nl> + <nl> + <nl> mmm a / tensorflow / compiler / mlir / tensorflow / ir / tf_generated_ops . td <nl> ppp b / tensorflow / compiler / mlir / tensorflow / ir / tf_generated_ops . td <nl> def TF_AddV2Op : TF_Op < " AddV2 " , [ Commutative , NoSideEffect , ResultsBroadcastable <nl> TF_DerivedOperandTypeAttr T = TF_DerivedOperandTypeAttr < 0 > ; <nl> <nl> let hasCanonicalizer = 1 ; <nl> + <nl> + let hasFolder = 1 ; <nl> } <nl> <nl> def TF_AllOp : TF_Op < " All " , [ NoSideEffect ] > { <nl> def TF_DivOp : TF_Op < " Div " , [ NoSideEffect , ResultsBroadcastableShape ] > , <nl> TF_DerivedOperandTypeAttr T = TF_DerivedOperandTypeAttr < 0 > ; <nl> <nl> let hasCanonicalizer = 1 ; <nl> + <nl> + let hasFolder = 1 ; <nl> } <nl> <nl> def TF_DivNoNanOp : TF_Op < " DivNoNan " , [ NoSideEffect , ResultsBroadcastableShape ] > , <nl> def TF_MulOp : TF_Op < " Mul " , [ Commutative , NoSideEffect , ResultsBroadcastableShap <nl> ) ; <nl> <nl> TF_DerivedOperandTypeAttr T = TF_DerivedOperandTypeAttr < 0 > ; <nl> + <nl> + let hasFolder = 1 ; <nl> } <nl> <nl> def TF_MulNoNanOp : TF_Op < " MulNoNan " , [ NoSideEffect , ResultsBroadcastableShape ] > , <nl> def TF_SubOp : TF_Op < " Sub " , [ NoSideEffect , ResultsBroadcastableShape ] > , <nl> TF_DerivedOperandTypeAttr T = TF_DerivedOperandTypeAttr < 0 > ; <nl> <nl> let hasCanonicalizer = 1 ; <nl> + <nl> + let hasFolder = 1 ; <nl> } <nl> <nl> def TF_SumOp : TF_Op < " Sum " , [ NoSideEffect ] > { <nl> mmm a / tensorflow / compiler / mlir / tensorflow / ir / tf_ops . cc <nl> ppp b / tensorflow / compiler / mlir / tensorflow / ir / tf_ops . cc <nl> LogicalResult FoldOperandsPermutation ( <nl> return success ( ) ; <nl> } <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / Rewrite Pattern for removing trivial Arithmetic op . <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + namespace { <nl> + / / Utility methods that returns Identity value to use for selected ops . <nl> + <nl> + APFloat GetIdentity ( AddV2Op op ) { return APFloat ( 0 . 0f ) ; } <nl> + APFloat GetIdentity ( SubOp op ) { return APFloat ( 0 . 0f ) ; } <nl> + APFloat GetIdentity ( MulOp op ) { return APFloat ( 1 . 0f ) ; } <nl> + APFloat GetIdentity ( DivOp op ) { return APFloat ( 1 . 0f ) ; } <nl> + <nl> + / / Folder that returns LHS of an Arithmetic Op if the RHS is a constant <nl> + / / known to be Identity ( e . g X + 0 ) <nl> + template < typename OP > <nl> + OpFoldResult TrivialArithmeticOpFolder ( OP arithmetic_op ) { <nl> + DenseFPElementsAttr rhs_value ; <nl> + auto constant_val = arithmetic_op . y ( ) ; <nl> + if ( ! matchPattern ( constant_val , m_Constant ( & rhs_value ) ) ) { <nl> + return { } ; <nl> + } <nl> + auto result_op_type = arithmetic_op . getResult ( ) . getType ( ) ; <nl> + auto lhs_type = arithmetic_op . x ( ) . getType ( ) ; <nl> + if ( ! result_op_type . template isa < ShapedType > ( ) | | <nl> + ! lhs_type . template isa < ShapedType > ( ) | | <nl> + ! result_op_type . template cast < ShapedType > ( ) . hasStaticShape ( ) ) { <nl> + return { } ; <nl> + } <nl> + / / We only handle non - broadcastable case . <nl> + if ( result_op_type ! = lhs_type ) { <nl> + return { } ; <nl> + } <nl> + auto identity_val = GetIdentity ( arithmetic_op ) ; <nl> + for ( auto it = rhs_value . float_value_begin ( ) ; <nl> + it ! = rhs_value . float_value_end ( ) ; + + it ) { <nl> + if ( * it ! = identity_val ) return { } ; <nl> + } <nl> + <nl> + return arithmetic_op . x ( ) ; <nl> + } <nl> + } / / namespace <nl> + <nl> namespace { <nl> # include " tensorflow / compiler / mlir / tensorflow / transforms / generated_canonicalize . inc " <nl> } / / namespace <nl> void AddV2Op : : getCanonicalizationPatterns ( OwningRewritePatternList & results , <nl> results . insert < AddV2OfNegLeft , AddV2OfNegRight > ( context ) ; <nl> } <nl> <nl> + OpFoldResult AddV2Op : : fold ( ArrayRef < Attribute > operands ) { <nl> + return TrivialArithmeticOpFolder < AddV2Op > ( * this ) ; <nl> + } <nl> + <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> / / AllOp <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> void DivOp : : getCanonicalizationPatterns ( OwningRewritePatternList & results , <nl> results . insert < DivWithSqrtDivisor > ( context ) ; <nl> } <nl> <nl> + OpFoldResult DivOp : : fold ( ArrayRef < Attribute > operands ) { <nl> + return TrivialArithmeticOpFolder < DivOp > ( * this ) ; <nl> + } <nl> + <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> / / DynamicStitchOp <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> LogicalResult MeanOp : : FoldOperandsPermutation ( ArrayRef < int64_t > permutation ) { <nl> return success ( ) ; <nl> } <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / MulOp <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + OpFoldResult MulOp : : fold ( ArrayRef < Attribute > operands ) { <nl> + return TrivialArithmeticOpFolder < MulOp > ( * this ) ; <nl> + } <nl> + <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> / / NegOp <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> void SubOp : : getCanonicalizationPatterns ( OwningRewritePatternList & results , <nl> results . insert < SubOfNeg > ( context ) ; <nl> } <nl> <nl> + OpFoldResult SubOp : : fold ( ArrayRef < Attribute > operands ) { <nl> + return TrivialArithmeticOpFolder < SubOp > ( * this ) ; <nl> + } <nl> + <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> / / SumOp <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> mmm a / tensorflow / compiler / mlir / tensorflow / tests / constant - fold . mlir <nl> ppp b / tensorflow / compiler / mlir / tensorflow / tests / constant - fold . mlir <nl> func @ testTensorListElementShape ( % arg0 : tensor < ! tf . variant < tensor < 2x4xf32 > > > ) - > <nl> / / CHECK - NEXT : return [ [ cst ] ] : tensor < 2xi32 > <nl> return % 0 : tensor < 2xi32 > <nl> } <nl> + <nl> + func @ RemoveTrivialAdd ( % arg0 : tensor < 2x2xf32 > , % arg1 : tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > { <nl> + % cst = constant dense < 0 . 0 > : tensor < 2x2xf32 > <nl> + % 0 = " tf . Add " ( % arg0 , % arg1 ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + % 1 = " tf . Add " ( % 0 , % cst ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + return % 1 : tensor < 2x2xf32 > <nl> + <nl> + / / CHECK - LABEL : RemoveTrivialAdd <nl> + / / CHECK : % [ [ RESULT : . * ] ] = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + / / CHECK - NEXT : return % [ [ RESULT ] ] : tensor < 2x2xf32 > <nl> + } <nl> + <nl> + func @ RemoveTrivialAddV2 ( % arg0 : tensor < 2x2xf32 > , % arg1 : tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > { <nl> + % cst = constant dense < 0 . 0 > : tensor < 2x2xf32 > <nl> + % 0 = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + % 1 = " tf . AddV2 " ( % 0 , % cst ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + return % 1 : tensor < 2x2xf32 > <nl> + <nl> + / / CHECK - LABEL : RemoveTrivialAddV2 <nl> + / / CHECK : % [ [ RESULT : . * ] ] = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + / / CHECK - NEXT : return % [ [ RESULT ] ] : tensor < 2x2xf32 > <nl> + } <nl> + <nl> + func @ RemoveTrivialSub ( % arg0 : tensor < 2x2xf32 > , % arg1 : tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > { <nl> + % cst = constant dense < 0 . 0 > : tensor < 2x2xf32 > <nl> + % 0 = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + % 1 = " tf . Sub " ( % 0 , % cst ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + return % 1 : tensor < 2x2xf32 > <nl> + <nl> + / / CHECK - LABEL : RemoveTrivialSub <nl> + / / CHECK : % [ [ RESULT : . * ] ] = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + / / CHECK - NEXT : return % [ [ RESULT ] ] : tensor < 2x2xf32 > <nl> + } <nl> + <nl> + func @ RemoveTrivialMul ( % arg0 : tensor < 2x2xf32 > , % arg1 : tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > { <nl> + % cst = constant dense < 1 . 0 > : tensor < 2x2xf32 > <nl> + % 0 = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + % 1 = " tf . Mul " ( % 0 , % cst ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + return % 1 : tensor < 2x2xf32 > <nl> + <nl> + / / CHECK - LABEL : RemoveTrivialMul <nl> + / / CHECK : % [ [ RESULT : . * ] ] = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + / / CHECK - NEXT : return % [ [ RESULT ] ] : tensor < 2x2xf32 > <nl> + } <nl> + <nl> + func @ RemoveTrivialDiv ( % arg0 : tensor < 2x2xf32 > , % arg1 : tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > { <nl> + % cst = constant dense < 1 . 0 > : tensor < 2x2xf32 > <nl> + % 0 = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + % 1 = " tf . Div " ( % 0 , % cst ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + return % 1 : tensor < 2x2xf32 > <nl> + <nl> + / / CHECK - LABEL : RemoveTrivialDiv <nl> + / / CHECK : % [ [ RESULT : . * ] ] = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < 2x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + / / CHECK - NEXT : return % [ [ RESULT ] ] : tensor < 2x2xf32 > <nl> + } <nl> + <nl> + func @ DontRemoveTrivialAdd ( % arg0 : tensor < 1x2xf32 > , % arg1 : tensor < 1x2xf32 > ) - > tensor < 2x2xf32 > { <nl> + % cst = constant dense < 0 . 0 > : tensor < 2x2xf32 > <nl> + % 0 = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < 1x2xf32 > , tensor < 1x2xf32 > ) - > tensor < 1x2xf32 > <nl> + % 1 = " tf . AddV2 " ( % 0 , % cst ) : ( tensor < 1x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + return % 1 : tensor < 2x2xf32 > <nl> + <nl> + / / CHECK - LABEL : DontRemoveTrivialAdd <nl> + / / CHECK : % [ [ CONST : . * ] ] = constant dense < 0 . 000000e + 00 > : tensor < 2x2xf32 > <nl> + / / CHECK : % [ [ add : . * ] ] = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < 1x2xf32 > , tensor < 1x2xf32 > ) - > tensor < 1x2xf32 > <nl> + / / CHECK : % [ [ RESULT : . * ] ] = " tf . AddV2 " ( % [ [ add ] ] , % [ [ CONST ] ] ) : ( tensor < 1x2xf32 > , tensor < 2x2xf32 > ) - > tensor < 2x2xf32 > <nl> + / / CHECK : return % [ [ RESULT ] ] : tensor < 2x2xf32 > <nl> + } <nl> + <nl> + func @ DontRemoveTrivialAdd2 ( % arg0 : tensor < ? x ? xf32 > , % arg1 : tensor < 2x2xf32 > ) - > tensor < ? x ? xf32 > { <nl> + % cst = constant dense < 0 . 0 > : tensor < 2x2xf32 > <nl> + % 0 = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < ? x ? xf32 > , tensor < 2x2xf32 > ) - > tensor < ? x ? xf32 > <nl> + % 1 = " tf . AddV2 " ( % 0 , % cst ) : ( tensor < ? x ? xf32 > , tensor < 2x2xf32 > ) - > tensor < ? x ? xf32 > <nl> + return % 1 : tensor < ? x ? xf32 > <nl> + <nl> + / / CHECK - LABEL : DontRemoveTrivialAdd2 <nl> + / / CHECK : % [ [ CONST : . * ] ] = constant dense < 0 . 000000e + 00 > : tensor < 2x2xf32 > <nl> + / / CHECK : % [ [ add : . * ] ] = " tf . AddV2 " ( % arg0 , % arg1 ) : ( tensor < ? x ? xf32 > , tensor < 2x2xf32 > ) - > tensor < ? x ? xf32 > <nl> + / / CHECK : % [ [ RESULT : . * ] ] = " tf . AddV2 " ( % [ [ add ] ] , % [ [ CONST ] ] ) : ( tensor < ? x ? xf32 > , tensor < 2x2xf32 > ) - > tensor < ? x ? xf32 > <nl> + / / CHECK : return % [ [ RESULT ] ] : tensor < ? x ? xf32 > <nl> + } <nl>
|
Add transformations for TFLite :
|
tensorflow/tensorflow
|
907e90035b3aa217a6dd65a8b30b68e8950ecc2a
|
2020-04-30T20:25:24Z
|
mmm a / ChangeLog <nl> ppp b / ChangeLog <nl> <nl> + 2009 - 05 - 31 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> + <nl> + Added test case for XmlRpcProcessor to fail to parse malformed <nl> + document . <nl> + * test / XmlRpcRequestProcessorTest . cc <nl> + <nl> 2009 - 05 - 30 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> <nl> Removed * . gmo files in po because they are generated on ' make <nl> mmm a / test / XmlRpcRequestProcessorTest . cc <nl> ppp b / test / XmlRpcRequestProcessorTest . cc <nl> class XmlRpcRequestProcessorTest : public CppUnit : : TestFixture { <nl> <nl> CPPUNIT_TEST_SUITE ( XmlRpcRequestProcessorTest ) ; <nl> CPPUNIT_TEST ( testParseMemory ) ; <nl> + CPPUNIT_TEST ( testParseMemory_shouldFail ) ; <nl> CPPUNIT_TEST_SUITE_END ( ) ; <nl> public : <nl> void setUp ( ) { } <nl> class XmlRpcRequestProcessorTest : public CppUnit : : TestFixture { <nl> void tearDown ( ) { } <nl> <nl> void testParseMemory ( ) ; <nl> + void testParseMemory_shouldFail ( ) ; <nl> } ; <nl> <nl> <nl> void XmlRpcRequestProcessorTest : : testParseMemory ( ) <nl> CPPUNIT_ASSERT_EQUAL ( std : : string ( " hello world " ) , req . _params [ 2 ] [ 1 ] . s ( ) ) ; <nl> } <nl> <nl> + void XmlRpcRequestProcessorTest : : testParseMemory_shouldFail ( ) <nl> + { <nl> + XmlRpcRequestProcessor proc ; <nl> + try { <nl> + proc . parseMemory ( " < methodCall > " <nl> + " < methodName > aria2 . addURI < / methodName > " <nl> + " < params > " <nl> + " < param > " <nl> + " < value > < i4 > 100 < / i4 > < / value > " <nl> + " < / param > " ) ; <nl> + CPPUNIT_FAIL ( " exception must be thrown . " ) ; <nl> + } catch ( RecoverableException & e ) { <nl> + / / success <nl> + } <nl> + } <nl> + <nl> } / / namespace xmlrpc <nl> <nl> } / / namespace aria2 <nl>
|
2009 - 05 - 31 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net >
|
aria2/aria2
|
0373ae325e4358fda12673564ad291473dec5c85
|
2009-05-31T08:02:42Z
|
mmm a / dbms / include / DB / Interpreters / Aggregator . h <nl> ppp b / dbms / include / DB / Interpreters / Aggregator . h <nl> struct AggregationMethodOneNumber <nl> <nl> Data data ; <nl> <nl> - const ColumnVector < FieldType > * column ; <nl> + const FieldType * column ; <nl> <nl> / * * Вызывается в начале обработки каждого блока . <nl> * Устанавливает переменные , необходимые для остальных методов , вызываемых во внутренних циклах . <nl> * / <nl> void init ( ConstColumnPlainPtrs & key_columns ) <nl> { <nl> - column = static_cast < const ColumnVector < FieldType > * > ( key_columns [ 0 ] ) ; <nl> + column = & static_cast < const ColumnVector < FieldType > * > ( key_columns [ 0 ] ) - > getData ( ) [ 0 ] ; <nl> } <nl> <nl> / / / Достать из ключевых столбцов ключ для вставки в хэш - таблицу . <nl> struct AggregationMethodOneNumber <nl> const Sizes & key_sizes , / / / Если ключи фиксированной длины - их длины . Не используется в методах агрегации по ключам переменной длины . <nl> StringRefs & keys ) const / / / Сюда могут быть записаны ссылки на данные ключей в столбцах . Они могут быть использованы в дальнейшем . <nl> { <nl> - return column - > get64 ( i ) ; <nl> + return get64 ( column [ i ] ) ; <nl> } <nl> <nl> / / / Из значения в хэш - таблице получить AggregateDataPtr . <nl> struct AggregationMethodOneNumber <nl> { <nl> static_cast < ColumnVector < FieldType > * > ( key_columns [ 0 ] ) - > insertData ( reinterpret_cast < const char * > ( & it - > first ) , sizeof ( it - > first ) ) ; <nl> } <nl> + <nl> + private : <nl> + UInt64 get64 ( FieldType x ) const <nl> + { <nl> + return x ; <nl> + } <nl> } ; <nl> <nl> + template < > <nl> + inline UInt64 AggregationMethodOneNumber < Float64 > : : get64 ( Float64 x ) const <nl> + { <nl> + union <nl> + { <nl> + Float64 src ; <nl> + UInt64 res ; <nl> + } ; <nl> + <nl> + src = x ; <nl> + return res ; <nl> + } <nl> + <nl> + template < > <nl> + inline UInt64 AggregationMethodOneNumber < Float32 > : : get64 ( Float32 x ) const <nl> + { <nl> + union <nl> + { <nl> + Float32 src ; <nl> + UInt64 res ; <nl> + } ; <nl> + <nl> + res = 0 ; <nl> + src = x ; <nl> + return res ; <nl> + } <nl> + <nl> <nl> / / / Для случая , когда есть один строковый ключ . <nl> struct AggregationMethodString <nl>
|
dbms : tiny improvement [ # METR - 2944 ] .
|
ClickHouse/ClickHouse
|
ec08b393dec6f513f13bcc8654055dea7069dc8b
|
2014-10-31T23:20:18Z
|
mmm a / cocos2dx / proj . marmalade / cocos2dx . mkf <nl> ppp b / cocos2dx / proj . marmalade / cocos2dx . mkf <nl> files <nl> [ particle_nodes ] <nl> " * . h " <nl> " * . cpp " <nl> - <nl> - ( " . . / physics_nodes " ) <nl> - [ physics_nodes ] <nl> - " * . h " <nl> - " * . cpp " <nl> - <nl> + <nl> ( " . . / platform " ) <nl> [ platforms ] <nl> " * . h " <nl>
|
remove physics_nodes from marmalade
|
cocos2d/cocos2d-x
|
db883f4efc1d847ac60f29ccc9b7de09525f30c0
|
2012-11-21T20:34:33Z
|
mmm a / torch / csrc / jit / script / schema_matching . cpp <nl> ppp b / torch / csrc / jit / script / schema_matching . cpp <nl> namespace torch { <nl> namespace jit { <nl> namespace script { <nl> <nl> - inline TypePtr unwrapOptional ( TypePtr opt_type ) { <nl> + static inline TypePtr unwrapOptional ( TypePtr opt_type ) { <nl> if ( auto unwrap_list_type = opt_type - > cast < OptionalType > ( ) ) { <nl> return unwrap_list_type - > getElementType ( ) ; <nl> } <nl> Value * tryConvertToType ( <nl> / / VarType , it will be added to the type_env through ` matchTypeVariables ` as <nl> / / the corresponding actual type . If ` allow_conversions ` is true , implicit <nl> / / conversions to the ` arg ` type may be performed through ` tryConvertToType ` . <nl> - Value * tryMatchArgument ( <nl> + static Value * tryMatchArgument ( <nl> const Argument & arg , <nl> Graph & graph , <nl> const SourceRange & loc , <nl> c10 : : optional < size_t > findInputWithName ( <nl> / / / ` elem_type ` , nullptr is returned . This is used for creating lists from <nl> / / / varargs so that calls like torch . zeros ( 1 , 2 , 3 ) will be matched to <nl> / / / aten : : zeros ( int [ ] ) . <nl> - Value * tryCreateList ( <nl> + static Value * tryCreateList ( <nl> const TypePtr & elem_type , <nl> Graph & graph , <nl> const SourceRange & loc , <nl> Value * tryCreateList ( <nl> / / Check if it is possible to convert all the remaining non - kwarg arguments <nl> / / to a list . This allows zeros ( IntArrayRef sizes ) to work with zeros ( 1 , 2 ) or <nl> / / zeros ( 1 ) <nl> - bool varargsCanBeUsedAsList ( <nl> + static bool varargsCanBeUsedAsList ( <nl> const FunctionSchema & schema , <nl> size_t arg_index , <nl> const Argument & arg ) { <nl> c10 : : optional < MatchedSchema > tryMatchSchema ( <nl> <nl> / / pack outputs of a function following python rules . If there is a single value <nl> / / return a SimpleValue , otherwise pack all the values into a Tuple . <nl> - Value * packOutputs ( <nl> + static Value * packOutputs ( <nl> Graph & g , <nl> at : : ArrayRef < Value * > values , <nl> c10 : : OptNameList field_names ) { <nl>
|
schema_matching . cpp : mark internal functions as static . ( )
|
pytorch/pytorch
|
b12a5f61552070ea1ad04d64b49ca26c44dc0196
|
2019-05-31T23:40:16Z
|
mmm a / main . c <nl> ppp b / main . c <nl> static bool read_response ( w_jbuffer_t * reader , int fd ) <nl> / / Just pass through what we get from the server . <nl> / / We use the buffer space from reader . <nl> int x ; <nl> + size_t res ; <nl> + char * buf ; <nl> + bool is_done = false ; <nl> <nl> - while ( true ) { <nl> + while ( ! is_done ) { <nl> x = read ( fd , reader - > buf , reader - > allocd ) ; <nl> if ( x < = 0 ) { <nl> return true ; <nl> } <nl> - fwrite ( reader - > buf , 1 , x , stdout ) ; <nl> + <nl> if ( memchr ( reader - > buf , ' \ n ' , x ) ) { <nl> - return true ; <nl> + is_done = true ; <nl> + } <nl> + <nl> + buf = reader - > buf ; <nl> + while ( x > 0 ) { <nl> + res = fwrite ( buf , 1 , x , stdout ) ; <nl> + if ( res = = 0 ) { <nl> + break ; <nl> + } <nl> + buf + = res ; <nl> + x - = res ; <nl> } <nl> } <nl> + <nl> + return true ; <nl> } <nl> <nl> j = w_json_buffer_next ( reader , fd , & jerr ) ; <nl> mmm a / query / since . c <nl> ppp b / query / since . c <nl> static bool eval_since ( struct w_query_ctx * ctx , <nl> { <nl> struct since_term * term = data ; <nl> w_clock_t clock ; <nl> - time_t tval ; <nl> + time_t tval = 0 ; <nl> <nl> unused_parameter ( ctx ) ; <nl> <nl>
|
Fixup no - pretty output case
|
facebook/watchman
|
1945489c03639cb5e25b8f7720fb270acb7d36a5
|
2013-02-15T21:37:30Z
|
mmm a / src / main . cpp <nl> ppp b / src / main . cpp <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv ) <nl> if ( fDebugNet | | ( vInv . size ( ) ! = 1 ) ) <nl> printf ( " received getdata ( % " PRIszu " invsz ) \ n " , vInv . size ( ) ) ; <nl> <nl> + vector < CInv > vNotFound ; <nl> BOOST_FOREACH ( const CInv & inv , vInv ) <nl> { <nl> if ( fShutdown ) <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv ) <nl> ss . reserve ( 1000 ) ; <nl> ss < < tx ; <nl> pfrom - > PushMessage ( " tx " , ss ) ; <nl> + pushed = true ; <nl> } <nl> } <nl> + if ( ! pushed ) { <nl> + vNotFound . push_back ( inv ) ; <nl> + } <nl> } <nl> <nl> - / / Track requests for our stuff <nl> + / / Track requests for our stuff . <nl> Inventory ( inv . hash ) ; <nl> + <nl> + if ( ! vNotFound . empty ( ) ) { <nl> + / / Let the peer know that we didn ' t find what it asked for , so it doesn ' t <nl> + / / have to wait around forever . Currently only SPV clients actually care <nl> + / / about this message : it ' s needed when they are recursively walking the <nl> + / / dependencies of relevant unconfirmed transactions . SPV clients want to <nl> + / / do that because they want to know about ( and store and rebroadcast and <nl> + / / risk analyze ) the dependencies of transactions relevant to them , without <nl> + / / having to download the entire memory pool . <nl> + pfrom - > PushMessage ( " notfound " , vNotFound ) ; <nl> + } <nl> } <nl> } <nl> <nl>
|
Merge pull request from mikehearn / notfoundmsg
|
bitcoin/bitcoin
|
a337505bd7d0791fa1123c600ea9295cafa678b3
|
2013-01-23T14:48:57Z
|
mmm a / lib / ClangImporter / ImportDecl . cpp <nl> ppp b / lib / ClangImporter / ImportDecl . cpp <nl> namespace { <nl> AccessLevel : : Public , Loc , name , Loc , None , nullptr , dc ) ; <nl> structDecl - > computeType ( ) ; <nl> structDecl - > setCheckedInheritanceClause ( ) ; <nl> + structDecl - > setAddedImplicitInitializers ( ) ; <nl> <nl> auto options = getDefaultMakeStructRawValuedOptions ( ) ; <nl> options | = MakeStructRawValuedFlags : : MakeUnlabeledValueInit ; <nl> namespace { <nl> errorWrapper = new ( C ) StructDecl ( loc , name , loc , None , nullptr , dc ) ; <nl> errorWrapper - > computeType ( ) ; <nl> errorWrapper - > setValidationStarted ( ) ; <nl> + errorWrapper - > setAddedImplicitInitializers ( ) ; <nl> errorWrapper - > setAccess ( AccessLevel : : Public ) ; <nl> errorWrapper - > getAttrs ( ) . add ( <nl> new ( Impl . SwiftContext ) FixedLayoutAttr ( / * IsImplicit * / true ) ) ; <nl> namespace { <nl> Impl . importSourceLoc ( decl - > getLocation ( ) ) , <nl> None , nullptr , dc ) ; <nl> result - > computeType ( ) ; <nl> + result - > setAddedImplicitInitializers ( ) ; <nl> Impl . ImportedDecls [ { decl - > getCanonicalDecl ( ) , getVersion ( ) } ] = result ; <nl> <nl> / / FIXME : Figure out what to do with superclasses in C + + . One possible <nl> SwiftDeclConverter : : importSwiftNewtype ( const clang : : TypedefNameDecl * decl , <nl> decl , AccessLevel : : Public , Loc , name , Loc , None , nullptr , dc ) ; <nl> structDecl - > computeType ( ) ; <nl> structDecl - > setCheckedInheritanceClause ( ) ; <nl> + structDecl - > setAddedImplicitInitializers ( ) ; <nl> <nl> / / Import the type of the underlying storage <nl> auto storedUnderlyingType = Impl . importTypeIgnoreIUO ( <nl> SwiftDeclConverter : : importAsOptionSetType ( DeclContext * dc , Identifier name , <nl> decl , AccessLevel : : Public , Loc , name , Loc , None , nullptr , dc ) ; <nl> structDecl - > computeType ( ) ; <nl> structDecl - > setCheckedInheritanceClause ( ) ; <nl> + structDecl - > setAddedImplicitInitializers ( ) ; <nl> <nl> makeStructRawValued ( Impl , structDecl , underlyingType , <nl> { KnownProtocolKind : : OptionSet } ) ; <nl> mmm a / lib / Sema / TypeCheckDecl . cpp <nl> ppp b / lib / Sema / TypeCheckDecl . cpp <nl> void TypeChecker : : synthesizeMemberForLookup ( NominalTypeDecl * target , <nl> } <nl> } <nl> <nl> - void TypeChecker : : addImplicitStructConformances ( StructDecl * SD ) { <nl> - / / Type - check the protocol conformances of the struct decl to instantiate its <nl> - / / derived conformances . <nl> - checkConformancesInContext ( SD , SD ) ; <nl> - } <nl> - <nl> - void TypeChecker : : addImplicitEnumConformances ( EnumDecl * ED ) { <nl> - / / Type - check the raw values of the enum . <nl> - for ( auto elt : ED - > getAllElements ( ) ) { <nl> - assert ( elt - > hasRawValueExpr ( ) ) ; <nl> - if ( elt - > getTypeCheckedRawValueExpr ( ) ) continue ; <nl> - Expr * typeChecked = elt - > getRawValueExpr ( ) ; <nl> - Type rawTy = ED - > mapTypeIntoContext ( ED - > getRawType ( ) ) ; <nl> - auto resultTy = typeCheckExpression ( <nl> - typeChecked , ED , TypeLoc : : withoutLoc ( rawTy ) , CTP_EnumCaseRawValue ) ; <nl> - assert ( resultTy ) ; <nl> - ( void ) resultTy ; <nl> - elt - > setTypeCheckedRawValueExpr ( typeChecked ) ; <nl> - checkEnumElementErrorHandling ( elt ) ; <nl> - } <nl> - <nl> - / / Type - check the protocol conformances of the enum decl to instantiate its <nl> - / / derived conformances . <nl> - checkConformancesInContext ( ED , ED ) ; <nl> - } <nl> - <nl> void TypeChecker : : defineDefaultConstructor ( NominalTypeDecl * decl ) { <nl> PrettyStackTraceDecl stackTrace ( " defining default constructor for " , <nl> decl ) ; <nl> mmm a / lib / Sema / TypeChecker . cpp <nl> ppp b / lib / Sema / TypeChecker . cpp <nl> TypeChecker : : ~ TypeChecker ( ) { <nl> Context . setLazyResolver ( nullptr ) ; <nl> } <nl> <nl> - void TypeChecker : : handleExternalDecl ( Decl * decl ) { <nl> - if ( auto SD = dyn_cast < StructDecl > ( decl ) ) { <nl> - addImplicitStructConformances ( SD ) ; <nl> - } <nl> - if ( auto CD = dyn_cast < ClassDecl > ( decl ) ) { <nl> - CD - > addImplicitDestructor ( ) ; <nl> - } <nl> - if ( auto ED = dyn_cast < EnumDecl > ( decl ) ) { <nl> - addImplicitEnumConformances ( ED ) ; <nl> - } <nl> - } <nl> - <nl> ProtocolDecl * TypeChecker : : getProtocol ( SourceLoc loc , KnownProtocolKind kind ) { <nl> auto protocol = Context . getProtocol ( kind ) ; <nl> if ( ! protocol & & loc . isValid ( ) ) { <nl> static void typeCheckFunctionsAndExternalDecls ( SourceFile & SF , TypeChecker & TC ) <nl> TC . checkFunctionErrorHandling ( AFD ) ; <nl> continue ; <nl> } <nl> - if ( isa < NominalTypeDecl > ( decl ) ) { <nl> - TC . handleExternalDecl ( decl ) ; <nl> + if ( isa < NominalTypeDecl > ( decl ) ) <nl> continue ; <nl> - } <nl> if ( isa < VarDecl > ( decl ) ) <nl> continue ; <nl> llvm_unreachable ( " Unhandled external definition kind " ) ; <nl> mmm a / lib / Sema / TypeChecker . h <nl> ppp b / lib / Sema / TypeChecker . h <nl> class TypeChecker final : public LazyResolver { <nl> / / / struct or class . <nl> void addImplicitConstructors ( NominalTypeDecl * typeDecl ) ; <nl> <nl> - / / / \ brief Add the RawOptionSet ( todo : , Equatable , and Hashable ) methods to an <nl> - / / / imported NS_OPTIONS struct . <nl> - void addImplicitStructConformances ( StructDecl * ED ) ; <nl> - <nl> - / / / \ brief Add the RawRepresentable , Equatable , and Hashable methods to an <nl> - / / / enum with a raw type . <nl> - void addImplicitEnumConformances ( EnumDecl * ED ) ; <nl> - <nl> / / / Synthesize the member with the given name on the target if applicable , <nl> / / / i . e . if the member is synthesizable and has not yet been added to the <nl> / / / target . <nl> class TypeChecker final : public LazyResolver { <nl> / / / we ' re parsing the standard library . <nl> ModuleDecl * getStdlibModule ( const DeclContext * dc ) ; <nl> <nl> - / / / \ name AST Mutation Listener Implementation <nl> - / / / @ { <nl> - void handleExternalDecl ( Decl * decl ) ; <nl> - <nl> - / / / @ } <nl> - <nl> / / / \ name Lazy resolution . <nl> / / / <nl> / / / Routines that perform lazy resolution as required for AST operations . <nl>
|
Merge pull request from slavapestov / sema - external - declarations
|
apple/swift
|
107849a33aa2aa5ff7c8ae9f5237c99bc6c67f07
|
2018-04-20T03:58:18Z
|
mmm a / tensorflow / tools / ci_build / ci_build . sh <nl> ppp b / tensorflow / tools / ci_build / ci_build . sh <nl> mkdir - p $ { WORKSPACE } / bazel - ci_build - cache <nl> $ { DOCKER_BINARY } run - - rm - - pid = host \ <nl> - v $ { WORKSPACE } / bazel - ci_build - cache : $ { WORKSPACE } / bazel - ci_build - cache \ <nl> - e " CI_BUILD_HOME = $ { WORKSPACE } / bazel - ci_build - cache " \ <nl> - - e " CI_BUILD_USER = $ ( id - u - - name ) " \ <nl> + - e " CI_BUILD_USER = $ ( id - u - n ) " \ <nl> - e " CI_BUILD_UID = $ ( id - u ) " \ <nl> - - e " CI_BUILD_GROUP = $ ( id - g - - name ) " \ <nl> + - e " CI_BUILD_GROUP = $ ( id - g - n ) " \ <nl> - e " CI_BUILD_GID = $ ( id - g ) " \ <nl> - e " CI_TENSORFLOW_SUBMODULE_PATH = $ { CI_TENSORFLOW_SUBMODULE_PATH } " \ <nl> - v $ { WORKSPACE } : / workspace \ <nl>
|
fixes
|
tensorflow/tensorflow
|
7544aeec4886e430690f2ef5a44d04cacf2e44cd
|
2016-11-22T12:57:34Z
|
mmm a / tensorflow / python / keras / layers / lstm_test . py <nl> ppp b / tensorflow / python / keras / layers / lstm_test . py <nl> <nl> <nl> from tensorflow . python import keras <nl> from tensorflow . python . framework import test_util as tf_test_util <nl> + from tensorflow . python . keras import keras_parameterized <nl> from tensorflow . python . keras import testing_utils <nl> from tensorflow . python . platform import test <nl> from tensorflow . python . training import adam <nl> <nl> from tensorflow . python . training . rmsprop import RMSPropOptimizer <nl> <nl> <nl> - @ tf_test_util . run_all_in_graph_and_eager_modes <nl> - class LSTMLayerTest ( test . TestCase , parameterized . TestCase ) : <nl> + @ keras_parameterized . run_all_keras_modes <nl> + class LSTMLayerTest ( keras_parameterized . TestCase ) : <nl> <nl> def test_return_sequences_LSTM ( self ) : <nl> num_samples = 2 <nl> def test_dynamic_behavior_LSTM ( self ) : <nl> layer = keras . layers . LSTM ( units , input_shape = ( None , embedding_dim ) ) <nl> model = keras . models . Sequential ( ) <nl> model . add ( layer ) <nl> - model . compile ( RMSPropOptimizer ( 0 . 001 ) , ' mse ' ) <nl> + model . compile ( RMSPropOptimizer ( 0 . 001 ) , ' mse ' , <nl> + run_eagerly = testing_utils . should_run_eagerly ( ) ) <nl> + <nl> x = np . random . random ( ( num_samples , timesteps , embedding_dim ) ) <nl> y = np . random . random ( ( num_samples , units ) ) <nl> model . train_on_batch ( x , y ) <nl> def test_constraints_LSTM ( self ) : <nl> self . assertEqual ( layer . cell . recurrent_kernel . constraint , r_constraint ) <nl> self . assertEqual ( layer . cell . bias . constraint , b_constraint ) <nl> <nl> - @ tf_test_util . run_v1_only ( ' b / 120545219 ' ) <nl> def test_with_masking_layer_LSTM ( self ) : <nl> layer_class = keras . layers . LSTM <nl> inputs = np . random . random ( ( 2 , 3 , 4 ) ) <nl> def test_with_masking_layer_LSTM ( self ) : <nl> model . add ( keras . layers . Masking ( input_shape = ( 3 , 4 ) ) ) <nl> model . add ( layer_class ( units = 5 , return_sequences = True , unroll = False ) ) <nl> model . compile ( loss = ' categorical_crossentropy ' , <nl> - optimizer = RMSPropOptimizer ( 0 . 01 ) ) <nl> + optimizer = RMSPropOptimizer ( 0 . 01 ) , <nl> + run_eagerly = testing_utils . should_run_eagerly ( ) ) <nl> model . fit ( inputs , targets , epochs = 1 , batch_size = 2 , verbose = 1 ) <nl> <nl> - @ tf_test_util . run_v1_only ( ' b / 120545219 ' ) <nl> def test_masking_with_stacking_LSTM ( self ) : <nl> inputs = np . random . random ( ( 2 , 3 , 4 ) ) <nl> targets = np . abs ( np . random . random ( ( 2 , 3 , 5 ) ) ) <nl> def test_masking_with_stacking_LSTM ( self ) : <nl> lstm_cells = [ keras . layers . LSTMCell ( 10 ) , keras . layers . LSTMCell ( 5 ) ] <nl> model . add ( keras . layers . RNN ( lstm_cells , return_sequences = True , unroll = False ) ) <nl> model . compile ( loss = ' categorical_crossentropy ' , <nl> - optimizer = RMSPropOptimizer ( 0 . 01 ) ) <nl> + optimizer = RMSPropOptimizer ( 0 . 01 ) , <nl> + run_eagerly = testing_utils . should_run_eagerly ( ) ) <nl> model . fit ( inputs , targets , epochs = 1 , batch_size = 2 , verbose = 1 ) <nl> <nl> def test_from_config_LSTM ( self ) : <nl> def test_specify_initial_state_keras_tensor ( self ) : <nl> <nl> model = keras . models . Model ( [ inputs ] + initial_state , output ) <nl> model . compile ( loss = ' categorical_crossentropy ' , <nl> - optimizer = adam . AdamOptimizer ( ) ) <nl> + optimizer = adam . AdamOptimizer ( ) , <nl> + run_eagerly = testing_utils . should_run_eagerly ( ) ) <nl> <nl> inputs = np . random . random ( ( num_samples , timesteps , embedding_dim ) ) <nl> initial_state = [ np . random . random ( ( num_samples , units ) ) <nl> def test_specify_initial_state_non_keras_tensor ( self ) : <nl> <nl> model = keras . models . Model ( inputs , output ) <nl> model . compile ( loss = ' categorical_crossentropy ' , <nl> - optimizer = adam . AdamOptimizer ( ) ) <nl> + optimizer = adam . AdamOptimizer ( ) , <nl> + run_eagerly = testing_utils . should_run_eagerly ( ) ) <nl> <nl> inputs = np . random . random ( ( num_samples , timesteps , embedding_dim ) ) <nl> targets = np . random . random ( ( num_samples , units ) ) <nl> def test_specify_state_with_masking ( self ) : <nl> <nl> model = keras . models . Model ( [ inputs ] + initial_state , output ) <nl> model . compile ( loss = ' categorical_crossentropy ' , <nl> - optimizer = RMSPropOptimizer ( 0 . 01 ) ) <nl> + optimizer = RMSPropOptimizer ( 0 . 01 ) , <nl> + run_eagerly = testing_utils . should_run_eagerly ( ) ) <nl> <nl> inputs = np . random . random ( ( num_samples , timesteps , embedding_dim ) ) <nl> initial_state = [ np . random . random ( ( num_samples , units ) ) <nl> def test_initial_states_as_other_inputs ( self ) : <nl> <nl> model = keras . models . Model ( inputs , output ) <nl> model . compile ( loss = ' categorical_crossentropy ' , <nl> - optimizer = adam . AdamOptimizer ( ) ) <nl> + optimizer = adam . AdamOptimizer ( ) , <nl> + run_eagerly = testing_utils . should_run_eagerly ( ) ) <nl> <nl> main_inputs = np . random . random ( ( num_samples , timesteps , embedding_dim ) ) <nl> initial_state = [ np . random . random ( ( num_samples , units ) ) <nl> def test_statefulness_LSTM ( self ) : <nl> <nl> self . assertAllClose ( out7 , out6 , atol = 1e - 5 ) <nl> <nl> + # b / 120919032 <nl> @ tf_test_util . run_deprecated_v1 <nl> def test_regularizers_LSTM ( self ) : <nl> embedding_dim = 4 <nl> layer_class = keras . layers . LSTM <nl> - with self . cached_session ( ) : <nl> - layer = layer_class ( <nl> - 5 , <nl> - return_sequences = False , <nl> - weights = None , <nl> - input_shape = ( None , embedding_dim ) , <nl> - kernel_regularizer = keras . regularizers . l1 ( 0 . 01 ) , <nl> - recurrent_regularizer = keras . regularizers . l1 ( 0 . 01 ) , <nl> - bias_regularizer = ' l2 ' , <nl> - activity_regularizer = ' l1 ' ) <nl> - layer . build ( ( None , None , 2 ) ) <nl> - self . assertEqual ( len ( layer . losses ) , 3 ) <nl> - x = keras . backend . variable ( np . ones ( ( 2 , 3 , 2 ) ) ) <nl> - layer ( x ) <nl> - self . assertEqual ( len ( layer . get_losses_for ( x ) ) , 1 ) <nl> + layer = layer_class ( <nl> + 5 , <nl> + return_sequences = False , <nl> + weights = None , <nl> + input_shape = ( None , embedding_dim ) , <nl> + kernel_regularizer = keras . regularizers . l1 ( 0 . 01 ) , <nl> + recurrent_regularizer = keras . regularizers . l1 ( 0 . 01 ) , <nl> + bias_regularizer = ' l2 ' , <nl> + activity_regularizer = ' l1 ' ) <nl> + layer . build ( ( None , None , 2 ) ) <nl> + self . assertEqual ( len ( layer . losses ) , 3 ) <nl> + x = keras . backend . variable ( np . ones ( ( 2 , 3 , 2 ) ) ) <nl> + layer ( x ) <nl> + self . assertEqual ( len ( layer . get_losses_for ( x ) ) , 1 ) <nl> <nl> if __name__ = = ' __main__ ' : <nl> test . main ( ) <nl>
|
Enable v2 mode for lstm_test .
|
tensorflow/tensorflow
|
4637671e4e6e3f88fc8f5b92538bfb813f3da682
|
2018-12-13T02:17:49Z
|
mmm a / mypy . ini <nl> ppp b / mypy . ini <nl> ignore_errors = True <nl> [ mypy - torch . cuda . comm ] <nl> ignore_errors = True <nl> <nl> - [ mypy - torch . cuda . memory ] <nl> - ignore_errors = True <nl> - <nl> [ mypy - torch . cuda . nccl ] <nl> ignore_errors = True <nl> <nl> mmm a / torch / _C / __init__ . pyi . in <nl> ppp b / torch / _C / __init__ . pyi . in <nl> <nl> <nl> import torch <nl> from torch import Tensor <nl> - from typing import ( Any , BinaryIO , Callable , ContextManager , Iterator , List , NamedTuple , <nl> + from typing import ( Any , BinaryIO , Callable , ContextManager , Dict , Iterator , List , NamedTuple , <nl> Optional , overload , Sequence , Tuple , TypeVar , Type , Union ) <nl> from torch . _six import inf <nl> <nl> class _TensorBase ( object ) : <nl> $ { tensor_method_hints } <nl> <nl> # Defined in torch / csrc / cuda / Module . cpp <nl> + def _cuda_getCurrentStream ( device : _int ) - > _int : . . . <nl> + def _cuda_getDefaultStream ( device : _int ) - > _int : . . . <nl> + def _cuda_getCurrentBlasHandle ( ) - > _int : . . . <nl> + def _cuda_setStream ( cuda_stream : _int ) - > None : . . . <nl> + def _cuda_getCompiledVersion ( ) - > _int : . . . <nl> + def _cuda_cudaHostAllocator ( ) - > _int : . . . <nl> + def _cuda_cudaCachingAllocator_raw_alloc ( size : _int , cuda_stream : _int ) - > _int : . . . <nl> + def _cuda_cudaCachingAllocator_raw_delete ( ptr : _int ) - > None : . . . <nl> + def _cuda_emptyCache ( ) - > None : . . . <nl> + def _cuda_memoryStats ( device : _int ) - > Dict [ str , Any ] : . . . <nl> + def _cuda_resetAccumulatedMemoryStats ( device : _int ) - > None : . . . <nl> + def _cuda_resetPeakMemoryStats ( device : _int ) - > None : . . . <nl> + def _cuda_memorySnapshot ( ) - > List [ Dict [ str , Any ] ] : . . . <nl> + def _cuda_lock_mutex ( ) - > None : . . . <nl> + def _cuda_unlock_mutex ( ) - > None : . . . <nl> + def _nccl_version ( ) - > _int : . . . <nl> + def _nccl_unique_id ( ) - > bytes : . . . <nl> + <nl> class _CudaDeviceProperties : <nl> name : str <nl> major : _int <nl> mmm a / torch / cuda / memory . py <nl> ppp b / torch / cuda / memory . py <nl> <nl> from typing import Any , Dict , Union <nl> <nl> import torch <nl> - from . import is_initialized , _get_device_index <nl> + from . import is_initialized , _get_device_index , _lazy_init <nl> from torch . types import Device <nl> <nl> def _host_allocator ( ) : <nl> def caching_allocator_alloc ( size , device : Union [ Device , int ] = None , stream = None <nl> <nl> Arguments : <nl> size ( int ) : number of bytes to be allocated . <nl> - device ( torch . device or int , optional ) : selected device . If it is <nl> + device ( torch . device or int , optional ) : selected device . If it is <nl> ` ` None ` ` the default CUDA device is used . <nl> stream ( torch . cuda . Stream or int , optional ) : selected stream . If is ` ` None ` ` then <nl> the default stream for the selected device is used . <nl>
|
Enable torch . cuda . memory typechecking ( )
|
pytorch/pytorch
|
0fa99d50bcc2fbe9ebc0babbf8c591fa2c071b01
|
2020-08-24T18:46:04Z
|
mmm a / python / mxnet / __init__ . py <nl> ppp b / python / mxnet / __init__ . py <nl> <nl> from . import torch <nl> from . import torch as th <nl> <nl> + from . import mod <nl> + <nl> __version__ = base . __version__ <nl> mmm a / python / mxnet / executor_manager . py <nl> ppp b / python / mxnet / executor_manager . py <nl> def _bind_exec ( sym , ctx , input_shapes , param_names , need_grad = False , <nl> <nl> # create or borrow aux variables <nl> if base_exec is None : <nl> - aux_arrays = [ nd . zeros ( s , ctx , dtype = t ) for s , t in zip ( aux_shape , arg_types ) ] <nl> + aux_arrays = [ nd . zeros ( s , ctx , dtype = t ) for s , t in zip ( aux_shape , aux_types ) ] <nl> else : <nl> for i , a in enumerate ( base_exec . aux_arrays ) : <nl> assert aux_shape [ i ] = = a . shape <nl>
|
fix typo
|
apache/incubator-mxnet
|
34c9e3f631cf92949558f118acb3b06b213cfe3c
|
2016-04-12T01:35:36Z
|
mmm a / Marlin / Configuration_adv . h <nl> ppp b / Marlin / Configuration_adv . h <nl> const unsigned int dropsegments = 5 ; / / everything with less than this number of st <nl> # ifdef FWRETRACT <nl> # define MIN_RETRACT 0 . 1 / / minimum extruded mm to accept a automatic gcode retraction attempt <nl> # define RETRACT_LENGTH 3 / / default retract length ( positive mm ) <nl> + # define RETRACT_LENGTH_SWAP 13 / / default swap retract length ( positive mm ) , for extruder change <nl> # define RETRACT_FEEDRATE 45 / / default feedrate for retracting ( mm / s ) <nl> # define RETRACT_ZLIFT 0 / / default retract Z - lift <nl> # define RETRACT_RECOVER_LENGTH 0 / / default additional recover length ( mm , added to retract length when recovering ) <nl> + # define RETRACT_RECOVER_LENGTH_SWAP 0 / / default additional swap recover length ( mm , added to retract length when recovering from extruder change ) <nl> # define RETRACT_RECOVER_FEEDRATE 8 / / default feedrate for recovering from retraction ( mm / s ) <nl> # endif <nl> <nl> mmm a / Marlin / Marlin . h <nl> ppp b / Marlin / Marlin . h <nl> extern unsigned char fanSpeedSoftPwm ; <nl> <nl> # ifdef FWRETRACT <nl> extern bool autoretract_enabled ; <nl> - extern bool retracted ; <nl> - extern float retract_length , retract_feedrate , retract_zlift ; <nl> - extern float retract_recover_length , retract_recover_feedrate ; <nl> + extern bool retracted [ EXTRUDERS ] ; <nl> + extern float retract_length , retract_length_swap , retract_feedrate , retract_zlift ; <nl> + extern float retract_recover_length , retract_recover_length_swap , retract_recover_feedrate ; <nl> # endif <nl> <nl> extern unsigned long starttime ; <nl> mmm a / Marlin / Marlin_main . cpp <nl> ppp b / Marlin / Marlin_main . cpp <nl> int EtoPPressure = 0 ; <nl> <nl> # ifdef FWRETRACT <nl> bool autoretract_enabled = false ; <nl> - bool retracted = false ; <nl> + bool retracted [ EXTRUDERS ] = { false <nl> + # if EXTRUDERS > 1 <nl> + , false <nl> + # if EXTRUDERS > 2 <nl> + , false <nl> + # endif <nl> + # endif <nl> + } ; <nl> + bool retracted_swap [ EXTRUDERS ] = { false <nl> + # if EXTRUDERS > 1 <nl> + , false <nl> + # if EXTRUDERS > 2 <nl> + , false <nl> + # endif <nl> + # endif <nl> + } ; <nl> + <nl> float retract_length = RETRACT_LENGTH ; <nl> + float retract_length_swap = RETRACT_LENGTH_SWAP ; <nl> float retract_feedrate = RETRACT_FEEDRATE ; <nl> float retract_zlift = RETRACT_ZLIFT ; <nl> float retract_recover_length = RETRACT_RECOVER_LENGTH ; <nl> + float retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP ; <nl> float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE ; <nl> # endif <nl> <nl> void refresh_cmd_timeout ( void ) <nl> } <nl> <nl> # ifdef FWRETRACT <nl> - void retract ( bool retracting ) { <nl> - if ( retracting & & ! retracted ) { <nl> + void retract ( bool retracting , bool swapretract = false ) { <nl> + if ( retracting & & ! retracted [ active_extruder ] ) { <nl> destination [ X_AXIS ] = current_position [ X_AXIS ] ; <nl> destination [ Y_AXIS ] = current_position [ Y_AXIS ] ; <nl> destination [ Z_AXIS ] = current_position [ Z_AXIS ] ; <nl> destination [ E_AXIS ] = current_position [ E_AXIS ] ; <nl> - current_position [ E_AXIS ] + = retract_length / volumetric_multiplier [ active_extruder ] ; <nl> + if ( swapretract ) { <nl> + current_position [ E_AXIS ] + = retract_length_swap / volumetric_multiplier [ active_extruder ] ; <nl> + } else { <nl> + current_position [ E_AXIS ] + = retract_length / volumetric_multiplier [ active_extruder ] ; <nl> + } <nl> plan_set_e_position ( current_position [ E_AXIS ] ) ; <nl> float oldFeedrate = feedrate ; <nl> feedrate = retract_feedrate * 60 ; <nl> - retracted = true ; <nl> + retracted [ active_extruder ] = true ; <nl> prepare_move ( ) ; <nl> current_position [ Z_AXIS ] - = retract_zlift ; <nl> plan_set_position ( current_position [ X_AXIS ] , current_position [ Y_AXIS ] , current_position [ Z_AXIS ] , current_position [ E_AXIS ] ) ; <nl> prepare_move ( ) ; <nl> feedrate = oldFeedrate ; <nl> - } else if ( ! retracting & & retracted ) { <nl> + } else if ( ! retracting & & retracted [ active_extruder ] ) { <nl> destination [ X_AXIS ] = current_position [ X_AXIS ] ; <nl> destination [ Y_AXIS ] = current_position [ Y_AXIS ] ; <nl> destination [ Z_AXIS ] = current_position [ Z_AXIS ] ; <nl> void refresh_cmd_timeout ( void ) <nl> current_position [ Z_AXIS ] + = retract_zlift ; <nl> plan_set_position ( current_position [ X_AXIS ] , current_position [ Y_AXIS ] , current_position [ Z_AXIS ] , current_position [ E_AXIS ] ) ; <nl> / / prepare_move ( ) ; <nl> - current_position [ E_AXIS ] - = ( retract_length + retract_recover_length ) / volumetric_multiplier [ active_extruder ] ; <nl> + if ( swapretract ) { <nl> + current_position [ E_AXIS ] - = ( retract_length_swap + retract_recover_length_swap ) / volumetric_multiplier [ active_extruder ] ; <nl> + } else { <nl> + current_position [ E_AXIS ] - = ( retract_length + retract_recover_length ) / volumetric_multiplier [ active_extruder ] ; <nl> + } <nl> plan_set_e_position ( current_position [ E_AXIS ] ) ; <nl> float oldFeedrate = feedrate ; <nl> feedrate = retract_recover_feedrate * 60 ; <nl> - retracted = false ; <nl> + retracted [ active_extruder ] = false ; <nl> prepare_move ( ) ; <nl> feedrate = oldFeedrate ; <nl> } <nl> void process_commands ( ) <nl> break ; <nl> # ifdef FWRETRACT <nl> case 10 : / / G10 retract <nl> + # if EXTRUDERS > 1 <nl> + retracted_swap [ active_extruder ] = ( code_seen ( ' S ' ) & & code_value_long ( ) = = 1 ) ; / / checks for swap retract argument <nl> + retract ( true , retracted_swap [ active_extruder ] ) ; <nl> + # else <nl> retract ( true ) ; <nl> + # endif <nl> break ; <nl> case 11 : / / G11 retract_recover <nl> + # if EXTRUDERS > 1 <nl> + retract ( false , retracted_swap [ active_extruder ] ) ; <nl> + # else <nl> retract ( false ) ; <nl> + # endif <nl> break ; <nl> # endif / / FWRETRACT <nl> case 28 : / / G28 Home all Axis one at a time <nl> void process_commands ( ) <nl> int t = code_value ( ) ; <nl> switch ( t ) <nl> { <nl> - case 0 : autoretract_enabled = false ; retracted = false ; break ; <nl> - case 1 : autoretract_enabled = true ; retracted = false ; break ; <nl> + case 0 : <nl> + { <nl> + autoretract_enabled = false ; <nl> + retracted [ 0 ] = false ; <nl> + # if EXTRUDERS > 1 <nl> + retracted [ 1 ] = false ; <nl> + # endif <nl> + # if EXTRUDERS > 2 <nl> + retracted [ 2 ] = false ; <nl> + # endif <nl> + } break ; <nl> + case 1 : <nl> + { <nl> + autoretract_enabled = true ; <nl> + retracted [ 0 ] = false ; <nl> + # if EXTRUDERS > 1 <nl> + retracted [ 1 ] = false ; <nl> + # endif <nl> + # if EXTRUDERS > 2 <nl> + retracted [ 2 ] = false ; <nl> + # endif <nl> + } break ; <nl> default : <nl> SERIAL_ECHO_START ; <nl> SERIAL_ECHOPGM ( MSG_UNKNOWN_COMMAND ) ; <nl> mmm a / Marlin / language . h <nl> ppp b / Marlin / language . h <nl> <nl> # define MSG_KILLED " KILLED . " <nl> # define MSG_STOPPED " STOPPED . " <nl> # define MSG_CONTROL_RETRACT " Retract mm " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Swap Re . mm " <nl> # define MSG_CONTROL_RETRACTF " Retract V " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Hop mm " <nl> # define MSG_CONTROL_RETRACT_RECOVER " UnRet + mm " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " S UnRet + mm " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " UnRet V " <nl> # define MSG_AUTORETRACT " AutoRetr . " <nl> # define MSG_FILAMENTCHANGE " Change filament " <nl> <nl> # define MSG_STOPPED " Zatrzymany . " <nl> # define MSG_STEPPER_RELEASED " Zwolniony . " <nl> # define MSG_CONTROL_RETRACT " Wycofaj mm " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Z Wycof . mm " <nl> # define MSG_CONTROL_RETRACTF " Wycofaj V " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Skok Z mm : " <nl> # define MSG_CONTROL_RETRACT_RECOVER " Cof . wycof . + mm " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " Z Cof . wyc . + mm " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " Cof . wycof . V " <nl> # define MSG_AUTORETRACT " Auto . wycofanie " <nl> # define MSG_FILAMENTCHANGE " Zmien filament " <nl> <nl> # define MSG_STOPPED " STOPPE . " <nl> # define MSG_STEPPER_RELEASED " RELACHE . " <nl> # define MSG_CONTROL_RETRACT " Retraction mm " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Ech . Retr . mm " <nl> # define MSG_CONTROL_RETRACTF " Retraction V " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Hop mm " <nl> # define MSG_CONTROL_RETRACT_RECOVER " UnRet + mm " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " Ech . UnRet + mm " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " UnRet V " <nl> # define MSG_AUTORETRACT " Retract . Auto . " <nl> # define MSG_FILAMENTCHANGE " Changer filament " <nl> <nl> # define MSG_STOPPED " GESTOPPT " <nl> # define MSG_STEPPER_RELEASED " Stepper frei " <nl> # define MSG_CONTROL_RETRACT " Retract mm " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Wechs . Retract mm " <nl> # define MSG_CONTROL_RETRACTF " Retract V " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Hop mm " <nl> # define MSG_CONTROL_RETRACT_RECOVER " UnRet + mm " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " Wechs . UnRet + mm " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " UnRet V " <nl> # define MSG_AUTORETRACT " AutoRetr . " <nl> # define MSG_FILAMENTCHANGE " Filament wechseln " <nl> <nl> # define MSG_KILLED " PARADA DE EMERG . " <nl> # define MSG_STOPPED " PARADA " <nl> # define MSG_CONTROL_RETRACT " Retraer mm " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Interc . Retraer mm " <nl> # define MSG_CONTROL_RETRACTF " Retraer V " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Levantar mm " <nl> # define MSG_CONTROL_RETRACT_RECOVER " DesRet + mm " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " Interc . DesRet + mm " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " DesRet V " <nl> # define MSG_AUTORETRACT " AutoRetr . " <nl> # define MSG_FILAMENTCHANGE " Cambiar filamento " <nl> <nl> # define MSG_KILLED " УБИТО . " <nl> # define MSG_STOPPED " ОСТАНОВЛЕНО . " <nl> # define MSG_CONTROL_RETRACT " Откат mm : " <nl> + # define MSG_CONTROL_RETRACT_SWAP " своп Откат mm : " <nl> # define MSG_CONTROL_RETRACTF " Откат V : " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Прыжок mm : " <nl> # define MSG_CONTROL_RETRACT_RECOVER " Возврат + mm : " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " своп Возврат + mm : " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " Возврат V : " <nl> # define MSG_AUTORETRACT " АвтоОткат : " <nl> # define MSG_FILAMENTCHANGE " Change filament " <nl> <nl> # define MSG_KILLED " UCCISO . " <nl> # define MSG_STOPPED " ARRESTATO . " <nl> # define MSG_CONTROL_RETRACT " Ritrai mm " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Scamb . Ritrai mm " <nl> # define MSG_CONTROL_RETRACTF " Ritrai V " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Salta mm " <nl> # define MSG_CONTROL_RETRACT_RECOVER " UnRet + mm " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " Scamb . UnRet + mm " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " UnRet V " <nl> # define MSG_AUTORETRACT " AutoArretramento " <nl> # define MSG_FILAMENTCHANGE " Cambia filamento " <nl> <nl> # define MSG_STOPPED " PARADA . " <nl> # define MSG_STEPPER_RELEASED " Lancado . " <nl> # define MSG_CONTROL_RETRACT " Retrair mm : " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Troca Retrair mm : " <nl> # define MSG_CONTROL_RETRACTF " Retrair V : " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Levantar mm : " <nl> # define MSG_CONTROL_RETRACT_RECOVER " DesRet + mm : " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " Troca DesRet + mm : " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " DesRet V : " <nl> # define MSG_AUTORETRACT " AutoRetr . : " <nl> # define MSG_FILAMENTCHANGE " Change filament " <nl> <nl> # define MSG_KILLED " KILLED . " <nl> # define MSG_STOPPED " STOPPED . " <nl> # define MSG_CONTROL_RETRACT " Veda mm " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Va . Veda mm " <nl> # define MSG_CONTROL_RETRACTF " Veda V " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Z mm " <nl> # define MSG_CONTROL_RETRACT_RECOVER " UnRet + mm " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " Va . UnRet + mm " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " UnRet V " <nl> # define MSG_AUTORETRACT " AutoVeto . " <nl> # define MSG_FILAMENTCHANGE " Change filament " <nl> <nl> # define MSG_KILLED " ATURADA D ' EMERCH . " <nl> # define MSG_STOPPED " ATURADA . " <nl> # define MSG_CONTROL_RETRACT " Retraer mm " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Swap Retraer mm " <nl> # define MSG_CONTROL_RETRACTF " Retraer F " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Devantar mm " <nl> # define MSG_CONTROL_RETRACT_RECOVER " DesRet + mm " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " Swap DesRet + mm " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " DesRet F " <nl> # define MSG_AUTORETRACT " AutoRetr . " <nl> # define MSG_FILAMENTCHANGE " Cambear " <nl> <nl> # define MSG_KILLED " AFGEBROKEN . " <nl> # define MSG_STOPPED " GESTOPT . " <nl> # define MSG_CONTROL_RETRACT " Retract mm " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Ruil Retract mm " <nl> # define MSG_CONTROL_RETRACTF " Retract F " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Hop mm " <nl> # define MSG_CONTROL_RETRACT_RECOVER " UnRet + mm " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " Ruil UnRet + mm " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " UnRet F " <nl> # define MSG_AUTORETRACT " AutoRetr . " <nl> # define MSG_FILAMENTCHANGE " Verv . Filament " <nl> <nl> # define MSG_KILLED " PARADA DE EMERG . " <nl> # define MSG_STOPPED " ATURAT . " <nl> # define MSG_CONTROL_RETRACT " Retreure mm " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Swap Retreure mm " <nl> # define MSG_CONTROL_RETRACTF " Retreure F " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Aixecar mm " <nl> # define MSG_CONTROL_RETRACT_RECOVER " DesRet + mm " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " Swap DesRet + mm " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " DesRet F " <nl> # define MSG_AUTORETRACT " AutoRetr . " <nl> # define MSG_FILAMENTCHANGE " Canviar filament " <nl> <nl> # define MSG_KILLED " LARRIALDI GELDIA " <nl> # define MSG_STOPPED " GELDITUTA . " <nl> # define MSG_CONTROL_RETRACT " Atzera egin mm " <nl> + # define MSG_CONTROL_RETRACT_SWAP " Swap Atzera egin mm " <nl> # define MSG_CONTROL_RETRACTF " Atzera egin V " <nl> # define MSG_CONTROL_RETRACT_ZLIFT " Igo mm " <nl> # define MSG_CONTROL_RETRACT_RECOVER " Atzera egin + mm " <nl> + # define MSG_CONTROL_RETRACT_RECOVER_SWAP " Swap Atzera egin + mm " <nl> # define MSG_CONTROL_RETRACT_RECOVERF " Atzera egin V " <nl> # define MSG_AUTORETRACT " Atzera egin " <nl> # define MSG_FILAMENTCHANGE " Aldatu filament . " <nl> mmm a / Marlin / ultralcd . cpp <nl> ppp b / Marlin / ultralcd . cpp <nl> static void lcd_control_retract_menu ( ) <nl> MENU_ITEM ( back , MSG_CONTROL , lcd_control_menu ) ; <nl> MENU_ITEM_EDIT ( bool , MSG_AUTORETRACT , & autoretract_enabled ) ; <nl> MENU_ITEM_EDIT ( float52 , MSG_CONTROL_RETRACT , & retract_length , 0 , 100 ) ; <nl> + # if EXTRUDERS > 1 <nl> + MENU_ITEM_EDIT ( float52 , MSG_CONTROL_RETRACT_SWAP , & retract_length_swap , 0 , 100 ) ; <nl> + # endif <nl> MENU_ITEM_EDIT ( float3 , MSG_CONTROL_RETRACTF , & retract_feedrate , 1 , 999 ) ; <nl> MENU_ITEM_EDIT ( float52 , MSG_CONTROL_RETRACT_ZLIFT , & retract_zlift , 0 , 999 ) ; <nl> MENU_ITEM_EDIT ( float52 , MSG_CONTROL_RETRACT_RECOVER , & retract_recover_length , 0 , 100 ) ; <nl> + # if EXTRUDERS > 1 <nl> + MENU_ITEM_EDIT ( float52 , MSG_CONTROL_RETRACT_RECOVER_SWAP , & retract_recover_length_swap , 0 , 100 ) ; <nl> + # endif <nl> MENU_ITEM_EDIT ( float3 , MSG_CONTROL_RETRACT_RECOVERF , & retract_recover_feedrate , 1 , 999 ) ; <nl> END_MENU ( ) ; <nl> } <nl>
|
Merge remote - tracking branch ' upstream / Marlin_v1 ' into Marlin_v1
|
MarlinFirmware/Marlin
|
1bd0dd04e3da4b50e06abbd1c636992e81c9aee8
|
2014-07-20T11:23:32Z
|
mmm a / tensorflow / core / kernels / data / BUILD <nl> ppp b / tensorflow / core / kernels / data / BUILD <nl> licenses ( [ " notice " ] ) # Apache 2 . 0 <nl> <nl> load ( <nl> " / / tensorflow : tensorflow . bzl " , <nl> - " tf_kernel_library " , <nl> " tf_cc_test " , <nl> + " tf_kernel_library " , <nl> ) <nl> <nl> # TODO ( mrry ) : Remove this empty forwarding library . <nl> tf_cc_test ( <nl> size = " small " , <nl> srcs = [ " map_dataset_op_test . cc " ] , <nl> deps = [ <nl> - " : map_dataset_op " , <nl> - " : range_dataset_op " , <nl> " : dataset_test_base " , <nl> " : iterator_ops " , <nl> - " / / tensorflow / core : testlib " , <nl> - " / / tensorflow / core : test_main " , <nl> + " : map_dataset_op " , <nl> + " : range_dataset_op " , <nl> " / / tensorflow / core : core_cpu_internal " , <nl> " / / tensorflow / core : dataset_ops_op_lib " , <nl> " / / tensorflow / core : framework " , <nl> " / / tensorflow / core : lib_internal " , <nl> - " / / tensorflow / core / kernels : function_ops " , <nl> + " / / tensorflow / core : test_main " , <nl> + " / / tensorflow / core : testlib " , <nl> " / / tensorflow / core / kernels : cwise_op " , <nl> + " / / tensorflow / core / kernels : function_ops " , <nl> ] , <nl> ) <nl> <nl> tf_cc_test ( <nl> srcs = [ " range_dataset_op_test . cc " ] , <nl> deps = [ <nl> " : dataset_test_base " , <nl> - " : range_dataset_op " , <nl> " : iterator_ops " , <nl> - " / / tensorflow / core : testlib " , <nl> + " : range_dataset_op " , <nl> " / / tensorflow / core : test_main " , <nl> - <nl> + " / / tensorflow / core : testlib " , <nl> ] , <nl> ) <nl> <nl>
|
Fix the style issue in BUILD file
|
tensorflow/tensorflow
|
4a18fbb2558cc80bfb754af0cc3602a938a4af17
|
2019-01-30T23:14:29Z
|
mmm a / spec / api - web - contents - spec . js <nl> ppp b / spec / api - web - contents - spec . js <nl> describe ( ' webContents module ' , ( ) = > { <nl> w . loadFile ( path . join ( fixtures , ' pages ' , ' key - events . html ' ) ) <nl> } ) <nl> <nl> - it ( ' has the correct properties ' , ( done ) = > { <nl> - w . loadFile ( path . join ( fixtures , ' pages ' , ' base - page . html ' ) ) <nl> - w . webContents . once ( ' did - finish - load ' , ( ) = > { <nl> - const testBeforeInput = ( opts ) = > { <nl> - return new Promise ( ( resolve , reject ) = > { <nl> - w . webContents . once ( ' before - input - event ' , ( event , input ) = > { <nl> + it ( ' has the correct properties ' , async ( ) = > { <nl> + await w . loadFile ( path . join ( fixtures , ' pages ' , ' base - page . html ' ) ) <nl> + const testBeforeInput = ( opts ) = > { <nl> + return new Promise ( ( resolve , reject ) = > { <nl> + w . webContents . once ( ' before - input - event ' , ( event , input ) = > { <nl> + try { <nl> assert . strictEqual ( input . type , opts . type ) <nl> assert . strictEqual ( input . key , opts . key ) <nl> assert . strictEqual ( input . code , opts . code ) <nl> describe ( ' webContents module ' , ( ) = > { <nl> assert . strictEqual ( input . alt , opts . alt ) <nl> assert . strictEqual ( input . meta , opts . meta ) <nl> resolve ( ) <nl> - } ) <nl> - <nl> - const modifiers = [ ] <nl> - if ( opts . shift ) modifiers . push ( ' shift ' ) <nl> - if ( opts . control ) modifiers . push ( ' control ' ) <nl> - if ( opts . alt ) modifiers . push ( ' alt ' ) <nl> - if ( opts . meta ) modifiers . push ( ' meta ' ) <nl> - if ( opts . isAutoRepeat ) modifiers . push ( ' isAutoRepeat ' ) <nl> - <nl> - w . webContents . sendInputEvent ( { <nl> - type : opts . type , <nl> - keyCode : opts . keyCode , <nl> - modifiers : modifiers <nl> - } ) <nl> + } catch ( e ) { <nl> + reject ( e ) <nl> + } <nl> } ) <nl> - } <nl> <nl> - Promise . resolve ( ) . then ( ( ) = > { <nl> - return testBeforeInput ( { <nl> - type : ' keyDown ' , <nl> - key : ' A ' , <nl> - code : ' KeyA ' , <nl> - keyCode : ' a ' , <nl> - shift : true , <nl> - control : true , <nl> - alt : true , <nl> - meta : true , <nl> - isAutoRepeat : true <nl> + const modifiers = [ ] <nl> + if ( opts . shift ) modifiers . push ( ' shift ' ) <nl> + if ( opts . control ) modifiers . push ( ' control ' ) <nl> + if ( opts . alt ) modifiers . push ( ' alt ' ) <nl> + if ( opts . meta ) modifiers . push ( ' meta ' ) <nl> + if ( opts . isAutoRepeat ) modifiers . push ( ' isAutoRepeat ' ) <nl> + <nl> + w . webContents . sendInputEvent ( { <nl> + type : opts . type , <nl> + keyCode : opts . keyCode , <nl> + modifiers : modifiers <nl> } ) <nl> - } ) . then ( ( ) = > { <nl> - return testBeforeInput ( { <nl> - type : ' keyUp ' , <nl> - key : ' . ' , <nl> - code : ' Period ' , <nl> - keyCode : ' . ' , <nl> - shift : false , <nl> - control : true , <nl> - alt : true , <nl> - meta : false , <nl> - isAutoRepeat : false <nl> - } ) <nl> - } ) . then ( ( ) = > { <nl> - return testBeforeInput ( { <nl> - type : ' keyUp ' , <nl> - key : ' ! ' , <nl> - code : ' Digit1 ' , <nl> - keyCode : ' 1 ' , <nl> - shift : true , <nl> - control : false , <nl> - alt : false , <nl> - meta : true , <nl> - isAutoRepeat : false <nl> - } ) <nl> - } ) . then ( ( ) = > { <nl> - return testBeforeInput ( { <nl> - type : ' keyUp ' , <nl> - key : ' Tab ' , <nl> - code : ' Tab ' , <nl> - keyCode : ' Tab ' , <nl> - shift : false , <nl> - control : true , <nl> - alt : false , <nl> - meta : false , <nl> - isAutoRepeat : true <nl> - } ) <nl> - } ) . then ( done ) . catch ( done ) <nl> + } ) <nl> + } <nl> + <nl> + await testBeforeInput ( { <nl> + type : ' keyDown ' , <nl> + key : ' A ' , <nl> + code : ' KeyA ' , <nl> + keyCode : ' a ' , <nl> + shift : true , <nl> + control : true , <nl> + alt : true , <nl> + meta : true , <nl> + isAutoRepeat : true <nl> + } ) <nl> + await testBeforeInput ( { <nl> + type : ' keyUp ' , <nl> + key : ' . ' , <nl> + code : ' Period ' , <nl> + keyCode : ' . ' , <nl> + shift : false , <nl> + control : true , <nl> + alt : true , <nl> + meta : false , <nl> + isAutoRepeat : false <nl> + } ) <nl> + await testBeforeInput ( { <nl> + type : ' keyUp ' , <nl> + key : ' ! ' , <nl> + code : ' Digit1 ' , <nl> + keyCode : ' 1 ' , <nl> + shift : true , <nl> + control : false , <nl> + alt : false , <nl> + meta : true , <nl> + isAutoRepeat : false <nl> + } ) <nl> + await testBeforeInput ( { <nl> + type : ' keyUp ' , <nl> + key : ' Tab ' , <nl> + code : ' Tab ' , <nl> + keyCode : ' Tab ' , <nl> + shift : false , <nl> + control : true , <nl> + alt : false , <nl> + meta : false , <nl> + isAutoRepeat : true <nl> } ) <nl> } ) <nl> } ) <nl>
|
test : fix flaky before - input - event test ( )
|
electron/electron
|
1152fecb75c372d957b09cf57caa8b5e23bdeddc
|
2018-12-12T01:01:48Z
|
mmm a / tests / src / manipulator_details_basic / test . cpp <nl> ppp b / tests / src / manipulator_details_basic / test . cpp <nl> TEST_CASE ( " simultaneous_options " ) { <nl> { " simultaneous_options " , nlohmann : : json : : object ( { <nl> { " key_down_order " , " unknown " } , <nl> { " key_up_order " , nlohmann : : json : : array ( ) } , <nl> + { " to_after_key_up " , " unknown " } , <nl> } ) } , <nl> } ) ) ; <nl> <nl> new file mode 100644 <nl> index 000000000 . . 72e8ffc0d <nl> mmm / dev / null <nl> ppp b / tests / src / manipulator_details_basic / tmp / . gitignore <nl> @ @ - 0 , 0 + 1 @ @ <nl> + * <nl> mmm a / tests / src / post_event_to_virtual_devices / json / expected_post_event_to_virtual_devices_queue / simultaneous_20 . json <nl> ppp b / tests / src / post_event_to_virtual_devices / json / expected_post_event_to_virtual_devices_queue / simultaneous_20 . json <nl> <nl> " type " : " keyboard_event " <nl> } , <nl> { <nl> - " time_stamp " : 12000009 , <nl> + " time_stamp " : 12000007 , <nl> " type " : " clear_keyboard_modifier_flags " <nl> } , <nl> { <nl>
|
update tests
|
pqrs-org/Karabiner-Elements
|
f89fc6d38dce68be2a57d17c5f750f1c12c17bf2
|
2018-02-27T18:27:57Z
|
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> if ( CMAKE_VERBOSE ) <nl> set ( CMAKE_VERBOSE_MAKEFILE 1 ) <nl> endif ( ) <nl> <nl> - if ( WIN32 ) <nl> - if ( $ { CMAKE_GENERATOR } MATCHES " ( MinGW ) | ( MSYS ) " ) <nl> - set ( CMAKE_CXX_FLAGS_RELEASE " - O2 - DNDEBUG " CACHE STRING " " ) <nl> - endif ( ) <nl> + if ( WIN32 AND $ { CMAKE_GENERATOR } MATCHES " ( MinGW ) | ( MSYS ) " AND NOT ANDROID ) <nl> + set ( CMAKE_CXX_FLAGS_RELEASE " - O2 - DNDEBUG " CACHE STRING " " ) <nl> endif ( ) <nl> <nl> <nl>
|
Fixed compiler options in Android build ( Windows )
|
opencv/opencv
|
591cb1b3cf9e5bdab964c63682ca356c352eae00
|
2011-06-28T05:51:41Z
|
mmm a / lib / Driver / ToolChains . cpp <nl> ppp b / lib / Driver / ToolChains . cpp <nl> toolchains : : GenericUnix : : constructInvocation ( const LinkJobAction & job , <nl> Arguments . push_back ( context . Args . MakeArgString ( A - > getValue ( ) ) ) ; <nl> } <nl> <nl> - if ( getTriple ( ) . getOS ( ) = = llvm : : Triple : : Linux ) { <nl> + if ( getTriple ( ) . getOS ( ) = = llvm : : Triple : : Linux & & ! getTriple ( ) . isAndroid ( ) ) { <nl> Arguments . push_back ( " - pie " ) ; <nl> } <nl> <nl>
|
Avoid adding - pie on Android apps which are - shared
|
apple/swift
|
c4c6a820e5bce915e37306d75e23eea8d86a4303
|
2017-08-29T14:33:38Z
|
mmm a / dbms / include / DB / Core / Defines . h <nl> ppp b / dbms / include / DB / Core / Defines . h <nl> <nl> # define DBMS_VERSION_MAJOR 0 <nl> # define DBMS_VERSION_MINOR 0 <nl> <nl> + # define DBMS_DEFAULT_HOST " localhost " <nl> + # define DBMS_DEFAULT_PORT 9000 <nl> + # define DBMS_DEFAULT_PORT_STR " 9000 " <nl> + <nl> # define DEFAULT_BLOCK_SIZE 1048576 <nl> # define DEFAULT_MAX_QUERY_SIZE 1048576 <nl> # define SHOW_CHARS_ON_SYNTAX_ERROR 160L <nl> mmm a / dbms / src / Client / Client . cpp <nl> ppp b / dbms / src / Client / Client . cpp <nl> class Client : public Poco : : Util : : Application <nl> void connect ( ) <nl> { <nl> String host = config ( ) . getString ( " host " , " localhost " ) ; <nl> - UInt16 port = config ( ) . getInt ( " port " , 9000 ) ; <nl> + UInt16 port = config ( ) . getInt ( " port " , DBMS_DEFAULT_PORT ) ; <nl> String default_database = config ( ) . getString ( " database " , " " ) ; <nl> <nl> Protocol : : Compression : : Enum compression = config ( ) . getBool ( " compression " , true ) <nl>
|
dbms : development [ # CONV - 5200 ] .
|
ClickHouse/ClickHouse
|
e0c9a59c7168892b3d388531a52e72b01ead4951
|
2012-07-06T18:12:52Z
|
mmm a / modules / python / src2 / cv2 . cpp <nl> ppp b / modules / python / src2 / cv2 . cpp <nl> static inline bool pyopencv_to ( PyObject * obj , Size & sz , const char * name = " < unk <nl> { <nl> if ( ! obj | | obj = = Py_None ) <nl> return true ; <nl> - return PyArg_Parse ( obj , " ii " , & sz . width , & sz . height ) > 0 ; <nl> + return PyArg_ParseTuple ( obj , " ii " , & sz . width , & sz . height ) > 0 ; <nl> } <nl> <nl> static inline PyObject * pyopencv_from ( const Size & sz ) <nl> static inline bool pyopencv_to ( PyObject * obj , Rect & r , const char * name = " < unkn <nl> { <nl> if ( ! obj | | obj = = Py_None ) <nl> return true ; <nl> - return PyArg_Parse ( obj , " iiii " , & r . x , & r . y , & r . width , & r . height ) > 0 ; <nl> + return PyArg_ParseTuple ( obj , " iiii " , & r . x , & r . y , & r . width , & r . height ) > 0 ; <nl> } <nl> <nl> static inline PyObject * pyopencv_from ( const Rect & r ) <nl> static inline bool pyopencv_to ( PyObject * obj , Range & r , const char * name = " < unk <nl> r = Range : : all ( ) ; <nl> return true ; <nl> } <nl> - return PyArg_Parse ( obj , " ii " , & r . start , & r . end ) > 0 ; <nl> + return PyArg_ParseTuple ( obj , " ii " , & r . start , & r . end ) > 0 ; <nl> } <nl> <nl> static inline PyObject * pyopencv_from ( const Range & r ) <nl> static inline bool pyopencv_to ( PyObject * obj , CvSlice & r , const char * name = " < u <nl> r = CV_WHOLE_SEQ ; <nl> return true ; <nl> } <nl> - return PyArg_Parse ( obj , " ii " , & r . start_index , & r . end_index ) > 0 ; <nl> + return PyArg_ParseTuple ( obj , " ii " , & r . start_index , & r . end_index ) > 0 ; <nl> } <nl> <nl> static inline PyObject * pyopencv_from ( const CvSlice & r ) <nl> static inline bool pyopencv_to ( PyObject * obj , Point & p , const char * name = " < unk <nl> p . y = saturate_cast < int > ( c . imag ) ; <nl> return true ; <nl> } <nl> - return PyArg_Parse ( obj , " ii " , & p . x , & p . y ) > 0 ; <nl> + return PyArg_ParseTuple ( obj , " ii " , & p . x , & p . y ) > 0 ; <nl> } <nl> <nl> static inline bool pyopencv_to ( PyObject * obj , Point2f & p , const char * name = " < unknown > " ) <nl> static inline bool pyopencv_to ( PyObject * obj , Point2f & p , const char * name = " < u <nl> p . y = saturate_cast < float > ( c . imag ) ; <nl> return true ; <nl> } <nl> - return PyArg_Parse ( obj , " ff " , & p . x , & p . y ) > 0 ; <nl> + return PyArg_ParseTuple ( obj , " ff " , & p . x , & p . y ) > 0 ; <nl> } <nl> <nl> static inline PyObject * pyopencv_from ( const Point & p ) <nl> static inline bool pyopencv_to ( PyObject * obj , Vec3d & v , const char * name = " < unk <nl> { <nl> if ( ! obj ) <nl> return true ; <nl> - return PyArg_Parse ( obj , " ddd " , & v [ 0 ] , & v [ 1 ] , & v [ 2 ] ) > 0 ; <nl> + return PyArg_ParseTuple ( obj , " ddd " , & v [ 0 ] , & v [ 1 ] , & v [ 2 ] ) > 0 ; <nl> } <nl> <nl> static inline PyObject * pyopencv_from ( const Vec3d & v ) <nl> mmm a / modules / python / src2 / gen2 . py <nl> ppp b / modules / python / src2 / gen2 . py <nl> def gen_code ( self , all_classes ) : <nl> parse_arglist = " , " . join ( [ " & " + all_cargs [ argno ] [ 1 ] for aname , argno in v . py_arglist ] ) , <nl> code_cvt = " & & \ n " . join ( code_cvt_list ) ) <nl> else : <nl> - code_parse = " if ( PyObject_Size ( args ) = = 0 & & PyObject_Size ( kw ) = = 0 ) " <nl> + code_parse = " if ( PyObject_Size ( args ) = = 0 & & ( kw = = NULL | | PyObject_Size ( kw ) = = 0 ) ) " <nl> <nl> if len ( v . py_outlist ) = = 0 : <nl> code_ret = " Py_RETURN_NONE " <nl>
|
fixed and
|
opencv/opencv
|
30f9710d558f47892ab838a2524c1b7e1616a012
|
2011-05-16T10:52:20Z
|
mmm a / platform / javascript / os_javascript . cpp <nl> ppp b / platform / javascript / os_javascript . cpp <nl> EM_BOOL OS_JavaScript : : mouse_button_callback ( int p_event_type , const EmscriptenM <nl> default : return false ; <nl> } <nl> <nl> + if ( ev - > is_pressed ( ) ) { <nl> + <nl> + uint64_t diff = p_event - > timestamp - os - > last_click_ms ; <nl> + <nl> + if ( ev - > get_button_index ( ) = = os - > last_click_button_index ) { <nl> + <nl> + if ( diff < 400 & & Point2 ( os - > last_click_pos ) . distance_to ( ev - > get_position ( ) ) < 5 ) { <nl> + <nl> + os - > last_click_ms = 0 ; <nl> + os - > last_click_pos = Point2 ( - 100 , - 100 ) ; <nl> + os - > last_click_button_index = - 1 ; <nl> + ev - > set_doubleclick ( true ) ; <nl> + } <nl> + <nl> + } else { <nl> + os - > last_click_button_index = ev - > get_button_index ( ) ; <nl> + } <nl> + <nl> + if ( ! ev - > is_doubleclick ( ) ) { <nl> + os - > last_click_ms + = diff ; <nl> + os - > last_click_pos = ev - > get_position ( ) ; <nl> + } <nl> + } <nl> + <nl> int mask = os - > input - > get_mouse_button_mask ( ) ; <nl> int button_flag = 1 < < ( ev - > get_button_index ( ) - 1 ) ; <nl> if ( ev - > is_pressed ( ) ) { <nl> OS_JavaScript : : OS_JavaScript ( int p_argc , char * p_argv [ ] ) { <nl> } <nl> set_cmdline ( p_argv [ 0 ] , arguments ) ; <nl> <nl> + last_click_button_index = - 1 ; <nl> + last_click_ms = 0 ; <nl> + last_click_pos = Point2 ( - 100 , - 100 ) ; <nl> + <nl> window_maximized = false ; <nl> soft_fullscreen_enabled = false ; <nl> canvas_size_adjustment_requested = false ; <nl> mmm a / platform / javascript / os_javascript . h <nl> ppp b / platform / javascript / os_javascript . h <nl> class OS_JavaScript : public OS_Unix { <nl> CursorShape cursor_shape ; <nl> Point2 touches [ 32 ] ; <nl> <nl> + Point2i last_click_pos ; <nl> + uint64_t last_click_ms ; <nl> + int last_click_button_index ; <nl> + <nl> MainLoop * main_loop ; <nl> AudioDriverJavaScript audio_driver_javascript ; <nl> <nl> mmm a / platform / x11 / os_x11 . cpp <nl> ppp b / platform / x11 / os_x11 . cpp <nl> Error OS_X11 : : initialize ( const VideoMode & p_desired , int p_video_driver , int p_a <nl> xmbstring = NULL ; <nl> x11_window = 0 ; <nl> last_click_ms = 0 ; <nl> + last_click_button_index = - 1 ; <nl> + last_click_pos = Point2 ( - 100 , - 100 ) ; <nl> args = OS : : get_singleton ( ) - > get_cmdline_args ( ) ; <nl> current_videomode = p_desired ; <nl> main_loop = NULL ; <nl> void OS_X11 : : process_xevents ( ) { <nl> <nl> mb - > set_pressed ( ( event . type = = ButtonPress ) ) ; <nl> <nl> - if ( event . type = = ButtonPress & & event . xbutton . button = = 1 ) { <nl> + if ( event . type = = ButtonPress ) { <nl> <nl> uint64_t diff = get_ticks_usec ( ) / 1000 - last_click_ms ; <nl> <nl> - if ( diff < 400 & & Point2 ( last_click_pos ) . distance_to ( Point2 ( event . xbutton . x , event . xbutton . y ) ) < 5 ) { <nl> + if ( mb - > get_button_index ( ) = = last_click_button_index ) { <nl> <nl> - last_click_ms = 0 ; <nl> - last_click_pos = Point2 ( - 100 , - 100 ) ; <nl> - mb - > set_doubleclick ( true ) ; <nl> + if ( diff < 400 & & Point2 ( last_click_pos ) . distance_to ( Point2 ( event . xbutton . x , event . xbutton . y ) ) < 5 ) { <nl> <nl> - } else { <nl> + last_click_ms = 0 ; <nl> + last_click_pos = Point2 ( - 100 , - 100 ) ; <nl> + last_click_button_index = - 1 ; <nl> + mb - > set_doubleclick ( true ) ; <nl> + } <nl> + <nl> + } else if ( mb - > get_button_index ( ) < 4 | | mb - > get_button_index ( ) > 7 ) { <nl> + last_click_button_index = mb - > get_button_index ( ) ; <nl> + } <nl> + <nl> + if ( ! mb - > is_doubleclick ( ) ) { <nl> last_click_ms + = diff ; <nl> last_click_pos = Point2 ( event . xbutton . x , event . xbutton . y ) ; <nl> } <nl> mmm a / platform / x11 / os_x11 . h <nl> ppp b / platform / x11 / os_x11 . h <nl> class OS_X11 : public OS_Unix { <nl> bool last_mouse_pos_valid ; <nl> Point2i last_click_pos ; <nl> uint64_t last_click_ms ; <nl> + int last_click_button_index ; <nl> uint32_t last_button_state ; <nl> # ifdef TOUCH_ENABLED <nl> struct { <nl>
|
Added double clicking to all buttons
|
godotengine/godot
|
51fa23a52a71fcbae5743587b35b179dcc226b92
|
2018-08-12T09:41:31Z
|
mmm a / android / sdk / src / main / java / com / taobao / weex / common / WXPerformance . java <nl> ppp b / android / sdk / src / main / java / com / taobao / weex / common / WXPerformance . java <nl> <nl> * / <nl> public String errMsg ; <nl> <nl> - public Map < String , String > getMeasureMap ( ) { <nl> - Map < String , String > quotas = new HashMap < > ( ) ; <nl> - quotas . put ( " JSTemplateSize " , Double . toString ( JSTemplateSize ) ) ; <nl> - quotas . put ( " JSLibSize " , Double . toString ( JSLibSize ) ) ; <nl> - quotas . put ( " communicateTime " , Long . toString ( communicateTime ) ) ; <nl> - quotas . put ( " screenRenderTime " , Long . toString ( screenRenderTime ) ) ; <nl> - quotas . put ( " totalTime " , Double . toString ( totalTime ) ) ; <nl> - quotas . put ( " localReadTime " , Double . toString ( localReadTime ) ) ; <nl> - quotas . put ( " JSLibInitTime " , Long . toString ( JSLibInitTime ) ) ; <nl> - quotas . put ( " networkTime " , Long . toString ( networkTime ) ) ; <nl> - quotas . put ( " templateLoadTime " , Long . toString ( templateLoadTime ) ) ; <nl> - quotas . put ( " SDKInitInvokeTime " , Long . toString ( WXEnvironment . sSDKInitInvokeTime ) ) ; <nl> - quotas . put ( " SDKInitExecuteTime " , Long . toString ( WXEnvironment . sSDKInitExecuteTime ) ) ; <nl> + public Map < String , Double > getMeasureMap ( ) { <nl> + Map < String , Double > quotas = new HashMap < > ( ) ; <nl> + quotas . put ( " JSTemplateSize " , JSTemplateSize ) ; <nl> + quotas . put ( " JSLibSize " , JSLibSize ) ; <nl> + quotas . put ( " communicateTime " , ( double ) communicateTime ) ; <nl> + quotas . put ( " screenRenderTime " , ( double ) screenRenderTime ) ; <nl> + quotas . put ( " totalTime " , totalTime ) ; <nl> + quotas . put ( " localReadTime " , localReadTime ) ; <nl> + quotas . put ( " JSLibInitTime " , ( double ) JSLibInitTime ) ; <nl> + quotas . put ( " networkTime " , ( double ) networkTime ) ; <nl> + quotas . put ( " templateLoadTime " , ( double ) templateLoadTime ) ; <nl> + quotas . put ( " SDKInitInvokeTime " , ( double ) WXEnvironment . sSDKInitInvokeTime ) ; <nl> + quotas . put ( " SDKInitExecuteTime " , ( double ) WXEnvironment . sSDKInitExecuteTime ) ; <nl> return quotas ; <nl> } <nl> <nl>
|
* [ android ] change mesure map type
|
apache/incubator-weex
|
b875654a4dc3e231a3e5e408d247ffc2b5cd40f5
|
2016-06-14T12:29:17Z
|
mmm a / README . md <nl> ppp b / README . md <nl> editor ] ( https : / / github . com / atom / atom ) . <nl> Prebuilt binaries of atom - shell for Linux , Windows and Mac can be found on the <nl> [ releases ] ( https : / / github . com / atom / atom - shell / releases ) page . <nl> <nl> + You can also use [ ` npm ` ] ( https : / / docs . npmjs . com / ) to install prebuilt atom - shell binaries : <nl> + <nl> + ` ` ` <nl> + # install globally in your PATH <nl> + npm install atom - shell - g <nl> + <nl> + # install as a development dependency <nl> + npm install atom - shell - - save - dev <nl> + ` ` ` <nl> + <nl> # # # Mirrors <nl> <nl> - [ China Mirror ] ( https : / / npm . taobao . org / mirrors / atom - shell ) : Improve download speeds for Chinese user . <nl>
|
add npm installation instructions to README
|
electron/electron
|
1d1db66abd3f63ffa9f72e3e9ee5449d14c99630
|
2015-02-26T05:56:47Z
|
mmm a / Telegram / SourceFiles / platform / linux / file_utilities_linux . cpp <nl> ppp b / Telegram / SourceFiles / platform / linux / file_utilities_linux . cpp <nl> bool UseNative ( Type type = Type : : ReadFile ) { <nl> / / or if QT_QPA_PLATFORMTHEME = ( gtk2 | gtk3 ) <nl> / / or if portals are used and operation is to open folder <nl> / / and portal doesn ' t support folder choosing <nl> - const auto neededForPortal = UseXDGDesktopPortal ( ) <nl> - & & type = = Type : : ReadFolder <nl> + const auto neededForPortal = ( type = = Type : : ReadFolder ) <nl> & & ! CanOpenDirectoryWithPortal ( ) ; <nl> <nl> const auto neededNonForced = DesktopEnvironment : : IsGtkBased ( ) <nl> - | | neededForPortal ; <nl> + | | ( UseXDGDesktopPortal ( ) & & neededForPortal ) ; <nl> <nl> - const auto excludeNonForced = InFlatpak ( ) | | InSnap ( ) ; <nl> + const auto excludeNonForced = InFlatpak ( ) <nl> + | | InSnap ( ) <nl> + | | ( UseXDGDesktopPortal ( ) & & ! neededForPortal ) ; <nl> <nl> return IsGtkIntegrationForced ( ) <nl> | | ( neededNonForced & & ! excludeNonForced ) ; <nl>
|
Fix TDESKTOP_USE_PORTAL on gtk environments
|
telegramdesktop/tdesktop
|
44c24f9fff46e45fa4304c92f8f3d008d3d3c9f6
|
2020-11-02T07:20:53Z
|
mmm a / editor / plugins / canvas_item_editor_plugin . cpp <nl> ppp b / editor / plugins / canvas_item_editor_plugin . cpp <nl> void CanvasItemEditor : : _find_canvas_items_at_pos ( const Point2 & p_pos , Node * p_no <nl> } <nl> } <nl> <nl> - void CanvasItemEditor : : _get_canvas_items_at_pos ( const Point2 & p_pos , Vector < _SelectResult > & r_items ) { <nl> + void CanvasItemEditor : : _get_canvas_items_at_pos ( const Point2 & p_pos , Vector < _SelectResult > & r_items , bool p_ignore_groups ) { <nl> <nl> Node * scene = editor - > get_edited_scene ( ) ; <nl> <nl> void CanvasItemEditor : : _get_canvas_items_at_pos ( const Point2 & p_pos , Vector < _Sel <nl> node = node - > get_parent ( ) ; <nl> } ; <nl> <nl> - / / Replace the node by the group if grouped <nl> CanvasItem * canvas_item = Object : : cast_to < CanvasItem > ( node ) ; <nl> - while ( node & & node ! = scene - > get_parent ( ) ) { <nl> - CanvasItem * canvas_item_tmp = Object : : cast_to < CanvasItem > ( node ) ; <nl> - if ( canvas_item_tmp & & node - > has_meta ( " _edit_group_ " ) ) { <nl> - canvas_item = canvas_item_tmp ; <nl> + if ( ! p_ignore_groups ) { <nl> + / / Replace the node by the group if grouped <nl> + while ( node & & node ! = scene - > get_parent ( ) ) { <nl> + CanvasItem * canvas_item_tmp = Object : : cast_to < CanvasItem > ( node ) ; <nl> + if ( canvas_item_tmp & & node - > has_meta ( " _edit_group_ " ) ) { <nl> + canvas_item = canvas_item_tmp ; <nl> + } <nl> + node = node - > get_parent ( ) ; <nl> } <nl> - node = node - > get_parent ( ) ; <nl> } <nl> <nl> / / Check if the canvas item is already in the list ( for groups or scenes ) <nl> void CanvasItemEditor : : _get_canvas_items_at_pos ( const Point2 & p_pos , Vector < _Sel <nl> } <nl> <nl> / / Remove the item if invalid <nl> - if ( ! canvas_item | | duplicate | | ( canvas_item ! = scene & & canvas_item - > get_owner ( ) ! = scene & & ! scene - > is_editable_instance ( canvas_item - > get_owner ( ) ) ) | | _is_node_locked ( canvas_item ) ) { <nl> + if ( ! canvas_item | | duplicate | | ( canvas_item ! = scene & & canvas_item - > get_owner ( ) ! = scene & & ! scene - > is_editable_instance ( canvas_item - > get_owner ( ) ) ) | | ( tool = = TOOL_LIST_SELECT & & _is_node_locked ( canvas_item ) ) ) { <nl> r_items . remove ( i ) ; <nl> i - - ; <nl> } else { <nl> bool CanvasItemEditor : : _gui_input_select ( const Ref < InputEvent > & p_event ) { <nl> / / Popup the selection menu list <nl> Point2 click = transform . affine_inverse ( ) . xform ( b - > get_position ( ) ) ; <nl> <nl> - _get_canvas_items_at_pos ( click , selection_results ) ; <nl> + _get_canvas_items_at_pos ( click , selection_results , b - > get_alt ( ) & & tool ! = TOOL_LIST_SELECT ) ; <nl> <nl> if ( selection_results . size ( ) = = 1 ) { <nl> CanvasItem * item = selection_results [ 0 ] . item ; <nl> bool CanvasItemEditor : : _gui_input_select ( const Ref < InputEvent > & p_event ) { <nl> Ref < Texture > icon = EditorNode : : get_singleton ( ) - > get_object_icon ( item , " Node " ) ; <nl> String node_path = " / " + root_name + " / " + root_path . rel_path_to ( item - > get_path ( ) ) ; <nl> <nl> - selection_menu - > add_item ( item - > get_name ( ) ) ; <nl> + int locked = 0 ; <nl> + if ( _is_node_locked ( item ) ) { <nl> + locked = 1 ; <nl> + } else { <nl> + Node * scene = editor - > get_edited_scene ( ) ; <nl> + Node * node = item ; <nl> + <nl> + while ( node & & node ! = scene - > get_parent ( ) ) { <nl> + CanvasItem * canvas_item_tmp = Object : : cast_to < CanvasItem > ( node ) ; <nl> + if ( canvas_item_tmp & & node - > has_meta ( " _edit_group_ " ) ) { <nl> + locked = 2 ; <nl> + } <nl> + node = node - > get_parent ( ) ; <nl> + } <nl> + } <nl> + <nl> + String suffix = String ( ) ; <nl> + if ( locked = = 1 ) { <nl> + suffix = " ( " + TTR ( " Locked " ) + " ) " ; <nl> + } else if ( locked = = 2 ) { <nl> + suffix = " ( " + TTR ( " Grouped " ) + " ) " ; <nl> + } <nl> + selection_menu - > add_item ( ( String ) item - > get_name ( ) + suffix ) ; <nl> selection_menu - > set_item_icon ( i , icon ) ; <nl> selection_menu - > set_item_metadata ( i , node_path ) ; <nl> selection_menu - > set_item_tooltip ( i , String ( item - > get_name ( ) ) + " \ nType : " + item - > get_class ( ) + " \ nPath : " + node_path ) ; <nl> mmm a / editor / plugins / canvas_item_editor_plugin . h <nl> ppp b / editor / plugins / canvas_item_editor_plugin . h <nl> class CanvasItemEditor : public VBoxContainer { <nl> bool _is_node_locked ( const Node * p_node ) ; <nl> bool _is_node_movable ( const Node * p_node , bool p_popup_warning = false ) ; <nl> void _find_canvas_items_at_pos ( const Point2 & p_pos , Node * p_node , Vector < _SelectResult > & r_items , const Transform2D & p_parent_xform = Transform2D ( ) , const Transform2D & p_canvas_xform = Transform2D ( ) ) ; <nl> - void _get_canvas_items_at_pos ( const Point2 & p_pos , Vector < _SelectResult > & r_items ) ; <nl> + void _get_canvas_items_at_pos ( const Point2 & p_pos , Vector < _SelectResult > & r_items , bool p_ignore_groups = false ) ; <nl> void _get_bones_at_pos ( const Point2 & p_pos , Vector < _SelectResult > & r_items ) ; <nl> <nl> void _find_canvas_items_in_rect ( const Rect2 & p_rect , Node * p_node , List < CanvasItem * > * r_items , const Transform2D & p_parent_xform = Transform2D ( ) , const Transform2D & p_canvas_xform = Transform2D ( ) ) ; <nl> mmm a / editor / plugins / spatial_editor_plugin . cpp <nl> ppp b / editor / plugins / spatial_editor_plugin . cpp <nl> void SpatialEditorViewport : : _clear_selected ( ) { <nl> editor_selection - > clear ( ) ; <nl> } <nl> <nl> - void SpatialEditorViewport : : _select_clicked ( bool p_append , bool p_single ) { <nl> + void SpatialEditorViewport : : _select_clicked ( bool p_append , bool p_single , bool p_allow_locked ) { <nl> <nl> if ( ! clicked ) <nl> return ; <nl> void SpatialEditorViewport : : _select_clicked ( bool p_append , bool p_single ) { <nl> if ( ! selected ) <nl> return ; <nl> <nl> - / / Replace the node by the group if grouped <nl> - while ( node & & node ! = editor - > get_edited_scene ( ) - > get_parent ( ) ) { <nl> - Spatial * selected_tmp = Object : : cast_to < Spatial > ( node ) ; <nl> - if ( selected_tmp & & node - > has_meta ( " _edit_group_ " ) ) { <nl> - selected = selected_tmp ; <nl> + if ( ! p_allow_locked ) { <nl> + / / Replace the node by the group if grouped <nl> + while ( node & & node ! = editor - > get_edited_scene ( ) - > get_parent ( ) ) { <nl> + Spatial * selected_tmp = Object : : cast_to < Spatial > ( node ) ; <nl> + if ( selected_tmp & & node - > has_meta ( " _edit_group_ " ) ) { <nl> + selected = selected_tmp ; <nl> + } <nl> + node = node - > get_parent ( ) ; <nl> } <nl> - node = node - > get_parent ( ) ; <nl> } <nl> <nl> - if ( ! _is_node_locked ( selected ) ) <nl> + if ( p_allow_locked | | ! _is_node_locked ( selected ) ) { <nl> _select ( selected , clicked_wants_append , true ) ; <nl> + } <nl> } <nl> <nl> void SpatialEditorViewport : : _select ( Node * p_node , bool p_append , bool p_single ) { <nl> void SpatialEditorViewport : : _list_select ( Ref < InputEventMouseButton > b ) { <nl> selection_results . clear ( ) ; <nl> <nl> if ( clicked ) { <nl> - _select_clicked ( clicked_wants_append , true ) ; <nl> + _select_clicked ( clicked_wants_append , true , spatial_editor - > get_tool_mode ( ) ! = SpatialEditor : : TOOL_MODE_LIST_SELECT ) ; <nl> clicked = 0 ; <nl> } <nl> <nl> void SpatialEditorViewport : : _list_select ( Ref < InputEventMouseButton > b ) { <nl> <nl> String node_path = " / " + root_name + " / " + root_path . rel_path_to ( spat - > get_path ( ) ) ; <nl> <nl> - selection_menu - > add_item ( spat - > get_name ( ) ) ; <nl> + int locked = 0 ; <nl> + if ( _is_node_locked ( spat ) ) { <nl> + locked = 1 ; <nl> + } else { <nl> + Node * ed_scene = editor - > get_edited_scene ( ) ; <nl> + Node * node = spat ; <nl> + <nl> + while ( node & & node ! = ed_scene - > get_parent ( ) ) { <nl> + Spatial * selected_tmp = Object : : cast_to < Spatial > ( node ) ; <nl> + if ( selected_tmp & & node - > has_meta ( " _edit_group_ " ) ) { <nl> + locked = 2 ; <nl> + } <nl> + node = node - > get_parent ( ) ; <nl> + } <nl> + } <nl> + <nl> + String suffix = String ( ) ; <nl> + if ( locked = = 1 ) { <nl> + suffix = " ( " + TTR ( " Locked " ) + " ) " ; <nl> + } else if ( locked = = 2 ) { <nl> + suffix = " ( " + TTR ( " Grouped " ) + " ) " ; <nl> + } <nl> + selection_menu - > add_item ( ( String ) spat - > get_name ( ) + suffix ) ; <nl> selection_menu - > set_item_icon ( i , icon ) ; <nl> selection_menu - > set_item_metadata ( i , node_path ) ; <nl> selection_menu - > set_item_tooltip ( i , String ( spat - > get_name ( ) ) + " \ nType : " + spat - > get_class ( ) + " \ nPath : " + node_path ) ; <nl> void SpatialEditorViewport : : _selection_result_pressed ( int p_result ) { <nl> clicked = selection_results [ p_result ] . item - > get_instance_id ( ) ; <nl> <nl> if ( clicked ) { <nl> - _select_clicked ( clicked_wants_append , true ) ; <nl> + _select_clicked ( clicked_wants_append , true , spatial_editor - > get_tool_mode ( ) ! = SpatialEditor : : TOOL_MODE_LIST_SELECT ) ; <nl> clicked = 0 ; <nl> } <nl> } <nl> mmm a / editor / plugins / spatial_editor_plugin . h <nl> ppp b / editor / plugins / spatial_editor_plugin . h <nl> class SpatialEditorViewport : public Control { <nl> void _update_name ( ) ; <nl> void _compute_edit ( const Point2 & p_point ) ; <nl> void _clear_selected ( ) ; <nl> - void _select_clicked ( bool p_append , bool p_single ) ; <nl> + void _select_clicked ( bool p_append , bool p_single , bool p_allow_locked = false ) ; <nl> void _select ( Node * p_node , bool p_append , bool p_single ) ; <nl> ObjectID _select_ray ( const Point2 & p_pos , bool p_append , bool & r_includes_current , int * r_gizmo_handle = NULL , bool p_alt_select = false ) ; <nl> void _find_items_at_pos ( const Point2 & p_pos , bool & r_includes_current , Vector < _RayResult > & results , bool p_alt_select = false ) ; <nl>
|
Include locked nodes on selection list
|
godotengine/godot
|
de77bda605ac049665d6c09ba1b8bd0651da3e79
|
2020-02-10T12:59:24Z
|
mmm a / THCBlas . cu <nl> ppp b / THCBlas . cu <nl> void THCudaBlas_ger ( THCState * state , long m , long n , float alpha , float * x , long <nl> " with the bound [ val ] < = % d " , INT_MAX ) ; <nl> } <nl> <nl> - / * Level 3 * / <nl> - void THCudaBlas_gemm ( THCState * state , char transa , char transb , long m , long n , long k , float alpha , float * a , long lda , float * b , long ldb , float beta , float * c , long ldc ) <nl> + cublasOperation_t convertTransToCublasOperation ( char trans ) { <nl> + if ( trans = = ' t ' ) return CUBLAS_OP_T ; <nl> + else if ( trans = = ' n ' ) return CUBLAS_OP_N ; <nl> + else if ( trans = = ' c ' ) return CUBLAS_OP_C ; <nl> + else { <nl> + THError ( " trans must be one of : t , n , c " ) ; <nl> + return CUBLAS_OP_T ; <nl> + } <nl> + } <nl> + <nl> + void adjustLd ( char transa , char transb , long m , long n , long k , long * lda , long * ldb , long * ldc ) <nl> { <nl> int transa_ = ( ( transa = = ' t ' ) | | ( transa = = ' T ' ) ) ; <nl> int transb_ = ( ( transb = = ' t ' ) | | ( transb = = ' T ' ) ) ; <nl> <nl> if ( n = = 1 ) <nl> - ldc = m ; <nl> + * ldc = m ; <nl> <nl> if ( transa_ ) <nl> { <nl> if ( m = = 1 ) <nl> - lda = k ; <nl> + * lda = k ; <nl> } <nl> else <nl> { <nl> if ( k = = 1 ) <nl> - lda = m ; <nl> + * lda = m ; <nl> } <nl> <nl> if ( transb_ ) <nl> { <nl> if ( k = = 1 ) <nl> - ldb = n ; <nl> + * ldb = n ; <nl> } <nl> else <nl> { <nl> if ( n = = 1 ) <nl> - ldb = k ; <nl> + * ldb = k ; <nl> } <nl> + } <nl> <nl> - cublasOperation_t opa ; <nl> - if ( transa = = ' t ' ) opa = CUBLAS_OP_T ; <nl> - else if ( transa = = ' n ' ) opa = CUBLAS_OP_N ; <nl> - else if ( transa = = ' c ' ) opa = CUBLAS_OP_C ; <nl> - else THError ( " transa must be one of : t , n , c " ) ; <nl> - <nl> - cublasOperation_t opb ; <nl> - if ( transb = = ' t ' ) opb = CUBLAS_OP_T ; <nl> - else if ( transb = = ' n ' ) opb = CUBLAS_OP_N ; <nl> - else if ( transb = = ' c ' ) opb = CUBLAS_OP_C ; <nl> - else THError ( " transb must be one of : t , n , c " ) ; <nl> + / * Level 3 * / <nl> + void THCudaBlas_gemm ( THCState * state , char transa , char transb , long m , long n , long k , float alpha , float * a , long lda , float * b , long ldb , float beta , float * c , long ldc ) <nl> + { <nl> + adjustLd ( transa , transb , m , n , k , & lda , & ldb , & ldc ) ; <nl> + cublasOperation_t opa = convertTransToCublasOperation ( transa ) ; <nl> + cublasOperation_t opb = convertTransToCublasOperation ( transb ) ; <nl> <nl> if ( ( m < = INT_MAX ) & & ( n < = INT_MAX ) & & ( k < = INT_MAX ) & & ( lda < = INT_MAX ) & & ( ldb < = INT_MAX ) & & ( ldc < = INT_MAX ) ) <nl> { <nl> void THCudaBlas_gemm ( THCState * state , char transa , char transb , long m , long n , <nl> THError ( " Cublas_gemm only supports m , n , k , lda , ldb , ldc " <nl> " with the bound [ val ] < = % d " , INT_MAX ) ; <nl> } <nl> + <nl> + void THCudaBlas_gemmBatched ( THCState * state , char transa , char transb , long m , long n , long k , <nl> + float alpha , const float * a [ ] , long lda , const float * b [ ] , long ldb , <nl> + float beta , float * c [ ] , long ldc , long batchCount ) <nl> + { <nl> + if ( ( m > = INT_MAX ) | | ( n > = INT_MAX ) | | ( k > = INT_MAX ) | | ( lda > = INT_MAX ) | | ( ldb > = INT_MAX ) | | ( ldc > = INT_MAX ) | | ( batchCount > = INT_MAX ) ) <nl> + { <nl> + THError ( " Cublas_gemm only supports m , n , k , lda , ldb , ldc , batchCount " <nl> + " with the bound [ val ] < = % d " , INT_MAX ) ; <nl> + } <nl> + <nl> + adjustLd ( transa , transb , m , n , k , & lda , & ldb , & ldc ) ; <nl> + cublasOperation_t opa = convertTransToCublasOperation ( transa ) ; <nl> + cublasOperation_t opb = convertTransToCublasOperation ( transb ) ; <nl> + <nl> + THCublasCheck ( cublasSgemmBatched ( * state - > blasState - > current_handle , <nl> + opa , opb , ( int ) m , ( int ) n , ( int ) k , <nl> + & alpha , a , ( int ) lda , b , ( int ) ldb , & beta , c , ( int ) ldc , <nl> + ( int ) batchCount ) ) ; <nl> + } <nl> mmm a / THCBlas . h <nl> ppp b / THCBlas . h <nl> THC_API void THCudaBlas_ger ( THCState * state , long m , long n , float alpha , float <nl> <nl> / * Level 3 * / <nl> THC_API void THCudaBlas_gemm ( THCState * state , char transa , char transb , long m , long n , long k , float alpha , float * a , long lda , float * b , long ldb , float beta , float * c , long ldc ) ; <nl> + THC_API void THCudaBlas_gemmBatched ( THCState * state , char transa , char transb , long m , long n , long k , <nl> + float alpha , const float * a [ ] , long lda , const float * b [ ] , long ldb , <nl> + float beta , float * c [ ] , long ldc , long batchCount ) ; <nl> <nl> # endif <nl> mmm a / THCTensorMath . cu <nl> ppp b / THCTensorMath . cu <nl> void THCudaTensor_addr ( THCState * state , THCudaTensor * r_ , float beta , THCudaTens <nl> } <nl> } <nl> <nl> + void THCudaTensor_baddbmm ( THCState * state , THCudaTensor * result , float beta , THCudaTensor * t , <nl> + float alpha , THCudaTensor * batch1 , THCudaTensor * batch2 ) { <nl> + THArgCheck ( THCudaTensor_nDimension ( state , t ) = = 3 , 4 , " expected 3D tensor " ) ; <nl> + THArgCheck ( THCudaTensor_nDimension ( state , batch1 ) = = 3 , 6 , " expected 3D tensor " ) ; <nl> + THArgCheck ( THCudaTensor_nDimension ( state , batch2 ) = = 3 , 7 , " expected 3D tensor " ) ; <nl> + THArgCheck ( THCudaTensor_size ( state , t , 0 ) = = THCudaTensor_size ( state , batch1 , 0 ) , 6 , <nl> + " equal number of batches expected " ) ; <nl> + THArgCheck ( THCudaTensor_size ( state , t , 0 ) = = THCudaTensor_size ( state , batch2 , 0 ) , 7 , <nl> + " equal number of batches expected " ) ; <nl> + THArgCheck ( THCudaTensor_size ( state , t , 1 ) = = THCudaTensor_size ( state , batch1 , 1 ) , 6 , <nl> + " wrong matrix size " ) ; <nl> + THArgCheck ( THCudaTensor_size ( state , t , 2 ) = = THCudaTensor_size ( state , batch2 , 2 ) , 7 , <nl> + " wrong matrix size " ) ; <nl> + THArgCheck ( THCudaTensor_size ( state , batch1 , 2 ) = = THCudaTensor_size ( state , batch2 , 1 ) , 6 , <nl> + " wrong matrix size " ) ; <nl> + <nl> + if ( t ! = result ) { <nl> + THCudaTensor_resizeAs ( state , result , t ) ; <nl> + THCudaTensor_copy ( state , result , t ) ; <nl> + } <nl> + <nl> + bool transpose_result ; <nl> + char transpose_batch1 , transpose_batch2 ; <nl> + long lda , ldb , ldc ; <nl> + THCudaTensor * result_ , * batch1_ , * batch2_ ; <nl> + if ( result - > stride [ 1 ] = = 1 ) <nl> + { <nl> + transpose_result = false ; <nl> + result_ = result ; <nl> + ldc = result_ - > stride [ 2 ] ; <nl> + } <nl> + else if ( result - > stride [ 2 ] = = 1 ) <nl> + { <nl> + transpose_result = true ; <nl> + <nl> + THCudaTensor * swap = batch2 ; <nl> + batch2 = batch1 ; <nl> + batch1 = swap ; <nl> + <nl> + result_ = result ; <nl> + ldc = result_ - > stride [ 1 ] ; <nl> + } <nl> + else <nl> + { <nl> + transpose_result = false ; <nl> + <nl> + result_ = THCudaTensor_newWithSize3d ( state , result - > size [ 0 ] , result - > size [ 2 ] , result - > size [ 1 ] ) ; <nl> + THCudaTensor_copy ( state , result_ , result ) ; <nl> + THCudaTensor_transpose ( state , result_ , NULL , 1 , 2 ) ; <nl> + <nl> + ldc = result_ - > stride [ 2 ] ; <nl> + } <nl> + <nl> + if ( batch1 - > stride [ transpose_result ? 2 : 1 ] = = 1 ) <nl> + { <nl> + transpose_batch1 = ' n ' ; <nl> + batch1_ = batch1 ; <nl> + lda = batch1_ - > stride [ transpose_result ? 1 : 2 ] ; <nl> + } <nl> + else if ( batch1 - > stride [ transpose_result ? 1 : 2 ] = = 1 ) <nl> + { <nl> + transpose_batch1 = ' t ' ; <nl> + batch1_ = batch1 ; <nl> + lda = batch1_ - > stride [ transpose_result ? 2 : 1 ] ; <nl> + } <nl> + else <nl> + { <nl> + transpose_batch1 = transpose_result ? ' n ' : ' t ' ; <nl> + batch1_ = THCudaTensor_newContiguous ( state , batch1 ) ; <nl> + lda = batch1_ - > stride [ 1 ] ; <nl> + } <nl> + <nl> + if ( batch2 - > stride [ transpose_result ? 2 : 1 ] = = 1 ) <nl> + { <nl> + transpose_batch2 = ' n ' ; <nl> + batch2_ = batch2 ; <nl> + ldb = batch2_ - > stride [ transpose_result ? 1 : 2 ] ; <nl> + } <nl> + else if ( batch2 - > stride [ transpose_result ? 1 : 2 ] = = 1 ) <nl> + { <nl> + transpose_batch2 = ' t ' ; <nl> + batch2_ = batch2 ; <nl> + ldb = batch2_ - > stride [ transpose_result ? 2 : 1 ] ; <nl> + } <nl> + else <nl> + { <nl> + transpose_batch2 = transpose_result ? ' n ' : ' t ' ; <nl> + batch2_ = THCudaTensor_newContiguous ( state , batch2 ) ; <nl> + ldb = batch2_ - > stride [ 1 ] ; <nl> + } <nl> + <nl> + / / Compute pointers to matrices in each batch . <nl> + long num_batches = result_ - > size [ 0 ] ; <nl> + size_t matrices_size = num_batches * sizeof ( float * ) ; <nl> + const float * * matrices1 = ( const float * * ) THAlloc ( matrices_size ) ; <nl> + const float * * matrices2 = ( const float * * ) THAlloc ( matrices_size ) ; <nl> + float * * result_matrices = ( float * * ) THAlloc ( matrices_size ) ; <nl> + for ( int i = 0 ; i < num_batches ; + + i ) <nl> + { <nl> + matrices1 [ i ] = THCudaTensor_data ( state , batch1_ ) + i * batch1_ - > stride [ 0 ] ; <nl> + matrices2 [ i ] = THCudaTensor_data ( state , batch2_ ) + i * batch2_ - > stride [ 0 ] ; <nl> + result_matrices [ i ] = THCudaTensor_data ( state , result_ ) + i * result_ - > stride [ 0 ] ; <nl> + } <nl> + <nl> + / / Copy pointers to device . <nl> + const float * * d_matrices1 , * * d_matrices2 ; <nl> + float * * d_result_matrices ; <nl> + THCudaCheck ( cudaMalloc ( & d_matrices1 , matrices_size ) ) ; <nl> + THCudaCheck ( cudaMalloc ( & d_matrices2 , matrices_size ) ) ; <nl> + THCudaCheck ( cudaMalloc ( & d_result_matrices , matrices_size ) ) ; <nl> + <nl> + THCudaCheck ( cudaMemcpyAsync ( d_matrices1 , matrices1 , matrices_size , cudaMemcpyHostToDevice ) ) ; <nl> + THCudaCheck ( cudaMemcpyAsync ( d_matrices2 , matrices2 , matrices_size , cudaMemcpyHostToDevice ) ) ; <nl> + THCudaCheck ( cudaMemcpyAsync ( d_result_matrices , result_matrices , matrices_size , cudaMemcpyHostToDevice ) ) ; <nl> + <nl> + THCudaBlas_gemmBatched ( <nl> + state , <nl> + transpose_batch1 , <nl> + transpose_batch2 , <nl> + result_ - > size [ transpose_result ? 2 : 1 ] , <nl> + result_ - > size [ transpose_result ? 1 : 2 ] , <nl> + batch1_ - > size [ transpose_result ? 1 : 2 ] , <nl> + alpha , <nl> + d_matrices1 , lda , <nl> + d_matrices2 , ldb , <nl> + beta , <nl> + d_result_matrices , ldc , <nl> + num_batches ) ; <nl> + <nl> + cudaFree ( d_matrices1 ) ; <nl> + cudaFree ( d_matrices2 ) ; <nl> + cudaFree ( d_result_matrices ) ; <nl> + THFree ( matrices1 ) ; <nl> + THFree ( matrices2 ) ; <nl> + THFree ( result_matrices ) ; <nl> + <nl> + if ( batch1_ ! = batch1 ) <nl> + THCudaTensor_free ( state , batch1_ ) ; <nl> + <nl> + if ( batch2_ ! = batch2 ) <nl> + THCudaTensor_free ( state , batch2_ ) ; <nl> + <nl> + if ( result_ ! = result ) <nl> + THCudaTensor_freeCopyTo ( state , result_ , result ) ; <nl> + } <nl> + <nl> # define IMPLEMENT_CUDA_TENSOR_BASIC_FUNC ( NAME , CFUNC ) \ <nl> struct NAME # # _functor \ <nl> { \ <nl> mmm a / THCTensorMath . h <nl> ppp b / THCTensorMath . h <nl> THC_API void THCudaTensor_prod ( THCState * state , THCudaTensor * self , THCudaTensor <nl> THC_API void THCudaTensor_addmv ( THCState * state , THCudaTensor * self , float beta , THCudaTensor * t , float alpha , THCudaTensor * mat , THCudaTensor * vec ) ; <nl> THC_API void THCudaTensor_addmm ( THCState * state , THCudaTensor * self , float beta , THCudaTensor * t , float alpha , THCudaTensor * mat1 , THCudaTensor * mat2 ) ; <nl> THC_API void THCudaTensor_addr ( THCState * state , THCudaTensor * self , float beta , THCudaTensor * t , float alpha , THCudaTensor * vec1 , THCudaTensor * vec2 ) ; <nl> + THC_API void THCudaTensor_baddbmm ( THCState * state , THCudaTensor * result , float beta , THCudaTensor * t , <nl> + float alpha , THCudaTensor * batch1 , THCudaTensor * batch2 ) ; <nl> <nl> THC_API void THCudaTensor_log ( THCState * state , THCudaTensor * self , THCudaTensor * src ) ; <nl> THC_API void THCudaTensor_log1p ( THCState * state , THCudaTensor * self , THCudaTensor * src ) ; <nl>
|
Add bmm and baddbmm .
|
pytorch/pytorch
|
f3854a8731c83bf55d089503d2a8f18b26fe1f2d
|
2015-01-27T18:05:34Z
|
mmm a / tools / linux - tick - processor <nl> ppp b / tools / linux - tick - processor <nl> fi <nl> [ " $ D8_PATH " ] | | D8_PATH = $ tools_path / . . <nl> d8_exec = $ D8_PATH / d8 <nl> <nl> - if [ " $ 1 " = " - - no - build " ] ; then <nl> - shift <nl> - else <nl> - # compile d8 if it doesn ' t exist , assuming this script <nl> - # resides in the repository . <nl> - [ - x $ d8_exec ] | | scons - j4 - C $ D8_PATH - Y $ tools_path / . . d8 <nl> + if [ ! - x $ d8_exec ] ; then <nl> + echo " d8 shell not found in $ D8_PATH " <nl> + echo " To build , execute ' scons < flags > d8 ' from the V8 directory " <nl> + exit 1 <nl> fi <nl> <nl> <nl>
|
Don ' t try to build d8 from profiler tick processor scripts .
|
v8/v8
|
792a6652ad0f5bb0b31c30182db88e019b9a2150
|
2011-07-05T05:27:10Z
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.