[Mesa-dev] [PATCH] es2tri: Define precision in fragment shader
According to GLSL ES spec, section 4.5.2: If the precision cannot be determined by this method e.g. if an entire expression is composed only of operands with no precision qualifier, and the result is not assigned or passed as an argument, then it is evaluated at the default precision of the type or greater. When this occurs in the fragment shader, the default precision must be defined. --- src/egl/opengles2/es2tri.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/egl/opengles2/es2tri.c b/src/egl/opengles2/es2tri.c index 6dcc1b8..349a576 100644 --- a/src/egl/opengles2/es2tri.c +++ b/src/egl/opengles2/es2tri.c @@ -139,6 +139,7 @@ static void create_shaders(void) { static const char *fragShaderText = + precision mediump float;\n varying vec4 v_color;\n void main() {\n gl_FragColor = v_color;\n -- 1.7.7 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] progs/egl: Add an OpenGL ES 2.0 demo for EGL_OES_image_pixmap.
This is based on opengles1/texture_from_pixmap.c --- src/egl/opengles2/Makefile.am |4 +- src/egl/opengles2/texture_from_pixmap.c | 653 +++ 2 files changed, 656 insertions(+), 1 deletions(-) create mode 100644 src/egl/opengles2/texture_from_pixmap.c diff --git a/src/egl/opengles2/Makefile.am b/src/egl/opengles2/Makefile.am index 8d85c06..1e791fb 100644 --- a/src/egl/opengles2/Makefile.am +++ b/src/egl/opengles2/Makefile.am @@ -38,7 +38,8 @@ if HAVE_GLESV2 bin_PROGRAMS = \ es2_info \ es2gears \ - es2tri + es2tri \ + texture_from_pixmap endif endif @@ -46,3 +47,4 @@ es2_info_LDADD = $(X11_LIBS) es2tri_LDADD = $(X11_LIBS) es2gears_LDADD = ../eglut/libeglut_x11.la +texture_from_pixmap_LDADD = $(X11_LIBS) diff --git a/src/egl/opengles2/texture_from_pixmap.c b/src/egl/opengles2/texture_from_pixmap.c new file mode 100644 index 000..5e47468 --- /dev/null +++ b/src/egl/opengles2/texture_from_pixmap.c @@ -0,0 +1,653 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + *Chia-I Wu o...@lunarg.com + *Shuang He shuang...@intel.com + */ + +/* + * This demo uses EGL_KHR_image_pixmap and GL_OES_EGL_image to demonstrate + * texture-from-pixmap. + */ + +#include assert.h +#include stdlib.h +#include stdio.h +#include string.h +#include unistd.h /* for usleep */ +#include sys/time.h /* for gettimeofday */ +#include X11/Xlib.h +#include X11/Xutil.h +#include X11/keysym.h +#include GLES2/gl2.h +#include GLES2/gl2ext.h +#include EGL/egl.h +#include EGL/eglext.h + +struct app_data { + /* native */ + Display *xdpy; + Window canvas, cube; + Pixmap pix; + unsigned int width, height, depth; + GC fg, bg; + + /* EGL */ + EGLDisplay dpy; + EGLContext ctx; + EGLSurface surf; + EGLImageKHR img; + + /* OpenGL ES */ + GLuint texture; + + PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR; + PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR; + PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES; + + /* app state */ + Bool loop; + Bool redraw, reshape; + + struct { + Bool active; + unsigned long next_frame; /* in ms */ + } animate; + + struct { + Bool active; + int x1, y1; + int x2, y2; + } paint; + int prog; + int vs; + int fs; +}; + +enum pigilt_attrib_location { + PIGLIT_ATTRIB_POS, + PIGLIT_ATTRIB_TEX +}; + +static const char vertex_shader[] = +attribute vec3 pos;\n +attribute vec3 tex;\n +\n +\n +varying mediump vec2 texCoord;\n +\n +void main(void)\n +{\n +gl_Position = vec4(pos, 1.0);\n +texCoord = tex.xy;\n +}; + +static const char fragment_shader[] = +uniform sampler2D texid;\n +varying mediump vec2 texCoord;\n +\n +void main(void)\n +{\n +gl_FragColor = texture2D(texid, texCoord);\n +}; + + +static void +gl_redraw(void) +{ + float verts[4][4]; + float tex[4][2]; + float x = -0.5; + float y = -0.5; + float w = 1.0; + float h = 1.0; + float tx = 0.0; + float ty = 1.0; + float tw = 1.0; + float th = -1.0; + + verts[0][0] = x; + verts[0][1] = y; + verts[0][2] = 0.0; + verts[0][3] = 1.0; + tex[0][0] = tx; + tex[0][1] = ty; + verts[1][0] = x + w; + verts[1][1] = y; + verts[1][2] = 0.0; + verts[1][3] = 1.0; + tex[1][0] = tx + tw; + tex[1][1] = ty; + verts[2][0] = x; + verts[2][1] = y + h; + verts[2][2] = 0.0; + verts[2][3] = 1.0; + tex[2][0] = tx; + tex[2][1] = ty + th; + verts[3][0] = x + w; + verts[3][1] = y + h; + verts[3][2] = 0.0; + verts[3][3] = 1.0; + tex[3][0] = tx + tw; + tex[3][1] = ty + th; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glVertexAttribPointer(PIGLIT_ATTRIB_POS, 4, GL_FLOAT, GL_FALSE, 0, verts); + glVertexAttribPointer(PIGLIT_ATTRIB_TEX, 2, GL_FLOAT, GL_FALSE, 0, tex); + glEnableVertexAttribArray
Re: [Mesa-dev] [PATCH] tnl: Add support for datatype GL_FIXED in vertex arrays
On 2011/2/15 13:08, Eric Anholt wrote: On Tue, 8 Feb 2011 14:30:55 -0800, Chad Versacec...@chad-versace.us wrote: Before populating the vertex buffer attribute pointer (VB-AttribPtr[]), convert vertex data in GL_FIXED format to GL_FLOAT. Fixes bug: http://bugs.freedesktop.org/show_bug.cgi?id=34047 Don't suppose we have a testcase for these? It could go easily in the ARB_ES2_compat directory without needing new framework stuff. Does this mean, we don't need infrastructure to support OpenGL ES 2.0 for piglit anymore? Thanks --Shuang ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i915: Fix INTEL_DEBUG=wm segmentation fault
The program should be disassembled after it's uploaded --- src/mesa/drivers/dri/i915/i915_fragprog.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 7a9fb7f..1c6e984 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -1162,11 +1162,6 @@ translate_program(struct i915_fragment_program *p) fixup_depth_write(p); i915_fini_program(p); - if (INTEL_DEBUG DEBUG_WM) { - printf(i915:\n); - i915_disassemble_program(i915-state.Program, i915-state.ProgramSize); - } - p-translated = 1; } @@ -1427,6 +1422,11 @@ i915ValidateFragmentProgram(struct i915_context *i915) if (!p-on_hardware) i915_upload_program(i915, p); + + if (INTEL_DEBUG DEBUG_WM) { + printf(i915:\n); + i915_disassemble_program(i915-state.Program, i915-state.ProgramSize); + } } void -- 1.7.0.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Mesa (master): i965: Don't write mrf assignment for pointsize output
For you information: This commit fixes 17 OpenGL ES 2.0 conformance cases on i965 And also another 1 commit from Ken also fixes 1 case So We have 18 more passes on OpenGL ES 2.0 conformance on i965 these two days Thanks --Shuang On 2010-11-25 0:29, Kristian Høgsberg wrote: Module: Mesa Branch: master Commit: a889f9ee5cccee031c1090a6ef92cba894b1d77c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a889f9ee5cccee031c1090a6ef92cba894b1d77c Author: Kristian Høgsbergk...@bitplanet.net Date: Wed Nov 24 10:12:20 2010 -0500 i965: Don't write mrf assignment for pointsize output https://bugs.freedesktop.org/show_bug.cgi?id=31894 --- src/mesa/drivers/dri/i965/brw_vs_emit.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index a13c3ca..89e4caf 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -281,7 +281,6 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) else if (i == VERT_RESULT_PSIZ) { c-regs[PROGRAM_OUTPUT][i] = brw_vec8_grf(reg, 0); reg++; - mrf++; /* just a placeholder? XXX fix later stages remove this */ } else { /* Two restrictions on our compute-to-MRF here. The @@ -1603,6 +1602,8 @@ static void emit_vertex_write( struct brw_vs_compile *c) break; if (!(c-prog_data.outputs_written BITFIELD64_BIT(i))) continue; + if (i == VERT_RESULT_PSIZ) +continue; if (i= VERT_RESULT_TEX0 c-regs[PROGRAM_OUTPUT][i].file == BRW_GENERAL_REGISTER_FILE) { ___ mesa-commit mailing list mesa-com...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev