remove ubo for efb2ram
This commit is contained in:
parent
f3d663c2f4
commit
b18c0a5d1b
|
@ -76,15 +76,6 @@ const char* WriteRegister(API_TYPE ApiType, const char *prefix, const u32 num)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *WriteLocation(API_TYPE ApiType)
|
|
||||||
{
|
|
||||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
|
||||||
return "";
|
|
||||||
static char result[64];
|
|
||||||
sprintf(result, "uniform ");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// block dimensions : widthStride, heightStride
|
// block dimensions : widthStride, heightStride
|
||||||
// texture dims : width, height, x offset, y offset
|
// texture dims : width, height, x offset, y offset
|
||||||
void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
||||||
|
@ -92,13 +83,7 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
||||||
// [0] left, top, right, bottom of source rectangle within source texture
|
// [0] left, top, right, bottom of source rectangle within source texture
|
||||||
// [1] width and height of destination texture in pixels
|
// [1] width and height of destination texture in pixels
|
||||||
// Two were merged for GLSL
|
// Two were merged for GLSL
|
||||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
WRITE(p, "uniform float4 " I_COLORS"[2] %s;\n", WriteRegister(ApiType, "c", C_COLORS));
|
||||||
WRITE(p, "layout(std140) uniform PSBlock {\n");
|
|
||||||
|
|
||||||
WRITE(p, "%sfloat4 " I_COLORS"[2] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_COLORS));
|
|
||||||
|
|
||||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
|
||||||
WRITE(p, "};\n");
|
|
||||||
|
|
||||||
float blkW = (float)TexDecoder_GetBlockWidthInTexels(format);
|
float blkW = (float)TexDecoder_GetBlockWidthInTexels(format);
|
||||||
float blkH = (float)TexDecoder_GetBlockHeightInTexels(format);
|
float blkH = (float)TexDecoder_GetBlockHeightInTexels(format);
|
||||||
|
@ -178,11 +163,7 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
||||||
// [0] left, top, right, bottom of source rectangle within source texture
|
// [0] left, top, right, bottom of source rectangle within source texture
|
||||||
// [1] width and height of destination texture in pixels
|
// [1] width and height of destination texture in pixels
|
||||||
// Two were merged for GLSL
|
// Two were merged for GLSL
|
||||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
WRITE(p, "uniform float4 " I_COLORS"[2] %s;\n", WriteRegister(ApiType, "c", C_COLORS));
|
||||||
WRITE(p, "layout(std140) uniform PSBlock {\n");
|
|
||||||
WRITE(p, "%sfloat4 " I_COLORS"[2] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_COLORS));
|
|
||||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
|
||||||
WRITE(p, "};\n");
|
|
||||||
|
|
||||||
float blkW = (float)TexDecoder_GetBlockWidthInTexels(format);
|
float blkW = (float)TexDecoder_GetBlockWidthInTexels(format);
|
||||||
float blkH = (float)TexDecoder_GetBlockHeightInTexels(format);
|
float blkH = (float)TexDecoder_GetBlockHeightInTexels(format);
|
||||||
|
|
|
@ -61,6 +61,8 @@ static FRAGMENTSHADER s_ColorMatrixProgram;
|
||||||
static FRAGMENTSHADER s_DepthMatrixProgram;
|
static FRAGMENTSHADER s_DepthMatrixProgram;
|
||||||
static GLuint s_ColorMatrixUniform;
|
static GLuint s_ColorMatrixUniform;
|
||||||
static GLuint s_DepthMatrixUniform;
|
static GLuint s_DepthMatrixUniform;
|
||||||
|
static u32 s_ColorCbufid;
|
||||||
|
static u32 s_DepthCbufid;
|
||||||
static VERTEXSHADER s_vProgram;
|
static VERTEXSHADER s_vProgram;
|
||||||
|
|
||||||
struct VBOCache {
|
struct VBOCache {
|
||||||
|
@ -318,10 +320,14 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
||||||
|
|
||||||
if(srcFormat == PIXELFMT_Z24) {
|
if(srcFormat == PIXELFMT_Z24) {
|
||||||
ProgramShaderCache::SetBothShaders(s_DepthMatrixProgram.glprogid, s_vProgram.glprogid);
|
ProgramShaderCache::SetBothShaders(s_DepthMatrixProgram.glprogid, s_vProgram.glprogid);
|
||||||
|
if(s_DepthCbufid != cbufid)
|
||||||
glUniform4fv(s_DepthMatrixUniform, 5, colmat);
|
glUniform4fv(s_DepthMatrixUniform, 5, colmat);
|
||||||
|
s_DepthCbufid = cbufid;
|
||||||
} else {
|
} else {
|
||||||
ProgramShaderCache::SetBothShaders(s_ColorMatrixProgram.glprogid, s_vProgram.glprogid);
|
ProgramShaderCache::SetBothShaders(s_ColorMatrixProgram.glprogid, s_vProgram.glprogid);
|
||||||
|
if(s_ColorCbufid != cbufid)
|
||||||
glUniform4fv(s_ColorMatrixUniform, 7, colmat);
|
glUniform4fv(s_ColorMatrixUniform, 7, colmat);
|
||||||
|
s_ColorCbufid = cbufid;
|
||||||
}
|
}
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
|
@ -543,6 +549,8 @@ TextureCache::TextureCache()
|
||||||
s_ColorMatrixUniform = glGetUniformLocation(ProgramShaderCache::GetCurrentProgram(), "colmat");
|
s_ColorMatrixUniform = glGetUniformLocation(ProgramShaderCache::GetCurrentProgram(), "colmat");
|
||||||
ProgramShaderCache::SetBothShaders(s_DepthMatrixProgram.glprogid, s_vProgram.glprogid);
|
ProgramShaderCache::SetBothShaders(s_DepthMatrixProgram.glprogid, s_vProgram.glprogid);
|
||||||
s_DepthMatrixUniform = glGetUniformLocation(ProgramShaderCache::GetCurrentProgram(), "colmat");
|
s_DepthMatrixUniform = glGetUniformLocation(ProgramShaderCache::GetCurrentProgram(), "colmat");
|
||||||
|
s_ColorCbufid = -1;
|
||||||
|
s_DepthCbufid = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -361,12 +361,14 @@ int EncodeToRamFromTexture(u32 address,GLuint source_texture, bool bFromZBuffer,
|
||||||
ProgramShaderCache::SetBothShaders(texconv_shader.glprogid, s_vProgram.glprogid);
|
ProgramShaderCache::SetBothShaders(texconv_shader.glprogid, s_vProgram.glprogid);
|
||||||
|
|
||||||
float sampleStride = bScaleByHalf ? 2.f : 1.f;
|
float sampleStride = bScaleByHalf ? 2.f : 1.f;
|
||||||
TextureConversionShader::SetShaderParameters((float)expandedWidth,
|
|
||||||
(float)Renderer::EFBToScaledY(expandedHeight), // TODO: Why do we scale this?
|
float params[] = {
|
||||||
(float)Renderer::EFBToScaledX(source.left),
|
Renderer::EFBToScaledXf(sampleStride), Renderer::EFBToScaledYf(sampleStride),
|
||||||
(float)Renderer::EFBToScaledY(EFB_HEIGHT - source.top - expandedHeight),
|
0.0f, 0.0f,
|
||||||
Renderer::EFBToScaledXf(sampleStride),
|
(float)expandedWidth, (float)Renderer::EFBToScaledY(expandedHeight)-1,
|
||||||
Renderer::EFBToScaledYf(sampleStride));
|
(float)Renderer::EFBToScaledX(source.left), (float)Renderer::EFBToScaledY(EFB_HEIGHT - source.top - expandedHeight)
|
||||||
|
};
|
||||||
|
glUniform4fv(glGetUniformLocation(ProgramShaderCache::GetCurrentProgram(), I_COLORS), 2, params);
|
||||||
|
|
||||||
TargetRectangle scaledSource;
|
TargetRectangle scaledSource;
|
||||||
scaledSource.top = 0;
|
scaledSource.top = 0;
|
||||||
|
|
Loading…
Reference in New Issue