aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/drivers')
-rw-r--r--mesalib/src/mesa/drivers/common/driverfuncs.c4
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c251
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c44
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.h4
-rw-r--r--mesalib/src/mesa/drivers/dri/common/utils.c26
-rw-r--r--mesalib/src/mesa/drivers/dri/common/utils.h2
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c30
-rw-r--r--mesalib/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp10
8 files changed, 211 insertions, 160 deletions
diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c
index 6d56838cd..6ece5d80e 100644
--- a/mesalib/src/mesa/drivers/common/driverfuncs.c
+++ b/mesalib/src/mesa/drivers/common/driverfuncs.c
@@ -180,8 +180,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
_mesa_init_texture_barrier_functions(driver);
/* APPLE_vertex_array_object */
- driver->NewArrayObject = _mesa_new_array_object;
- driver->DeleteArrayObject = _mesa_delete_array_object;
+ driver->NewArrayObject = _mesa_new_vao;
+ driver->DeleteArrayObject = _mesa_delete_vao;
driver->BindArrayObject = NULL;
_mesa_init_shader_object_functions(driver);
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 2443a7723..f12bcaab1 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -164,7 +164,7 @@ struct save_state
GLuint EnvMode; /* unit[0] only */
/** MESA_META_VERTEX */
- struct gl_array_object *ArrayObj;
+ struct gl_vertex_array_object *VAO;
struct gl_buffer_object *ArrayBufferObj;
/** MESA_META_VIEWPORT */
@@ -221,7 +221,7 @@ struct temp_texture
*/
struct blit_state
{
- GLuint ArrayObj;
+ GLuint VAO;
GLuint VBO;
GLuint DepthFP;
GLuint ShaderProg;
@@ -235,7 +235,7 @@ struct blit_state
*/
struct clear_state
{
- GLuint ArrayObj;
+ GLuint VAO;
GLuint VBO;
GLuint ShaderProg;
GLint ColorLocation;
@@ -252,7 +252,7 @@ struct clear_state
*/
struct copypix_state
{
- GLuint ArrayObj;
+ GLuint VAO;
GLuint VBO;
};
@@ -262,7 +262,7 @@ struct copypix_state
*/
struct drawpix_state
{
- GLuint ArrayObj;
+ GLuint VAO;
GLuint StencilFP; /**< Fragment program for drawing stencil images */
GLuint DepthFP; /**< Fragment program for drawing depth images */
@@ -274,7 +274,7 @@ struct drawpix_state
*/
struct bitmap_state
{
- GLuint ArrayObj;
+ GLuint VAO;
GLuint VBO;
struct temp_texture Tex; /**< separate texture from other meta ops */
};
@@ -295,7 +295,7 @@ struct glsl_sampler {
*/
struct gen_mipmap_state
{
- GLuint ArrayObj;
+ GLuint VAO;
GLuint VBO;
GLuint FBO;
GLuint Sampler;
@@ -313,7 +313,7 @@ struct gen_mipmap_state
*/
struct decompress_state
{
- GLuint ArrayObj;
+ GLuint VAO;
GLuint VBO, FBO, RBO, Sampler;
GLint Width, Height;
};
@@ -323,7 +323,7 @@ struct decompress_state
*/
struct drawtex_state
{
- GLuint ArrayObj;
+ GLuint VAO;
GLuint VBO;
};
@@ -350,11 +350,12 @@ struct gl_meta_state
struct drawtex_state DrawTex; /**< For _mesa_meta_DrawTex() */
};
-static void meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit);
-static void cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex);
-static void meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear);
-static void meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
- struct gen_mipmap_state *mipmap);
+static void meta_glsl_blit_cleanup(struct blit_state *blit);
+static void cleanup_temp_texture(struct temp_texture *tex);
+static void meta_glsl_clear_cleanup(struct clear_state *clear);
+static void meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap);
+static void meta_decompress_cleanup(struct decompress_state *decompress);
+static void meta_drawpix_cleanup(struct drawpix_state *drawpix);
static GLuint
compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source)
@@ -445,10 +446,12 @@ _mesa_meta_free(struct gl_context *ctx)
{
GET_CURRENT_CONTEXT(old_context);
_mesa_make_current(ctx, NULL, NULL);
- meta_glsl_blit_cleanup(ctx, &ctx->Meta->Blit);
- meta_glsl_clear_cleanup(ctx, &ctx->Meta->Clear);
- meta_glsl_generate_mipmap_cleanup(ctx, &ctx->Meta->Mipmap);
- cleanup_temp_texture(ctx, &ctx->Meta->TempTex);
+ meta_glsl_blit_cleanup(&ctx->Meta->Blit);
+ meta_glsl_clear_cleanup(&ctx->Meta->Clear);
+ meta_glsl_generate_mipmap_cleanup(&ctx->Meta->Mipmap);
+ cleanup_temp_texture(&ctx->Meta->TempTex);
+ meta_decompress_cleanup(&ctx->Meta->Decompress);
+ meta_drawpix_cleanup(&ctx->Meta->DrawPix);
if (old_context)
_mesa_make_current(old_context, old_context->WinSysDrawBuffer, old_context->WinSysReadBuffer);
else
@@ -726,8 +729,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
if (state & MESA_META_VERTEX) {
/* save vertex array object state */
- _mesa_reference_array_object(ctx, &save->ArrayObj,
- ctx->Array.ArrayObj);
+ _mesa_reference_vao(ctx, &save->VAO,
+ ctx->Array.VAO);
_mesa_reference_buffer_object(ctx, &save->ArrayBufferObj,
ctx->Array.ArrayBufferObj);
/* set some default state? */
@@ -1092,8 +1095,8 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, NULL);
/* restore vertex array object */
- _mesa_BindVertexArray(save->ArrayObj->Name);
- _mesa_reference_array_object(ctx, &save->ArrayObj, NULL);
+ _mesa_BindVertexArray(save->VAO->Name);
+ _mesa_reference_vao(ctx, &save->VAO, NULL);
}
if (state & MESA_META_VIEWPORT) {
@@ -1208,7 +1211,7 @@ init_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
}
static void
-cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
+cleanup_temp_texture(struct temp_texture *tex)
{
if (!tex->TexObj)
return;
@@ -1453,20 +1456,19 @@ init_blit_depth_pixels(struct gl_context *ctx)
}
static void
-setup_ff_blit_framebuffer(struct gl_context *ctx,
- struct blit_state *blit)
+setup_ff_blit_framebuffer(struct blit_state *blit)
{
struct vertex {
GLfloat x, y, s, t;
};
struct vertex verts[4];
- if (blit->ArrayObj == 0) {
+ if (blit->VAO == 0) {
/* one-time setup */
/* create vertex array object */
- _mesa_GenVertexArrays(1, &blit->ArrayObj);
- _mesa_BindVertexArray(blit->ArrayObj);
+ _mesa_GenVertexArrays(1, &blit->VAO);
+ _mesa_BindVertexArray(blit->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &blit->VBO);
@@ -1508,11 +1510,11 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
assert(_mesa_is_desktop_gl(ctx) || texture_2d);
/* Check if already initialized */
- if (blit->ArrayObj == 0) {
+ if (blit->VAO == 0) {
/* create vertex array object */
- _mesa_GenVertexArrays(1, &blit->ArrayObj);
- _mesa_BindVertexArray(blit->ArrayObj);
+ _mesa_GenVertexArrays(1, &blit->VAO);
+ _mesa_BindVertexArray(blit->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &blit->VBO);
@@ -1682,10 +1684,10 @@ blitframebuffer_texture(struct gl_context *ctx,
_mesa_UseProgram(blit->RectShaderProg);
}
else {
- setup_ff_blit_framebuffer(ctx, &ctx->Meta->Blit);
+ setup_ff_blit_framebuffer(&ctx->Meta->Blit);
}
- _mesa_BindVertexArray(blit->ArrayObj);
+ _mesa_BindVertexArray(blit->VAO);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, blit->VBO);
_mesa_GenSamplers(1, &sampler);
@@ -1867,10 +1869,10 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
_mesa_UseProgram(blit->RectShaderProg);
}
else {
- setup_ff_blit_framebuffer(ctx, blit);
+ setup_ff_blit_framebuffer(blit);
}
- _mesa_BindVertexArray(blit->ArrayObj);
+ _mesa_BindVertexArray(blit->VAO);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, blit->VBO);
/* Continue with "normal" approach which involves copying the src rect
@@ -1998,11 +2000,11 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
}
static void
-meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit)
+meta_glsl_blit_cleanup(struct blit_state *blit)
{
- if (blit->ArrayObj) {
- _mesa_DeleteVertexArrays(1, &blit->ArrayObj);
- blit->ArrayObj = 0;
+ if (blit->VAO) {
+ _mesa_DeleteVertexArrays(1, &blit->VAO);
+ blit->VAO = 0;
_mesa_DeleteBuffers(1, &blit->VBO);
blit->VBO = 0;
}
@@ -2047,12 +2049,12 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
_mesa_meta_begin(ctx, metaSave);
- if (clear->ArrayObj == 0) {
+ if (clear->VAO == 0) {
/* one-time setup */
/* create vertex array object */
- _mesa_GenVertexArrays(1, &clear->ArrayObj);
- _mesa_BindVertexArray(clear->ArrayObj);
+ _mesa_GenVertexArrays(1, &clear->VAO);
+ _mesa_BindVertexArray(clear->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &clear->VBO);
@@ -2065,7 +2067,7 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
_mesa_EnableClientState(GL_COLOR_ARRAY);
}
else {
- _mesa_BindVertexArray(clear->ArrayObj);
+ _mesa_BindVertexArray(clear->VAO);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, clear->VBO);
}
@@ -2180,12 +2182,12 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
GLuint vs, gs = 0, fs;
bool has_integer_textures;
- if (clear->ArrayObj != 0)
+ if (clear->VAO != 0)
return;
/* create vertex array object */
- _mesa_GenVertexArrays(1, &clear->ArrayObj);
- _mesa_BindVertexArray(clear->ArrayObj);
+ _mesa_GenVertexArrays(1, &clear->VAO);
+ _mesa_BindVertexArray(clear->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &clear->VBO);
@@ -2287,12 +2289,12 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
}
static void
-meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear)
+meta_glsl_clear_cleanup(struct clear_state *clear)
{
- if (clear->ArrayObj == 0)
+ if (clear->VAO == 0)
return;
- _mesa_DeleteVertexArrays(1, &clear->ArrayObj);
- clear->ArrayObj = 0;
+ _mesa_DeleteVertexArrays(1, &clear->VAO);
+ clear->VAO = 0;
_mesa_DeleteBuffers(1, &clear->VBO);
clear->VBO = 0;
_mesa_DeleteObjectARB(clear->ShaderProg);
@@ -2357,7 +2359,7 @@ _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers)
ctx->Color.ClearColor.f);
}
- _mesa_BindVertexArray(clear->ArrayObj);
+ _mesa_BindVertexArray(clear->VAO);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, clear->VBO);
/* GL_COLOR_BUFFER_BIT */
@@ -2470,12 +2472,12 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
MESA_META_VERTEX |
MESA_META_VIEWPORT));
- if (copypix->ArrayObj == 0) {
+ if (copypix->VAO == 0) {
/* one-time setup */
/* create vertex array object */
- _mesa_GenVertexArrays(1, &copypix->ArrayObj);
- _mesa_BindVertexArray(copypix->ArrayObj);
+ _mesa_GenVertexArrays(1, &copypix->VAO);
+ _mesa_BindVertexArray(copypix->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &copypix->VBO);
@@ -2490,7 +2492,7 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
_mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
}
else {
- _mesa_BindVertexArray(copypix->ArrayObj);
+ _mesa_BindVertexArray(copypix->VAO);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, copypix->VBO);
}
@@ -2543,7 +2545,24 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
_mesa_meta_end(ctx);
}
+static void
+meta_drawpix_cleanup(struct drawpix_state *drawpix)
+{
+ if (drawpix->VAO != 0) {
+ _mesa_DeleteVertexArrays(1, &drawpix->VAO);
+ drawpix->VAO = 0;
+ }
+ if (drawpix->StencilFP != 0) {
+ _mesa_DeleteProgramsARB(1, &drawpix->StencilFP);
+ drawpix->StencilFP = 0;
+ }
+
+ if (drawpix->DepthFP != 0) {
+ _mesa_DeleteProgramsARB(1, &drawpix->DepthFP);
+ drawpix->DepthFP = 0;
+ }
+}
/**
* When the glDrawPixels() image size is greater than the max rectangle
@@ -2825,11 +2844,11 @@ _mesa_meta_DrawPixels(struct gl_context *ctx,
verts[3].t = tex->Ttop;
}
- if (drawpix->ArrayObj == 0) {
+ if (drawpix->VAO == 0) {
/* one-time setup: create vertex array object */
- _mesa_GenVertexArrays(1, &drawpix->ArrayObj);
+ _mesa_GenVertexArrays(1, &drawpix->VAO);
}
- _mesa_BindVertexArray(drawpix->ArrayObj);
+ _mesa_BindVertexArray(drawpix->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &vbo);
@@ -3001,12 +3020,12 @@ _mesa_meta_Bitmap(struct gl_context *ctx,
MESA_META_VERTEX |
MESA_META_VIEWPORT));
- if (bitmap->ArrayObj == 0) {
+ if (bitmap->VAO == 0) {
/* one-time setup */
/* create vertex array object */
- _mesa_GenVertexArraysAPPLE(1, &bitmap->ArrayObj);
- _mesa_BindVertexArrayAPPLE(bitmap->ArrayObj);
+ _mesa_GenVertexArrays(1, &bitmap->VAO);
+ _mesa_BindVertexArray(bitmap->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &bitmap->VBO);
@@ -3023,7 +3042,7 @@ _mesa_meta_Bitmap(struct gl_context *ctx,
_mesa_EnableClientState(GL_COLOR_ARRAY);
}
else {
- _mesa_BindVertexArray(bitmap->ArrayObj);
+ _mesa_BindVertexArray(bitmap->VAO);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, bitmap->VBO);
}
@@ -3361,18 +3380,17 @@ setup_texture_coords(GLenum faceTarget,
static void
-setup_ff_generate_mipmap(struct gl_context *ctx,
- struct gen_mipmap_state *mipmap)
+setup_ff_generate_mipmap(struct gen_mipmap_state *mipmap)
{
struct vertex {
GLfloat x, y, tex[3];
};
- if (mipmap->ArrayObj == 0) {
+ if (mipmap->VAO == 0) {
/* one-time setup */
/* create vertex array object */
- _mesa_GenVertexArraysAPPLE(1, &mipmap->ArrayObj);
- _mesa_BindVertexArrayAPPLE(mipmap->ArrayObj);
+ _mesa_GenVertexArrays(1, &mipmap->VAO);
+ _mesa_BindVertexArray(mipmap->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &mipmap->VBO);
@@ -3451,11 +3469,11 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
void *mem_ctx;
/* Check if already initialized */
- if (mipmap->ArrayObj == 0) {
+ if (mipmap->VAO == 0) {
/* create vertex array object */
- _mesa_GenVertexArrays(1, &mipmap->ArrayObj);
- _mesa_BindVertexArray(mipmap->ArrayObj);
+ _mesa_GenVertexArrays(1, &mipmap->VAO);
+ _mesa_BindVertexArray(mipmap->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &mipmap->VBO);
@@ -3552,13 +3570,12 @@ setup_glsl_generate_mipmap(struct gl_context *ctx,
static void
-meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
- struct gen_mipmap_state *mipmap)
+meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap)
{
- if (mipmap->ArrayObj == 0)
+ if (mipmap->VAO == 0)
return;
- _mesa_DeleteVertexArrays(1, &mipmap->ArrayObj);
- mipmap->ArrayObj = 0;
+ _mesa_DeleteVertexArrays(1, &mipmap->VAO);
+ mipmap->VAO = 0;
_mesa_DeleteBuffers(1, &mipmap->VBO);
mipmap->VBO = 0;
@@ -3630,11 +3647,11 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_UseProgram(mipmap->ShaderProg);
}
else {
- setup_ff_generate_mipmap(ctx, mipmap);
+ setup_ff_generate_mipmap(mipmap);
_mesa_set_enable(ctx, target, GL_TRUE);
}
- _mesa_BindVertexArray(mipmap->ArrayObj);
+ _mesa_BindVertexArray(mipmap->VAO);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
@@ -3814,7 +3831,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
* ReadPixels() and passed to Tex[Sub]Image().
*/
static GLenum
-get_temp_image_type(struct gl_context *ctx, gl_format format)
+get_temp_image_type(struct gl_context *ctx, mesa_format format)
{
GLenum baseFormat;
@@ -3945,6 +3962,25 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
}
+static void
+meta_decompress_cleanup(struct decompress_state *decompress)
+{
+ if (decompress->FBO != 0) {
+ _mesa_DeleteFramebuffers(1, &decompress->FBO);
+ _mesa_DeleteRenderbuffers(1, &decompress->RBO);
+ }
+
+ if (decompress->VAO != 0) {
+ _mesa_DeleteVertexArrays(1, &decompress->VAO);
+ _mesa_DeleteBuffers(1, &decompress->VBO);
+ }
+
+ if (decompress->Sampler != 0)
+ _mesa_DeleteSamplers(1, &decompress->Sampler);
+
+ memset(decompress, 0, sizeof(*decompress));
+}
+
/**
* Decompress a texture image by drawing a quad with the compressed
* texture and reading the pixels out of the color buffer.
@@ -3981,11 +4017,28 @@ decompress_texture_image(struct gl_context *ctx,
target == GL_TEXTURE_2D_ARRAY);
}
- if (target == GL_TEXTURE_CUBE_MAP) {
+ switch (target) {
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_1D_ARRAY:
+ assert(!"No compressed 1D textures.");
+ return;
+
+ case GL_TEXTURE_3D:
+ assert(!"No compressed 3D textures.");
+ return;
+
+ case GL_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ /* These targets are just broken currently. */
+ return;
+
+ case GL_TEXTURE_CUBE_MAP:
faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face;
- }
- else {
+ break;
+
+ default:
faceTarget = target;
+ break;
}
/* save fbo bindings (not saved by _mesa_meta_begin()) */
@@ -4023,10 +4076,10 @@ decompress_texture_image(struct gl_context *ctx,
}
/* setup VBO data */
- if (decompress->ArrayObj == 0) {
+ if (decompress->VAO == 0) {
/* create vertex array object */
- _mesa_GenVertexArrays(1, &decompress->ArrayObj);
- _mesa_BindVertexArray(decompress->ArrayObj);
+ _mesa_GenVertexArrays(1, &decompress->VAO);
+ _mesa_BindVertexArray(decompress->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &decompress->VBO);
@@ -4041,7 +4094,7 @@ decompress_texture_image(struct gl_context *ctx,
_mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
}
else {
- _mesa_BindVertexArray(decompress->ArrayObj);
+ _mesa_BindVertexArray(decompress->VAO);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, decompress->VBO);
}
@@ -4068,18 +4121,17 @@ decompress_texture_image(struct gl_context *ctx,
verts[3].tex);
/* setup vertex positions */
- verts[0].x = 0.0F;
- verts[0].y = 0.0F;
- verts[1].x = width;
- verts[1].y = 0.0F;
- verts[2].x = width;
- verts[2].y = height;
- verts[3].x = 0.0F;
- verts[3].y = height;
+ verts[0].x = -1.0F;
+ verts[0].y = -1.0F;
+ verts[1].x = 1.0F;
+ verts[1].y = -1.0F;
+ verts[2].x = 1.0F;
+ verts[2].y = 1.0F;
+ verts[3].x = -1.0F;
+ verts[3].y = 1.0F;
_mesa_MatrixMode(GL_PROJECTION);
_mesa_LoadIdentity();
- _mesa_Ortho(0.0, width, 0.0, height, -1.0, 1.0);
_mesa_set_viewport(ctx, 0, 0, 0, width, height);
/* upload new vertex data */
@@ -4179,7 +4231,8 @@ _mesa_meta_GetTexImage(struct gl_context *ctx,
* unsigned, normalized values. We could handle signed and unnormalized
* with floating point renderbuffers...
*/
- if (_mesa_is_format_compressed(texImage->TexFormat) &&
+ if (texImage->TexObject->Target != GL_TEXTURE_CUBE_MAP_ARRAY
+ && _mesa_is_format_compressed(texImage->TexFormat) &&
_mesa_get_format_datatype(texImage->TexFormat)
== GL_UNSIGNED_NORMALIZED) {
struct gl_texture_object *texObj = texImage->TexObject;
@@ -4236,13 +4289,13 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
MESA_META_VERTEX |
MESA_META_VIEWPORT));
- if (drawtex->ArrayObj == 0) {
+ if (drawtex->VAO == 0) {
/* one-time setup */
GLint active_texture;
/* create vertex array object */
- _mesa_GenVertexArrays(1, &drawtex->ArrayObj);
- _mesa_BindVertexArray(drawtex->ArrayObj);
+ _mesa_GenVertexArrays(1, &drawtex->VAO);
+ _mesa_BindVertexArray(drawtex->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &drawtex->VBO);
@@ -4266,7 +4319,7 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
_mesa_ClientActiveTexture(GL_TEXTURE0 + active_texture);
}
else {
- _mesa_BindVertexArray(drawtex->ArrayObj);
+ _mesa_BindVertexArray(drawtex->VAO);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, drawtex->VBO);
}
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index d64821112..83841def5 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -806,60 +806,60 @@ driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv)
}
uint32_t
-driGLFormatToImageFormat(gl_format format)
+driGLFormatToImageFormat(mesa_format format)
{
switch (format) {
- case MESA_FORMAT_RGB565:
+ case MESA_FORMAT_B5G6R5_UNORM:
return __DRI_IMAGE_FORMAT_RGB565;
- case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_B8G8R8X8_UNORM:
return __DRI_IMAGE_FORMAT_XRGB8888;
- case MESA_FORMAT_ARGB2101010:
+ case MESA_FORMAT_B10G10R10A2_UNORM:
return __DRI_IMAGE_FORMAT_ARGB2101010;
- case MESA_FORMAT_XRGB2101010_UNORM:
+ case MESA_FORMAT_B10G10R10X2_UNORM:
return __DRI_IMAGE_FORMAT_XRGB2101010;
- case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_B8G8R8A8_UNORM:
return __DRI_IMAGE_FORMAT_ARGB8888;
- case MESA_FORMAT_RGBA8888_REV:
+ case MESA_FORMAT_R8G8B8A8_UNORM:
return __DRI_IMAGE_FORMAT_ABGR8888;
- case MESA_FORMAT_RGBX8888_REV:
+ case MESA_FORMAT_R8G8B8X8_UNORM:
return __DRI_IMAGE_FORMAT_XBGR8888;
- case MESA_FORMAT_R8:
+ case MESA_FORMAT_R_UNORM8:
return __DRI_IMAGE_FORMAT_R8;
- case MESA_FORMAT_GR88:
+ case MESA_FORMAT_R8G8_UNORM:
return __DRI_IMAGE_FORMAT_GR88;
case MESA_FORMAT_NONE:
return __DRI_IMAGE_FORMAT_NONE;
- case MESA_FORMAT_SARGB8:
+ case MESA_FORMAT_B8G8R8A8_SRGB:
return __DRI_IMAGE_FORMAT_SARGB8;
default:
return 0;
}
}
-gl_format
+mesa_format
driImageFormatToGLFormat(uint32_t image_format)
{
switch (image_format) {
case __DRI_IMAGE_FORMAT_RGB565:
- return MESA_FORMAT_RGB565;
+ return MESA_FORMAT_B5G6R5_UNORM;
case __DRI_IMAGE_FORMAT_XRGB8888:
- return MESA_FORMAT_XRGB8888;
+ return MESA_FORMAT_B8G8R8X8_UNORM;
case __DRI_IMAGE_FORMAT_ARGB2101010:
- return MESA_FORMAT_ARGB2101010;
+ return MESA_FORMAT_B10G10R10A2_UNORM;
case __DRI_IMAGE_FORMAT_XRGB2101010:
- return MESA_FORMAT_XRGB2101010_UNORM;
+ return MESA_FORMAT_B10G10R10X2_UNORM;
case __DRI_IMAGE_FORMAT_ARGB8888:
- return MESA_FORMAT_ARGB8888;
+ return MESA_FORMAT_B8G8R8A8_UNORM;
case __DRI_IMAGE_FORMAT_ABGR8888:
- return MESA_FORMAT_RGBA8888_REV;
+ return MESA_FORMAT_R8G8B8A8_UNORM;
case __DRI_IMAGE_FORMAT_XBGR8888:
- return MESA_FORMAT_RGBX8888_REV;
+ return MESA_FORMAT_R8G8B8X8_UNORM;
case __DRI_IMAGE_FORMAT_R8:
- return MESA_FORMAT_R8;
+ return MESA_FORMAT_R_UNORM8;
case __DRI_IMAGE_FORMAT_GR88:
- return MESA_FORMAT_GR88;
+ return MESA_FORMAT_R8G8_UNORM;
case __DRI_IMAGE_FORMAT_SARGB8:
- return MESA_FORMAT_SARGB8;
+ return MESA_FORMAT_B8G8R8A8_SRGB;
case __DRI_IMAGE_FORMAT_NONE:
return MESA_FORMAT_NONE;
default:
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.h b/mesalib/src/mesa/drivers/dri/common/dri_util.h
index a79a4ed7a..a37a0bbbc 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.h
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.h
@@ -281,9 +281,9 @@ struct __DRIdrawableRec {
};
extern uint32_t
-driGLFormatToImageFormat(gl_format format);
+driGLFormatToImageFormat(mesa_format format);
-extern gl_format
+extern mesa_format
driImageFormatToGLFormat(uint32_t image_format);
extern void
diff --git a/mesalib/src/mesa/drivers/dri/common/utils.c b/mesalib/src/mesa/drivers/dri/common/utils.c
index 3e35fe2d0..1f29e0b08 100644
--- a/mesalib/src/mesa/drivers/dri/common/utils.c
+++ b/mesalib/src/mesa/drivers/dri/common/utils.c
@@ -151,7 +151,7 @@ driGetRendererString( char * buffer, const char * hardware_name,
* If the function fails and returns \c GL_FALSE, this
* value will be unmodified, but some elements in the
* linked list may be modified.
- * \param format Mesa gl_format enum describing the pixel format
+ * \param format Mesa mesa_format enum describing the pixel format
* \param depth_bits Array of depth buffer sizes to be exposed.
* \param stencil_bits Array of stencil buffer sizes to be exposed.
* \param num_depth_stencil_bits Number of entries in both \c depth_bits and
@@ -176,7 +176,7 @@ driGetRendererString( char * buffer, const char * hardware_name,
* \c format).
*/
__DRIconfig **
-driCreateConfigs(gl_format format,
+driCreateConfigs(mesa_format format,
const uint8_t * depth_bits, const uint8_t * stencil_bits,
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes,
@@ -184,15 +184,15 @@ driCreateConfigs(gl_format format,
GLboolean enable_accum)
{
static const uint32_t masks_table[][4] = {
- /* MESA_FORMAT_RGB565 */
+ /* MESA_FORMAT_B5G6R5_UNORM */
{ 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 },
- /* MESA_FORMAT_XRGB8888 */
+ /* MESA_FORMAT_B8G8R8X8_UNORM */
{ 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 },
- /* MESA_FORMAT_ARGB8888 */
+ /* MESA_FORMAT_B8G8R8A8_UNORM */
{ 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 },
- /* MESA_FORMAT_XRGB2101010_UNORM */
+ /* MESA_FORMAT_B10G10R10X2_UNORM */
{ 0x3FF00000, 0x000FFC00, 0x000003FF, 0x00000000 },
- /* MESA_FORMAT_ARGB2101010 */
+ /* MESA_FORMAT_B10G10R10A2_UNORM */
{ 0x3FF00000, 0x000FFC00, 0x000003FF, 0xC0000000 },
};
@@ -209,20 +209,20 @@ driCreateConfigs(gl_format format,
bool is_srgb;
switch (format) {
- case MESA_FORMAT_RGB565:
+ case MESA_FORMAT_B5G6R5_UNORM:
masks = masks_table[0];
break;
- case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_B8G8R8X8_UNORM:
masks = masks_table[1];
break;
- case MESA_FORMAT_ARGB8888:
- case MESA_FORMAT_SARGB8:
+ case MESA_FORMAT_B8G8R8A8_UNORM:
+ case MESA_FORMAT_B8G8R8A8_SRGB:
masks = masks_table[2];
break;
- case MESA_FORMAT_XRGB2101010_UNORM:
+ case MESA_FORMAT_B10G10R10X2_UNORM:
masks = masks_table[3];
break;
- case MESA_FORMAT_ARGB2101010:
+ case MESA_FORMAT_B10G10R10A2_UNORM:
masks = masks_table[4];
break;
default:
diff --git a/mesalib/src/mesa/drivers/dri/common/utils.h b/mesalib/src/mesa/drivers/dri/common/utils.h
index 22af123c3..094143446 100644
--- a/mesalib/src/mesa/drivers/dri/common/utils.h
+++ b/mesalib/src/mesa/drivers/dri/common/utils.h
@@ -48,7 +48,7 @@ struct __DRIconfigRec {
};
extern __DRIconfig **
-driCreateConfigs(gl_format format,
+driCreateConfigs(mesa_format format,
const uint8_t * depth_bits, const uint8_t * stencil_bits,
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes,
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index 30e6805e9..071192c6f 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -71,19 +71,17 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
struct dri_context *dri_ctx;
int x, y, w, h;
__DRIscreen *sPriv = dPriv->driScreenPriv;
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
struct swrast_texture_image *swImage;
uint32_t internalFormat;
- gl_format texFormat;
+ mesa_format texFormat;
dri_ctx = pDRICtx->driverPrivate;
internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4);
- texUnit = _mesa_get_current_tex_unit(&dri_ctx->Base);
- texObj = _mesa_select_tex_object(&dri_ctx->Base, texUnit, target);
+ texObj = _mesa_get_current_tex_object(&dri_ctx->Base, target);
texImage = _mesa_get_tex_image(&dri_ctx->Base, texObj, target, 0);
swImage = swrast_texture_image(texImage);
@@ -92,9 +90,9 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
sPriv->swrast_loader->getDrawableInfo(dPriv, &x, &y, &w, &h, dPriv->loaderPrivate);
if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
- texFormat = MESA_FORMAT_XRGB8888;
+ texFormat = MESA_FORMAT_B8G8R8X8_UNORM;
else
- texFormat = MESA_FORMAT_ARGB8888;
+ texFormat = MESA_FORMAT_B8G8R8A8_UNORM;
_mesa_init_teximage_fields(&dri_ctx->Base, texImage,
w, h, 1, 0, internalFormat, texFormat);
@@ -130,7 +128,7 @@ swrastFillInModes(__DRIscreen *psp,
__DRIconfig **configs;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
- gl_format format;
+ mesa_format format;
/* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
* support pageflipping at all.
@@ -166,13 +164,13 @@ swrastFillInModes(__DRIscreen *psp,
switch (pixel_bits) {
case 16:
- format = MESA_FORMAT_RGB565;
+ format = MESA_FORMAT_B5G6R5_UNORM;
break;
case 24:
- format = MESA_FORMAT_XRGB8888;
+ format = MESA_FORMAT_B8G8R8X8_UNORM;
break;
case 32:
- format = MESA_FORMAT_ARGB8888;
+ format = MESA_FORMAT_B8G8R8A8_UNORM;
break;
default:
fprintf(stderr, "[%s:%u] bad depth %d\n", __func__, __LINE__,
@@ -345,25 +343,25 @@ swrast_new_renderbuffer(const struct gl_config *visual, __DRIdrawable *dPriv,
switch (pixel_format) {
case PF_A8R8G8B8:
- rb->Format = MESA_FORMAT_ARGB8888;
+ rb->Format = MESA_FORMAT_B8G8R8A8_UNORM;
rb->InternalFormat = GL_RGBA;
rb->_BaseFormat = GL_RGBA;
xrb->bpp = 32;
break;
case PF_X8R8G8B8:
- rb->Format = MESA_FORMAT_ARGB8888; /* XXX */
+ rb->Format = MESA_FORMAT_B8G8R8A8_UNORM; /* XXX */
rb->InternalFormat = GL_RGB;
rb->_BaseFormat = GL_RGB;
xrb->bpp = 32;
break;
case PF_R5G6B5:
- rb->Format = MESA_FORMAT_RGB565;
+ rb->Format = MESA_FORMAT_B5G6R5_UNORM;
rb->InternalFormat = GL_RGB;
rb->_BaseFormat = GL_RGB;
xrb->bpp = 16;
break;
case PF_R3G3B2:
- rb->Format = MESA_FORMAT_RGB332;
+ rb->Format = MESA_FORMAT_B2G3R3_UNORM;
rb->InternalFormat = GL_RGB;
rb->_BaseFormat = GL_RGB;
xrb->bpp = 8;
@@ -627,14 +625,14 @@ viewport(struct gl_context *ctx)
swrast_check_and_update_window_size(ctx, read);
}
-static gl_format swrastChooseTextureFormat(struct gl_context * ctx,
+static mesa_format swrastChooseTextureFormat(struct gl_context * ctx,
GLenum target,
GLint internalFormat,
GLenum format,
GLenum type)
{
if (internalFormat == GL_RGB)
- return MESA_FORMAT_XRGB8888;
+ return MESA_FORMAT_B8G8R8X8_UNORM;
return _mesa_choose_tex_format(ctx, target, internalFormat, format, type);
}
diff --git a/mesalib/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp b/mesalib/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp
index df697e4a3..813ad1ff2 100644
--- a/mesalib/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp
+++ b/mesalib/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp
@@ -593,23 +593,23 @@ MesaSoftwareRast::_SetupRenderBuffer(struct gl_renderbuffer* rb,
switch (colorSpace) {
case B_RGBA32:
rb->_BaseFormat = GL_RGBA;
- rb->Format = MESA_FORMAT_ARGB8888;
+ rb->Format = MESA_FORMAT_B8G8R8A8_UNORM;
break;
case B_RGB32:
rb->_BaseFormat = GL_RGB;
- rb->Format = MESA_FORMAT_XRGB8888;
+ rb->Format = MESA_FORMAT_B8G8R8X8_UNORM;
break;
case B_RGB24:
rb->_BaseFormat = GL_RGB;
- rb->Format = MESA_FORMAT_RGB888;
+ rb->Format = MESA_FORMAT_BGR_UNORM8;
break;
case B_RGB16:
rb->_BaseFormat = GL_RGB;
- rb->Format = MESA_FORMAT_RGB565;
+ rb->Format = MESA_FORMAT_B5G6R5_UNORM;
break;
case B_RGB15:
rb->_BaseFormat = GL_RGB;
- rb->Format = MESA_FORMAT_ARGB1555;
+ rb->Format = MESA_FORMAT_B5G5R5A1_UNORM;
break;
default:
fprintf(stderr, "Unsupported screen color space %s\n",