summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Ignore glPointSize when GL_POINT_SIZE_ARRAY_OES is enabledPlamena Manolova2016-03-151-0/+2
| | | | | | | | | | When a user defines a point size array and enables it, the point size value set via glPointSize should be ignored. To achieve this, we can simply toggle ctx->VertexProgram.PointSizeEnabled. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42187 Signed-off-by: Plamena Manolova <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* get: reconcile aliasing enums for MaxCombinedShaderOutputResourcesNicolai Hähnle2016-03-142-2/+11
| | | | | | | | | | | The enums MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS and MAX_COMBINED_SHADER_OUTPUT_RESOURCES are equal and should therefore only appear once. Noticed while implementing ARB_shader_image_load_store without previously implementing SSBO. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add GL_ARB_shader_atomic_counter_ops supportIlia Mirkin2016-03-102-0/+2
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: Make glGetInteger64v convert float/doubles to 32-bit integers.Kenneth Graunke2016-03-091-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | According to the GL 4.4 core specification, section 2.2.2 ("Data Conversions For State Query Commands"): "If a command returning integer data is called, such as GetIntegerv or GetInteger64v, a boolean value of TRUE or FALSE is interpreted as one or zero, respectively. A floating-point value is rounded to the nearest integer, unless the value is an RGBA color component, a DepthRange value, or a depth buffer clear value. In these cases, the query command converts the floating-point value to an integer according to the INT entry of table 18.2; a value not in [−1, 1] converts to an undefined value." The INT entry of table 18.2 shows that b = 32, meaning the expectation is to convert it to a 32-bit integer value. Fixes: dEQP-GLES3.functional.state_query.floats.blend_color_getinteger64 dEQP-GLES3.functional.state_query.floats.color_clear_value_getinteger64 dEQP-GLES3.functional.state_query.floats.depth_clear_value_getinteger64 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94456 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* mesa/main: do not wrap header inclusion in extern "C"Emil Velikov2016-03-091-4/+2
| | | | Signed-off-by: Emil Velikov <[email protected]>
* mesa: Fix error code for GetFramebufferAttachmentParameter in ES 3.0+.Kenneth Graunke2016-03-081-2/+16
| | | | | | | | | | | | | | | | | | The ES 3.0+ specifications contain the exact same text as the OpenGL specification, which says that we should return GL_INVALID_OPERATION. ES 2.0 contains different text saying we should return GL_INVALID_ENUM. Previously, Mesa chose the error code based on API (GL vs. ES). This patch makes ES 3.0+ follow the GL behavior. ES 2 remains as is. Fixes dEQP-GLES3.functional.fbo.api.attachment_query_empty_fbo. However, breaks the dEQP-GLES2 variant of the same test for drivers which silently promote to ES 3.0. This can be worked around by exporting MESA_GLES_VERSION_OVERRIDE=2.0, but is a bug in dEQP-GLES2. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add GL_RED and GL_RG to ES3 effective internal format mapping.Kenneth Graunke2016-03-081-0/+4
| | | | | | | | | | | | | | | | The dEQP-GLES3.functional.fbo.completeness.renderable.texture. {color0,depth,stencil}.{red,rg}_unsigned_byte tests appear to expect GL_RED/GL_RG and GL_UNSIGNED_BYTE to map to GL_R8/GL_RG8, rather than returning an INVALID_OPERATION error. This makes perfect sense. However, RED and RG are strangely missing from the ES 3.0/3.1/3.2 spec's "Effective internal format corresponding to external format and type" tables. It may be worth filing a spec bug. Fixes the 6 dEQP tests mentioned above. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* mesa: fix malformed assertion in _image_format_class_to_glenum()Brian Paul2016-03-081-1/+1
| | | | Reviewed-by: Vinson Lee <[email protected]>
* mesa: Change GLboolean to bool in GenerateMipmap target checker.Kenneth Graunke2016-03-071-4/+4
| | | | | | | This is not API facing, so just use bool. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: Make GenerateMipmap check the target before finding an object.Kenneth Graunke2016-03-071-6/+12
| | | | | | | | | | | | | | | | | | | | If glGenerateMipmap was called with a bogus target, then it would pass that to _mesa_get_current_tex_object(), which would raise a _mesa_problem() telling people to file bugs. We'd then do the proper error checking, raise an error, and bail. Doing the check first avoids the _mesa_problem(). The DSA variant doesn't take a target parameter, so we leave the target validation exactly as it was in that case. Fixes one dEQP GLES2 test: dEQP-GLES2.functional.negative_api.texture.generatemipmap.invalid_target. v2: Rebase on Antia's recent patch to this area. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> [v1] Reviewed-by: Matt Turner <[email protected]>
* mesa: flip current tf object back to default if current is being deletedIlia Mirkin2016-03-071-0/+5
| | | | | | | | | | In the rather unusual case of Bind + Delete, we need to make sure that we unbind the current tf object. Fixes dEQP-GLES3.functional.lifetime.delete_bound.transform_feedback Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: Allow Get*() of several forgotten IsEnabled() pnames.Kenneth Graunke2016-03-032-0/+5
| | | | | | | | | | | | | | | | | | | | From section 6.2 ("State Tables") of the GL 2.1 specification (the text also appears in the GL 3.0 and ES 3.1 specifications): "However, state variables for which IsEnabled is listed as the query command can also be obtained using GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev." GL_DEBUG_OUTPUT, GL_DEBUG_OUTPUT_SYNCHRONOUS, and GL_FRAGMENT_SHADER_ATI were missing from the glGet*() functions. All other IsEnabled() pnames look to be present, as far as I can tell. Fixes 8 dEQP-GLES31.functional.debug.state_query subtests: debug_output[_synchronous]_get{boolean,float,integer,integer64}. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* mesa: Make glGet queries initialize ctx->Debug when necessary.Kenneth Graunke2016-03-031-14/+6
| | | | | | | | | | | | | | | | | | | | | | | dEQP-GLES31.functional.debug.state_query.debug_group_stack_depth_* tries to call glGet on GL_DEBUG_GROUP_STACK_DEPTH right away, before doing any other debug setup. This should return 1. However, because ctx->Debug wasn't allocated, we bailed and returned 0. This patch removes the open-coded locking and switches the two glGet functions to use _mesa_lock_debug_state(), which takes care of allocating and initializing that state on the first time. It also conveniently takes care of unlocking on failure for us, so we don't need to handle that in every caller. Fixes dEQP-GLES31.functional.debug.state_query.debug_group_stack_depth_ {getboolean,getfloat,getinteger,getinteger64}. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* mesa/glformats: Consider DEPTH/STENCIL when resolving a mesa_formatEduardo Lima Mitev2016-03-031-0/+21
| | | | | | | | | | _mesa_format_from_format_and_type() is currently not considering DEPTH and STENCIL formats, which are not array formats and are not handled anywhere. This patch adds cases for common combinations of DEPTH/STENCIL format and types. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Add (GET_)TEXTURE_IMAGE_TYPE pnamesEduardo Lima Mitev2016-03-031-9/+5
| | | | | | These basically reuse the default implementation of GL_READ_PIXELS_TYPE. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Add (GET_)TEXTURE_IMAGE_FORMAT pnamesEduardo Lima Mitev2016-03-031-5/+18
| | | | Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Add READ_PIXELS_TYPE pnameEduardo Lima Mitev2016-03-031-4/+21
| | | | | | | | We call the driver to provide its preferred type, but also provide a default implementation that selects a generic type based on the passed internal format. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Add READ_PIXELS_FORMAT pnameEduardo Lima Mitev2016-03-031-6/+21
| | | | Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Add support for READ_PIXELS queryEduardo Lima Mitev2016-03-031-1/+2
| | | | | | | This is supported since very early version of OpenGL, but we still call the driver to give it the opportunity to report caveat or no support. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: added FILTER pname supportAlejandro Piñeiro2016-03-031-1/+19
| | | | | | | | | | | | | | | | | | | | | It discards out the targets and internalformats that explicitly mention (per-spec) that doesn't support filter types other than NEAREST or NEAREST_MIPMAP_NEAREST. Those are: * Texture buffers target * Multisample targets * Any integer internalformat For the case of multisample targets, it was used the existing method _mesa_target_allows_setting_sampler_parameter. This would scalate better in the future if new targets appear that doesn't allow to set sampler parameters. We consider RENDERBUFFER to support LINEAR filters, because although it doesn't support this filter for sampling, you can set LINEAR on a blit operation using glBlitFramebuffer. Reviewed-by: Dave Airlie <[email protected]>
* mesa/texparam: make public target_allows_setting_sampler_parametersAlejandro Piñeiro2016-03-032-16/+19
| | | | | | In order to allow to be used on ARB_internalformat_query2 implementation. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added framebuffer renderability related queriesAntia Puentes2016-03-031-7/+33
| | | | | | | | | | | | | | | | | | | | From the ARB_internalformat_query2 specification: "- FRAMEBUFFER_RENDERABLE: The support for rendering to the resource via framebuffer attachment is returned in <params>. - FRAMEBUFFER_RENDERABLE_LAYERED: The support for layered rendering to the resource via framebuffer attachment is returned in <params>. - FRAMEBUFFER_BLEND: The support for rendering to the resource via framebuffer attachment when blending is enabled is returned in <params>." For all of them, "Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource is unsupported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added texture gather/shadow related queriesAntia Puentes2016-03-031-7/+36
| | | | | | | | | | | | | | | | | | | | From the ARB_internalformat_query2 specification: "- TEXTURE_SHADOW: The support for using the resource with shadow samplers is written to <params>. - TEXTURE_GATHER: The support for using the resource with texture gather operations is written to <params>. - TEXTURE_GATHER_SHADOW: The support for using resource with texture gather operations with shadow samplers is written to <params>." For all of them, "Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource or operation is not supported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added texture view related queriesAntia Puentes2016-03-031-4/+18
| | | | | | | | | | | | | | | | | | From the ARB_internalformat_query2 specification: "- TEXTURE_VIEW: The support for using the resource with the TextureView command is returned in <params>. Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource or operation is not supported, NONE is returned. - VIEW_COMPATIBILITY_CLASS: The compatibility class of the resource when used as a texture view is returned in <params>. The compatibility class is one of the values from the /Class/ column of Table 3.X.2. If the resource has no other formats that are compatible, the resource does not support views, or if texture views are not supported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/textureview: Make _lookup_view_class publicAntia Puentes2016-03-032-8/+12
| | | | | | | It will be used by the ARB_internalformat_query2 implementation to implement the VIEW_COMPATIBILITY_CLASS <pname> query. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added CLEAR_BUFFER <pname> queryAntia Puentes2016-03-031-1/+6
| | | | | | | | | | | From the ARB_internalformat_query2 specification: "- CLEAR_BUFFER: The support for using the resource with ClearBuffer*Data commands is returned in <params>. Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource or operation is not supported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added compressed texture related queriesAntia Puentes2016-03-031-8/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | From the ARB_internalformat_query2 specification: "- TEXTURE_COMPRESSED: If <internalformat> is a compressed format that is supported for this type of resource, TRUE is returned in <params>. If the internal format is not compressed, or the type of resource is not supported, FALSE is returned. - TEXTURE_COMPRESSED_BLOCK_WIDTH: If the resource contains a compressed format, the width of a compressed block (in bytes) is returned in <params>. If the internal format is not compressed, or the resource is not supported, 0 is returned. - TEXTURE_COMPRESSED_BLOCK_HEIGHT: If the resource contains a compressed format, the height of a compressed block (in bytes) is returned in <params>. If the internal format is not compressed, or the resource is not supported, 0 is returned. - TEXTURE_COMPRESSED_BLOCK_SIZE: If the resource contains a compressed format the number of bytes per block is returned in <params>. If the internal format is not compressed, or the resource is not supported, 0 is returned. (combined with the above, allows the bitrate to be computed, and may be useful in conjunction with ARB_compressed_texture_pixel_storage)." Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added simultaneous texture and depth/stencil queriesAntia Puentes2016-03-031-10/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the ARB_internalformat_query2 specification: "- SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST: The support for using the resource both as a source for texture sampling while it is bound as a buffer for depth test is written to <params>. For example, a depth (or stencil) texture could be bound simultaneously for texturing while it is bound as a depth (and/or stencil) buffer without causing a feedback loop, provided that depth writes are disabled. - SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST: The support for using the resource both as a source for texture sampling while it is bound as a buffer for stencil test is written to <params>. For example, a depth (or stencil) texture could be bound simultaneously for texturing while it is bound as a depth (and/or stencil) buffer without causing a feedback loop, provided that stencil writes are disabled. - SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE: The support for using the resource both as a source for texture sampling while performing depth writes to the resources is written to <params>. For example, a depth-stencil texture could be bound simultaneously for stencil texturing while it is bound as a depth buffer. Feedback loops cannot occur because sampling a stencil texture only returns the stencil portion, and thus writes to the depth buffer do not modify the stencil portions. - SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE: The support for using the resource both as a source for texture sampling while performing stencil writes to the resources is written to <params>. For example, a depth-stencil texture could be bound simultaneously for depth-texturing while it is bound as a stencil buffer. Feedback loops cannot occur because sampling a depth texture only returns the depth portion, and thus writes to the stencil buffer could not modify the depth portions. For all of them, "Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource or operation is not supported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added queries related to image texturesAntia Puentes2016-03-031-7/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the ARB_internalformat_query2 specification: "- IMAGE_TEXEL_SIZE: The size of a texel when the resource when used as an image texture is returned in <params>. This is the value from the /Size/ column in Table 3.22. If the resource is not supported for image textures, or if image textures are not supported, zero is returned. - IMAGE_COMPATIBILITY_CLASS: The compatibility class of the resource when used as an image texture is returned in <params>. This corresponds to the value from the /Class/ column in Table 3.22. The possible values returned are IMAGE_CLASS_4_X_32, IMAGE_CLASS_2_X_32, IMAGE_CLASS_1_X_32, IMAGE_CLASS_4_X_16, IMAGE_CLASS_2_X_16, IMAGE_CLASS_1_X_16, IMAGE_CLASS_4_X_8, IMAGE_CLASS_2_X_8, IMAGE_CLASS_1_X_8, IMAGE_CLASS_11_11_10, and IMAGE_CLASS_10_10_10_2, which correspond to the 4x32, 2x32, 1x32, 4x16, 2x16, 1x16, 4x8, 2x8, 1x8, the class (a) 11/11/10 packed floating-point format, and the class (b) 10/10/10/2 packed formats, respectively. If the resource is not supported for image textures, or if image textures are not supported, NONE is returned. - IMAGE_PIXEL_FORMAT: The pixel format of the resource when used as an image texture is returned in <params>. This is the value from the /Pixel format/ column in Table 3.22. If the resource is not supported for image textures, or if image textures are not supported, NONE is returned. - IMAGE_PIXEL_TYPE: The pixel type of the resource when used as an image texture is returned in <params>. This is the value from the /Pixel type/ column in Table 3.22. If the resource is not supported for image textures, or if image textures are not supported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/shaderimage: Added func to get the GL_IMAGE_CLASS from the formatAntia Puentes2016-03-032-0/+51
| | | | | | | It will be used by the ARB_internalformat_query2 implementation to implement the IMAGE_COMPATIBILITY_CLASS <pname> query. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added SHADER_IMAGE_{LOAD,STORE,ATOMIC} <pname> queriesAntia Puentes2016-03-031-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | From the ARB_internalformat_query2 specification: "- SHADER_IMAGE_LOAD: The support for using the resource with image load operations in shaders is written to <params>. In this case the <internalformat> is the value of the <format> parameter that would be passed to BindImageTexture. - SHADER_IMAGE_STORE: The support for using the resource with image store operations in shaders is written to <params>. In this case the <internalformat> is the value of the <format> parameter that is passed to BindImageTexture. - SHADER_IMAGE_ATOMIC: The support for using the resource with atomic memory operations from shaders is written to <params>." For all of them: "Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource or operation is not supported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/shaderimage: Make is_image_format_supported publicAntia Puentes2016-03-032-8/+13
| | | | | | | | It will be used by the ARB_internalformat_query2 implementation to implement queries related to the ARB_shader_image_load_store extension. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added queries related to texture sampling in shadersAntia Puentes2016-03-031-16/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the ARB_internalformat_query2 specification: "- VERTEX_TEXTURE: The support for using the resource as a source for texture sampling in a vertex shader is written to <params>. - TESS_CONTROL_TEXTURE: The support for using the resource as a source for texture sampling in a tessellation control shader is written to <params>. - TESS_EVALUATION_TEXTURE: The support for using the resource as a source for texture sampling in a tessellation evaluation shader is written to <params>. - GEOMETRY_TEXTURE: The support for using the resource as a source for texture sampling in a geometry shader is written to <params>. - FRAGMENT_TEXTURE: The support for using the resource as a source for texture sampling in a fragment shader is written to <params>. - COMPUTE_TEXTURE: The support for using the resource as a source for texture sampling in a compute shader is written to <params>." For all of them, "Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource or operation is not supported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added SRGB_DECODE_ARB <pname> queryAntia Puentes2016-03-031-1/+10
| | | | | | | | | | | | From the ARB_internalformat_query2 specification: "- SRGB_DECODE_ARB: The support for toggling whether sRGB decode happens at sampling time (see EXT/ARB_texture_sRGB_decode) for the resource is returned in <params>. Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource or operation is not supported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added SRGB_{READ,WRITE} <pname> queriesAntia Puentes2016-03-031-2/+16
| | | | | | | | | | | | | | | | | | | | From the ARB_internalformat_query2 specification: "- SRGB_READ: The support for converting from sRGB colorspace on read operations (see section 3.9.18) from the resource is returned in <params>. Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource or operation is not supported, NONE is returned. - SRGB_WRITE: The support for converting to sRGB colorspace on write operations to the resource is returned in <params>. This indicates that writing to framebuffers with this internalformat will encode to sRGB color spaces when FRAMEBUFFER_SRGB is enabled (see section 4.1.8). Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource or operation is not supported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added COLOR_ENCODING <pname> query.Antia Puentes2016-03-031-1/+7
| | | | | | | | | | | | From the ARB_internalformat_query2 specification: "- COLOR_ENCODING: The color encoding for the resource is returned in <params>. Possible values for color buffers are LINEAR or SRGB, for linear or sRGB-encoded color components, respectively. For non-color formats (such as depth or stencil), or for unsupported resources, the value NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/glformats: Add a helper function _mesa_is_srgb_format()Eduardo Lima Mitev2016-03-032-0/+48
| | | | | | Returns true if the passed format is an sRGB format, false otherwise. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added mipmap related <pname> queriesAntia Puentes2016-03-031-7/+33
| | | | | | | | | | | | | | | | | | | | | | | | | Specifically MIPMAP, MANUAL_GENERATE_MIPMAP and AUTO_GENERATE_MIPMAP <pname> queries. From the ARB_internalformat_query2 specification: "- MIPMAP: If the resource supports mipmaps, TRUE is returned in <params>. If the resource is not supported, or if mipmaps are not supported for this type of resource, FALSE is returned. - MANUAL_GENERATE_MIPMAP: The support for manually generating mipmaps for the resource is returned in <params>. Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource is not supported, or if the operation is not supported, NONE is returned. - AUTO_GENERATE_MIPMAP: The support for automatic generation of mipmaps for the resource is returned in <params>. Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource is not supported, or if the operation is not supported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
* mesa/genmipmap: Added a function to validate the internalformatAntia Puentes2016-03-032-4/+15
| | | | | | | It will be used by the ARB_internalformat_query2 implementation to implement mipmap related queries. Reviewed-by: Dave Airlie <[email protected]>
* mesa/genmipmap: Added a function to check if the target is validAntia Puentes2016-03-032-13/+24
| | | | | | | It will be used by the ARB_internalformat_query2 implementation to implement mipmap related queries. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added {COLOR,DEPTH,STENCIL}_RENDERABLE <pname> queriesAntia Puentes2016-03-031-7/+15
| | | | Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added {COLOR,DEPTH,STENCIL}_COMPONENTS <pname> queriesAntia Puentes2016-03-031-3/+27
| | | | Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: support for MAX_COMBINED_DIMENSIONSAlejandro Piñeiro2016-03-031-9/+81
| | | | | | | | | | | | | | | | | | | | It is implemented combining the values returned by calls to the 32-bit query _mesa_GetInternalformati32v. The main reason is simplicity. The other option would be C&P how we implemented the support of GL_MAX_{WIDTH/HEIGHT/DEPTH} and GL_SAMPLES. Additionally, doing this way, we avoid adding checks on the code, as are done by the call to the query itself. MAX_COMBINED_DIMENSIONS is the only pname pointed on the spec of needing a 64-bit query. We handle that possibility by packing the returning value on the two first 32-bit integers of params. This would work on the 32-bit query as far as the value is not greater that INT_MAX. On the 64-bit query wrapper we unpack those values in order to get the final value. Reviewed-by: Dave Airlie <[email protected]>
* mesa/teximage: add _mesa_is_cube_map_texture utility methodEduardo Lima Mitev2016-03-032-0/+22
| | | | Reviewed-by: Dave Airlie <[email protected]>
* main/formatquery: support for MAX_{WIDTH/HEIGHT/DEPTH/LAYERS}Alejandro Piñeiro2016-03-031-8/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented by calling GetIntegerv with the equivalent pname and handling individually the exceptions related to dimensions. All those pnames are used to get the maximum value for each dimension of the given target. The only difference between this calls and calling GetInteger with pnames like GL_MAX_TEXTURE_SIZE, GL_MAX_3D_TEXTURE_SIZE, etc is that GetInternalformat allows to specify a internalformat. But at this moment, there is no reason to think that the values would be different based on the internalformat. The spec already take that into account, using these specific pnames as example on Issue 7 of arb_internalformat_query2 spec. So this seems like a hook to allow to return different values based on the internalformat in the future. It is worth to note that the piglit test associated to those pnames are checking the returned values of GetInternalformat against the values returned by GetInteger, and the test is passing with NVIDIA proprietary drivers. main/formatquery: support for MAX_{WIDTH/HEIGHT/DEPTH/LAYERS} Implemented by calling GetIntegerv with the equivalent pname and handling individually the exceptions related to dimensions. All those pnames are used to get the maximum value for each dimension of the given target. The only difference between this calls and calling GetInteger with pnames like GL_MAX_TEXTURE_SIZE, GL_MAX_3D_TEXTURE_SIZE, etc is that GetInternalformat allows to specify a internalformat. But at this moment, there is no reason to think that the values would be different based on the internalformat. The spec already take that into account, using these specific pnames as example on Issue 7 of arb_internalformat_query2 spec. So this seems like a hook to allow to return different values based on the internalformat in the future. It is worth to note that the piglit test associated to those pnames are checking the returned values of GetInternalformat against the values returned by GetInteger, and the test is passing with NVIDIA proprietary drivers. v2: use _mesa_has## instead of direct ctx->Extensions access (Nanley Chery) Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: support for IMAGE_FORMAT_COMPATIBILITY_TYPEAlejandro Piñeiro2016-03-031-2/+20
| | | | | | | | | | | | | | | | | | | | | | | From arb_internalformat_query2 spec: "IMAGE_FORMAT_COMPATIBILITY_TYPE: The matching criteria use for the resource when used as an image textures is returned in <params>. This is equivalent to calling GetTexParameter with <value> set to IMAGE_FORMAT_COMPATIBILITY_TYPE." Current implementation of GetTexParameter for this case returns a field of a texture object, so the support of this pname was implemented creating a temporal texture object and returning that value. It is worth to mention that right now that field is not reassigned after initialization. So it is somehow hardcoded. An alternative option would be return that value. That doesn't seems really scalable though. v2: use _mesa_has## instead of direct ctx->Extensions access (Nanley Chery) Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: handle unmodified buffer for SAMPLES on the 64-bit queryAlejandro Piñeiro2016-03-031-3/+14
| | | | | | | | | | | | | | | | | | | | From arb_internalformat_query2 spec: " If <internalformat> is not color-renderable, depth-renderable, or stencil-renderable (as defined in section 4.4.4), or if <target> does not support multiple samples (ie other than TEXTURE_2D_MULTISAMPLE, TEXTURE_2D_MULTISAMPLE_ARRAY, or RENDERBUFFER), <params> is not modified." So there are cases where the buffer should not be modified. As the 64-bit query is a wrapper over the 32-bit query, we can't just copy the values to the equivalent 32-bit buffer, as that would fail if the original params contained values greater that INT_MAX. So we need to copy-back only the values that got modified by the 32-bit query. We do that by filling the temporal buffer by negatives, as the 32-bit query should not return negative values ever. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: initial implementation for GetInternalformati64vAlejandro Piñeiro2016-03-031-1/+7
| | | | | | | | | It just does a wrapping on the existing 32-bit GetInternalformativ. We will maintain the 32-bit query as default as it is likely that it would be the one most used. Reviewed-by: Dave Airlie <[email protected]>
* mesa/formatquery: Added INTERNALFORMAT_{X}_{SIZE,TYPE} <pname> queriesAntia Puentes2016-03-031-37/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the ARB_internalformat_query2 spec: "- INTERNALFORMAT_RED_SIZE - INTERNALFORMAT_GREEN_SIZE - INTERNALFORMAT_BLUE_SIZE - INTERNALFORMAT_ALPHA_SIZE - INTERNALFORMAT_DEPTH_SIZE - INTERNALFORMAT_STENCIL_SIZE - INTERNALFORMAT_SHARED_SIZE For uncompressed internal formats, queries of these values return the actual resolutions that would be used for storing image array components for the resource. For compressed internal formats, the resolutions returned specify the component resolution of an uncompressed internal format that produces an image of roughly the same quality as the compressed algorithm. For textures this query will return the same information as querying GetTexLevelParameter{if}v for TEXTURE_*_SIZE would return. If the internal format is unsupported, or if a particular component is not present in the format, 0 is written to <params>. - INTERNALFORMAT_RED_TYPE - INTERNALFORMAT_GREEN_TYPE - INTERNALFORMAT_BLUE_TYPE - INTERNALFORMAT_ALPHA_TYPE - INTERNALFORMAT_DEPTH_TYPE - INTERNALFORMAT_STENCIL_TYPE For uncompressed internal formats, queries for these values return the data type used to store the component. For compressed internal formats the types returned specify how components are interpreted after decompression. For textures this query returns the same information as querying GetTexLevelParameter{if}v for TEXTURE_*TYPE would return. Possible values return include, NONE, SIGNED_NORMALIZED, UNSIGNED_NORMALIZED, FLOAT, INT, UNSIGNED_INT, representing missing, signed normalized fixed point, unsigned normalized fixed point, floating-point, signed unnormalized integer and unsigned unnormalized integer components. NONE is returned for all component types if the format is unsupported." Reviewed-by: Dave Airlie <[email protected]>
* mesa/main: Extend _mesa_get_format_bits to accept new pnamesAntia Puentes2016-03-031-0/+6
| | | | | | | | | | | | | | | | The new pnames accepted by the function are: - INTERNALFORMAT_RED_SIZE - INTERNALFORMAT_GREEN_SIZE - INTERNALFORMAT_BLUE_SIZE - INTERNALFORMAT_ALPHA_SIZE - INTERNALFORMAT_DEPTH_SIZE - INTERNALFORMAT_STENCIL_SIZE It will be used by the ARB_internalformat_query2 implementation to implement those pnames. Reviewed-by: Dave Airlie <[email protected]>