Commit 15c3c927 authored by Martin Finkel's avatar Martin Finkel
Browse files

some more printf + remove commented out code

parent 00c8dfa7
......@@ -5,6 +5,7 @@
// #if SUPPORT_D3D11
#include <assert.h>
#include <tchar.h>
#include <windows.h>
......@@ -95,11 +96,12 @@ struct render_context
ID3D11ShaderResourceView *textureShaderInput;
ID3D11RenderTargetView *textureRenderTarget;
ID3D11Texture2D *texture2;
// ID3D11Texture2D *texture2;
ID3D11ShaderResourceView *textureShaderInput2;
ID3D11RenderTargetView *textureRenderTarget2;
// ID3D11RenderTargetView *textureRenderTarget2;
CRITICAL_SECTION sizeLock; // the ReportSize callback cannot be called during/after the Cleanup_cb is called
std::mutex text_lock;
unsigned width, height;
void (*ReportSize)(void *ReportOpaque, unsigned width, unsigned height);
void *ReportOpaque;
......@@ -139,7 +141,6 @@ private:
render_context Context;
const UINT Width = SCREEN_WIDTH;
const UINT Height = SCREEN_HEIGHT;
std::mutex text_lock;
void* Hwnd = (void*)424242;
bool initialized;
};
......@@ -274,18 +275,6 @@ void RenderAPI_D3D11::CreateResources(struct render_context *ctx)
pMultithread->Release();
}
// D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc = {
// .Format = DXGI_FORMAT_R8G8B8A8_UNORM,
// .ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D,
// };
// hr = ctx->d3device->CreateRenderTargetView(ctx->texture2, &renderTargetViewDesc, &ctx->textureRenderTarget2);
// if (FAILED(hr))
// {
// DEBUG("FAILED ctx->d3device->CreateRenderTargetView(ctx->texture, &renderTargetViewDesc, &ctx->textureRenderTarget)");
// abort();
// }
DEBUG("Compiling shaders....\n");
ID3D10Blob *VS, *PS, *pErrBlob;
......@@ -502,12 +491,13 @@ bool RenderAPI_D3D11::UpdateOutput_cb( void *opaque, const libvlc_video_direct3d
void RenderAPI_D3D11::Swap_cb( void* opaque )
{
DEBUG("SWAP");
DEBUG("libvlc SWAP \n");
struct render_context *ctx = static_cast<struct render_context *>( opaque );
// std::swap(ctx->texture2, ctx->texture);
//std::lock_guard<std::mutex> lock(ctx->text_lock);
ctx->updated = true;
std::swap(ctx->textureShaderInput2, ctx->textureShaderInput2);
// ctx->d3dctx->OMSetRenderTargets(1, &ctx->textureRenderTarget, NULL);
}
void RenderAPI_D3D11::EndRender(struct render_context *ctx)
......@@ -622,21 +612,7 @@ void* RenderAPI_D3D11::getVideoFrame(bool* out_updated)
{
DEBUG("Entering getVideoFrame \n");
if(Context.updated)
{
DEBUG("Context.updated is true \n");
}
else
{
DEBUG("Context.updated is false \n");
}
out_updated = &Context.updated;
// return (void*)Context.texture;
return (void*)Context.textureShaderInput;
//return nullptr;
return (void*)Context.textureShaderInput2;
// std::lock_guard<std::mutex> lock(text_lock);
// if (out_updated)
......
......@@ -178,10 +178,13 @@ static void UNITY_INTERFACE_API OnRenderEvent(int eventID)
void TextureUpdateCallback(int eventID, void* data)
{
DEBUG("Entering TextureUpdateCallback \n");
auto event = static_cast<UnityRenderingExtEventType>(eventID);
if (event == kUnityRenderingExtEventUpdateTextureBeginV2)
{
DEBUG("event is kUnityRenderingExtEventUpdateTextureBeginV2 \n");
auto *pParams = reinterpret_cast<UnityRenderingExtTextureUpdateParamsV2*>(data);
if(mp == NULL)
......@@ -192,18 +195,27 @@ void TextureUpdateCallback(int eventID, void* data)
bool* updated;
if (!s_CurrentAPI) {
DEBUG("Error, no Render API");
DEBUG("Error, no Render API \n");
if (updated)
*updated = false;
return;
}
DEBUG("calling s_CurrentAPI->getVideoFrame(updated) \n");
void* tex = s_CurrentAPI->getVideoFrame(updated);
DEBUG("SWAPPING -===================");
DEBUG("SWAPPING -=================== \n");
std::swap(tex, pParams->texData);
}
else if (event == kUnityRenderingExtEventUpdateTextureEndV2)
{
{
DEBUG("event is kUnityRenderingExtEventUpdateTextureEndV2 \n");
auto *pParams = reinterpret_cast<UnityRenderingExtTextureUpdateParamsV2*>(data);
if(pParams->texData != nullptr)
{
pParams->texData = nullptr;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment