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

44 lines
1.3 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
{
2022-09-04 15:47:37 +02:00
static const auto FOURCC_RESZ = static_cast<D3DDDIFORMAT>(MAKEFOURCC('R', 'E', 'S', 'Z'));
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'));
2019-07-26 00:26:44 +02:00
struct FormatInfo
{
2022-09-04 15:47:37 +02:00
struct Component
{
BYTE bitCount;
BYTE pos;
};
BYTE bitsPerPixel;
2019-07-26 00:26:44 +02:00
BYTE bytesPerPixel;
2022-09-04 15:47:37 +02:00
Component unused;
Component alpha;
Component red;
Component green;
Component blue;
Component depth;
Component stencil;
2019-07-26 00:26:44 +02:00
2022-09-04 15:47:37 +02:00
FormatInfo();
FormatInfo(BYTE unusedBitCount, BYTE alphaBitCount, BYTE redBitCount, BYTE greenBitCount, BYTE blueBitCount);
FormatInfo(BYTE unusedBitCount, BYTE depthBitCount, BYTE stencilBitCount);
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);
2019-07-26 00:26:44 +02:00
FormatInfo getFormatInfo(D3DDDIFORMAT format);
DDPIXELFORMAT getPixelFormat(D3DDDIFORMAT format);
2019-07-26 00:26:44 +02:00
}