[Mesa-dev] [PATCH 07/14] mesa: Create the default (name==0) buffer texture.
Kenneth Graunke
kenneth at whitecape.org
Wed Mar 28 20:12:14 PDT 2012
On 03/28/2012 10:58 AM, Eric Anholt wrote:
> All that should be needed is that it exists. Fixes segfaults on first
> _mesa_update_context() with a samplerBuffer-using shader active but
> without a particular buffer texture enabled.
> ---
> src/glsl/builtins/tools/texture_builtins.py | 4 +---
> src/mesa/main/texobj.c | 5 +++++
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py
> index 3a4943a..bbbbd0b 100755
> --- a/src/glsl/builtins/tools/texture_builtins.py
> +++ b/src/glsl/builtins/tools/texture_builtins.py
> @@ -73,9 +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" and "Buffer" not in sampler_type):
> - print "\n (declare (in) int lod)",
> - elif (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)
You meant to squash this into patch 6, not this one. I'm fine with the
change.
> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
> index d7dee4f..88dc3b1 100644
> --- a/src/mesa/main/texobj.c
> +++ b/src/mesa/main/texobj.c
> @@ -756,6 +756,9 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
> target = GL_TEXTURE_1D;
> break;
> case TEXTURE_BUFFER_INDEX:
> + dims = 0;
> + target = GL_TEXTURE_BUFFER;
> + break;
> case TEXTURE_EXTERNAL_INDEX:
> default:
> /* no-op */
> @@ -794,6 +797,8 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
> GL_RGBA, texFormat);
>
> switch (dims) {
> + case 0:
> + break;
> case 1:
> ctx->Driver.TexImage1D(ctx, texImage, GL_RGBA,
> width, 0,
More information about the mesa-dev
mailing list