9 changed files with 1 additions and 150 deletions
-
1.gitignore
-
BINPackages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/Plugins/PS5/PSSRPlugin.prx
-
4Tools/PSSRPlugin/PSSRPlugin.vcxproj
-
12Tools/PSSRPlugin/PSSRPlugin.vcxproj.filters
-
3Tools/PSSRPlugin/common.h
-
86Tools/PSSRPlugin/mfsr.cpp
-
36Tools/PSSRPlugin/prx.cpp
-
7Tools/PSSRPlugin/psml.cpp
-
2Tools/PSSRPlugin/pssrplugin.cpp
@ -1,3 +0,0 @@ |
|||
#pragma once |
|||
|
|||
#define PSML_EXPORT __declspec (dllexport) |
|||
@ -1,86 +0,0 @@ |
|||
#include "common.h"
|
|||
#include <psml_mfsr.h>
|
|||
#include <agc/core/sync.h>
|
|||
|
|||
using namespace sce::Psml; |
|||
|
|||
struct MfsrCommandInitializationData |
|||
{ |
|||
MfsrProfile profile; |
|||
uint16_t outputColorWidth; |
|||
uint16_t outputColorHeight; |
|||
}; |
|||
|
|||
struct MfsrCommandExecutionData |
|||
{ |
|||
|
|||
}; |
|||
|
|||
struct MfsrTextureTable |
|||
{ |
|||
sce::Agc::Core::Texture* colorInput; |
|||
sce::Agc::Core::Texture* colorOutput; |
|||
sce::Agc::Core::Texture* depth; |
|||
sce::Agc::Core::Texture* exposureTexture; |
|||
sce::Agc::Core::Texture* motionVectors; |
|||
sce::Agc::Core::Texture* reactiveMask; |
|||
}; |
|||
|
|||
PSML_EXPORT bool CreateMfsrContext(const MfsrCommandInitializationData* initSettings, MfsrContext* context, MfsrSharedResources* sharedResources) |
|||
{ |
|||
int res = initMfsr(); |
|||
if (res != SCE_OK && res != SCE_PSML_MFSR_ERROR_ALREADY_INITIALIZED) |
|||
{ |
|||
// TODO: log error code
|
|||
return false; |
|||
} |
|||
|
|||
// TODO: figure out what the exact purpose of the shared resources is exactly.
|
|||
// Does it map one-to-one with the MfsrContext or do we only ever need a single shared resources instance?
|
|||
// This affects how we should model the internal data and the interface exposed to C#.
|
|||
//
|
|||
// Seems to be shared between all contexts. Just use a fixed MfsrProfile as Quality is the only one that exists right now anyway.
|
|||
// See also: https://p.siedev.net/resources/documents/SDK/9.000/PSML_MFSR-Overview/0002.html#__document_toc_00000011
|
|||
MfsrSharedResourcesInitParameters resParams; |
|||
resParams.init(); |
|||
resParams.m_profile = initSettings->profile; |
|||
|
|||
createMfsrSharedResources(sharedResources, &resParams); // TODO: handle error
|
|||
|
|||
MfsrContextInitParameters initParams; |
|||
initParams.init(); |
|||
initParams.m_profile = initSettings->profile; |
|||
initParams.m_outputColorWidth = initSettings->outputColorWidth; |
|||
initParams.m_outputColorHeight = initSettings->outputColorHeight; |
|||
// TODO: allocate buffers for previous frames
|
|||
|
|||
createMfsrContext(context, &initParams); // TODO: handle error
|
|||
|
|||
return true; |
|||
} |
|||
|
|||
PSML_EXPORT void DestroyMfsrContext(MfsrContext context, MfsrSharedResources sharedResources) |
|||
{ |
|||
releaseMfsrContext(context); |
|||
releaseMfsrSharedResources(sharedResources); |
|||
} |
|||
|
|||
PSML_EXPORT void ExecuteMfsr(sce::Agc::DrawCommandBuffer* cmd, MfsrContext context, const MfsrTextureTable* textures) // TODO: add dispatch params (initData & executeData)
|
|||
{ |
|||
// TODO: flushing cache on input textures equivalent to SyncCacheOp::kFlushWritesToGl2 may be necessary, depending on what Unity does or doesn't do internally.
|
|||
// This means basically invalidating all write caches, making sure that dispatchMfsr() gets to see all the latest data when it reads from the input textures.
|
|||
// See technote: https://p.siedev.net/technotes/view/644/1
|
|||
|
|||
DispatchMfsrParameters dispatchParams; |
|||
dispatchParams.init(); // TODO: might want to reuse these params as init() is relatively expensive
|
|||
dispatchParams.m_color = textures->colorInput; |
|||
dispatchParams.m_outputColor = textures->colorOutput; |
|||
dispatchParams.m_depth = textures->depth; |
|||
dispatchParams.m_exposure = textures->exposureTexture; |
|||
dispatchParams.m_motionVectors = textures->motionVectors; |
|||
dispatchParams.m_reactiveMask = textures->reactiveMask; |
|||
// TODO: add data from initData & executeData
|
|||
// TODO: where exactly do the shared resources feature in all this?
|
|||
|
|||
dispatchMfsr(context, cmd, &dispatchParams); // TODO: handle error
|
|||
} |
|||
@ -1,36 +0,0 @@ |
|||
#include <libsysmodule.h>
|
|||
#include <psml/mfsr.h>
|
|||
|
|||
// We need to provide an export to force the expected stub library to be generated
|
|||
__declspec (dllexport) void dummy() |
|||
{ |
|||
if (sceSysmoduleLoadModule(SCE_SYSMODULE_PSML) != SCE_OK) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
sce::Psml::initMfsr(); // TODO: probably returns an error code if PSSR is not supported (0 is okay, SCE_PSML_MFSR_ERROR_ALREADY_INITIALIZED is also okay, everything else is error)
|
|||
|
|||
sce::Psml::MfsrSharedResourcesInitParameters resParams; |
|||
resParams.init(); |
|||
|
|||
sce::Psml::MfsrSharedResources sharedResources; |
|||
sce::Psml::createMfsrSharedResources(&sharedResources, &resParams); // TODO: handle error
|
|||
|
|||
sce::Psml::MfsrContextInitParameters initParams; |
|||
initParams.init(); |
|||
|
|||
sce::Psml::MfsrContext context; |
|||
sce::Psml::createMfsrContext(&context, &initParams); // TODO: handle error
|
|||
|
|||
sce::Psml::DispatchMfsrParameters dispatchParams; |
|||
dispatchParams.init(); // TOOD: get this stuff from Unity
|
|||
|
|||
sce::Psml::dispatchMfsr(context, nullptr, &dispatchParams); // TODO: get command buffer pointer from Unity
|
|||
|
|||
sce::Psml::releaseMfsrContext(context); |
|||
context = nullptr; |
|||
|
|||
sce::Psml::releaseMfsrSharedResources(sharedResources); |
|||
sharedResources = nullptr; |
|||
} |
|||
@ -1,7 +0,0 @@ |
|||
#include "common.h"
|
|||
#include <libsysmodule.h>
|
|||
|
|||
PSML_EXPORT bool Load() |
|||
{ |
|||
return sceSysmoduleLoadModule(SCE_SYSMODULE_PSML) == SCE_SYSMODULE_LOADED; |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue