From ded57b5a4131a213d57f5a20d50b819b7a8924df Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 17 Oct 2012 08:04:15 +0200 Subject: pixman mesa git update 17 oct 2012 pixman: 6e56098c0338ce74228187e4c96fed1a66cb0956 mesa: 0199ff7fe323cf527ffacfdef3258ab85799dd13 --- mesalib/src/mesa/state_tracker/st_atom_sampler.c | 12 +- mesalib/src/mesa/state_tracker/st_cb_clear.c | 19 +++- mesalib/src/mesa/state_tracker/st_cb_program.c | 3 +- mesalib/src/mesa/state_tracker/st_extensions.c | 5 - mesalib/src/mesa/state_tracker/st_format.c | 124 ++++++++++++++------- mesalib/src/mesa/state_tracker/st_format.h | 5 +- mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 5 - mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c | 22 +--- mesalib/src/mesa/state_tracker/st_program.c | 2 - 9 files changed, 117 insertions(+), 80 deletions(-) (limited to 'mesalib/src/mesa/state_tracker') diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c index adcc7b505..3eba5b13c 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c +++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c @@ -34,6 +34,7 @@ #include "main/macros.h" #include "main/mtypes.h" +#include "main/glformats.h" #include "main/samplerobj.h" #include "main/texobj.h" @@ -172,12 +173,17 @@ convert_sampler(struct st_context *st, msamp->BorderColor.ui[2] || msamp->BorderColor.ui[3]) { struct gl_texture_image *teximg; + GLboolean is_integer = GL_FALSE; teximg = texobj->Image[0][texobj->BaseLevel]; - st_translate_color(msamp->BorderColor.f, - teximg ? teximg->_BaseFormat : GL_RGBA, - sampler->border_color.f); + if (teximg) { + is_integer = _mesa_is_enum_format_integer(teximg->InternalFormat); + } + + st_translate_color(&msamp->BorderColor, + &sampler->border_color, + teximg ? teximg->_BaseFormat : GL_RGBA, is_integer); } sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ? diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c index e731b6b5e..90eb0af4f 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_clear.c +++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c @@ -37,6 +37,7 @@ #include "main/accum.h" #include "main/formats.h" #include "main/macros.h" +#include "main/glformats.h" #include "program/prog_instruction.h" #include "st_context.h" #include "st_atom.h" @@ -301,9 +302,13 @@ clear_with_quad(struct gl_context *ctx, cso_set_geometry_shader_handle(st->cso_context, NULL); if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { - st_translate_color(ctx->Color.ClearColor.f, - ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, - clearColor.f); + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; + GLboolean is_integer = _mesa_is_enum_format_integer(rb->InternalFormat); + + st_translate_color(&ctx->Color.ClearColor, + &clearColor, + ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, + is_integer); } /* draw quad matching scissor rect */ @@ -540,9 +545,13 @@ st_Clear(struct gl_context *ctx, GLbitfield mask) clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL; if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { - st_translate_color(ctx->Color.ClearColor.f, + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; + GLboolean is_integer = _mesa_is_enum_format_integer(rb->InternalFormat); + + st_translate_color(&ctx->Color.ClearColor, + &clearColor, ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, - clearColor.f); + is_integer); } st->pipe->clear(st->pipe, clear_buffers, &clearColor, diff --git a/mesalib/src/mesa/state_tracker/st_cb_program.c b/mesalib/src/mesa/state_tracker/st_cb_program.c index 617e7ce64..e7732bdbd 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_program.c +++ b/mesalib/src/mesa/state_tracker/st_cb_program.c @@ -99,8 +99,7 @@ st_new_program(struct gl_context *ctx, GLenum target, GLuint id) return _mesa_init_vertex_program(ctx, &prog->Base, target, id); } - case GL_FRAGMENT_PROGRAM_ARB: - case GL_FRAGMENT_PROGRAM_NV: { + case GL_FRAGMENT_PROGRAM_ARB: { struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program); return _mesa_init_fragment_program(ctx, &prog->Base, target, id); } diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index d6cb915e9..08a41c3e2 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -524,11 +524,6 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.NV_texgen_reflection = GL_TRUE; ctx->Extensions.NV_texture_env_combine4 = GL_TRUE; ctx->Extensions.NV_texture_rectangle = GL_TRUE; -#if 0 - /* possibly could support the following two */ - ctx->Extensions.NV_vertex_program = GL_TRUE; - ctx->Extensions.NV_vertex_program1_1 = GL_TRUE; -#endif ctx->Extensions.OES_EGL_image = GL_TRUE; if (ctx->API != API_OPENGL) diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index a9ff2cd0d..af81f732d 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -1686,44 +1686,92 @@ st_sampler_compat_formats(enum pipe_format format1, enum pipe_format format2) * Similarly for texture border colors. */ void -st_translate_color(const GLfloat colorIn[4], GLenum baseFormat, - GLfloat colorOut[4]) +st_translate_color(union gl_color_union *colorIn, + union pipe_color_union *colorOut, + GLenum baseFormat, GLboolean is_integer) { - switch (baseFormat) { - case GL_RED: - colorOut[0] = colorIn[0]; - colorOut[1] = 0.0F; - colorOut[2] = 0.0F; - colorOut[3] = 1.0F; - break; - case GL_RG: - colorOut[0] = colorIn[0]; - colorOut[1] = colorIn[1]; - colorOut[2] = 0.0F; - colorOut[3] = 1.0F; - break; - case GL_RGB: - colorOut[0] = colorIn[0]; - colorOut[1] = colorIn[1]; - colorOut[2] = colorIn[2]; - colorOut[3] = 1.0F; - break; - case GL_ALPHA: - colorOut[0] = colorOut[1] = colorOut[2] = 0.0; - colorOut[3] = colorIn[3]; - break; - case GL_LUMINANCE: - colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0]; - colorOut[3] = 1.0; - break; - case GL_LUMINANCE_ALPHA: - colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0]; - colorOut[3] = colorIn[3]; - break; - case GL_INTENSITY: - colorOut[0] = colorOut[1] = colorOut[2] = colorOut[3] = colorIn[0]; - break; - default: - COPY_4V(colorOut, colorIn); + if (is_integer) { + int *in = colorIn->i; + int *out = colorOut->i; + + switch (baseFormat) { + case GL_RED: + out[0] = in[0]; + out[1] = 0; + out[2] = 0; + out[3] = 1; + break; + case GL_RG: + out[0] = in[0]; + out[1] = in[1]; + out[2] = 0; + out[3] = 1; + break; + case GL_RGB: + out[0] = in[0]; + out[1] = in[1]; + out[2] = in[2]; + out[3] = 1; + break; + case GL_ALPHA: + out[0] = out[1] = out[2] = 0; + out[3] = in[3]; + break; + case GL_LUMINANCE: + out[0] = out[1] = out[2] = in[0]; + out[3] = 1; + break; + case GL_LUMINANCE_ALPHA: + out[0] = out[1] = out[2] = in[0]; + out[3] = in[3]; + break; + case GL_INTENSITY: + out[0] = out[1] = out[2] = out[3] = in[0]; + break; + default: + COPY_4V(out, in); + } + } + else { + float *in = colorIn->f; + float *out = colorOut->f; + + switch (baseFormat) { + case GL_RED: + out[0] = in[0]; + out[1] = 0.0F; + out[2] = 0.0F; + out[3] = 1.0F; + break; + case GL_RG: + out[0] = in[0]; + out[1] = in[1]; + out[2] = 0.0F; + out[3] = 1.0F; + break; + case GL_RGB: + out[0] = in[0]; + out[1] = in[1]; + out[2] = in[2]; + out[3] = 1.0F; + break; + case GL_ALPHA: + out[0] = out[1] = out[2] = 0.0F; + out[3] = in[3]; + break; + case GL_LUMINANCE: + out[0] = out[1] = out[2] = in[0]; + out[3] = 1.0F; + break; + case GL_LUMINANCE_ALPHA: + out[0] = out[1] = out[2] = in[0]; + out[3] = in[3]; + break; + case GL_INTENSITY: + out[0] = out[1] = out[2] = out[3] = in[0]; + break; + default: + COPY_4V(out, in); + } } } diff --git a/mesalib/src/mesa/state_tracker/st_format.h b/mesalib/src/mesa/state_tracker/st_format.h index 2eef2c0d4..39397b17a 100644 --- a/mesalib/src/mesa/state_tracker/st_format.h +++ b/mesalib/src/mesa/state_tracker/st_format.h @@ -75,7 +75,8 @@ st_sampler_compat_formats(enum pipe_format format1, enum pipe_format format2); extern void -st_translate_color(const GLfloat colorIn[4], GLenum baseFormat, - GLfloat colorOut[4]); +st_translate_color(union gl_color_union *colorIn, + union pipe_color_union *colorOut, + GLenum baseFormat, GLboolean is_integer); #endif /* ST_FORMAT_H */ diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 852dceaf6..705f2b055 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -74,7 +74,6 @@ extern "C" { #define PROGRAM_ANY_CONST ((1 << PROGRAM_LOCAL_PARAM) | \ (1 << PROGRAM_ENV_PARAM) | \ (1 << PROGRAM_STATE_VAR) | \ - (1 << PROGRAM_NAMED_PARAM) | \ (1 << PROGRAM_CONSTANT) | \ (1 << PROGRAM_UNIFORM)) @@ -536,7 +535,6 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, case PROGRAM_LOCAL_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_STATE_VAR: - case PROGRAM_NAMED_PARAM: case PROGRAM_CONSTANT: case PROGRAM_UNIFORM: this->indirect_addr_consts = true; @@ -558,7 +556,6 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, case PROGRAM_LOCAL_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_STATE_VAR: - case PROGRAM_NAMED_PARAM: case PROGRAM_CONSTANT: case PROGRAM_UNIFORM: this->indirect_addr_consts = true; @@ -4041,7 +4038,6 @@ src_register(struct st_translate *t, t->temps[index] = ureg_DECL_local_temporary(t->ureg); return ureg_src(t->temps[index]); - case PROGRAM_NAMED_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_LOCAL_PARAM: case PROGRAM_UNIFORM: @@ -4692,7 +4688,6 @@ st_translate_program( case PROGRAM_ENV_PARAM: case PROGRAM_LOCAL_PARAM: case PROGRAM_STATE_VAR: - case PROGRAM_NAMED_PARAM: case PROGRAM_UNIFORM: t->constants[i] = ureg_DECL_constant(ureg, i); break; diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c index c614bdec5..a023058d0 100644 --- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -49,7 +49,6 @@ #define PROGRAM_ANY_CONST ((1 << PROGRAM_LOCAL_PARAM) | \ (1 << PROGRAM_ENV_PARAM) | \ (1 << PROGRAM_STATE_VAR) | \ - (1 << PROGRAM_NAMED_PARAM) | \ (1 << PROGRAM_CONSTANT) | \ (1 << PROGRAM_UNIFORM)) @@ -221,7 +220,6 @@ src_register( struct st_translate *t, t->temps[index] = ureg_DECL_temporary( t->ureg ); return ureg_src(t->temps[index]); - case PROGRAM_NAMED_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_LOCAL_PARAM: case PROGRAM_UNIFORM: @@ -543,8 +541,6 @@ translate_opcode( unsigned op ) return TGSI_OPCODE_BGNLOOP; case OPCODE_BGNSUB: return TGSI_OPCODE_BGNSUB; - case OPCODE_BRA: - return TGSI_OPCODE_BRA; case OPCODE_BRK: return TGSI_OPCODE_BRK; case OPCODE_CAL: @@ -1056,19 +1052,10 @@ st_translate_mesa_program( */ if (procType == TGSI_PROCESSOR_FRAGMENT) { for (i = 0; i < numInputs; i++) { - if (program->InputFlags[0] & PROG_PARAM_BIT_CYL_WRAP) { - t->inputs[i] = ureg_DECL_fs_input_cyl(ureg, - inputSemanticName[i], - inputSemanticIndex[i], - interpMode[i], - TGSI_CYLINDRICAL_WRAP_X); - } - else { - t->inputs[i] = ureg_DECL_fs_input(ureg, - inputSemanticName[i], - inputSemanticIndex[i], - interpMode[i]); - } + t->inputs[i] = ureg_DECL_fs_input(ureg, + inputSemanticName[i], + inputSemanticIndex[i], + interpMode[i]); } if (program->InputsRead & FRAG_BIT_WPOS) { @@ -1211,7 +1198,6 @@ st_translate_mesa_program( case PROGRAM_ENV_PARAM: case PROGRAM_LOCAL_PARAM: case PROGRAM_STATE_VAR: - case PROGRAM_NAMED_PARAM: case PROGRAM_UNIFORM: t->constants[i] = ureg_DECL_constant( ureg, i ); break; diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index ac066a766..a9111b523 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -309,7 +309,6 @@ st_translate_vertex_program(struct st_context *st, if (!stvp->glsl_to_tgsi) { _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_OUTPUT); - _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_VARYING); } ureg = ureg_create( TGSI_PROCESSOR_VERTEX ); @@ -828,7 +827,6 @@ st_translate_geometry_program(struct st_context *st, return NULL; _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_OUTPUT); - _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_VARYING); ureg = ureg_create( TGSI_PROCESSOR_GEOMETRY ); if (ureg == NULL) { -- cgit v1.2.3