Program Listing for File player.h
↰ Return to documentation for file (include\playback\player.h
)
/******************************************************************************
© Intel Corporation.
This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.
This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.
******************************************************************************/
#pragma once
#include "serialization/apicallcontext.h"
#include "layer-system/layer-system.h"
#include "playback-support/playback-listener.h"
#include "playback-support/playback-support.h"
#include <vector>
#include <memory>
#include <cstdint>
#include <thread>
#include "concurrent/semaphore.h"
#include "concurrent/critical-section.h"
namespace gpa {
struct Surface;
struct PlaybackHookCallbacks;
namespace serialization {
class Storage;
class RandomAccessSerializer;
} // namespace serialization
namespace playback {
struct Context;
class Callable;
class Player
{
public:
Player(TCHAR const* const* prePlaybackLayers, TCHAR const* const* postPlaybackLayers,
serialization::Storage* resourceStorage, playback::IPlaybackListener* playbackListener,
LayerArgLookup const* argLookup = nullptr, bool enableD3D12DDIHooks = true);
Player(TCHAR const* const* prePlaybackLayers, TCHAR const* const* postPlaybackLayers,
serialization::Storage* resourceStorage, playback::IPlaybackListener* playbackListener,
STD_STRING const& processNameOverride, LayerArgLookup const* argLookup = nullptr,
bool enableD3D12DDIHooks = true);
~Player();
bool UpdateContext(Callable* callable, bool isRepeating = false, uint64_t repeatPass = 0);
bool Play(Callable* callable, bool isRepeating = false, bool isRepeated = false,
uint64_t repeatPass = 0, bool releaseCallableResources = true, bool shouldExecute = true);
gpa::Surface* RequestSurface(SurfaceCreateInfo const& surfaceCreateInfo);
bool Ingress(Callable* callable, const void** params = nullptr, size_t paramCount = 0);
bool Egress(Callable* callable, bool releaseResources = false, uint64_t returnValue = 0);
void SetProcessNameOverride(STD_STRING const& nameOverride);
void SetAgilitySDKPath(TCHAR const* path);
private:
playback::Context mContext;
bool mContextUpdated = false;
std::unique_ptr<serialization::RandomAccessSerializer> mResourceSerializer;
// for overriding the reported process name, to enable driver-side title optimizations
STD_STRING mProcessNameOverride;
std::string mAgilitySDKPath;
#if defined(_WIN32)
// resident hook callbacks
std::unique_ptr<PlaybackHookCallbacks> mPlaybackHookCallbacks;
#endif
STD_STRING GetProcessNameOverride(const STD_STRING& moduleFilename);
void Initialize(TCHAR const* const* prePlaybackLayers, TCHAR const* const* postPlaybackLayers,
serialization::Storage* resourceStorage, playback::IPlaybackListener* playbackListener,
LayerArgLookup const* argLookup, bool enableD3D12DDIHooks);
};
} // namespace playback
} // namespace gpa