#pragma once
#include <cstdint>
#include <d3d11.h>
#include "Common/GPU/thin3d.h"
struct D3D11BlendKey {
union {
uint64_t value;
struct {
unsigned int blendEnable : 1;
unsigned int srcColor : 5;
unsigned int destColor : 5;
unsigned int srcAlpha : 5;
unsigned int destAlpha : 5;
unsigned int blendOpColor : 3;
unsigned int blendOpAlpha : 3;
unsigned int logicOpEnable : 1;
unsigned int logicOp : 4;
unsigned int colorWriteMask : 4;
};
};
};
struct D3D11DepthStencilKey {
union {
uint64_t value;
struct {
unsigned int depthTestEnable : 1;
unsigned int depthWriteEnable : 1;
unsigned int depthCompareOp : 4;
unsigned int stencilTestEnable : 1;
unsigned int stencilCompareFunc : 4;
unsigned int stencilPassOp : 4;
unsigned int stencilFailOp : 4;
unsigned int stencilDepthFailOp : 4;
unsigned int stencilWriteMask : 8;
unsigned int stencilCompareMask : 8;
};
};
};
struct D3D11RasterKey {
union {
uint32_t value;
struct {
unsigned int cullMode : 2;
unsigned int depthClipEnable : 1;
};
};
};
struct D3D11StateKeys {
D3D11BlendKey blend;
D3D11DepthStencilKey depthStencil;
D3D11RasterKey raster;
};
struct D3D11DynamicState {
int topology;
bool useBlendColor;
uint32_t blendColor;
bool useStencil;
uint8_t stencilRef;
Draw::Viewport viewport;
D3D11_RECT scissor;
};