#include <stdio.h>
#include "glheader.h"
-#include "imports.h"
+
#include "blend.h"
#include "buffers.h"
#include "context.h"
#include "texobj.h"
#include "glformats.h"
#include "state.h"
+#include "util/u_memory.h"
fb->_AllColorBuffersFixedPoint = !visual->floatMode;
fb->_HasSNormOrFloatColorBuffer = visual->floatMode;
fb->_HasAttachments = true;
+ fb->FlipY = true;
+
+ fb->SampleLocationTable = NULL;
+ fb->ProgrammableSampleLocations = 0;
+ fb->SampleLocationPixelGrid = 0;
compute_depth_max(fb);
}
fb->_ColorDrawBufferIndexes[0] = BUFFER_COLOR0;
fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT;
fb->_ColorReadBufferIndex = BUFFER_COLOR0;
+ fb->SampleLocationTable = NULL;
+ fb->ProgrammableSampleLocations = 0;
+ fb->SampleLocationPixelGrid = 0;
fb->Delete = _mesa_destroy_framebuffer;
simple_mtx_init(&fb->Mutex, mtx_plain);
}
assert(!att->Texture);
att->Type = GL_NONE;
}
+
+ free(fb->SampleLocationTable);
+ fb->SampleLocationTable = NULL;
}
struct gl_framebuffer *fb)
{
memset(&fb->Visual, 0, sizeof(fb->Visual));
- fb->Visual.rgbMode = GL_TRUE; /* assume this */
/* find first RGB renderbuffer */
for (unsigned i = 0; i < BUFFER_COUNT; i++) {
fb->Visual.alphaBits = _mesa_get_format_bits(fmt, GL_ALPHA_BITS);
fb->Visual.rgbBits = fb->Visual.redBits
+ fb->Visual.greenBits + fb->Visual.blueBits;
- if (_mesa_get_format_color_encoding(fmt) == GL_SRGB)
- fb->Visual.sRGBCapable = ctx->Extensions.EXT_framebuffer_sRGB;
+ if (_mesa_is_format_srgb(fmt))
+ fb->Visual.sRGBCapable = ctx->Extensions.EXT_sRGB;
break;
}
}
const struct gl_renderbuffer *rb =
fb->Attachment[BUFFER_DEPTH].Renderbuffer;
const mesa_format fmt = rb->Format;
- fb->Visual.haveDepthBuffer = GL_TRUE;
fb->Visual.depthBits = _mesa_get_format_bits(fmt, GL_DEPTH_BITS);
}
const struct gl_renderbuffer *rb =
fb->Attachment[BUFFER_STENCIL].Renderbuffer;
const mesa_format fmt = rb->Format;
- fb->Visual.haveStencilBuffer = GL_TRUE;
fb->Visual.stencilBits = _mesa_get_format_bits(fmt, GL_STENCIL_BITS);
}
const struct gl_renderbuffer *rb =
fb->Attachment[BUFFER_ACCUM].Renderbuffer;
const mesa_format fmt = rb->Format;
- fb->Visual.haveAccumBuffer = GL_TRUE;
fb->Visual.accumRedBits = _mesa_get_format_bits(fmt, GL_RED_BITS);
fb->Visual.accumGreenBits = _mesa_get_format_bits(fmt, GL_GREEN_BITS);
fb->Visual.accumBlueBits = _mesa_get_format_bits(fmt, GL_BLUE_BITS);
}
compute_depth_max(fb);
+ _mesa_update_allow_draw_out_of_order(ctx);
}
}
else {
const mesa_format format = fb->_ColorReadBuffer->Format;
- const GLenum data_type = _mesa_get_format_datatype(format);
- if (format == MESA_FORMAT_B8G8R8A8_UNORM)
+ switch (format) {
+ case MESA_FORMAT_RGBA_UINT8:
+ return GL_RGBA_INTEGER;
+ case MESA_FORMAT_B8G8R8A8_UNORM:
return GL_BGRA;
- else if (format == MESA_FORMAT_B5G6R5_UNORM)
+ case MESA_FORMAT_B5G6R5_UNORM:
+ case MESA_FORMAT_R11G11B10_FLOAT:
return GL_RGB;
- else if (format == MESA_FORMAT_R_UNORM8)
+ case MESA_FORMAT_RG_FLOAT32:
+ case MESA_FORMAT_RG_FLOAT16:
+ case MESA_FORMAT_RG_UNORM8:
+ return GL_RG;
+ case MESA_FORMAT_RG_SINT32:
+ case MESA_FORMAT_RG_UINT32:
+ case MESA_FORMAT_RG_SINT16:
+ case MESA_FORMAT_RG_UINT16:
+ case MESA_FORMAT_RG_SINT8:
+ case MESA_FORMAT_RG_UINT8:
+ return GL_RG_INTEGER;
+ case MESA_FORMAT_R_FLOAT32:
+ case MESA_FORMAT_R_FLOAT16:
+ case MESA_FORMAT_R_UNORM16:
+ case MESA_FORMAT_R_UNORM8:
+ case MESA_FORMAT_R_SNORM16:
+ case MESA_FORMAT_R_SNORM8:
return GL_RED;
+ case MESA_FORMAT_R_SINT32:
+ case MESA_FORMAT_R_UINT32:
+ case MESA_FORMAT_R_SINT16:
+ case MESA_FORMAT_R_UINT16:
+ case MESA_FORMAT_R_SINT8:
+ case MESA_FORMAT_R_UINT8:
+ return GL_RED_INTEGER;
+ default:
+ break;
+ }
- switch (data_type) {
- case GL_UNSIGNED_INT:
- case GL_INT:
+ if (_mesa_is_format_integer(format))
return GL_RGBA_INTEGER;
- default:
+ else
return GL_RGBA;
- }
}
}
return GL_NONE;
}
else {
- const GLenum format = fb->_ColorReadBuffer->Format;
- const GLenum data_type = _mesa_get_format_datatype(format);
-
- if (format == MESA_FORMAT_B5G6R5_UNORM)
- return GL_UNSIGNED_SHORT_5_6_5;
-
- if (format == MESA_FORMAT_B10G10R10A2_UNORM ||
- format == MESA_FORMAT_B10G10R10X2_UNORM ||
- format == MESA_FORMAT_R10G10B10A2_UNORM ||
- format == MESA_FORMAT_R10G10B10X2_UNORM)
- return GL_UNSIGNED_INT_2_10_10_10_REV;
-
- switch (data_type) {
- case GL_SIGNED_NORMALIZED:
- return GL_BYTE;
- case GL_UNSIGNED_INT:
- case GL_INT:
- case GL_FLOAT:
- return data_type;
- case GL_UNSIGNED_NORMALIZED:
- default:
- return GL_UNSIGNED_BYTE;
- }
+ const mesa_format format = fb->_ColorReadBuffer->Format;
+ GLenum data_type;
+ GLuint comps;
+
+ _mesa_uncompressed_format_to_type_and_comps(format, &data_type, &comps);
+
+ return data_type;
}
}