mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 19:21:38 +00:00
[MESA]
- leaner build part 11 of X - Get rid of ARB_draw_buffers, ARB_draw_buffers2, ARB_draw_buffers_blend extensions. CORE-7499 svn path=/trunk/; revision=60516
This commit is contained in:
parent
837a526ab8
commit
3073548a43
42 changed files with 341 additions and 2719 deletions
|
@ -4740,7 +4740,7 @@ yyreduce:
|
|||
"`OPTION ARB_draw_buffers' or "
|
||||
"`OPTION ATI_draw_buffers'");
|
||||
YYERROR;
|
||||
} else if ((yyvsp[(2) - (3)].integer) >= state->MaxDrawBuffers) {
|
||||
} else if ((yyvsp[(2) - (3)].integer) > 0) {
|
||||
yyerror(& (yylsp[(1) - (3)]), state,
|
||||
"result.color[] exceeds MAX_DRAW_BUFFERS_ARB");
|
||||
YYERROR;
|
||||
|
@ -5700,7 +5700,7 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st
|
|||
state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
|
||||
state->MaxLights = ctx->Const.MaxLights;
|
||||
state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
|
||||
state->MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
|
||||
state->MaxDrawBuffers = 1;
|
||||
|
||||
state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
|
||||
? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM;
|
||||
|
|
|
@ -71,7 +71,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx,
|
|||
this->Const.MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
|
||||
this->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents;
|
||||
|
||||
this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
|
||||
this->Const.MaxDrawBuffers = 1;
|
||||
|
||||
/* Note: Once the OpenGL 3.0 'forward compatible' context or the OpenGL 3.2
|
||||
* Core context is supported, this logic will need change. Older versions of
|
||||
|
|
|
@ -1793,7 +1793,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (!assign_attribute_or_color_locations(prog, MESA_SHADER_FRAGMENT, ctx->Const.MaxDrawBuffers)) {
|
||||
if (!assign_attribute_or_color_locations(prog, MESA_SHADER_FRAGMENT, 1)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
|
|||
driver->ColorMaterial = NULL;
|
||||
driver->CullFace = NULL;
|
||||
driver->DrawBuffer = NULL;
|
||||
driver->DrawBuffers = NULL;
|
||||
driver->FrontFace = NULL;
|
||||
driver->DepthFunc = NULL;
|
||||
driver->DepthMask = NULL;
|
||||
|
@ -200,112 +199,3 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
|
|||
/* GL_ARB_texture_storage */
|
||||
driver->AllocTextureStorage = _swrast_AllocTextureStorage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call the ctx->Driver.* state functions with current values to initialize
|
||||
* driver state.
|
||||
* Only the Intel drivers use this so far.
|
||||
*/
|
||||
void
|
||||
_mesa_init_driver_state(struct gl_context *ctx)
|
||||
{
|
||||
ctx->Driver.AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef);
|
||||
|
||||
ctx->Driver.BlendColor(ctx, ctx->Color.BlendColor);
|
||||
|
||||
ctx->Driver.BlendEquationSeparate(ctx,
|
||||
ctx->Color.Blend[0].EquationRGB,
|
||||
ctx->Color.Blend[0].EquationA);
|
||||
|
||||
ctx->Driver.BlendFuncSeparate(ctx,
|
||||
ctx->Color.Blend[0].SrcRGB,
|
||||
ctx->Color.Blend[0].DstRGB,
|
||||
ctx->Color.Blend[0].SrcA,
|
||||
ctx->Color.Blend[0].DstA);
|
||||
|
||||
if (ctx->Driver.ColorMaskIndexed) {
|
||||
GLuint i;
|
||||
for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
|
||||
ctx->Driver.ColorMaskIndexed(ctx, i,
|
||||
ctx->Color.ColorMask[i][RCOMP],
|
||||
ctx->Color.ColorMask[i][GCOMP],
|
||||
ctx->Color.ColorMask[i][BCOMP],
|
||||
ctx->Color.ColorMask[i][ACOMP]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ctx->Driver.ColorMask(ctx,
|
||||
ctx->Color.ColorMask[0][RCOMP],
|
||||
ctx->Color.ColorMask[0][GCOMP],
|
||||
ctx->Color.ColorMask[0][BCOMP],
|
||||
ctx->Color.ColorMask[0][ACOMP]);
|
||||
}
|
||||
|
||||
ctx->Driver.CullFace(ctx, ctx->Polygon.CullFaceMode);
|
||||
ctx->Driver.DepthFunc(ctx, ctx->Depth.Func);
|
||||
ctx->Driver.DepthMask(ctx, ctx->Depth.Mask);
|
||||
|
||||
ctx->Driver.Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_BLEND, ctx->Color.BlendEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled);
|
||||
ctx->Driver.Enable(ctx, GL_CULL_FACE, ctx->Polygon.CullFlag);
|
||||
ctx->Driver.Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test);
|
||||
ctx->Driver.Enable(ctx, GL_DITHER, ctx->Color.DitherFlag);
|
||||
ctx->Driver.Enable(ctx, GL_FOG, ctx->Fog.Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_LIGHTING, ctx->Light.Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag);
|
||||
ctx->Driver.Enable(ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag);
|
||||
ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_3D, GL_FALSE);
|
||||
ctx->Driver.Enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
|
||||
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color);
|
||||
{
|
||||
GLfloat mode = (GLfloat) ctx->Fog.Mode;
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_MODE, &mode);
|
||||
}
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density);
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start);
|
||||
ctx->Driver.Fogfv(ctx, GL_FOG_END, &ctx->Fog.End);
|
||||
|
||||
ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
|
||||
|
||||
{
|
||||
GLfloat f = (GLfloat) ctx->Light.Model.ColorControl;
|
||||
ctx->Driver.LightModelfv(ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f);
|
||||
}
|
||||
|
||||
ctx->Driver.LineWidth(ctx, ctx->Line.Width);
|
||||
ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp);
|
||||
ctx->Driver.PointSize(ctx, ctx->Point.Size);
|
||||
ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple);
|
||||
ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
|
||||
ctx->Scissor.Width, ctx->Scissor.Height);
|
||||
ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel);
|
||||
ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT,
|
||||
ctx->Stencil.Function[0],
|
||||
ctx->Stencil.Ref[0],
|
||||
ctx->Stencil.ValueMask[0]);
|
||||
ctx->Driver.StencilFuncSeparate(ctx, GL_BACK,
|
||||
ctx->Stencil.Function[1],
|
||||
ctx->Stencil.Ref[1],
|
||||
ctx->Stencil.ValueMask[1]);
|
||||
ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT, ctx->Stencil.WriteMask[0]);
|
||||
ctx->Driver.StencilMaskSeparate(ctx, GL_BACK, ctx->Stencil.WriteMask[1]);
|
||||
ctx->Driver.StencilOpSeparate(ctx, GL_FRONT,
|
||||
ctx->Stencil.FailFunc[0],
|
||||
ctx->Stencil.ZFailFunc[0],
|
||||
ctx->Stencil.ZPassFunc[0]);
|
||||
ctx->Driver.StencilOpSeparate(ctx, GL_BACK,
|
||||
ctx->Stencil.FailFunc[1],
|
||||
ctx->Stencil.ZFailFunc[1],
|
||||
ctx->Stencil.ZPassFunc[1]);
|
||||
|
||||
|
||||
ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,4 @@ extern void
|
|||
_mesa_init_driver_functions(struct dd_function_table *driver);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_init_driver_state(struct gl_context *ctx);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -71,36 +71,11 @@ _mesa_meta_end(struct gl_context *ctx);
|
|||
extern GLboolean
|
||||
_mesa_meta_in_progress(struct gl_context *ctx);
|
||||
|
||||
extern void
|
||||
_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
|
||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||
GLbitfield mask, GLenum filter);
|
||||
|
||||
extern void
|
||||
_mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers);
|
||||
|
||||
extern void
|
||||
_mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers);
|
||||
|
||||
extern void
|
||||
_mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
||||
GLsizei width, GLsizei height,
|
||||
GLint dstx, GLint dsty, GLenum type);
|
||||
|
||||
extern void
|
||||
_mesa_meta_DrawPixels(struct gl_context *ctx,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type,
|
||||
const struct gl_pixelstore_attrib *unpack,
|
||||
const GLvoid *pixels);
|
||||
|
||||
extern void
|
||||
_mesa_meta_Bitmap(struct gl_context *ctx,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
const struct gl_pixelstore_attrib *unpack,
|
||||
const GLubyte *bitmap);
|
||||
|
||||
extern GLboolean
|
||||
_mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target,
|
||||
struct gl_texture_object *texObj);
|
||||
|
|
|
@ -344,7 +344,12 @@ accum_return(struct gl_context *ctx, GLfloat value,
|
|||
struct gl_renderbuffer *accRb = fb->Attachment[BUFFER_ACCUM].Renderbuffer;
|
||||
GLubyte *accMap, *colorMap;
|
||||
GLint accRowStride, colorRowStride;
|
||||
GLuint buffer;
|
||||
struct gl_renderbuffer *colorRb = fb->_ColorDrawBuffer;
|
||||
const GLboolean masking = (!ctx->Color.ColorMask[RCOMP] ||
|
||||
!ctx->Color.ColorMask[GCOMP] ||
|
||||
!ctx->Color.ColorMask[BCOMP] ||
|
||||
!ctx->Color.ColorMask[ACOMP]);
|
||||
GLbitfield mappingFlags = GL_MAP_WRITE_BIT;
|
||||
|
||||
/* Map accum buffer */
|
||||
ctx->Driver.MapRenderbuffer(ctx, accRb, xpos, ypos, width, height,
|
||||
|
@ -355,89 +360,79 @@ accum_return(struct gl_context *ctx, GLfloat value,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Loop over destination buffers */
|
||||
for (buffer = 0; buffer < fb->_NumColorDrawBuffers; buffer++) {
|
||||
struct gl_renderbuffer *colorRb = fb->_ColorDrawBuffers[buffer];
|
||||
const GLboolean masking = (!ctx->Color.ColorMask[buffer][RCOMP] ||
|
||||
!ctx->Color.ColorMask[buffer][GCOMP] ||
|
||||
!ctx->Color.ColorMask[buffer][BCOMP] ||
|
||||
!ctx->Color.ColorMask[buffer][ACOMP]);
|
||||
GLbitfield mappingFlags = GL_MAP_WRITE_BIT;
|
||||
|
||||
if (masking)
|
||||
mappingFlags |= GL_MAP_READ_BIT;
|
||||
if (masking)
|
||||
mappingFlags |= GL_MAP_READ_BIT;
|
||||
|
||||
/* Map color buffer */
|
||||
ctx->Driver.MapRenderbuffer(ctx, colorRb, xpos, ypos, width, height,
|
||||
mappingFlags, &colorMap, &colorRowStride);
|
||||
if (!colorMap) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAccum");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (accRb->Format == MESA_FORMAT_SIGNED_RGBA_16) {
|
||||
const GLfloat scale = value / 32767.0f;
|
||||
GLint i, j;
|
||||
GLfloat (*rgba)[4], (*dest)[4];
|
||||
|
||||
rgba = (GLfloat (*)[4]) malloc(width * 4 * sizeof(GLfloat));
|
||||
dest = (GLfloat (*)[4]) malloc(width * 4 * sizeof(GLfloat));
|
||||
|
||||
if (rgba && dest) {
|
||||
for (j = 0; j < height; j++) {
|
||||
GLshort *acc = (GLshort *) accMap;
|
||||
|
||||
for (i = 0; i < width; i++) {
|
||||
rgba[i][0] = acc[i * 4 + 0] * scale;
|
||||
rgba[i][1] = acc[i * 4 + 1] * scale;
|
||||
rgba[i][2] = acc[i * 4 + 2] * scale;
|
||||
rgba[i][3] = acc[i * 4 + 3] * scale;
|
||||
}
|
||||
|
||||
if (masking) {
|
||||
|
||||
/* get existing colors from dest buffer */
|
||||
_mesa_unpack_rgba_row(colorRb->Format, width, colorMap, dest);
|
||||
|
||||
/* use the dest colors where mask[channel] = 0 */
|
||||
if (ctx->Color.ColorMask[buffer][RCOMP] == 0) {
|
||||
for (i = 0; i < width; i++)
|
||||
rgba[i][RCOMP] = dest[i][RCOMP];
|
||||
}
|
||||
if (ctx->Color.ColorMask[buffer][GCOMP] == 0) {
|
||||
for (i = 0; i < width; i++)
|
||||
rgba[i][GCOMP] = dest[i][GCOMP];
|
||||
}
|
||||
if (ctx->Color.ColorMask[buffer][BCOMP] == 0) {
|
||||
for (i = 0; i < width; i++)
|
||||
rgba[i][BCOMP] = dest[i][BCOMP];
|
||||
}
|
||||
if (ctx->Color.ColorMask[buffer][ACOMP] == 0) {
|
||||
for (i = 0; i < width; i++)
|
||||
rgba[i][ACOMP] = dest[i][ACOMP];
|
||||
}
|
||||
}
|
||||
|
||||
_mesa_pack_float_rgba_row(colorRb->Format, width,
|
||||
(const GLfloat (*)[4]) rgba, colorMap);
|
||||
|
||||
accMap += accRowStride;
|
||||
colorMap += colorRowStride;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAccum");
|
||||
}
|
||||
free(rgba);
|
||||
free(dest);
|
||||
}
|
||||
else {
|
||||
/* other types someday? */
|
||||
}
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, colorRb);
|
||||
ctx->Driver.MapRenderbuffer(ctx, colorRb, xpos, ypos, width, height,
|
||||
mappingFlags, &colorMap, &colorRowStride);
|
||||
if (!colorMap) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAccum");
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, accRb);
|
||||
return;
|
||||
}
|
||||
|
||||
if (accRb->Format == MESA_FORMAT_SIGNED_RGBA_16) {
|
||||
const GLfloat scale = value / 32767.0f;
|
||||
GLint i, j;
|
||||
GLfloat (*rgba)[4], (*dest)[4];
|
||||
|
||||
rgba = (GLfloat (*)[4]) malloc(width * 4 * sizeof(GLfloat));
|
||||
dest = (GLfloat (*)[4]) malloc(width * 4 * sizeof(GLfloat));
|
||||
|
||||
if (rgba && dest) {
|
||||
for (j = 0; j < height; j++) {
|
||||
GLshort *acc = (GLshort *) accMap;
|
||||
|
||||
for (i = 0; i < width; i++) {
|
||||
rgba[i][0] = acc[i * 4 + 0] * scale;
|
||||
rgba[i][1] = acc[i * 4 + 1] * scale;
|
||||
rgba[i][2] = acc[i * 4 + 2] * scale;
|
||||
rgba[i][3] = acc[i * 4 + 3] * scale;
|
||||
}
|
||||
|
||||
if (masking) {
|
||||
|
||||
/* get existing colors from dest buffer */
|
||||
_mesa_unpack_rgba_row(colorRb->Format, width, colorMap, dest);
|
||||
|
||||
/* use the dest colors where mask[channel] = 0 */
|
||||
if (ctx->Color.ColorMask[RCOMP] == 0) {
|
||||
for (i = 0; i < width; i++)
|
||||
rgba[i][RCOMP] = dest[i][RCOMP];
|
||||
}
|
||||
if (ctx->Color.ColorMask[GCOMP] == 0) {
|
||||
for (i = 0; i < width; i++)
|
||||
rgba[i][GCOMP] = dest[i][GCOMP];
|
||||
}
|
||||
if (ctx->Color.ColorMask[BCOMP] == 0) {
|
||||
for (i = 0; i < width; i++)
|
||||
rgba[i][BCOMP] = dest[i][BCOMP];
|
||||
}
|
||||
if (ctx->Color.ColorMask[ACOMP] == 0) {
|
||||
for (i = 0; i < width; i++)
|
||||
rgba[i][ACOMP] = dest[i][ACOMP];
|
||||
}
|
||||
}
|
||||
|
||||
_mesa_pack_float_rgba_row(colorRb->Format, width,
|
||||
(const GLfloat (*)[4]) rgba, colorMap);
|
||||
|
||||
accMap += accRowStride;
|
||||
colorMap += colorRowStride;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAccum");
|
||||
}
|
||||
free(rgba);
|
||||
free(dest);
|
||||
}
|
||||
else {
|
||||
/* other types someday? */
|
||||
}
|
||||
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, colorRb);
|
||||
ctx->Driver.UnmapRenderbuffer(ctx, accRb);
|
||||
}
|
||||
|
||||
|
|
|
@ -554,11 +554,6 @@ _mesa_create_exec_table(void)
|
|||
SET_MapBufferARB(exec, _mesa_MapBufferARB);
|
||||
SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB);
|
||||
|
||||
/* ARB 37. GL_ARB_draw_buffers */
|
||||
#if FEATURE_draw_read_buffer
|
||||
SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB);
|
||||
#endif
|
||||
|
||||
/* ARB 104. GL_ARB_robustness */
|
||||
SET_GetGraphicsResetStatusARB(exec, _mesa_GetGraphicsResetStatusARB);
|
||||
SET_GetnPolygonStippleARB(exec, _mesa_GetnPolygonStippleARB);
|
||||
|
@ -645,12 +640,6 @@ _mesa_create_exec_table(void)
|
|||
SET_GetStringi(exec, _mesa_GetStringi);
|
||||
SET_ClampColor(exec, _mesa_ClampColorARB);
|
||||
|
||||
/* GL_ARB_draw_buffer_blend */
|
||||
SET_BlendFunciARB(exec, _mesa_BlendFunci);
|
||||
SET_BlendFuncSeparateiARB(exec, _mesa_BlendFuncSeparatei);
|
||||
SET_BlendEquationiARB(exec, _mesa_BlendEquationi);
|
||||
SET_BlendEquationSeparateiARB(exec, _mesa_BlendEquationSeparatei);
|
||||
|
||||
/* GL_NV_texture_barrier */
|
||||
SET_TextureBarrierNV(exec, _mesa_TextureBarrierNV);
|
||||
|
||||
|
|
|
@ -226,13 +226,11 @@ _mesa_PushAttrib(GLbitfield mask)
|
|||
}
|
||||
|
||||
if (mask & GL_COLOR_BUFFER_BIT) {
|
||||
GLuint i;
|
||||
struct gl_colorbuffer_attrib *attr;
|
||||
attr = MALLOC_STRUCT( gl_colorbuffer_attrib );
|
||||
memcpy( attr, &ctx->Color, sizeof(struct gl_colorbuffer_attrib) );
|
||||
/* push the Draw FBO's DrawBuffer[] state, not ctx->Color.DrawBuffer[] */
|
||||
for (i = 0; i < ctx->Const.MaxDrawBuffers; i ++)
|
||||
attr->DrawBuffer[i] = ctx->DrawBuffer->ColorDrawBuffer[i];
|
||||
attr->DrawBuffer = ctx->DrawBuffer->ColorDrawBuffer;
|
||||
save_attrib_data(&head, GL_COLOR_BUFFER_BIT, attr);
|
||||
}
|
||||
|
||||
|
@ -818,76 +816,31 @@ _mesa_PopAttrib(void)
|
|||
color->ClearColor.f[2],
|
||||
color->ClearColor.f[3]);
|
||||
_mesa_IndexMask(color->IndexMask);
|
||||
_mesa_ColorMask((GLboolean) (color->ColorMask[0][0] != 0),
|
||||
(GLboolean) (color->ColorMask[0][1] != 0),
|
||||
(GLboolean) (color->ColorMask[0][2] != 0),
|
||||
(GLboolean) (color->ColorMask[0][3] != 0));
|
||||
{
|
||||
/* Need to determine if more than one color output is
|
||||
* specified. If so, call glDrawBuffersARB, else call
|
||||
* glDrawBuffer(). This is a subtle, but essential point
|
||||
* since GL_FRONT (for example) is illegal for the former
|
||||
* function, but legal for the later.
|
||||
*/
|
||||
GLboolean multipleBuffers = GL_FALSE;
|
||||
GLuint i;
|
||||
|
||||
for (i = 1; i < ctx->Const.MaxDrawBuffers; i++) {
|
||||
if (color->DrawBuffer[i] != GL_NONE) {
|
||||
multipleBuffers = GL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Call the API_level functions, not _mesa_drawbuffers()
|
||||
* since we need to do error checking on the pop'd
|
||||
* GL_DRAW_BUFFER.
|
||||
* Ex: if GL_FRONT were pushed, but we're popping with a
|
||||
* user FBO bound, GL_FRONT will be illegal and we'll need
|
||||
* to record that error. Per OpenGL ARB decision.
|
||||
*/
|
||||
if (multipleBuffers)
|
||||
_mesa_DrawBuffersARB(ctx->Const.MaxDrawBuffers,
|
||||
color->DrawBuffer);
|
||||
else
|
||||
_mesa_DrawBuffer(color->DrawBuffer[0]);
|
||||
}
|
||||
_mesa_ColorMask((GLboolean) (color->ColorMask[0] != 0),
|
||||
(GLboolean) (color->ColorMask[1] != 0),
|
||||
(GLboolean) (color->ColorMask[2] != 0),
|
||||
(GLboolean) (color->ColorMask[3] != 0));
|
||||
_mesa_DrawBuffer(color->DrawBuffer);
|
||||
_mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled);
|
||||
_mesa_AlphaFunc(color->AlphaFunc, color->AlphaRefUnclamped);
|
||||
if (ctx->Color.BlendEnabled != color->BlendEnabled) {
|
||||
_mesa_set_enable(ctx, GL_BLEND, (color->BlendEnabled & 1));
|
||||
}
|
||||
if (ctx->Color._BlendFuncPerBuffer ||
|
||||
ctx->Color._BlendEquationPerBuffer) {
|
||||
/* set blend per buffer */
|
||||
GLuint buf;
|
||||
for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {
|
||||
_mesa_BlendFuncSeparatei(buf, color->Blend[buf].SrcRGB,
|
||||
color->Blend[buf].DstRGB,
|
||||
color->Blend[buf].SrcA,
|
||||
color->Blend[buf].DstA);
|
||||
_mesa_BlendEquationSeparatei(buf,
|
||||
color->Blend[buf].EquationRGB,
|
||||
color->Blend[buf].EquationA);
|
||||
}
|
||||
/* set same blend modes for all buffers */
|
||||
_mesa_BlendFuncSeparateEXT(color->SrcRGB,
|
||||
color->DstRGB,
|
||||
color->SrcA,
|
||||
color->DstA);
|
||||
/* This special case is because glBlendEquationSeparateEXT
|
||||
* cannot take GL_LOGIC_OP as a parameter.
|
||||
*/
|
||||
if (color->EquationRGB == color->EquationA) {
|
||||
_mesa_BlendEquation(color->EquationRGB);
|
||||
}
|
||||
else {
|
||||
/* set same blend modes for all buffers */
|
||||
_mesa_BlendFuncSeparateEXT(color->Blend[0].SrcRGB,
|
||||
color->Blend[0].DstRGB,
|
||||
color->Blend[0].SrcA,
|
||||
color->Blend[0].DstA);
|
||||
/* This special case is because glBlendEquationSeparateEXT
|
||||
* cannot take GL_LOGIC_OP as a parameter.
|
||||
*/
|
||||
if (color->Blend[0].EquationRGB ==
|
||||
color->Blend[0].EquationA) {
|
||||
_mesa_BlendEquation(color->Blend[0].EquationRGB);
|
||||
}
|
||||
else {
|
||||
_mesa_BlendEquationSeparateEXT(
|
||||
color->Blend[0].EquationRGB,
|
||||
color->Blend[0].EquationA);
|
||||
}
|
||||
_mesa_BlendEquationSeparateEXT(
|
||||
color->EquationRGB,
|
||||
color->EquationA);
|
||||
}
|
||||
_mesa_BlendColor(color->BlendColorUnclamped[0],
|
||||
color->BlendColorUnclamped[1],
|
||||
|
|
|
@ -168,8 +168,6 @@ void GLAPIENTRY
|
|||
_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
|
||||
GLenum sfactorA, GLenum dfactorA )
|
||||
{
|
||||
GLuint buf, numBuffers;
|
||||
GLboolean changed;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
|
@ -186,32 +184,19 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
|
|||
return;
|
||||
}
|
||||
|
||||
numBuffers = ctx->Extensions.ARB_draw_buffers_blend
|
||||
? ctx->Const.MaxDrawBuffers : 1;
|
||||
|
||||
changed = GL_FALSE;
|
||||
for (buf = 0; buf < numBuffers; buf++) {
|
||||
if (ctx->Color.Blend[buf].SrcRGB != sfactorRGB ||
|
||||
ctx->Color.Blend[buf].DstRGB != dfactorRGB ||
|
||||
ctx->Color.Blend[buf].SrcA != sfactorA ||
|
||||
ctx->Color.Blend[buf].DstA != dfactorA) {
|
||||
changed = GL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!changed)
|
||||
if (ctx->Color.SrcRGB == sfactorRGB &&
|
||||
ctx->Color.DstRGB == dfactorRGB &&
|
||||
ctx->Color.SrcA == sfactorA &&
|
||||
ctx->Color.DstA == dfactorA) {
|
||||
return;
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
|
||||
for (buf = 0; buf < numBuffers; buf++) {
|
||||
ctx->Color.Blend[buf].SrcRGB = sfactorRGB;
|
||||
ctx->Color.Blend[buf].DstRGB = dfactorRGB;
|
||||
ctx->Color.Blend[buf].SrcA = sfactorA;
|
||||
ctx->Color.Blend[buf].DstA = dfactorA;
|
||||
}
|
||||
ctx->Color._BlendFuncPerBuffer = GL_FALSE;
|
||||
|
||||
ctx->Color.SrcRGB = sfactorRGB;
|
||||
ctx->Color.DstRGB = dfactorRGB;
|
||||
ctx->Color.SrcA = sfactorA;
|
||||
ctx->Color.DstA = dfactorA;
|
||||
if (ctx->Driver.BlendFuncSeparate) {
|
||||
ctx->Driver.BlendFuncSeparate(ctx, sfactorRGB, dfactorRGB,
|
||||
sfactorA, dfactorA);
|
||||
|
@ -220,66 +205,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
|
|||
|
||||
|
||||
#if _HAVE_FULL_GL
|
||||
|
||||
|
||||
/**
|
||||
* Set blend source/dest factors for one color buffer/target.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
|
||||
{
|
||||
_mesa_BlendFuncSeparatei(buf, sfactor, dfactor, sfactor, dfactor);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set separate blend source/dest factors for one color buffer/target.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
|
||||
GLenum sfactorA, GLenum dfactorA)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!ctx->Extensions.ARB_draw_buffers_blend) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glBlendFunc[Separate]i()");
|
||||
return;
|
||||
}
|
||||
|
||||
if (buf >= ctx->Const.MaxDrawBuffers) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glBlendFuncSeparatei(buffer=%u)",
|
||||
buf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!validate_blend_factors(ctx, "glBlendFuncSeparatei",
|
||||
sfactorRGB, dfactorRGB,
|
||||
sfactorA, dfactorA)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->Color.Blend[buf].SrcRGB == sfactorRGB &&
|
||||
ctx->Color.Blend[buf].DstRGB == dfactorRGB &&
|
||||
ctx->Color.Blend[buf].SrcA == sfactorA &&
|
||||
ctx->Color.Blend[buf].DstA == dfactorA)
|
||||
return; /* no change */
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
|
||||
ctx->Color.Blend[buf].SrcRGB = sfactorRGB;
|
||||
ctx->Color.Blend[buf].DstRGB = dfactorRGB;
|
||||
ctx->Color.Blend[buf].SrcA = sfactorA;
|
||||
ctx->Color.Blend[buf].DstA = dfactorA;
|
||||
ctx->Color._BlendFuncPerBuffer = GL_TRUE;
|
||||
|
||||
if (ctx->Driver.BlendFuncSeparatei) {
|
||||
ctx->Driver.BlendFuncSeparatei(ctx, buf, sfactorRGB, dfactorRGB,
|
||||
sfactorA, dfactorA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if given blend equation is legal.
|
||||
* \return GL_TRUE if legal, GL_FALSE otherwise.
|
||||
|
@ -305,8 +230,6 @@ legal_blend_equation(const struct gl_context *ctx, GLenum mode)
|
|||
void GLAPIENTRY
|
||||
_mesa_BlendEquation( GLenum mode )
|
||||
{
|
||||
GLuint buf, numBuffers;
|
||||
GLboolean changed;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
|
@ -319,75 +242,21 @@ _mesa_BlendEquation( GLenum mode )
|
|||
return;
|
||||
}
|
||||
|
||||
numBuffers = ctx->Extensions.ARB_draw_buffers_blend
|
||||
? ctx->Const.MaxDrawBuffers : 1;
|
||||
|
||||
changed = GL_FALSE;
|
||||
for (buf = 0; buf < numBuffers; buf++) {
|
||||
if (ctx->Color.Blend[buf].EquationRGB != mode ||
|
||||
ctx->Color.Blend[buf].EquationA != mode) {
|
||||
changed = GL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!changed)
|
||||
if (ctx->Color.EquationRGB == mode && ctx->Color.EquationA == mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
for (buf = 0; buf < numBuffers; buf++) {
|
||||
ctx->Color.Blend[buf].EquationRGB = mode;
|
||||
ctx->Color.Blend[buf].EquationA = mode;
|
||||
}
|
||||
ctx->Color._BlendEquationPerBuffer = GL_FALSE;
|
||||
ctx->Color.EquationRGB = mode;
|
||||
ctx->Color.EquationA = mode;
|
||||
|
||||
if (ctx->Driver.BlendEquationSeparate)
|
||||
(*ctx->Driver.BlendEquationSeparate)( ctx, mode, mode );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set blend equation for one color buffer/target.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_BlendEquationi(GLuint buf, GLenum mode)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glBlendEquationi(%u, %s)\n",
|
||||
buf, _mesa_lookup_enum_by_nr(mode));
|
||||
|
||||
if (buf >= ctx->Const.MaxDrawBuffers) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glBlendFuncSeparatei(buffer=%u)",
|
||||
buf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!legal_blend_equation(ctx, mode)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationi");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->Color.Blend[buf].EquationRGB == mode &&
|
||||
ctx->Color.Blend[buf].EquationA == mode)
|
||||
return; /* no change */
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
ctx->Color.Blend[buf].EquationRGB = mode;
|
||||
ctx->Color.Blend[buf].EquationA = mode;
|
||||
ctx->Color._BlendEquationPerBuffer = GL_TRUE;
|
||||
|
||||
if (ctx->Driver.BlendEquationSeparatei)
|
||||
ctx->Driver.BlendEquationSeparatei(ctx, buf, mode, mode);
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA )
|
||||
{
|
||||
GLuint buf, numBuffers;
|
||||
GLboolean changed;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
|
@ -412,77 +281,19 @@ _mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA )
|
|||
return;
|
||||
}
|
||||
|
||||
numBuffers = ctx->Extensions.ARB_draw_buffers_blend
|
||||
? ctx->Const.MaxDrawBuffers : 1;
|
||||
|
||||
changed = GL_FALSE;
|
||||
for (buf = 0; buf < numBuffers; buf++) {
|
||||
if (ctx->Color.Blend[buf].EquationRGB != modeRGB ||
|
||||
ctx->Color.Blend[buf].EquationA != modeA) {
|
||||
changed = GL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!changed)
|
||||
if (ctx->Color.EquationRGB == modeRGB && ctx->Color.EquationA == modeA) {
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
for (buf = 0; buf < numBuffers; buf++) {
|
||||
ctx->Color.Blend[buf].EquationRGB = modeRGB;
|
||||
ctx->Color.Blend[buf].EquationA = modeA;
|
||||
}
|
||||
ctx->Color._BlendEquationPerBuffer = GL_FALSE;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
ctx->Color.EquationRGB = modeRGB;
|
||||
ctx->Color.EquationA = modeA;
|
||||
|
||||
if (ctx->Driver.BlendEquationSeparate)
|
||||
ctx->Driver.BlendEquationSeparate(ctx, modeRGB, modeA);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set separate blend equations for one color buffer/target.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glBlendEquationSeparatei(%u, %s %s)\n", buf,
|
||||
_mesa_lookup_enum_by_nr(modeRGB),
|
||||
_mesa_lookup_enum_by_nr(modeA));
|
||||
|
||||
if (buf >= ctx->Const.MaxDrawBuffers) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glBlendEquationSeparatei(buffer=%u)",
|
||||
buf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!legal_blend_equation(ctx, modeRGB)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparatei(modeRGB)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!legal_blend_equation(ctx, modeA)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparatei(modeA)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->Color.Blend[buf].EquationRGB == modeRGB &&
|
||||
ctx->Color.Blend[buf].EquationA == modeA)
|
||||
return; /* no change */
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
ctx->Color.Blend[buf].EquationRGB = modeRGB;
|
||||
ctx->Color.Blend[buf].EquationA = modeA;
|
||||
ctx->Color._BlendEquationPerBuffer = GL_TRUE;
|
||||
|
||||
if (ctx->Driver.BlendEquationSeparatei)
|
||||
ctx->Driver.BlendEquationSeparatei(ctx, buf, modeRGB, modeA);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* _HAVE_FULL_GL */
|
||||
|
||||
|
||||
|
@ -664,8 +475,6 @@ _mesa_ColorMask( GLboolean red, GLboolean green,
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte tmp[4];
|
||||
GLuint i;
|
||||
GLboolean flushed;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
|
@ -680,61 +489,15 @@ _mesa_ColorMask( GLboolean red, GLboolean green,
|
|||
tmp[BCOMP] = blue ? 0xff : 0x0;
|
||||
tmp[ACOMP] = alpha ? 0xff : 0x0;
|
||||
|
||||
flushed = GL_FALSE;
|
||||
for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
|
||||
if (!TEST_EQ_4V(tmp, ctx->Color.ColorMask[i])) {
|
||||
if (!flushed) {
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
}
|
||||
flushed = GL_TRUE;
|
||||
COPY_4UBV(ctx->Color.ColorMask[i], tmp);
|
||||
}
|
||||
if (!TEST_EQ_4V(tmp, ctx->Color.ColorMask)) {
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
COPY_4UBV(ctx->Color.ColorMask, tmp);
|
||||
}
|
||||
|
||||
if (ctx->Driver.ColorMask)
|
||||
ctx->Driver.ColorMask( ctx, red, green, blue, alpha );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For GL_EXT_draw_buffers2 and GL3
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_ColorMaskIndexed( GLuint buf, GLboolean red, GLboolean green,
|
||||
GLboolean blue, GLboolean alpha )
|
||||
{
|
||||
GLubyte tmp[4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glColorMaskIndexed %u %d %d %d %d\n",
|
||||
buf, red, green, blue, alpha);
|
||||
|
||||
if (buf >= ctx->Const.MaxDrawBuffers) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glColorMaskIndexed(buf=%u)", buf);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Shouldn't have any information about channel depth in core mesa
|
||||
* -- should probably store these as the native booleans:
|
||||
*/
|
||||
tmp[RCOMP] = red ? 0xff : 0x0;
|
||||
tmp[GCOMP] = green ? 0xff : 0x0;
|
||||
tmp[BCOMP] = blue ? 0xff : 0x0;
|
||||
tmp[ACOMP] = alpha ? 0xff : 0x0;
|
||||
|
||||
if (TEST_EQ_4V(tmp, ctx->Color.ColorMask[buf]))
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
COPY_4UBV(ctx->Color.ColorMask[buf], tmp);
|
||||
|
||||
if (ctx->Driver.ColorMaskIndexed)
|
||||
ctx->Driver.ColorMaskIndexed(ctx, buf, red, green, blue, alpha);
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_ClampColorARB(GLenum target, GLenum clamp)
|
||||
{
|
||||
|
@ -783,8 +546,6 @@ _mesa_ClampColorARB(GLenum target, GLenum clamp)
|
|||
*/
|
||||
void _mesa_init_color( struct gl_context * ctx )
|
||||
{
|
||||
GLuint i;
|
||||
|
||||
/* Color buffer group */
|
||||
ctx->Color.IndexMask = ~0u;
|
||||
memset(ctx->Color.ColorMask, 0xff, sizeof(ctx->Color.ColorMask));
|
||||
|
@ -794,14 +555,12 @@ void _mesa_init_color( struct gl_context * ctx )
|
|||
ctx->Color.AlphaFunc = GL_ALWAYS;
|
||||
ctx->Color.AlphaRef = 0;
|
||||
ctx->Color.BlendEnabled = 0x0;
|
||||
for (i = 0; i < Elements(ctx->Color.Blend); i++) {
|
||||
ctx->Color.Blend[i].SrcRGB = GL_ONE;
|
||||
ctx->Color.Blend[i].DstRGB = GL_ZERO;
|
||||
ctx->Color.Blend[i].SrcA = GL_ONE;
|
||||
ctx->Color.Blend[i].DstA = GL_ZERO;
|
||||
ctx->Color.Blend[i].EquationRGB = GL_FUNC_ADD;
|
||||
ctx->Color.Blend[i].EquationA = GL_FUNC_ADD;
|
||||
}
|
||||
ctx->Color.SrcRGB = GL_ONE;
|
||||
ctx->Color.DstRGB = GL_ZERO;
|
||||
ctx->Color.SrcA = GL_ONE;
|
||||
ctx->Color.DstA = GL_ZERO;
|
||||
ctx->Color.EquationRGB = GL_FUNC_ADD;
|
||||
ctx->Color.EquationA = GL_FUNC_ADD;
|
||||
ASSIGN_4V( ctx->Color.BlendColor, 0.0, 0.0, 0.0, 0.0 );
|
||||
ASSIGN_4V( ctx->Color.BlendColorUnclamped, 0.0, 0.0, 0.0, 0.0 );
|
||||
ctx->Color.IndexLogicOpEnabled = GL_FALSE;
|
||||
|
@ -810,10 +569,10 @@ void _mesa_init_color( struct gl_context * ctx )
|
|||
ctx->Color.DitherFlag = GL_TRUE;
|
||||
|
||||
if (ctx->Visual.doubleBufferMode) {
|
||||
ctx->Color.DrawBuffer[0] = GL_BACK;
|
||||
ctx->Color.DrawBuffer = GL_BACK;
|
||||
}
|
||||
else {
|
||||
ctx->Color.DrawBuffer[0] = GL_FRONT;
|
||||
ctx->Color.DrawBuffer = GL_FRONT;
|
||||
}
|
||||
|
||||
ctx->Color.ClampFragmentColor = GL_FIXED_ONLY_ARB;
|
||||
|
|
|
@ -47,31 +47,15 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
|
|||
GLenum sfactorA, GLenum dfactorA );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor);
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
|
||||
GLenum sfactorA, GLenum dfactorA);
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BlendEquation( GLenum mode );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BlendEquationi(GLuint buf, GLenum mode);
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA);
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
|
||||
|
@ -91,10 +75,6 @@ extern void GLAPIENTRY
|
|||
_mesa_ColorMask( GLboolean red, GLboolean green,
|
||||
GLboolean blue, GLboolean alpha );
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_ColorMaskIndexed( GLuint buf, GLboolean red, GLboolean green,
|
||||
GLboolean blue, GLboolean alpha );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_ClampColorARB(GLenum target, GLenum clamp);
|
||||
|
|
|
@ -255,91 +255,15 @@ _mesa_DrawBuffer(GLenum buffer)
|
|||
}
|
||||
|
||||
/* if we get here, there's no error so set new state */
|
||||
_mesa_drawbuffers(ctx, 1, &buffer, &destMask);
|
||||
_mesa_drawbuffer(ctx, buffer, destMask);
|
||||
|
||||
/*
|
||||
* Call device driver function.
|
||||
*/
|
||||
if (ctx->Driver.DrawBuffers)
|
||||
ctx->Driver.DrawBuffers(ctx, 1, &buffer);
|
||||
else if (ctx->Driver.DrawBuffer)
|
||||
if (ctx->Driver.DrawBuffer)
|
||||
ctx->Driver.DrawBuffer(ctx, buffer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called by glDrawBuffersARB; specifies the destination color renderbuffers
|
||||
* for N fragment program color outputs.
|
||||
* \sa _mesa_DrawBuffer
|
||||
* \param n number of outputs
|
||||
* \param buffers array [n] of renderbuffer names. Unlike glDrawBuffer, the
|
||||
* names cannot specify more than one buffer. For example,
|
||||
* GL_FRONT_AND_BACK is illegal.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers)
|
||||
{
|
||||
GLint output;
|
||||
GLbitfield usedBufferMask, supportedMask;
|
||||
GLbitfield destMask[MAX_DRAW_BUFFERS];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
/* Turns out n==0 is a valid input that should not produce an error.
|
||||
* The remaining code below correctly handles the n==0 case.
|
||||
*/
|
||||
if (n < 0 || n > (GLsizei) ctx->Const.MaxDrawBuffers) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawBuffersARB(n)");
|
||||
return;
|
||||
}
|
||||
|
||||
supportedMask = supported_buffer_bitmask(ctx, ctx->DrawBuffer);
|
||||
usedBufferMask = 0x0;
|
||||
|
||||
/* complicated error checking... */
|
||||
for (output = 0; output < n; output++) {
|
||||
if (buffers[output] == GL_NONE) {
|
||||
destMask[output] = 0x0;
|
||||
}
|
||||
else {
|
||||
destMask[output] = draw_buffer_enum_to_bitmask(buffers[output]);
|
||||
if (destMask[output] == BAD_MASK
|
||||
|| _mesa_bitcount(destMask[output]) > 1) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffersARB(buffer)");
|
||||
return;
|
||||
}
|
||||
destMask[output] &= supportedMask;
|
||||
if (destMask[output] == 0) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glDrawBuffersARB(unsupported buffer)");
|
||||
return;
|
||||
}
|
||||
if (destMask[output] & usedBufferMask) {
|
||||
/* can't specify a dest buffer more than once! */
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glDrawBuffersARB(duplicated buffer)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* update bitmask */
|
||||
usedBufferMask |= destMask[output];
|
||||
}
|
||||
}
|
||||
|
||||
/* OK, if we get here, there were no errors so set the new state */
|
||||
_mesa_drawbuffers(ctx, n, buffers, destMask);
|
||||
|
||||
/*
|
||||
* Call device driver function. Note that n can be equal to 0,
|
||||
* in which case we don't want to reference buffers[0], which
|
||||
* may not be valid.
|
||||
*/
|
||||
if (ctx->Driver.DrawBuffers)
|
||||
ctx->Driver.DrawBuffers(ctx, n, buffers);
|
||||
else if (ctx->Driver.DrawBuffer)
|
||||
ctx->Driver.DrawBuffer(ctx, n > 0 ? buffers[0] : GL_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs necessary state updates when _mesa_drawbuffers makes an
|
||||
* actual change.
|
||||
|
@ -371,85 +295,31 @@ updated_drawbuffers(struct gl_context *ctx)
|
|||
* BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT).
|
||||
*/
|
||||
void
|
||||
_mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
|
||||
const GLbitfield *destMask)
|
||||
_mesa_drawbuffer(struct gl_context *ctx, const GLenum buffers, GLbitfield destMask)
|
||||
{
|
||||
struct gl_framebuffer *fb = ctx->DrawBuffer;
|
||||
GLbitfield mask[MAX_DRAW_BUFFERS];
|
||||
GLuint buf;
|
||||
GLint bufIndex;
|
||||
|
||||
if (!destMask) {
|
||||
/* compute destMask values now */
|
||||
const GLbitfield supportedMask = supported_buffer_bitmask(ctx, fb);
|
||||
GLuint output;
|
||||
for (output = 0; output < n; output++) {
|
||||
mask[output] = draw_buffer_enum_to_bitmask(buffers[output]);
|
||||
ASSERT(mask[output] != BAD_MASK);
|
||||
mask[output] &= supportedMask;
|
||||
}
|
||||
destMask = mask;
|
||||
destMask = draw_buffer_enum_to_bitmask(buffers);
|
||||
ASSERT(destmask != BAD_MASK);
|
||||
destMask &= supportedMask;
|
||||
}
|
||||
|
||||
bufIndex = _mesa_ffs(destMask) - 1;
|
||||
|
||||
/*
|
||||
* If n==1, destMask[0] may have up to four bits set.
|
||||
* Otherwise, destMask[x] can only have one bit set.
|
||||
*/
|
||||
if (n == 1) {
|
||||
GLuint count = 0, destMask0 = destMask[0];
|
||||
while (destMask0) {
|
||||
GLint bufIndex = _mesa_ffs(destMask0) - 1;
|
||||
if (fb->_ColorDrawBufferIndexes[count] != bufIndex) {
|
||||
updated_drawbuffers(ctx);
|
||||
fb->_ColorDrawBufferIndexes[count] = bufIndex;
|
||||
}
|
||||
count++;
|
||||
destMask0 &= ~(1 << bufIndex);
|
||||
}
|
||||
fb->ColorDrawBuffer[0] = buffers[0];
|
||||
fb->_NumColorDrawBuffers = count;
|
||||
}
|
||||
else {
|
||||
GLuint count = 0;
|
||||
for (buf = 0; buf < n; buf++ ) {
|
||||
if (destMask[buf]) {
|
||||
GLint bufIndex = _mesa_ffs(destMask[buf]) - 1;
|
||||
/* only one bit should be set in the destMask[buf] field */
|
||||
ASSERT(_mesa_bitcount(destMask[buf]) == 1);
|
||||
if (fb->_ColorDrawBufferIndexes[buf] != bufIndex) {
|
||||
updated_drawbuffers(ctx);
|
||||
fb->_ColorDrawBufferIndexes[buf] = bufIndex;
|
||||
}
|
||||
count = buf + 1;
|
||||
}
|
||||
else {
|
||||
if (fb->_ColorDrawBufferIndexes[buf] != -1) {
|
||||
updated_drawbuffers(ctx);
|
||||
fb->_ColorDrawBufferIndexes[buf] = -1;
|
||||
}
|
||||
}
|
||||
fb->ColorDrawBuffer[buf] = buffers[buf];
|
||||
}
|
||||
fb->_NumColorDrawBuffers = count;
|
||||
}
|
||||
|
||||
/* set remaining outputs to -1 (GL_NONE) */
|
||||
for (buf = fb->_NumColorDrawBuffers; buf < ctx->Const.MaxDrawBuffers; buf++) {
|
||||
if (fb->_ColorDrawBufferIndexes[buf] != -1) {
|
||||
updated_drawbuffers(ctx);
|
||||
fb->_ColorDrawBufferIndexes[buf] = -1;
|
||||
}
|
||||
}
|
||||
for (buf = n; buf < ctx->Const.MaxDrawBuffers; buf++) {
|
||||
fb->ColorDrawBuffer[buf] = GL_NONE;
|
||||
if (fb->_ColorDrawBufferIndex != bufIndex) {
|
||||
updated_drawbuffers(ctx);
|
||||
fb->_ColorDrawBufferIndex = bufIndex;
|
||||
}
|
||||
fb->ColorDrawBuffer = buffers;
|
||||
|
||||
if (fb->Name == 0) {
|
||||
/* also set context drawbuffer state */
|
||||
for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {
|
||||
if (ctx->Color.DrawBuffer[buf] != fb->ColorDrawBuffer[buf]) {
|
||||
updated_drawbuffers(ctx);
|
||||
ctx->Color.DrawBuffer[buf] = fb->ColorDrawBuffer[buf];
|
||||
}
|
||||
if (ctx->Color.DrawBuffer != fb->ColorDrawBuffer) {
|
||||
updated_drawbuffers(ctx);
|
||||
ctx->Color.DrawBuffer = fb->ColorDrawBuffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -461,18 +331,12 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
|
|||
* Use when changing contexts.
|
||||
*/
|
||||
void
|
||||
_mesa_update_draw_buffers(struct gl_context *ctx)
|
||||
_mesa_update_draw_buffer(struct gl_context *ctx)
|
||||
{
|
||||
GLenum buffers[MAX_DRAW_BUFFERS];
|
||||
GLuint i;
|
||||
|
||||
/* should be a window system FBO */
|
||||
assert(ctx->DrawBuffer->Name == 0);
|
||||
|
||||
for (i = 0; i < ctx->Const.MaxDrawBuffers; i++)
|
||||
buffers[i] = ctx->Color.DrawBuffer[i];
|
||||
|
||||
_mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers, buffers, NULL);
|
||||
_mesa_drawbuffer(ctx, ctx->Color.DrawBuffer, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,18 +40,14 @@ struct gl_context;
|
|||
extern void GLAPIENTRY
|
||||
_mesa_DrawBuffer( GLenum mode );
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers);
|
||||
|
||||
extern void
|
||||
_mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
|
||||
const GLbitfield *destMask);
|
||||
_mesa_drawbuffer(struct gl_context *ctx, const GLenum buffers, const GLbitfield destMask);
|
||||
|
||||
extern void
|
||||
_mesa_readbuffer(struct gl_context *ctx, GLenum buffer, GLint bufferIndex);
|
||||
|
||||
extern void
|
||||
_mesa_update_draw_buffers(struct gl_context *ctx);
|
||||
_mesa_update_draw_buffer(struct gl_context *ctx);
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
|
|
|
@ -217,10 +217,7 @@ _mesa_Clear( GLbitfield mask )
|
|||
*/
|
||||
bufferMask = 0;
|
||||
if (mask & GL_COLOR_BUFFER_BIT) {
|
||||
GLuint i;
|
||||
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
|
||||
bufferMask |= (1 << ctx->DrawBuffer->_ColorDrawBufferIndexes[i]);
|
||||
}
|
||||
bufferMask |= (1 << ctx->DrawBuffer->_ColorDrawBufferIndex);
|
||||
}
|
||||
|
||||
if ((mask & GL_DEPTH_BUFFER_BIT)
|
||||
|
|
|
@ -264,12 +264,6 @@
|
|||
/*@}*/
|
||||
|
||||
|
||||
/** For GL_ARB_draw_buffers */
|
||||
/*@{*/
|
||||
#define MAX_DRAW_BUFFERS 8
|
||||
/*@}*/
|
||||
|
||||
|
||||
/** For GL_EXT_framebuffer_object */
|
||||
/*@{*/
|
||||
#define MAX_COLOR_ATTACHMENTS 8
|
||||
|
|
|
@ -549,9 +549,6 @@ _mesa_init_constants(struct gl_context *ctx)
|
|||
/* CheckArrayBounds is overriden by drivers/x11 for X server */
|
||||
ctx->Const.CheckArrayBounds = GL_FALSE;
|
||||
|
||||
/* GL_ARB_draw_buffers */
|
||||
ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS;
|
||||
|
||||
#if FEATURE_EXT_framebuffer_object
|
||||
ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS;
|
||||
ctx->Const.MaxRenderbufferSize = MAX_WIDTH;
|
||||
|
@ -645,10 +642,8 @@ check_context_limits(struct gl_context *ctx)
|
|||
assert(ctx->Const.MaxViewportWidth <= MAX_WIDTH);
|
||||
assert(ctx->Const.MaxViewportHeight <= MAX_WIDTH);
|
||||
|
||||
assert(ctx->Const.MaxDrawBuffers <= MAX_DRAW_BUFFERS);
|
||||
|
||||
/* if this fails, add more enum values to gl_buffer_index */
|
||||
assert(BUFFER_COLOR0 + MAX_DRAW_BUFFERS <= BUFFER_COUNT);
|
||||
assert(BUFFER_COLOR0 + 1 <= BUFFER_COUNT);
|
||||
|
||||
/* XXX probably add more tests */
|
||||
}
|
||||
|
@ -1302,7 +1297,7 @@ _mesa_make_current( struct gl_context *newCtx,
|
|||
* For winsys FBOs this comes from the GL state (which may have
|
||||
* changed since the last time this FBO was bound).
|
||||
*/
|
||||
_mesa_update_draw_buffers(newCtx);
|
||||
_mesa_update_draw_buffer(newCtx);
|
||||
}
|
||||
if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) {
|
||||
_mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer);
|
||||
|
|
|
@ -562,8 +562,6 @@ struct dd_function_table {
|
|||
/** Enable and disable writing of frame buffer color components */
|
||||
void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask,
|
||||
GLboolean bmask, GLboolean amask );
|
||||
void (*ColorMaskIndexed)(struct gl_context *ctx, GLuint buf, GLboolean rmask,
|
||||
GLboolean gmask, GLboolean bmask, GLboolean amask);
|
||||
/** Cause a material color to track the current color */
|
||||
void (*ColorMaterial)(struct gl_context *ctx, GLenum face, GLenum mode);
|
||||
/** Specify whether front- or back-facing facets can be culled */
|
||||
|
@ -578,8 +576,6 @@ struct dd_function_table {
|
|||
void (*DepthRange)(struct gl_context *ctx, GLclampd nearval, GLclampd farval);
|
||||
/** Specify the current buffer for writing */
|
||||
void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer );
|
||||
/** Specify the buffers for writing for fragment programs*/
|
||||
void (*DrawBuffers)( struct gl_context *ctx, GLsizei n, const GLenum *buffers );
|
||||
/** Enable or disable server-side gl capabilities */
|
||||
void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state);
|
||||
/** Specify fog parameters */
|
||||
|
|
|
@ -449,8 +449,8 @@ _mesa_dump_color_buffer(const char *filename)
|
|||
printf("ReadBuffer %p 0x%x DrawBuffer %p 0x%x\n",
|
||||
(void *) ctx->ReadBuffer->_ColorReadBuffer,
|
||||
ctx->ReadBuffer->ColorReadBuffer,
|
||||
(void *) ctx->DrawBuffer->_ColorDrawBuffers[0],
|
||||
ctx->DrawBuffer->ColorDrawBuffer[0]);
|
||||
(void *) ctx->DrawBuffer->_ColorDrawBuffer,
|
||||
ctx->DrawBuffer->ColorDrawBuffer);
|
||||
printf("Writing %d x %d color buffer to %s\n", w, h, filename);
|
||||
write_ppm(filename, buf, w, h, 4, 0, 1, 2, GL_TRUE);
|
||||
|
||||
|
|
|
@ -617,17 +617,12 @@
|
|||
#define _gloffset_BindAttribLocationARB 568
|
||||
#define _gloffset_GetActiveAttribARB 569
|
||||
#define _gloffset_GetAttribLocationARB 570
|
||||
#define _gloffset_DrawBuffersARB 571
|
||||
#define _gloffset_ClampColorARB 572
|
||||
#define _gloffset_RenderbufferStorageMultisample 575
|
||||
#define _gloffset_FlushMappedBufferRange 580
|
||||
#define _gloffset_MapBufferRange 581
|
||||
#define _gloffset_BindVertexArray 583
|
||||
#define _gloffset_GenVertexArrays 584
|
||||
#define _gloffset_BlendEquationSeparateiARB 597
|
||||
#define _gloffset_BlendEquationiARB 598
|
||||
#define _gloffset_BlendFuncSeparateiARB 599
|
||||
#define _gloffset_BlendFunciARB 600
|
||||
#define _gloffset_GetGraphicsResetStatusARB 665
|
||||
#define _gloffset_GetnColorTableARB 666
|
||||
#define _gloffset_GetnConvolutionFilterARB 668
|
||||
|
@ -1047,7 +1042,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
|
|||
#define BindAttribLocationARB_remap_index 160
|
||||
#define GetActiveAttribARB_remap_index 161
|
||||
#define GetAttribLocationARB_remap_index 162
|
||||
#define DrawBuffersARB_remap_index 163
|
||||
#define ClampColorARB_remap_index 164
|
||||
#define RenderbufferStorageMultisample_remap_index 167
|
||||
#define VertexAttribDivisorARB_remap_index 171
|
||||
|
@ -1055,10 +1049,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
|
|||
#define MapBufferRange_remap_index 173
|
||||
#define BindVertexArray_remap_index 175
|
||||
#define GenVertexArrays_remap_index 176
|
||||
#define BlendEquationSeparateiARB_remap_index 189
|
||||
#define BlendEquationiARB_remap_index 190
|
||||
#define BlendFuncSeparateiARB_remap_index 191
|
||||
#define BlendFunciARB_remap_index 192
|
||||
#define GetGraphicsResetStatusARB_remap_index 257
|
||||
#define GetnColorTableARB_remap_index 258
|
||||
#define GetnConvolutionFilterARB_remap_index 260
|
||||
|
@ -1472,17 +1462,12 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
|
|||
#define _gloffset_BindAttribLocationARB driDispatchRemapTable[BindAttribLocationARB_remap_index]
|
||||
#define _gloffset_GetActiveAttribARB driDispatchRemapTable[GetActiveAttribARB_remap_index]
|
||||
#define _gloffset_GetAttribLocationARB driDispatchRemapTable[GetAttribLocationARB_remap_index]
|
||||
#define _gloffset_DrawBuffersARB driDispatchRemapTable[DrawBuffersARB_remap_index]
|
||||
#define _gloffset_ClampColorARB driDispatchRemapTable[ClampColorARB_remap_index]
|
||||
#define _gloffset_RenderbufferStorageMultisample driDispatchRemapTable[RenderbufferStorageMultisample_remap_index]
|
||||
#define _gloffset_FlushMappedBufferRange driDispatchRemapTable[FlushMappedBufferRange_remap_index]
|
||||
#define _gloffset_MapBufferRange driDispatchRemapTable[MapBufferRange_remap_index]
|
||||
#define _gloffset_BindVertexArray driDispatchRemapTable[BindVertexArray_remap_index]
|
||||
#define _gloffset_GenVertexArrays driDispatchRemapTable[GenVertexArrays_remap_index]
|
||||
#define _gloffset_BlendEquationSeparateiARB driDispatchRemapTable[BlendEquationSeparateiARB_remap_index]
|
||||
#define _gloffset_BlendEquationiARB driDispatchRemapTable[BlendEquationiARB_remap_index]
|
||||
#define _gloffset_BlendFuncSeparateiARB driDispatchRemapTable[BlendFuncSeparateiARB_remap_index]
|
||||
#define _gloffset_BlendFunciARB driDispatchRemapTable[BlendFunciARB_remap_index]
|
||||
#define _gloffset_GetGraphicsResetStatusARB driDispatchRemapTable[GetGraphicsResetStatusARB_remap_index]
|
||||
#define _gloffset_GetnColorTableARB driDispatchRemapTable[GetnColorTableARB_remap_index]
|
||||
#define _gloffset_GetnConvolutionFilterARB driDispatchRemapTable[GetnConvolutionFilterARB_remap_index]
|
||||
|
@ -7795,17 +7780,6 @@ static inline void SET_GetAttribLocationARB(struct _glapi_table *disp, GLint (GL
|
|||
SET_by_offset(disp, _gloffset_GetAttribLocationARB, fn);
|
||||
}
|
||||
|
||||
typedef void (GLAPIENTRYP _glptr_DrawBuffersARB)(GLsizei, const GLenum *);
|
||||
#define CALL_DrawBuffersARB(disp, parameters) \
|
||||
(* GET_DrawBuffersARB(disp)) parameters
|
||||
static inline _glptr_DrawBuffersARB GET_DrawBuffersARB(struct _glapi_table *disp) {
|
||||
return (_glptr_DrawBuffersARB) (GET_by_offset(disp, _gloffset_DrawBuffersARB));
|
||||
}
|
||||
|
||||
static inline void SET_DrawBuffersARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLenum *)) {
|
||||
SET_by_offset(disp, _gloffset_DrawBuffersARB, fn);
|
||||
}
|
||||
|
||||
typedef void (GLAPIENTRYP _glptr_ClampColorARB)(GLenum, GLenum);
|
||||
#define CALL_ClampColorARB(disp, parameters) \
|
||||
(* GET_ClampColorARB(disp)) parameters
|
||||
|
@ -7872,50 +7846,6 @@ static inline void SET_GenVertexArrays(struct _glapi_table *disp, void (GLAPIENT
|
|||
SET_by_offset(disp, _gloffset_GenVertexArrays, fn);
|
||||
}
|
||||
|
||||
typedef void (GLAPIENTRYP _glptr_BlendEquationSeparateiARB)(GLuint, GLenum, GLenum);
|
||||
#define CALL_BlendEquationSeparateiARB(disp, parameters) \
|
||||
(* GET_BlendEquationSeparateiARB(disp)) parameters
|
||||
static inline _glptr_BlendEquationSeparateiARB GET_BlendEquationSeparateiARB(struct _glapi_table *disp) {
|
||||
return (_glptr_BlendEquationSeparateiARB) (GET_by_offset(disp, _gloffset_BlendEquationSeparateiARB));
|
||||
}
|
||||
|
||||
static inline void SET_BlendEquationSeparateiARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLenum)) {
|
||||
SET_by_offset(disp, _gloffset_BlendEquationSeparateiARB, fn);
|
||||
}
|
||||
|
||||
typedef void (GLAPIENTRYP _glptr_BlendEquationiARB)(GLuint, GLenum);
|
||||
#define CALL_BlendEquationiARB(disp, parameters) \
|
||||
(* GET_BlendEquationiARB(disp)) parameters
|
||||
static inline _glptr_BlendEquationiARB GET_BlendEquationiARB(struct _glapi_table *disp) {
|
||||
return (_glptr_BlendEquationiARB) (GET_by_offset(disp, _gloffset_BlendEquationiARB));
|
||||
}
|
||||
|
||||
static inline void SET_BlendEquationiARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum)) {
|
||||
SET_by_offset(disp, _gloffset_BlendEquationiARB, fn);
|
||||
}
|
||||
|
||||
typedef void (GLAPIENTRYP _glptr_BlendFuncSeparateiARB)(GLuint, GLenum, GLenum, GLenum, GLenum);
|
||||
#define CALL_BlendFuncSeparateiARB(disp, parameters) \
|
||||
(* GET_BlendFuncSeparateiARB(disp)) parameters
|
||||
static inline _glptr_BlendFuncSeparateiARB GET_BlendFuncSeparateiARB(struct _glapi_table *disp) {
|
||||
return (_glptr_BlendFuncSeparateiARB) (GET_by_offset(disp, _gloffset_BlendFuncSeparateiARB));
|
||||
}
|
||||
|
||||
static inline void SET_BlendFuncSeparateiARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLenum, GLenum, GLenum)) {
|
||||
SET_by_offset(disp, _gloffset_BlendFuncSeparateiARB, fn);
|
||||
}
|
||||
|
||||
typedef void (GLAPIENTRYP _glptr_BlendFunciARB)(GLuint, GLenum, GLenum);
|
||||
#define CALL_BlendFunciARB(disp, parameters) \
|
||||
(* GET_BlendFunciARB(disp)) parameters
|
||||
static inline _glptr_BlendFunciARB GET_BlendFunciARB(struct _glapi_table *disp) {
|
||||
return (_glptr_BlendFunciARB) (GET_by_offset(disp, _gloffset_BlendFunciARB));
|
||||
}
|
||||
|
||||
static inline void SET_BlendFunciARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLenum, GLenum)) {
|
||||
SET_by_offset(disp, _gloffset_BlendFunciARB, fn);
|
||||
}
|
||||
|
||||
typedef GLenum (GLAPIENTRYP _glptr_GetGraphicsResetStatusARB)(void);
|
||||
#define CALL_GetGraphicsResetStatusARB(disp, parameters) \
|
||||
(* GET_GetGraphicsResetStatusARB(disp)) parameters
|
||||
|
|
|
@ -190,11 +190,6 @@ typedef enum
|
|||
OPCODE_BLEND_EQUATION_SEPARATE,
|
||||
OPCODE_BLEND_FUNC_SEPARATE,
|
||||
|
||||
OPCODE_BLEND_EQUATION_I,
|
||||
OPCODE_BLEND_EQUATION_SEPARATE_I,
|
||||
OPCODE_BLEND_FUNC_I,
|
||||
OPCODE_BLEND_FUNC_SEPARATE_I,
|
||||
|
||||
OPCODE_CALL_LIST,
|
||||
OPCODE_CALL_LIST_OFFSET,
|
||||
OPCODE_CLEAR,
|
||||
|
@ -321,8 +316,6 @@ typedef enum
|
|||
/* GL_ARB_vertex/fragment_program */
|
||||
OPCODE_PROGRAM_STRING_ARB,
|
||||
OPCODE_PROGRAM_ENV_PARAMETER_ARB,
|
||||
/* GL_ARB_draw_buffers */
|
||||
OPCODE_DRAW_BUFFERS_ARB,
|
||||
/* GL_ATI_fragment_shader */
|
||||
OPCODE_TEX_BUMP_PARAMETER_ATI,
|
||||
/* OpenGL 2.0 */
|
||||
|
@ -1138,81 +1131,6 @@ save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
|
|||
}
|
||||
}
|
||||
|
||||
/* GL_ARB_draw_buffers_blend */
|
||||
static void GLAPIENTRY
|
||||
save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
|
||||
GLenum sfactorA, GLenum dfactorA)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
Node *n;
|
||||
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
|
||||
n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5);
|
||||
if (n) {
|
||||
n[1].ui = buf;
|
||||
n[2].e = sfactorRGB;
|
||||
n[3].e = dfactorRGB;
|
||||
n[4].e = sfactorA;
|
||||
n[5].e = dfactorA;
|
||||
}
|
||||
if (ctx->ExecuteFlag) {
|
||||
CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
|
||||
sfactorA, dfactorA));
|
||||
}
|
||||
}
|
||||
|
||||
/* GL_ARB_draw_buffers_blend */
|
||||
static void GLAPIENTRY
|
||||
save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
Node *n;
|
||||
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
|
||||
n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 3);
|
||||
if (n) {
|
||||
n[1].ui = buf;
|
||||
n[2].e = sfactor;
|
||||
n[3].e = dfactor;
|
||||
}
|
||||
if (ctx->ExecuteFlag) {
|
||||
CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
|
||||
}
|
||||
}
|
||||
|
||||
/* GL_ARB_draw_buffers_blend */
|
||||
static void GLAPIENTRY
|
||||
save_BlendEquationi(GLuint buf, GLenum mode)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
Node *n;
|
||||
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
|
||||
n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
|
||||
if (n) {
|
||||
n[1].ui = buf;
|
||||
n[2].e = mode;
|
||||
}
|
||||
if (ctx->ExecuteFlag) {
|
||||
CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
|
||||
}
|
||||
}
|
||||
|
||||
/* GL_ARB_draw_buffers_blend */
|
||||
static void GLAPIENTRY
|
||||
save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
Node *n;
|
||||
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
|
||||
n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
|
||||
if (n) {
|
||||
n[1].ui = buf;
|
||||
n[2].e = modeRGB;
|
||||
n[3].e = modeA;
|
||||
}
|
||||
if (ctx->ExecuteFlag) {
|
||||
CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
|
||||
}
|
||||
}
|
||||
|
||||
static void invalidate_saved_current_state( struct gl_context *ctx )
|
||||
{
|
||||
GLint i;
|
||||
|
@ -4771,28 +4689,6 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
|
|||
|
||||
#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
Node *n;
|
||||
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
|
||||
n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
|
||||
if (n) {
|
||||
GLint i;
|
||||
n[1].i = count;
|
||||
if (count > MAX_DRAW_BUFFERS)
|
||||
count = MAX_DRAW_BUFFERS;
|
||||
for (i = 0; i < count; i++) {
|
||||
n[2 + i].e = buffers[i];
|
||||
}
|
||||
}
|
||||
if (ctx->ExecuteFlag) {
|
||||
CALL_DrawBuffersARB(ctx->Exec, (count, buffers));
|
||||
}
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
save_TexBumpParameterfvATI(GLenum pname, const GLfloat *param)
|
||||
{
|
||||
|
@ -6604,25 +6500,6 @@ execute_list(struct gl_context *ctx, GLuint list)
|
|||
(n[1].e, n[2].e, n[3].e, n[4].e));
|
||||
break;
|
||||
|
||||
case OPCODE_BLEND_FUNC_I:
|
||||
/* GL_ARB_draw_buffers_blend */
|
||||
CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
|
||||
break;
|
||||
case OPCODE_BLEND_FUNC_SEPARATE_I:
|
||||
/* GL_ARB_draw_buffers_blend */
|
||||
CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
|
||||
n[4].e, n[5].e));
|
||||
break;
|
||||
case OPCODE_BLEND_EQUATION_I:
|
||||
/* GL_ARB_draw_buffers_blend */
|
||||
CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
|
||||
break;
|
||||
case OPCODE_BLEND_EQUATION_SEPARATE_I:
|
||||
/* GL_ARB_draw_buffers_blend */
|
||||
CALL_BlendEquationSeparateiARB(ctx->Exec,
|
||||
(n[1].ui, n[2].e, n[3].e));
|
||||
break;
|
||||
|
||||
case OPCODE_CALL_LIST:
|
||||
/* Generated by glCallList(), don't add ListBase */
|
||||
if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
|
||||
|
@ -7267,15 +7144,6 @@ execute_list(struct gl_context *ctx, GLuint list)
|
|||
n[6].f));
|
||||
break;
|
||||
#endif
|
||||
case OPCODE_DRAW_BUFFERS_ARB:
|
||||
{
|
||||
GLenum buffers[MAX_DRAW_BUFFERS];
|
||||
GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
|
||||
for (i = 0; i < count; i++)
|
||||
buffers[i] = n[2 + i].e;
|
||||
CALL_DrawBuffersARB(ctx->Exec, (n[1].i, buffers));
|
||||
}
|
||||
break;
|
||||
#if FEATURE_EXT_framebuffer_blit
|
||||
case OPCODE_BLIT_FRAMEBUFFER:
|
||||
CALL_BlitFramebufferEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
|
||||
|
@ -9086,8 +8954,6 @@ _mesa_create_save_table(void)
|
|||
SET_MapBufferARB(table, _mesa_MapBufferARB);
|
||||
SET_UnmapBufferARB(table, _mesa_UnmapBufferARB);
|
||||
|
||||
SET_DrawBuffersARB(table, save_DrawBuffersARB);
|
||||
|
||||
#if FEATURE_EXT_framebuffer_blit
|
||||
SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT);
|
||||
#endif
|
||||
|
@ -9188,12 +9054,6 @@ _mesa_create_save_table(void)
|
|||
/* GL_NV_texture_barrier */
|
||||
SET_TextureBarrierNV(table, save_TextureBarrierNV);
|
||||
|
||||
/* GL_ARB_draw_buffer_blend */
|
||||
SET_BlendFunciARB(table, save_BlendFunci);
|
||||
SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
|
||||
SET_BlendEquationiARB(table, save_BlendEquationi);
|
||||
SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
|
||||
|
||||
/* GL_ARB_texture_storage (no dlist support) */
|
||||
SET_TexStorage1D(table, _mesa_TexStorage1D);
|
||||
SET_TexStorage2D(table, _mesa_TexStorage2D);
|
||||
|
|
|
@ -57,7 +57,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
|
|||
_mesa_lookup_enum_by_nr(format),
|
||||
_mesa_lookup_enum_by_nr(type),
|
||||
pixels,
|
||||
_mesa_lookup_enum_by_nr(ctx->DrawBuffer->ColorDrawBuffer[0]),
|
||||
_mesa_lookup_enum_by_nr(ctx->DrawBuffer->ColorDrawBuffer),
|
||||
IROUND(ctx->Current.RasterPos[0]),
|
||||
IROUND(ctx->Current.RasterPos[1]));
|
||||
|
||||
|
@ -164,7 +164,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
|
|||
srcx, srcy, width, height,
|
||||
_mesa_lookup_enum_by_nr(type),
|
||||
_mesa_lookup_enum_by_nr(ctx->ReadBuffer->ColorReadBuffer),
|
||||
_mesa_lookup_enum_by_nr(ctx->DrawBuffer->ColorDrawBuffer[0]),
|
||||
_mesa_lookup_enum_by_nr(ctx->DrawBuffer->ColorDrawBuffer),
|
||||
IROUND(ctx->Current.RasterPos[0]),
|
||||
IROUND(ctx->Current.RasterPos[1]));
|
||||
|
||||
|
|
|
@ -277,11 +277,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
|||
break;
|
||||
case GL_BLEND:
|
||||
{
|
||||
GLbitfield newEnabled =
|
||||
state * ((1 << ctx->Const.MaxDrawBuffers) - 1);
|
||||
if (newEnabled != ctx->Color.BlendEnabled) {
|
||||
if (state != ctx->Color.BlendEnabled) {
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
ctx->Color.BlendEnabled = newEnabled;
|
||||
ctx->Color.BlendEnabled = state;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -69,8 +69,6 @@ static const struct extension extension_table[] = {
|
|||
/* ARB Extensions */
|
||||
{ "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), 2004 },
|
||||
{ "GL_ARB_conservative_depth", o(ARB_conservative_depth), 2011 },
|
||||
{ "GL_ARB_draw_buffers", o(dummy_true), 2002 },
|
||||
{ "GL_ARB_draw_buffers_blend", o(ARB_draw_buffers_blend), 2009 },
|
||||
{ "GL_ARB_fragment_program", o(ARB_fragment_program), 2002 },
|
||||
{ "GL_ARB_fragment_program_shadow", o(ARB_fragment_program_shadow), 2003 },
|
||||
{ "GL_ARB_fragment_shader", o(ARB_fragment_shader), 2002 },
|
||||
|
@ -152,7 +150,6 @@ static const struct extension extension_table[] = {
|
|||
|
||||
/* Vendor extensions */
|
||||
{ "GL_AMD_conservative_depth", o(ARB_conservative_depth), 2009 },
|
||||
{ "GL_AMD_draw_buffers_blend", o(ARB_draw_buffers_blend), 2009 },
|
||||
{ "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), 2009 },
|
||||
{ "GL_APPLE_object_purgeable", o(APPLE_object_purgeable), 2006 },
|
||||
{ "GL_APPLE_packed_pixels", o(APPLE_packed_pixels), 2002 },
|
||||
|
|
|
@ -648,7 +648,6 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
|
|||
GLuint minWidth = ~0, minHeight = ~0, maxWidth = 0, maxHeight = 0;
|
||||
GLint numSamples = -1;
|
||||
GLint i;
|
||||
GLuint j;
|
||||
|
||||
assert(is_user_fbo(fb));
|
||||
|
||||
|
@ -775,18 +774,16 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
/* Check that all DrawBuffers are present */
|
||||
for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
|
||||
if (fb->ColorDrawBuffer[j] != GL_NONE) {
|
||||
if (fb->ColorDrawBuffer != GL_NONE) {
|
||||
const struct gl_renderbuffer_attachment *att
|
||||
= _mesa_get_attachment(ctx, fb, fb->ColorDrawBuffer[j]);
|
||||
= _mesa_get_attachment(ctx, fb, fb->ColorDrawBuffer);
|
||||
assert(att);
|
||||
if (att->Type == GL_NONE) {
|
||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT;
|
||||
fbo_incomplete("missing drawbuffer", j);
|
||||
fbo_incomplete("missing drawbuffer", 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check that the ReadBuffer is present */
|
||||
if (fb->ColorReadBuffer != GL_NONE) {
|
||||
|
@ -2361,7 +2358,7 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
|||
/* get color read/draw renderbuffers */
|
||||
if (mask & GL_COLOR_BUFFER_BIT) {
|
||||
colorReadRb = readFb->_ColorReadBuffer;
|
||||
colorDrawRb = drawFb->_ColorDrawBuffers[0];
|
||||
colorDrawRb = drawFb->_ColorDrawBuffer;
|
||||
|
||||
/* From the EXT_framebuffer_object spec:
|
||||
*
|
||||
|
|
|
@ -137,16 +137,14 @@ _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
|
|||
|
||||
/* Init read/draw renderbuffer state */
|
||||
if (visual->doubleBufferMode) {
|
||||
fb->_NumColorDrawBuffers = 1;
|
||||
fb->ColorDrawBuffer[0] = GL_BACK;
|
||||
fb->_ColorDrawBufferIndexes[0] = BUFFER_BACK_LEFT;
|
||||
fb->ColorDrawBuffer = GL_BACK;
|
||||
fb->_ColorDrawBufferIndex = BUFFER_BACK_LEFT;
|
||||
fb->ColorReadBuffer = GL_BACK;
|
||||
fb->_ColorReadBufferIndex = BUFFER_BACK_LEFT;
|
||||
}
|
||||
else {
|
||||
fb->_NumColorDrawBuffers = 1;
|
||||
fb->ColorDrawBuffer[0] = GL_FRONT;
|
||||
fb->_ColorDrawBufferIndexes[0] = BUFFER_FRONT_LEFT;
|
||||
fb->ColorDrawBuffer = GL_FRONT;
|
||||
fb->_ColorDrawBufferIndex = BUFFER_FRONT_LEFT;
|
||||
fb->ColorReadBuffer = GL_FRONT;
|
||||
fb->_ColorReadBufferIndex = BUFFER_FRONT_LEFT;
|
||||
}
|
||||
|
@ -172,9 +170,8 @@ _mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name)
|
|||
|
||||
fb->Name = name;
|
||||
fb->RefCount = 1;
|
||||
fb->_NumColorDrawBuffers = 1;
|
||||
fb->ColorDrawBuffer[0] = GL_COLOR_ATTACHMENT0_EXT;
|
||||
fb->_ColorDrawBufferIndexes[0] = BUFFER_COLOR0;
|
||||
fb->ColorDrawBuffer = GL_COLOR_ATTACHMENT0_EXT;
|
||||
fb->_ColorDrawBufferIndex = BUFFER_COLOR0;
|
||||
fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT;
|
||||
fb->_ColorReadBufferIndex = BUFFER_COLOR0;
|
||||
fb->Delete = _mesa_destroy_framebuffer;
|
||||
|
@ -628,19 +625,12 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx,
|
|||
static void
|
||||
update_color_draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb)
|
||||
{
|
||||
GLuint output;
|
||||
|
||||
/* set 0th buffer to NULL now in case _NumColorDrawBuffers is zero */
|
||||
fb->_ColorDrawBuffers[0] = NULL;
|
||||
|
||||
for (output = 0; output < fb->_NumColorDrawBuffers; output++) {
|
||||
GLint buf = fb->_ColorDrawBufferIndexes[output];
|
||||
if (buf >= 0) {
|
||||
fb->_ColorDrawBuffers[output] = fb->Attachment[buf].Renderbuffer;
|
||||
}
|
||||
else {
|
||||
fb->_ColorDrawBuffers[output] = NULL;
|
||||
}
|
||||
GLint buf = fb->_ColorDrawBufferIndex;
|
||||
if (buf >= 0) {
|
||||
fb->_ColorDrawBuffer = fb->Attachment[buf].Renderbuffer;
|
||||
}
|
||||
else {
|
||||
fb->_ColorDrawBuffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -690,10 +680,7 @@ update_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
|
|||
/* Need to update the FB's GL_DRAW_BUFFER state to match the
|
||||
* context state (GL_READ_BUFFER too).
|
||||
*/
|
||||
if (fb->ColorDrawBuffer[0] != ctx->Color.DrawBuffer[0]) {
|
||||
_mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers,
|
||||
ctx->Color.DrawBuffer, NULL);
|
||||
}
|
||||
_mesa_drawbuffer(ctx, ctx->Color.DrawBuffer, 0);
|
||||
}
|
||||
else {
|
||||
/* This is a user-created framebuffer.
|
||||
|
|
|
@ -131,7 +131,6 @@ enum value_extra {
|
|||
EXTRA_VERSION_32,
|
||||
EXTRA_NEW_BUFFERS,
|
||||
EXTRA_NEW_FRAG_CLAMP,
|
||||
EXTRA_VALID_DRAW_BUFFER,
|
||||
EXTRA_VALID_TEXTURE_UNIT,
|
||||
EXTRA_VALID_CLIP_DISTANCE,
|
||||
EXTRA_FLUSH_CURRENT,
|
||||
|
@ -232,11 +231,6 @@ static const int extra_new_frag_clamp[] = {
|
|||
EXTRA_END
|
||||
};
|
||||
|
||||
static const int extra_valid_draw_buffer[] = {
|
||||
EXTRA_VALID_DRAW_BUFFER,
|
||||
EXTRA_END
|
||||
};
|
||||
|
||||
static const int extra_valid_texture_unit[] = {
|
||||
EXTRA_VALID_TEXTURE_UNIT,
|
||||
EXTRA_END
|
||||
|
@ -347,7 +341,7 @@ static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
|
|||
static const struct value_desc values[] = {
|
||||
{ GL_ALPHA_BITS, BUFFER_INT(Visual.alphaBits), extra_new_buffers },
|
||||
{ GL_BLEND, CONTEXT_BIT0(Color.BlendEnabled), NO_EXTRA },
|
||||
{ GL_BLEND_SRC, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA },
|
||||
{ GL_BLEND_SRC, CONTEXT_ENUM(Color.SrcRGB), NO_EXTRA },
|
||||
{ GL_BLUE_BITS, BUFFER_INT(Visual.blueBits), extra_new_buffers },
|
||||
{ GL_COLOR_CLEAR_VALUE, LOC_CUSTOM, TYPE_FLOATN_4, 0, extra_new_frag_clamp },
|
||||
{ GL_COLOR_WRITEMASK, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA },
|
||||
|
@ -409,15 +403,15 @@ static const struct value_desc values[] = {
|
|||
extra_ARB_texture_cube_map }, /* XXX: OES_texture_cube_map */
|
||||
|
||||
/* XXX: OES_blend_subtract */
|
||||
{ GL_BLEND_SRC_RGB_EXT, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA },
|
||||
{ GL_BLEND_DST_RGB_EXT, CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA },
|
||||
{ GL_BLEND_SRC_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].SrcA), NO_EXTRA },
|
||||
{ GL_BLEND_DST_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].DstA), NO_EXTRA },
|
||||
{ GL_BLEND_SRC_RGB_EXT, CONTEXT_ENUM(Color.SrcRGB), NO_EXTRA },
|
||||
{ GL_BLEND_DST_RGB_EXT, CONTEXT_ENUM(Color.DstRGB), NO_EXTRA },
|
||||
{ GL_BLEND_SRC_ALPHA_EXT, CONTEXT_ENUM(Color.SrcA), NO_EXTRA },
|
||||
{ GL_BLEND_DST_ALPHA_EXT, CONTEXT_ENUM(Color.DstA), NO_EXTRA },
|
||||
|
||||
/* GL_BLEND_EQUATION_RGB, which is what we're really after, is
|
||||
* defined identically to GL_BLEND_EQUATION. */
|
||||
{ GL_BLEND_EQUATION, CONTEXT_ENUM(Color.Blend[0].EquationRGB), NO_EXTRA },
|
||||
{ GL_BLEND_EQUATION_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].EquationA), NO_EXTRA },
|
||||
{ GL_BLEND_EQUATION, CONTEXT_ENUM(Color.EquationRGB), NO_EXTRA },
|
||||
{ GL_BLEND_EQUATION_ALPHA_EXT, CONTEXT_ENUM(Color.EquationA), NO_EXTRA },
|
||||
|
||||
/* GL_ARB_texture_compression */
|
||||
{ GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
|
||||
|
@ -483,7 +477,7 @@ static const struct value_desc values[] = {
|
|||
{ GL_ALPHA_TEST, CONTEXT_BOOL(Color.AlphaEnabled), NO_EXTRA },
|
||||
{ GL_ALPHA_TEST_FUNC, CONTEXT_ENUM(Color.AlphaFunc), NO_EXTRA },
|
||||
{ GL_ALPHA_TEST_REF, LOC_CUSTOM, TYPE_FLOATN, 0, extra_new_frag_clamp },
|
||||
{ GL_BLEND_DST, CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA },
|
||||
{ GL_BLEND_DST, CONTEXT_ENUM(Color.DstRGB), NO_EXTRA },
|
||||
{ GL_CLIP_DISTANCE0, CONTEXT_BIT0(Transform.ClipPlanesEnabled), extra_valid_clip_distance },
|
||||
{ GL_CLIP_DISTANCE1, CONTEXT_BIT1(Transform.ClipPlanesEnabled), extra_valid_clip_distance },
|
||||
{ GL_CLIP_DISTANCE2, CONTEXT_BIT2(Transform.ClipPlanesEnabled), extra_valid_clip_distance },
|
||||
|
@ -614,30 +608,10 @@ static const struct value_desc values[] = {
|
|||
CONTEXT_INT(Const.MaxTextureCoordUnits),
|
||||
extra_ARB_fragment_program_NV_fragment_program },
|
||||
|
||||
/* GL_ARB_draw_buffers */
|
||||
{ GL_MAX_DRAW_BUFFERS_ARB, CONTEXT_INT(Const.MaxDrawBuffers), NO_EXTRA },
|
||||
|
||||
/* GL_EXT_framebuffer_object / GL_NV_fbo_color_attachments */
|
||||
{ GL_MAX_COLOR_ATTACHMENTS, CONTEXT_INT(Const.MaxColorAttachments),
|
||||
extra_EXT_framebuffer_object },
|
||||
|
||||
/* GL_ARB_draw_buffers / GL_NV_draw_buffers (for ES 2.0) */
|
||||
{ GL_DRAW_BUFFER0_ARB, BUFFER_ENUM(ColorDrawBuffer[0]), NO_EXTRA },
|
||||
{ GL_DRAW_BUFFER1_ARB, BUFFER_ENUM(ColorDrawBuffer[1]),
|
||||
extra_valid_draw_buffer },
|
||||
{ GL_DRAW_BUFFER2_ARB, BUFFER_ENUM(ColorDrawBuffer[2]),
|
||||
extra_valid_draw_buffer },
|
||||
{ GL_DRAW_BUFFER3_ARB, BUFFER_ENUM(ColorDrawBuffer[3]),
|
||||
extra_valid_draw_buffer },
|
||||
{ GL_DRAW_BUFFER4_ARB, BUFFER_ENUM(ColorDrawBuffer[4]),
|
||||
extra_valid_draw_buffer },
|
||||
{ GL_DRAW_BUFFER5_ARB, BUFFER_ENUM(ColorDrawBuffer[5]),
|
||||
extra_valid_draw_buffer },
|
||||
{ GL_DRAW_BUFFER6_ARB, BUFFER_ENUM(ColorDrawBuffer[6]),
|
||||
extra_valid_draw_buffer },
|
||||
{ GL_DRAW_BUFFER7_ARB, BUFFER_ENUM(ColorDrawBuffer[7]),
|
||||
extra_valid_draw_buffer },
|
||||
|
||||
{ GL_BLEND_COLOR_EXT, LOC_CUSTOM, TYPE_FLOATN_4, 0, extra_new_frag_clamp },
|
||||
/* GL_ARB_fragment_program */
|
||||
{ GL_MAX_TEXTURE_IMAGE_UNITS_ARB, /* == GL_MAX_TEXTURE_IMAGE_UNITS_NV */
|
||||
|
@ -703,7 +677,7 @@ static const struct value_desc values[] = {
|
|||
{ GL_DEPTH_BIAS, CONTEXT_FLOAT(Pixel.DepthBias), NO_EXTRA },
|
||||
{ GL_DEPTH_SCALE, CONTEXT_FLOAT(Pixel.DepthScale), NO_EXTRA },
|
||||
{ GL_DOUBLEBUFFER, BUFFER_INT(Visual.doubleBufferMode), NO_EXTRA },
|
||||
{ GL_DRAW_BUFFER, BUFFER_ENUM(ColorDrawBuffer[0]), NO_EXTRA },
|
||||
{ GL_DRAW_BUFFER, BUFFER_ENUM(ColorDrawBuffer), NO_EXTRA },
|
||||
{ GL_EDGE_FLAG, LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA },
|
||||
{ GL_FEEDBACK_BUFFER_SIZE, CONTEXT_INT(Feedback.BufferSize), NO_EXTRA },
|
||||
{ GL_FEEDBACK_BUFFER_TYPE, CONTEXT_ENUM(Feedback.Type), NO_EXTRA },
|
||||
|
@ -1216,10 +1190,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
|
|||
break;
|
||||
|
||||
case GL_COLOR_WRITEMASK:
|
||||
v->value_int_4[0] = ctx->Color.ColorMask[0][RCOMP] ? 1 : 0;
|
||||
v->value_int_4[1] = ctx->Color.ColorMask[0][GCOMP] ? 1 : 0;
|
||||
v->value_int_4[2] = ctx->Color.ColorMask[0][BCOMP] ? 1 : 0;
|
||||
v->value_int_4[3] = ctx->Color.ColorMask[0][ACOMP] ? 1 : 0;
|
||||
v->value_int_4[0] = ctx->Color.ColorMask[RCOMP] ? 1 : 0;
|
||||
v->value_int_4[1] = ctx->Color.ColorMask[GCOMP] ? 1 : 0;
|
||||
v->value_int_4[2] = ctx->Color.ColorMask[BCOMP] ? 1 : 0;
|
||||
v->value_int_4[3] = ctx->Color.ColorMask[ACOMP] ? 1 : 0;
|
||||
break;
|
||||
|
||||
case GL_EDGE_FLAG:
|
||||
|
@ -1505,13 +1479,6 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d
|
|||
case EXTRA_FLUSH_CURRENT:
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
break;
|
||||
case EXTRA_VALID_DRAW_BUFFER:
|
||||
if (d->pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(draw buffer %u)",
|
||||
func, d->pname - GL_DRAW_BUFFER0_ARB);
|
||||
return GL_FALSE;
|
||||
}
|
||||
break;
|
||||
case EXTRA_VALID_TEXTURE_UNIT:
|
||||
if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(texture %u)",
|
||||
|
|
|
@ -367,7 +367,7 @@ typedef enum
|
|||
* any are written, FRAG_RESULT_COLOR will not be written.
|
||||
*/
|
||||
FRAG_RESULT_DATA0 = 3,
|
||||
FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
|
||||
FRAG_RESULT_MAX = (FRAG_RESULT_DATA0)
|
||||
} gl_frag_result;
|
||||
|
||||
|
||||
|
@ -670,9 +670,9 @@ struct gl_colorbuffer_attrib
|
|||
GLuint ClearIndex; /**< Index for glClear */
|
||||
union gl_color_union ClearColor; /**< Color for glClear, unclamped */
|
||||
GLuint IndexMask; /**< Color index write mask */
|
||||
GLubyte ColorMask[MAX_DRAW_BUFFERS][4]; /**< Each flag is 0xff or 0x0 */
|
||||
GLubyte ColorMask[4]; /**< Each flag is 0xff or 0x0 */
|
||||
|
||||
GLenum DrawBuffer[MAX_DRAW_BUFFERS]; /**< Which buffer to draw into */
|
||||
GLenum DrawBuffer; /**< Which buffer to draw into */
|
||||
|
||||
/**
|
||||
* \name alpha testing
|
||||
|
@ -697,19 +697,12 @@ struct gl_colorbuffer_attrib
|
|||
GLfloat BlendColorUnclamped[4]; /**< Blending color */
|
||||
GLfloat BlendColor[4]; /**< Blending color */
|
||||
|
||||
struct
|
||||
{
|
||||
GLenum SrcRGB; /**< RGB blend source term */
|
||||
GLenum DstRGB; /**< RGB blend dest term */
|
||||
GLenum SrcA; /**< Alpha blend source term */
|
||||
GLenum DstA; /**< Alpha blend dest term */
|
||||
GLenum EquationRGB; /**< GL_ADD, GL_SUBTRACT, etc. */
|
||||
GLenum EquationA; /**< GL_ADD, GL_SUBTRACT, etc. */
|
||||
} Blend[MAX_DRAW_BUFFERS];
|
||||
/** Are the blend func terms currently different for each buffer/target? */
|
||||
GLboolean _BlendFuncPerBuffer;
|
||||
/** Are the blend equations currently different for each buffer/target? */
|
||||
GLboolean _BlendEquationPerBuffer;
|
||||
GLenum SrcRGB; /**< RGB blend source term */
|
||||
GLenum DstRGB; /**< RGB blend dest term */
|
||||
GLenum SrcA; /**< Alpha blend source term */
|
||||
GLenum DstA; /**< Alpha blend dest term */
|
||||
GLenum EquationRGB; /**< GL_ADD, GL_SUBTRACT, etc. */
|
||||
GLenum EquationA; /**< GL_ADD, GL_SUBTRACT, etc. */
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
|
@ -2253,14 +2246,13 @@ struct gl_framebuffer
|
|||
/* In unextended OpenGL these vars are part of the GL_COLOR_BUFFER
|
||||
* attribute group and GL_PIXEL attribute group, respectively.
|
||||
*/
|
||||
GLenum ColorDrawBuffer[MAX_DRAW_BUFFERS];
|
||||
GLenum ColorDrawBuffer;
|
||||
GLenum ColorReadBuffer;
|
||||
|
||||
/** Computed from ColorDraw/ReadBuffer above */
|
||||
GLuint _NumColorDrawBuffers;
|
||||
GLint _ColorDrawBufferIndexes[MAX_DRAW_BUFFERS]; /**< BUFFER_x or -1 */
|
||||
GLint _ColorDrawBufferIndex; /**< BUFFER_x or -1 */
|
||||
GLint _ColorReadBufferIndex; /* -1 = None */
|
||||
struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS];
|
||||
struct gl_renderbuffer *_ColorDrawBuffer;
|
||||
struct gl_renderbuffer *_ColorReadBuffer;
|
||||
|
||||
/** Delete this framebuffer */
|
||||
|
@ -2356,8 +2348,6 @@ struct gl_constants
|
|||
/** vertex array / buffer object bounds checking */
|
||||
GLboolean CheckArrayBounds;
|
||||
|
||||
GLuint MaxDrawBuffers; /**< GL_ARB_draw_buffers */
|
||||
|
||||
GLuint MaxColorAttachments; /**< GL_EXT_framebuffer_object */
|
||||
GLuint MaxRenderbufferSize; /**< GL_EXT_framebuffer_object */
|
||||
GLuint MaxSamples; /**< GL_ARB_framebuffer_object */
|
||||
|
@ -2436,8 +2426,6 @@ struct gl_extensions
|
|||
GLboolean dummy_false; /* Set false by _mesa_init_extensions(). */
|
||||
GLboolean ARB_color_buffer_float;
|
||||
GLboolean ARB_conservative_depth;
|
||||
GLboolean ARB_depth_clamp;
|
||||
GLboolean ARB_draw_buffers_blend;
|
||||
GLboolean ARB_fragment_program;
|
||||
GLboolean ARB_fragment_program_shadow;
|
||||
GLboolean ARB_fragment_shader;
|
||||
|
|
|
@ -255,7 +255,7 @@ _mesa_BindFragDataLocation(GLuint program, GLuint colorNumber,
|
|||
return;
|
||||
}
|
||||
|
||||
if (colorNumber >= ctx->Const.MaxDrawBuffers) {
|
||||
if (colorNumber > 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glBindFragDataLocation(index)");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -272,14 +272,6 @@ arb_output_attrib_string(GLint index, GLenum progType)
|
|||
"result.depth", /* FRAG_RESULT_DEPTH */
|
||||
"result.(one)", /* FRAG_RESULT_STENCIL */
|
||||
"result.color", /* FRAG_RESULT_COLOR */
|
||||
"result.color[0]", /* FRAG_RESULT_DATA0 (named for GLSL's gl_FragData) */
|
||||
"result.color[1]",
|
||||
"result.color[2]",
|
||||
"result.color[3]",
|
||||
"result.color[4]",
|
||||
"result.color[5]",
|
||||
"result.color[6]",
|
||||
"result.color[7]" /* MAX_DRAW_BUFFERS = 8 */
|
||||
};
|
||||
|
||||
/* sanity checks */
|
||||
|
|
|
@ -898,7 +898,7 @@ _mesa_valid_register_index(const struct gl_context *ctx,
|
|||
case MESA_SHADER_VERTEX:
|
||||
return index < VERT_RESULT_VAR0 + ctx->Const.MaxVarying;
|
||||
case MESA_SHADER_FRAGMENT:
|
||||
return index < FRAG_RESULT_DATA0 + ctx->Const.MaxDrawBuffers;
|
||||
return index <= FRAG_RESULT_DATA0;
|
||||
default:
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
|
|
@ -75,10 +75,10 @@ blend_noop(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
{
|
||||
GLint bytes;
|
||||
|
||||
ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].SrcRGB == GL_ZERO);
|
||||
ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE);
|
||||
ASSERT(ctx->Color.EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.SrcRGB == GL_ZERO);
|
||||
ASSERT(ctx->Color.DstRGB == GL_ONE);
|
||||
(void) ctx;
|
||||
|
||||
/* just memcpy */
|
||||
|
@ -101,10 +101,10 @@ static void _BLENDAPI
|
|||
blend_replace(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
||||
GLvoid *src, const GLvoid *dst, GLenum chanType)
|
||||
{
|
||||
ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].SrcRGB == GL_ONE);
|
||||
ASSERT(ctx->Color.Blend[0].DstRGB == GL_ZERO);
|
||||
ASSERT(ctx->Color.EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.SrcRGB == GL_ONE);
|
||||
ASSERT(ctx->Color.DstRGB == GL_ZERO);
|
||||
(void) ctx;
|
||||
(void) n;
|
||||
(void) mask;
|
||||
|
@ -125,12 +125,12 @@ blend_transparency_ubyte(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
const GLubyte (*dest)[4] = (const GLubyte (*)[4]) dst;
|
||||
GLuint i;
|
||||
|
||||
ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.SrcRGB == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.SrcA == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.DstRGB == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.DstA == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(chanType == GL_UNSIGNED_BYTE);
|
||||
|
||||
(void) ctx;
|
||||
|
@ -170,12 +170,12 @@ blend_transparency_ushort(struct gl_context *ctx, GLuint n, const GLubyte mask[]
|
|||
const GLushort (*dest)[4] = (const GLushort (*)[4]) dst;
|
||||
GLuint i;
|
||||
|
||||
ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.SrcRGB == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.SrcA == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.DstRGB == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.DstA == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(chanType == GL_UNSIGNED_SHORT);
|
||||
|
||||
(void) ctx;
|
||||
|
@ -208,12 +208,12 @@ blend_transparency_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
const GLfloat (*dest)[4] = (const GLfloat (*)[4]) dst;
|
||||
GLuint i;
|
||||
|
||||
ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.SrcRGB == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.SrcA == GL_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.DstRGB == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(ctx->Color.DstA == GL_ONE_MINUS_SRC_ALPHA);
|
||||
ASSERT(chanType == GL_FLOAT);
|
||||
|
||||
(void) ctx;
|
||||
|
@ -248,10 +248,10 @@ blend_add(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
{
|
||||
GLuint i;
|
||||
|
||||
ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.Blend[0].SrcRGB == GL_ONE);
|
||||
ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE);
|
||||
ASSERT(ctx->Color.EquationRGB == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.EquationA == GL_FUNC_ADD);
|
||||
ASSERT(ctx->Color.SrcRGB == GL_ONE);
|
||||
ASSERT(ctx->Color.DstRGB == GL_ONE);
|
||||
(void) ctx;
|
||||
|
||||
if (chanType == GL_UNSIGNED_BYTE) {
|
||||
|
@ -313,8 +313,8 @@ blend_min(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
GLvoid *src, const GLvoid *dst, GLenum chanType)
|
||||
{
|
||||
GLuint i;
|
||||
ASSERT(ctx->Color.Blend[0].EquationRGB == GL_MIN);
|
||||
ASSERT(ctx->Color.Blend[0].EquationA == GL_MIN);
|
||||
ASSERT(ctx->Color.EquationRGB == GL_MIN);
|
||||
ASSERT(ctx->Color.EquationA == GL_MIN);
|
||||
(void) ctx;
|
||||
|
||||
if (chanType == GL_UNSIGNED_BYTE) {
|
||||
|
@ -366,8 +366,8 @@ blend_max(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
GLvoid *src, const GLvoid *dst, GLenum chanType)
|
||||
{
|
||||
GLuint i;
|
||||
ASSERT(ctx->Color.Blend[0].EquationRGB == GL_MAX);
|
||||
ASSERT(ctx->Color.Blend[0].EquationA == GL_MAX);
|
||||
ASSERT(ctx->Color.EquationRGB == GL_MAX);
|
||||
ASSERT(ctx->Color.EquationA == GL_MAX);
|
||||
(void) ctx;
|
||||
|
||||
if (chanType == GL_UNSIGNED_BYTE) {
|
||||
|
@ -500,7 +500,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
*/
|
||||
|
||||
/* Source RGB factor */
|
||||
switch (ctx->Color.Blend[0].SrcRGB) {
|
||||
switch (ctx->Color.SrcRGB) {
|
||||
case GL_ZERO:
|
||||
sR = sG = sB = 0.0F;
|
||||
break;
|
||||
|
@ -570,7 +570,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
}
|
||||
|
||||
/* Source Alpha factor */
|
||||
switch (ctx->Color.Blend[0].SrcA) {
|
||||
switch (ctx->Color.SrcA) {
|
||||
case GL_ZERO:
|
||||
sA = 0.0F;
|
||||
break;
|
||||
|
@ -624,7 +624,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
}
|
||||
|
||||
/* Dest RGB factor */
|
||||
switch (ctx->Color.Blend[0].DstRGB) {
|
||||
switch (ctx->Color.DstRGB) {
|
||||
case GL_ZERO:
|
||||
dR = dG = dB = 0.0F;
|
||||
break;
|
||||
|
@ -687,7 +687,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
}
|
||||
|
||||
/* Dest Alpha factor */
|
||||
switch (ctx->Color.Blend[0].DstA) {
|
||||
switch (ctx->Color.DstA) {
|
||||
case GL_ZERO:
|
||||
dA = 0.0F;
|
||||
break;
|
||||
|
@ -738,7 +738,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
}
|
||||
|
||||
/* compute the blended RGB */
|
||||
switch (ctx->Color.Blend[0].EquationRGB) {
|
||||
switch (ctx->Color.EquationRGB) {
|
||||
case GL_FUNC_ADD:
|
||||
r = Rs * sR + Rd * dR;
|
||||
g = Gs * sG + Gd * dG;
|
||||
|
@ -775,7 +775,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
}
|
||||
|
||||
/* compute the blended alpha */
|
||||
switch (ctx->Color.Blend[0].EquationA) {
|
||||
switch (ctx->Color.EquationA) {
|
||||
case GL_FUNC_ADD:
|
||||
a = As * sA + Ad * dA;
|
||||
break;
|
||||
|
@ -903,13 +903,13 @@ void
|
|||
_swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType)
|
||||
{
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
const GLenum eq = ctx->Color.Blend[0].EquationRGB;
|
||||
const GLenum srcRGB = ctx->Color.Blend[0].SrcRGB;
|
||||
const GLenum dstRGB = ctx->Color.Blend[0].DstRGB;
|
||||
const GLenum srcA = ctx->Color.Blend[0].SrcA;
|
||||
const GLenum dstA = ctx->Color.Blend[0].DstA;
|
||||
const GLenum eq = ctx->Color.EquationRGB;
|
||||
const GLenum srcRGB = ctx->Color.SrcRGB;
|
||||
const GLenum dstRGB = ctx->Color.DstRGB;
|
||||
const GLenum srcA = ctx->Color.SrcA;
|
||||
const GLenum dstA = ctx->Color.DstA;
|
||||
|
||||
if (ctx->Color.Blend[0].EquationRGB != ctx->Color.Blend[0].EquationA) {
|
||||
if (ctx->Color.EquationRGB != ctx->Color.EquationA) {
|
||||
swrast->BlendFunc = blend_general;
|
||||
}
|
||||
else if (eq == GL_MIN) {
|
||||
|
|
|
@ -146,7 +146,7 @@ blit_nearest(struct gl_context *ctx,
|
|||
switch (buffer) {
|
||||
case GL_COLOR_BUFFER_BIT:
|
||||
readRb = ctx->ReadBuffer->_ColorReadBuffer;
|
||||
drawRb = ctx->DrawBuffer->_ColorDrawBuffers[0];
|
||||
drawRb = ctx->DrawBuffer->_ColorDrawBuffer;
|
||||
|
||||
if (readRb->Format == drawRb->Format) {
|
||||
mode = DIRECT;
|
||||
|
@ -471,7 +471,7 @@ blit_linear(struct gl_context *ctx,
|
|||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1)
|
||||
{
|
||||
struct gl_renderbuffer *readRb = ctx->ReadBuffer->_ColorReadBuffer;
|
||||
struct gl_renderbuffer *drawRb = ctx->DrawBuffer->_ColorDrawBuffers[0];
|
||||
struct gl_renderbuffer *drawRb = ctx->DrawBuffer->_ColorDrawBuffer;
|
||||
|
||||
const GLint srcWidth = ABS(srcX1 - srcX0);
|
||||
const GLint dstWidth = ABS(dstX1 - dstX0);
|
||||
|
|
|
@ -174,20 +174,9 @@ clear_rgba_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||
static void
|
||||
clear_color_buffers(struct gl_context *ctx)
|
||||
{
|
||||
GLuint buf;
|
||||
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffer;
|
||||
|
||||
for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) {
|
||||
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[buf];
|
||||
|
||||
/* If this is an ES2 context or GL_ARB_ES2_compatibility is supported,
|
||||
* the framebuffer can be complete with some attachments be missing. In
|
||||
* this case the _ColorDrawBuffers pointer will be NULL.
|
||||
*/
|
||||
if (rb == NULL)
|
||||
continue;
|
||||
|
||||
clear_rgba_buffer(ctx, rb, ctx->Color.ColorMask[buf]);
|
||||
}
|
||||
clear_rgba_buffer(ctx, rb, ctx->Color.ColorMask);
|
||||
}
|
||||
|
||||
|
||||
|
@ -219,8 +208,7 @@ _swrast_Clear(struct gl_context *ctx, GLbitfield buffers)
|
|||
if (SWRAST_CONTEXT(ctx)->NewState)
|
||||
_swrast_validate_derived(ctx);
|
||||
|
||||
if ((buffers & BUFFER_BITS_COLOR)
|
||||
&& (ctx->DrawBuffer->_NumColorDrawBuffers > 0)) {
|
||||
if (buffers & BUFFER_BITS_COLOR) {
|
||||
clear_color_buffers(ctx);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ _swrast_update_rasterflags( struct gl_context *ctx )
|
|||
{
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
GLbitfield rasterMask = 0;
|
||||
GLuint i;
|
||||
|
||||
if (ctx->Color.AlphaEnabled) rasterMask |= ALPHATEST_BIT;
|
||||
if (ctx->Color.BlendEnabled) rasterMask |= BLEND_BIT;
|
||||
|
@ -63,15 +62,13 @@ _swrast_update_rasterflags( struct gl_context *ctx )
|
|||
if (swrast->_FogEnabled) rasterMask |= FOG_BIT;
|
||||
if (ctx->Scissor.Enabled) rasterMask |= CLIP_BIT;
|
||||
if (ctx->Stencil._Enabled) rasterMask |= STENCIL_BIT;
|
||||
for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
|
||||
if (!ctx->Color.ColorMask[i][0] ||
|
||||
!ctx->Color.ColorMask[i][1] ||
|
||||
!ctx->Color.ColorMask[i][2] ||
|
||||
!ctx->Color.ColorMask[i][3]) {
|
||||
rasterMask |= MASKING_BIT;
|
||||
break;
|
||||
}
|
||||
if (!ctx->Color.ColorMask[0] ||
|
||||
!ctx->Color.ColorMask[1] ||
|
||||
!ctx->Color.ColorMask[2] ||
|
||||
!ctx->Color.ColorMask[3]) {
|
||||
rasterMask |= MASKING_BIT;
|
||||
}
|
||||
|
||||
if (ctx->Color.ColorLogicOpEnabled) rasterMask |= LOGIC_OP_BIT;
|
||||
if (ctx->Texture._EnabledUnits) rasterMask |= TEXTURE_BIT;
|
||||
if ( ctx->Viewport.X < 0
|
||||
|
@ -81,24 +78,11 @@ _swrast_update_rasterflags( struct gl_context *ctx )
|
|||
rasterMask |= CLIP_BIT;
|
||||
}
|
||||
|
||||
|
||||
/* If we're not drawing to exactly one color buffer set the
|
||||
* MULTI_DRAW_BIT flag. Also set it if we're drawing to no
|
||||
* buffers or the RGBA or CI mask disables all writes.
|
||||
*/
|
||||
if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) {
|
||||
/* more than one color buffer designated for writing (or zero buffers) */
|
||||
rasterMask |= MULTI_DRAW_BIT;
|
||||
}
|
||||
|
||||
for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
|
||||
if (ctx->Color.ColorMask[i][0] +
|
||||
ctx->Color.ColorMask[i][1] +
|
||||
ctx->Color.ColorMask[i][2] +
|
||||
ctx->Color.ColorMask[i][3] == 0) {
|
||||
rasterMask |= MULTI_DRAW_BIT; /* all RGBA channels disabled */
|
||||
break;
|
||||
}
|
||||
if (ctx->Color.ColorMask[0] +
|
||||
ctx->Color.ColorMask[1] +
|
||||
ctx->Color.ColorMask[2] +
|
||||
ctx->Color.ColorMask[3] == 0) {
|
||||
rasterMask |= MULTI_DRAW_BIT; /* all RGBA channels disabled */
|
||||
}
|
||||
|
||||
#if CHAN_TYPE == GL_FLOAT
|
||||
|
|
|
@ -438,10 +438,8 @@ swrast_fast_copy_pixels(struct gl_context *ctx,
|
|||
GLint srcRowStride, dstRowStride;
|
||||
|
||||
if (type == GL_COLOR) {
|
||||
if (dstFb->_NumColorDrawBuffers != 1)
|
||||
return GL_FALSE;
|
||||
srcRb = srcFb->_ColorReadBuffer;
|
||||
dstRb = dstFb->_ColorDrawBuffers[0];
|
||||
dstRb = dstFb->_ColorDrawBuffer;
|
||||
}
|
||||
else if (type == GL_STENCIL) {
|
||||
srcRb = srcFb->Attachment[BUFFER_STENCIL].Renderbuffer;
|
||||
|
|
|
@ -194,15 +194,14 @@ fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y,
|
|||
const struct gl_pixelstore_attrib *userUnpack,
|
||||
const GLvoid *pixels)
|
||||
{
|
||||
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
|
||||
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffer;
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
struct gl_pixelstore_attrib unpack;
|
||||
|
||||
if (!rb)
|
||||
return GL_TRUE; /* no-op */
|
||||
|
||||
if (ctx->DrawBuffer->_NumColorDrawBuffers > 1 ||
|
||||
(swrast->_RasterMask & ~CLIP_BIT) ||
|
||||
if ((swrast->_RasterMask & ~CLIP_BIT) ||
|
||||
ctx->Texture._EnabledCoordUnits ||
|
||||
userUnpack->SwapBytes ||
|
||||
ctx->Pixel.ZoomX != 1.0f ||
|
||||
|
@ -428,14 +427,10 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
|
|||
span.arrayMask = SPAN_RGBA;
|
||||
span.arrayAttribs = FRAG_BIT_COL0; /* we're fill in COL0 attrib values */
|
||||
|
||||
if (ctx->DrawBuffer->_NumColorDrawBuffers > 0) {
|
||||
GLenum datatype = _mesa_get_format_datatype(
|
||||
ctx->DrawBuffer->_ColorDrawBuffers[0]->Format);
|
||||
if (datatype != GL_FLOAT &&
|
||||
ctx->Color.ClampFragmentColor != GL_FALSE) {
|
||||
/* need to clamp colors before applying fragment ops */
|
||||
transferOps |= IMAGE_CLAMP_BIT;
|
||||
}
|
||||
if (_mesa_get_format_datatype(ctx->DrawBuffer->_ColorDrawBuffer->Format) != GL_FLOAT &&
|
||||
ctx->Color.ClampFragmentColor != GL_FALSE) {
|
||||
/* need to clamp colors before applying fragment ops */
|
||||
transferOps |= IMAGE_CLAMP_BIT;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
void
|
||||
_swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
||||
SWspan *span, GLuint buf)
|
||||
SWspan *span)
|
||||
{
|
||||
const GLuint n = span->end;
|
||||
void *rbPixels;
|
||||
|
@ -57,7 +57,7 @@ _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||
*/
|
||||
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
|
||||
/* treat 4xGLubyte as 1xGLuint */
|
||||
const GLuint srcMask = *((GLuint *) ctx->Color.ColorMask[buf]);
|
||||
const GLuint srcMask = *((GLuint *) ctx->Color.ColorMask);
|
||||
const GLuint dstMask = ~srcMask;
|
||||
const GLuint *dst = (const GLuint *) rbPixels;
|
||||
GLuint *src = (GLuint *) span->array->rgba8;
|
||||
|
@ -69,10 +69,10 @@ _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||
else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
|
||||
/* 2-byte components */
|
||||
/* XXX try to use 64-bit arithmetic someday */
|
||||
const GLushort rMask = ctx->Color.ColorMask[buf][RCOMP] ? 0xffff : 0x0;
|
||||
const GLushort gMask = ctx->Color.ColorMask[buf][GCOMP] ? 0xffff : 0x0;
|
||||
const GLushort bMask = ctx->Color.ColorMask[buf][BCOMP] ? 0xffff : 0x0;
|
||||
const GLushort aMask = ctx->Color.ColorMask[buf][ACOMP] ? 0xffff : 0x0;
|
||||
const GLushort rMask = ctx->Color.ColorMask[RCOMP] ? 0xffff : 0x0;
|
||||
const GLushort gMask = ctx->Color.ColorMask[GCOMP] ? 0xffff : 0x0;
|
||||
const GLushort bMask = ctx->Color.ColorMask[BCOMP] ? 0xffff : 0x0;
|
||||
const GLushort aMask = ctx->Color.ColorMask[ACOMP] ? 0xffff : 0x0;
|
||||
const GLushort (*dst)[4] = (const GLushort (*)[4]) rbPixels;
|
||||
GLushort (*src)[4] = span->array->rgba16;
|
||||
GLuint i;
|
||||
|
@ -85,10 +85,10 @@ _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||
}
|
||||
else {
|
||||
/* 4-byte components */
|
||||
const GLuint rMask = ctx->Color.ColorMask[buf][RCOMP] ? ~0x0 : 0x0;
|
||||
const GLuint gMask = ctx->Color.ColorMask[buf][GCOMP] ? ~0x0 : 0x0;
|
||||
const GLuint bMask = ctx->Color.ColorMask[buf][BCOMP] ? ~0x0 : 0x0;
|
||||
const GLuint aMask = ctx->Color.ColorMask[buf][ACOMP] ? ~0x0 : 0x0;
|
||||
const GLuint rMask = ctx->Color.ColorMask[RCOMP] ? ~0x0 : 0x0;
|
||||
const GLuint gMask = ctx->Color.ColorMask[GCOMP] ? ~0x0 : 0x0;
|
||||
const GLuint bMask = ctx->Color.ColorMask[BCOMP] ? ~0x0 : 0x0;
|
||||
const GLuint aMask = ctx->Color.ColorMask[ACOMP] ? ~0x0 : 0x0;
|
||||
const GLuint (*dst)[4] = (const GLuint (*)[4]) rbPixels;
|
||||
GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLuint i;
|
||||
|
|
|
@ -36,6 +36,6 @@ struct gl_renderbuffer;
|
|||
|
||||
extern void
|
||||
_swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
||||
SWspan *span, GLuint buf);
|
||||
SWspan *span);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -592,7 +592,6 @@ _swrast_map_renderbuffers(struct gl_context *ctx)
|
|||
{
|
||||
struct gl_framebuffer *fb = ctx->DrawBuffer;
|
||||
struct gl_renderbuffer *depthRb, *stencilRb;
|
||||
GLuint buf;
|
||||
|
||||
depthRb = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
|
||||
if (depthRb) {
|
||||
|
@ -606,10 +605,8 @@ _swrast_map_renderbuffers(struct gl_context *ctx)
|
|||
map_attachment(ctx, fb, BUFFER_STENCIL);
|
||||
}
|
||||
|
||||
for (buf = 0; buf < fb->_NumColorDrawBuffers; buf++) {
|
||||
map_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
|
||||
find_renderbuffer_colortype(fb->_ColorDrawBuffers[buf]);
|
||||
}
|
||||
map_attachment(ctx, fb, fb->_ColorDrawBufferIndex);
|
||||
find_renderbuffer_colortype(fb->_ColorDrawBuffer);
|
||||
}
|
||||
|
||||
|
||||
|
@ -621,7 +618,6 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx)
|
|||
{
|
||||
struct gl_framebuffer *fb = ctx->DrawBuffer;
|
||||
struct gl_renderbuffer *depthRb, *stencilRb;
|
||||
GLuint buf;
|
||||
|
||||
depthRb = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
|
||||
if (depthRb) {
|
||||
|
@ -635,7 +631,5 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx)
|
|||
unmap_attachment(ctx, fb, BUFFER_STENCIL);
|
||||
}
|
||||
|
||||
for (buf = 0; buf < fb->_NumColorDrawBuffers; buf++) {
|
||||
unmap_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
|
||||
}
|
||||
unmap_attachment(ctx, fb, fb->_ColorDrawBufferIndex);
|
||||
}
|
||||
|
|
|
@ -1042,7 +1042,7 @@ void
|
|||
_swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
|
||||
{
|
||||
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
const GLuint *colorMask = (GLuint *) ctx->Color.ColorMask;
|
||||
const GLuint colorMask = *((GLuint *)ctx->Color.ColorMask);
|
||||
const GLbitfield origInterpMask = span->interpMask;
|
||||
const GLbitfield origArrayMask = span->arrayMask;
|
||||
const GLbitfield64 origArrayAttribs = span->arrayAttribs;
|
||||
|
@ -1147,7 +1147,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
|
|||
/* We had to wait until now to check for glColorMask(0,0,0,0) because of
|
||||
* the occlusion test.
|
||||
*/
|
||||
if (fb->_NumColorDrawBuffers == 1 && colorMask[0] == 0x0) {
|
||||
if (colorMask == 0) {
|
||||
/* no colors to write */
|
||||
goto end;
|
||||
}
|
||||
|
@ -1205,83 +1205,65 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
|
|||
* multiFragOutputs=TRUE for the later case.
|
||||
*/
|
||||
{
|
||||
const GLuint numBuffers = fb->_NumColorDrawBuffers;
|
||||
GLuint buf;
|
||||
struct gl_renderbuffer *rb = fb->_ColorDrawBuffer;
|
||||
|
||||
for (buf = 0; buf < numBuffers; buf++) {
|
||||
struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[buf];
|
||||
/* color[fragOutput] will be written to buffer */
|
||||
|
||||
/* color[fragOutput] will be written to buffer[buf] */
|
||||
if (rb) {
|
||||
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
|
||||
GLenum colorType = srb->ColorType;
|
||||
|
||||
if (rb) {
|
||||
GLchan rgbaSave[MAX_WIDTH][4];
|
||||
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
|
||||
GLenum colorType = srb->ColorType;
|
||||
assert(colorType == GL_UNSIGNED_BYTE ||
|
||||
colorType == GL_FLOAT);
|
||||
|
||||
assert(colorType == GL_UNSIGNED_BYTE ||
|
||||
colorType == GL_FLOAT);
|
||||
|
||||
/* set span->array->rgba to colors for renderbuffer's datatype */
|
||||
if (span->array->ChanType != colorType) {
|
||||
convert_color_type(span, colorType, 0);
|
||||
/* set span->array->rgba to colors for renderbuffer's datatype */
|
||||
if (span->array->ChanType != colorType) {
|
||||
convert_color_type(span, colorType, 0);
|
||||
}
|
||||
else {
|
||||
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
|
||||
span->array->rgba = span->array->rgba8;
|
||||
}
|
||||
else {
|
||||
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
|
||||
span->array->rgba = span->array->rgba8;
|
||||
}
|
||||
else {
|
||||
span->array->rgba = (void *)
|
||||
span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
}
|
||||
span->array->rgba = (void *)span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
}
|
||||
}
|
||||
|
||||
if (numBuffers > 1) {
|
||||
/* save colors for second, third renderbuffer writes */
|
||||
memcpy(rgbaSave, span->array->rgba,
|
||||
4 * span->end * sizeof(GLchan));
|
||||
}
|
||||
|
||||
ASSERT(rb->_BaseFormat == GL_RGBA ||
|
||||
rb->_BaseFormat == GL_RGB ||
|
||||
rb->_BaseFormat == GL_RED ||
|
||||
rb->_BaseFormat == GL_RG ||
|
||||
rb->_BaseFormat == GL_ALPHA);
|
||||
ASSERT(rb->_BaseFormat == GL_RGBA ||
|
||||
rb->_BaseFormat == GL_RGB ||
|
||||
rb->_BaseFormat == GL_RED ||
|
||||
rb->_BaseFormat == GL_RG ||
|
||||
rb->_BaseFormat == GL_ALPHA);
|
||||
|
||||
if (ctx->Color.ColorLogicOpEnabled) {
|
||||
_swrast_logicop_rgba_span(ctx, rb, span);
|
||||
}
|
||||
else if ((ctx->Color.BlendEnabled >> buf) & 1) {
|
||||
_swrast_blend_span(ctx, rb, span);
|
||||
}
|
||||
if (ctx->Color.ColorLogicOpEnabled) {
|
||||
_swrast_logicop_rgba_span(ctx, rb, span);
|
||||
}
|
||||
else if (ctx->Color.BlendEnabled) {
|
||||
_swrast_blend_span(ctx, rb, span);
|
||||
}
|
||||
|
||||
if (colorMask[buf] != 0xffffffff) {
|
||||
_swrast_mask_rgba_span(ctx, rb, span, buf);
|
||||
}
|
||||
if (colorMask != 0xffffffff) {
|
||||
_swrast_mask_rgba_span(ctx, rb, span);
|
||||
}
|
||||
|
||||
if (span->arrayMask & SPAN_XY) {
|
||||
/* array of pixel coords */
|
||||
put_values(ctx, rb,
|
||||
span->array->ChanType, span->end,
|
||||
span->array->x, span->array->y,
|
||||
span->array->rgba, span->array->mask);
|
||||
}
|
||||
else {
|
||||
/* horizontal run of pixels */
|
||||
_swrast_put_row(ctx, rb,
|
||||
span->array->ChanType,
|
||||
span->end, span->x, span->y,
|
||||
span->array->rgba,
|
||||
span->writeAll ? NULL: span->array->mask);
|
||||
}
|
||||
if (span->arrayMask & SPAN_XY) {
|
||||
/* array of pixel coords */
|
||||
put_values(ctx, rb,
|
||||
span->array->ChanType, span->end,
|
||||
span->array->x, span->array->y,
|
||||
span->array->rgba, span->array->mask);
|
||||
}
|
||||
else {
|
||||
/* horizontal run of pixels */
|
||||
_swrast_put_row(ctx, rb,
|
||||
span->array->ChanType,
|
||||
span->end, span->x, span->y,
|
||||
span->array->rgba,
|
||||
span->writeAll ? NULL: span->array->mask);
|
||||
}
|
||||
|
||||
if (numBuffers > 1) {
|
||||
/* restore original span values */
|
||||
memcpy(span->array->rgba, rgbaSave,
|
||||
4 * span->end * sizeof(GLchan));
|
||||
}
|
||||
|
||||
} /* if rb */
|
||||
} /* for buf */
|
||||
} /* if rb */
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
|
@ -122,7 +122,7 @@ _swrast_culltriangle( struct gl_context *ctx,
|
|||
#define T_SCALE theight
|
||||
|
||||
#define SETUP_CODE \
|
||||
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \
|
||||
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffer; \
|
||||
const struct gl_texture_object *obj = \
|
||||
ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
|
||||
const struct gl_texture_image *texImg = \
|
||||
|
@ -180,7 +180,7 @@ _swrast_culltriangle( struct gl_context *ctx,
|
|||
#define T_SCALE theight
|
||||
|
||||
#define SETUP_CODE \
|
||||
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \
|
||||
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffer; \
|
||||
const struct gl_texture_object *obj = \
|
||||
ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
|
||||
const struct gl_texture_image *texImg = \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue