Merge branch 'master' into radeon-rewrite

Conflicts:
	src/mesa/drivers/dri/r300/r300_context.c
	src/mesa/drivers/dri/r300/r300_texstate.c
This commit is contained in:
Michel Dänzer 2009-05-20 17:00:48 +02:00
commit b9bd1abf26
89 changed files with 1787 additions and 975 deletions

View file

@ -127,6 +127,7 @@ linux-icc \
linux-icc-static \
linux-llvm \
linux-osmesa \
linux-osmesa-static \
linux-osmesa16 \
linux-osmesa16-static \
linux-osmesa32 \
@ -327,6 +328,7 @@ GALLIUM_FILES = \
$(DIRECTORY)/src/gallium/*/*/*/SConscript \
$(DIRECTORY)/src/gallium/*/*/*/*.[ch] \
$(DIRECTORY)/src/gallium/*/*/*/*.py \
$(DIRECTORY)/src/gallium/*/*/*/*/Makefile \
$(DIRECTORY)/src/gallium/*/*/*/*/*.[ch] \
@ -402,7 +404,6 @@ DEMO_FILES = \
$(DIRECTORY)/progs/osdemos/Makefile \
$(DIRECTORY)/progs/osdemos/*.c \
$(DIRECTORY)/progs/xdemos/Makefile* \
$(DIRECTORY)/progs/xdemos/descrip.mms \
$(DIRECTORY)/progs/xdemos/*.[chf] \
$(DIRECTORY)/progs/redbook/Makefile* \
$(DIRECTORY)/progs/redbook/README \
@ -418,9 +419,6 @@ DEMO_FILES = \
$(DIRECTORY)/progs/windml/*.c \
$(DIRECTORY)/progs/windml/*.bmp \
$(DIRECTORY)/progs/ggi/*.c \
$(DIRECTORY)/windows/VC6/progs/demos/*.dsp \
$(DIRECTORY)/windows/VC6/progs/progs.dsw \
$(DIRECTORY)/windows/VC7/progs/demos/*.vcproj \
$(DIRECTORY)/windows/VC7/progs/progs.sln
GLUT_FILES = \
@ -430,14 +428,11 @@ GLUT_FILES = \
$(DIRECTORY)/src/glut/glx/depend \
$(DIRECTORY)/src/glut/glx/glut.pc.in \
$(DIRECTORY)/src/glut/glx/*def \
$(DIRECTORY)/src/glut/glx/descrip.mms \
$(DIRECTORY)/src/glut/glx/mms_depend \
$(DIRECTORY)/src/glut/glx/*.[ch] \
$(DIRECTORY)/src/glut/beos/*.[ch] \
$(DIRECTORY)/src/glut/beos/*.cpp \
$(DIRECTORY)/src/glut/beos/Makefile \
$(DIRECTORY)/src/glut/dos/*.[ch] \
$(DIRECTORY)/src/glut/dos/Makefile.DJ \
$(DIRECTORY)/src/glut/dos/PC_HW/*.[chS] \
$(DIRECTORY)/src/glut/ggi/*.[ch] \
$(DIRECTORY)/src/glut/ggi/Makefile \

View file

@ -0,0 +1,37 @@
# Configuration for building static libOSMesa.a on Linux, no Xlib driver
# This doesn't really have any Linux dependencies, so it should be usable
# on other (gcc-based) systems.
include $(TOP)/configs/default
CONFIG_NAME = linux-osmesa
# Compiler and flags
CC = gcc -m32
CXX = g++ -m32
CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS
CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
MKLIB_OPTIONS = -static
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
# Directories
SRC_DIRS = mesa glu
DRIVER_DIRS = osmesa
PROGRAM_DIRS = osdemos
# Dependencies
GL_LIB_DEPS =
OSMESA_LIB_DEPS =
GLU_LIB_DEPS =
GLUT_LIB_DEPS =
GLW_LIB_DEPS =
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
$(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm

View file

@ -11,9 +11,10 @@
<H1>News</H1>
<h2>May tbd, 2009</h2>
<h2>May 15, 2009</h2>
<p>
<a href="relnotes-7.5.html">Mesa 7.5</a> is released.
<a href="relnotes-7.4.2.html">Mesa 7.4.2</a> is released.
This is a stable release fixing bugs since the 7.4.1 release.
</p>

74
docs/relnotes-7.4.2.html Normal file
View file

@ -0,0 +1,74 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.4.2 Release Notes / May 15, 2009</H1>
<p>
Mesa 7.4.2 is a stable development release fixing bugs since the 7.4.1 release.
</p>
<p>
Mesa 7.4.2 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
172f5193154dad731387f97bd44ab68f MesaLib-7.4.2.tar.gz
b10a76e32bde4645cfc34ea0416d7d8b MesaLib-7.4.2.tar.bz2
cc6dfc2efd424cc342b84e6bcd78ce5d MesaLib-7.4.2.zip
182a7e78aa7a480b3650a5c956dbddd1 MesaDemos-7.4.2.tar.gz
bf559a0485667a3bfa4513a23501579b MesaDemos-7.4.2.tar.bz2
5379e622b65e8c22022dba34aeb6f4f9 MesaDemos-7.4.2.zip
7cc43c1c35bf6a279a16e063dea3b8c5 MesaGLUT-7.4.2.tar.gz
e0dfc44d537904a030861e5b3c760c11 MesaGLUT-7.4.2.tar.bz2
4a6cf5bbbac190d6ba97448b3098b7f4 MesaGLUT-7.4.2.zip
</pre>
<h2>Bug fixes</h2>
<ul>
<li>Fixed segfault when rendering to front buffer with DRI 1.
<li>Fixed swrast texture rectangle bug when wrap mode = GL_CLAMP_TO_BORDER and
filter mode = GL_LINEAR. (bug 21461)
<li>Fixed texture object mem leak during context destruction.
<li>Fixed a state validation bug in glCopyTex[Sub]Image()
<li>Fixed some i965 GLSL bugs.
<li>Fixed an R300 driver texture object bad memory reference.
</ul>
<h2>Driver Status</h2>
<pre>
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa/GLX (on Xlib) implements OpenGL 2.1
OSMesa (off-screen) implements OpenGL 2.1
Windows/Win32 implements OpenGL 2.1
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
SVGA unsupported
Wind River UGL unsupported
DJGPP unsupported
GGI unsupported
BeOS unsupported
Allegro unsupported
D3D unsupported
</pre>
</body>
</html>

View file

@ -46,7 +46,7 @@ tbd
<h2>New features</h2>
<ul>
<li>Gallium - this is the new architecture for OS-independent and
<li>Gallium3D - this is the new architecture for OS-independent and
API-independent 3D drivers.
Gallium3D is intended for GPUs that fully support vertex/fragment shaders.
The Gallium3D drivers currently included are:
@ -54,8 +54,10 @@ tbd
<li>softpipe - a software/reference driver
<li>i915 - Intel 915/945 driver
<li><a href="cell.html">Cell</a> - IBM/Sony/Toshiba Cell processor driver
<li>nouveau - preliminary driver for NVIDIA GPUs (still under development)
<li>r300 - preliminary driver for R300 (still under development)
<li>nouveau (for NVIDIA GPUs) and R300 for (AMD/ATI R300).
<b>PLEASE NOTE: these drivers are incomplete and still under development.
It's probably NOT worthwhile to report any bugs unless you have patches.
</b>
</ul>
<li>GL_ARB_framebuffer_object extension (software drivers, i965 driver)
<li>Reworked two-sided stencil support.

View file

@ -43,6 +43,7 @@ tbd
<ul>
<li><a href="openvg.html">OpenVG</a> front-end (state tracker for Gallium).
This was written by Zack Rusin at Tungsten Graphics.
<li>GL_APPLE_vertex_array_object for Gallium drivers and Intel DRI drivers.
</ul>

View file

@ -10,8 +10,8 @@
<p>
Mesa uses an even/odd version number scheme like the Linux kernel.
Odd numbered versions (such as 7.5) designate new developmental releases.
Even numbered versions (such as 7.4) designate stable releases.
Odd numbered versions (such as 6.5) designate new developmental releases.
Even numbered versions (such as 6.4) designate stable releases.
</p>
@ -22,6 +22,7 @@ The release notes summarize what's new or changed in each Mesa release.
<UL>
<LI><A HREF="relnotes-7.6.html">7.6 release notes</A>
<LI><A HREF="relnotes-7.5.html">7.5 release notes</A>
<LI><A HREF="relnotes-7.4.2.html">7.4.2 release notes</A>
<LI><A HREF="relnotes-7.4.1.html">7.4.1 release notes</A>
<LI><A HREF="relnotes-7.4.html">7.4 release notes</A>
<LI><A HREF="relnotes-7.3.html">7.3 release notes</A>

View file

@ -19,6 +19,7 @@ fs-tri
line
line-clip
line-cull
line-flat
line-smooth
line-stipple-wide
line-userclip
@ -130,6 +131,7 @@ tristrip-flat
vbo-drawarrays
vbo-drawelements
vbo-drawrange
vbo-noninterleaved
vp-array
vp-array-int
vp-clip
@ -139,6 +141,7 @@ vp-tri-cb
vp-tri-cb-pos
vp-tri-cb-tex
vp-tri-imm
vp-tri-invariant
vp-tri-swap
vp-tri-tex
vp-unfilled

View file

@ -60,6 +60,7 @@ static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
glutDestroyWindow(win);
exit(0);
default:
glutPostRedisplay();

View file

@ -0,0 +1,165 @@
/*
* Copyright 2009 Jakob Bornecrantz <jakob@vmware.com>
* Corbin Simpson <MostAwesomeDude@gmail.com>
*
* 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
* THE AUTHOR(S) 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. */
#ifndef TRACE_DRM_H
#define TRACE_DRM_H
#include "state_tracker/drm_api.h"
#include "trace/tr_buffer.h"
#include "trace/tr_context.h"
#include "trace/tr_screen.h"
#include "trace/tr_texture.h"
struct drm_api hooks;
static struct pipe_screen *
trace_drm_create_screen(int fd, struct drm_create_screen_arg *arg)
{
struct pipe_screen *screen;
if (arg && arg->mode != DRM_CREATE_NORMAL)
return NULL;
screen = hooks.create_screen(fd, arg);
return trace_screen_create(screen);
};
static struct pipe_context *
trace_drm_create_context(struct pipe_screen *_screen)
{
struct pipe_screen *screen;
struct pipe_context *pipe;
if (trace_enabled())
screen = trace_screen(_screen)->screen;
else
screen = _screen;
pipe = hooks.create_context(screen);
if (trace_enabled())
pipe = trace_context_create(_screen, pipe);
return pipe;
};
static boolean
trace_drm_buffer_from_texture(struct pipe_texture *_texture,
struct pipe_buffer **_buffer,
unsigned *stride)
{
struct pipe_texture *texture;
struct pipe_buffer *buffer = NULL;
boolean result;
if (trace_enabled())
texture = trace_texture(_texture)->texture;
else
texture = _texture;
result = hooks.buffer_from_texture(texture, &buffer, stride);
if (result && _buffer)
buffer = trace_buffer_create(trace_screen(texture->screen), buffer);
if (_buffer)
*_buffer = buffer;
else
pipe_buffer_reference(&buffer, NULL);
return result;
}
static struct pipe_buffer *
trace_drm_buffer_from_handle(struct pipe_screen *_screen,
const char *name,
unsigned handle)
{
struct pipe_screen *screen;
struct pipe_buffer *result;
if (trace_enabled())
screen = trace_screen(_screen)->screen;
else
screen = _screen;
result = hooks.buffer_from_handle(screen, name, handle);
if (trace_enabled())
result = trace_buffer_create(trace_screen(_screen), result);
return result;
}
static boolean
trace_drm_handle_from_buffer(struct pipe_screen *_screen,
struct pipe_buffer *_buffer,
unsigned *handle)
{
struct pipe_screen *screen;
struct pipe_buffer *buffer;
if (trace_enabled()) {
screen = trace_screen(_screen)->screen;
buffer = trace_buffer(_buffer)->buffer;
} else {
screen = _screen;
buffer = _buffer;
}
return hooks.handle_from_buffer(screen, buffer, handle);
}
static boolean
trace_drm_global_handle_from_buffer(struct pipe_screen *_screen,
struct pipe_buffer *_buffer,
unsigned *handle)
{
struct pipe_screen *screen;
struct pipe_buffer *buffer;
if (trace_enabled()) {
screen = trace_screen(_screen)->screen;
buffer = trace_buffer(_buffer)->buffer;
} else {
screen = _screen;
buffer = _buffer;
}
return hooks.global_handle_from_buffer(screen, buffer, handle);
}
struct drm_api drm_api_hooks =
{
.create_screen = trace_drm_create_screen,
.create_context = trace_drm_create_context,
.buffer_from_texture = trace_drm_buffer_from_texture,
.buffer_from_handle = trace_drm_buffer_from_handle,
.handle_from_buffer = trace_drm_handle_from_buffer,
.global_handle_from_buffer = trace_drm_global_handle_from_buffer,
};
#endif /* TRACE_DRM_H */

View file

@ -34,7 +34,6 @@ void r300_parse_chipset(struct r300_capabilities* caps)
caps->is_r500 = FALSE;
caps->num_vert_fpus = 4;
/* Note: These are not ordered by PCI ID. I leave that task to GCC,
* which will perform the ordering while collating jump tables. Instead,
* I've tried to group them according to capabilities and age. */
@ -349,7 +348,4 @@ void r300_parse_chipset(struct r300_capabilities* caps)
caps->pci_id);
break;
}
/* XXX SW TCL is broken so no forcing it off right now
caps->has_tcl = FALSE; */
}

View file

@ -34,8 +34,6 @@ struct r300_capabilities {
int family;
/* The number of vertex floating-point units */
int num_vert_fpus;
/* The number of fragment pipes */
int num_frag_pipes;
/* Whether or not TCL is physically present */
boolean has_tcl;
/* Whether or not this is an RV515 or newer; R500s have many differences

View file

@ -129,7 +129,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
if (!r300)
return NULL;
/* XXX this could be refactored now? */
r300->winsys = r300_winsys;
r300->context.winsys = (struct pipe_winsys*)r300_winsys;
@ -146,8 +145,15 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->context.is_texture_referenced = r300_is_texture_referenced;
r300->context.is_buffer_referenced = r300_is_buffer_referenced;
/* Create a Draw. This is used for vert collation and SW TCL. */
r300->draw = draw_create();
/* Enable our renderer. */
draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300));
/* Tell Draw that we can always do non-UCP clipping. */
draw_set_driver_clipping(r300->draw, TRUE);
/* Force Draw to never do viewport transform, since (again) we can do
* transform in hardware, always. */
draw_set_viewport_state(r300->draw, &r300_viewport_identity);
r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state);
r300->rs_block = CALLOC_STRUCT(r300_rs_block);

View file

@ -63,6 +63,11 @@ struct r300_rs_state {
/* Draw-specific rasterizer state */
struct pipe_rasterizer_state rs;
/* Whether or not to enable the VTE. This is referenced at the very
* last moment during emission of VTE state, to decide whether or not
* the VTE should be used for transformation. */
boolean enable_vte;
uint32_t vap_control_status; /* R300_VAP_CNTL_STATUS: 0x2140 */
uint32_t point_size; /* R300_GA_POINT_SIZE: 0x421c */
uint32_t point_minmax; /* R300_GA_POINT_MINMAX: 0x4230 */
@ -255,6 +260,11 @@ struct r300_vertex_shader {
} instructions[128]; /*< XXX magic number */
};
static struct pipe_viewport_state r300_viewport_identity = {
.scale = {1.0, 1.0, 1.0, 1.0},
.translate = {0.0, 0.0, 0.0, 0.0},
};
struct r300_context {
/* Parent class */
struct pipe_context context;

View file

@ -152,10 +152,12 @@ void r500_fs_dump(struct r500_fragment_shader* fs)
static void r300_vs_op_dump(uint32_t op)
{
if (op & 0x81) {
debug_printf("PVS_MACRO_OP_2CLK_M2X_ADD\n");
} else if (op & 0x80) {
debug_printf(" PVS_MACRO_OP_2CLK_MADD\n");
if (op & 0x80) {
if (op & 0x1) {
debug_printf("PVS_MACRO_OP_2CLK_M2X_ADD\n");
} else {
debug_printf(" PVS_MACRO_OP_2CLK_MADD\n");
}
} else if (op & 0x40) {
debug_printf("%s\n", r300_vs_me_ops[op & 0x1f]);
} else {

View file

@ -163,6 +163,7 @@ void r300_emit_fb_state(struct r300_context* r300,
BEGIN_CS((8 * fb->nr_cbufs) + (fb->zsbuf ? 8 : 0) + 4);
for (i = 0; i < fb->nr_cbufs; i++) {
tex = (struct r300_texture*)fb->cbufs[i]->texture;
assert(tex && tex->buffer && "cbuf is marked, but NULL!");
pixpitch = tex->stride / tex->tex.block.size;
OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1);
@ -177,7 +178,8 @@ void r300_emit_fb_state(struct r300_context* r300,
if (fb->zsbuf) {
tex = (struct r300_texture*)fb->zsbuf->texture;
pixpitch = (tex->stride / tex->tex.block.size);
assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
pixpitch = tex->stride / tex->tex.block.size;
OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1);
OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
@ -234,7 +236,7 @@ void r300_emit_rs_block_state(struct r300_context* r300,
}
for (i = 0; i < 8; i++) {
OUT_CS(rs->ip[i]);
debug_printf("ip %d: 0x%08x\n", i, rs->ip[i]);
/* debug_printf("ip %d: 0x%08x\n", i, rs->ip[i]); */
}
OUT_CS_REG_SEQ(R300_RS_COUNT, 2);
@ -248,11 +250,11 @@ void r300_emit_rs_block_state(struct r300_context* r300,
}
for (i = 0; i < 8; i++) {
OUT_CS(rs->inst[i]);
debug_printf("inst %d: 0x%08x\n", i, rs->inst[i]);
/* debug_printf("inst %d: 0x%08x\n", i, rs->inst[i]); */
}
debug_printf("count: 0x%08x inst_count: 0x%08x\n", rs->count,
rs->inst_count);
/* debug_printf("count: 0x%08x inst_count: 0x%08x\n", rs->count,
* rs->inst_count); */
END_CS;
}
@ -334,22 +336,22 @@ void r300_emit_vertex_format_state(struct r300_context* r300)
OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2);
OUT_CS(r300->vertex_info.vinfo.hwfmt[2]);
OUT_CS(r300->vertex_info.vinfo.hwfmt[3]);
for (i = 0; i < 4; i++) {
debug_printf("hwfmt%d: 0x%08x\n", i,
r300->vertex_info.vinfo.hwfmt[i]);
}
/* for (i = 0; i < 4; i++) {
* debug_printf("hwfmt%d: 0x%08x\n", i,
* r300->vertex_info.vinfo.hwfmt[i]);
* } */
OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0, 8);
for (i = 0; i < 8; i++) {
OUT_CS(r300->vertex_info.vap_prog_stream_cntl[i]);
debug_printf("prog_stream_cntl%d: 0x%08x\n", i,
r300->vertex_info.vap_prog_stream_cntl[i]);
/* debug_printf("prog_stream_cntl%d: 0x%08x\n", i,
* r300->vertex_info.vap_prog_stream_cntl[i]); */
}
OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_EXT_0, 8);
for (i = 0; i < 8; i++) {
OUT_CS(r300->vertex_info.vap_prog_stream_cntl_ext[i]);
debug_printf("prog_stream_cntl_ext%d: 0x%08x\n", i,
r300->vertex_info.vap_prog_stream_cntl_ext[i]);
/* debug_printf("prog_stream_cntl_ext%d: 0x%08x\n", i,
* r300->vertex_info.vap_prog_stream_cntl_ext[i]); */
}
END_CS;
}
@ -427,7 +429,11 @@ void r300_emit_viewport_state(struct r300_context* r300,
OUT_CS_32F(viewport->zscale);
OUT_CS_32F(viewport->zoffset);
OUT_CS_REG(R300_VAP_VTE_CNTL, viewport->vte_control);
if (r300->rs_state->enable_vte) {
OUT_CS_REG(R300_VAP_VTE_CNTL, viewport->vte_control);
} else {
OUT_CS_REG(R300_VAP_VTE_CNTL, 0);
}
END_CS;
}
@ -460,7 +466,6 @@ void r300_emit_dirty_state(struct r300_context* r300)
for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) {
tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]->texture;
assert(tex && tex->buffer && "cbuf is marked, but NULL!");
if (!tex->buffer) return;
r300->winsys->add_buffer(r300->winsys, tex->buffer,
0, RADEON_GEM_DOMAIN_VRAM);
}
@ -468,10 +473,16 @@ void r300_emit_dirty_state(struct r300_context* r300)
if (r300->framebuffer_state.zsbuf) {
tex = (struct r300_texture*)r300->framebuffer_state.zsbuf->texture;
assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
if (!tex->buffer) return;
r300->winsys->add_buffer(r300->winsys, tex->buffer,
0, RADEON_GEM_DOMAIN_VRAM);
}
/* ...textures... */
for (i = 0; i < r300->texture_count; i++) {
tex = r300->textures[i];
assert(tex && tex->buffer && "texture is marked, but NULL!");
r300->winsys->add_buffer(r300->winsys, tex->buffer,
RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0);
}
/* ...and vertex buffer. */
if (r300->vbo) {
r300->winsys->add_buffer(r300->winsys, r300->vbo,

View file

@ -87,23 +87,25 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
} else {
return 0;
}
return 0;
case PIPE_CAP_GLSL:
/* IN THEORY */
return 0;
if (r300screen->caps->is_r500) {
return 1;
} else {
return 0;
}
case PIPE_CAP_S3TC:
/* IN THEORY */
return 0;
case PIPE_CAP_ANISOTROPIC_FILTER:
/* IN THEORY */
return 0;
return 1;
case PIPE_CAP_POINT_SPRITE:
/* IN THEORY */
return 0;
case PIPE_CAP_MAX_RENDER_TARGETS:
return 4;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
/* IN THEORY */
return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
/* IN THEORY */
return 0;
@ -152,17 +154,20 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
static float r300_get_paramf(struct pipe_screen* pscreen, int param)
{
struct r300_screen* r300screen = r300_screen(pscreen);
switch (param) {
case PIPE_CAP_MAX_LINE_WIDTH:
case PIPE_CAP_MAX_LINE_WIDTH_AA:
/* XXX this is the biggest thing that will fit in that register.
* Perhaps the actual rendering limits are less? */
return 10922.0f;
case PIPE_CAP_MAX_POINT_WIDTH:
case PIPE_CAP_MAX_POINT_WIDTH_AA:
/* XXX this is the biggest thing that will fit in that register.
* Perhaps the actual rendering limits are less? */
return 10922.0f;
/* The maximum dimensions of the colorbuffer are our practical
* rendering limits. 2048 pixels should be enough for anybody. */
if (r300screen->caps->is_r500) {
return 4096.0f;
} else {
return 2048.0f;
}
case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
return 16.0f;
case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
@ -230,9 +235,16 @@ static boolean r300_is_format_supported(struct pipe_screen* pscreen,
case PIPE_TEXTURE_2D:
return check_tex_2d_format(format,
r300_screen(pscreen)->caps->is_r500);
case PIPE_TEXTURE_1D:
case PIPE_TEXTURE_3D:
case PIPE_TEXTURE_CUBE:
debug_printf("r300: Implementation error: Unsupported format "
"target: %d\n", target);
break;
default:
debug_printf("r300: Warning: Got unknown format target: %d\n",
format);
debug_printf("r300: Fatal: This is not a format target: %d\n",
target);
assert(0);
break;
}
@ -337,7 +349,6 @@ struct pipe_screen* r300_create_screen(struct r300_winsys* r300_winsys)
return NULL;
caps->pci_id = r300_winsys->pci_id;
caps->num_frag_pipes = r300_winsys->gb_pipes;
r300_parse_chipset(caps);

View file

@ -62,8 +62,6 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
}
/* PIPE_LOGICOP_* don't need to be translated, fortunately. */
/* XXX are logicops still allowed if blending's disabled?
* Does Gallium take care of it for us? */
if (state->logicop_enable) {
blend->rop = R300_RB3D_ROPCNTL_ROP_ENABLE |
(state->logicop_func) << R300_RB3D_ROPCNTL_ROP_SHIFT;
@ -121,7 +119,7 @@ static void r300_set_clip_state(struct pipe_context* pipe,
const struct pipe_clip_state* state)
{
struct r300_context* r300 = r300_context(pipe);
/* XXX Draw */
/* XXX add HW TCL clipping setup */
draw_flush(r300->draw);
draw_set_clip_state(r300->draw, state);
}
@ -257,6 +255,7 @@ static void r300_set_edgeflags(struct pipe_context* pipe,
const unsigned* bitfield)
{
/* XXX you know it's bad when i915 has this blank too */
/* XXX and even worse, I have no idea WTF the bitfield is */
}
static void
@ -289,6 +288,7 @@ static void* r300_create_fs_state(struct pipe_context* pipe,
/* Copy state directly into shader. */
fs->state = *shader;
fs->state.tokens = tgsi_dup_tokens(shader->tokens);
tgsi_scan_shader(shader->tokens, &fs->info);
@ -317,13 +317,15 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader)
/* Delete fragment shader state. */
static void r300_delete_fs_state(struct pipe_context* pipe, void* shader)
{
struct r3xx_fragment_shader* fs = (struct r3xx_fragment_shader*)shader;
FREE(fs->state.tokens);
FREE(shader);
}
static void r300_set_polygon_stipple(struct pipe_context* pipe,
const struct pipe_poly_stipple* state)
{
/* XXX */
/* XXX no idea how to set this up, but not terribly important */
}
/* Create a new rasterizer state based on the CSO rasterizer state.
@ -341,6 +343,8 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
/* Copy rasterizer state for Draw. */
rs->rs = *state;
rs->enable_vte = !state->bypass_vs_clip_and_viewport;
/* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL.
* Else, enable HW TCL and force Draw's TCL off. */
if (state->bypass_vs_clip_and_viewport ||
@ -555,43 +559,35 @@ static void r300_set_viewport_state(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
draw_flush(r300->draw);
/* Do the transform in HW. */
r300->viewport_state->vte_control = R300_VTX_W0_FMT;
if (r300_screen(r300->context.screen)->caps->has_tcl) {
/* Do the transform in HW. */
r300->viewport_state->vte_control = R300_VTX_W0_FMT;
if (state->scale[0] != 1.0f) {
assert(state->scale[0] != 0.0f);
r300->viewport_state->xscale = state->scale[0];
r300->viewport_state->vte_control |= R300_VPORT_X_SCALE_ENA;
}
if (state->scale[1] != 1.0f) {
assert(state->scale[1] != 0.0f);
r300->viewport_state->yscale = state->scale[1];
r300->viewport_state->vte_control |= R300_VPORT_Y_SCALE_ENA;
}
if (state->scale[2] != 1.0f) {
assert(state->scale[2] != 0.0f);
r300->viewport_state->zscale = state->scale[2];
r300->viewport_state->vte_control |= R300_VPORT_Z_SCALE_ENA;
}
if (state->translate[0] != 0.0f) {
r300->viewport_state->xoffset = state->translate[0];
r300->viewport_state->vte_control |= R300_VPORT_X_OFFSET_ENA;
}
if (state->translate[1] != 0.0f) {
r300->viewport_state->yoffset = state->translate[1];
r300->viewport_state->vte_control |= R300_VPORT_Y_OFFSET_ENA;
}
if (state->translate[2] != 0.0f) {
r300->viewport_state->zoffset = state->translate[2];
r300->viewport_state->vte_control |= R300_VPORT_Z_OFFSET_ENA;
}
} else {
r300->viewport_state->vte_control = 0;
/* Have Draw do the actual transform. */
draw_set_viewport_state(r300->draw, state);
if (state->scale[0] != 1.0f) {
assert(state->scale[0] != 0.0f);
r300->viewport_state->xscale = state->scale[0];
r300->viewport_state->vte_control |= R300_VPORT_X_SCALE_ENA;
}
if (state->scale[1] != 1.0f) {
assert(state->scale[1] != 0.0f);
r300->viewport_state->yscale = state->scale[1];
r300->viewport_state->vte_control |= R300_VPORT_Y_SCALE_ENA;
}
if (state->scale[2] != 1.0f) {
assert(state->scale[2] != 0.0f);
r300->viewport_state->zscale = state->scale[2];
r300->viewport_state->vte_control |= R300_VPORT_Z_SCALE_ENA;
}
if (state->translate[0] != 0.0f) {
r300->viewport_state->xoffset = state->translate[0];
r300->viewport_state->vte_control |= R300_VPORT_X_OFFSET_ENA;
}
if (state->translate[1] != 0.0f) {
r300->viewport_state->yoffset = state->translate[1];
r300->viewport_state->vte_control |= R300_VPORT_Y_OFFSET_ENA;
}
if (state->translate[2] != 0.0f) {
r300->viewport_state->zoffset = state->translate[2];
r300->viewport_state->vte_control |= R300_VPORT_Z_OFFSET_ENA;
}
r300->dirty_state |= R300_NEW_VIEWPORT;
@ -631,6 +627,7 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader);
/* Copy state directly into shader. */
vs->state = *shader;
vs->state.tokens = tgsi_dup_tokens(shader->tokens);
tgsi_scan_shader(shader->tokens, &vs->info);
@ -676,6 +673,7 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
draw_delete_vertex_shader(r300->draw, vs->draw);
FREE(vs->state.tokens);
FREE(shader);
} else {
draw_delete_vertex_shader(r300->draw,

View file

@ -162,26 +162,40 @@ static void r300_vs_tab_routes(struct r300_context* r300,
static void r300_vertex_psc(struct r300_context* r300,
struct r300_vertex_format* vformat)
{
struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct vertex_info* vinfo = &vformat->vinfo;
int* tab = vformat->vs_tab;
uint32_t temp;
int i;
int i, attrib_count;
debug_printf("r300: attrib count: %d\n", vinfo->num_attribs);
for (i = 0; i < vinfo->num_attribs; i++) {
debug_printf("r300: attrib: offset %d, interp %d, size %d,"
" tab %d\n", vinfo->attrib[i].src_index,
vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit,
tab[i]);
/* Vertex shaders have no semantics on their inputs,
* so PSC should just route stuff based on their info,
* and not on attrib information. */
if (r300screen->caps->has_tcl) {
attrib_count = r300->vs->info.num_inputs;
debug_printf("r300: routing %d attribs in psc for vs\n",
attrib_count);
} else {
attrib_count = vinfo->num_attribs;
debug_printf("r300: attrib count: %d\n", attrib_count);
for (i = 0; i < attrib_count; i++) {
debug_printf("r300: attrib: offset %d, interp %d, size %d,"
" tab %d\n", vinfo->attrib[i].src_index,
vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit,
tab[i]);
}
}
for (i = 0; i < vinfo->num_attribs; i++) {
for (i = 0; i < attrib_count; i++) {
/* Make sure we have a proper destination for our attribute */
assert(tab[i] != -1);
/* Add the attribute to the PSC table. */
temp = translate_vertex_data_type(vinfo->attrib[i].emit) |
(tab[i] << R300_DST_VEC_LOC_SHIFT);
temp = r300screen->caps->has_tcl ?
R300_DATA_TYPE_FLOAT_4 :
translate_vertex_data_type(vinfo->attrib[i].emit);
temp |= tab[i] << R300_DST_VEC_LOC_SHIFT;
if (i & 1) {
vformat->vap_prog_stream_cntl[i >> 1] &= 0x0000ffff;
vformat->vap_prog_stream_cntl[i >> 1] |= temp << 16;
@ -206,7 +220,6 @@ static void r300_vertex_psc(struct r300_context* r300,
/* Update the vertex format. */
static void r300_update_vertex_format(struct r300_context* r300)
{
struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct r300_vertex_format vformat;
int i;

View file

@ -353,25 +353,6 @@ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format)
/* Non-CSO state. (For now.) */
static INLINE uint32_t r300_translate_gb_pipes(int pipe_count)
{
switch (pipe_count) {
case 1:
return R300_GB_TILE_PIPE_COUNT_RV300;
break;
case 2:
return R300_GB_TILE_PIPE_COUNT_R300;
break;
case 3:
return R300_GB_TILE_PIPE_COUNT_R420_3P;
break;
case 4:
return R300_GB_TILE_PIPE_COUNT_R420;
break;
}
return 0;
}
static INLINE uint32_t translate_vertex_data_type(int type) {
switch (type) {
case EMIT_1F:

View file

@ -34,36 +34,19 @@ void r300_emit_invariant_state(struct r300_context* r300)
struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
CS_LOCALS(r300);
BEGIN_CS(30 + (caps->has_tcl ? 2: 0));
BEGIN_CS(26 + (caps->has_tcl ? 2: 0));
/*** Graphics Backend (GB) ***/
/* Various GB enables */
OUT_CS_REG(R300_GB_ENABLE, 0x0);
/* Subpixel multisampling for AA */
OUT_CS_REG(R300_GB_MSPOS0, 0x66666666);
OUT_CS_REG(R300_GB_MSPOS1, 0x66666666);
/* GB tile config and pipe setup */
OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_DISABLE |
r300_translate_gb_pipes(caps->num_frag_pipes));
OUT_CS_REG(R300_GB_MSPOS1, 0x6666666);
/* Source of fog depth */
OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W);
/* AA enable */
OUT_CS_REG(R300_GB_AA_CONFIG, 0x0);
/*** Geometry Assembly (GA) ***/
/* GA errata fixes. */
if (caps->is_r500) {
OUT_CS_REG(R300_GA_ENHANCE,
R300_GA_ENHANCE_DEADLOCK_CNTL_PREVENT_TCL |
R300_GA_ENHANCE_FASTSYNC_CNTL_ENABLE |
R500_GA_ENHANCE_REG_READWRITE_ENABLE |
R500_GA_ENHANCE_REG_NOSTALL_ENABLE);
} else {
OUT_CS_REG(R300_GA_ENHANCE,
R300_GA_ENHANCE_DEADLOCK_CNTL_PREVENT_TCL |
R300_GA_ENHANCE_FASTSYNC_CNTL_ENABLE);
}
/*** Fog (FG) ***/
OUT_CS_REG(R300_FG_FOG_BLEND, 0x0);
OUT_CS_REG(R300_FG_FOG_COLOR_R, 0x0);
@ -86,7 +69,7 @@ void r300_emit_invariant_state(struct r300_context* r300)
END_CS;
/* XXX unsorted stuff from surface_fill */
BEGIN_CS(79 + (caps->has_tcl ? 7 : 0));
BEGIN_CS(77 + (caps->has_tcl ? 7 : 0));
/* Flush PVS. */
OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
@ -113,11 +96,14 @@ void r300_emit_invariant_state(struct r300_context* r300)
OUT_CS_32F(0.0);
OUT_CS_REG_SEQ(R300_GA_POINT_S1, 1);
OUT_CS_32F(1.0);
/* XXX line tex stuffing */
OUT_CS_REG_SEQ(R300_GA_LINE_S0, 1);
OUT_CS_32F(0.0);
OUT_CS_REG_SEQ(R300_GA_LINE_S1, 1);
OUT_CS_32F(1.0);
OUT_CS_REG(R300_GA_TRIANGLE_STIPPLE, 0x5 |
(0x5 << R300_GA_TRIANGLE_STIPPLE_Y_SHIFT_SHIFT));
/* XXX this big chunk should be refactored into rs_state */
OUT_CS_REG(R300_GA_LINE_S0, 0x00000000);
OUT_CS_REG(R300_GA_LINE_S1, 0x3F800000);
OUT_CS_REG(R300_GA_SOLID_RG, 0x00000000);
OUT_CS_REG(R300_GA_SOLID_BA, 0x00000000);
OUT_CS_REG(R300_GA_POLY_MODE, 0x00000000);
@ -144,8 +130,6 @@ void r300_emit_invariant_state(struct r300_context* r300)
OUT_CS_REG(R300_VAP_VTX_STATE_CNTL, 0x1);
OUT_CS_REG(R300_VAP_VSM_VTX_ASSM, 0x405);
OUT_CS_REG(R300_SE_VTE_CNTL, 0x0000043F);
/* Vertex size. */
OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
/* XXX */
OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa);

View file

@ -59,6 +59,12 @@ static void r300_fs_declare(struct r300_fs_asm* assembler,
}
break;
case TGSI_FILE_OUTPUT:
/* Depth write. Mark the position of the output so we can
* identify it later. */
if (decl->Semantic.SemanticName == TGSI_SEMANTIC_POSITION) {
assembler->depth_output = decl->DeclarationRange.First;
}
break;
case TGSI_FILE_CONSTANT:
break;
case TGSI_FILE_TEMPORARY:
@ -120,6 +126,14 @@ static INLINE unsigned r300_fs_dst(struct r300_fs_asm* assembler,
return 0;
}
static INLINE boolean r300_fs_is_depr(struct r300_fs_asm* assembler,
struct tgsi_dst_register* dst)
{
return (assembler->writes_depth &&
(dst->File == TGSI_FILE_OUTPUT) &&
(dst->Index == assembler->depth_output));
}
static INLINE unsigned r500_fix_swiz(unsigned s)
{
/* For historical reasons, the swizzle values x, y, z, w, and 0 are
@ -194,11 +208,17 @@ static INLINE uint32_t r300_alpha_op(unsigned op)
static INLINE uint32_t r500_rgba_op(unsigned op)
{
switch (op) {
case TGSI_OPCODE_COS:
case TGSI_OPCODE_EX2:
case TGSI_OPCODE_LG2:
case TGSI_OPCODE_RCP:
case TGSI_OPCODE_RSQ:
case TGSI_OPCODE_SIN:
return R500_ALU_RGBA_OP_SOP;
case TGSI_OPCODE_DDX:
return R500_ALU_RGBA_OP_MDH;
case TGSI_OPCODE_DDY:
return R500_ALU_RGBA_OP_MDV;
case TGSI_OPCODE_FRC:
return R500_ALU_RGBA_OP_FRC;
case TGSI_OPCODE_DP3:
@ -224,6 +244,8 @@ static INLINE uint32_t r500_rgba_op(unsigned op)
static INLINE uint32_t r500_alpha_op(unsigned op)
{
switch (op) {
case TGSI_OPCODE_COS:
return R500_ALPHA_OP_COS;
case TGSI_OPCODE_EX2:
return R500_ALPHA_OP_EX2;
case TGSI_OPCODE_LG2:
@ -234,6 +256,12 @@ static INLINE uint32_t r500_alpha_op(unsigned op)
return R500_ALPHA_OP_RSQ;
case TGSI_OPCODE_FRC:
return R500_ALPHA_OP_FRC;
case TGSI_OPCODE_SIN:
return R500_ALPHA_OP_SIN;
case TGSI_OPCODE_DDX:
return R500_ALPHA_OP_MDH;
case TGSI_OPCODE_DDY:
return R500_ALPHA_OP_MDV;
case TGSI_OPCODE_DP3:
case TGSI_OPCODE_DP4:
case TGSI_OPCODE_DPH:
@ -302,16 +330,21 @@ static INLINE void r500_emit_alu(struct r500_fragment_shader* fs,
int i = fs->instruction_count;
if (dst->DstRegister.File == TGSI_FILE_OUTPUT) {
fs->instructions[i].inst0 = R500_INST_TYPE_OUT |
R500_ALU_OMASK(dst->DstRegister.WriteMask);
fs->instructions[i].inst0 = R500_INST_TYPE_OUT;
if (r300_fs_is_depr(assembler, dst)) {
fs->instructions[i].inst4 = R500_W_OMASK;
} else {
fs->instructions[i].inst0 |=
R500_ALU_OMASK(dst->DstRegister.WriteMask);
}
} else {
fs->instructions[i].inst0 = R500_INST_TYPE_ALU |
R500_ALU_WMASK(dst->DstRegister.WriteMask);
R500_ALU_WMASK(dst->DstRegister.WriteMask);
}
fs->instructions[i].inst0 |= R500_INST_TEX_SEM_WAIT;
fs->instructions[i].inst4 =
fs->instructions[i].inst4 |=
R500_ALPHA_ADDRD(r300_fs_dst(assembler, &dst->DstRegister));
fs->instructions[i].inst5 =
R500_ALU_RGBA_ADDRD(r300_fs_dst(assembler, &dst->DstRegister));
@ -441,6 +474,9 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs,
* AMD/ATI names for opcodes, please, as it facilitates using the
* documentation. */
switch (inst->Instruction.Opcode) {
/* XXX trig needs extra prep */
case TGSI_OPCODE_COS:
case TGSI_OPCODE_SIN:
/* The simple scalar ops. */
case TGSI_OPCODE_EX2:
case TGSI_OPCODE_LG2:
@ -452,6 +488,8 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs,
inst->FullSrcRegisters[0].SrcRegister.SwizzleW =
inst->FullSrcRegisters[0].SrcRegister.SwizzleX;
/* Fall through */
case TGSI_OPCODE_DDX:
case TGSI_OPCODE_DDY:
case TGSI_OPCODE_FRC:
r500_emit_maths(fs, assembler, inst->FullSrcRegisters,
&inst->FullDstRegisters[0], inst->Instruction.Opcode, 1);
@ -581,6 +619,8 @@ void r300_translate_fragment_shader(struct r300_context* r300,
}
/* Setup starting offset for immediates. */
assembler->imm_offset = consts->user_count;
/* Enable depth writes, if needed. */
assembler->writes_depth = fs->info.writes_z;
/* Make sure we start at the beginning of the shader. */
if (is_r500) {

View file

@ -57,6 +57,7 @@
#define R500_TEX_WMASK(x) ((x) << 11)
#define R500_ALU_WMASK(x) ((x) << 11)
#define R500_ALU_OMASK(x) ((x) << 15)
#define R500_W_OMASK (1 << 31)
/* TGSI constants. TGSI is like XML: If it can't solve your problems, you're
* not using enough of it. */
@ -99,20 +100,17 @@ struct r300_fs_asm {
unsigned imm_offset;
/* Number of immediate constants. */
unsigned imm_count;
/* Are depth writes enabled? */
boolean writes_depth;
/* Depth write offset. This is the TGSI output that corresponds to
* depth writes. */
unsigned depth_output;
};
void r300_translate_fragment_shader(struct r300_context* r300,
struct r3xx_fragment_shader* fs);
static struct r300_fragment_shader r300_passthrough_fragment_shader = {
/* XXX This is the emission code. TODO: decode
OUT_CS_REG(R300_US_CONFIG, 0);
OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0);
OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0);
OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0);
OUT_CS_REG(R300_US_CODE_ADDR_3, 0x400000);
*/
.alu_instruction_count = 1,
.tex_instruction_count = 0,
.indirections = 0,
@ -159,14 +157,6 @@ static struct r500_fragment_shader r500_passthrough_fragment_shader = {
};
static struct r300_fragment_shader r300_texture_fragment_shader = {
/* XXX This is the emission code. TODO: decode
OUT_CS_REG(R300_US_CONFIG, 0);
OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0);
OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0);
OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0);
OUT_CS_REG(R300_US_CODE_ADDR_3, 0x400000);
*/
.alu_instruction_count = 1,
.tex_instruction_count = 0,
.indirections = 0,

View file

@ -325,6 +325,8 @@ static void r300_vs_init(struct r300_vertex_shader* vs,
break;
}
}
vs->instruction_count = 0;
}
void r300_translate_vertex_shader(struct r300_context* r300,

View file

@ -23,19 +23,17 @@
#include "r300_surface.h"
static void r300_surface_setup(struct pipe_context* pipe,
struct pipe_surface* dest,
static void r300_surface_setup(struct r300_context* r300,
struct r300_texture* dest,
unsigned x, unsigned y,
unsigned w, unsigned h)
{
struct r300_context* r300 = r300_context(pipe);
struct r300_capabilities* caps = r300_screen(pipe->screen)->caps;
struct r300_texture* tex = (struct r300_texture*)dest->texture;
unsigned pixpitch = tex->stride / tex->tex.block.size;
struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
unsigned pixpitch = dest->stride / dest->tex.block.size;
CS_LOCALS(r300);
/* Make sure our target BO is okay. */
r300->winsys->add_buffer(r300->winsys, tex->buffer,
r300->winsys->add_buffer(r300->winsys, dest->buffer,
0, RADEON_GEM_DOMAIN_VRAM);
if (r300->winsys->validate(r300->winsys)) {
r300->context.flush(&r300->context, 0, NULL);
@ -46,7 +44,22 @@ static void r300_surface_setup(struct pipe_context* pipe,
r300_emit_dsa_state(r300, &dsa_clear_state);
r300_emit_rs_state(r300, &rs_clear_state);
BEGIN_CS(15);
BEGIN_CS(24);
/* Viewport setup */
OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
OUT_CS_32F((float)w);
OUT_CS_32F((float)x);
OUT_CS_32F((float)h);
OUT_CS_32F((float)y);
OUT_CS_32F(1.0);
OUT_CS_32F(0.0);
OUT_CS_REG(R300_VAP_VTE_CNTL, R300_VPORT_X_SCALE_ENA |
R300_VPORT_X_OFFSET_ENA |
R300_VPORT_Y_SCALE_ENA |
R300_VPORT_Y_OFFSET_ENA |
R300_VTX_XY_FMT | R300_VTX_Z_FMT);
/* Pixel scissors. */
OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2);
@ -71,9 +84,9 @@ static void r300_surface_setup(struct pipe_context* pipe,
/* Setup colorbuffer. */
OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0, 1);
OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
OUT_CS_RELOC(dest->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
OUT_CS_REG(R300_RB3D_COLORPITCH0, pixpitch |
r300_translate_colorformat(tex->tex.format));
r300_translate_colorformat(dest->tex.format));
OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0xf);
END_CS;
@ -110,7 +123,7 @@ static void r300_surface_fill(struct pipe_context* pipe,
return;
}
r300_surface_setup(r300, dest, x, y, w, h);
r300_surface_setup(r300, tex, x, y, w, h);
/* Vertex shader setup */
if (caps->has_tcl) {
@ -134,7 +147,7 @@ static void r300_surface_fill(struct pipe_context* pipe,
r300_emit_rs_block_state(r300, &r300_rs_block_clear_state);
}
BEGIN_CS(31);
BEGIN_CS(26);
/* VAP stream control, mapping from input memory to PVS/RS memory */
if (caps->has_tcl) {
@ -161,27 +174,21 @@ static void r300_surface_fill(struct pipe_context* pipe,
/* Disable textures */
OUT_CS_REG(R300_TX_ENABLE, 0x0);
/* Viewport setup */
OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
OUT_CS_32F(1.0);
OUT_CS_32F((float)x);
OUT_CS_32F(1.0);
OUT_CS_32F((float)y);
OUT_CS_32F(1.0);
OUT_CS_32F(0.0);
/* The size of the point we're about to draw, in sixths of pixels */
OUT_CS_REG(R300_GA_POINT_SIZE,
((h * 6) & R300_POINTSIZE_Y_MASK) |
((h * 6) & R300_POINTSIZE_Y_MASK) |
((w * 6) << R300_POINTSIZE_X_SHIFT));
/* Vertex size. */
OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
/* Packet3 with our point vertex */
OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8);
OUT_CS(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING |
(1 << R300_PRIM_NUM_VERTICES_SHIFT));
/* Position */
OUT_CS_32F(w / 2.0);
OUT_CS_32F(h / 2.0);
OUT_CS_32F(0.5);
OUT_CS_32F(0.5);
OUT_CS_32F(1.0);
OUT_CS_32F(1.0);
/* Color */
@ -190,11 +197,7 @@ static void r300_surface_fill(struct pipe_context* pipe,
OUT_CS_32F(b);
OUT_CS_32F(a);
/* XXX figure out why this is 0xA and not 0x2 */
OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA);
/* XXX OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT,
R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); */
END_CS;
@ -227,13 +230,20 @@ static void r300_surface_copy(struct pipe_context* pipe,
srcx, srcy, w, h);
}
/* Add our source texture to the BO list before emitting anything.
* r300_surface_setup will flush if needed for us. */
r300->winsys->add_buffer(r300->winsys, srctex->buffer,
RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0);
r300_surface_setup(r300, desttex, destx, desty, w, h);
r300_emit_sampler(r300, &r300_sampler_copy_state, 0);
r300_emit_texture(r300, srctex, 0);
r300_flush_textures(r300);
/* Vertex shader setup */
if (caps->has_tcl) {
r300_emit_vertex_shader(r300, &r300_texture_vertex_shader);
r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader);
} else {
BEGIN_CS(4);
OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VAP_TCL_BYPASS);
@ -253,6 +263,7 @@ static void r300_surface_copy(struct pipe_context* pipe,
r300_emit_rs_block_state(r300, &r300_rs_block_copy_state);
}
BEGIN_CS(28);
/* VAP stream control, mapping from input memory to PVS/RS memory */
if (caps->has_tcl) {
OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
@ -275,33 +286,38 @@ static void r300_surface_copy(struct pipe_context* pipe,
/* Two components of texture 0 */
OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x2);
/* Vertex size. */
OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
/* Packet3 with our texcoords */
OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8);
OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 16);
OUT_CS(R300_PRIM_TYPE_QUADS | R300_PRIM_WALK_RING |
(4 << R300_PRIM_NUM_VERTICES_SHIFT));
/* (x , y ) */
OUT_CS_32F((float)destx);
OUT_CS_32F((float)desty);
OUT_CS_32F((float)srcx);
OUT_CS_32F((float)srcy);
OUT_CS_32F((float)(destx / dest->width));
OUT_CS_32F((float)(desty / dest->height));
OUT_CS_32F((float)(srcx / dest->width));
OUT_CS_32F((float)(srcy / dest->height));
/* (x , y + h) */
OUT_CS_32F((float)destx);
OUT_CS_32F((float)(desty + h));
OUT_CS_32F((float)srcx);
OUT_CS_32F((float)(srcy + h));
OUT_CS_32F((float)(destx / dest->width));
OUT_CS_32F((float)((desty + h) / dest->height));
OUT_CS_32F((float)(srcx / dest->width));
OUT_CS_32F((float)((srcy + h) / dest->height));
/* (x + w, y + h) */
OUT_CS_32F((float)(destx + w));
OUT_CS_32F((float)(desty + h));
OUT_CS_32F((float)(srcx + w));
OUT_CS_32F((float)(srcy + h));
OUT_CS_32F((float)((destx + w) / dest->width));
OUT_CS_32F((float)((desty + h) / dest->height));
OUT_CS_32F((float)((srcx + w) / dest->width));
OUT_CS_32F((float)((srcy + h) / dest->height));
/* (x + w, y ) */
OUT_CS_32F((float)(destx + w));
OUT_CS_32F((float)desty);
OUT_CS_32F((float)(srcx + w));
OUT_CS_32F((float)srcy);
OUT_CS_32F((float)((destx + w) / dest->width));
OUT_CS_32F((float)(desty / dest->height));
OUT_CS_32F((float)((srcx + w) / dest->width));
OUT_CS_32F((float)(srcy / dest->height));
OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA);
END_CS;
r300->dirty_hw++;
}

View file

@ -45,9 +45,6 @@ struct r300_winsys {
/* PCI ID */
uint32_t pci_id;
/* GB pipe count */
uint32_t gb_pipes;
/* GART size. */
uint32_t gart_size;

View file

@ -92,6 +92,7 @@ struct softpipe_context {
* queries.
*/
uint64_t occlusion_count;
unsigned active_query_count;
/** Mapped vertex buffers */
ubyte *mapped_vbuffer[PIPE_MAX_ATTRIBS];

View file

@ -80,7 +80,7 @@ sp_build_quad_pipeline(struct softpipe_context *sp)
sp_push_quad_first( sp, sp->quad[i].blend, i );
}
if (sp->depth_stencil->depth.occlusion_count) {
if (sp->active_query_count) {
sp_push_quad_first( sp, sp->quad[i].occlusion, i );
}

View file

@ -34,6 +34,7 @@
#include "util/u_memory.h"
#include "sp_context.h"
#include "sp_query.h"
#include "sp_state.h"
struct softpipe_query {
uint64_t start;
@ -69,6 +70,8 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
struct softpipe_query *sq = softpipe_query(q);
sq->start = softpipe->occlusion_count;
softpipe->active_query_count++;
softpipe->dirty |= SP_NEW_QUERY;
}
@ -78,7 +81,9 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
struct softpipe_context *softpipe = softpipe_context( pipe );
struct softpipe_query *sq = softpipe_query(q);
softpipe->active_query_count--;
sq->end = softpipe->occlusion_count;
softpipe->dirty |= SP_NEW_QUERY;
}

View file

@ -127,6 +127,11 @@ softpipe_is_format_supported( struct pipe_screen *screen,
unsigned tex_usage,
unsigned geom_flags )
{
assert(target == PIPE_TEXTURE_1D ||
target == PIPE_TEXTURE_2D ||
target == PIPE_TEXTURE_3D ||
target == PIPE_TEXTURE_CUBE);
switch(format) {
case PIPE_FORMAT_DXT1_RGB:
case PIPE_FORMAT_DXT1_RGBA:

View file

@ -7,6 +7,7 @@ C_SOURCES = \
tr_buffer.c \
tr_context.c \
tr_dump.c \
tr_dump_state.c \
tr_screen.c \
tr_state.c \
tr_texture.c

View file

@ -8,6 +8,7 @@ trace = env.ConvenienceLibrary(
'tr_buffer.c',
'tr_context.c',
'tr_dump.c',
'tr_dump_state.c',
'tr_screen.c',
'tr_state.c',
'tr_texture.c',

View file

@ -31,11 +31,11 @@
#include "pipe/p_screen.h"
#include "tr_dump.h"
#include "tr_dump_state.h"
#include "tr_state.h"
#include "tr_buffer.h"
#include "tr_screen.h"
#include "tr_texture.h"
#include "tr_context.h"
static INLINE struct pipe_buffer *
@ -121,6 +121,9 @@ trace_context_draw_arrays(struct pipe_context *_pipe,
struct pipe_context *pipe = tr_ctx->pipe;
boolean result;
if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
return 0;
trace_dump_call_begin("pipe_context", "draw_arrays");
trace_dump_arg(ptr, pipe);
@ -150,6 +153,9 @@ trace_context_draw_elements(struct pipe_context *_pipe,
struct pipe_buffer *indexBuffer = tr_buf->buffer;
boolean result;
if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
return 0;
trace_screen_user_buffer_update(_pipe->screen, indexBuffer);
trace_dump_call_begin("pipe_context", "draw_elements");
@ -187,6 +193,9 @@ trace_context_draw_range_elements(struct pipe_context *_pipe,
struct pipe_buffer *indexBuffer = tr_buf->buffer;
boolean result;
if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
return 0;
trace_screen_user_buffer_update(_pipe->screen, indexBuffer);
trace_dump_call_begin("pipe_context", "draw_range_elements");
@ -573,23 +582,32 @@ trace_context_create_fs_state(struct pipe_context *_pipe,
trace_dump_call_end();
result = trace_shader_create(tr_ctx, state, result, TRACE_SHADER_FRAGMENT);
return result;
}
static INLINE void
trace_context_bind_fs_state(struct pipe_context *_pipe,
void *state)
void *_state)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct trace_shader *tr_shdr = trace_shader(_state);
struct pipe_context *pipe = tr_ctx->pipe;
void *state = tr_shdr ? tr_shdr->state : NULL;
trace_dump_call_begin("pipe_context", "bind_fs_state");
trace_dump_arg(ptr, pipe);
trace_dump_arg(ptr, state);
pipe->bind_fs_state(pipe, state);;
tr_ctx->curr.fs = tr_shdr;
if (tr_shdr && tr_shdr->replaced)
state = tr_shdr->replaced;
pipe->bind_fs_state(pipe, state);
trace_dump_call_end();
}
@ -597,19 +615,23 @@ trace_context_bind_fs_state(struct pipe_context *_pipe,
static INLINE void
trace_context_delete_fs_state(struct pipe_context *_pipe,
void *state)
void *_state)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct trace_shader *tr_shdr = trace_shader(_state);
struct pipe_context *pipe = tr_ctx->pipe;
void *state = tr_shdr->state;
trace_dump_call_begin("pipe_context", "delete_fs_state");
trace_dump_arg(ptr, pipe);
trace_dump_arg(ptr, state);
pipe->delete_fs_state(pipe, state);;
pipe->delete_fs_state(pipe, state);
trace_dump_call_end();
trace_shader_destroy(tr_ctx, tr_shdr);
}
@ -626,28 +648,37 @@ trace_context_create_vs_state(struct pipe_context *_pipe,
trace_dump_arg(ptr, pipe);
trace_dump_arg(shader_state, state);
result = pipe->create_vs_state(pipe, state);;
result = pipe->create_vs_state(pipe, state);
trace_dump_ret(ptr, result);
trace_dump_call_end();
result = trace_shader_create(tr_ctx, state, result, TRACE_SHADER_VERTEX);
return result;
}
static INLINE void
trace_context_bind_vs_state(struct pipe_context *_pipe,
void *state)
void *_state)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct trace_shader *tr_shdr = trace_shader(_state);
struct pipe_context *pipe = tr_ctx->pipe;
void *state = tr_shdr ? tr_shdr->state : NULL;
trace_dump_call_begin("pipe_context", "bind_vs_state");
trace_dump_arg(ptr, pipe);
trace_dump_arg(ptr, state);
tr_ctx->curr.vs = tr_shdr;
if (tr_shdr && tr_shdr->replaced)
state = tr_shdr->replaced;
pipe->bind_vs_state(pipe, state);;
trace_dump_call_end();
@ -656,10 +687,12 @@ trace_context_bind_vs_state(struct pipe_context *_pipe,
static INLINE void
trace_context_delete_vs_state(struct pipe_context *_pipe,
void *state)
void *_state)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct trace_shader *tr_shdr = trace_shader(_state);
struct pipe_context *pipe = tr_ctx->pipe;
void *state = tr_shdr->state;
trace_dump_call_begin("pipe_context", "delete_vs_state");
@ -669,6 +702,8 @@ trace_context_delete_vs_state(struct pipe_context *_pipe,
pipe->delete_vs_state(pipe, state);;
trace_dump_call_end();
trace_shader_destroy(tr_ctx, tr_shdr);
}
@ -1089,7 +1124,7 @@ trace_context_create(struct pipe_screen *_screen,
if(!pipe)
goto error1;
if(!trace_dump_trace_enabled())
if(!trace_enabled())
goto error1;
tr_scr = trace_screen(_screen);
@ -1099,6 +1134,9 @@ trace_context_create(struct pipe_screen *_screen,
if(!tr_ctx)
goto error1;
pipe_mutex_init(tr_ctx->list_mutex);
make_empty_list(&tr_ctx->shaders);
tr_ctx->base.winsys = _screen->winsys;
tr_ctx->base.screen = _screen;
tr_ctx->base.destroy = trace_context_destroy;

View file

@ -33,6 +33,7 @@
#include "util/u_debug.h"
#include "pipe/p_context.h"
#include "tr_screen.h"
#ifdef __cplusplus
extern "C" {
@ -45,7 +46,19 @@ struct trace_context
struct pipe_context *pipe;
/* current state */
struct {
struct trace_shader *fs;
struct trace_shader *vs;
} curr;
/* for list on screen */
struct tr_list list;
/* list of state objects */
pipe_mutex list_mutex;
unsigned num_shaders;
struct tr_list shaders;
};

View file

@ -0,0 +1,490 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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 "tgsi/tgsi_dump.h"
#include "tr_dump.h"
#include "tr_dump_state.h"
void trace_dump_format(enum pipe_format format)
{
trace_dump_enum(pf_name(format) );
}
void trace_dump_block(const struct pipe_format_block *block)
{
trace_dump_struct_begin("pipe_format_block");
trace_dump_member(uint, block, size);
trace_dump_member(uint, block, width);
trace_dump_member(uint, block, height);
trace_dump_struct_end();
}
static void trace_dump_reference(const struct pipe_reference *reference)
{
trace_dump_struct_begin("pipe_reference");
trace_dump_member(int, &reference->count, count);
trace_dump_struct_end();
}
void trace_dump_template(const struct pipe_texture *templat)
{
if(!templat) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_texture");
trace_dump_member(int, templat, target);
trace_dump_member(format, templat, format);
trace_dump_member_begin("width");
trace_dump_array(uint, templat->width, 1);
trace_dump_member_end();
trace_dump_member_begin("height");
trace_dump_array(uint, templat->height, 1);
trace_dump_member_end();
trace_dump_member_begin("depth");
trace_dump_array(uint, templat->depth, 1);
trace_dump_member_end();
trace_dump_member_begin("block");
trace_dump_block(&templat->block);
trace_dump_member_end();
trace_dump_member(uint, templat, last_level);
trace_dump_member(uint, templat, tex_usage);
trace_dump_struct_end();
}
void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_rasterizer_state");
trace_dump_member(bool, state, flatshade);
trace_dump_member(bool, state, light_twoside);
trace_dump_member(uint, state, front_winding);
trace_dump_member(uint, state, cull_mode);
trace_dump_member(uint, state, fill_cw);
trace_dump_member(uint, state, fill_ccw);
trace_dump_member(bool, state, offset_cw);
trace_dump_member(bool, state, offset_ccw);
trace_dump_member(bool, state, scissor);
trace_dump_member(bool, state, poly_smooth);
trace_dump_member(bool, state, poly_stipple_enable);
trace_dump_member(bool, state, point_smooth);
trace_dump_member(bool, state, point_sprite);
trace_dump_member(bool, state, point_size_per_vertex);
trace_dump_member(bool, state, multisample);
trace_dump_member(bool, state, line_smooth);
trace_dump_member(bool, state, line_stipple_enable);
trace_dump_member(uint, state, line_stipple_factor);
trace_dump_member(uint, state, line_stipple_pattern);
trace_dump_member(bool, state, line_last_pixel);
trace_dump_member(bool, state, bypass_vs_clip_and_viewport);
trace_dump_member(bool, state, flatshade_first);
trace_dump_member(bool, state, gl_rasterization_rules);
trace_dump_member(float, state, line_width);
trace_dump_member(float, state, point_size);
trace_dump_member(float, state, point_size_min);
trace_dump_member(float, state, point_size_max);
trace_dump_member(float, state, offset_units);
trace_dump_member(float, state, offset_scale);
trace_dump_member_array(uint, state, sprite_coord_mode);
trace_dump_struct_end();
}
void trace_dump_poly_stipple(const struct pipe_poly_stipple *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_poly_stipple");
trace_dump_member_begin("stipple");
trace_dump_array(uint,
state->stipple,
Elements(state->stipple));
trace_dump_member_end();
trace_dump_struct_end();
}
void trace_dump_viewport_state(const struct pipe_viewport_state *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_viewport_state");
trace_dump_member_array(float, state, scale);
trace_dump_member_array(float, state, translate);
trace_dump_struct_end();
}
void trace_dump_scissor_state(const struct pipe_scissor_state *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_scissor_state");
trace_dump_member(uint, state, minx);
trace_dump_member(uint, state, miny);
trace_dump_member(uint, state, maxx);
trace_dump_member(uint, state, maxy);
trace_dump_struct_end();
}
void trace_dump_clip_state(const struct pipe_clip_state *state)
{
unsigned i;
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_clip_state");
trace_dump_member_begin("ucp");
trace_dump_array_begin();
for(i = 0; i < PIPE_MAX_CLIP_PLANES; ++i) {
trace_dump_elem_begin();
trace_dump_array(float, state->ucp[i], 4);
trace_dump_elem_end();
}
trace_dump_array_end();
trace_dump_member_end();
trace_dump_member(uint, state, nr);
trace_dump_struct_end();
}
void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_constant_buffer");
trace_dump_member(buffer_ptr, state, buffer);
trace_dump_struct_end();
}
void trace_dump_shader_state(const struct pipe_shader_state *state)
{
static char str[8192];
if(!state) {
trace_dump_null();
return;
}
tgsi_dump_str(state->tokens, 0, str, sizeof(str));
trace_dump_struct_begin("pipe_shader_state");
trace_dump_member_begin("tokens");
trace_dump_string(str);
trace_dump_member_end();
trace_dump_struct_end();
}
void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state)
{
unsigned i;
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_depth_stencil_alpha_state");
trace_dump_member_begin("depth");
trace_dump_struct_begin("pipe_depth_state");
trace_dump_member(bool, &state->depth, enabled);
trace_dump_member(bool, &state->depth, writemask);
trace_dump_member(uint, &state->depth, func);
trace_dump_struct_end();
trace_dump_member_end();
trace_dump_member_begin("stencil");
trace_dump_array_begin();
for(i = 0; i < Elements(state->stencil); ++i) {
trace_dump_elem_begin();
trace_dump_struct_begin("pipe_stencil_state");
trace_dump_member(bool, &state->stencil[i], enabled);
trace_dump_member(uint, &state->stencil[i], func);
trace_dump_member(uint, &state->stencil[i], fail_op);
trace_dump_member(uint, &state->stencil[i], zpass_op);
trace_dump_member(uint, &state->stencil[i], zfail_op);
trace_dump_member(uint, &state->stencil[i], ref_value);
trace_dump_member(uint, &state->stencil[i], valuemask);
trace_dump_member(uint, &state->stencil[i], writemask);
trace_dump_struct_end();
trace_dump_elem_end();
}
trace_dump_array_end();
trace_dump_member_end();
trace_dump_member_begin("alpha");
trace_dump_struct_begin("pipe_alpha_state");
trace_dump_member(bool, &state->alpha, enabled);
trace_dump_member(uint, &state->alpha, func);
trace_dump_member(float, &state->alpha, ref_value);
trace_dump_struct_end();
trace_dump_member_end();
trace_dump_struct_end();
}
void trace_dump_blend_state(const struct pipe_blend_state *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_blend_state");
trace_dump_member(bool, state, blend_enable);
trace_dump_member(uint, state, rgb_func);
trace_dump_member(uint, state, rgb_src_factor);
trace_dump_member(uint, state, rgb_dst_factor);
trace_dump_member(uint, state, alpha_func);
trace_dump_member(uint, state, alpha_src_factor);
trace_dump_member(uint, state, alpha_dst_factor);
trace_dump_member(bool, state, logicop_enable);
trace_dump_member(uint, state, logicop_func);
trace_dump_member(uint, state, colormask);
trace_dump_member(bool, state, dither);
trace_dump_struct_end();
}
void trace_dump_blend_color(const struct pipe_blend_color *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_blend_color");
trace_dump_member_array(float, state, color);
trace_dump_struct_end();
}
void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state)
{
trace_dump_struct_begin("pipe_framebuffer_state");
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
trace_dump_member(uint, state, nr_cbufs);
trace_dump_member_array(ptr, state, cbufs);
trace_dump_member(ptr, state, zsbuf);
trace_dump_struct_end();
}
void trace_dump_sampler_state(const struct pipe_sampler_state *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_sampler_state");
trace_dump_member(uint, state, wrap_s);
trace_dump_member(uint, state, wrap_t);
trace_dump_member(uint, state, wrap_r);
trace_dump_member(uint, state, min_img_filter);
trace_dump_member(uint, state, min_mip_filter);
trace_dump_member(uint, state, mag_img_filter);
trace_dump_member(bool, state, compare_mode);
trace_dump_member(uint, state, compare_func);
trace_dump_member(bool, state, normalized_coords);
trace_dump_member(uint, state, prefilter);
trace_dump_member(float, state, shadow_ambient);
trace_dump_member(float, state, lod_bias);
trace_dump_member(float, state, min_lod);
trace_dump_member(float, state, max_lod);
trace_dump_member_array(float, state, border_color);
trace_dump_member(float, state, max_anisotropy);
trace_dump_struct_end();
}
void trace_dump_surface(const struct pipe_surface *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_surface");
trace_dump_reference(&state->reference);
trace_dump_member(format, state, format);
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
trace_dump_member(uint, state, layout);
trace_dump_member(uint, state, offset);
trace_dump_member(uint, state, usage);
trace_dump_member(ptr, state, texture);
trace_dump_member(uint, state, face);
trace_dump_member(uint, state, level);
trace_dump_member(uint, state, zslice);
trace_dump_struct_end();
}
void trace_dump_transfer(const struct pipe_transfer *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_transfer");
trace_dump_member(format, state, format);
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
trace_dump_member_begin("block");
trace_dump_block(&state->block);
trace_dump_member_end();
trace_dump_member(uint, state, nblocksx);
trace_dump_member(uint, state, nblocksy);
trace_dump_member(uint, state, stride);
trace_dump_member(uint, state, usage);
trace_dump_member(ptr, state, texture);
trace_dump_member(uint, state, face);
trace_dump_member(uint, state, level);
trace_dump_member(uint, state, zslice);
trace_dump_struct_end();
}
void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_vertex_buffer");
trace_dump_member(uint, state, stride);
trace_dump_member(uint, state, max_index);
trace_dump_member(uint, state, buffer_offset);
trace_dump_member(buffer_ptr, state, buffer);
trace_dump_struct_end();
}
void trace_dump_vertex_element(const struct pipe_vertex_element *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_vertex_element");
trace_dump_member(uint, state, src_offset);
trace_dump_member(uint, state, vertex_buffer_index);
trace_dump_member(uint, state, nr_components);
trace_dump_member(format, state, src_format);
trace_dump_struct_end();
}

View file

@ -0,0 +1,78 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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.
*
**************************************************************************/
#ifndef TR_DUMP_STATE_H_
#define TR_DUMP_STATE_H_
#include "pipe/p_format.h"
#include "pipe/p_state.h"
#include "pipe/p_shader_tokens.h"
void trace_dump_format(enum pipe_format format);
void trace_dump_block(const struct pipe_format_block *block);
void trace_dump_template(const struct pipe_texture *templat);
void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state);
void trace_dump_poly_stipple(const struct pipe_poly_stipple *state);
void trace_dump_viewport_state(const struct pipe_viewport_state *state);
void trace_dump_scissor_state(const struct pipe_scissor_state *state);
void trace_dump_clip_state(const struct pipe_clip_state *state);
void trace_dump_constant_buffer(const struct pipe_constant_buffer *state);
void trace_dump_token(const struct tgsi_token *token);
void trace_dump_shader_state(const struct pipe_shader_state *state);
void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state);
void trace_dump_blend_state(const struct pipe_blend_state *state);
void trace_dump_blend_color(const struct pipe_blend_color *state);
void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state);
void trace_dump_sampler_state(const struct pipe_sampler_state *state);
void trace_dump_surface(const struct pipe_surface *state);
void trace_dump_transfer(const struct pipe_transfer *state);
void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state);
void trace_dump_vertex_element(const struct pipe_vertex_element *state);
#endif /* TR_STATE_H */

View file

@ -30,13 +30,15 @@
#include "tr_buffer.h"
#include "tr_dump.h"
#include "tr_state.h"
#include "tr_dump_state.h"
#include "tr_texture.h"
#include "tr_screen.h"
#include "pipe/p_inlines.h"
static boolean trace = FALSE;
static const char *
trace_screen_get_name(struct pipe_screen *_screen)
{
@ -212,10 +214,12 @@ static struct pipe_texture *
trace_screen_texture_blanket(struct pipe_screen *_screen,
const struct pipe_texture *templat,
const unsigned *ppitch,
struct pipe_buffer *buffer)
struct pipe_buffer *_buffer)
{
struct trace_screen *tr_scr = trace_screen(_screen);
struct trace_buffer *tr_buf = trace_buffer(_buffer);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_buffer *buffer = tr_buf->buffer;
unsigned pitch = *ppitch;
struct pipe_texture *result;
@ -818,19 +822,23 @@ trace_screen_destroy(struct pipe_screen *_screen)
struct pipe_screen *screen = tr_scr->screen;
trace_dump_call_begin("pipe_screen", "destroy");
trace_dump_arg(ptr, screen);
trace_dump_call_end();
trace_dump_trace_end();
screen->destroy(screen);
trace_dump_call_end();
trace_dump_trace_end();
FREE(tr_scr);
}
boolean
trace_enabled(void)
{
return trace;
}
struct pipe_screen *
trace_screen_create(struct pipe_screen *screen)
{
@ -842,10 +850,13 @@ trace_screen_create(struct pipe_screen *screen)
trace_dump_init();
if(!trace_dump_trace_begin())
goto error1;
if(trace_dump_trace_begin()) {
trace_dumping_start();
trace = TRUE;
}
trace_dumping_start();
if (!trace)
goto error1;
trace_dump_call_begin("", "pipe_screen_create");

View file

@ -71,6 +71,13 @@ struct trace_screen
};
/*
* tr_screen.c
*/
boolean
trace_enabled(void);
struct trace_screen *
trace_screen(struct pipe_screen *screen);

View file

@ -1,491 +1,66 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
/*
* 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 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:
* 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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.
*
**************************************************************************/
* 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 "tgsi/tgsi_dump.h"
#include "tr_dump.h"
#include "tr_state.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"
void trace_dump_format(enum pipe_format format)
#include "tgsi/tgsi_parse.h"
struct trace_shader * trace_shader_create(struct trace_context *tr_ctx,
const struct pipe_shader_state *state,
void *result,
enum trace_shader_type type)
{
trace_dump_enum(pf_name(format) );
struct trace_shader *tr_shdr = CALLOC_STRUCT(trace_shader);
tr_shdr->state = result;
tr_shdr->type = type;
tr_shdr->tokens = tgsi_dup_tokens(state->tokens);
/* works on context as well */
trace_screen_add_to_list(tr_ctx, shaders, tr_shdr);
return tr_shdr;
}
void trace_dump_block(const struct pipe_format_block *block)
void trace_shader_destroy(struct trace_context *tr_ctx,
struct trace_shader *tr_shdr)
{
trace_dump_struct_begin("pipe_format_block");
trace_dump_member(uint, block, size);
trace_dump_member(uint, block, width);
trace_dump_member(uint, block, height);
trace_dump_struct_end();
}
trace_screen_remove_from_list(tr_ctx, shaders, tr_shdr);
static void trace_dump_reference(const struct pipe_reference *reference)
{
trace_dump_struct_begin("pipe_reference");
trace_dump_member(int, &reference->count, count);
trace_dump_struct_end();
}
void trace_dump_template(const struct pipe_texture *templat)
{
if(!templat) {
trace_dump_null();
return;
if (tr_shdr->replaced) {
if (tr_shdr->type == TRACE_SHADER_FRAGMENT)
tr_ctx->pipe->delete_fs_state(tr_ctx->pipe, tr_shdr->replaced);
else if (tr_shdr->type == TRACE_SHADER_VERTEX)
tr_ctx->pipe->delete_vs_state(tr_ctx->pipe, tr_shdr->replaced);
else
assert(0);
}
trace_dump_struct_begin("pipe_texture");
trace_dump_member(int, templat, target);
trace_dump_member(format, templat, format);
trace_dump_member_begin("width");
trace_dump_array(uint, templat->width, 1);
trace_dump_member_end();
trace_dump_member_begin("height");
trace_dump_array(uint, templat->height, 1);
trace_dump_member_end();
trace_dump_member_begin("depth");
trace_dump_array(uint, templat->depth, 1);
trace_dump_member_end();
trace_dump_member_begin("block");
trace_dump_block(&templat->block);
trace_dump_member_end();
trace_dump_member(uint, templat, last_level);
trace_dump_member(uint, templat, tex_usage);
trace_dump_struct_end();
}
void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_rasterizer_state");
trace_dump_member(bool, state, flatshade);
trace_dump_member(bool, state, light_twoside);
trace_dump_member(uint, state, front_winding);
trace_dump_member(uint, state, cull_mode);
trace_dump_member(uint, state, fill_cw);
trace_dump_member(uint, state, fill_ccw);
trace_dump_member(bool, state, offset_cw);
trace_dump_member(bool, state, offset_ccw);
trace_dump_member(bool, state, scissor);
trace_dump_member(bool, state, poly_smooth);
trace_dump_member(bool, state, poly_stipple_enable);
trace_dump_member(bool, state, point_smooth);
trace_dump_member(bool, state, point_sprite);
trace_dump_member(bool, state, point_size_per_vertex);
trace_dump_member(bool, state, multisample);
trace_dump_member(bool, state, line_smooth);
trace_dump_member(bool, state, line_stipple_enable);
trace_dump_member(uint, state, line_stipple_factor);
trace_dump_member(uint, state, line_stipple_pattern);
trace_dump_member(bool, state, line_last_pixel);
trace_dump_member(bool, state, bypass_vs_clip_and_viewport);
trace_dump_member(bool, state, flatshade_first);
trace_dump_member(bool, state, gl_rasterization_rules);
trace_dump_member(float, state, line_width);
trace_dump_member(float, state, point_size);
trace_dump_member(float, state, point_size_min);
trace_dump_member(float, state, point_size_max);
trace_dump_member(float, state, offset_units);
trace_dump_member(float, state, offset_scale);
trace_dump_member_array(uint, state, sprite_coord_mode);
trace_dump_struct_end();
}
void trace_dump_poly_stipple(const struct pipe_poly_stipple *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_poly_stipple");
trace_dump_member_begin("stipple");
trace_dump_array(uint,
state->stipple,
Elements(state->stipple));
trace_dump_member_end();
trace_dump_struct_end();
}
void trace_dump_viewport_state(const struct pipe_viewport_state *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_viewport_state");
trace_dump_member_array(float, state, scale);
trace_dump_member_array(float, state, translate);
trace_dump_struct_end();
}
void trace_dump_scissor_state(const struct pipe_scissor_state *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_scissor_state");
trace_dump_member(uint, state, minx);
trace_dump_member(uint, state, miny);
trace_dump_member(uint, state, maxx);
trace_dump_member(uint, state, maxy);
trace_dump_struct_end();
}
void trace_dump_clip_state(const struct pipe_clip_state *state)
{
unsigned i;
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_clip_state");
trace_dump_member_begin("ucp");
trace_dump_array_begin();
for(i = 0; i < PIPE_MAX_CLIP_PLANES; ++i) {
trace_dump_elem_begin();
trace_dump_array(float, state->ucp[i], 4);
trace_dump_elem_end();
}
trace_dump_array_end();
trace_dump_member_end();
trace_dump_member(uint, state, nr);
trace_dump_struct_end();
}
void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_constant_buffer");
trace_dump_member(buffer_ptr, state, buffer);
trace_dump_struct_end();
}
void trace_dump_shader_state(const struct pipe_shader_state *state)
{
static char str[8192];
if(!state) {
trace_dump_null();
return;
}
tgsi_dump_str(state->tokens, 0, str, sizeof(str));
trace_dump_struct_begin("pipe_shader_state");
trace_dump_member_begin("tokens");
trace_dump_string(str);
trace_dump_member_end();
trace_dump_struct_end();
}
void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state)
{
unsigned i;
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_depth_stencil_alpha_state");
trace_dump_member_begin("depth");
trace_dump_struct_begin("pipe_depth_state");
trace_dump_member(bool, &state->depth, enabled);
trace_dump_member(bool, &state->depth, writemask);
trace_dump_member(uint, &state->depth, func);
trace_dump_member(bool, &state->depth, occlusion_count);
trace_dump_struct_end();
trace_dump_member_end();
trace_dump_member_begin("stencil");
trace_dump_array_begin();
for(i = 0; i < Elements(state->stencil); ++i) {
trace_dump_elem_begin();
trace_dump_struct_begin("pipe_stencil_state");
trace_dump_member(bool, &state->stencil[i], enabled);
trace_dump_member(uint, &state->stencil[i], func);
trace_dump_member(uint, &state->stencil[i], fail_op);
trace_dump_member(uint, &state->stencil[i], zpass_op);
trace_dump_member(uint, &state->stencil[i], zfail_op);
trace_dump_member(uint, &state->stencil[i], ref_value);
trace_dump_member(uint, &state->stencil[i], valuemask);
trace_dump_member(uint, &state->stencil[i], writemask);
trace_dump_struct_end();
trace_dump_elem_end();
}
trace_dump_array_end();
trace_dump_member_end();
trace_dump_member_begin("alpha");
trace_dump_struct_begin("pipe_alpha_state");
trace_dump_member(bool, &state->alpha, enabled);
trace_dump_member(uint, &state->alpha, func);
trace_dump_member(float, &state->alpha, ref_value);
trace_dump_struct_end();
trace_dump_member_end();
trace_dump_struct_end();
}
void trace_dump_blend_state(const struct pipe_blend_state *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_blend_state");
trace_dump_member(bool, state, blend_enable);
trace_dump_member(uint, state, rgb_func);
trace_dump_member(uint, state, rgb_src_factor);
trace_dump_member(uint, state, rgb_dst_factor);
trace_dump_member(uint, state, alpha_func);
trace_dump_member(uint, state, alpha_src_factor);
trace_dump_member(uint, state, alpha_dst_factor);
trace_dump_member(bool, state, logicop_enable);
trace_dump_member(uint, state, logicop_func);
trace_dump_member(uint, state, colormask);
trace_dump_member(bool, state, dither);
trace_dump_struct_end();
}
void trace_dump_blend_color(const struct pipe_blend_color *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_blend_color");
trace_dump_member_array(float, state, color);
trace_dump_struct_end();
}
void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state)
{
trace_dump_struct_begin("pipe_framebuffer_state");
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
trace_dump_member(uint, state, nr_cbufs);
trace_dump_member_array(ptr, state, cbufs);
trace_dump_member(ptr, state, zsbuf);
trace_dump_struct_end();
}
void trace_dump_sampler_state(const struct pipe_sampler_state *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_sampler_state");
trace_dump_member(uint, state, wrap_s);
trace_dump_member(uint, state, wrap_t);
trace_dump_member(uint, state, wrap_r);
trace_dump_member(uint, state, min_img_filter);
trace_dump_member(uint, state, min_mip_filter);
trace_dump_member(uint, state, mag_img_filter);
trace_dump_member(bool, state, compare_mode);
trace_dump_member(uint, state, compare_func);
trace_dump_member(bool, state, normalized_coords);
trace_dump_member(uint, state, prefilter);
trace_dump_member(float, state, shadow_ambient);
trace_dump_member(float, state, lod_bias);
trace_dump_member(float, state, min_lod);
trace_dump_member(float, state, max_lod);
trace_dump_member_array(float, state, border_color);
trace_dump_member(float, state, max_anisotropy);
trace_dump_struct_end();
}
void trace_dump_surface(const struct pipe_surface *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_surface");
trace_dump_reference(&state->reference);
trace_dump_member(format, state, format);
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
trace_dump_member(uint, state, layout);
trace_dump_member(uint, state, offset);
trace_dump_member(uint, state, usage);
trace_dump_member(ptr, state, texture);
trace_dump_member(uint, state, face);
trace_dump_member(uint, state, level);
trace_dump_member(uint, state, zslice);
trace_dump_struct_end();
}
void trace_dump_transfer(const struct pipe_transfer *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_transfer");
trace_dump_member(format, state, format);
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
trace_dump_member_begin("block");
trace_dump_block(&state->block);
trace_dump_member_end();
trace_dump_member(uint, state, nblocksx);
trace_dump_member(uint, state, nblocksy);
trace_dump_member(uint, state, stride);
trace_dump_member(uint, state, usage);
trace_dump_member(ptr, state, texture);
trace_dump_member(uint, state, face);
trace_dump_member(uint, state, level);
trace_dump_member(uint, state, zslice);
trace_dump_struct_end();
}
void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_vertex_buffer");
trace_dump_member(uint, state, stride);
trace_dump_member(uint, state, max_index);
trace_dump_member(uint, state, buffer_offset);
trace_dump_member(buffer_ptr, state, buffer);
trace_dump_struct_end();
}
void trace_dump_vertex_element(const struct pipe_vertex_element *state)
{
if(!state) {
trace_dump_null();
return;
}
trace_dump_struct_begin("pipe_vertex_element");
trace_dump_member(uint, state, src_offset);
trace_dump_member(uint, state, vertex_buffer_index);
trace_dump_member(uint, state, nr_components);
trace_dump_member(format, state, src_format);
trace_dump_struct_end();
FREE(tr_shdr->replaced_tokens);
FREE(tr_shdr->tokens);
FREE(tr_shdr);
}

View file

@ -1,78 +1,68 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
/*
* 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 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:
* 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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.
*
**************************************************************************/
* 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.
*/
#ifndef TR_STATE_H
#define TR_STATE_H
#ifndef TR_STATE_H_
#define TR_STATE_H_
#include "pipe/p_format.h"
#include "pipe/p_state.h"
#include "pipe/p_shader_tokens.h"
#include "tr_context.h"
struct tgsi_token;
enum trace_shader_type {
TRACE_SHADER_FRAGMENT = 0,
TRACE_SHADER_VERTEX = 1,
TRACE_SHADER_GEOMETRY = 2,
};
struct trace_shader
{
struct tr_list list;
enum trace_shader_type type;
void *state;
void *replaced;
struct tgsi_token *tokens;
struct tgsi_token *replaced_tokens;
boolean disabled;
};
void trace_dump_format(enum pipe_format format);
static INLINE struct trace_shader *
trace_shader(void *state)
{
return (struct trace_shader *)state;
}
void trace_dump_block(const struct pipe_format_block *block);
struct trace_shader * trace_shader_create(struct trace_context *tr_ctx,
const struct pipe_shader_state *state,
void *result,
enum trace_shader_type type);
void trace_dump_template(const struct pipe_texture *templat);
void trace_shader_destroy(struct trace_context *tr_ctx,
struct trace_shader *tr_shdr);
void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state);
void trace_dump_poly_stipple(const struct pipe_poly_stipple *state);
void trace_dump_viewport_state(const struct pipe_viewport_state *state);
void trace_dump_scissor_state(const struct pipe_scissor_state *state);
void trace_dump_clip_state(const struct pipe_clip_state *state);
void trace_dump_constant_buffer(const struct pipe_constant_buffer *state);
void trace_dump_token(const struct tgsi_token *token);
void trace_dump_shader_state(const struct pipe_shader_state *state);
void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state);
void trace_dump_blend_state(const struct pipe_blend_state *state);
void trace_dump_blend_color(const struct pipe_blend_color *state);
void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state);
void trace_dump_sampler_state(const struct pipe_sampler_state *state);
void trace_dump_surface(const struct pipe_surface *state);
void trace_dump_transfer(const struct pipe_transfer *state);
void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state);
void trace_dump_vertex_element(const struct pipe_vertex_element *state);
#endif /* TR_STATE_H */
#endif

View file

@ -138,6 +138,18 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv)
dri_drawable->pBackClipRects[0].x2 = dri_drawable->w;
dri_drawable->pBackClipRects[0].y2 = dri_drawable->h;
if (drawable->old_num == count &&
drawable->old_w == dri_drawable->w &&
drawable->old_h == dri_drawable->h &&
memcmp(drawable->old, buffers, sizeof(__DRIbuffer) * count) == 0) {
return;
} else {
drawable->old_num = count;
drawable->old_w = dri_drawable->w;
drawable->old_h = dri_drawable->h;
memcpy(drawable->old, buffers, sizeof(__DRIbuffer) * count);
}
for (i = 0; i < count; i++) {
enum pipe_format format = 0;
int index = 0;

View file

@ -46,6 +46,11 @@ struct dri_drawable
unsigned attachments[8];
unsigned num_attachments;
__DRIbuffer old[8];
unsigned old_num;
unsigned old_w;
unsigned old_h;
/* gallium */
struct st_framebuffer *stfb;
struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX];

View file

@ -36,9 +36,11 @@
#define need_GL_ARB_multisample
#define need_GL_ARB_occlusion_query
#define need_GL_ARB_point_parameters
#define need_GL_ARB_shader_objects
#define need_GL_ARB_texture_compression
#define need_GL_ARB_vertex_buffer_object
#define need_GL_ARB_vertex_program
#define need_GL_ARB_vertex_shader
#define need_GL_ARB_window_pos
#define need_GL_EXT_blend_color
#define need_GL_EXT_blend_equation_separate
@ -50,16 +52,23 @@
#define need_GL_EXT_multi_draw_arrays
#define need_GL_EXT_secondary_color
#define need_GL_NV_vertex_program
#define need_GL_VERSION_2_0
#define need_GL_VERSION_2_1
#include "extension_helper.h"
/**
* Extension strings exported by the driver.
*/
const struct dri_extension card_extensions[] = {
{"GL_ARB_fragment_shader", NULL},
{"GL_ARB_multisample", GL_ARB_multisample_functions},
{"GL_ARB_multitexture", NULL},
{"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
{"GL_ARB_pixel_buffer_object", NULL},
{"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
{"GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
{"GL_ARB_shading_language_120", GL_VERSION_2_1_functions },
{"GL_ARB_shader_objects", GL_ARB_shader_objects_functions},
{"GL_ARB_texture_border_clamp", NULL},
{"GL_ARB_texture_compression", GL_ARB_texture_compression_functions},
{"GL_ARB_texture_cube_map", NULL},
@ -69,7 +78,7 @@ const struct dri_extension card_extensions[] = {
{"GL_ARB_texture_mirrored_repeat", NULL},
{"GL_ARB_texture_rectangle", NULL},
{"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
{"GL_ARB_pixel_buffer_object", NULL},
{"GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions},
{"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
{"GL_ARB_window_pos", GL_ARB_window_pos_functions},
{"GL_EXT_blend_color", GL_EXT_blend_color_functions},

View file

@ -1,29 +1,19 @@
TARGET = libegldrm.a
CFILES = $(wildcard ./*.c)
OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES))
GALLIUMDIR = ../..
TOP = ../../../..
TOP = ../../../..
include $(TOP)/configs/current
include ${TOP}/configs/current
LIBNAME = egldrm
CFLAGS := \
-I${GALLIUMDIR}/include \
-I${GALLIUMDIR}/auxiliary \
-I${TOP}/src/mesa/drivers/dri/common \
-I${TOP}/src/mesa \
-I$(TOP)/include \
-I$(TOP)/src/egl/main \
${LIBDRM_CFLAGS} \
${CFLAGS}
LIBRARY_INCLUDES = \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/auxiliary \
-I$(TOP)/src/mesa/drivers/dri/common \
-I$(TOP)/src/mesa \
-I$(TOP)/include \
-I$(TOP)/src/egl/main \
$(shell pkg-config --cflags-only-I libdrm)
#############################################
.PHONY = all clean
C_SOURCES = $(wildcard ./*.c)
all: ${TARGET}
${TARGET}: ${OBJECTS}
ar rcs $@ $^
clean:
rm -rf ${OBJECTS} ${TARGET}
include ../../Makefile.template

View file

@ -37,7 +37,7 @@
#include "stw_pixelformat.h"
#define STW_MAX_PIXELFORMATS 128
#define STW_MAX_PIXELFORMATS 256
struct pipe_screen;

View file

@ -0,0 +1,7 @@
Import('*')
SConscript(['gem/SConscript',])
if 'mesa' in env['statetrackers']:
SConscript(['dri/SConscript'])

View file

@ -6,6 +6,7 @@ LIBNAME = i915_dri.so
PIPE_DRIVERS = \
$(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
$(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/i915simple/libi915simple.a
@ -21,5 +22,5 @@ include ../../Makefile.template
DRI_LIB_DEPS += -ldrm_intel
symlinks: $(TOP)/$(LIB_DIR)/gallium
@rm -f $(TOP)/lib/gallium/i965_dri.so
ln -s i915_dri.so $(TOP)/lib/gallium/i965_dri.so
@rm -f $(TOP)/$(LIB_DIR)/gallium/i965_dri.so
ln -s i915_dri.so $(TOP)/$(LIB_DIR)/gallium/i965_dri.so

View file

@ -0,0 +1,16 @@
Import('*')
env = drienv.Clone()
drivers = [
softpipe,
i915simple,
trace,
inteldrm
]
env.SharedLibrary(
target ='i915_dri.so',
source = COMMON_GALLIUM_SOURCES,
LIBS = drivers + mesa + auxiliaries + env['LIBS'],
)

View file

@ -0,0 +1,17 @@
Import('*')
env = drienv.Clone()
inteldrm_sources = [
'intel_be_api.c',
'intel_be_batchbuffer.c',
'intel_be_context.c',
'intel_be_device.c',
]
inteldrm = env.ConvenienceLibrary(
target ='inteldrm',
source = inteldrm_sources,
)
Export('inteldrm')

View file

@ -2,7 +2,13 @@
#include "intel_be_api.h"
#include "i915simple/i915_winsys.h"
#ifdef DEBUG
#include "trace/trace_drm.h"
struct drm_api hooks =
#else
struct drm_api drm_api_hooks =
#endif
{
/* intel_be_context.c */
.create_context = intel_be_create_context,

View file

@ -30,6 +30,10 @@
#include "radeon_drm.h"
#ifdef DEBUG
#include "trace/trace_drm.h"
#endif
/* Create a pipe_screen. */
struct pipe_screen* radeon_create_screen(int drmFB,
struct drm_create_screen_arg *arg)
@ -112,7 +116,11 @@ boolean radeon_global_handle_from_buffer(struct pipe_screen* screen,
return TRUE;
}
#ifdef DEBUG
struct drm_api hooks = {
#else
struct drm_api drm_api_hooks = {
#endif
.create_screen = radeon_create_screen,
.create_context = radeon_create_context,
/* XXX fix this */

View file

@ -57,10 +57,6 @@ static boolean radeon_r300_validate(struct r300_winsys* winsys)
(struct radeon_winsys_priv*)winsys->radeon_winsys;
struct radeon_cs_space_check* sc = priv->sc;
debug_printf("Validation count: %d\n", priv->bo_count);
for (i = 0; i < priv->bo_count; i++) {
debug_printf("BO %d: %p rd: %d wd: %d\n", i, sc[i].bo, sc[i].read_domains, sc[i].write_domain);
}
retval = radeon_cs_space_check(priv->cs, sc, priv->bo_count);
if (retval == RADEON_CS_SPACE_OP_TO_BIG) {
@ -152,44 +148,44 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys)
/* Helper function to do the ioctls needed for setup and init. */
static void do_ioctls(struct r300_winsys* winsys, int fd)
{
struct drm_radeon_gem_info info = {0};
struct drm_radeon_gem_info gem_info = {0};
drm_radeon_getparam_t gp = {0};
struct drm_radeon_info info = {0};
int target = 0;
int retval;
info.value = &target;
gp.value = &target;
/* First, get the number of pixel pipes */
gp.param = RADEON_PARAM_NUM_GB_PIPES;
retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp));
/* First, get PCI ID */
info.request = RADEON_INFO_DEVICE_ID;
retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
if (retval) {
fprintf(stderr, "%s: Failed to get GB pipe count, error number %d\n",
fprintf(stderr, "%s: New ioctl for PCI ID failed "
"(error number %d), trying classic ioctl...\n",
__FUNCTION__, retval);
exit(1);
}
winsys->gb_pipes = target;
/* Then, get PCI ID */
gp.param = RADEON_PARAM_DEVICE_ID;
retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp));
if (retval) {
fprintf(stderr, "%s: Failed to get PCI ID, error number %d\n",
__FUNCTION__, retval);
exit(1);
gp.param = RADEON_PARAM_DEVICE_ID;
retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp,
sizeof(gp));
if (retval) {
fprintf(stderr, "%s: Failed to get PCI ID, "
"error number %d\n", __FUNCTION__, retval);
exit(1);
}
}
winsys->pci_id = target;
/* Finally, retrieve MM info */
/* Then, retrieve MM info */
retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO,
&info, sizeof(info));
&gem_info, sizeof(gem_info));
if (retval) {
fprintf(stderr, "%s: Failed to get MM info, error number %d\n",
__FUNCTION__, retval);
exit(1);
}
winsys->gart_size = info.gart_size;
winsys->gart_size = gem_info.gart_size;
/* XXX */
winsys->vram_size = info.vram_visible;
winsys->vram_size = gem_info.vram_visible;
}
struct r300_winsys*

View file

@ -31,5 +31,18 @@
#include "radeon_buffer.h"
/* protect us from bonghits */
#ifndef RADEON_INFO_DEVICE_ID
#define RADEON_INFO_DEVICE_ID 0
#endif
#ifndef DRM_RADEON_INFO
#define DRM_RADEON_INFO 0x1
struct drm_radeon_info {
uint32_t request;
uint32_t pad;
uint64_t value;
};
#endif
struct r300_winsys*
radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys);

View file

@ -10,6 +10,7 @@ PIPE_DRIVERS = \
$(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
$(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
C_SOURCES = \

View file

@ -8,6 +8,7 @@ PIPE_DRIVERS = \
$(TOP)/src/gallium/state_trackers/egl/libegldrm.a \
$(GALLIUMDIR)/winsys/drm/radeon/core/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
DRIVER_SOURCES =

View file

@ -405,6 +405,8 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
psp->createContext = driCreateContext;
psp->createDrawable = driCreateDrawable;
psp->swapBuffers = driSwapBuffers;
psp->waitX = NULL;
psp->waitGL = NULL;
return psp;

View file

@ -1319,30 +1319,31 @@ PUBLIC XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attribList)
** Eliminate visuals that don't meet minimum requirements
** Compute a score for those that do
** Remember which visual, if any, got the highest score
** If no visual is acceptable, return None
** Otherwise, create an XVisualInfo list with just the selected X visual
** and return this.
*/
for ( modes = psc->visuals ; modes != NULL ; modes = modes->next ) {
if ( fbconfigs_compatible( & test_config, modes )
&& ((best_config == NULL)
|| (fbconfig_compare( (const __GLcontextModes * const * const)&modes, &best_config ) < 0)) ) {
best_config = modes;
XVisualInfo visualTemplate;
XVisualInfo *newList;
int i;
visualTemplate.screen = screen;
visualTemplate.visualid = modes->visualID;
newList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask,
&visualTemplate, &i );
if (newList) {
Xfree(visualList);
visualList = newList;
best_config = modes;
}
}
}
/*
** If no visual is acceptable, return None
** Otherwise, create an XVisualInfo list with just the selected X visual
** and return this.
*/
if (best_config != NULL) {
XVisualInfo visualTemplate;
int i;
visualTemplate.screen = screen;
visualTemplate.visualid = best_config->visualID;
visualList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask,
&visualTemplate, &i );
}
return visualList;
}

View file

@ -19,6 +19,7 @@ DRIVER_SOURCES = \
intel_batchbuffer.c \
intel_clear.c \
intel_extensions.c \
intel_generatemipmap.c \
intel_mipmap_tree.c \
intel_tex_layout.c \
intel_tex_image.c \

View file

@ -55,6 +55,17 @@ static GLint step_offsets[6][2] = {
[FACE_NEG_Z] = {-1, 1},
};
static GLint bottom_offsets[6] = {
[FACE_POS_X] = 16 + 0 * 8,
[FACE_POS_Y] = 16 + 1 * 8,
[FACE_POS_Z] = 16 + 2 * 8,
[FACE_NEG_X] = 16 + 3 * 8,
[FACE_NEG_Y] = 16 + 4 * 8,
[FACE_NEG_Z] = 16 + 5 * 8,
};
/**
* Cube texture map layout for i830M-GM915.
*
@ -297,7 +308,7 @@ i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt)
* +---+ +---+ +---+ +---+ +---+ +---+
*
* The bottom row continues with the remaining 2x2 then the 1x1 mip contents
* in order, with each of them aligned to a 4x4 block boundary. Thus, for
* in order, with each of them aligned to a 8x8 block boundary. Thus, for
* 32x32 cube maps and smaller, the bottom row layout is going to dictate the
* pitch of the tree. For a tree with 4x4 images, the pitch is at least
* 14 * 8 = 112 texels, for 2x2 it is at least 12 * 8 texels, and for 1x1
@ -375,10 +386,11 @@ i945_miptree_layout_cube(struct intel_context *intel,
x = (face - 4) * 8;
break;
}
break;
case 2:
y = mt->total_height - 4;
x = 16 + face * 8;
x = bottom_offsets[face];
break;
case 1:
@ -454,7 +466,10 @@ i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt)
{
switch (mt->target) {
case GL_TEXTURE_CUBE_MAP:
i945_miptree_layout_cube(intel, mt);
if (mt->compressed)
i945_miptree_layout_cube(intel, mt);
else
i915_miptree_layout_cube(intel, mt);
break;
case GL_TEXTURE_3D:
i945_miptree_layout_3d(intel, mt);

View file

@ -97,7 +97,7 @@ struct brw_glsl_call;
#define BRW_EU_MAX_INSN_STACK 5
#define BRW_EU_MAX_INSN 4000
#define BRW_EU_MAX_INSN 10000
struct brw_compile {
struct brw_instruction store[BRW_EU_MAX_INSN];

View file

@ -319,6 +319,9 @@ static void brw_wm_populate_key( struct brw_context *brw,
key->drawable_height = brw->intel.driDrawable->h;
}
/* CACHE_NEW_VS_PROG */
key->vp_outputs_written = brw->vs.prog_data->outputs_written & DO_SETUP_BITS;
/* The unique fragment program ID */
key->program_string_id = fp->id;
}
@ -357,7 +360,7 @@ const struct brw_tracked_state brw_wm_prog = {
.brw = (BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_WM_INPUT_DIMENSIONS |
BRW_NEW_REDUCED_PRIMITIVE),
.cache = 0
.cache = CACHE_NEW_VS_PROG,
},
.prepare = brw_prepare_wm_prog
};

View file

@ -75,6 +75,7 @@ struct brw_wm_prog_key {
GLuint program_string_id:32;
GLuint origin_x, origin_y;
GLuint drawable_height;
GLuint vp_outputs_written;
};

View file

@ -302,7 +302,7 @@ static void prealloc_reg(struct brw_wm_compile *c)
{
int i, j;
struct brw_reg reg;
int nr_interp_regs = 0;
int urb_read_length = 0;
GLuint inputs = FRAG_BIT_WPOS | c->fp_interp_emitted | c->fp_deriv_emitted;
GLuint reg_index = 0;
@ -366,18 +366,29 @@ static void prealloc_reg(struct brw_wm_compile *c)
}
/* fragment shader inputs */
for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
if (inputs & (1<<i)) {
nr_interp_regs++;
reg = brw_vec8_grf(reg_index, 0);
for (j = 0; j < 4; j++)
set_reg(c, PROGRAM_PAYLOAD, i, j, reg);
reg_index += 2;
}
for (i = 0; i < VERT_RESULT_MAX; i++) {
int fp_input;
if (i >= VERT_RESULT_VAR0)
fp_input = i - VERT_RESULT_VAR0 + FRAG_ATTRIB_VAR0;
else if (i <= VERT_RESULT_TEX7)
fp_input = i;
else
fp_input = -1;
if (fp_input >= 0 && inputs & (1 << fp_input)) {
urb_read_length = reg_index;
reg = brw_vec8_grf(reg_index, 0);
for (j = 0; j < 4; j++)
set_reg(c, PROGRAM_PAYLOAD, fp_input, j, reg);
}
if (c->key.vp_outputs_written & (1 << i)) {
reg_index += 2;
}
}
c->prog_data.first_curbe_grf = c->key.nr_depth_regs * 2;
c->prog_data.urb_read_length = nr_interp_regs * 2;
c->prog_data.urb_read_length = urb_read_length;
c->prog_data.curb_read_length = c->nr_creg;
c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, reg_index, 0);
reg_index++;
@ -509,6 +520,14 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c,
const GLuint nr = 1;
const GLuint component = GET_SWZ(src->Swizzle, channel);
/* Extended swizzle terms */
if (component == SWIZZLE_ZERO) {
return brw_imm_f(0.0F);
}
else if (component == SWIZZLE_ONE) {
return brw_imm_f(1.0F);
}
if (c->fp->use_const_buffer &&
(src->File == PROGRAM_STATE_VAR ||
src->File == PROGRAM_CONSTANT ||
@ -806,27 +825,26 @@ static void emit_fb_write(struct brw_wm_compile *c,
}
if (c->key.dest_depth_reg) {
GLuint comp = c->key.dest_depth_reg / 2;
GLuint off = c->key.dest_depth_reg % 2;
const GLuint comp = c->key.dest_depth_reg / 2;
const GLuint off = c->key.dest_depth_reg % 2;
assert(comp == 1);
assert(off == 0);
#if 0
/* XXX do we need this code? comp always 1, off always 0, it seems */
if (off != 0) {
/* XXX this code needs review/testing */
struct brw_reg arg1_0 = get_src_reg(c, inst, 1, comp);
struct brw_reg arg1_1 = get_src_reg(c, inst, 1, comp+1);
brw_push_insn_state(p);
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
brw_MOV(p, brw_message_reg(nr), offset(arg1[comp],1));
brw_MOV(p, brw_message_reg(nr), offset(arg1_0, 1));
/* 2nd half? */
brw_MOV(p, brw_message_reg(nr+1), arg1[comp+1]);
brw_MOV(p, brw_message_reg(nr+1), arg1_1);
brw_pop_insn_state(p);
}
else
#endif
{
struct brw_reg src = get_src_reg(c, inst, 1, 1);
brw_MOV(p, brw_message_reg(nr), src);
struct brw_reg src = get_src_reg(c, inst, 1, 1);
brw_MOV(p, brw_message_reg(nr), src);
}
nr += 2;
}

View file

@ -116,6 +116,10 @@ const struct {
{ C, 0, 1, 1, 1 }
};
/**
* \param line_aa AA_NEVER, AA_ALWAYS or AA_SOMETIMES
* \param lookup bitmask of IZ_* flags
*/
void brw_wm_lookup_iz( GLuint line_aa,
GLuint lookup,
struct brw_wm_prog_key *key )

View file

@ -69,8 +69,6 @@ static void prealloc_reg(struct brw_wm_compile *c,
*/
static void init_registers( struct brw_wm_compile *c )
{
struct brw_context *brw = c->func.brw;
GLuint inputs = (brw->vs.prog_data->outputs_written & DO_SETUP_BITS);
GLuint nr_interp_regs = 0;
GLuint i = 0;
GLuint j;
@ -85,16 +83,19 @@ static void init_registers( struct brw_wm_compile *c )
prealloc_reg(c, &c->creg[j], i++);
for (j = 0; j < FRAG_ATTRIB_MAX; j++) {
if (inputs & (1<<j)) {
/* index for vs output and ps input are not the same
in shader varying */
GLuint index;
if (j > FRAG_ATTRIB_VAR0)
index = j - (VERT_RESULT_VAR0 - FRAG_ATTRIB_VAR0);
if (c->key.vp_outputs_written & (1<<j)) {
int fp_index;
if (j >= VERT_RESULT_VAR0)
fp_index = j - (VERT_RESULT_VAR0 - FRAG_ATTRIB_VAR0);
else if (j <= VERT_RESULT_TEX7)
fp_index = j;
else
index = j;
fp_index = -1;
nr_interp_regs++;
prealloc_reg(c, &c->payload.input_interp[index], i++);
if (fp_index >= 0)
prealloc_reg(c, &c->payload.input_interp[fp_index], i++);
}
}

View file

@ -178,6 +178,16 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key,
sampler->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CUBE;
sampler->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CUBE;
}
else if (key->tex_target == GL_TEXTURE_1D) {
/* There's a bug in 1D texture sampling - it actually pays
* attention to the wrap_t value, though it should not.
* Override the wrap_t value here to GL_REPEAT to keep
* any nonexistent border pixels from floating in.
*/
sampler->ss1.r_wrap_mode = translate_wrap_mode(key->wrap_r);
sampler->ss1.s_wrap_mode = translate_wrap_mode(key->wrap_s);
sampler->ss1.t_wrap_mode = BRW_TEXCOORDMODE_WRAP;
}
else {
sampler->ss1.r_wrap_mode = translate_wrap_mode(key->wrap_r);
sampler->ss1.s_wrap_mode = translate_wrap_mode(key->wrap_s);

View file

@ -214,6 +214,7 @@ intel_bufferobj_map(GLcontext * ctx,
struct intel_context *intel = intel_context(ctx);
struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
GLboolean read_only = (access == GL_READ_ONLY_ARB);
GLboolean write_only = (access == GL_WRITE_ONLY_ARB);
assert(intel_obj);
@ -225,7 +226,14 @@ intel_bufferobj_map(GLcontext * ctx,
return NULL;
}
dri_bo_map(intel_obj->buffer, !read_only);
if (write_only && intel->intelScreen->kernel_exec_fencing) {
drm_intel_gem_bo_map_gtt(intel_obj->buffer);
intel_obj->mapped_gtt = GL_TRUE;
} else {
drm_intel_bo_map(intel_obj->buffer, !read_only);
intel_obj->mapped_gtt = GL_FALSE;
}
obj->Pointer = intel_obj->buffer->virtual;
return obj->Pointer;
}
@ -243,7 +251,11 @@ intel_bufferobj_unmap(GLcontext * ctx,
assert(intel_obj);
if (intel_obj->buffer != NULL) {
assert(obj->Pointer);
dri_bo_unmap(intel_obj->buffer);
if (intel_obj->mapped_gtt) {
drm_intel_gem_bo_unmap_gtt(intel_obj->buffer);
} else {
drm_intel_bo_unmap(intel_obj->buffer);
}
obj->Pointer = NULL;
}
return GL_TRUE;

View file

@ -46,6 +46,7 @@ struct intel_buffer_object
struct intel_region *region; /* Is there a zero-copy texture
associated with this (pixel)
buffer object? */
GLboolean mapped_gtt;
};

View file

@ -276,7 +276,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
ctx->Driver.Enable(ctx, GL_DEPTH_TEST,
(ctx->Depth.Test && fb->Visual.depthBits > 0));
ctx->Driver.Enable(ctx, GL_STENCIL_TEST,
(ctx->Stencil._Enabled && fb->Visual.stencilBits > 0));
(ctx->Stencil.Enabled && fb->Visual.stencilBits > 0));
}
else {
/* Mesa's Stencil._Enabled field is updated when

View file

@ -30,6 +30,7 @@
#include "main/enums.h"
#include "main/image.h"
#include "main/mtypes.h"
#include "main/arrayobj.h"
#include "main/attrib.h"
#include "main/blend.h"
#include "main/bufferobj.h"
@ -66,6 +67,45 @@
BUFFER_BIT_COLOR6 | \
BUFFER_BIT_COLOR7)
/**
* Per-context one-time init of things for intl_clear_tris().
* Basically set up a private array object for vertex/color arrays.
*/
static void
init_clear(GLcontext *ctx)
{
struct intel_context *intel = intel_context(ctx);
struct gl_array_object *arraySave = NULL;
const GLuint arrayBuffer = ctx->Array.ArrayBufferObj->Name;
const GLuint elementBuffer = ctx->Array.ElementArrayBufferObj->Name;
/* create new array object */
intel->clear.arrayObj = _mesa_new_array_object(ctx, ~0);
/* save current array object, bind new one */
_mesa_reference_array_object(ctx, &arraySave, ctx->Array.ArrayObj);
_mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, intel->clear.arrayObj);
/* one-time setup of vertex arrays (pos, color) */
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
_mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
_mesa_ColorPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), intel->clear.color);
_mesa_VertexPointer(3, GL_FLOAT, 3 * sizeof(GLfloat), intel->clear.vertices);
_mesa_Enable(GL_COLOR_ARRAY);
_mesa_Enable(GL_VERTEX_ARRAY);
/* restore original array object */
_mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, arraySave);
_mesa_reference_array_object(ctx, &arraySave, NULL);
/* restore original buffer objects */
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, arrayBuffer);
_mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementBuffer);
}
/**
* Perform glClear where mask contains only color, depth, and/or stencil.
*
@ -78,14 +118,16 @@ void
intel_clear_tris(GLcontext *ctx, GLbitfield mask)
{
struct intel_context *intel = intel_context(ctx);
GLfloat vertices[4][3];
GLfloat color[4][4];
GLfloat dst_z;
struct gl_framebuffer *fb = ctx->DrawBuffer;
int i;
GLboolean saved_fp_enable = GL_FALSE, saved_vp_enable = GL_FALSE;
GLuint saved_shader_program = 0;
unsigned int saved_active_texture;
struct gl_array_object *arraySave = NULL;
if (!intel->clear.arrayObj)
init_clear(ctx);
assert((mask & ~(TRI_CLEAR_COLOR_BITS | BUFFER_BIT_DEPTH |
BUFFER_BIT_STENCIL)) == 0);
@ -98,7 +140,6 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
GL_STENCIL_BUFFER_BIT |
GL_TRANSFORM_BIT |
GL_CURRENT_BIT);
_mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
saved_active_texture = ctx->Texture.CurrentUnit;
/* Disable existing GL state we don't want to apply to a clear. */
@ -149,18 +190,14 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
}
}
#if FEATURE_ARB_vertex_buffer_object
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
_mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
#endif
/* save current array object, bind our private one */
_mesa_reference_array_object(ctx, &arraySave, ctx->Array.ArrayObj);
_mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, intel->clear.arrayObj);
intel_meta_set_passthrough_transform(intel);
for (i = 0; i < 4; i++) {
color[i][0] = ctx->Color.ClearColor[0];
color[i][1] = ctx->Color.ClearColor[1];
color[i][2] = ctx->Color.ClearColor[2];
color[i][3] = ctx->Color.ClearColor[3];
COPY_4FV(intel->clear.color[i], ctx->Color.ClearColor);
}
/* convert clear Z from [0,1] to NDC coord in [-1,1] */
@ -169,23 +206,18 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
/* Prepare the vertices, which are the same regardless of which buffer we're
* drawing to.
*/
vertices[0][0] = fb->_Xmin;
vertices[0][1] = fb->_Ymin;
vertices[0][2] = dst_z;
vertices[1][0] = fb->_Xmax;
vertices[1][1] = fb->_Ymin;
vertices[1][2] = dst_z;
vertices[2][0] = fb->_Xmax;
vertices[2][1] = fb->_Ymax;
vertices[2][2] = dst_z;
vertices[3][0] = fb->_Xmin;
vertices[3][1] = fb->_Ymax;
vertices[3][2] = dst_z;
_mesa_ColorPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &color);
_mesa_VertexPointer(3, GL_FLOAT, 3 * sizeof(GLfloat), &vertices);
_mesa_Enable(GL_COLOR_ARRAY);
_mesa_Enable(GL_VERTEX_ARRAY);
intel->clear.vertices[0][0] = fb->_Xmin;
intel->clear.vertices[0][1] = fb->_Ymin;
intel->clear.vertices[0][2] = dst_z;
intel->clear.vertices[1][0] = fb->_Xmax;
intel->clear.vertices[1][1] = fb->_Ymin;
intel->clear.vertices[1][2] = dst_z;
intel->clear.vertices[2][0] = fb->_Xmax;
intel->clear.vertices[2][1] = fb->_Ymax;
intel->clear.vertices[2][2] = dst_z;
intel->clear.vertices[3][0] = fb->_Xmin;
intel->clear.vertices[3][1] = fb->_Ymax;
intel->clear.vertices[3][2] = dst_z;
while (mask != 0) {
GLuint this_mask = 0;
@ -223,8 +255,10 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
/* Control writing of the stencil clear value to stencil. */
if (this_mask & BUFFER_BIT_STENCIL) {
_mesa_Enable(GL_STENCIL_TEST);
_mesa_StencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
_mesa_StencilFuncSeparate(GL_FRONT, GL_ALWAYS, ctx->Stencil.Clear,
_mesa_StencilOpSeparate(GL_FRONT_AND_BACK,
GL_REPLACE, GL_REPLACE, GL_REPLACE);
_mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS,
ctx->Stencil.Clear,
ctx->Stencil.WriteMask[0]);
} else {
_mesa_Disable(GL_STENCIL_TEST);
@ -246,8 +280,11 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
if (saved_shader_program)
_mesa_UseProgramObjectARB(saved_shader_program);
_mesa_PopClientAttrib();
_mesa_PopAttrib();
/* restore current array object */
_mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, arraySave);
_mesa_reference_array_object(ctx, &arraySave, NULL);
}
static const char *buffer_names[] = {

View file

@ -28,6 +28,7 @@
#include "main/glheader.h"
#include "main/context.h"
#include "main/arrayobj.h"
#include "main/extensions.h"
#include "main/framebuffer.h"
#include "main/imports.h"
@ -393,7 +394,7 @@ intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
if (!driContext->driScreenPriv->dri2.enabled)
return;
if (!intel->internal_viewport_call) {
if (!intel->internal_viewport_call && ctx->DrawBuffer->Name == 0) {
intel_update_renderbuffers(driContext, driContext->driDrawablePriv);
if (driContext->driDrawablePriv != driContext->driReadablePriv)
intel_update_renderbuffers(driContext, driContext->driReadablePriv);
@ -755,6 +756,9 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
INTEL_FIREVERTICES(intel);
if (intel->clear.arrayObj)
_mesa_delete_array_object(&intel->ctx, intel->clear.arrayObj);
intel->vtbl.destroy(intel);
release_texture_heaps = (intel->ctx.Shared->RefCount == 1);

View file

@ -225,6 +225,14 @@ struct intel_context
GLuint ClearColor565;
GLuint ClearColor8888;
/* info for intel_clear_tris() */
struct
{
struct gl_array_object *arrayObj;
GLfloat vertices[4][3];
GLfloat color[4][4];
} clear;
/* Offsets of fields within the current vertex:
*/
GLuint coloroffset;

View file

@ -48,6 +48,7 @@
#define need_GL_EXT_point_parameters
#define need_GL_EXT_secondary_color
#define need_GL_EXT_stencil_two_side
#define need_GL_APPLE_vertex_array_object
#define need_GL_ATI_separate_stencil
#define need_GL_ATI_envmap_bumpmap
#define need_GL_NV_point_sprite
@ -95,6 +96,7 @@ static const struct dri_extension card_extensions[] = {
{ "GL_EXT_texture_lod_bias", NULL },
{ "GL_3DFX_texture_compression_FXT1", NULL },
{ "GL_APPLE_client_storage", NULL },
{ "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions},
{ "GL_MESA_pack_invert", NULL },
{ "GL_MESA_ycbcr_texture", NULL },
{ "GL_NV_blend_square", NULL },

View file

@ -236,7 +236,7 @@ intel_get_param(__DRIscreenPrivate *psp, int param, int *value)
ret = drmCommandWriteRead(psp->fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
if (ret) {
fprintf(stderr, "drm_i915_getparam: %d\n", ret);
_mesa_warning(NULL, "drm_i915_getparam: %d\n", ret);
return GL_FALSE;
}

View file

@ -208,7 +208,7 @@ try_pbo_upload(struct intel_context *intel,
if (!pbo ||
intel->ctx._ImageTransferState ||
unpack->SkipPixels || unpack->SkipRows) {
_mesa_printf("%s: failure 1\n", __FUNCTION__);
DBG("%s: failure 1\n", __FUNCTION__);
return GL_FALSE;
}
@ -264,7 +264,7 @@ try_pbo_zcopy(struct intel_context *intel,
if (!pbo ||
intel->ctx._ImageTransferState ||
unpack->SkipPixels || unpack->SkipRows) {
_mesa_printf("%s: failure 1\n", __FUNCTION__);
DBG("%s: failure 1\n", __FUNCTION__);
return GL_FALSE;
}
@ -283,7 +283,7 @@ try_pbo_zcopy(struct intel_context *intel,
dst_stride = intelImage->mt->pitch;
if (src_stride != dst_stride || dst_offset != 0 || src_offset != 0) {
_mesa_printf("%s: failure 2\n", __FUNCTION__);
DBG("%s: failure 2\n", __FUNCTION__);
return GL_FALSE;
}

View file

@ -57,6 +57,7 @@ _mesa_initialize_array_object( GLcontext *ctx,
struct gl_array_object *obj, GLuint name );
/*
* API functions
*/

View file

@ -368,12 +368,18 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
att->Complete = GL_FALSE;
return;
}
if (texImage->TexFormat->TexelBytes == 0) {
att_incomplete("compressed internalformat");
att->Complete = GL_FALSE;
return;
}
}
else if (format == GL_DEPTH) {
if (texImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT) {
/* OK */
}
else if (ctx->Extensions.EXT_packed_depth_stencil &&
ctx->Extensions.ARB_depth_texture &&
texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) {
/* OK */
}
@ -384,10 +390,19 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
}
}
else {
/* no such thing as stencil textures */
att_incomplete("illegal stencil texture");
att->Complete = GL_FALSE;
return;
ASSERT(format == GL_STENCIL);
ASSERT(att->Renderbuffer->StencilBits);
if (ctx->Extensions.EXT_packed_depth_stencil &&
ctx->Extensions.ARB_depth_texture &&
att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
/* OK */
}
else {
/* no such thing as stencil-only textures */
att_incomplete("illegal stencil texture");
att->Complete = GL_FALSE;
return;
}
}
}
else if (att->Type == GL_RENDERBUFFER_EXT) {

View file

@ -1370,6 +1370,9 @@ make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border,
/**
* Down-sample a texture image to produce the next lower mipmap level.
* \param comps components per texel (1, 2, 3 or 4)
* \param srcRowStride stride between source rows, in texels
* \param dstRowStride stride between destination rows, in texels
*/
void
_mesa_generate_mipmap_level(GLenum target,
@ -1478,9 +1481,12 @@ next_mipmap_level_size(GLenum target, GLint border,
/**
* For GL_SGIX_generate_mipmap:
* Generate a complete set of mipmaps from texObj's base-level image.
* Automatic mipmap generation.
* This is the fallback/default function for ctx->Driver.GenerateMipmap().
* Generate a complete set of mipmaps from texObj's BaseLevel image.
* Stop at texObj's MaxLevel or when we get to the 1x1 texture.
* For cube maps, target will be one of
* GL_TEXTURE_CUBE_MAP_POSITIVE/NEGATIVE_X/Y/Z; never GL_TEXTURE_CUBE_MAP.
*/
void
_mesa_generate_mipmap(GLcontext *ctx, GLenum target,

View file

@ -281,7 +281,8 @@ valid_texture_object(const struct gl_texture_object *tex)
_mesa_problem(NULL, "invalid reference to a deleted texture object");
return GL_FALSE;
default:
_mesa_problem(NULL, "invalid texture object Target value");
_mesa_problem(NULL, "invalid texture object Target 0x%x, Id = %u",
tex->Target, tex->Name);
return GL_FALSE;
}
}

View file

@ -507,6 +507,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
trb->Base.BlueBits = trb->TexImage->TexFormat->BlueBits;
trb->Base.AlphaBits = trb->TexImage->TexFormat->AlphaBits;
trb->Base.DepthBits = trb->TexImage->TexFormat->DepthBits;
trb->Base.StencilBits = trb->TexImage->TexFormat->StencilBits;
}

View file

@ -343,7 +343,10 @@ _mesa_opcode_string(gl_inst_opcode opcode)
{
if (opcode < MAX_OPCODE)
return InstInfo[opcode].Name;
else
return "OP?";
else {
static char s[20];
_mesa_snprintf(s, sizeof(s), "OP%u", opcode);
return s;
}
}

View file

@ -75,7 +75,11 @@ file_string(gl_register_file f, gl_prog_print_mode mode)
case PROGRAM_UNDEFINED:
return "UNDEFINED";
default:
return "Unknown program file!";
{
static char s[20];
_mesa_snprintf(s, sizeof(s), "FILE%u", f);
return s;
}
}
}
@ -736,7 +740,10 @@ _mesa_fprint_instruction_opt(FILE *f,
mode, prog);
}
else {
_mesa_fprintf(f, "Other opcode %d\n", inst->Opcode);
fprint_alu_instruction(f, inst,
_mesa_opcode_string(inst->Opcode),
3/*_mesa_num_inst_src_regs(inst->Opcode)*/,
mode, prog);
}
break;
}

View file

@ -24,11 +24,12 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
* Brian Paul
*/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
* Brian Paul
*/
#include "main/imports.h"
#include "shader/prog_parameter.h"
@ -44,19 +45,21 @@
#include "st_program.h"
#include "st_inlines.h"
/**
* Pass the given program parameters to the graphics pipe as a
* constant buffer.
* \param id either PIPE_SHADER_VERTEX or PIPE_SHADER_FRAGMENT
* \param shader_type either PIPE_SHADER_VERTEX or PIPE_SHADER_FRAGMENT
*/
void st_upload_constants( struct st_context *st,
struct gl_program_parameter_list *params,
unsigned id)
unsigned shader_type)
{
struct pipe_context *pipe = st->pipe;
struct pipe_constant_buffer *cbuf = &st->state.constants[id];
struct pipe_constant_buffer *cbuf = &st->state.constants[shader_type];
assert(id == PIPE_SHADER_VERTEX || id == PIPE_SHADER_FRAGMENT);
assert(shader_type == PIPE_SHADER_VERTEX ||
shader_type == PIPE_SHADER_FRAGMENT);
/* update constants */
if (params && params->NumParameters) {
@ -68,13 +71,14 @@ void st_upload_constants( struct st_context *st,
* avoid gratuitous rendering synchronization.
*/
pipe_buffer_reference(&cbuf->buffer, NULL );
cbuf->buffer = pipe_buffer_create(pipe->screen, 16, PIPE_BUFFER_USAGE_CONSTANT,
cbuf->buffer = pipe_buffer_create(pipe->screen, 16,
PIPE_BUFFER_USAGE_CONSTANT,
paramBytes );
if (0)
{
printf("%s(shader=%d, numParams=%d, stateFlags=0x%x)\n",
__FUNCTION__, id, params->NumParameters, params->StateFlags);
if (0) {
debug_printf("%s(shader=%d, numParams=%d, stateFlags=0x%x)\n",
__FUNCTION__, shader_type, params->NumParameters,
params->StateFlags);
_mesa_print_parameter_list(params);
}
@ -84,15 +88,16 @@ void st_upload_constants( struct st_context *st,
0, paramBytes,
params->ParameterValues);
st->pipe->set_constant_buffer(st->pipe, id, 0, cbuf);
st->pipe->set_constant_buffer(st->pipe, shader_type, 0, cbuf);
}
else {
st->constants.tracked_state[id].dirty.mesa = 0;
// st->pipe->set_constant_buffer(st->pipe, id, 0, NULL);
st->constants.tracked_state[shader_type].dirty.mesa = 0x0;
}
}
/* Vertex shader:
/**
* Vertex shader:
*/
static void update_vs_constants(struct st_context *st )
{
@ -102,6 +107,7 @@ static void update_vs_constants(struct st_context *st )
st_upload_constants( st, params, PIPE_SHADER_VERTEX );
}
const struct st_tracked_state st_update_vs_constants = {
"st_update_vs_constants", /* name */
{ /* dirty */
@ -111,7 +117,10 @@ const struct st_tracked_state st_update_vs_constants = {
update_vs_constants /* update */
};
/* Fragment shader:
/**
* Fragment shader:
*/
static void update_fs_constants(struct st_context *st )
{
@ -121,6 +130,7 @@ static void update_fs_constants(struct st_context *st )
st_upload_constants( st, params, PIPE_SHADER_FRAGMENT );
}
const struct st_tracked_state st_update_fs_constants = {
"st_update_fs_constants", /* name */
{ /* dirty */

View file

@ -98,8 +98,6 @@ update_framebuffer_state( struct st_context *st )
struct st_renderbuffer *strb;
GLuint i;
memset(framebuffer, 0, sizeof(*framebuffer));
framebuffer->width = fb->Width;
framebuffer->height = fb->Height;
@ -120,13 +118,20 @@ update_framebuffer_state( struct st_context *st )
}
if (strb->surface) {
framebuffer->cbufs[framebuffer->nr_cbufs] = strb->surface;
pipe_surface_reference(&framebuffer->cbufs[framebuffer->nr_cbufs],
strb->surface);
framebuffer->nr_cbufs++;
}
strb->defined = GL_TRUE; /* we'll be drawing something */
}
}
for (i = framebuffer->nr_cbufs; i < PIPE_MAX_COLOR_BUFS; i++) {
pipe_surface_reference(&framebuffer->cbufs[i], NULL);
}
/*
* Depth/Stencil renderbuffer/surface.
*/
strb = st_renderbuffer(fb->Attachment[BUFFER_DEPTH].Renderbuffer);
if (strb) {
strb = st_renderbuffer(strb->Base.Wrapped);
@ -134,15 +139,14 @@ update_framebuffer_state( struct st_context *st )
/* rendering to a GL texture, may have to update surface */
update_renderbuffer_surface(st, strb);
}
framebuffer->zsbuf = strb->surface;
pipe_surface_reference(&framebuffer->zsbuf, strb->surface);
}
else {
strb = st_renderbuffer(fb->Attachment[BUFFER_STENCIL].Renderbuffer);
if (strb) {
strb = st_renderbuffer(strb->Base.Wrapped);
assert(strb->surface);
framebuffer->zsbuf = strb->surface;
pipe_surface_reference(&framebuffer->zsbuf, strb->surface);
}
}

View file

@ -28,6 +28,7 @@
#include "main/imports.h"
#include "main/mtypes.h"
#include "main/arrayobj.h"
#include "main/bufferobj.h"
#include "st_inlines.h"
@ -307,4 +308,8 @@ st_init_bufferobject_functions(struct dd_function_table *functions)
functions->MapBufferRange = st_bufferobj_map_range;
functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range;
functions->UnmapBuffer = st_bufferobj_unmap;
/* For GL_APPLE_vertex_array_object */
functions->NewArrayObject = _mesa_new_array_object;
functions->DeleteArrayObject = _mesa_delete_array_object;
}

View file

@ -233,6 +233,7 @@ void st_destroy_context( struct st_context *st )
struct pipe_context *pipe = st->pipe;
struct cso_context *cso = st->cso_context;
GLcontext *ctx = st->ctx;
GLuint i;
/* need to unbind and destroy CSO objects before anything else */
cso_release_all(st->cso_context);
@ -240,6 +241,12 @@ void st_destroy_context( struct st_context *st )
st_reference_fragprog(st, &st->fp, NULL);
st_reference_vertprog(st, &st->vp, NULL);
/* release framebuffer surfaces */
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
pipe_surface_reference(&st->state.framebuffer.cbufs[i], NULL);
}
pipe_surface_reference(&st->state.framebuffer.zsbuf, NULL);
_mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache);
_vbo_DestroyContext(st->ctx);

View file

@ -168,6 +168,8 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
ctx->Extensions.NV_blend_square = GL_TRUE;
ctx->Extensions.NV_texgen_reflection = GL_TRUE;

View file

@ -87,7 +87,7 @@ st_render_mipmap(struct st_context *st,
assert(target != GL_TEXTURE_3D); /* not done yet */
/* check if we can render in the texture's format */
if (!screen->is_format_supported(screen, pt->format, target,
if (!screen->is_format_supported(screen, pt->format, pt->target,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
return FALSE;
}
@ -123,6 +123,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
struct pipe_transfer *srcTrans, *dstTrans;
const ubyte *srcData;
ubyte *dstData;
int srcStride, dstStride;
srcTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
srcLevel, zslice,
@ -139,14 +140,17 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
srcData = (ubyte *) screen->transfer_map(screen, srcTrans);
dstData = (ubyte *) screen->transfer_map(screen, dstTrans);
srcStride = srcTrans->stride / srcTrans->block.size;
dstStride = dstTrans->stride / dstTrans->block.size;
_mesa_generate_mipmap_level(target, datatype, comps,
0 /*border*/,
pt->width[srcLevel], pt->height[srcLevel], pt->depth[srcLevel],
srcData,
srcTrans->stride, /* stride in bytes */
srcStride, /* stride in texels */
pt->width[dstLevel], pt->height[dstLevel], pt->depth[dstLevel],
dstData,
dstTrans->stride); /* stride in bytes */
dstStride); /* stride in texels */
screen->transfer_unmap(screen, srcTrans);
screen->transfer_unmap(screen, dstTrans);

View file

@ -1329,7 +1329,7 @@ static void
opt_sample_rgb_2d(GLcontext *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4])
const GLfloat lambda[], GLfloat rgba[][4])
{
const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel];
const GLfloat width = (GLfloat) img->Width;
@ -1351,9 +1351,9 @@ opt_sample_rgb_2d(GLcontext *ctx,
GLint j = IFLOOR(texcoords[k][1] * height) & rowMask;
GLint pos = (j << shift) | i;
GLchan *texel = ((GLchan *) img->Data) + 3*pos;
rgba[k][RCOMP] = texel[0];
rgba[k][GCOMP] = texel[1];
rgba[k][BCOMP] = texel[2];
rgba[k][RCOMP] = CHAN_TO_FLOAT(texel[0]);
rgba[k][GCOMP] = CHAN_TO_FLOAT(texel[1]);
rgba[k][BCOMP] = CHAN_TO_FLOAT(texel[2]);
}
}
@ -1370,7 +1370,7 @@ static void
opt_sample_rgba_2d(GLcontext *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoords[][4],
const GLfloat lambda[], GLchan rgba[][4])
const GLfloat lambda[], GLfloat rgba[][4])
{
const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel];
const GLfloat width = (GLfloat) img->Width;
@ -1392,7 +1392,10 @@ opt_sample_rgba_2d(GLcontext *ctx,
const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask;
const GLint pos = (row << shift) | col;
const GLchan *texel = ((GLchan *) img->Data) + (pos << 2); /* pos*4 */
COPY_4V(rgba[i], texel);
rgba[i][RCOMP] = CHAN_TO_FLOAT(texel[0]);
rgba[i][GCOMP] = CHAN_TO_FLOAT(texel[1]);
rgba[i][BCOMP] = CHAN_TO_FLOAT(texel[2]);
rgba[i][ACOMP] = CHAN_TO_FLOAT(texel[3]);
}
}
@ -1425,7 +1428,6 @@ sample_lambda_2d(GLcontext *ctx,
case GL_NEAREST:
if (repeatNoBorderPOT) {
switch (tImg->TexFormat->MesaFormat) {
#if 0
case MESA_FORMAT_RGB:
opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
@ -1434,7 +1436,6 @@ sample_lambda_2d(GLcontext *ctx,
opt_sample_rgba_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
#endif
default:
sample_nearest_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart );
@ -1484,7 +1485,6 @@ sample_lambda_2d(GLcontext *ctx,
case GL_NEAREST:
if (repeatNoBorderPOT) {
switch (tImg->TexFormat->MesaFormat) {
#if 0
case MESA_FORMAT_RGB:
opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
@ -1493,7 +1493,6 @@ sample_lambda_2d(GLcontext *ctx,
opt_sample_rgba_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;
#endif
default:
sample_nearest_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart );
@ -3180,7 +3179,6 @@ _swrast_choose_texture_sample_func( GLcontext *ctx,
}
else {
/* check for a few optimized cases */
#if 0
const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
ASSERT(t->MinFilter == GL_NEAREST);
if (t->WrapS == GL_REPEAT &&
@ -3197,10 +3195,6 @@ _swrast_choose_texture_sample_func( GLcontext *ctx,
img->TexFormat->MesaFormat == MESA_FORMAT_RGBA) {
return &opt_sample_rgba_2d;
}
#else
if (0)
;
#endif
else {
return &sample_nearest_2d;
}