[host] dxgi: move the backend interface into a separate header

This commit is contained in:
Geoffrey McRae 2023-11-07 18:33:31 +11:00
parent 748c9c177e
commit eb2796d40b
5 changed files with 73 additions and 17 deletions

View File

@ -0,0 +1,60 @@
/**
* Looking Glass
* Copyright © 2017-2023 The Looking Glass Authors
* https://looking-glass.io
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 59
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _H_DXGI_BACKEND_
#define _H_DXGI_BACKEND_
#include "dxgi_capture.h"
struct DXGIInterface;
struct Texture;
struct DXGICopyBackend
{
// friendly name
const char * name;
// internal code name
const char * code;
// create the copy backend
bool (*create)(struct DXGIInterface * intf);
// configure the copy backend with the specified format
bool (*configure)(unsigned width, unsigned height,
DXGI_FORMAT format, unsigned * pitch);
// free the copy backend
void (*free)(void);
// called each captured frame after post processing to copy the frame
bool (*copyFrame)(struct Texture * tex, ID3D11Texture2D * src);
// maps the copied frame into memory
CaptureResult (*mapTexture)(struct Texture * tex);
// unmaps the copied frame from memory
void (*unmapTexture)(struct Texture * tex);
// called just before the frame is released by the frontend
void (*preRelease)(void);
};
#endif

View File

@ -18,7 +18,7 @@
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "dxgi_capture.h"
#include "backend.h"
#include "com_ref.h"
#include <assert.h>

View File

@ -18,7 +18,7 @@
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "dxgi_capture.h"
#include "backend.h"
#include "com_ref.h"
#include <assert.h>

View File

@ -18,6 +18,9 @@
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _H_DXGI_CAPTURE_
#define _H_DXGI_CAPTURE_
#include "pp.h"
#include <stdint.h>
@ -33,6 +36,8 @@
#include "common/vector.h"
#include "interface/capture.h"
#include "backend.h"
enum TextureState
{
TEXTURE_STATE_UNUSED,
@ -64,8 +69,6 @@ struct FrameDamage
FrameDamageRect rects[KVMFR_MAX_DAMAGE_RECTS];
};
struct DXGICopyBackend;
struct DXGIInterface
{
bool initialized;
@ -119,16 +122,4 @@ struct DXGIInterface
struct FrameDamage frameDamage[LGMP_Q_FRAME_LEN];
};
struct DXGICopyBackend
{
const char * name;
const char * code;
bool (*create)(struct DXGIInterface * intf);
bool (*configure)(unsigned width, unsigned height,
DXGI_FORMAT format, unsigned * pitch);
void (*free)(void);
bool (*copyFrame)(Texture * tex, ID3D11Texture2D * src);
CaptureResult (*mapTexture)(Texture * tex);
void (*unmapTexture)(Texture * tex);
void (*preRelease)(void);
};
#endif

View File

@ -18,6 +18,9 @@
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _H_DXGI_PP_
#define _H_DXGI_PP_
#include <d3d11.h>
#include <stdbool.h>
@ -58,3 +61,5 @@ typedef struct
void (*finish)(void);
}
DXGIPostProcess;
#endif