1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

48 lines
1.4 KiB
C
Raw Normal View History

2019-07-26 00:26:44 +02:00
#pragma once
#include <d3d.h>
#include <d3dumddi.h>
2022-08-15 23:59:15 +02:00
#include <D3dDdi/DeviceState.h>
2019-07-26 00:26:44 +02:00
namespace D3dDdi
{
static const auto FOURCC_DF16 = static_cast<D3DDDIFORMAT>(MAKEFOURCC('D', 'F', '1', '6'));
static const auto FOURCC_DF24 = static_cast<D3DDDIFORMAT>(MAKEFOURCC('D', 'F', '2', '4'));
2022-09-04 15:47:37 +02:00
static const auto FOURCC_INTZ = static_cast<D3DDDIFORMAT>(MAKEFOURCC('I', 'N', 'T', 'Z'));
static const auto FOURCC_NULL = static_cast<D3DDDIFORMAT>(MAKEFOURCC('N', 'U', 'L', 'L'));
static const auto FOURCC_RESZ = static_cast<D3DDDIFORMAT>(MAKEFOURCC('R', 'E', 'S', 'Z'));
2022-09-04 15:47:37 +02:00
2019-07-26 00:26:44 +02:00
struct FormatInfo
{
2022-09-04 15:47:37 +02:00
struct Component
{
2022-12-17 13:43:52 +01:00
BYTE bitCount = 0;
BYTE pos = 0;
2022-09-04 15:47:37 +02:00
};
2022-12-17 13:43:52 +01:00
BYTE bitsPerPixel = 0;
BYTE bytesPerPixel = 0;
2022-09-04 15:47:37 +02:00
Component unused;
Component alpha;
Component red;
Component green;
Component blue;
2022-12-17 13:43:52 +01:00
Component palette;
2022-09-04 15:47:37 +02:00
Component depth;
Component stencil;
2022-12-17 13:43:52 +01:00
Component luminance;
Component du;
Component dv;
DDPIXELFORMAT pixelFormat = {};
2019-07-26 00:26:44 +02:00
};
2022-08-15 23:59:15 +02:00
D3DCOLOR convertFrom32Bit(const FormatInfo& dstFormatInfo, D3DCOLOR srcColor);
DeviceState::ShaderConstF convertToShaderConst(const FormatInfo& srcFormatInfo, D3DCOLOR srcColor);
2022-09-04 15:47:37 +02:00
DWORD getComponent(D3DCOLOR color, const D3dDdi::FormatInfo::Component& component);
float getComponentAsFloat(D3DCOLOR color, const D3dDdi::FormatInfo::Component& component);
2022-12-17 13:43:52 +01:00
D3DDDIFORMAT getFormat(const DDPIXELFORMAT& pixelFormat);
2019-07-26 00:26:44 +02:00
FormatInfo getFormatInfo(D3DDDIFORMAT format);
DDPIXELFORMAT getPixelFormat(D3DDDIFORMAT format);
2019-07-26 00:26:44 +02:00
}