diff --git a/app/shaders/d3d11_video_pixel.hlsl b/app/shaders/d3d11_video_pixel.hlsl index b74f0f6c..83d02b45 100644 --- a/app/shaders/d3d11_video_pixel.hlsl +++ b/app/shaders/d3d11_video_pixel.hlsl @@ -17,7 +17,7 @@ struct ShaderInput min16float4 main(ShaderInput input) : SV_TARGET { float y = luminancePlane.Sample(theSampler, input.tex); - float2 uv = chrominancePlane.Sample(theSampler, input.tex); + float2 uv = chrominancePlane.Sample(theSampler, input.tex); float3 yuv = float3(y, uv); // Subtract the YUV offset for limited vs full range diff --git a/app/streaming/video/ffmpeg-renderers/d3d11va.cpp b/app/streaming/video/ffmpeg-renderers/d3d11va.cpp index 8df7c3e2..518ad63e 100644 --- a/app/streaming/video/ffmpeg-renderers/d3d11va.cpp +++ b/app/streaming/video/ffmpeg-renderers/d3d11va.cpp @@ -83,7 +83,6 @@ D3D11VARenderer::D3D11VARenderer() m_FrameWaitableObject(nullptr), m_VideoPixelShader(nullptr), m_VideoVertexBuffer(nullptr), - m_VideoConstantBuffer(nullptr), m_OverlayLock(0), m_OverlayPixelShader(nullptr), m_HwDeviceContext(nullptr), @@ -100,7 +99,6 @@ D3D11VARenderer::~D3D11VARenderer() { SDL_DestroyMutex(m_ContextLock); - SAFE_COM_RELEASE(m_VideoConstantBuffer); SAFE_COM_RELEASE(m_VideoVertexBuffer); SAFE_COM_RELEASE(m_VideoPixelShader); @@ -739,9 +737,6 @@ void D3D11VARenderer::updateColorConversionConstants(AVFrame* frame) return; } - // Free any existing buffer - SAFE_COM_RELEASE(m_VideoConstantBuffer); - D3D11_BUFFER_DESC constDesc = {}; constDesc.ByteWidth = sizeof(CSC_CONST_BUF); constDesc.Usage = D3D11_USAGE_IMMUTABLE; @@ -789,9 +784,13 @@ void D3D11VARenderer::updateColorConversionConstants(AVFrame* frame) D3D11_SUBRESOURCE_DATA constData = {}; constData.pSysMem = &constBuf; - HRESULT hr = m_Device->CreateBuffer(&constDesc, &constData, &m_VideoConstantBuffer); - if (FAILED(hr)) { - m_VideoConstantBuffer = nullptr; + ID3D11Buffer* constantBuffer; + HRESULT hr = m_Device->CreateBuffer(&constDesc, &constData, &constantBuffer); + if (SUCCEEDED(hr)) { + m_DeviceContext->PSSetConstantBuffers(0, 1, &constantBuffer); + constantBuffer->Release(); + } + else { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ID3D11Device::CreateBuffer() failed: %x", hr); @@ -849,9 +848,8 @@ void D3D11VARenderer::renderVideo(AVFrame* frame) m_DeviceContext->PSSetShaderResources(1, 1, &chrominanceTextureView); chrominanceTextureView->Release(); - // Bind video pixel shader and CSC constants + // Bind video pixel shader m_DeviceContext->PSSetShader(m_VideoPixelShader, nullptr, 0); - m_DeviceContext->PSSetConstantBuffers(0, 1, &m_VideoConstantBuffer); // Draw the video m_DeviceContext->DrawIndexed(6, 0, 0); diff --git a/app/streaming/video/ffmpeg-renderers/d3d11va.h b/app/streaming/video/ffmpeg-renderers/d3d11va.h index d5db7f58..252d2ba2 100644 --- a/app/streaming/video/ffmpeg-renderers/d3d11va.h +++ b/app/streaming/video/ffmpeg-renderers/d3d11va.h @@ -52,7 +52,6 @@ private: ID3D11PixelShader* m_VideoPixelShader; ID3D11Buffer* m_VideoVertexBuffer; - ID3D11Buffer* m_VideoConstantBuffer; SDL_SpinLock m_OverlayLock; ID3D11Buffer* m_OverlayVertexBuffers[Overlay::OverlayMax];