[Mesa-dev] [PATCH 1/4] mesa: properly return GetTexLevelParameter queries for buffer textures
Brian Paul
brianp at vmware.com
Mon Mar 28 16:14:16 UTC 2016
Reviewed-by: Brian Paul <brianp at vmware.com>
On 03/27/2016 09:19 AM, Ilia Mirkin wrote:
> 1-month ping
>
> dEQP has a number of tests both for texture buffers, as well as image
> buffers. would be nice to have access to those.
>
> -ilia
>
> On Sat, Feb 27, 2016 at 4:29 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> This fixes all failures with dEQP tests in this area. While
>> ARB_texture_buffer_object explicitly says that GetTexLevelParameter & co
>> should not be supported, GL 3.1 reverses this decision and allows all of
>> these queries there.
>>
>> Conversely, there is no text that forbids the buffer-specific queries
>> from being used with non-buffer images.
>>
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> ---
>> src/mesa/main/texparam.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++--
>> 1 file changed, 52 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
>> index 3b769f4..9d94636 100644
>> --- a/src/mesa/main/texparam.c
>> +++ b/src/mesa/main/texparam.c
>> @@ -1447,6 +1447,29 @@ get_tex_level_parameter_image(struct gl_context *ctx,
>> *params = img->FixedSampleLocations;
>> break;
>>
>> + /* There is never a buffer data store here, but these pnames still have
>> + * to work.
>> + */
>> +
>> + /* GL_ARB_texture_buffer_object */
>> + case GL_TEXTURE_BUFFER_DATA_STORE_BINDING:
>> + if (!ctx->Extensions.ARB_texture_buffer_object)
>> + goto invalid_pname;
>> + *params = 0;
>> + break;
>> +
>> + /* GL_ARB_texture_buffer_range */
>> + case GL_TEXTURE_BUFFER_OFFSET:
>> + if (!ctx->Extensions.ARB_texture_buffer_range)
>> + goto invalid_pname;
>> + *params = 0;
>> + break;
>> + case GL_TEXTURE_BUFFER_SIZE:
>> + if (!ctx->Extensions.ARB_texture_buffer_range)
>> + goto invalid_pname;
>> + *params = 0;
>> + break;
>> +
>> default:
>> goto invalid_pname;
>> }
>> @@ -1468,13 +1491,24 @@ get_tex_level_parameter_buffer(struct gl_context *ctx,
>> {
>> const struct gl_buffer_object *bo = texObj->BufferObject;
>> mesa_format texFormat = texObj->_BufferObjectFormat;
>> + int bytes = MAX2(1, _mesa_get_format_bytes(texFormat));
>> GLenum internalFormat = texObj->BufferObjectFormat;
>> GLenum baseFormat = _mesa_get_format_base_format(texFormat);
>> const char *suffix = dsa ? "ture" : "";
>>
>> if (!bo) {
>> /* undefined texture buffer object */
>> - *params = pname == GL_TEXTURE_COMPONENTS ? 1 : 0;
>> + switch (pname) {
>> + case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS:
>> + *params = GL_TRUE;
>> + break;
>> + case GL_TEXTURE_INTERNAL_FORMAT:
>> + *params = internalFormat;
>> + break;
>> + default:
>> + *params = 0;
>> + break;
>> + }
>> return;
>> }
>>
>> @@ -1483,10 +1517,13 @@ get_tex_level_parameter_buffer(struct gl_context *ctx,
>> *params = bo->Name;
>> break;
>> case GL_TEXTURE_WIDTH:
>> - *params = bo->Size;
>> + *params = ((texObj->BufferSize == -1) ? bo->Size : texObj->BufferSize)
>> + / bytes;
>> break;
>> case GL_TEXTURE_HEIGHT:
>> case GL_TEXTURE_DEPTH:
>> + *params = 1;
>> + break;
>> case GL_TEXTURE_BORDER:
>> case GL_TEXTURE_SHARED_SIZE:
>> case GL_TEXTURE_COMPRESSED:
>> @@ -1536,6 +1573,19 @@ get_tex_level_parameter_buffer(struct gl_context *ctx,
>> *params = (texObj->BufferSize == -1) ? bo->Size : texObj->BufferSize;
>> break;
>>
>> + /* GL_ARB_texture_multisample */
>> + case GL_TEXTURE_SAMPLES:
>> + if (!ctx->Extensions.ARB_texture_multisample)
>> + goto invalid_pname;
>> + *params = 0;
>> + break;
>> +
>> + case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS:
>> + if (!ctx->Extensions.ARB_texture_multisample)
>> + goto invalid_pname;
>> + *params = GL_TRUE;
>> + break;
>> +
>> /* GL_ARB_texture_compression */
>> case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
>> /* Always illegal for GL_TEXTURE_BUFFER */
>> --
>> 2.4.10
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=NBqjQGyb73UPGPIVz1-hfSm0zb9WfWbc0gjTvrJ8JVI&s=ZJrAJ2tGof3duwSP9XUKgHl1MOlcHSdbEvNLADuhvA0&e=
>
More information about the mesa-dev
mailing list