diff options
author | Chris Forbes <chrisf@ijw.co.nz> | 2012-11-25 20:23:32 +1300 |
---|---|---|
committer | Chris Forbes <chrisf@ijw.co.nz> | 2013-03-02 11:35:13 +1300 |
commit | 7c1017e292b2d27af6d7e15db874f50223d73e15 (patch) | |
tree | 0ee974a2c315b78299c50d7192635045ef4950c7 /src/mesa/main/multisample.c | |
parent | abb5429537b4e7f42bcdd744ed7aaaf35b719cf4 (diff) | |
download | external_mesa3d-7c1017e292b2d27af6d7e15db874f50223d73e15.zip external_mesa3d-7c1017e292b2d27af6d7e15db874f50223d73e15.tar.gz external_mesa3d-7c1017e292b2d27af6d7e15db874f50223d73e15.tar.bz2 |
mesa: implement GetMultisamplefv
Actual sample locations deferred to a driverfunc since only the driver
really knows where they will be.
V2: - pass the draw buffer to the driverfunc; don't fallback to pixel
center if driverfunc is missing.
- rename GetSampleLocation to GetSamplePosition
- invert y sample position for winsys FBOs, at Paul's suggestion
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mesa/main/multisample.c')
-rw-r--r-- | src/mesa/main/multisample.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c index 0687cd0..2d3a35e 100644 --- a/src/mesa/main/multisample.c +++ b/src/mesa/main/multisample.c @@ -28,6 +28,7 @@ #include "main/macros.h" #include "main/multisample.h" #include "main/mtypes.h" +#include "main/fbobject.h" /** @@ -65,8 +66,28 @@ _mesa_init_multisample(struct gl_context *ctx) void GLAPIENTRY _mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat * val) { - assert(!"Not implemented"); - // TODO: make this work + GET_CURRENT_CONTEXT(ctx); + + switch (pname) { + case GL_SAMPLE_POSITION: { + if (index >= ctx->DrawBuffer->Visual.samples) { + _mesa_error( ctx, GL_INVALID_VALUE, "glGetMultisamplefv(index)" ); + return; + } + + ctx->Driver.GetSamplePosition(ctx, ctx->DrawBuffer, index, val); + + /* winsys FBOs are upside down */ + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) + val[1] = 1 - val[1]; + + return; + } + + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMultisamplefv(pname)" ); + return; + } } void GLAPIENTRY |