mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
OpenXR - Use single VR projection matrix
This commit is contained in:
parent
47a7b856ef
commit
7b089effa0
@ -808,8 +808,7 @@ void UpdateVRParams(float* projMatrix) {
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateVRProjection(float* projMatrix, float* leftEye, float* rightEye) {
|
||||
float output[16];
|
||||
void UpdateVRProjection(float* projMatrix, float* output) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (PSP_CoreParameter().compat.vrCompat().ProjectionHack && ((i == 8) || (i == 9))) {
|
||||
output[i] = 0;
|
||||
@ -822,8 +821,6 @@ void UpdateVRProjection(float* projMatrix, float* leftEye, float* rightEye) {
|
||||
output[i] = 0;
|
||||
}
|
||||
}
|
||||
memcpy(leftEye, output, 16 * sizeof(float));
|
||||
memcpy(rightEye, output, 16 * sizeof(float));
|
||||
}
|
||||
|
||||
void UpdateVRView(float* leftEye, float* rightEye) {
|
||||
|
@ -59,6 +59,6 @@ bool IsFlatVRScene();
|
||||
bool IsGameVRScene();
|
||||
bool Is2DVRObject(float* projMatrix, bool ortho);
|
||||
void UpdateVRParams(float* projMatrix);
|
||||
void UpdateVRProjection(float* projMatrix, float* leftEye, float* rightEye);
|
||||
void UpdateVRProjection(float* projMatrix, float* output);
|
||||
void UpdateVRView(float* leftEye, float* rightEye);
|
||||
void UpdateVRViewMatrices();
|
||||
|
@ -494,11 +494,7 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
||||
*uniformMask |= DIRTY_PROJTHROUGHMATRIX;
|
||||
} else if (useHWTransform) {
|
||||
if (gstate_c.Use(GPU_USE_VIRTUAL_REALITY)) {
|
||||
if (gstate_c.Use(GPU_USE_SINGLE_PASS_STEREO)) {
|
||||
WRITE(p, "layout(shared) uniform ProjectionMatrix { uniform mat4 u_proj_lens[2]; };\n");
|
||||
} else {
|
||||
WRITE(p, "uniform mat4 u_proj_lens;\n");
|
||||
}
|
||||
WRITE(p, "uniform mat4 u_proj_lens;\n");
|
||||
}
|
||||
WRITE(p, "uniform mat4 u_proj;\n");
|
||||
*uniformMask |= DIRTY_PROJMATRIX;
|
||||
|
@ -423,21 +423,18 @@ void LinkedShader::UpdateUniforms(const ShaderID &vsid, bool useBufferedRenderin
|
||||
// Update any dirty uniforms before we draw
|
||||
if (dirty & DIRTY_PROJMATRIX) {
|
||||
if (gstate_c.Use(GPU_USE_VIRTUAL_REALITY)) {
|
||||
Matrix4x4 leftEyeMatrix, rightEyeMatrix;
|
||||
Matrix4x4 vrProjection;
|
||||
if (flatScreen || is2D) {
|
||||
memcpy(&leftEyeMatrix, gstate.projMatrix, 16 * sizeof(float));
|
||||
memcpy(&rightEyeMatrix, gstate.projMatrix, 16 * sizeof(float));
|
||||
memcpy(&vrProjection, gstate.projMatrix, 16 * sizeof(float));
|
||||
} else {
|
||||
UpdateVRProjection(gstate.projMatrix, leftEyeMatrix.m, rightEyeMatrix.m);
|
||||
UpdateVRProjection(gstate.projMatrix, vrProjection.m);
|
||||
}
|
||||
UpdateVRParams(gstate.projMatrix);
|
||||
|
||||
FlipProjMatrix(leftEyeMatrix, useBufferedRendering);
|
||||
FlipProjMatrix(rightEyeMatrix, useBufferedRendering);
|
||||
ScaleProjMatrix(leftEyeMatrix, useBufferedRendering);
|
||||
ScaleProjMatrix(rightEyeMatrix, useBufferedRendering);
|
||||
FlipProjMatrix(vrProjection, useBufferedRendering);
|
||||
ScaleProjMatrix(vrProjection, useBufferedRendering);
|
||||
|
||||
render_->SetUniformM4x4Stereo("u_proj_lens", &u_proj_lens, leftEyeMatrix.m, rightEyeMatrix.m);
|
||||
render_->SetUniformM4x4(&u_proj_lens, vrProjection.m);
|
||||
}
|
||||
|
||||
Matrix4x4 flippedMatrix;
|
||||
|
Loading…
Reference in New Issue
Block a user