diff options
author | Eric Anholt <[email protected]> | 2012-03-26 14:04:48 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-04-09 14:34:27 -0700 |
commit | bb430ced7fb2aa26007637a0907d886716e8ddd6 (patch) | |
tree | 4d0e1754c561d52f1f038d815c8bb6848c4dc359 /src/glsl/builtins | |
parent | 659855252107debc47dbac8ec7985e1024d7ab5c (diff) |
glsl: Add texelFetch(*samplerBuffer) entrypoints to GLSL 1.40.
Fix texelFetch(sampler2DRect) and textureSize(samplerBuffer)
generation to not reference a LOD at the same time because it's easier
than not fixing it.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/builtins')
-rw-r--r-- | src/glsl/builtins/profiles/140.frag | 4 | ||||
-rw-r--r-- | src/glsl/builtins/profiles/140.vert | 4 | ||||
-rwxr-xr-x | src/glsl/builtins/tools/texture_builtins.py | 11 |
3 files changed, 15 insertions, 4 deletions
diff --git a/src/glsl/builtins/profiles/140.frag b/src/glsl/builtins/profiles/140.frag index da284735cce..b534827c994 100644 --- a/src/glsl/builtins/profiles/140.frag +++ b/src/glsl/builtins/profiles/140.frag @@ -714,6 +714,10 @@ uvec4 texelFetch(usampler1DArray sampler, ivec2 P, int lod); ivec4 texelFetch(isampler2DArray sampler, ivec3 P, int lod); uvec4 texelFetch(usampler2DArray sampler, ivec3 P, int lod); + vec4 texelFetch( samplerBuffer sampler, int P); +ivec4 texelFetch(isamplerBuffer sampler, int P); +uvec4 texelFetch(usamplerBuffer sampler, int P); + /* texelFetchOffset */ vec4 texelFetchOffset( sampler1D sampler, int P, int lod, int offset); ivec4 texelFetchOffset(isampler1D sampler, int P, int lod, int offset); diff --git a/src/glsl/builtins/profiles/140.vert b/src/glsl/builtins/profiles/140.vert index bfef4ed1a41..7aa92402c38 100644 --- a/src/glsl/builtins/profiles/140.vert +++ b/src/glsl/builtins/profiles/140.vert @@ -635,6 +635,10 @@ uvec4 texelFetch(usampler1DArray sampler, ivec2 P, int lod); ivec4 texelFetch(isampler2DArray sampler, ivec3 P, int lod); uvec4 texelFetch(usampler2DArray sampler, ivec3 P, int lod); + vec4 texelFetch( samplerBuffer sampler, int P); +ivec4 texelFetch(isamplerBuffer sampler, int P); +uvec4 texelFetch(usamplerBuffer sampler, int P); + /* texelFetchOffset */ vec4 texelFetchOffset( sampler1D sampler, int P, int lod, int offset); ivec4 texelFetchOffset(isampler1D sampler, int P, int lod, int offset); diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py index cd15dc4b31c..bbbbd0bd0c5 100755 --- a/src/glsl/builtins/tools/texture_builtins.py +++ b/src/glsl/builtins/tools/texture_builtins.py @@ -25,6 +25,8 @@ def get_sampler_dim(sampler_type): sampler_dim = 3 elif sampler_type == "ExternalOES": sampler_dim = 2 + elif sampler_type == "Buffer": + sampler_dim = 1 else: assert False ("coord_dim: invalid sampler_type: " + sampler_type) return sampler_dim @@ -71,7 +73,7 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0): print "\n (declare (in) " + vec_type("i" if tex_inst == "txf" else "", coord_dim + extra_dim) + " P)", if tex_inst == "txl": print "\n (declare (in) float lod)", - elif tex_inst == "txf" or (tex_inst == "txs" and "Rect" not in sampler_type): + elif ((tex_inst == "txf" or tex_inst == "txs") and "Buffer" not in sampler_type and "Rect" not in sampler_type): print "\n (declare (in) int lod)", elif tex_inst == "txd": grad_type = vec_type("", coord_dim) @@ -115,12 +117,12 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0): # Bias/explicit LOD/gradient: if tex_inst == "txb": print "(var_ref bias)", - elif tex_inst == "txs": - if "Rect" not in sampler_type: + elif tex_inst == "txs" or tex_inst == "txf": + if "Rect" not in sampler_type and "Buffer" not in sampler_type: print "(var_ref lod)", else: print "(constant int (0))" - elif tex_inst == "txl" or tex_inst == "txf": + elif tex_inst == "txl": print "(var_ref lod)", elif tex_inst == "txd": print "((var_ref dPdx) (var_ref dPdy))", @@ -255,6 +257,7 @@ def generate_texture_functions(fs): generate_fiu_sigs("txf", "3D") generate_fiu_sigs("txf", "1DArray") generate_fiu_sigs("txf", "2DArray") + generate_fiu_sigs("txf", "Buffer") end_function(fs, "texelFetch") start_function("texelFetchOffset") |