OSDN Git Service

glsl: add support for the imageSize builtin
authorMartin Peres <martin.peres@linux.intel.com>
Mon, 27 Apr 2015 16:25:34 +0000 (19:25 +0300)
committerMartin Peres <martin.peres@linux.intel.com>
Thu, 20 Aug 2015 11:07:46 +0000 (14:07 +0300)
commit58a8689717a5965919934d1b4b44b4eef0a6bf64
tree74c4a0500c67591d410dbacfc0e230ee8b3fc3fc
parent3d93f65ef2dbecbf615ee8041d92354ae660d71b
glsl: add support for the imageSize builtin

The code is heavily inspired from Francisco Jerez's code supporting the
image_load_store extension.

Backends willing to support this builtin should handle
__intrinsic_image_size.

v2: Based on the review of Ilia Mirkin
- Enable the extension for GLES 3.1
- Fix indentation
- Fix the return type (float to int, number of components for CubeImages)
- Add a warning related to GLES 3.1

v3: Based on the review of Francisco Jerez
- Refactor the code to share both add_image_function and _image with the other
  image-related functions

v4: Based on Topi Pohjolainen's comments
- Do not add parenthesis for the return value

v5: based on Francisco Jerez's comments:
- Fix a few indent issues
- Reduce the size of a condition by testing the dimension and array properties
  instead of enumerating all the formats.

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/glsl/builtin_functions.cpp