summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
Diffstat (limited to 'progs')
-rw-r--r--progs/glsl/Makefile21
-rw-r--r--progs/glsl/multitex.c93
-rw-r--r--progs/rbug/.gitignore9
-rw-r--r--progs/rbug/Makefile46
-rw-r--r--progs/rbug/README39
-rw-r--r--progs/rbug/ctx_info.c80
-rw-r--r--progs/rbug/shdr_disable.c82
-rw-r--r--progs/rbug/shdr_dump.c115
-rw-r--r--progs/rbug/shdr_info.c98
-rw-r--r--progs/rbug/simple_client.c64
-rw-r--r--progs/rbug/simple_server.c62
-rw-r--r--progs/rbug/tex_dump.c127
-rw-r--r--progs/rbug/tex_info.c78
-rw-r--r--progs/samples/prim.c7
-rw-r--r--progs/trivial/tri-z.c50
-rw-r--r--progs/util/extfuncs.h19
-rw-r--r--progs/vpglsl/psiz-imm.glsl6
-rw-r--r--progs/vpglsl/psiz-mul.glsl6
-rw-r--r--progs/vpglsl/vp-tris.c58
-rw-r--r--progs/wgl/wglinfo.c11
20 files changed, 1028 insertions, 43 deletions
diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile
index 71db895d1d..f97cdb6942 100644
--- a/progs/glsl/Makefile
+++ b/progs/glsl/Makefile
@@ -80,25 +80,26 @@ clean:
-rm -f *.o *~
-rm -f extfuncs.h
-rm -f shaderutil.*
+ -rm -f readtex.*
##### Extra dependencies
-extfuncs.h:
- cp $(TOP)/progs/util/extfuncs.h .
+extfuncs.h: $(TOP)/progs/util/extfuncs.h
+ cp $< .
-readtex.c:
- cp $(TOP)/progs/util/readtex.c .
+readtex.c: $(TOP)/progs/util/readtex.c
+ cp $< .
-readtex.h:
- cp $(TOP)/progs/util/readtex.h .
+readtex.h: $(TOP)/progs/util/readtex.h
+ cp $< .
-shaderutil.c:
- cp $(TOP)/progs/util/shaderutil.c .
+shaderutil.c: $(TOP)/progs/util/shaderutil.c
+ cp $< .
-shaderutil.h:
- cp $(TOP)/progs/util/shaderutil.h .
+shaderutil.h: $(TOP)/progs/util/shaderutil.h
+ cp $< .
diff --git a/progs/glsl/multitex.c b/progs/glsl/multitex.c
index b4be463787..1a1c63aaf4 100644
--- a/progs/glsl/multitex.c
+++ b/progs/glsl/multitex.c
@@ -51,6 +51,8 @@ static GLfloat Xrot = 0.0, Yrot = .0, Zrot = 0.0;
static GLfloat EyeDist = 10;
static GLboolean Anim = GL_TRUE;
static GLboolean UseArrays = GL_TRUE;
+static GLboolean UseVBO = GL_TRUE;
+static GLuint VBO = 0;
static GLint VertCoord_attr = -1, TexCoord0_attr = -1, TexCoord1_attr = -1;
@@ -76,28 +78,81 @@ static const GLfloat VertCoords[4][2] = {
};
+
+static void
+SetupVertexBuffer(void)
+{
+ glGenBuffersARB_func(1, &VBO);
+ glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, VBO);
+
+ glBufferDataARB_func(GL_ARRAY_BUFFER_ARB,
+ sizeof(VertCoords) +
+ sizeof(Tex0Coords) +
+ sizeof(Tex1Coords),
+ NULL,
+ GL_STATIC_DRAW_ARB);
+
+ /* non-interleaved vertex arrays */
+
+ glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB,
+ 0, /* offset */
+ sizeof(VertCoords), /* size */
+ VertCoords); /* data */
+
+ glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB,
+ sizeof(VertCoords), /* offset */
+ sizeof(Tex0Coords), /* size */
+ Tex0Coords); /* data */
+
+ glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB,
+ sizeof(VertCoords) +
+ sizeof(Tex0Coords), /* offset */
+ sizeof(Tex1Coords), /* size */
+ Tex1Coords); /* data */
+
+ glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0);
+}
+
+
static void
DrawPolygonArray(void)
{
+ void *vertPtr, *tex0Ptr, *tex1Ptr;
+
+ if (UseVBO) {
+ glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, VBO);
+ vertPtr = (void *) 0;
+ tex0Ptr = (void *) sizeof(VertCoords);
+ tex1Ptr = (void *) (sizeof(VertCoords) + sizeof(Tex0Coords));
+ }
+ else {
+ glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0);
+ vertPtr = VertCoords;
+ tex0Ptr = Tex0Coords;
+ tex1Ptr = Tex1Coords;
+ }
+
if (VertCoord_attr >= 0) {
glVertexAttribPointer_func(VertCoord_attr, 2, GL_FLOAT, GL_FALSE,
- 0, VertCoords);
+ 0, vertPtr);
glEnableVertexAttribArray_func(VertCoord_attr);
}
else {
- glVertexPointer(2, GL_FLOAT, 0, VertCoords);
+ glVertexPointer(2, GL_FLOAT, 0, vertPtr);
glEnable(GL_VERTEX_ARRAY);
}
glVertexAttribPointer_func(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE,
- 0, Tex0Coords);
+ 0, tex0Ptr);
glEnableVertexAttribArray_func(TexCoord0_attr);
glVertexAttribPointer_func(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE,
- 0, Tex1Coords);
+ 0, tex1Ptr);
glEnableVertexAttribArray_func(TexCoord1_attr);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0);
}
@@ -163,6 +218,10 @@ key(unsigned char k, int x, int y)
UseArrays = !UseArrays;
printf("Arrays: %d\n", UseArrays);
break;
+ case 'v':
+ UseVBO = !UseVBO;
+ printf("Use VBO: %d\n", UseVBO);
+ break;
case ' ':
Anim = !Anim;
if (Anim)
@@ -271,9 +330,24 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
InitUniforms(program, uniforms);
+ VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
+ if (VertCoord_attr > 0) {
+ /* We want the VertCoord attrib to have position zero so that
+ * the call to glVertexAttrib(0, xyz) triggers vertex processing.
+ * Otherwise, if TexCoord0 or TexCoord1 gets position 0 we'd have
+ * to set that attribute last (which is a PITA to manage).
+ */
+ glBindAttribLocation_func(program, 0, "VertCoord");
+ /* re-link */
+ glLinkProgram_func(program);
+ /* VertCoord_attr should be zero now */
+ VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
+ assert(VertCoord_attr == 0);
+ }
+
TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0");
TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1");
- VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
+
printf("TexCoord0_attr = %d\n", TexCoord0_attr);
printf("TexCoord1_attr = %d\n", TexCoord1_attr);
printf("VertCoord_attr = %d\n", VertCoord_attr);
@@ -299,12 +373,19 @@ InitGL(void)
/*exit(1);*/
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
-
+ printf("Usage:\n");
+ printf(" a - toggle arrays vs. immediate mode rendering\n");
+ printf(" v - toggle VBO usage for array rendering\n");
+ printf(" z/Z - change viewing distance\n");
+ printf(" SPACE - toggle animation\n");
+ printf(" Esc - exit\n");
GetExtensionFuncs();
InitTextures();
InitPrograms();
+ SetupVertexBuffer();
+
glEnable(GL_DEPTH_TEST);
glClearColor(.6, .6, .9, 0);
diff --git a/progs/rbug/.gitignore b/progs/rbug/.gitignore
new file mode 100644
index 0000000000..317290bbb3
--- /dev/null
+++ b/progs/rbug/.gitignore
@@ -0,0 +1,9 @@
+simple_client
+simple_server
+shdr_info
+shdr_dump
+shdr_disable
+ctx_info
+tex_dump
+tex_info
+*.bmp
diff --git a/progs/rbug/Makefile b/progs/rbug/Makefile
new file mode 100644
index 0000000000..8df03dd4e1
--- /dev/null
+++ b/progs/rbug/Makefile
@@ -0,0 +1,46 @@
+# progs/rbug/Makefile
+
+TOP = ../..
+include $(TOP)/configs/current
+
+INCLUDES = \
+ -I. \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium/drivers \
+ $(PROG_INCLUDES)
+
+LINKS = \
+ $(GALLIUM_AUXILIARIES) \
+ $(PROG_LINKS)
+
+SOURCES = \
+ simple_client.c \
+ simple_server.c \
+ shdr_info.c \
+ shdr_dump.c \
+ shdr_disable.c \
+ ctx_info.c \
+ tex_info.c \
+ tex_dump.c
+
+
+OBJECTS = $(SOURCES:.c=.o)
+
+PROGS = $(OBJECTS:.o=)
+
+##### TARGETS #####
+
+default: $(OBJECTS) $(PROGS)
+
+clean:
+ -rm -f $(PROGS)
+ -rm -f *.o
+
+##### RULES #####
+
+$(OBJECTS): %.o: %.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $(PROG_DEFINES) $< -o $@
+
+$(PROGS): %: %.o
+ $(CC) $(LDFLAGS) $< $(LINKS) -o $@
diff --git a/progs/rbug/README b/progs/rbug/README
new file mode 100644
index 0000000000..0eb0a5de9a
--- /dev/null
+++ b/progs/rbug/README
@@ -0,0 +1,39 @@
+ REMOTE DEBUGGING CLI APPLICATIONS
+
+
+= About =
+
+This directory contains a Gallium3D remote debugging cli applications.
+
+
+= Build Instructions =
+
+To build, build a normal gallium build and from this directory do the following.
+
+ make
+
+= Usage =
+
+Make sure that you driver has trace integration, see
+src/gallium/driver/trace/README for more information about that. Then from on
+the computer that you want to debug do:
+
+ export GALLIUM_RBUG=true
+
+ <launch app>
+
+From the debugging computer launch apps form this directory. Currently ip
+addresses are hardcoded and you need to edit the application, but that will
+change in the future.
+
+= Testing =
+
+The two apps simple_client and simple_server. Are unit testing of the
+connection and (de)marsheler. Just run the server first and then the client:
+
+ ./simple_server &
+ ./simple_client
+
+
+--
+Jakob Bornecrantz <jakob@vmware.com>
diff --git a/progs/rbug/ctx_info.c b/progs/rbug/ctx_info.c
new file mode 100644
index 0000000000..d72c326719
--- /dev/null
+++ b/progs/rbug/ctx_info.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 (including the next
+ * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VMWARE AND/OR THEIR SUPPLIERS 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.
+ */
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+#include "util/u_memory.h"
+#include "util/u_debug.h"
+#include "util/u_network.h"
+
+#include "rbug/rbug.h"
+
+static void talk()
+{
+ int c = u_socket_connect("localhost", 13370);
+ struct rbug_connection *con = rbug_from_socket(c);
+ struct rbug_header *header;
+ struct rbug_proto_context_list_reply *list;
+ struct rbug_proto_context_info_reply *info;
+ int i;
+
+ assert(c >= 0);
+ assert(con);
+ debug_printf("Connection get!\n");
+
+ debug_printf("Sending get contexts\n");
+ rbug_send_context_list(con, NULL);
+
+ debug_printf("Waiting for contexts\n");
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_CONTEXT_LIST_REPLY);
+ list = (struct rbug_proto_context_list_reply *)header;
+
+ debug_printf("Got contexts:\n");
+ for (i = 0; i < list->contexts_len; i++) {
+#if 0
+ rbug_send_contexts_info(con, list->contexts[i], NULL);
+
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_CONTEXT_INFO_REPLY);
+ info = (struct rbug_proto_context_info_reply *)header;
+#else
+ (void)info;
+ header = NULL;
+#endif
+
+ debug_printf("%llu\n",
+ (unsigned long long)list->contexts[i]);
+ rbug_free_header(header);
+ }
+
+ rbug_free_header(&list->header);
+ rbug_disconnect(con);
+}
+
+int main(int argc, char** argv)
+{
+ talk();
+ return 0;
+}
diff --git a/progs/rbug/shdr_disable.c b/progs/rbug/shdr_disable.c
new file mode 100644
index 0000000000..e6b12073d8
--- /dev/null
+++ b/progs/rbug/shdr_disable.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 (including the next
+ * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VMWARE AND/OR THEIR SUPPLIERS 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.
+ */
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+#include "util/u_memory.h"
+#include "util/u_debug.h"
+#include "util/u_network.h"
+
+#include "rbug/rbug.h"
+
+static void talk(rbug_context_t ctx, rbug_shader_t shdr)
+{
+ int c = u_socket_connect("localhost", 13370);
+ struct rbug_connection *con = rbug_from_socket(c);
+ struct rbug_header *header;
+
+ assert(c >= 0);
+ assert(con);
+ debug_printf("Connection get!\n");
+
+ rbug_send_shader_disable(con, ctx, shdr, true, NULL);
+
+ rbug_send_ping(con, NULL);
+
+ debug_printf("Sent waiting for reply\n");
+ header = rbug_get_message(con, NULL);
+
+ if (header->opcode != RBUG_OP_PING_REPLY)
+ debug_printf("Error\n");
+ else
+ debug_printf("Ok!\n");
+
+ rbug_free_header(header);
+ rbug_disconnect(con);
+}
+
+static void print_usage()
+{
+ printf("Usage shdr_disable <context> <shader>\n");
+ exit(-1);
+}
+
+int main(int argc, char** argv)
+{
+ long ctx;
+ long shdr;
+
+ if (argc < 3)
+ print_usage();
+
+ ctx = atol(argv[1]);
+ shdr = atol(argv[2]);
+
+ if (ctx <= 0 && ctx <= 0)
+ print_usage();
+
+ talk((uint64_t)ctx, (uint64_t)shdr);
+
+ return 0;
+}
diff --git a/progs/rbug/shdr_dump.c b/progs/rbug/shdr_dump.c
new file mode 100644
index 0000000000..8f9d758d51
--- /dev/null
+++ b/progs/rbug/shdr_dump.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 (including the next
+ * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VMWARE AND/OR THEIR SUPPLIERS 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.
+ */
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+#include "util/u_memory.h"
+#include "util/u_debug.h"
+#include "util/u_network.h"
+
+#include "rbug/rbug.h"
+
+#include "tgsi/tgsi_dump.h"
+
+static void shader_info(struct rbug_connection *con, rbug_context_t ctx)
+{
+ struct rbug_header *header;
+ struct rbug_proto_shader_list_reply *list;
+ struct rbug_proto_shader_info_reply *info;
+ int i;
+
+ debug_printf("Sending get shaders to %llu\n", (unsigned long long)ctx);
+ rbug_send_shader_list(con, ctx, NULL);
+
+ debug_printf("Waiting for shaders from %llu\n", (unsigned long long)ctx);
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_SHADER_LIST_REPLY);
+ list = (struct rbug_proto_shader_list_reply *)header;
+
+ debug_printf("Got shaders:\n");
+ for (i = 0; i < list->shaders_len; i++) {
+ rbug_send_shader_info(con, ctx, list->shaders[i], NULL);
+
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_SHADER_INFO_REPLY);
+ info = (struct rbug_proto_shader_info_reply *)header;
+
+ debug_printf("#####################################################\n");
+ debug_printf("ctx: %llu shdr: %llu disabled %u\n",
+ (unsigned long long)ctx,
+ (unsigned long long)list->shaders[i],
+ info->disabled);
+
+ /* just to be sure */
+ assert(sizeof(struct tgsi_token) == 4);
+
+ debug_printf("-----------------------------------------------------\n");
+ tgsi_dump((struct tgsi_token *)info->original, 0);
+
+ if (info->replaced_len > 0) {
+ debug_printf("-----------------------------------------------------\n");
+ tgsi_dump((struct tgsi_token *)info->replaced, 0);
+ }
+
+ rbug_free_header(header);
+ }
+
+ debug_printf("#####################################################\n");
+ rbug_free_header(&list->header);
+}
+
+static void talk()
+{
+ int c = u_socket_connect("localhost", 13370);
+ struct rbug_connection *con = rbug_from_socket(c);
+ struct rbug_header *header;
+ struct rbug_proto_context_list_reply *list;
+ int i;
+
+ assert(c >= 0);
+ assert(con);
+ debug_printf("Connection get!\n");
+
+ debug_printf("Sending get contexts\n");
+ rbug_send_context_list(con, NULL);
+
+ debug_printf("Waiting for contexts\n");
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_CONTEXT_LIST_REPLY);
+ list = (struct rbug_proto_context_list_reply *)header;
+
+ debug_printf("Got contexts:\n");
+ for (i = 0; i < list->contexts_len; i++) {
+ shader_info(con, list->contexts[i]);
+ }
+
+ rbug_free_header(&list->header);
+ rbug_disconnect(con);
+}
+
+int main(int argc, char** argv)
+{
+ talk();
+ return 0;
+}
diff --git a/progs/rbug/shdr_info.c b/progs/rbug/shdr_info.c
new file mode 100644
index 0000000000..b6864e988e
--- /dev/null
+++ b/progs/rbug/shdr_info.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 (including the next
+ * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VMWARE AND/OR THEIR SUPPLIERS 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.
+ */
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+#include "util/u_memory.h"
+#include "util/u_debug.h"
+#include "util/u_network.h"
+
+#include "rbug/rbug.h"
+
+static void shader_info(struct rbug_connection *con, rbug_context_t ctx)
+{
+ struct rbug_header *header;
+ struct rbug_proto_shader_list_reply *list;
+ struct rbug_proto_shader_info_reply *info;
+ int i;
+
+ rbug_send_shader_list(con, ctx, NULL);
+
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_SHADER_LIST_REPLY);
+ list = (struct rbug_proto_shader_list_reply *)header;
+
+ debug_printf(" context | shader | disabled |\n");
+ for (i = 0; i < list->shaders_len; i++) {
+ rbug_send_shader_info(con, ctx, list->shaders[i], NULL);
+
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_SHADER_INFO_REPLY);
+ info = (struct rbug_proto_shader_info_reply *)header;
+
+ debug_printf("% 15llu |% 15llu |% 15u |\n",
+ (unsigned long long)ctx,
+ (unsigned long long)list->shaders[i],
+ (unsigned)info->disabled);
+
+ rbug_free_header(header);
+ }
+
+ rbug_free_header(&list->header);
+}
+
+static void talk()
+{
+ int c = u_socket_connect("localhost", 13370);
+ struct rbug_connection *con = rbug_from_socket(c);
+ struct rbug_header *header;
+ struct rbug_proto_context_list_reply *list;
+ int i;
+
+ assert(c >= 0);
+ assert(con);
+ debug_printf("Connection get!\n");
+
+ debug_printf("Sending get contexts\n");
+ rbug_send_context_list(con, NULL);
+
+ debug_printf("Waiting for contexts\n");
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_CONTEXT_LIST_REPLY);
+ list = (struct rbug_proto_context_list_reply *)header;
+
+ debug_printf("Got contexts:\n");
+ for (i = 0; i < list->contexts_len; i++) {
+ shader_info(con, list->contexts[i]);
+ }
+
+ rbug_free_header(&list->header);
+ rbug_disconnect(con);
+}
+
+int main(int argc, char** argv)
+{
+ talk();
+ return 0;
+}
diff --git a/progs/rbug/simple_client.c b/progs/rbug/simple_client.c
new file mode 100644
index 0000000000..38929fa796
--- /dev/null
+++ b/progs/rbug/simple_client.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 (including the next
+ * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VMWARE AND/OR THEIR SUPPLIERS 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.
+ */
+
+#include "pipe/p_compiler.h"
+#include "util/u_memory.h"
+#include "util/u_debug.h"
+#include "util/u_network.h"
+
+#include "rbug/rbug.h"
+
+static void talk()
+{
+ int c = u_socket_connect("localhost", 13370);
+ struct rbug_connection *con = rbug_from_socket(c);
+ struct rbug_header *header;
+ struct rbug_proto_texture_list_reply *list;
+ int i;
+
+ assert(c >= 0);
+ assert(con);
+ debug_printf("Connection get!\n");
+
+ debug_printf("Sending get textures\n");
+ rbug_send_texture_list(con, NULL);
+
+ debug_printf("Waiting for textures\n");
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_TEXTURE_LIST_REPLY);
+ list = (struct rbug_proto_texture_list_reply *)header;
+
+ debug_printf("Got textures:\n");
+ for (i = 0; i < list->textures_len; i++)
+ debug_printf("\ttex %llu\n", (unsigned long long)list->textures[i]);
+
+ rbug_free_header(header);
+ rbug_disconnect(con);
+}
+
+int main(int argc, char** argv)
+{
+ talk();
+ return 0;
+}
diff --git a/progs/rbug/simple_server.c b/progs/rbug/simple_server.c
new file mode 100644
index 0000000000..04380c3310
--- /dev/null
+++ b/progs/rbug/simple_server.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 (including the next
+ * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VMWARE AND/OR THEIR SUPPLIERS 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.
+ */
+
+#include "pipe/p_compiler.h"
+#include "util/u_memory.h"
+#include "util/u_debug.h"
+#include "util/u_network.h"
+
+#include "rbug/rbug.h"
+
+static void wait()
+{
+ int s = u_socket_listen_on_port(13370);
+ int c = u_socket_accept(s);
+ struct rbug_connection *con = rbug_from_socket(c);
+ struct rbug_header *header;
+ rbug_texture_t texs[2];
+ uint32_t serial;
+ texs[0] = 1337;
+ texs[1] = 7331;
+
+ assert(s >= 0);
+ assert(c >= 0);
+ assert(con);
+ debug_printf("Connection get!\n");
+
+ debug_printf("Waiting for get textures\n");
+ header = rbug_get_message(con, &serial);
+ assert(header);
+ assert(header->opcode == RBUG_OP_TEXTURE_LIST);
+ rbug_free_header(header);
+
+ rbug_send_texture_list_reply(con, serial, texs, 2, NULL);
+ rbug_disconnect(con);
+}
+
+int main(int argc, char** argv)
+{
+ wait();
+ return 0;
+}
diff --git a/progs/rbug/tex_dump.c b/progs/rbug/tex_dump.c
new file mode 100644
index 0000000000..f9e06ee994
--- /dev/null
+++ b/progs/rbug/tex_dump.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 (including the next
+ * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VMWARE AND/OR THEIR SUPPLIERS 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.
+ */
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+#include "pipe/p_state.h"
+#include "util/u_memory.h"
+#include "util/u_debug.h"
+#include "util/u_network.h"
+#include "util/u_tile.h"
+#include "rbug/rbug.h"
+
+static void dump(rbug_texture_t tex,
+ struct rbug_proto_texture_info_reply *info,
+ struct rbug_proto_texture_read_reply *read,
+ int mip)
+{
+ enum pipe_format format = info->format;
+ uint8_t *data = read->data;
+ unsigned width = info->width[mip];
+ unsigned height = info->height[mip];
+ unsigned dst_stride = width * 4 * 4;
+ unsigned src_stride = read->stride;
+ float *rgba = MALLOC(dst_stride * height);
+ int i;
+ char filename[512];
+
+ util_snprintf(filename, 512, "%llu_%s_%u.bmp",
+ (unsigned long long)tex, pf_name(info->format), mip);
+
+ if (pf_is_compressed(info->format)) {
+ debug_printf("skipping: %s\n", filename);
+ return;
+ }
+
+ debug_printf("saving: %s\n", filename);
+
+ for (i = 0; i < height; i++) {
+ pipe_tile_raw_to_rgba(format, data + src_stride * i,
+ width, 1,
+ &rgba[width*4*i], dst_stride);
+ }
+
+ debug_dump_float_rgba_bmp(filename, width, height, rgba, width);
+
+ FREE(rgba);
+}
+
+static void talk()
+{
+ int c = u_socket_connect("localhost", 13370);
+ struct rbug_connection *con = rbug_from_socket(c);
+ struct rbug_header *header;
+ struct rbug_header *header2;
+ struct rbug_proto_texture_list_reply *list;
+ struct rbug_proto_texture_info_reply *info;
+ struct rbug_proto_texture_read_reply *read;
+ int i, j;
+
+ assert(c >= 0);
+ assert(con);
+ debug_printf("Connection get!\n");
+
+ debug_printf("Sending get textures\n");
+ rbug_send_texture_list(con, NULL);
+
+ debug_printf("Waiting for textures\n");
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_TEXTURE_LIST_REPLY);
+ list = (struct rbug_proto_texture_list_reply *)header;
+
+ debug_printf("Got textures:\n");
+ for (i = 0; i < list->textures_len; i++) {
+ rbug_send_texture_info(con, list->textures[i], NULL);
+
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_TEXTURE_INFO_REPLY);
+ info = (struct rbug_proto_texture_info_reply *)header;
+
+ for (j = 0; j <= info->last_level; j++) {
+ rbug_send_texture_read(con, list->textures[i],
+ 0, j, 0,
+ 0, 0, info->width[j], info->height[j],
+ NULL);
+
+ header2 = rbug_get_message(con, NULL);
+ assert(header2->opcode == RBUG_OP_TEXTURE_READ_REPLY);
+ read = (struct rbug_proto_texture_read_reply *)header2;
+
+ dump(list->textures[i], info, read, j);
+
+ rbug_free_header(header2);
+ }
+
+ rbug_free_header(header);
+
+ }
+ rbug_free_header(&list->header);
+ rbug_disconnect(con);
+}
+
+int main(int argc, char** argv)
+{
+ talk();
+ return 0;
+}
diff --git a/progs/rbug/tex_info.c b/progs/rbug/tex_info.c
new file mode 100644
index 0000000000..4a21bae359
--- /dev/null
+++ b/progs/rbug/tex_info.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 (including the next
+ * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VMWARE AND/OR THEIR SUPPLIERS 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.
+ */
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+#include "util/u_memory.h"
+#include "util/u_debug.h"
+#include "util/u_network.h"
+
+#include "rbug/rbug.h"
+
+static void talk()
+{
+ int c = u_socket_connect("localhost", 13370);
+ struct rbug_connection *con = rbug_from_socket(c);
+ struct rbug_header *header;
+ struct rbug_proto_texture_list_reply *list;
+ struct rbug_proto_texture_info_reply *info;
+ int i;
+
+ assert(c >= 0);
+ assert(con);
+ debug_printf("Connection get!\n");
+
+ debug_printf("Sending get textures\n");
+ rbug_send_texture_list(con, NULL);
+
+ debug_printf("Waiting for textures\n");
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_TEXTURE_LIST_REPLY);
+ list = (struct rbug_proto_texture_list_reply *)header;
+
+ debug_printf("Got textures:\n");
+ for (i = 0; i < list->textures_len; i++) {
+ rbug_send_texture_info(con, list->textures[i], NULL);
+
+ header = rbug_get_message(con, NULL);
+ assert(header->opcode == RBUG_OP_TEXTURE_INFO_REPLY);
+ info = (struct rbug_proto_texture_info_reply *)header;
+
+ debug_printf("%llu %s %u x %u x %u, block(%ux%u %u), last_level: %u, nr_samples: %u, usage: %u\n",
+ (unsigned long long)list->textures[i], pf_name(info->format),
+ info->width[0], info->height[0], info->depth[0],
+ info->blockw, info->blockh, info->blocksize,
+ info->last_level, info->nr_samples, info->tex_usage);
+ rbug_free_header(header);
+ }
+
+ rbug_free_header(&list->header);
+ rbug_disconnect(con);
+}
+
+int main(int argc, char** argv)
+{
+ talk();
+ return 0;
+}
diff --git a/progs/samples/prim.c b/progs/samples/prim.c
index f47c60faef..c04750725f 100644
--- a/progs/samples/prim.c
+++ b/progs/samples/prim.c
@@ -466,25 +466,22 @@ static void Draw(void)
} else {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
-#if 01
+
Viewport(0, 0); Point();
Viewport(0, 1); Lines();
Viewport(0, 2); LineStrip();
Viewport(0, 3); LineLoop();
Viewport(1, 0); Bitmap();
-
Viewport(1, 1); TriangleFan();
Viewport(1, 2); Triangles();
Viewport(1, 3); TriangleStrip();
Viewport(2, 0); Rect();
-#endif
Viewport(2, 1); PolygonFunc();
-#if 01
Viewport(2, 2); Quads();
Viewport(2, 3); QuadStrip();
-#endif
+
glFlush();
if (doubleBuffer) {
diff --git a/progs/trivial/tri-z.c b/progs/trivial/tri-z.c
index 335d2b90e2..014aaa071a 100644
--- a/progs/trivial/tri-z.c
+++ b/progs/trivial/tri-z.c
@@ -57,13 +57,19 @@ static struct { GLenum func; const char *str; } funcs[] =
static int curFunc = 0;
static double clearVal = 1.0;
-
+static float minZ = 0.0;
+static float maxZ = 1.0;
static void usage(void)
{
- printf("t - toggle rendering order of triangles\n");
- printf("c - toggle Z clear value between 0, 1\n");
- printf("f - cycle through depth test functions\n");
+ printf("t - toggle rendering order of triangles\n");
+ printf("c - toggle Z clear value between 0, 1\n");
+ printf("f - cycle through depth test functions\n");
+ printf("n/N - decrease/increase depthrange minZ\n");
+ printf("x/X - decrease/increase depthrange maxZ\n");
+ printf("spc - reset\n");
+ printf("z - set to reverse-direction (ztrick) mode\n");
+ fflush(stdout);
}
@@ -97,9 +103,11 @@ static void drawRightTriangle(void)
void display(void)
{
- printf("GL_CLEAR_DEPTH = %f GL_DEPTH_FUNC = %s\n",
- clearVal, funcs[curFunc].str);
+ printf("GL_CLEAR_DEPTH = %.2f, GL_DEPTH_FUNC = %s, DepthRange(%.1f, %.1f)\n",
+ clearVal, funcs[curFunc].str, minZ, maxZ);
+ fflush(stdout);
glClearDepth(clearVal);
+ glDepthRange(minZ, maxZ);
glDepthFunc(funcs[curFunc].func);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -131,27 +139,49 @@ void reshape(int w, int h)
void keyboard(unsigned char key, int x, int y)
{
switch (key) {
+ case 'n':
+ minZ -= .1;
+ break;
+ case 'N':
+ minZ += .1;
+ break;
+ case 'x':
+ maxZ -= .1;
+ break;
+ case 'X':
+ maxZ += .1;
+ break;
case 'c':
case 'C':
clearVal = 1.0 - clearVal;
- glutPostRedisplay();
break;
case 'f':
case 'F':
curFunc = (curFunc + 1) % NUM_FUNCS;
- glutPostRedisplay();
break;
case 't':
case 'T':
leftFirst = !leftFirst;
- glutPostRedisplay();
+ break;
+ case ' ':
+ curFunc = 0;
+ clearVal = 1.0;
+ minZ = 0.0;
+ maxZ = 1.0;
+ break;
+ case 'z':
+ curFunc = 2;
+ clearVal = 0.0;
+ minZ = 1.0;
+ maxZ = 0.0;
break;
case 27: /* Escape key */
exit(0);
break;
default:
- break;
+ return;
}
+ glutPostRedisplay();
}
/* Main Loop
diff --git a/progs/util/extfuncs.h b/progs/util/extfuncs.h
index 070414e294..238794d55a 100644
--- a/progs/util/extfuncs.h
+++ b/progs/util/extfuncs.h
@@ -86,6 +86,15 @@ static PFNGLISVERTEXARRAYAPPLEPROC glIsVertexArrayAPPLE_func = NULL;
/* GL_EXT_stencil_two_side */
static PFNGLACTIVESTENCILFACEEXTPROC glActiveStencilFaceEXT_func = NULL;
+/* GL_ARB_buffer_object */
+static PFNGLGENBUFFERSARBPROC glGenBuffersARB_func = NULL;
+static PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB_func = NULL;
+static PFNGLBINDBUFFERARBPROC glBindBufferARB_func = NULL;
+static PFNGLBUFFERDATAARBPROC glBufferDataARB_func = NULL;
+static PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB_func = NULL;
+static PFNGLMAPBUFFERARBPROC glMapBufferARB_func = NULL;
+static PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB_func = NULL;
+
static void
GetExtensionFuncs(void)
@@ -173,5 +182,15 @@ GetExtensionFuncs(void)
/* GL_EXT_stencil_two_side */
glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC) glutGetProcAddress("glActiveStencilFaceEXT");
+
+ /* GL_ARB_vertex_buffer_object */
+ glGenBuffersARB_func = (PFNGLGENBUFFERSARBPROC) glutGetProcAddress("glGenBuffersARB");
+ glDeleteBuffersARB_func = (PFNGLDELETEBUFFERSARBPROC) glutGetProcAddress("glDeleteBuffersARB");
+ glBindBufferARB_func = (PFNGLBINDBUFFERARBPROC) glutGetProcAddress("glBindBufferARB");
+ glBufferDataARB_func = (PFNGLBUFFERDATAARBPROC) glutGetProcAddress("glBufferDataARB");
+ glBufferSubDataARB_func = (PFNGLBUFFERSUBDATAARBPROC) glutGetProcAddress("glBufferSubDataARB");
+ glMapBufferARB_func = (PFNGLMAPBUFFERARBPROC) glutGetProcAddress("glMapBufferARB");
+ glUnmapBufferARB_func = (PFNGLUNMAPBUFFERARBPROC) glutGetProcAddress("glUnmapBufferARB");
+
}
diff --git a/progs/vpglsl/psiz-imm.glsl b/progs/vpglsl/psiz-imm.glsl
new file mode 100644
index 0000000000..101d314d58
--- /dev/null
+++ b/progs/vpglsl/psiz-imm.glsl
@@ -0,0 +1,6 @@
+
+void main() {
+ gl_FrontColor = gl_Color;
+ gl_PointSize = 2.0;
+ gl_Position = gl_Vertex;
+}
diff --git a/progs/vpglsl/psiz-mul.glsl b/progs/vpglsl/psiz-mul.glsl
new file mode 100644
index 0000000000..77f4a46b52
--- /dev/null
+++ b/progs/vpglsl/psiz-mul.glsl
@@ -0,0 +1,6 @@
+
+void main() {
+ gl_FrontColor = gl_Color;
+ gl_PointSize = 10 * gl_Color.x;
+ gl_Position = gl_Vertex;
+}
diff --git a/progs/vpglsl/vp-tris.c b/progs/vpglsl/vp-tris.c
index 9ae410bf98..b2b0508091 100644
--- a/progs/vpglsl/vp-tris.c
+++ b/progs/vpglsl/vp-tris.c
@@ -10,6 +10,10 @@
static const char *filename = NULL;
static GLuint nr_steps = 4;
+static GLuint prim = GL_TRIANGLES;
+static GLfloat psz = 1.0;
+static GLboolean pointsmooth = 0;
+static GLboolean program_point_size = 0;
static GLuint fragShader;
static GLuint vertShader;
@@ -229,6 +233,14 @@ static void subdiv( union vert *v0,
}
}
+static void enable( GLenum value, GLboolean flag )
+{
+ if (flag)
+ glEnable(value);
+ else
+ glDisable(value);
+}
+
/** Assignment */
#define ASSIGN_3V( V, V0, V1, V2 ) \
do { \
@@ -241,10 +253,13 @@ static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+ glPointSize(psz);
glUseProgram(program);
+ enable( GL_POINT_SMOOTH, pointsmooth );
+ enable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB, program_point_size );
- glBegin(GL_TRIANGLES);
+ glBegin(prim);
{
@@ -291,10 +306,41 @@ static void Key( unsigned char key, int x, int y )
(void) x;
(void) y;
switch (key) {
- case 27:
- CleanUp();
- exit(0);
- break;
+ case 'p':
+ prim = GL_POINTS;
+ break;
+ case 't':
+ prim = GL_TRIANGLES;
+ break;
+ case 's':
+ psz += .5;
+ break;
+ case 'S':
+ if (psz > .5)
+ psz -= .5;
+ break;
+ case 'm':
+ pointsmooth = !pointsmooth;
+ break;
+ case 'z':
+ program_point_size = !program_point_size;
+ break;
+ case '+':
+ nr_steps++;
+ break;
+ case '-':
+ if (nr_steps)
+ nr_steps--;
+ break;
+ case ' ':
+ psz = 1.0;
+ prim = GL_TRIANGLES;
+ nr_steps = 4;
+ break;
+ case 27:
+ CleanUp();
+ exit(0);
+ break;
}
glutPostRedisplay();
}
@@ -305,7 +351,7 @@ int main( int argc, char *argv[] )
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
+ glutCreateWindow(argv[argc-1]);
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
diff --git a/progs/wgl/wglinfo.c b/progs/wgl/wglinfo.c
index 881d35b297..864372c2f9 100644
--- a/progs/wgl/wglinfo.c
+++ b/progs/wgl/wglinfo.c
@@ -348,7 +348,6 @@ print_screen_info(HDC _hdc, GLboolean limits)
HWND win;
HGLRC ctx;
int visinfo;
- int width = 100, height = 100;
HDC hdc;
PIXELFORMATDESCRIPTOR pfd;
@@ -364,18 +363,18 @@ print_screen_info(HDC _hdc, GLboolean limits)
win = CreateWindowEx(0,
wc.lpszClassName,
"wglinfo",
- WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+ WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
- width,
- height,
NULL,
NULL,
wc.hInstance,
NULL);
if (!win) {
fprintf(stderr, "Couldn't create window");
- exit(1);
+ return;
}
hdc = GetDC(win);
@@ -476,7 +475,7 @@ print_visual_attribs_verbose(int iPixelFormat, LPPIXELFORMATDESCRIPTOR ppfd)
ppfd->dwFlags & PFD_DRAW_TO_WINDOW ? 1 : 0);
printf(" bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n",
0 /* ppfd->bufferSize */, 0 /* ppfd->level */,
- visual_render_type_name(ppfd->dwFlags),
+ visual_render_type_name(ppfd->iPixelType),
ppfd->dwFlags & PFD_DOUBLEBUFFER ? 1 : 0,
ppfd->dwFlags & PFD_STEREO ? 1 : 0);
printf(" rgba: cRedBits=%d cGreenBits=%d cBlueBits=%d cAlphaBits=%d\n",