diff options
| author | magumagu <magumagu9@gmail.com> | 2015-01-25 15:49:35 -0800 |
|---|---|---|
| committer | magumagu <magumagu9@gmail.com> | 2015-01-25 15:49:35 -0800 |
| commit | ef75f3005d5e09edaa739d298f644be1f28e3f19 (patch) | |
| tree | 4cd5554a4364cf288001ded42e857ee67c4406cb /Source/Core/VideoCommon/TextureConversionShader.cpp | |
| parent | 4e9497cdb85ecbd088ca06fb501496aa0c8240a7 (diff) | |
WIP.
Diffstat (limited to 'Source/Core/VideoCommon/TextureConversionShader.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureConversionShader.cpp | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index 8734eb42c3..3e09113518 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -70,21 +70,24 @@ static void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType) WRITE(p, " out vec4 ocol0;\n"); WRITE(p, "void main()\n"); + WRITE(p, "{\n" + " int2 sampleUv;\n" + " int2 uv1 = int2(gl_FragCoord.xy);\n" + ); } else // D3D { - WRITE(p,"sampler samp0 : register(s0);\n"); + WRITE(p, "sampler samp0 : register(s0);\n"); WRITE(p, "Texture2D Tex0 : register(t0);\n"); - WRITE(p,"void main(\n"); - WRITE(p," out float4 ocol0 : SV_Target)\n"); + WRITE(p, "void main(\n"); + WRITE(p, " out float4 ocol0 : SV_Target, in float4 rawpos : SV_Position)\n"); + WRITE(p, "{\n" + " int2 sampleUv;\n" + " int2 uv1 = int2((rawpos + 1) / 2 * float2(640, 528));\n" + ); } - WRITE(p, "{\n" - " int2 sampleUv;\n" - " int2 uv1 = int2(gl_FragCoord.xy);\n" - ); - WRITE(p, " int y_block_position = uv1.y & %d;\n", ~(blkH - 1)); WRITE(p, " int y_offset_in_block = uv1.y & %d;\n", blkH - 1); WRITE(p, " int x_virtual_position = (uv1.x << %d) + y_offset_in_block * position.z;\n", IntLog2(samples)); @@ -116,9 +119,18 @@ static void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType) static void WriteSampleColor(char*& p, const char* colorComp, const char* dest, int xoffset, API_TYPE ApiType) { - WRITE(p, " %s = texture(samp0, float3(uv0 + float2(%d, 0) * sample_offset, 0.0)).%s;\n", - dest, xoffset, colorComp - ); + if (ApiType == API_OPENGL) + { + WRITE(p, " %s = texture(samp0, float3(uv0 + float2(%d, 0) * sample_offset, 0.0)).%s;\n", + dest, xoffset, colorComp + ); + } + else + { + WRITE(p, " %s = Tex0.Sample(samp0, float3(uv0 + float2(%d, 0) * sample_offset, 0.0)).%s;\n", + dest, xoffset, colorComp + ); + } } static void WriteColorToIntensity(char*& p, const char* src, const char* dest) @@ -134,6 +146,7 @@ static void WriteColorToIntensity(char*& p, const char* src, const char* dest) static void WriteToBitDepth(char*& p, u8 depth, const char* src, const char* dest) { + //WRITE(p, " ocol0 = float4(1,1,1,1;\n"); WRITE(p, " %s = floor(%s * 255.0 / exp2(8.0 - %d.0));\n", dest, src, depth); } |
