mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
D3D: Add SBS/TAB output support.
This commit is contained in:
@ -422,20 +422,20 @@ int CD3DFont::DrawTextScaled(float x, float y, float size, float spacing, u32 dw
|
||||
ID3D11SamplerState* linear_copy_sampler = nullptr;
|
||||
ID3D11SamplerState* point_copy_sampler = nullptr;
|
||||
|
||||
struct STQVertex { float x, y, z, u, v, w; };
|
||||
struct STSQVertex { float x, y, z, u, v, w; };
|
||||
struct STQVertex { float x, y, z, u, v, w, g; };
|
||||
struct STSQVertex { float x, y, z, u, v, w, g; };
|
||||
struct ClearVertex { float x, y, z; u32 col; };
|
||||
struct ColVertex { float x, y, z; u32 col; };
|
||||
|
||||
struct
|
||||
{
|
||||
float u1, v1, u2, v2, G;
|
||||
float u1, v1, u2, v2, S, G;
|
||||
} tex_quad_data;
|
||||
|
||||
struct
|
||||
{
|
||||
MathUtil::Rectangle<float> rdest;
|
||||
float u1, v1, u2, v2, G;
|
||||
float u1, v1, u2, v2, S, G;
|
||||
} tex_sub_quad_data;
|
||||
|
||||
struct
|
||||
@ -512,7 +512,8 @@ void drawShadedTexQuad(ID3D11ShaderResourceView* texture,
|
||||
ID3D11PixelShader* PShader,
|
||||
ID3D11VertexShader* Vshader,
|
||||
ID3D11InputLayout* layout,
|
||||
float Gamma)
|
||||
float Gamma,
|
||||
u32 slice)
|
||||
{
|
||||
float sw = 1.0f /(float) SourceWidth;
|
||||
float sh = 1.0f /(float) SourceHeight;
|
||||
@ -520,19 +521,21 @@ void drawShadedTexQuad(ID3D11ShaderResourceView* texture,
|
||||
float u2 = ((float)rSource->right) * sw;
|
||||
float v1 = ((float)rSource->top) * sh;
|
||||
float v2 = ((float)rSource->bottom) * sh;
|
||||
float S = (float)slice;
|
||||
float G = 1.0f / Gamma;
|
||||
|
||||
STQVertex coords[4] = {
|
||||
{-1.0f, 1.0f, 0.0f, u1, v1, G},
|
||||
{ 1.0f, 1.0f, 0.0f, u2, v1, G},
|
||||
{-1.0f,-1.0f, 0.0f, u1, v2, G},
|
||||
{ 1.0f,-1.0f, 0.0f, u2, v2, G},
|
||||
{-1.0f, 1.0f, 0.0f, u1, v1, S, G},
|
||||
{ 1.0f, 1.0f, 0.0f, u2, v1, S, G},
|
||||
{-1.0f,-1.0f, 0.0f, u1, v2, S, G},
|
||||
{ 1.0f,-1.0f, 0.0f, u2, v2, S, G},
|
||||
};
|
||||
|
||||
// only upload the data to VRAM if it changed
|
||||
if (stq_observer ||
|
||||
tex_quad_data.u1 != u1 || tex_quad_data.v1 != v1 ||
|
||||
tex_quad_data.u2 != u2 || tex_quad_data.v2 != v2 || tex_quad_data.G != G)
|
||||
tex_quad_data.u2 != u2 || tex_quad_data.v2 != v2 ||
|
||||
tex_quad_data.S != S || tex_quad_data.G != G)
|
||||
{
|
||||
stq_offset = util_vbuf->AppendData(coords, sizeof(coords), sizeof(STQVertex));
|
||||
stq_observer = false;
|
||||
@ -541,7 +544,8 @@ void drawShadedTexQuad(ID3D11ShaderResourceView* texture,
|
||||
tex_quad_data.v1 = v1;
|
||||
tex_quad_data.u2 = u2;
|
||||
tex_quad_data.v2 = v2;
|
||||
tex_quad_data.G = G;
|
||||
tex_quad_data.S = S;
|
||||
tex_quad_data.G = G;
|
||||
}
|
||||
UINT stride = sizeof(STQVertex);
|
||||
UINT offset = 0;
|
||||
@ -568,7 +572,8 @@ void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture,
|
||||
ID3D11PixelShader* PShader,
|
||||
ID3D11VertexShader* Vshader,
|
||||
ID3D11InputLayout* layout,
|
||||
float Gamma)
|
||||
float Gamma,
|
||||
u32 slice)
|
||||
{
|
||||
float sw = 1.0f /(float) SourceWidth;
|
||||
float sh = 1.0f /(float) SourceHeight;
|
||||
@ -576,20 +581,22 @@ void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture,
|
||||
float u2 = (rSource->right ) * sw;
|
||||
float v1 = (rSource->top ) * sh;
|
||||
float v2 = (rSource->bottom) * sh;
|
||||
float S = (float)slice;
|
||||
float G = 1.0f / Gamma;
|
||||
|
||||
STSQVertex coords[4] = {
|
||||
{ rDest->left , rDest->bottom, 0.0f, u1, v2, G},
|
||||
{ rDest->right, rDest->bottom, 0.0f, u2, v2, G},
|
||||
{ rDest->left , rDest->top , 0.0f, u1, v1, G},
|
||||
{ rDest->right, rDest->top , 0.0f, u2, v1, G},
|
||||
{ rDest->left , rDest->bottom, 0.0f, u1, v2, S, G},
|
||||
{ rDest->right, rDest->bottom, 0.0f, u2, v2, S, G},
|
||||
{ rDest->left , rDest->top , 0.0f, u1, v1, S, G},
|
||||
{ rDest->right, rDest->top , 0.0f, u2, v1, S, G},
|
||||
};
|
||||
|
||||
// only upload the data to VRAM if it changed
|
||||
if (stsq_observer ||
|
||||
memcmp(rDest, &tex_sub_quad_data.rdest, sizeof(*rDest)) != 0 ||
|
||||
tex_sub_quad_data.u1 != u1 || tex_sub_quad_data.v1 != v1 ||
|
||||
tex_sub_quad_data.u2 != u2 || tex_sub_quad_data.v2 != v2 || tex_sub_quad_data.G != G)
|
||||
tex_sub_quad_data.u2 != u2 || tex_sub_quad_data.v2 != v2 ||
|
||||
tex_sub_quad_data.S != S || tex_sub_quad_data.G != G)
|
||||
{
|
||||
stsq_offset = util_vbuf->AppendData(coords, sizeof(coords), sizeof(STSQVertex));
|
||||
stsq_observer = false;
|
||||
@ -598,6 +605,7 @@ void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture,
|
||||
tex_sub_quad_data.v1 = v1;
|
||||
tex_sub_quad_data.u2 = u2;
|
||||
tex_sub_quad_data.v2 = v2;
|
||||
tex_sub_quad_data.S = S;
|
||||
tex_sub_quad_data.G = G;
|
||||
memcpy(&tex_sub_quad_data.rdest, &rDest, sizeof(rDest));
|
||||
}
|
||||
|
Reference in New Issue
Block a user