Skip to content

Commit

Permalink
- allow obtaining holographic stereo matrices through glGet API
Browse files Browse the repository at this point in the history
  • Loading branch information
mlfarrell committed Aug 12, 2016
1 parent ab3ffff commit 7a858fc
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/GLES2/gl2ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,9 @@ GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint div
#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
#endif /* GL_ANGLE_texture_usage */

//HACK - mlf
#define GL_HOLOGRAPHIC_MATRICES_ANGLE 0xFFFF1

#ifndef GL_ANGLE_translated_shader_source
#define GL_ANGLE_translated_shader_source 1
#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
Expand Down
10 changes: 10 additions & 0 deletions src/libANGLE/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,11 @@ void State::getBooleanv(GLenum pname, GLboolean *params)
}
}

///HACK - mlf
#ifdef ANGLE_ENABLE_WINDOWS_HOLOGRAPHIC
void AngleHolographicGetHoloMatrices(float *matricesViewProjection2);
#endif

void State::getFloatv(GLenum pname, GLfloat *params)
{
// Please note: DEPTH_CLEAR_VALUE is included in our internal getFloatv implementation
Expand Down Expand Up @@ -1413,6 +1418,11 @@ void State::getFloatv(GLenum pname, GLfloat *params)
params[2] = mBlendColor.blue;
params[3] = mBlendColor.alpha;
break;

case GL_HOLOGRAPHIC_MATRICES_ANGLE:
AngleHolographicGetHoloMatrices(params);
break;

default:
UNREACHABLE();
break;
Expand Down
14 changes: 14 additions & 0 deletions src/libANGLE/renderer/d3d/d3d11/winrt/HolographicSwapChain11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ using namespace ABI::Windows::Graphics::DirectX::Direct3D11;
using namespace ABI::Windows::Graphics::Holographic;
using namespace ABI::Windows::Perception::Spatial;

///HACK - mlf
namespace gl
{
static DirectX::XMFLOAT4X4 gHoloViewProj[2];

void AngleHolographicGetHoloMatrices(float *matricesViewProjection2)
{
memcpy(matricesViewProjection2, gHoloViewProj, sizeof(float) * 16 * 2);
}
}
///end hack

namespace rx
{

Expand Down Expand Up @@ -458,6 +470,8 @@ EGLint HolographicSwapChain11::updateHolographicRenderingParameters(
DirectX::XMLoadFloat4x4(reinterpret_cast<DirectX::XMFLOAT4X4*>(&viewTransform.Right)) * DirectX::XMLoadFloat4x4(reinterpret_cast<DirectX::XMFLOAT4X4*>(&projectionTransform.Right)))
);

memcpy(gl::gHoloViewProj, viewProj, sizeof(float) * 16 * 2);

// get the current program
context = gl::GetValidGlobalContext();
program = context->getState().getProgram();
Expand Down
7 changes: 7 additions & 0 deletions src/libANGLE/validationES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,13 @@ bool ValidateUniformMatrix(gl::Context *context, GLenum matrixType, GLint locati

bool ValidateStateQuery(gl::Context *context, GLenum pname, GLenum *nativeType, unsigned int *numParams)
{
//HACK - mlf
if(pname == GL_HOLOGRAPHIC_MATRICES_ANGLE)
{
*nativeType = GL_FLOAT;
return true;
}

if (!context->getQueryParameterInfo(pname, nativeType, numParams))
{
context->recordError(Error(GL_INVALID_ENUM));
Expand Down

0 comments on commit 7a858fc

Please sign in to comment.