mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 02:33:43 +01:00
OpenXR - HUD support added
This commit is contained in:
1 parent
2103874c0f
commit
4814bed7df
3 files changed
+29
No files matched your search
@@ -534,6 +534,11 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
||||
WRITE(p, "uniform lowp float u_rotation;\n");
|
||||
}
|
||||
|
||||
#ifdef OPENXR
|
||||
WRITE(p, "uniform lowp float u_scaleX;\n");
|
||||
WRITE(p, "uniform lowp float u_scaleY;\n");
|
||||
#endif
|
||||
|
||||
if (useHWTransform || !hasColor) {
|
||||
WRITE(p, "uniform lowp vec4 u_matambientalpha;\n"); // matambient + matalpha
|
||||
*uniformMask |= DIRTY_MATAMBIENTALPHA;
|
||||
@@ -1183,6 +1188,12 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
||||
WRITE(p, " if (%sgl_Position.z == %sgl_Position.w) %sgl_Position.z *= 0.999999;\n",
|
||||
compat.vsOutPrefix, compat.vsOutPrefix, compat.vsOutPrefix);
|
||||
}
|
||||
#ifdef OPENXR
|
||||
WRITE(p, " if ((u_scaleX < 0.99) || (u_scaleY < 0.99)) {\n");
|
||||
WRITE(p, " %sgl_Position.x *= u_scaleX;\n", compat.vsOutPrefix);
|
||||
WRITE(p, " %sgl_Position.y *= u_scaleY;\n", compat.vsOutPrefix);
|
||||
WRITE(p, " }\n");
|
||||
#endif
|
||||
|
||||
if (compat.shaderLanguage == HLSL_D3D11 || compat.shaderLanguage == HLSL_D3D9) {
|
||||
WRITE(p, " return Out;\n");
|
||||
|
||||
@@ -134,6 +134,10 @@ LinkedShader::LinkedShader(GLRenderManager *render, VShaderID VSID, Shader *vs,
|
||||
queries.push_back({ &u_cullRangeMin, "u_cullRangeMin" });
|
||||
queries.push_back({ &u_cullRangeMax, "u_cullRangeMax" });
|
||||
queries.push_back({ &u_rotation, "u_rotation" });
|
||||
#ifdef OPENXR
|
||||
queries.push_back({ &u_scaleX, "u_scaleX" });
|
||||
queries.push_back({ &u_scaleY, "u_scaleY" });
|
||||
#endif
|
||||
|
||||
#ifdef USE_BONE_ARRAY
|
||||
queries.push_back({ &u_bone, "u_bone" });
|
||||
@@ -334,10 +338,22 @@ void LinkedShader::UpdateUniforms(u32 vertType, const ShaderID &vsid, bool useBu
|
||||
if (((i == 3) && (fabs(fabs(value) - 1.0f) > e))) oneTranslation = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Count 3D objects
|
||||
bool is2D = identity || oneTranslation || ortho;
|
||||
if (!is2D) {
|
||||
VR_SetConfig(VR_CONFIG_3D_GEOMETRY_COUNT, VR_GetConfig(VR_CONFIG_3D_GEOMETRY_COUNT) + 1);
|
||||
}
|
||||
|
||||
// Set HUD mode
|
||||
if (is2D && (VR_GetConfig(VR_CONFIG_MODE) != VR_MODE_FLAT_SCREEN)) {
|
||||
float scale = 0.5f;
|
||||
render_->SetUniformF1(&u_scaleX, scale);
|
||||
render_->SetUniformF1(&u_scaleY, scale / 16.0f * 9.0f);
|
||||
} else {
|
||||
render_->SetUniformF1(&u_scaleX, 1.0f);
|
||||
render_->SetUniformF1(&u_scaleY, 1.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Update any dirty uniforms before we draw
|
||||
|
||||
@@ -61,6 +61,8 @@ public:
|
||||
int u_cullRangeMin;
|
||||
int u_cullRangeMax;
|
||||
int u_rotation;
|
||||
int u_scaleX;
|
||||
int u_scaleY;
|
||||
|
||||
#ifdef USE_BONE_ARRAY
|
||||
int u_bone; // array, size is numBones
|
||||
|
||||
Reference in new issue
Block a user