Merge pull request #6730 from stenzek/no-gamma-param

D3D: Drop gamma parameter from util draw helper
This commit is contained in:
Markus Wick 2018-05-02 14:04:28 +02:00 committed by GitHub
commit 71c8c65e6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 32 deletions

View file

@ -487,11 +487,7 @@ static ID3D11SamplerState* point_copy_sampler = nullptr;
struct STQVertex
{
float x, y, z, u, v, w, g;
};
struct STSQVertex
{
float x, y, z, u, v, w, g;
float x, y, z, u, v, w;
};
struct ClearVertex
{
@ -589,7 +585,7 @@ void SetLinearCopySampler()
void drawShadedTexQuad(ID3D11ShaderResourceView* texture, const D3D11_RECT* rSource,
int SourceWidth, int SourceHeight, ID3D11PixelShader* PShader,
ID3D11VertexShader* VShader, ID3D11InputLayout* layout,
ID3D11GeometryShader* GShader, float Gamma, u32 slice)
ID3D11GeometryShader* GShader, u32 slice)
{
float sw = 1.0f / (float)SourceWidth;
float sh = 1.0f / (float)SourceHeight;
@ -598,18 +594,17 @@ void drawShadedTexQuad(ID3D11ShaderResourceView* texture, const D3D11_RECT* rSou
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, 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},
{-1.0f, 1.0f, 0.0f, u1, v1, S},
{1.0f, 1.0f, 0.0f, u2, v1, S},
{-1.0f, -1.0f, 0.0f, u1, v2, S},
{1.0f, -1.0f, 0.0f, u2, v2, S},
};
// 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.S != S || tex_quad_data.G != G)
tex_quad_data.v2 != v2 || tex_quad_data.S != S)
{
stq_offset = util_vbuf->AppendData(coords, sizeof(coords), sizeof(STQVertex));
stq_observer = false;
@ -619,7 +614,6 @@ void drawShadedTexQuad(ID3D11ShaderResourceView* texture, const D3D11_RECT* rSou
tex_quad_data.u2 = u2;
tex_quad_data.v2 = v2;
tex_quad_data.S = S;
tex_quad_data.G = G;
}
UINT stride = sizeof(STQVertex);
UINT offset = 0;

View file

@ -23,7 +23,7 @@ void SetLinearCopySampler();
void drawShadedTexQuad(ID3D11ShaderResourceView* texture, const D3D11_RECT* rSource,
int SourceWidth, int SourceHeight, ID3D11PixelShader* PShader,
ID3D11VertexShader* VShader, ID3D11InputLayout* layout,
ID3D11GeometryShader* GShader = nullptr, float Gamma = 1.0f, u32 slice = 0);
ID3D11GeometryShader* GShader = nullptr, u32 slice = 0);
void drawClearQuad(u32 Color, float z);
void drawColorQuad(u32 Color, float z, float x1, float y1, float x2, float y2);

View file

@ -180,11 +180,10 @@ void DXTexture::ScaleRectangleFromTexture(const AbstractTexture* source,
srcRC.right = srcrect.right;
srcRC.top = srcrect.top;
srcRC.bottom = srcrect.bottom;
D3D::drawShadedTexQuad(srcentry->m_texture->GetSRV(), &srcRC, srcentry->m_config.width,
srcentry->m_config.height, PixelShaderCache::GetColorCopyProgram(false),
VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout(),
GeometryShaderCache::GetCopyGeometryShader(), 1.0, 0);
D3D::drawShadedTexQuad(
srcentry->m_texture->GetSRV(), &srcRC, srcentry->m_config.width, srcentry->m_config.height,
PixelShaderCache::GetColorCopyProgram(false), VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout(), GeometryShaderCache::GetCopyGeometryShader(), 0);
g_renderer->RestoreAPIState();
}

View file

@ -89,13 +89,11 @@ const char copy_shader_code[] = {
"{\n"
" float4 vPosition : POSITION;\n"
" float3 vTexCoord : TEXCOORD0;\n"
" float vTexCoord1 : TEXCOORD1;\n"
"};\n"
"struct GSOUTPUT\n"
"{\n"
" float4 vPosition : POSITION;\n"
" float3 vTexCoord : TEXCOORD0;\n"
" float vTexCoord1 : TEXCOORD1;\n"
" uint slice : SV_RenderTargetArrayIndex;\n"
"};\n"
"[maxvertexcount(6)]\n"
@ -108,8 +106,7 @@ const char copy_shader_code[] = {
" GSOUTPUT OUT;\n"
" OUT.vPosition = o[i].vPosition;\n"
" OUT.vTexCoord = o[i].vTexCoord;\n"
" OUT.vTexCoord.z = slice;\n"
" OUT.vTexCoord1 = o[i].vTexCoord1;\n"
" OUT.vTexCoord.z = float(slice);\n"
" OUT.slice = slice;\n"
" Output.Append(OUT);\n"
" }\n"

View file

@ -870,13 +870,13 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
D3D::drawShadedTexQuad(src_texture->GetSRV(), src.AsRECT(), src_width, src_height,
PixelShaderCache::GetColorCopyProgram(false),
VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout(), nullptr, 1.0f, 0);
VertexShaderCache::GetSimpleInputLayout(), nullptr, 0);
D3D::context->RSSetViewports(1, &rightVp);
D3D::drawShadedTexQuad(src_texture->GetSRV(), src.AsRECT(), src_width, src_height,
PixelShaderCache::GetColorCopyProgram(false),
VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout(), nullptr, 1.0f, 1);
VertexShaderCache::GetSimpleInputLayout(), nullptr, 1);
}
else if (g_ActiveConfig.stereo_mode == StereoMode::Nvidia3DVision)
{
@ -895,13 +895,13 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
D3D::drawShadedTexQuad(src_texture->GetSRV(), src.AsRECT(), src_width, src_height,
PixelShaderCache::GetColorCopyProgram(false),
VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout(), nullptr, 1.0f, 0);
VertexShaderCache::GetSimpleInputLayout(), nullptr, 0);
D3D::context->RSSetViewports(1, &rightVp);
D3D::drawShadedTexQuad(src_texture->GetSRV(), src.AsRECT(), src_width, src_height,
PixelShaderCache::GetColorCopyProgram(false),
VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout(), nullptr, 1.0f, 1);
VertexShaderCache::GetSimpleInputLayout(), nullptr, 1);
// Copy the left eye to the backbuffer, if Nvidia 3D Vision is enabled it should
// recognize the signature and automatically include the right eye frame.
@ -926,7 +926,7 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
nullptr;
D3D::drawShadedTexQuad(src_texture->GetSRV(), src.AsRECT(), src_width, src_height, pixelShader,
VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout(), geomShader, 1.0f);
VertexShaderCache::GetSimpleInputLayout(), geomShader);
}
}

View file

@ -86,14 +86,12 @@ const char simple_shader_code[] = {
"{\n"
"float4 vPosition : POSITION;\n"
"float3 vTexCoord : TEXCOORD0;\n"
"float vTexCoord1 : TEXCOORD1;\n"
"};\n"
"VSOUTPUT main(float4 inPosition : POSITION,float4 inTEX0 : TEXCOORD0)\n"
"VSOUTPUT main(float4 inPosition : POSITION,float3 inTEX0 : TEXCOORD0)\n"
"{\n"
"VSOUTPUT OUT;\n"
"OUT.vPosition = inPosition;\n"
"OUT.vTexCoord = inTEX0.xyz;\n"
"OUT.vTexCoord1 = inTEX0.w;\n"
"OUT.vTexCoord = inTEX0;\n"
"return OUT;\n"
"}\n"};