diff options
Diffstat (limited to 'lib/mesa/src')
-rw-r--r-- | lib/mesa/src/mesa/drivers/dri/i915/intel_screen.h | 2 | ||||
-rw-r--r-- | lib/mesa/src/mesa/drivers/dri/i965/brw_program_binary.c | 4 | ||||
-rw-r--r-- | lib/mesa/src/mesa/drivers/dri/i965/hsw_sol.c | 3 | ||||
-rw-r--r-- | lib/mesa/src/mesa/drivers/dri/meson.build | 4 | ||||
-rw-r--r-- | lib/mesa/src/mesa/main/draw.c | 195 | ||||
-rw-r--r-- | lib/mesa/src/mesa/main/draw.h | 6 | ||||
-rw-r--r-- | lib/mesa/src/mesa/main/draw_validate.c | 2 | ||||
-rw-r--r-- | lib/mesa/src/mesa/main/format_pack.c | 50 | ||||
-rw-r--r-- | lib/mesa/src/mesa/main/format_unpack.c | 53 | ||||
-rw-r--r-- | lib/mesa/src/mesa/main/formats.csv | 1 | ||||
-rw-r--r-- | lib/mesa/src/mesa/main/glheader.h | 6 | ||||
-rw-r--r-- | lib/mesa/src/mesa/main/glspirv.c | 5 | ||||
-rw-r--r-- | lib/mesa/src/mesa/main/tests/meson.build | 3 | ||||
-rw-r--r-- | lib/mesa/src/mesa/main/texformat.c | 3 | ||||
-rw-r--r-- | lib/mesa/src/mesa/program/program_parse.tab.h | 9 |
15 files changed, 187 insertions, 159 deletions
diff --git a/lib/mesa/src/mesa/drivers/dri/i915/intel_screen.h b/lib/mesa/src/mesa/drivers/dri/i915/intel_screen.h index ac70d3655..359cf3134 100644 --- a/lib/mesa/src/mesa/drivers/dri/i915/intel_screen.h +++ b/lib/mesa/src/mesa/drivers/dri/i915/intel_screen.h @@ -44,8 +44,6 @@ struct intel_screen bool no_hw; - bool hw_has_swizzling; - bool no_vbo; dri_bufmgr *bufmgr; diff --git a/lib/mesa/src/mesa/drivers/dri/i965/brw_program_binary.c b/lib/mesa/src/mesa/drivers/dri/i965/brw_program_binary.c index db0333224..1298d9e76 100644 --- a/lib/mesa/src/mesa/drivers/dri/i965/brw_program_binary.c +++ b/lib/mesa/src/mesa/drivers/dri/i965/brw_program_binary.c @@ -206,14 +206,14 @@ brw_program_deserialize_driver_blob(struct gl_context *ctx, break; switch ((enum driver_cache_blob_part)part_type) { case GEN_PART: { - uint32_t gen_size = blob_read_uint32(&reader); + MAYBE_UNUSED uint32_t gen_size = blob_read_uint32(&reader); assert(!reader.overrun && (uintptr_t)(reader.end - reader.current) > gen_size); deserialize_gen_program(&reader, ctx, prog, stage); break; } case NIR_PART: { - uint32_t nir_size = blob_read_uint32(&reader); + MAYBE_UNUSED uint32_t nir_size = blob_read_uint32(&reader); assert(!reader.overrun && (uintptr_t)(reader.end - reader.current) > nir_size); const struct nir_shader_compiler_options *options = diff --git a/lib/mesa/src/mesa/drivers/dri/i965/hsw_sol.c b/lib/mesa/src/mesa/drivers/dri/i965/hsw_sol.c index f84063ded..b7272db8b 100644 --- a/lib/mesa/src/mesa/drivers/dri/i965/hsw_sol.c +++ b/lib/mesa/src/mesa/drivers/dri/i965/hsw_sol.c @@ -98,7 +98,8 @@ tally_prims_written(struct brw_context *brw, brw_load_register_mem64(brw, HSW_CS_GPR(1), obj->prim_count_bo, START_OFFSET + i * sizeof(uint64_t)); /* GPR2 = Ending Snapshot */ - brw_load_register_reg64(brw, GEN7_SO_NUM_PRIMS_WRITTEN(i), HSW_CS_GPR(2)); + brw_load_register_reg64(brw, HSW_CS_GPR(2), + GEN7_SO_NUM_PRIMS_WRITTEN(i)); BEGIN_BATCH(9); OUT_BATCH(HSW_MI_MATH | (9 - 2)); diff --git a/lib/mesa/src/mesa/drivers/dri/meson.build b/lib/mesa/src/mesa/drivers/dri/meson.build index 0410a5a12..dddc4ae3d 100644 --- a/lib/mesa/src/mesa/drivers/dri/meson.build +++ b/lib/mesa/src/mesa/drivers/dri/meson.build @@ -54,6 +54,10 @@ if dri_drivers != [] dep_selinux, dep_libdrm, dep_expat, dep_m, dep_thread, dep_dl, idep_nir, ], link_args : [ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections], + # Will be deleted during installation, see install_megadrivers.py + install : true, + install_dir : dri_drivers_path, + name_suffix : 'so', ) meson.add_install_script( diff --git a/lib/mesa/src/mesa/main/draw.c b/lib/mesa/src/mesa/main/draw.c index cceadf261..bfc4b9c93 100644 --- a/lib/mesa/src/mesa/main/draw.c +++ b/lib/mesa/src/mesa/main/draw.c @@ -67,7 +67,7 @@ check_array_data(struct gl_context *ctx, struct gl_vertex_array_object *vao, GLuint attrib, GLuint j) { const struct gl_array_attributes *array = &vao->VertexAttrib[attrib]; - if (array->Enabled) { + if (vao->Enabled & VERT_BIT(attrib)) { const struct gl_vertex_buffer_binding *binding = &vao->BufferBinding[array->BufferBindingIndex]; struct gl_buffer_object *bo = binding->BufferObj; @@ -82,18 +82,19 @@ check_array_data(struct gl_context *ctx, struct gl_vertex_array_object *vao, data = ADD_POINTERS(_mesa_vertex_attrib_address(array, binding), bo->Mappings[MAP_INTERNAL].Pointer); } - switch (array->Type) { + switch (array->Format.Type) { case GL_FLOAT: { GLfloat *f = (GLfloat *) ((GLubyte *) data + binding->Stride * j); GLint k; - for (k = 0; k < array->Size; k++) { + for (k = 0; k < array->Format.Size; k++) { if (IS_INF_OR_NAN(f[k]) || f[k] >= 1.0e20F || f[k] <= -1.0e10F) { printf("Bad array data:\n"); printf(" Element[%u].%u = %f\n", j, k, f[k]); printf(" Array %u at %p\n", attrib, (void *) array); printf(" Type 0x%x, Size %d, Stride %d\n", - array->Type, array->Size, binding->Stride); + array->Format.Type, array->Format.Size, + binding->Stride); printf(" Address/offset %p in Buffer Object %u\n", array->Ptr, bo->Name); f[k] = 1.0F; /* XXX replace the bad value! */ @@ -117,7 +118,7 @@ unmap_array_buffer(struct gl_context *ctx, struct gl_vertex_array_object *vao, GLuint attrib) { const struct gl_array_attributes *array = &vao->VertexAttrib[attrib]; - if (array->Enabled) { + if (vao->Enabled & VERT_BIT(attrib)) { const struct gl_vertex_buffer_binding *binding = &vao->BufferBinding[array->BufferBindingIndex]; struct gl_buffer_object *bo = binding->BufferObj; @@ -225,7 +226,7 @@ skip_validated_draw(struct gl_context *ctx) case API_OPENGLES: /* For OpenGL ES, only draw if we have vertex positions */ - if (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled) + if (!(ctx->Array.VAO->Enabled & VERT_BIT_POS)) return true; break; @@ -252,8 +253,7 @@ skip_validated_draw(struct gl_context *ctx) /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic * array [0]). */ - return (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled && - !ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled); + return !(ctx->Array.VAO->Enabled & (VERT_BIT_POS|VERT_BIT_GENERIC0)); } break; @@ -274,23 +274,22 @@ print_draw_arrays(struct gl_context *ctx, { const struct gl_vertex_array_object *vao = ctx->Array.VAO; - printf("_mesa_exec_DrawArrays(mode 0x%x, start %d, count %d):\n", + printf("_mesa_DrawArrays(mode 0x%x, start %d, count %d):\n", mode, start, count); - unsigned i; - for (i = 0; i < VERT_ATTRIB_MAX; ++i) { + GLbitfield mask = vao->Enabled; + while (mask) { + const gl_vert_attrib i = u_bit_scan(&mask); const struct gl_array_attributes *array = &vao->VertexAttrib[i]; - if (!array->Enabled) - continue; const struct gl_vertex_buffer_binding *binding = &vao->BufferBinding[array->BufferBindingIndex]; struct gl_buffer_object *bufObj = binding->BufferObj; - printf("attr %s: size %d stride %d enabled %d " + printf("attr %s: size %d stride %d " "ptr %p Bufobj %u\n", gl_vert_attrib_name((gl_vert_attrib) i), - array->Size, binding->Stride, array->Enabled, + array->Format.Size, binding->Stride, array->Ptr, bufObj->Name); if (_mesa_is_bufferobj(bufObj)) { @@ -301,7 +300,7 @@ print_draw_arrays(struct gl_context *ctx, _mesa_vertex_attrib_address(array, binding); unsigned multiplier; - switch (array->Type) { + switch (array->Format.Type) { case GL_DOUBLE: case GL_INT64_ARB: case GL_UNSIGNED_INT64_ARB: @@ -315,7 +314,7 @@ print_draw_arrays(struct gl_context *ctx, int *k = (int *) f; int i = 0; int n = (count - 1) * (binding->Stride / (4 * multiplier)) - + array->Size; + + array->Format.Size; if (n > 32) n = 32; printf(" Data at offset %d:\n", offset); @@ -538,8 +537,8 @@ _mesa_exec_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) /** * Called from glDrawArrays when in immediate mode (not display list mode). */ -static void GLAPIENTRY -_mesa_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) +void GLAPIENTRY +_mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) { GET_CURRENT_CONTEXT(ctx); @@ -573,9 +572,9 @@ _mesa_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) * Called from glDrawArraysInstanced when in immediate mode (not * display list mode). */ -static void GLAPIENTRY -_mesa_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count, - GLsizei numInstances) +void GLAPIENTRY +_mesa_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count, + GLsizei numInstances) { GET_CURRENT_CONTEXT(ctx); @@ -859,10 +858,10 @@ _mesa_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, /** * Called by glDrawRangeElementsBaseVertex() in immediate mode. */ -static void GLAPIENTRY -_mesa_exec_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid * indices, GLint basevertex) +void GLAPIENTRY +_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid * indices, GLint basevertex) { static GLuint warnCount = 0; GLboolean index_bounds_valid = GL_TRUE; @@ -958,9 +957,9 @@ _mesa_exec_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, /** * Called by glDrawRangeElements() in immediate mode. */ -static void GLAPIENTRY -_mesa_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end, - GLsizei count, GLenum type, const GLvoid * indices) +void GLAPIENTRY +_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, + GLsizei count, GLenum type, const GLvoid * indices) { if (MESA_VERBOSE & VERBOSE_DRAW) { GET_CURRENT_CONTEXT(ctx); @@ -970,17 +969,17 @@ _mesa_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end, _mesa_enum_to_string(type), indices); } - _mesa_exec_DrawRangeElementsBaseVertex(mode, start, end, count, type, - indices, 0); + _mesa_DrawRangeElementsBaseVertex(mode, start, end, count, type, + indices, 0); } /** * Called by glDrawElements() in immediate mode. */ -static void GLAPIENTRY -_mesa_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices) +void GLAPIENTRY +_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid * indices) { GET_CURRENT_CONTEXT(ctx); @@ -1009,9 +1008,9 @@ _mesa_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, /** * Called by glDrawElementsBaseVertex() in immediate mode. */ -static void GLAPIENTRY -_mesa_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices, GLint basevertex) +void GLAPIENTRY +_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, + const GLvoid * indices, GLint basevertex) { GET_CURRENT_CONTEXT(ctx); @@ -1321,10 +1320,9 @@ _mesa_validated_multidrawelements(struct gl_context *ctx, GLenum mode, } -static void GLAPIENTRY -_mesa_exec_MultiDrawElements(GLenum mode, - const GLsizei *count, GLenum type, - const GLvoid * const *indices, GLsizei primcount) +void GLAPIENTRY +_mesa_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, + const GLvoid * const *indices, GLsizei primcount) { GET_CURRENT_CONTEXT(ctx); @@ -1344,12 +1342,12 @@ _mesa_exec_MultiDrawElements(GLenum mode, } -static void GLAPIENTRY -_mesa_exec_MultiDrawElementsBaseVertex(GLenum mode, - const GLsizei *count, GLenum type, - const GLvoid * const *indices, - GLsizei primcount, - const GLsizei *basevertex) +void GLAPIENTRY +_mesa_MultiDrawElementsBaseVertex(GLenum mode, + const GLsizei *count, GLenum type, + const GLvoid * const *indices, + GLsizei primcount, + const GLsizei *basevertex) { GET_CURRENT_CONTEXT(ctx); @@ -1444,8 +1442,8 @@ _mesa_draw_transform_feedback(struct gl_context *ctx, GLenum mode, * glVertexPointer, glColorPointer, etc. * Part of GL_ARB_transform_feedback2. */ -static void GLAPIENTRY -_mesa_exec_DrawTransformFeedback(GLenum mode, GLuint name) +void GLAPIENTRY +_mesa_DrawTransformFeedback(GLenum mode, GLuint name) { GET_CURRENT_CONTEXT(ctx); struct gl_transform_feedback_object *obj = @@ -1997,15 +1995,15 @@ void _mesa_initialize_exec_dispatch(const struct gl_context *ctx, struct _glapi_table *exec) { - SET_DrawArrays(exec, _mesa_exec_DrawArrays); - SET_DrawElements(exec, _mesa_exec_DrawElements); + SET_DrawArrays(exec, _mesa_DrawArrays); + SET_DrawElements(exec, _mesa_DrawElements); if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) { - SET_DrawRangeElements(exec, _mesa_exec_DrawRangeElements); + SET_DrawRangeElements(exec, _mesa_DrawRangeElements); } SET_MultiDrawArrays(exec, _mesa_exec_MultiDrawArrays); - SET_MultiDrawElementsEXT(exec, _mesa_exec_MultiDrawElements); + SET_MultiDrawElementsEXT(exec, _mesa_MultiDrawElements); if (ctx->API == API_OPENGL_COMPAT) { SET_Rectf(exec, _mesa_exec_Rectf); @@ -2015,13 +2013,13 @@ _mesa_initialize_exec_dispatch(const struct gl_context *ctx, if (ctx->API != API_OPENGLES && ctx->Extensions.ARB_draw_elements_base_vertex) { - SET_DrawElementsBaseVertex(exec, _mesa_exec_DrawElementsBaseVertex); + SET_DrawElementsBaseVertex(exec, _mesa_DrawElementsBaseVertex); SET_MultiDrawElementsBaseVertex(exec, - _mesa_exec_MultiDrawElementsBaseVertex); + _mesa_MultiDrawElementsBaseVertex); if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) { SET_DrawRangeElementsBaseVertex(exec, - _mesa_exec_DrawRangeElementsBaseVertex); + _mesa_DrawRangeElementsBaseVertex); SET_DrawElementsInstancedBaseVertex(exec, _mesa_exec_DrawElementsInstancedBaseVertex); } @@ -2042,12 +2040,12 @@ _mesa_initialize_exec_dispatch(const struct gl_context *ctx, } if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) { - SET_DrawArraysInstancedARB(exec, _mesa_exec_DrawArraysInstanced); + SET_DrawArraysInstancedARB(exec, _mesa_DrawArraysInstanced); SET_DrawElementsInstancedARB(exec, _mesa_exec_DrawElementsInstanced); } if (_mesa_is_desktop_gl(ctx)) { - SET_DrawTransformFeedback(exec, _mesa_exec_DrawTransformFeedback); + SET_DrawTransformFeedback(exec, _mesa_DrawTransformFeedback); SET_DrawTransformFeedbackStream(exec, _mesa_exec_DrawTransformFeedbackStream); SET_DrawTransformFeedbackInstanced(exec, @@ -2065,87 +2063,6 @@ _mesa_initialize_exec_dispatch(const struct gl_context *ctx, -/** - * The following functions are only used for OpenGL ES 1/2 support. - * And some aren't even supported (yet) in ES 1/2. - */ - - -void GLAPIENTRY -_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count) -{ - _mesa_exec_DrawArrays(mode, first, count); -} - - -void GLAPIENTRY -_mesa_DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, - GLsizei primcount) -{ - _mesa_exec_DrawArraysInstanced(mode, first, count, primcount); -} - - -void GLAPIENTRY -_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices) -{ - _mesa_exec_DrawElements(mode, count, type, indices); -} - - -void GLAPIENTRY -_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices, GLint basevertex) -{ - _mesa_exec_DrawElementsBaseVertex(mode, count, type, indices, basevertex); -} - - -void GLAPIENTRY -_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, - GLenum type, const GLvoid * indices) -{ - _mesa_exec_DrawRangeElements(mode, start, end, count, type, indices); -} - - -void GLAPIENTRY -_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid *indices, GLint basevertex) -{ - _mesa_exec_DrawRangeElementsBaseVertex(mode, start, end, count, type, - indices, basevertex); -} - - -void GLAPIENTRY -_mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, - const GLvoid ** indices, GLsizei primcount) -{ - _mesa_exec_MultiDrawElements(mode, count, type, indices, primcount); -} - - -void GLAPIENTRY -_mesa_MultiDrawElementsBaseVertex(GLenum mode, - const GLsizei *count, GLenum type, - const GLvoid **indices, GLsizei primcount, - const GLint *basevertex) -{ - _mesa_exec_MultiDrawElementsBaseVertex(mode, count, type, indices, - primcount, basevertex); -} - - -void GLAPIENTRY -_mesa_DrawTransformFeedback(GLenum mode, GLuint name) -{ - _mesa_exec_DrawTransformFeedback(mode, name); -} - - /* GL_IBM_multimode_draw_arrays */ void GLAPIENTRY _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first, diff --git a/lib/mesa/src/mesa/main/draw.h b/lib/mesa/src/mesa/main/draw.h index 76d54f482..b8e611321 100644 --- a/lib/mesa/src/mesa/main/draw.h +++ b/lib/mesa/src/mesa/main/draw.h @@ -129,14 +129,14 @@ _mesa_MultiDrawArrays(GLenum mode, const GLint *first, void GLAPIENTRY -_mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, - const GLvoid **indices, GLsizei primcount); +_mesa_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, + const GLvoid *const *indices, GLsizei primcount); void GLAPIENTRY _mesa_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, - const GLvoid **indices, GLsizei primcount, + const GLvoid * const * indices, GLsizei primcount, const GLint *basevertex); diff --git a/lib/mesa/src/mesa/main/draw_validate.c b/lib/mesa/src/mesa/main/draw_validate.c index 29304bd51..b715a27f8 100644 --- a/lib/mesa/src/mesa/main/draw_validate.c +++ b/lib/mesa/src/mesa/main/draw_validate.c @@ -1100,7 +1100,7 @@ valid_draw_indirect(struct gl_context *ctx, * buffer bound. */ if (_mesa_is_gles31(ctx) && - ctx->Array.VAO->_Enabled & ~ctx->Array.VAO->VertexAttribBufferMask) { + ctx->Array.VAO->Enabled & ~ctx->Array.VAO->VertexAttribBufferMask) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(No VBO bound)", name); return GL_FALSE; } diff --git a/lib/mesa/src/mesa/main/format_pack.c b/lib/mesa/src/mesa/main/format_pack.c index 6b183d55f..3430f360f 100644 --- a/lib/mesa/src/mesa/main/format_pack.c +++ b/lib/mesa/src/mesa/main/format_pack.c @@ -1829,6 +1829,19 @@ pack_ubyte_a8l8_srgb(const GLubyte src[4], void *dst) } static inline void +pack_ubyte_r_srgb8(const GLubyte src[4], void *dst) +{ + + + uint8_t r = + + util_format_linear_to_srgb_8unorm(src[0]); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; +} + +static inline void pack_ubyte_l_srgb8(const GLubyte src[4], void *dst) { @@ -3661,7 +3674,7 @@ pack_ubyte_r11g11b10_float(const GLubyte src[4], void *dst) /* uint packing functions */ - + static inline void pack_uint_a8b8g8r8_uint(const GLuint src[4], void *dst) { @@ -6903,6 +6916,19 @@ pack_float_a8l8_srgb(const GLfloat src[4], void *dst) } static inline void +pack_float_r_srgb8(const GLfloat src[4], void *dst) +{ + + + uint8_t r = + + util_format_linear_float_to_srgb_8unorm(src[0]); + + uint8_t *d = (uint8_t *)dst; + d[0] = r; +} + +static inline void pack_float_l_srgb8(const GLfloat src[4], void *dst) { @@ -7515,6 +7541,9 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) case MESA_FORMAT_A8L8_SRGB: return pack_ubyte_a8l8_srgb; + case MESA_FORMAT_R_SRGB8: + return pack_ubyte_r_srgb8; + case MESA_FORMAT_L_SRGB8: return pack_ubyte_l_srgb8; @@ -8061,6 +8090,9 @@ _mesa_get_pack_float_rgba_function(mesa_format format) case MESA_FORMAT_A8L8_SRGB: return pack_float_a8l8_srgb; + case MESA_FORMAT_R_SRGB8: + return pack_float_r_srgb8; + case MESA_FORMAT_L_SRGB8: return pack_float_l_srgb8; @@ -8717,6 +8749,13 @@ _mesa_pack_ubyte_rgba_row(mesa_format format, GLuint n, } break; + case MESA_FORMAT_R_SRGB8: + for (i = 0; i < n; ++i) { + pack_ubyte_r_srgb8(src[i], d); + d += 1; + } + break; + case MESA_FORMAT_L_SRGB8: for (i = 0; i < n; ++i) { pack_ubyte_l_srgb8(src[i], d); @@ -9404,7 +9443,7 @@ _mesa_pack_uint_rgba_row(mesa_format format, GLuint n, GLubyte *d = dst; switch (format) { - + case MESA_FORMAT_A8B8G8R8_UINT: for (i = 0; i < n; ++i) { pack_uint_a8b8g8r8_uint(src[i], d); @@ -10513,6 +10552,13 @@ _mesa_pack_float_rgba_row(mesa_format format, GLuint n, } break; + case MESA_FORMAT_R_SRGB8: + for (i = 0; i < n; ++i) { + pack_float_r_srgb8(src[i], d); + d += 1; + } + break; + case MESA_FORMAT_L_SRGB8: for (i = 0; i < n; ++i) { pack_float_l_srgb8(src[i], d); diff --git a/lib/mesa/src/mesa/main/format_unpack.c b/lib/mesa/src/mesa/main/format_unpack.c index b3289acd3..d3527d6e8 100644 --- a/lib/mesa/src/mesa/main/format_unpack.c +++ b/lib/mesa/src/mesa/main/format_unpack.c @@ -1788,6 +1788,24 @@ unpack_float_a8l8_srgb(const void *void_src, GLfloat dst[4]) } static inline void +unpack_float_r_srgb8(const void *void_src, GLfloat dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = src[0]; + + + + + dst[0] = util_format_srgb_8unorm_to_linear_float(r); + + dst[1] = 0.0f; + + dst[2] = 0.0f; + + dst[3] = 1.0f; +} + +static inline void unpack_float_l_srgb8(const void *void_src, GLfloat dst[4]) { uint8_t *src = (uint8_t *)void_src; @@ -3988,6 +4006,24 @@ unpack_ubyte_a8l8_srgb(const void *void_src, GLubyte dst[4]) } static inline void +unpack_ubyte_r_srgb8(const void *void_src, GLubyte dst[4]) +{ + uint8_t *src = (uint8_t *)void_src; + uint8_t r = src[0]; + + + + + dst[0] = util_format_srgb_to_linear_8unorm(r); + + dst[1] = 0; + + dst[2] = 0; + + dst[3] = 255; +} + +static inline void unpack_ubyte_l_srgb8(const void *void_src, GLubyte dst[4]) { uint8_t *src = (uint8_t *)void_src; @@ -4032,7 +4068,7 @@ unpack_ubyte_bgr_srgb8(const void *void_src, GLubyte dst[4]) /* integer packing functions */ - + static inline void unpack_int_a8b8g8r8_uint(const void *void_src, GLuint dst[4]) { @@ -5828,6 +5864,12 @@ _mesa_unpack_rgba_row(mesa_format format, GLuint n, s += 2; } break; + case MESA_FORMAT_R_SRGB8: + for (i = 0; i < n; ++i) { + unpack_float_r_srgb8(s, dst[i]); + s += 1; + } + break; case MESA_FORMAT_L_SRGB8: for (i = 0; i < n; ++i) { unpack_float_l_srgb8(s, dst[i]); @@ -6556,6 +6598,13 @@ _mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, } break; + case MESA_FORMAT_R_SRGB8: + for (i = 0; i < n; ++i) { + unpack_ubyte_r_srgb8(s, dst[i]); + s += 1; + } + break; + case MESA_FORMAT_L_SRGB8: for (i = 0; i < n; ++i) { unpack_ubyte_l_srgb8(s, dst[i]); @@ -6597,7 +6646,7 @@ _mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, GLuint i; switch (format) { - + case MESA_FORMAT_A8B8G8R8_UINT: for (i = 0; i < n; ++i) { unpack_int_a8b8g8r8_uint(s, dst[i]); diff --git a/lib/mesa/src/mesa/main/formats.csv b/lib/mesa/src/mesa/main/formats.csv index ce53f8f05..cb821fec6 100644 --- a/lib/mesa/src/mesa/main/formats.csv +++ b/lib/mesa/src/mesa/main/formats.csv @@ -158,6 +158,7 @@ MESA_FORMAT_L8A8_SRGB , packed, 1, 1, 1, un8 , un8 , , MESA_FORMAT_A8L8_SRGB , packed, 1, 1, 1, un8 , un8 , , , yyyx, srgb # Array sRGB formats +MESA_FORMAT_R_SRGB8 , array , 1, 1, 1, un8 , , , , x001, srgb MESA_FORMAT_L_SRGB8 , array , 1, 1, 1, un8 , , , , xxx1, srgb MESA_FORMAT_BGR_SRGB8 , array , 1, 1, 1, un8 , un8 , un8 , , zyx1, srgb diff --git a/lib/mesa/src/mesa/main/glheader.h b/lib/mesa/src/mesa/main/glheader.h index e95fc9fb4..5764b83ff 100644 --- a/lib/mesa/src/mesa/main/glheader.h +++ b/lib/mesa/src/mesa/main/glheader.h @@ -138,6 +138,9 @@ typedef int GLclampx; #define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837 #endif +#ifndef GL_EXT_texture_sRGB_R8 +#define GL_SR8_EXT 0x8FBD +#endif /** * Internal token to represent a GLSL shader program (a collection of @@ -148,6 +151,9 @@ typedef int GLclampx; */ #define GL_SHADER_PROGRAM_MESA 0x9999 +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +#endif #ifdef __cplusplus } diff --git a/lib/mesa/src/mesa/main/glspirv.c b/lib/mesa/src/mesa/main/glspirv.c index 04e46ba57..227971091 100644 --- a/lib/mesa/src/mesa/main/glspirv.c +++ b/lib/mesa/src/mesa/main/glspirv.c @@ -212,6 +212,7 @@ _mesa_spirv_to_nir(struct gl_context *ctx, const struct spirv_to_nir_options spirv_options = { .lower_workgroup_access_to_offsets = true, + .lower_ubo_ssbo_access_to_offsets = true, .caps = ctx->Const.SpirVCapabilities }; @@ -242,10 +243,10 @@ _mesa_spirv_to_nir(struct gl_context *ctx, * inline functions. That way they get properly initialized at the top * of the function and not at the top of its caller. */ - NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_local); + NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function_temp); NIR_PASS_V(nir, nir_lower_returns); NIR_PASS_V(nir, nir_inline_functions); - NIR_PASS_V(nir, nir_copy_prop); + NIR_PASS_V(nir, nir_opt_deref); /* Pick off the single entrypoint that we want */ foreach_list_typed_safe(nir_function, func, node, &nir->functions) { diff --git a/lib/mesa/src/mesa/main/tests/meson.build b/lib/mesa/src/mesa/main/tests/meson.build index d1bd81a56..4b3932515 100644 --- a/lib/mesa/src/mesa/main/tests/meson.build +++ b/lib/mesa/src/mesa/main/tests/meson.build @@ -41,5 +41,6 @@ test( include_directories : [inc_include, inc_src, inc_mapi, inc_mesa], dependencies : [idep_gtest, dep_clock, dep_dl, dep_thread], link_with : [libmesa_classic, link_main_test], - ) + ), + suite : ['mesa'], ) diff --git a/lib/mesa/src/mesa/main/texformat.c b/lib/mesa/src/mesa/main/texformat.c index 822f80f89..381edd554 100644 --- a/lib/mesa/src/mesa/main/texformat.c +++ b/lib/mesa/src/mesa/main/texformat.c @@ -477,6 +477,9 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB); RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB); break; + case GL_SR8_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_R_SRGB8); + break; case GL_SLUMINANCE_EXT: case GL_SLUMINANCE8_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_L_SRGB8); diff --git a/lib/mesa/src/mesa/program/program_parse.tab.h b/lib/mesa/src/mesa/program/program_parse.tab.h index d60eb3b63..def9d6d8c 100644 --- a/lib/mesa/src/mesa/program/program_parse.tab.h +++ b/lib/mesa/src/mesa/program/program_parse.tab.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.2. */ +/* A Bison parser, made by GNU Bison 3.3.2. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -160,7 +161,7 @@ extern int _mesa_program_debug; union YYSTYPE { -#line 129 "./program/program_parse.y" /* yacc.c:1906 */ +#line 129 "./program/program_parse.y" /* yacc.c:1921 */ struct asm_instruction *inst; struct asm_symbol *sym; @@ -186,7 +187,7 @@ union YYSTYPE unsigned negate:1; } ext_swizzle; -#line 190 "./program/program_parse.tab.h" /* yacc.c:1906 */ +#line 191 "./program/program_parse.tab.h" /* yacc.c:1921 */ }; typedef union YYSTYPE YYSTYPE; |