summaryrefslogtreecommitdiff
path: root/src/mesa/main
AgeCommit message (Collapse)AuthorFilesLines
2024-02-21mesa: declare _mesa_HashTable::id_alloc as non-pointerMarek Olšák2-28/+15
split from "mesa: enable GL names reuse for _mesa_HashTable, remove the alternative" Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27494>
2024-02-21vdpau: Declare texture object as immutable using helper function.Chris Rankin1-1/+2
Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10618 Signed-off-by: Chris Rankin <rankincj@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27681>
2024-02-20mesa: add more driver support checks for more format queriesMike Blumenkrantz1-0/+8
fixes #10641 cc: mesa-stable Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Acked-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27698>
2024-02-17mesa: check driver format support for certain GetInternalformativ queriesMike Blumenkrantz1-0/+26
according to spec, these should return NONE if the format is not supported for a given texture target, but mesa was incorrectly returning a hardcoded value for all cases without checking the driver instead, check whether the driver can create a texture for a given format to correctly handle this non-support case cc: mesa-stable Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27621>
2024-02-14mesa: fix off-by-one for newblock allocation in dlist_allocthfrwn1-1/+1
Cc: mesa-stable Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27556>
2024-02-13mesa/main: work around chrome/firefox bugErik Faye-Lund2-3/+20
Due to flawed logic, Chromium and Firefox thinks EXT_texture_storage allows using GL_BGRA8_EXT for *all* texturing, including things like glTexSubImage2D, which it does not. However, this bug was introduced in Chromium back in 2016, and there's also a lot of Electron apps that bundle outdated versions of Chromium. This means it's going to be a *mess* to fix this properly while staying within the spec. I've opened a ticket with Khronos to consider changing the spec to make this legal, because it seems most other OpenGL implementations allow it. But in the mean time, let's complain a bit, but accept the behavior. This way people can at least run browsers with hardware acceleration again. If we decide to change the spec, we can remove this wording. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10550 Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27521>
2024-02-13mesa/main: mark GL_BGRA8_EXT as color-renderableErik Faye-Lund1-0/+8
While this is not quite as clear as in the previous commit, I still believe this is the case, but in a bit of an indirect way: 1. EXT_texture_storage defines that GL_BGRA8_EXT is allowed to be used in certain sitations if *either* EXT_texture_format_BGRA8888 *or* APPLE_texture_format_BGRA8888 is supported. 2. Surprisingly, EXT_texture_format_BGRA8888 (which we do support) does not even mention GL_BGRA8_EXT, only GL_BGRA_EXT. 3. APPLE_texture_format_BGRA8888 on the other hand (which we *don't* support) *does* introduce GL_BGRA8_EXT, and is pretty clear about it being intended for rendering-purposes. But it's written against GLES 1.1 instead of GLES 2 or later, so it doesn't explicitly add it to the required tables. I think the above tells us that GL_BGRA8_EXT is *supposed* to be a color-renderable format, even if the way we currently support it is rather underspecified. It should also be texture-filterable, for the same reason as in the previous commit. In the longer run, we should probably add support for APPLE_texture_format_BGRA8888, which would make things a bit clearer. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27521>
2024-02-13mesa/main: mark GL_BGRA as color-renderableErik Faye-Lund2-5/+6
The EXT_texture_format_BGRA8888-spec is quite clear that this format is color-renderable, so let's mark it properly as such. It should also be texture-filterable, because in the version of OpenGL ES it was written against all texture-formats were filterable to begin with. While we're at it, use the non-EXT version of the enum; it's been in the headers since OpenGL 1.2... Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27521>
2024-02-13mesa/main: fix _mesa_base_tex_format for BGRAErik Faye-Lund1-11/+3
This function needs the GLES fix for all APIs now. And it should also handle the sized internal format. Fixes: 4de62731f4d ("mesa/main: add support for EXT_texture_storage") Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27521>
2024-02-13mesa: use util_idalloc_alloc_range for _mesa_HashFindFreeKeyBlockMarek Olšák1-2/+2
Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27588>
2024-02-13mesa: fix incorrect _mesa_HashInsertLocked parameter in _mesa_EndListMarek Olšák1-1/+1
This fixes random behavior when we turn on GL names reuse for display lists. (ctx->Const.ForceGLNamesReuse) Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27588>
2024-02-13st/mesa: remove !obj checking in _mesa_get_bufferobj_reference when it's uselessMarek Olšák1-4/+2
There is at least one case in a future commit where the compiler can't do this automatically. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27587>
2024-02-13st/mesa: merge 3 unlikely blocks in _mesa_get_bufferobj_referenceMarek Olšák1-14/+20
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27587>
2024-02-13mesa: remove _mesa_HashTable::InDeleteAllMarek Olšák2-21/+0
It's not necessary if we don't remove entries from the hash table, which we don't have to do because we are going to destroy it anyway. Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27586>
2024-02-13mesa: fold _mesa_HashDeleteAll into _mesa_DeleteHashTableMarek Olšák10-116/+73
They are always called back-to-back. This is simpler. Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27586>
2024-02-13mesa: re-format main/hash.h, move inlines to the end, some code to main/hash.cMarek Olšák2-129/+122
the assertions also didn't do anything Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27586>
2024-02-13mesa: clean up unnecessary _mesa_HashTable locked/unlocked wrappersMarek Olšák2-72/+35
Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27586>
2024-02-13mesa: remove unused _mesa_HashTable codeMarek Olšák4-82/+0
Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27586>
2024-02-12glsl: skip conversion of half float back to float for GL queriesTimothy Arceri1-4/+7
This is only needed for GLES where floats have been lowered to half floats internally. We don't do that in desktop GL and we need to skip it to return the correct enums for the AMD_gpu_shader_half_float extension. Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540>
2024-02-12glsl: add basic params for AMD_gpu_shader_half_float extensionTimothy Arceri2-0/+2
This sets us the basic infrastructure to required to add an extension. Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540>
2024-02-10mesa: add gl_vertex_array_object::NonIdentityBufferAttribMappingMarek Olšák3-0/+14
It will be used to skip the indirection from vertex attribs to vertex buffers. Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27525>
2024-02-10mesa: inline _mesa_set_vao_immutableMarek Olšák2-18/+0
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27525>
2024-02-10mesa: inline {Create,Draw}GalliumVertexState callbacksMarek Olšák2-13/+4
They are always constant. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27525>
2024-02-10st/mesa: constify the pipe_draw_info parameter and remove obsolete commentsMarek Olšák1-10/+3
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27525>
2024-02-08mesa: plumb errors through to texture allocationMike Blumenkrantz2-22/+27
the spec allows this and tests like spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch expect it cc: mesa-stable Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25931>
2024-02-02mesa: fix error-handling for ETC2/RGTC texturesErik Faye-Lund1-4/+8
It seems we missed an error-case that got introduced in OpenGL 4.4. While this error doesn't *technically* exist as-is in OpenGL ES before version 3, neither does 3D textures. And while OES_texture_3D introduces it to OpenGL ES 2.0 without adding the same error for ETC2 textures, that is likely an omission in the spec; 3D ETC2 texture was never a thing. This fixes a regression in the confidential Khronos CTS, specifically GL46.gtf42.GL3Tests.texture_storage.texture_storage_compressed_texture_data Fixes: 652a898d316 ("mesa/main: add support for EXT_texture_storage") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10545 Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Tested-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27428>
2024-02-01mesa/main: add support for EXT_texture_storageErik Faye-Lund2-0/+51
It's sometimes really, really useful if GL_BGRA8 can be used as a sized internal format, and the combination of EXT_texture_storage and EXT_texture_format_BGRA8888 allows this (only when using texture-storage, which is good enough in some cases). Until now, we've only implemented ARB_texture_storage, and not the EXT version. So let's implement the EXT version as well, so we get the benefit of the interaction here. This pulls in a lot of other similar interactions as well, which also seems useful. ...because the ARB version is created from the EXT version, let's move the EXT function definitions to the EXT extension. These should probably have been suffixed with ARB in the ARB-version, but things seems to have just ended up kinda confused. Oh well. Reviewed-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27222>
2024-01-31mesa/main: Use secure_getenv for shader dumpingFriedrich Vock1-2/+2
Reviewed-by: Eric Engestrom <eric@igalia.com> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27381>
2024-01-29glthread: apply the thread scheduling policy when a batch executes synchronouslyMarek Olšák1-0/+2
before this, when no batch was executed asynchronously, the policy wasn't applied Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27247>
2024-01-29glthread: apply the thread scheduling policy when the context is createdMarek Olšák1-17/+28
instead of after 128 batches Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27247>
2024-01-29st/mesa: rename ST_L3_PINNING_DISABLED -> ST_THREAD_SCHEDULER_DISABLEDMarek Olšák1-1/+1
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27247>
2024-01-29gallium: rename PIPE_.._PIN_THREADS_TO_L3_CACHE -> .._UPDATE_THREAD_SCHEDULINGMarek Olšák1-1/+1
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27247>
2024-01-29mesa,gallium: move the thread scheduler to src/utilMarek Olšák2-15/+18
The only change in behavior is that setting the affinity mask is skipped when it has no effect, which happens when the app thread hasn't been moved under a different L3 cache by the kernel (the sched_state variable tracks that). This improves performance because setting the affinity mask incurs measurable CPU overhead even if it has no effect. Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27247>
2024-01-12mesa: Consider mesa format in addition to internal format for mip/cube ↵Jesse Natalie1-2/+4
completeness Prior to 06b526de, the mesa format was used for these completeness checks. That was to address the case where a *different* internal format selected the *same* mesa format, and the texture shouldn't be considered compatible. But this didn't address the case where the *same* internal format selected a *different* mesa format, e.g. because the type passed to the TexImage API was different. An old WGL demo app called TexFilter.exe tries to redefine a mipped RGBA16 texture as RGBA8. This incorrect logic caused Mesa to try to copy the RGBA16 data from the smaller mips into the newly created RGBA8 data, because it thought that the texture was still mip-complete, despite the format changing. Cc: mesa-stable Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27023>
2024-01-12mesa/st: don't use NIR_PASS_VAlyssa Rosenzweig3-12/+12
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26976>
2024-01-09mesa: check for float-format supportErik Faye-Lund1-6/+9
Surprisingly enough, EXT_color_buffer_float doesn't make RGB32F color-renderable, but EXT_color_buffer_half_float *does* make RGB16F color-renderable... Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26870>
2024-01-09mesa/main: require EXT_color_buffer_float for ES 3.2Erik Faye-Lund1-1/+1
OpenGL ES 3.2 makes FP16 and FP32 textures color-renderable, so this is effectively a requirement. Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26870>
2024-01-09mesa: actually check for EXT_color_buffer_float supportErik Faye-Lund2-2/+3
EXT_color_buffer_float makes both 16 and 32 bit floating-point texture formats color-renderable. We can't just unconditionally report that, we need to check for support. The RGB formats are a bit special under this extension, because it's not specified as color-renderable. However, because the RGBA formats *are* specified as color-renderable, and the state-tracker can emulate the RGB formats with the RGBA ones, we don't need to test for that here. While we're at it, move EXT_color_buffer_half_float to its correct sorted position. Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26870>
2024-01-08mesa,u_threaded_context: add a fast path for glDrawElements calling TC directlyMarek Olšák1-3/+55
mesa/main/draw.c calls threaded_context to add a draw call, but the caller fills it manually. This way we don't have to fill pipe_draw_info in a local variable and later copy it to tc_batch. tc_batch is filled from draw.c directly. It also eliminates a few conditional jumps thanks to assumptions we can make in DrawElements but not tc_draw_vbo. This decreases the overhead of the GL frontend thread by 1.1%, which has CPU usage of 26%, so it decreases the overhead for that thread by 4.2%. (1.1 / 26) Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26584>
2024-01-08glthread: add proper helpers for call fencesMarek Olšák3-23/+42
These wait for a GL call to be processed by the consumer thread. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26916>
2024-01-08glthread: don't unroll draws using user VBOs with GLESMarek Olšák1-1/+2
The unrolling uses glBegin, which is unsupported by GLES and the GL dispatch fails. Fixes: 50d791ca73e52c6 - glthread: add a vertex upload path that unrolls indices for glDrawElements Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26916>
2024-01-05util: Add align_uintptr and use it treewide to replace ALIGN that works on ↵Yonggang Luo1-1/+1
size_t and uintptr_t Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26866>
2023-12-22mesa: Use glsl_type C helpersCaio Oliveira2-31/+31
Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26707>
2023-12-21mesa: fix enum support for EXT_clip_cull_distanceTapani Pälli1-4/+4
Extension was enabled but required enums not. Fixes: 979bcb9f428 ("glsl: add EXT_clip_cull_distance support based on ARB_cull_distance") Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26688>
2023-12-21mesa: enable GL_SELECT and GL_FEEDBACK modes for indirect drawsMarek Olšák1-1/+1
This enables the correct GL_SELECT/GL_FEEDBACK codepaths for indirect draws. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26786>
2023-12-21mesa: add a pipe_draw_indirect_info* parameter into the DrawGallium callbackMarek Olšák2-9/+10
We need this to enable GL_SELECT and GL_FEEDBACK modes for indirect draws. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26786>
2023-12-21mesa: micro-improvements in draw.cMarek Olšák1-8/+13
- use ctx->pipe instead of ctx->st->pipe - call st_prepare_draw outside the loop - don't call DrawGallium is draw.count == 0 Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26786>
2023-12-21glthread: add a missing end-of-batch markerMarek Olšák1-0/+5
Unmarshal calls that "look ahead" in the batch use it. They expect the next call ID to be equal to a specific GL call. NUM_DISPATCH_CMD is not equal to any GL call (it's last_call_id + 1). This was missed in the referenced commit, causing assertion failures. Fixes: c3b95d1507d809ff9c - glthread: add a marker at the end of batches indicating the end Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26786>
2023-12-19mesa: Drop not used program_written_to_cacheChristian Gmeiner1-3/+0
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26740>
2023-12-12mesa/main: allow S3TC for 3D texturesPavel Asyutchenko1-0/+20
This is allowed by D3D, RADV, ANV and Nvidia GL drivers at least, so it should work on any hardware with S3TC. Confirmed to work in OpenXRay on radeonsi. Signed-off-by: Pavel Asyutchenko <svenpavel@gmail.com> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26389>