mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-02 11:02:28 +02:00
OGL: use integer uniforms for efb2ram texture converter
This commit is contained in:
parent
1138c2e155
commit
687097d4bc
@ -296,9 +296,9 @@ int EncodeToRamFromTexture(u32 address,GLuint source_texture, bool bFromZBuffer,
|
|||||||
s32 expandedHeight = (height + blkH) & (~blkH);
|
s32 expandedHeight = (height + blkH) & (~blkH);
|
||||||
|
|
||||||
texconv_shader.Bind();
|
texconv_shader.Bind();
|
||||||
glUniform4f(texconv_shader.UniformLocations[0],
|
glUniform4i(texconv_shader.UniformLocations[0],
|
||||||
float(source.left), float(source.top),
|
source.left, source.top,
|
||||||
(float)expandedWidth, bScaleByHalf ? 2.f : 1.f);
|
expandedWidth, bScaleByHalf ? 2 : 1);
|
||||||
|
|
||||||
TargetRectangle scaledSource;
|
TargetRectangle scaledSource;
|
||||||
scaledSource.top = 0;
|
scaledSource.top = 0;
|
||||||
|
@ -62,7 +62,7 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
|||||||
{
|
{
|
||||||
// left, top, of source rectangle within source texture
|
// left, top, of source rectangle within source texture
|
||||||
// width of the destination rectangle, scale_factor (1 or 2)
|
// width of the destination rectangle, scale_factor (1 or 2)
|
||||||
WRITE(p, "uniform float4 " I_COLORS";\n");
|
WRITE(p, "uniform int4 " I_COLORS";\n");
|
||||||
|
|
||||||
int blkW = TexDecoder_GetBlockWidthInTexels(format);
|
int blkW = TexDecoder_GetBlockWidthInTexels(format);
|
||||||
int blkH = TexDecoder_GetBlockHeightInTexels(format);
|
int blkH = TexDecoder_GetBlockHeightInTexels(format);
|
||||||
@ -97,7 +97,7 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
|||||||
WRITE(p, " int yl = uv1.y / %d;\n", blkH);
|
WRITE(p, " int yl = uv1.y / %d;\n", blkH);
|
||||||
WRITE(p, " int yb = yl * %d;\n", blkH);
|
WRITE(p, " int yb = yl * %d;\n", blkH);
|
||||||
WRITE(p, " int yoff = uv1.y - yb;\n");
|
WRITE(p, " int yoff = uv1.y - yb;\n");
|
||||||
WRITE(p, " int xp = uv1.x + yoff * int(" I_COLORS".z);\n");
|
WRITE(p, " int xp = uv1.x + yoff * " I_COLORS".z;\n");
|
||||||
WRITE(p, " int xel = xp / %d;\n", samples == 1 ? factor : blkW);
|
WRITE(p, " int xel = xp / %d;\n", samples == 1 ? factor : blkW);
|
||||||
WRITE(p, " int xb = xel / %d;\n", blkH);
|
WRITE(p, " int xb = xel / %d;\n", blkH);
|
||||||
WRITE(p, " int xoff = xel - xb * %d;\n", blkH);
|
WRITE(p, " int xoff = xel - xb * %d;\n", blkH);
|
||||||
@ -111,13 +111,13 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
|||||||
|
|
||||||
void WriteSampleColor(char*& p, const char* colorComp, const char* dest, int xoffset, API_TYPE ApiType)
|
void WriteSampleColor(char*& p, const char* colorComp, const char* dest, int xoffset, API_TYPE ApiType)
|
||||||
{
|
{
|
||||||
WRITE(p, // sampleUv is the sample position in (int)gx_coords
|
WRITE(p, // sampleUv is the sample position in (int)gx_coords
|
||||||
"uv0 = float2(sampleUv + int2(%d, 0));\n" // pixel offset (if more than one pixel is samped)
|
"uv0 = float2(sampleUv + int2(%d, 0)" // pixel offset (if more than one pixel is samped)
|
||||||
"uv0 *= " I_COLORS".w;\n" // scale by two (if wanted)
|
" + " I_COLORS".xy);\n" // move to copyed rect
|
||||||
"uv0 += " I_COLORS".xy;\n" // move to copyed rect
|
"uv0 += float2(0.5, 0.5);\n" // move to center of pixel
|
||||||
"uv0 += float2(0.5, 0.5);\n" // move to center of pixel
|
"uv0 *= float(" I_COLORS".w);\n" // scale by two if needed (this will move to pixels border to filter linear)
|
||||||
"uv0 /= float2(%d, %d);\n" // normlize to [0:1]
|
"uv0 /= float2(%d, %d);\n" // normlize to [0:1]
|
||||||
"uv0.y = 1.0-uv0.y;\n" // ogl foo (disable this line for d3d)
|
"uv0.y = 1.0-uv0.y;\n" // ogl foo (disable this line for d3d)
|
||||||
"%s = texture(samp0, uv0).%s;\n",
|
"%s = texture(samp0, uv0).%s;\n",
|
||||||
xoffset, EFB_WIDTH, EFB_HEIGHT, dest, colorComp
|
xoffset, EFB_WIDTH, EFB_HEIGHT, dest, colorComp
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user