mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Merge pull request #14 from degasus/uboWorkaroundRemove
OGL: Remove non-UBO code path.
This commit is contained in:
@ -283,23 +283,23 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
||||
}
|
||||
out.Write("\n");
|
||||
|
||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
if (ApiType == API_OPENGL)
|
||||
out.Write("layout(std140%s) uniform PSBlock {\n", g_ActiveConfig.backend_info.bSupportShadingLanguage420pack ? ", binding = 1" : "");
|
||||
|
||||
DeclareUniform(out, ApiType, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_COLORS, "float4", I_COLORS"[4]");
|
||||
DeclareUniform(out, ApiType, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_KCOLORS, "float4", I_KCOLORS"[4]");
|
||||
DeclareUniform(out, ApiType, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_ALPHA, "float4", I_ALPHA"[1]"); // TODO: Why is this an array...-.-
|
||||
DeclareUniform(out, ApiType, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_TEXDIMS, "float4", I_TEXDIMS"[8]");
|
||||
DeclareUniform(out, ApiType, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_ZBIAS, "float4", I_ZBIAS"[2]");
|
||||
DeclareUniform(out, ApiType, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_INDTEXSCALE, "float4", I_INDTEXSCALE"[2]");
|
||||
DeclareUniform(out, ApiType, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_INDTEXMTX, "float4", I_INDTEXMTX"[6]");
|
||||
DeclareUniform(out, ApiType, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_FOG, "float4", I_FOG"[3]");
|
||||
DeclareUniform(out, ApiType, C_COLORS, "float4", I_COLORS"[4]");
|
||||
DeclareUniform(out, ApiType, C_KCOLORS, "float4", I_KCOLORS"[4]");
|
||||
DeclareUniform(out, ApiType, C_ALPHA, "float4", I_ALPHA"[1]"); // TODO: Why is this an array...-.-
|
||||
DeclareUniform(out, ApiType, C_TEXDIMS, "float4", I_TEXDIMS"[8]");
|
||||
DeclareUniform(out, ApiType, C_ZBIAS, "float4", I_ZBIAS"[2]");
|
||||
DeclareUniform(out, ApiType, C_INDTEXSCALE, "float4", I_INDTEXSCALE"[2]");
|
||||
DeclareUniform(out, ApiType, C_INDTEXMTX, "float4", I_INDTEXMTX"[6]");
|
||||
DeclareUniform(out, ApiType, C_FOG, "float4", I_FOG"[3]");
|
||||
|
||||
// For pixel lighting - TODO: Should only be defined when per pixel lighting is enabled!
|
||||
DeclareUniform(out, ApiType, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_PLIGHTS, "float4", I_PLIGHTS"[40]");
|
||||
DeclareUniform(out, ApiType, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_PMATERIALS, "float4", I_PMATERIALS"[4]");
|
||||
DeclareUniform(out, ApiType, C_PLIGHTS, "float4", I_PLIGHTS"[40]");
|
||||
DeclareUniform(out, ApiType, C_PMATERIALS, "float4", I_PMATERIALS"[4]");
|
||||
|
||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
if (ApiType == API_OPENGL)
|
||||
out.Write("};\n");
|
||||
|
||||
if (ApiType == API_OPENGL)
|
||||
|
@ -174,18 +174,18 @@ static inline void WriteRegister(T& object, API_TYPE ApiType, const char *prefix
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static inline void WriteLocation(T& object, API_TYPE ApiType, bool using_ubos)
|
||||
static inline void WriteLocation(T& object, API_TYPE ApiType)
|
||||
{
|
||||
if (using_ubos)
|
||||
if (ApiType == API_OPENGL)
|
||||
return;
|
||||
|
||||
object.Write("uniform ");
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static inline void DeclareUniform(T& object, API_TYPE api_type, bool using_ubos, const u32 num, const char* type, const char* name)
|
||||
static inline void DeclareUniform(T& object, API_TYPE api_type, const u32 num, const char* type, const char* name)
|
||||
{
|
||||
WriteLocation(object, api_type, using_ubos);
|
||||
WriteLocation(object, api_type);
|
||||
object.Write("%s %s ", type, name);
|
||||
WriteRegister(object, api_type, "c", num);
|
||||
object.Write(";\n");
|
||||
|
@ -83,20 +83,20 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
|
||||
_assert_(bpmem.genMode.numcolchans == xfregs.numChan.numColorChans);
|
||||
|
||||
// uniforms
|
||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
if (api_type == API_OPENGL)
|
||||
out.Write("layout(std140%s) uniform VSBlock {\n", g_ActiveConfig.backend_info.bSupportShadingLanguage420pack ? ", binding = 2" : "");
|
||||
|
||||
DeclareUniform(out, api_type, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_POSNORMALMATRIX, "float4", I_POSNORMALMATRIX"[6]");
|
||||
DeclareUniform(out, api_type, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_PROJECTION, "float4", I_PROJECTION"[4]");
|
||||
DeclareUniform(out, api_type, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_MATERIALS, "float4", I_MATERIALS"[4]");
|
||||
DeclareUniform(out, api_type, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_LIGHTS, "float4", I_LIGHTS"[40]");
|
||||
DeclareUniform(out, api_type, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_TEXMATRICES, "float4", I_TEXMATRICES"[24]");
|
||||
DeclareUniform(out, api_type, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_TRANSFORMMATRICES, "float4", I_TRANSFORMMATRICES"[64]");
|
||||
DeclareUniform(out, api_type, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_NORMALMATRICES, "float4", I_NORMALMATRICES"[32]");
|
||||
DeclareUniform(out, api_type, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_POSTTRANSFORMMATRICES, "float4", I_POSTTRANSFORMMATRICES"[64]");
|
||||
DeclareUniform(out, api_type, g_ActiveConfig.backend_info.bSupportsGLSLUBO, C_DEPTHPARAMS, "float4", I_DEPTHPARAMS);
|
||||
DeclareUniform(out, api_type, C_POSNORMALMATRIX, "float4", I_POSNORMALMATRIX"[6]");
|
||||
DeclareUniform(out, api_type, C_PROJECTION, "float4", I_PROJECTION"[4]");
|
||||
DeclareUniform(out, api_type, C_MATERIALS, "float4", I_MATERIALS"[4]");
|
||||
DeclareUniform(out, api_type, C_LIGHTS, "float4", I_LIGHTS"[40]");
|
||||
DeclareUniform(out, api_type, C_TEXMATRICES, "float4", I_TEXMATRICES"[24]");
|
||||
DeclareUniform(out, api_type, C_TRANSFORMMATRICES, "float4", I_TRANSFORMMATRICES"[64]");
|
||||
DeclareUniform(out, api_type, C_NORMALMATRICES, "float4", I_NORMALMATRICES"[32]");
|
||||
DeclareUniform(out, api_type, C_POSTTRANSFORMMATRICES, "float4", I_POSTTRANSFORMMATRICES"[64]");
|
||||
DeclareUniform(out, api_type, C_DEPTHPARAMS, "float4", I_DEPTHPARAMS);
|
||||
|
||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
if (api_type == API_OPENGL)
|
||||
out.Write("};\n");
|
||||
|
||||
GenerateVSOutputStruct(out, api_type);
|
||||
|
@ -215,7 +215,6 @@ void VideoConfig::VerifyValidity()
|
||||
if (!backend_info.bSupports3DVision) b3DVision = false;
|
||||
if (!backend_info.bSupportsFormatReinterpretation) bEFBEmulateFormatChanges = false;
|
||||
if (!backend_info.bSupportsPixelLighting) bEnablePixelLighting = false;
|
||||
if (backend_info.APIType != API_OPENGL) backend_info.bSupportsGLSLUBO = false;
|
||||
}
|
||||
|
||||
void VideoConfig::Save(const char *ini_file)
|
||||
|
@ -150,7 +150,6 @@ struct VideoConfig
|
||||
bool bSupportsPrimitiveRestart;
|
||||
bool bSupportsSeparateAlphaFunction;
|
||||
bool bSupportsOversizedViewports;
|
||||
bool bSupportsGLSLUBO; // needed by PixelShaderGen, so must stay in VideoCommon
|
||||
bool bSupportsEarlyZ; // needed by PixelShaderGen, so must stay in VideoCommon
|
||||
bool bSupportShadingLanguage420pack; // needed by ShaderGen, so must stay in VideoCommon
|
||||
} backend_info;
|
||||
|
Reference in New Issue
Block a user