Files
LookingGlass/idd/LGIdd/effect/CDownsampleEffect.h
Geoffrey McRae 1b7c00dc82
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
[idd] driver: implement postprocess filters
2026-06-03 08:59:48 +10:00

63 lines
1.6 KiB
C++

/**
* Looking Glass
* Copyright © 2017-2026 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.
*/
#pragma once
#include "CComputeEffect.h"
#include <vector>
#include <string>
class CDownsampleEffect : public CComputeEffect
{
private:
struct Rule
{
bool greater = false;
unsigned x = 0;
unsigned y = 0;
unsigned targetX = 0;
unsigned targetY = 0;
};
struct Consts
{
float width;
float height;
} m_consts = {};
std::vector<Rule> m_rules;
ComPtr<ID3D12Resource> m_constBuffer;
DXGI_FORMAT m_format = DXGI_FORMAT_UNKNOWN;
double m_scaleX = 1.0;
double m_scaleY = 1.0;
unsigned m_width = 0;
unsigned m_height = 0;
bool ParseRules(const std::wstring& value);
const Rule * MatchRule(unsigned width, unsigned height) const;
public:
const char * GetName() const override { return "Downsample"; }
bool Init(const ComPtr<ID3D12Device3>& device);
PostProcessStatus SetFormat(const ComPtr<ID3D12Device3>& device,
const D12FrameFormat& src, D12FrameFormat& dst) override;
void AdjustDamage(RECT dirtyRects[], unsigned * nbDirtyRects) override;
ComPtr<ID3D12Resource> Run(const ComPtr<ID3D12Device3>& device,
const ComPtr<ID3D12GraphicsCommandList>& commandList,
const ComPtr<ID3D12Resource>& src, RECT dirtyRects[],
unsigned * nbDirtyRects) override;
};