Conflicts: src/gallium/auxiliary/util/u_tile.c src/gallium/auxiliary/util/u_tile.h src/gallium/drivers/identity/id_context.c src/gallium/drivers/llvmpipe/lp_setup.c src/gallium/drivers/llvmpipe/lp_setup.h src/gallium/drivers/softpipe/sp_tex_tile_cache.c src/gallium/include/pipe/p_context.h src/mesa/state_tracker/st_cb_bitmap.c src/mesa/state_tracker/st_cb_drawpixels.ctags/mesa-7.9-rc1
@@ -494,13 +494,16 @@ case $ARCH in | |||
OPTS="${OPTS} -Wl,-Mmapfile.scope" | |||
fi | |||
# Check if objects are SPARC v9 | |||
# Check if objects are 64-bit | |||
# file says: ELF 64-bit MSB relocatable SPARCV9 Version 1 | |||
set ${OBJECTS} | |||
if [ ${LINK} = "cc" -o ${LINK} = "CC" ] ; then | |||
SPARCV9=`file $1 | grep SPARCV9` | |||
if [ "${SPARCV9}" ] ; then | |||
OPTS="${OPTS} -xarch=v9" | |||
ABI64=`file $1 | grep "ELF 64-bit"` | |||
if [ "${ABI64}" ] ; then | |||
case `uname -p` in | |||
sparc) OPTS="${OPTS} -xarch=v9" ;; | |||
i386) OPTS="${OPTS} -xarch=amd64" ;; | |||
esac | |||
fi | |||
fi | |||
if [ "${ALTOPTS}" ] ; then |
@@ -100,7 +100,7 @@ GALLIUM_DIRS = auxiliary drivers state_trackers | |||
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a | |||
GALLIUM_DRIVERS_DIRS = softpipe failover svga i915 i965 r300 trace identity | |||
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) | |||
GALLIUM_WINSYS_DIRS = drm null xlib | |||
GALLIUM_WINSYS_DIRS = null xlib drm | |||
GALLIUM_TARGET_DIRS = libgl-xlib | |||
GALLIUM_WINSYS_DRM_DIRS = swrast | |||
GALLIUM_STATE_TRACKERS_DIRS = glx vega |
@@ -58,7 +58,7 @@ PROGRAM_DIRS := egl $(PROGRAM_DIRS) | |||
EGL_DRIVERS_DIRS = glx | |||
DRIVER_DIRS = dri | |||
GALLIUM_WINSYS_DIRS = drm | |||
GALLIUM_WINSYS_DIRS = null xlib drm | |||
GALLIUM_TARGET_DIRS = | |||
GALLIUM_WINSYS_DRM_DIRS = vmware intel i965 | |||
GALLIUM_STATE_TRACKERS_DIRS = egl |
@@ -22,6 +22,8 @@ LIBDRM_REQUIRED=2.4.15 | |||
LIBDRM_RADEON_REQUIRED=2.4.17 | |||
DRI2PROTO_REQUIRED=2.1 | |||
GLPROTO_REQUIRED=1.4.11 | |||
LIBDRM_XORG_REQUIRED=2.4.17 | |||
LIBKMS_XORG_REQUIRED=1.0.0 | |||
dnl Check for progs | |||
AC_PROG_CPP | |||
@@ -458,6 +460,7 @@ CORE_DIRS="glsl mesa" | |||
SRC_DIRS="glew" | |||
GLU_DIRS="sgi" | |||
GALLIUM_DIRS="auxiliary drivers state_trackers" | |||
GALLIUM_TARGET_DIRS="" | |||
GALLIUM_WINSYS_DIRS="" | |||
GALLIUM_WINSYS_DRM_DIRS="" | |||
GALLIUM_DRIVERS_DIRS="softpipe failover trace identity" | |||
@@ -467,11 +470,12 @@ case "$mesa_driver" in | |||
xlib) | |||
DRIVER_DIRS="x11" | |||
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib" | |||
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib" | |||
;; | |||
dri) | |||
SRC_DIRS="$SRC_DIRS glx" | |||
DRIVER_DIRS="dri" | |||
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm" | |||
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib drm" | |||
;; | |||
osmesa) | |||
DRIVER_DIRS="osmesa" | |||
@@ -481,6 +485,7 @@ AC_SUBST([SRC_DIRS]) | |||
AC_SUBST([GLU_DIRS]) | |||
AC_SUBST([DRIVER_DIRS]) | |||
AC_SUBST([GALLIUM_DIRS]) | |||
AC_SUBST([GALLIUM_TARGET_DIRS]) | |||
AC_SUBST([GALLIUM_WINSYS_DIRS]) | |||
AC_SUBST([GALLIUM_WINSYS_DRM_DIRS]) | |||
AC_SUBST([GALLIUM_DRIVERS_DIRS]) | |||
@@ -1200,7 +1205,7 @@ yes) | |||
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl" | |||
fi | |||
# Have only tested st/xorg on 1.6.0 servers | |||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0], | |||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED], | |||
HAVE_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg", | |||
HAVE_XORG="no") | |||
;; | |||
@@ -1220,9 +1225,9 @@ yes) | |||
fi | |||
;; | |||
xorg) | |||
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1], | |||
HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71", | |||
HAVE_XEXTPROTO_71="no") | |||
PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED]) | |||
PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED]) | |||
HAVE_XORG="yes" | |||
;; | |||
es) | |||
# mesa/es is required to build es state tracker | |||
@@ -1234,6 +1239,12 @@ yes) | |||
;; | |||
esac | |||
if test "x$HAVE_XORG" = xyes; then | |||
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1], | |||
HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71", | |||
HAVE_XEXTPROTO_71="no") | |||
fi | |||
AC_ARG_WITH([egl-displays], | |||
[AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@], | |||
[comma delimited native displays libEGL supports, e.g. | |||
@@ -1415,6 +1426,7 @@ echo "" | |||
if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then | |||
echo " Gallium: yes" | |||
echo " Gallium dirs: $GALLIUM_DIRS" | |||
echo " Target dirs: $GALLIUM_TARGET_DIRS" | |||
echo " Winsys dirs: $GALLIUM_WINSYS_DIRS" | |||
echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS" | |||
echo " Driver dirs: $GALLIUM_DRIVERS_DIRS" |
@@ -644,7 +644,7 @@ Hints and Special Features: | |||
- The Voodoo driver supports the GL_EXT_paletted_texture. it works | |||
only with GL_COLOR_INDEX8_EXT, GL_RGBA palettes and the alpha value | |||
is ignored because this is a limitation of the the current Glide | |||
is ignored because this is a limitation of the current Glide | |||
version and of the Voodoo hardware. See Mesa-3.1/3Dfx/demos/paltex.c for | |||
a demo of this extension. | |||
@@ -28,7 +28,7 @@ cards.</p> | |||
<ol> | |||
<li> | |||
<p>Run <code>configure</code> with the desired state trackers and and enable | |||
<p>Run <code>configure</code> with the desired state trackers and enable | |||
the Gallium driver for your hardware. For example</p> | |||
<pre> |
@@ -36,6 +36,7 @@ static int tex_width=64, tex_height=64, tex_depth=64; | |||
static float angx=0, angy=0, angz=0; | |||
static int texgen = 2, animate = 1, smooth = 1, wireframe = 0; | |||
static int CurTexture = NOISE_TEXTURE, CurObject = TORUS; | |||
static GLenum Filter = GL_LINEAR; | |||
static void | |||
@@ -298,8 +299,6 @@ create3Dtexture(void) | |||
printf("setting up 3d texture...\n"); | |||
glBindTexture(GL_TEXTURE_3D, NOISE_TEXTURE); | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT); | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT); | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT); | |||
@@ -406,6 +405,9 @@ drawScene(void) | |||
glDisable(GL_TEXTURE_GEN_R); | |||
} | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, Filter); | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, Filter); | |||
glCallList(CurObject); | |||
glPopMatrix(); | |||
@@ -505,6 +507,12 @@ KeyHandler(unsigned char key, int x, int y) | |||
else | |||
CurObject = TORUS; | |||
break; | |||
case 'f': | |||
if (Filter == GL_LINEAR) | |||
Filter = GL_NEAREST; | |||
else | |||
Filter = GL_LINEAR; | |||
break; | |||
case 'i': | |||
if (CurTexture == NOISE_TEXTURE) | |||
CurTexture = GRADIENT_TEXTURE; | |||
@@ -513,6 +521,7 @@ KeyHandler(unsigned char key, int x, int y) | |||
glBindTexture(GL_TEXTURE_3D, CurTexture); | |||
break; | |||
case 'a': | |||
case ' ': | |||
animate = !animate; | |||
if (animate) | |||
glutIdleFunc(Idle); | |||
@@ -559,8 +568,6 @@ create3Dgradient(void) | |||
glBindTexture(GL_TEXTURE_3D, GRADIENT_TEXTURE); | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT); | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT); | |||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT); |
@@ -57,13 +57,13 @@ peglgears: peglgears.o $(HEADERS) $(LIB_DEP) | |||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB) -lm | |||
xeglgears: xeglgears.o $(HEADERS) $(LIB_DEP) | |||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11 -lm | |||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lm -L$(libdir) -lX11 | |||
xeglthreads: xeglthreads.o $(HEADERS) $(LIB_DEP) | |||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11 -lm | |||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lm -L$(libdir) -lX11 | |||
xegl_tri: xegl_tri.o $(HEADERS) $(LIB_DEP) | |||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11 | |||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lm -L$(libdir) -lX11 | |||
clean: | |||
-rm -f *.o *~ |
@@ -0,0 +1,8 @@ | |||
void main() { | |||
float sum = 0.0; | |||
do { | |||
sum += 0.1; | |||
break; | |||
} while (true); | |||
gl_FragColor = vec4(sum); | |||
} |
@@ -0,0 +1,10 @@ | |||
void main() { | |||
float sum = 0.0; | |||
do { | |||
sum += 0.1; | |||
if (sum < 0.499999) | |||
continue; | |||
break; | |||
} while (true); | |||
gl_FragColor = vec4(sum); | |||
} |
@@ -0,0 +1,11 @@ | |||
uniform int KernelSizeInt; | |||
void main() { | |||
int i; | |||
vec4 sum = vec4(0.0); | |||
for (i = 0; i < KernelSizeInt; ++i) { | |||
sum.g += 0.25; | |||
} | |||
sum.a = 1.0; | |||
gl_FragColor = sum; | |||
} |
@@ -0,0 +1,13 @@ | |||
uniform int KernelSizeInt; | |||
void main() { | |||
int i; | |||
vec4 sum = vec4(0.0); | |||
for (i = 0; i < KernelSizeInt; ++i) { | |||
sum.g += 0.25; | |||
if (i > 0) | |||
break; | |||
} | |||
sum.a = 1.0; | |||
gl_FragColor = sum; | |||
} |
@@ -128,6 +128,11 @@ static void setup_uniforms() | |||
} | |||
{ | |||
GLint loci = glGetUniformLocationARB(program, "KernelSizeInt"); | |||
if (loci >= 0) | |||
glUniform1i(loci, 4); | |||
} | |||
{ | |||
GLint loc1f = glGetUniformLocationARB(program, "KernelValue1f"); | |||
GLint loc2f = glGetUniformLocationARB(program, "KernelValue2f"); |
@@ -0,0 +1,6 @@ | |||
void main() { | |||
// this should always be true | |||
if (gl_FragCoord.x >= 0.0) { | |||
gl_FragColor = vec4(0.5, 0.0, 0.5, 1.0); | |||
} | |||
} |
@@ -0,0 +1,7 @@ | |||
void main() { | |||
float sum = 0.0; | |||
while (sum < 0.499999) { | |||
sum += 0.1; | |||
} | |||
gl_FragColor = vec4(sum); | |||
} |
@@ -0,0 +1,9 @@ | |||
void main() { | |||
float sum = 0.0; | |||
while (true) { | |||
sum += 0.1; | |||
if (sum > 0.8) | |||
break; | |||
} | |||
gl_FragColor = vec4(sum); | |||
} |
@@ -1041,7 +1041,7 @@ glmFacetNormals(GLMmodel* model) | |||
/* glmVertexNormals: Generates smooth vertex normals for a model. | |||
* First builds a list of all the triangles each vertex is in. Then | |||
* loops through each vertex in the the list averaging all the facet | |||
* loops through each vertex in the list averaging all the facet | |||
* normals of the triangles each vertex is in. Finally, sets the | |||
* normal index in the triangle for the vertex to the generated smooth | |||
* normal. If the dot product of a facet normal and the facet normal |
@@ -153,7 +153,7 @@ glmFacetNormals(GLMmodel* model); | |||
/* glmVertexNormals: Generates smooth vertex normals for a model. | |||
* First builds a list of all the triangles each vertex is in. Then | |||
* loops through each vertex in the the list averaging all the facet | |||
* loops through each vertex in the list averaging all the facet | |||
* normals of the triangles each vertex is in. Finally, sets the | |||
* normal index in the triangle for the vertex to the generated smooth | |||
* normal. If the dot product of a facet normal and the facet normal |
@@ -12,29 +12,39 @@ bezmesh | |||
checker | |||
clip | |||
colormat | |||
combiner | |||
convolution | |||
cube | |||
cubemap | |||
depthcue | |||
dof | |||
double | |||
drawf | |||
feedback | |||
fog | |||
fogcoord | |||
fogindex | |||
font | |||
hello | |||
histogram | |||
image | |||
light | |||
lines | |||
list | |||
material | |||
minmax | |||
mipmap | |||
model | |||
movelight | |||
multisamp | |||
multitex | |||
mvarray | |||
nurbs | |||
pickdepth | |||
picksquare | |||
plane | |||
planet | |||
pointp | |||
polyoff | |||
polys | |||
quadric | |||
@@ -44,10 +54,12 @@ scene | |||
scenebamb | |||
sceneflat | |||
select | |||
shadowmap | |||
smooth | |||
stencil | |||
stroke | |||
surface | |||
surfpoints | |||
teaambient | |||
teapots | |||
tess | |||
@@ -56,6 +68,7 @@ texbind | |||
texgen | |||
texprox | |||
texsub | |||
texture3d | |||
texturesurf | |||
torus | |||
trim |
@@ -33,7 +33,8 @@ CheckError(int line) | |||
static void | |||
Display( void ) | |||
{ | |||
GLubyte *buffer = malloc(Width * Height * 4); | |||
GLboolean copyPix = GL_FALSE; | |||
GLboolean blitPix = GL_FALSE; | |||
GLenum status; | |||
CheckError(__LINE__); | |||
@@ -63,16 +64,43 @@ Display( void ) | |||
glutSolidTeapot(2.0); | |||
glPopMatrix(); | |||
/* read from user framebuffer */ | |||
glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); | |||
if (copyPix) { | |||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB); | |||
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); | |||
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); | |||
glDrawBuffer(GL_BACK); | |||
/* draw to window */ | |||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | |||
glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ | |||
glWindowPos2iARB(0, 0); | |||
glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); | |||
glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ | |||
glWindowPos2iARB(0, 0); | |||
glCopyPixels(0, 0, Width, Height, GL_COLOR); | |||
} | |||
else if (blitPix) { | |||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB); | |||
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); | |||
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); | |||
glDrawBuffer(GL_BACK); | |||
glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ | |||
glBlitFramebufferEXT(0, 0, Width, Height, | |||
0, 0, Width, Height, | |||
GL_COLOR_BUFFER_BIT, GL_NEAREST); | |||
} | |||
else { | |||
GLubyte *buffer = malloc(Width * Height * 4); | |||
/* read from user framebuffer */ | |||
glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); | |||
/* draw to window */ | |||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | |||
glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ | |||
glWindowPos2iARB(0, 0); | |||
glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); | |||
free(buffer); | |||
} | |||
free(buffer); | |||
glutSwapBuffers(); | |||
CheckError(__LINE__); | |||
} |
@@ -30,7 +30,7 @@ | |||
* it (via \c glPopClientAttrib). After popping, the state of the VAO is | |||
* examined. | |||
* | |||
* According the the APPLE_vertex_array_object spec, the contents of the VAO | |||
* According to the APPLE_vertex_array_object spec, the contents of the VAO | |||
* should be restored to the values that they had when pushed. | |||
* | |||
* \author Ian Romanick <idr@us.ibm.com> |
@@ -30,7 +30,7 @@ | |||
* it (via \c glPopClientAttrib). After popping, the state of the VAO is | |||
* examined. | |||
* | |||
* According the the APPLE_vertex_array_object spec, the contents of the VAO | |||
* According to the APPLE_vertex_array_object spec, the contents of the VAO | |||
* should be restored to the values that they had when pushed. | |||
* | |||
* \author Ian Romanick <idr@us.ibm.com> |
@@ -11,6 +11,7 @@ include $(TOP)/configs/current | |||
LIBS = -L$(TOP)/$(LIB_DIR) -l $(GLEW_LIB) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) | |||
SOURCES = \ | |||
clear-fbo-scissor.c \ | |||
clear-fbo-tex.c \ | |||
clear-fbo.c \ | |||
clear-scissor.c \ |
@@ -1,7 +1,8 @@ | |||
Import('*') | |||
progs = [ | |||
'clear-fbo-tex', | |||
'clear-fbo-scissor', | |||
'clear-fbo-tex', | |||
'clear-fbo', | |||
'clear-scissor', | |||
'clear-undefined', |
@@ -0,0 +1,234 @@ | |||
/* | |||
* Use scissor to clear the four quadrants of the FBO to different | |||
* colors. Then draw a grey triangle in the middle. | |||
*/ | |||
#include <assert.h> | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#include <math.h> | |||
#include <string.h> | |||
#include <GL/glew.h> | |||
#include <GL/glut.h> | |||
#include <GL/glu.h> | |||
static int Width = 512, Height = 512; | |||
static GLuint MyFB, MyRB; | |||
static GLboolean UseTex = GL_FALSE; | |||
static GLboolean UseCopyPix = GL_FALSE; | |||
#define CheckError() \ | |||
do { \ | |||
GLenum err = glGetError(); \ | |||
if (err != GL_NO_ERROR) \ | |||
printf("Error: %s\n", gluErrorString(err)); \ | |||
assert(err == GL_NO_ERROR); \ | |||
} while (0) | |||
static void | |||
Init(void) | |||
{ | |||
GLenum status; | |||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | |||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); | |||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); | |||
fflush(stderr); | |||
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { | |||
printf("GL_EXT_framebuffer_object not found!\n"); | |||
exit(0); | |||
} | |||
glGenFramebuffersEXT(1, &MyFB); | |||
glGenRenderbuffersEXT(1, &MyRB); | |||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); | |||
if (UseTex) { | |||
GLuint tex; | |||
glGenTextures(1, &tex); | |||
glBindTexture(GL_TEXTURE_2D, tex); | |||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, | |||
GL_RGBA, GL_UNSIGNED_BYTE, NULL); | |||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | |||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | |||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, | |||
GL_COLOR_ATTACHMENT0_EXT, | |||
GL_TEXTURE_2D, tex, 0); | |||
} | |||
else { | |||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, MyRB); | |||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, | |||
GL_COLOR_ATTACHMENT0_EXT, | |||
GL_RENDERBUFFER_EXT, MyRB); | |||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); | |||
} | |||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); | |||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { | |||
fprintf(stderr, "Framebuffer object is incomplete (0x%x)!\n", status); | |||
} | |||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | |||
} | |||
static void | |||
Reshape(int width, int height) | |||
{ | |||
glViewport(0, 0, width, height); | |||
glMatrixMode(GL_PROJECTION); | |||
glLoadIdentity(); | |||
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); | |||
glMatrixMode(GL_MODELVIEW); | |||
Width = width; | |||
Height = height; | |||
if (!UseTex) { | |||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); | |||
} | |||
} | |||
static void | |||
Key(unsigned char key, int x, int y) | |||
{ | |||
if (key == 27) { | |||
exit(0); | |||
} | |||
glutPostRedisplay(); | |||
} | |||
static void | |||
Draw(void) | |||
{ | |||
GLboolean scissor = GL_TRUE; | |||
/* draw to user framebuffer */ | |||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); | |||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); | |||
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); | |||
glViewport(0, 0, Width, Height); | |||
CheckError(); | |||
if (scissor) { | |||
glEnable(GL_SCISSOR_TEST); | |||
/* lower-left = red */ | |||
glClearColor(1, 0, 0, 0); | |||
glScissor(0, 0, Width / 2, Height / 2); | |||
glClear(GL_COLOR_BUFFER_BIT); | |||
/* lower-right = green */ | |||
glClearColor(0, 1, 0, 0); | |||
glScissor(Width / 2, 0, Width - Width / 2, Height / 2); | |||
glClear(GL_COLOR_BUFFER_BIT); | |||
/* upper-left = blue */ | |||
glClearColor(0, 0, 1, 0); | |||
glScissor(0, Height / 2, Width / 2, Height - Height / 2); | |||
glClear(GL_COLOR_BUFFER_BIT); | |||
/* upper-right = white */ | |||
glClearColor(1, 1, 1, 0); | |||
glScissor(Width / 2, Height / 2, Width - Width / 2, Height - Height / 2); | |||
glClear(GL_COLOR_BUFFER_BIT); | |||
glDisable(GL_SCISSOR_TEST); | |||
} | |||
else { | |||
glClearColor(0, 1, 0, 0); | |||
glClear(GL_COLOR_BUFFER_BIT); | |||
} | |||
CheckError(); | |||
/* gray triangle in middle, pointing up */ | |||
glColor3f(0.5, 0.5, 0.5); | |||
glBegin(GL_TRIANGLES); | |||
glVertex2f(Width/4, Height/4); | |||
glVertex2f(Width*3/4, Height/4); | |||
glVertex2f(Width/2, Height*3/4); | |||
glVertex2f(-0.5, -0.5); | |||
glVertex2f(+0.5, -0.5); | |||
glVertex2f( 0.0, 0.7); | |||
glEnd(); | |||
CheckError(); | |||
/* copy fbo to window */ | |||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB); | |||
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); | |||
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); | |||
glDrawBuffer(GL_BACK); | |||
if (UseCopyPix) { | |||
glWindowPos2i(0, 0); | |||
glCopyPixels(0, 0, Width, Height, GL_COLOR); | |||
} | |||
else { | |||
GLubyte *buffer = malloc(Width * Height * 4); | |||
/* read from user framebuffer */ | |||
glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); | |||
/* draw to window */ | |||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | |||
glWindowPos2iARB(0, 0); | |||
glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); | |||
free(buffer); | |||
} | |||
/* Bind normal framebuffer */ | |||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | |||
glutSwapBuffers(); | |||
CheckError(); | |||
} | |||
int | |||
main(int argc, char *argv[]) | |||
{ | |||
int i; | |||
glutInit(&argc, argv); | |||
glutInitWindowPosition(100, 0); | |||
glutInitWindowSize(Width, Height); | |||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); | |||
for (i = 1; i < argc; i++) { | |||
if (strcmp(argv[i], "-t") == 0) | |||
UseTex = GL_TRUE; | |||
else if (strcmp(argv[i], "-c") == 0) | |||
UseCopyPix = GL_TRUE; | |||
} | |||
if (UseTex) | |||
printf("Using render to texture\n"); | |||
else | |||
printf("Using user-created render buffer\n"); | |||
if (!glutCreateWindow(argv[0])) { | |||
exit(1); | |||
} | |||
glewInit(); | |||
Init(); | |||
glutReshapeFunc(Reshape); | |||
glutKeyboardFunc(Key); | |||
glutDisplayFunc(Draw); | |||
glutMainLoop(); | |||
return 0; | |||
} |
@@ -13,11 +13,14 @@ glxpixmap | |||
glxsnoop | |||
glxswapcontrol | |||
manywin | |||
msctest | |||
multictx | |||
offset | |||
omlsync | |||
overlay | |||
pbdemo | |||
pbinfo | |||
pbdemo | |||
shape | |||
sharedtex | |||
sharedtex_mt | |||
texture_from_pixmap | |||
@@ -26,5 +29,3 @@ xdemo | |||
xfont | |||
xrotfontdemo | |||
yuvrect_client | |||
msctest | |||
omlsync |
@@ -11,7 +11,7 @@ LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) | |||
# Add X11 and pthread libs to satisfy GNU gold. | |||
APP_LIB_DEPS += -lX11 -lpthread | |||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(APP_LIB_DEPS) | |||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(libdir) $(APP_LIB_DEPS) | |||
PROGS = \ | |||
corender \ |
@@ -82,11 +82,6 @@ def generate(env): | |||
print 'scons: could not determine the LLVM version from %s' % llvm_config | |||
return | |||
if llvm_version >= distutils.version.LooseVersion('2.7'): | |||
print 'scons: Ignoring unsupported LLVM version %s' % llvm_version | |||
print 'scons: See http://www.llvm.org/bugs/show_bug.cgi?id=6429' | |||
return | |||
env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')]) | |||
env.AppendUnique(CPPDEFINES = [ | |||
'__STDC_LIMIT_MACROS', | |||
@@ -138,11 +133,6 @@ def generate(env): | |||
llvm_version = env.backtick('llvm-config --version').rstrip() | |||
llvm_version = distutils.version.LooseVersion(llvm_version) | |||
if llvm_version >= distutils.version.LooseVersion('2.7'): | |||
print 'scons: Ignoring unsupported LLVM version %s' % llvm_version | |||
print 'scons: See http://www.llvm.org/bugs/show_bug.cgi?id=6429' | |||
return | |||
try: | |||
env.ParseConfig('llvm-config --cppflags') | |||
env.ParseConfig('llvm-config --libs jit interpreter nativecodegen bitwriter') |
@@ -436,9 +436,9 @@ aaline_create_texture(struct aaline_stage *aaline) | |||
/* This texture is new, no need to flush. | |||
*/ | |||
transfer = screen->get_tex_transfer(screen, aaline->texture, 0, level, 0, | |||
transfer = pipe->get_tex_transfer(pipe, aaline->texture, 0, level, 0, | |||
PIPE_TRANSFER_WRITE, 0, 0, size, size); | |||
data = screen->transfer_map(screen, transfer); | |||
data = pipe->transfer_map(pipe, transfer); | |||
if (data == NULL) | |||
return FALSE; | |||
@@ -462,8 +462,8 @@ aaline_create_texture(struct aaline_stage *aaline) | |||
} | |||
/* unmap */ | |||
screen->transfer_unmap(screen, transfer); | |||
screen->tex_transfer_destroy(transfer); | |||
pipe->transfer_unmap(pipe, transfer); | |||
pipe->tex_transfer_destroy(pipe, transfer); | |||
} | |||
return TRUE; | |||
} |
@@ -377,19 +377,21 @@ pstip_update_texture(struct pstip_stage *pstip) | |||
{ | |||
static const uint bit31 = 1 << 31; | |||
struct pipe_context *pipe = pstip->pipe; | |||
struct pipe_screen *screen = pipe->screen; | |||
struct pipe_transfer *transfer; | |||
const uint *stipple = pstip->state.stipple->stipple; | |||
uint i, j; | |||
ubyte *data; | |||
/* XXX: want to avoid flushing just because we use stipple: | |||
* | |||
* Flush should no longer be necessary if driver is properly | |||
* interleaving drawing and transfers on a given context: | |||
*/ | |||
pipe->flush( pipe, PIPE_FLUSH_TEXTURE_CACHE, NULL ); | |||
transfer = screen->get_tex_transfer(screen, pstip->texture, 0, 0, 0, | |||
PIPE_TRANSFER_WRITE, 0, 0, 32, 32); | |||
data = screen->transfer_map(screen, transfer); | |||
transfer = pipe->get_tex_transfer(pipe, pstip->texture, 0, 0, 0, | |||
PIPE_TRANSFER_WRITE, 0, 0, 32, 32); | |||
data = pipe->transfer_map(pipe, transfer); | |||
/* | |||
* Load alpha texture. | |||
@@ -411,8 +413,8 @@ pstip_update_texture(struct pstip_stage *pstip) | |||
} | |||
/* unmap */ | |||
screen->transfer_unmap(screen, transfer); | |||
screen->tex_transfer_destroy(transfer); | |||
pipe->transfer_unmap(pipe, transfer); | |||
pipe->tex_transfer_destroy(pipe, transfer); | |||
} | |||
@@ -35,7 +35,7 @@ | |||
#define LP_BLD_ALPHA_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
struct pipe_alpha_state; | |||
struct lp_type; |
@@ -232,6 +232,37 @@ lp_build_add(struct lp_build_context *bld, | |||
} | |||
/** Return the sum of the elements of a */ | |||
LLVMValueRef | |||
lp_build_sum_vector(struct lp_build_context *bld, | |||
LLVMValueRef a) | |||
{ | |||
const struct lp_type type = bld->type; | |||
LLVMValueRef index, res; | |||
int i; | |||
if (a == bld->zero) | |||
return bld->zero; | |||
if (a == bld->undef) | |||
return bld->undef; | |||
assert(type.length > 1); | |||
assert(!bld->type.norm); | |||
index = LLVMConstInt(LLVMInt32Type(), 0, 0); | |||
res = LLVMBuildExtractElement(bld->builder, a, index, ""); | |||
for (i = 1; i < type.length; i++) { | |||
index = LLVMConstInt(LLVMInt32Type(), i, 0); | |||
res = LLVMBuildAdd(bld->builder, res, | |||
LLVMBuildExtractElement(bld->builder, a, index, ""), | |||
""); | |||
} | |||
return res; | |||
} | |||
/** | |||
* Generate a - b | |||
*/ | |||
@@ -689,12 +720,12 @@ lp_build_negate(struct lp_build_context *bld, | |||
} | |||
/** Return -1, 0 or +1 depending on the sign of a */ | |||
LLVMValueRef | |||
lp_build_sgn(struct lp_build_context *bld, | |||
LLVMValueRef a) | |||
{ | |||
const struct lp_type type = bld->type; | |||
LLVMTypeRef vec_type = lp_build_vec_type(type); | |||
LLVMValueRef cond; | |||
LLVMValueRef res; | |||
@@ -704,14 +735,29 @@ lp_build_sgn(struct lp_build_context *bld, | |||
res = bld->one; | |||
} | |||
else if(type.floating) { | |||
/* Take the sign bit and add it to 1 constant */ | |||
LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); | |||
LLVMValueRef mask = lp_build_int_const_scalar(type, (unsigned long long)1 << (type.width - 1)); | |||
LLVMTypeRef vec_type; | |||
LLVMTypeRef int_type; | |||
LLVMValueRef mask; | |||
LLVMValueRef sign; | |||
LLVMValueRef one; | |||
sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, ""); | |||
unsigned long long maskBit = (unsigned long long)1 << (type.width - 1); | |||
if (type.length == 1) { | |||
int_type = lp_build_int_elem_type(type); | |||
vec_type = lp_build_elem_type(type); | |||
mask = LLVMConstInt(int_type, maskBit, 0); | |||
} | |||
else { | |||
/* vector */ | |||
int_type = lp_build_int_vec_type(type); | |||
vec_type = lp_build_vec_type(type); | |||
mask = lp_build_int_const_scalar(type, maskBit); | |||
} | |||
/* Take the sign bit and add it to 1 constant */ | |||
sign = LLVMBuildBitCast(bld->builder, a, int_type, ""); | |||
sign = LLVMBuildAnd(bld->builder, sign, mask, ""); | |||
one = LLVMConstBitCast(bld->one, int_vec_type); | |||
one = LLVMConstBitCast(bld->one, int_type); | |||
res = LLVMBuildOr(bld->builder, sign, one, ""); | |||
res = LLVMBuildBitCast(bld->builder, res, vec_type, ""); | |||
} | |||
@@ -883,6 +929,10 @@ lp_build_floor(struct lp_build_context *bld, | |||
assert(type.floating); | |||
if (type.length == 1) { | |||
return LLVMBuildFPTrunc(bld->builder, a, LLVMFloatType(), ""); | |||
} | |||
if(util_cpu_caps.has_sse4_1) | |||
return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR); | |||
else { | |||
@@ -953,6 +1003,9 @@ lp_build_itrunc(struct lp_build_context *bld, | |||
} | |||
/** | |||
* Convert float[] to int[] with round(). | |||
*/ | |||
LLVMValueRef | |||
lp_build_iround(struct lp_build_context *bld, | |||
LLVMValueRef a) | |||
@@ -1013,6 +1066,14 @@ lp_build_ifloor(struct lp_build_context *bld, | |||
LLVMValueRef res; | |||
assert(type.floating); | |||
if (type.length == 1) { | |||
/* scalar float to int */ | |||
LLVMTypeRef int_type = LLVMIntType(type.width); | |||
res = LLVMBuildFPToSI(bld->builder, a, int_type, ""); | |||
return res; | |||
} | |||
assert(lp_check_value(type, a)); | |||
if(util_cpu_caps.has_sse4_1) { |
@@ -37,7 +37,7 @@ | |||
#define LP_BLD_ARIT_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
struct lp_type; | |||
@@ -56,6 +56,10 @@ lp_build_add(struct lp_build_context *bld, | |||
LLVMValueRef a, | |||
LLVMValueRef b); | |||
LLVMValueRef | |||
lp_build_sum_vector(struct lp_build_context *bld, | |||
LLVMValueRef a); | |||
LLVMValueRef | |||
lp_build_sub(struct lp_build_context *bld, | |||
LLVMValueRef a, |
@@ -40,7 +40,7 @@ | |||
* for a standalone example. | |||
*/ | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
#include "pipe/p_format.h" | |||
@@ -221,8 +221,16 @@ lp_build_undef(struct lp_type type) | |||
LLVMValueRef | |||
lp_build_zero(struct lp_type type) | |||
{ | |||
LLVMTypeRef vec_type = lp_build_vec_type(type); | |||
return LLVMConstNull(vec_type); | |||
if (type.length == 1) { | |||
if (type.floating) | |||
return LLVMConstReal(LLVMFloatType(), 0.0); | |||
else | |||
return LLVMConstInt(LLVMIntType(type.width), 0, 0); | |||
} | |||
else { | |||
LLVMTypeRef vec_type = lp_build_vec_type(type); | |||
return LLVMConstNull(vec_type); | |||
} | |||
} | |||
@@ -37,7 +37,7 @@ | |||
#define LP_BLD_CONST_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
#include <pipe/p_compiler.h> | |||
@@ -37,7 +37,7 @@ | |||
#define LP_BLD_CONV_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
struct lp_type; |
@@ -30,7 +30,7 @@ | |||
#define LP_BLD_DEBUG_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
#include "pipe/p_compiler.h" | |||
#include "util/u_string.h" |
@@ -36,7 +36,7 @@ | |||
#define LP_BLD_DEPTH_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
struct pipe_depth_state; |
@@ -308,7 +308,7 @@ lp_build_flow_scope_end(struct lp_build_flow_context *flow) | |||
* Note: this function has no dependencies on the flow code and could | |||
* be used elsewhere. | |||
*/ | |||
static LLVMBasicBlockRef | |||
LLVMBasicBlockRef | |||
lp_build_insert_new_block(LLVMBuilderRef builder, const char *name) | |||
{ | |||
LLVMBasicBlockRef current_block; | |||
@@ -648,7 +648,9 @@ lp_build_if(struct lp_build_if_state *ctx, | |||
ifthen->phi[i] = LLVMBuildPhi(builder, LLVMTypeOf(*flow->variables[i]), ""); | |||
/* add add the initial value of the var from the entry block */ | |||
LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &ifthen->entry_block, 1); | |||
if (!LLVMIsUndef(*flow->variables[i])) | |||
LLVMAddIncoming(ifthen->phi[i], flow->variables[i], | |||
&ifthen->entry_block, 1); | |||
} | |||
/* create/insert true_block before merge_block */ | |||
@@ -695,18 +697,21 @@ lp_build_endif(struct lp_build_if_state *ctx) | |||
{ | |||
struct lp_build_flow_context *flow = ctx->flow; | |||
struct lp_build_flow_if *ifthen; | |||
LLVMBasicBlockRef curBlock = LLVMGetInsertBlock(ctx->builder); | |||
unsigned i; | |||
ifthen = &lp_build_flow_pop(flow, LP_BUILD_FLOW_IF)->ifthen; | |||
assert(ifthen); | |||
/* Insert branch to the merge block from current block */ | |||
LLVMBuildBr(ctx->builder, ifthen->merge_block); | |||
if (ifthen->false_block) { | |||
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block); | |||
/* for each variable, update the Phi node with a (variable, block) pair */ | |||
for (i = 0; i < flow->num_variables; i++) { | |||
assert(*flow->variables[i]); | |||
LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &ifthen->false_block, 1); | |||
LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &curBlock, 1); | |||
/* replace the variable ref with the phi function */ | |||
*flow->variables[i] = ifthen->phi[i]; | |||
} | |||
@@ -742,15 +747,18 @@ lp_build_endif(struct lp_build_if_state *ctx) | |||
ifthen->true_block, ifthen->merge_block); | |||
} | |||
/* Append an unconditional Br(anch) instruction on the true_block */ | |||
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->true_block); | |||
LLVMBuildBr(ctx->builder, ifthen->merge_block); | |||
/* Insert branch from end of true_block to merge_block */ | |||
if (ifthen->false_block) { | |||
/* Append an unconditional Br(anch) instruction on the false_block */ | |||
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->false_block); | |||
/* Append an unconditional Br(anch) instruction on the true_block */ | |||
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->true_block); | |||
LLVMBuildBr(ctx->builder, ifthen->merge_block); | |||
} | |||
else { | |||
/* No else clause. | |||
* Note that we've already inserted the branch at the end of | |||
* true_block. See the very first LLVMBuildBr() call in this function. | |||
*/ | |||
} | |||
/* Resume building code at end of the ifthen->merge_block */ | |||
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block); |
@@ -35,7 +35,7 @@ | |||
#define LP_BLD_FLOW_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
struct lp_type; | |||
@@ -145,7 +145,9 @@ lp_build_else(struct lp_build_if_state *ctx); | |||
void | |||
lp_build_endif(struct lp_build_if_state *ctx); | |||
LLVMBasicBlockRef | |||
lp_build_insert_new_block(LLVMBuilderRef builder, const char *name); | |||
#endif /* !LP_BLD_FLOW_H */ |
@@ -34,7 +34,7 @@ | |||
* Pixel format helpers. | |||
*/ | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
#include "pipe/p_format.h" | |||
@@ -41,7 +41,7 @@ | |||
#define LP_BLD_INTERP_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
#include "tgsi/tgsi_exec.h" | |||
@@ -37,7 +37,7 @@ | |||
#define LP_BLD_INTR_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
/** |
@@ -42,6 +42,26 @@ | |||
#include "lp_bld_logic.h" | |||
/* | |||
* XXX | |||
* | |||
* Selection with vector conditional like | |||
* | |||
* select <4 x i1> %C, %A, %B | |||
* | |||
* is valid IR (e.g. llvm/test/Assembler/vector-select.ll), but it is not | |||
* supported on any backend. | |||
* | |||
* Expanding the boolean vector to full SIMD register width, as in | |||
* | |||
* sext <4 x i1> %C to <4 x i32> | |||
* | |||
* is valid and supported (e.g., llvm/test/CodeGen/X86/vec_compare.ll), but | |||
* it causes assertion failures in LLVM 2.6. It appears to work correctly on | |||
* LLVM 2.7. | |||
*/ | |||
/** | |||
* Build code to compare two values 'a' and 'b' of 'type' using the given func. | |||
* \param func one of PIPE_FUNC_x | |||
@@ -54,13 +74,11 @@ lp_build_compare(LLVMBuilderRef builder, | |||
LLVMValueRef a, | |||
LLVMValueRef b) | |||
{ | |||
LLVMTypeRef vec_type = lp_build_vec_type(type); | |||
LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); | |||
LLVMValueRef zeros = LLVMConstNull(int_vec_type); | |||
LLVMValueRef ones = LLVMConstAllOnes(int_vec_type); | |||
LLVMValueRef cond; | |||
LLVMValueRef res; | |||
unsigned i; | |||
assert(func >= PIPE_FUNC_NEVER); | |||
assert(func <= PIPE_FUNC_ALWAYS); | |||
@@ -74,10 +92,12 @@ lp_build_compare(LLVMBuilderRef builder, | |||
/* XXX: It is not clear if we should use the ordered or unordered operators */ | |||
#if HAVE_LLVM < 0x0207 | |||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) | |||
if(type.width * type.length == 128) { | |||
if(type.floating && util_cpu_caps.has_sse) { | |||
/* float[4] comparison */ | |||
LLVMTypeRef vec_type = lp_build_vec_type(type); | |||
LLVMValueRef args[3]; | |||
unsigned cc; | |||
boolean swap; | |||
@@ -147,6 +167,7 @@ lp_build_compare(LLVMBuilderRef builder, | |||
const char *pcmpgt; | |||
LLVMValueRef args[2]; | |||
LLVMValueRef res; | |||
LLVMTypeRef vec_type = lp_build_vec_type(type); | |||
switch (type.width) { | |||
case 8: | |||
@@ -200,6 +221,7 @@ lp_build_compare(LLVMBuilderRef builder, | |||
} | |||
} /* if (type.width * type.length == 128) */ | |||
#endif | |||
#endif /* HAVE_LLVM < 0x0207 */ | |||
if(type.floating) { | |||
LLVMRealPredicate op; | |||
@@ -233,16 +255,19 @@ lp_build_compare(LLVMBuilderRef builder, | |||
return lp_build_undef(type); | |||
} | |||
#if 0 | |||
/* XXX: Although valid IR, no LLVM target currently support this */ | |||
#if HAVE_LLVM >= 0x0207 | |||
cond = LLVMBuildFCmp(builder, op, a, b, ""); | |||
res = LLVMBuildSelect(builder, cond, ones, zeros, ""); | |||
res = LLVMBuildSExt(builder, cond, int_vec_type, ""); | |||
#else | |||
res = LLVMGetUndef(int_vec_type); | |||
if (type.length == 1) { | |||
res = LLVMBuildFCmp(builder, op, a, b, ""); | |||
cond = LLVMBuildFCmp(builder, op, a, b, ""); | |||
res = LLVMBuildSExt(builder, cond, int_vec_type, ""); | |||
} | |||
else { | |||
unsigned i; | |||
res = LLVMGetUndef(int_vec_type); | |||
debug_printf("%s: warning: using slow element-wise float" | |||
" vector comparison\n", __FUNCTION__); | |||
for (i = 0; i < type.length; ++i) { | |||
@@ -286,16 +311,19 @@ lp_build_compare(LLVMBuilderRef builder, | |||
return lp_build_undef(type); | |||
} | |||
#if 0 | |||
/* XXX: Although valid IR, no LLVM target currently support this */ | |||
#if HAVE_LLVM >= 0x0207 | |||
cond = LLVMBuildICmp(builder, op, a, b, ""); | |||
res = LLVMBuildSelect(builder, cond, ones, zeros, ""); | |||
res = LLVMBuildSExt(builder, cond, int_vec_type, ""); | |||
#else | |||
res = LLVMGetUndef(int_vec_type); | |||
if (type.length == 1) { | |||
res = LLVMBuildICmp(builder, op, a, b, ""); | |||
cond = LLVMBuildICmp(builder, op, a, b, ""); | |||
res = LLVMBuildSExt(builder, cond, int_vec_type, ""); | |||
} | |||
else { | |||
unsigned i; | |||
res = LLVMGetUndef(int_vec_type); | |||
debug_printf("%s: warning: using slow element-wise int" | |||
" vector comparison\n", __FUNCTION__); | |||
@@ -337,6 +365,8 @@ lp_build_cmp(struct lp_build_context *bld, | |||
/** | |||
* Return mask ? a : b; | |||
* | |||
* mask is a bitwise mask, composed of 0 or ~0 for each element. | |||
*/ | |||
LLVMValueRef | |||
lp_build_select(struct lp_build_context *bld, | |||
@@ -351,6 +381,7 @@ lp_build_select(struct lp_build_context *bld, | |||
return a; | |||
if (type.length == 1) { | |||
mask = LLVMBuildTrunc(bld->builder, mask, LLVMInt1Type(), ""); | |||
res = LLVMBuildSelect(bld->builder, mask, a, b, ""); | |||
} | |||
else { |
@@ -37,7 +37,7 @@ | |||
#define LP_BLD_LOGIC_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
#include "pipe/p_defines.h" /* For PIPE_FUNC_xxx */ | |||
@@ -256,7 +256,7 @@ lp_build_pack2(LLVMBuilderRef builder, | |||
LLVMValueRef lo, | |||
LLVMValueRef hi) | |||
{ | |||
#if !(HAVE_LLVM >= 0x0207) | |||
#if HAVE_LLVM < 0x0207 | |||
LLVMTypeRef src_vec_type = lp_build_vec_type(src_type); | |||
#endif | |||
LLVMTypeRef dst_vec_type = lp_build_vec_type(dst_type); |
@@ -37,7 +37,7 @@ | |||
#define LP_BLD_PACK_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
struct lp_type; |
@@ -155,14 +155,16 @@ lp_build_gather(LLVMBuilderRef builder, | |||
/** | |||
* Compute the offset of a pixel. | |||
* | |||
* x, y, y_stride are vectors | |||
* x, y, z, y_stride, z_stride are vectors | |||
*/ | |||
LLVMValueRef | |||
lp_build_sample_offset(struct lp_build_context *bld, | |||
const struct util_format_description *format_desc, | |||
LLVMValueRef x, | |||
LLVMValueRef y, | |||
LLVMValueRef y_stride) | |||
LLVMValueRef z, | |||
LLVMValueRef y_stride, | |||
LLVMValueRef z_stride) | |||
{ | |||
LLVMValueRef x_stride; | |||
LLVMValueRef offset; | |||
@@ -178,6 +180,10 @@ lp_build_sample_offset(struct lp_build_context *bld, | |||
LLVMValueRef y_offset_lo, y_offset_hi; | |||
LLVMValueRef offset_lo, offset_hi; | |||
/* XXX 1D & 3D addressing not done yet */ | |||
assert(!z); | |||
assert(!z_stride); | |||
x_lo = LLVMBuildAnd(bld->builder, x, bld->one, ""); | |||
y_lo = LLVMBuildAnd(bld->builder, y, bld->one, ""); | |||
@@ -201,13 +207,17 @@ lp_build_sample_offset(struct lp_build_context *bld, | |||
offset = lp_build_add(bld, offset_hi, offset_lo); | |||
} | |||
else { | |||
LLVMValueRef x_offset; | |||
LLVMValueRef y_offset; | |||
offset = lp_build_mul(bld, x, x_stride); | |||
x_offset = lp_build_mul(bld, x, x_stride); | |||
y_offset = lp_build_mul(bld, y, y_stride); | |||
if (y && y_stride) { | |||
LLVMValueRef y_offset = lp_build_mul(bld, y, y_stride); | |||
offset = lp_build_add(bld, offset, y_offset); | |||
} | |||
offset = lp_build_add(bld, x_offset, y_offset); | |||
if (z && z_stride) { | |||
LLVMValueRef z_offset = lp_build_mul(bld, z, z_stride); | |||
offset = lp_build_add(bld, offset, z_offset); | |||
} | |||
} | |||
return offset; |
@@ -36,7 +36,7 @@ | |||
#define LP_BLD_SAMPLE_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
struct pipe_texture; | |||
struct pipe_sampler_state; | |||
@@ -113,9 +113,9 @@ struct lp_sampler_dynamic_state | |||
unsigned unit); | |||
LLVMValueRef | |||
(*stride)( struct lp_sampler_dynamic_state *state, | |||
LLVMBuilderRef builder, | |||
unsigned unit); | |||
(*row_stride)( struct lp_sampler_dynamic_state *state, | |||
LLVMBuilderRef builder, | |||
unsigned unit); | |||
LLVMValueRef | |||
(*data_ptr)( struct lp_sampler_dynamic_state *state, | |||
@@ -148,7 +148,9 @@ lp_build_sample_offset(struct lp_build_context *bld, | |||
const struct util_format_description *format_desc, | |||
LLVMValueRef x, | |||
LLVMValueRef y, | |||
LLVMValueRef y_stride); | |||
LLVMValueRef z, | |||
LLVMValueRef y_stride, | |||
LLVMValueRef z_stride); | |||
void |
@@ -37,7 +37,7 @@ | |||
#define LP_BLD_STRUCT_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
#include <llvm-c/Target.h> | |||
#include "util/u_debug.h" |
@@ -37,7 +37,7 @@ | |||
#define LP_BLD_SWIZZLE_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
struct lp_type; |
@@ -35,7 +35,7 @@ | |||
#ifndef LP_BLD_TGSI_H | |||
#define LP_BLD_TGSI_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
struct tgsi_token; |
@@ -41,6 +41,7 @@ | |||
#include "util/u_debug.h" | |||
#include "util/u_math.h" | |||
#include "util/u_memory.h" | |||
#include "tgsi/tgsi_dump.h" | |||
#include "tgsi/tgsi_info.h" | |||
#include "tgsi/tgsi_parse.h" | |||
#include "tgsi/tgsi_util.h" | |||
@@ -95,6 +96,19 @@ struct lp_exec_mask { | |||
int cond_stack_size; | |||
LLVMValueRef cond_mask; | |||
LLVMValueRef break_stack[LP_TGSI_MAX_NESTING]; | |||
int break_stack_size; | |||
LLVMValueRef break_mask; | |||
LLVMValueRef cont_stack[LP_TGSI_MAX_NESTING]; | |||
int cont_stack_size; | |||
LLVMValueRef cont_mask; | |||
LLVMBasicBlockRef loop_stack[LP_TGSI_MAX_NESTING]; | |||
int loop_stack_size; | |||
LLVMBasicBlockRef loop_block; | |||
LLVMValueRef exec_mask; | |||
}; | |||
@@ -145,14 +159,33 @@ static void lp_exec_mask_init(struct lp_exec_mask *mask, struct lp_build_context | |||
mask->bld = bld; | |||
mask->has_mask = FALSE; | |||
mask->cond_stack_size = 0; | |||
mask->loop_stack_size = 0; | |||
mask->break_stack_size = 0; | |||
mask->cont_stack_size = 0; | |||
mask->int_vec_type = lp_build_int_vec_type(mask->bld->type); | |||
} | |||
static void lp_exec_mask_update(struct lp_exec_mask *mask) | |||
{ | |||
mask->exec_mask = mask->cond_mask; | |||
mask->has_mask = (mask->cond_stack_size > 0); | |||
if (mask->loop_stack_size) { | |||
/*for loops we need to update the entire mask at | |||
* runtime */ | |||
LLVMValueRef tmp; | |||
tmp = LLVMBuildAnd(mask->bld->builder, | |||
mask->cont_mask, | |||
mask->break_mask, | |||
"maskcb"); | |||
mask->exec_mask = LLVMBuildAnd(mask->bld->builder, | |||
mask->cond_mask, | |||
tmp, | |||
"maskfull"); | |||
} else | |||
mask->exec_mask = mask->cond_mask; | |||
mask->has_mask = (mask->cond_stack_size > 0 || | |||
mask->loop_stack_size > 0); | |||
} | |||
static void lp_exec_mask_cond_push(struct lp_exec_mask *mask, | |||
@@ -189,6 +222,89 @@ static void lp_exec_mask_cond_pop(struct lp_exec_mask *mask) | |||
lp_exec_mask_update(mask); | |||
} | |||
static void lp_exec_bgnloop(struct lp_exec_mask *mask) | |||
{ | |||
if (mask->cont_stack_size == 0) | |||
mask->cont_mask = LLVMConstAllOnes(mask->int_vec_type); | |||
if (mask->cont_stack_size == 0) | |||
mask->break_mask = LLVMConstAllOnes(mask->int_vec_type); | |||
if (mask->cond_stack_size == 0) | |||
mask->cond_mask = LLVMConstAllOnes(mask->int_vec_type); | |||
mask->loop_stack[mask->loop_stack_size++] = mask->loop_block; | |||
mask->loop_block = lp_build_insert_new_block(mask->bld->builder, "bgnloop"); | |||
LLVMBuildBr(mask->bld->builder, mask->loop_block); | |||
LLVMPositionBuilderAtEnd(mask->bld->builder, mask->loop_block); | |||
lp_exec_mask_update(mask); | |||
} | |||
static void lp_exec_break(struct lp_exec_mask *mask) | |||
{ | |||
LLVMValueRef exec_mask = LLVMBuildNot(mask->bld->builder, | |||
mask->exec_mask, | |||
"break"); | |||
mask->break_stack[mask->break_stack_size++] = mask->break_mask; | |||
if (mask->break_stack_size > 1) { | |||
mask->break_mask = LLVMBuildAnd(mask->bld->builder, | |||
mask->break_mask, | |||
exec_mask, "break_full"); | |||
} else | |||
mask->break_mask = exec_mask; | |||
lp_exec_mask_update(mask); | |||
} | |||
static void lp_exec_continue(struct lp_exec_mask *mask) | |||
{ | |||
LLVMValueRef exec_mask = LLVMBuildNot(mask->bld->builder, | |||
mask->exec_mask, | |||
""); | |||
mask->cont_stack[mask->cont_stack_size++] = mask->cont_mask; | |||
if (mask->cont_stack_size > 1) { | |||
mask->cont_mask = LLVMBuildAnd(mask->bld->builder, | |||
mask->cont_mask, | |||
exec_mask, ""); | |||
} else | |||
mask->cont_mask = exec_mask; | |||
lp_exec_mask_update(mask); | |||
} | |||
static void lp_exec_endloop(struct lp_exec_mask *mask) | |||
{ | |||
LLVMBasicBlockRef endloop; | |||
LLVMTypeRef reg_type = LLVMIntType(mask->bld->type.width* | |||
mask->bld->type.length); | |||
/* i1cond = (mask == 0) */ | |||
LLVMValueRef i1cond = LLVMBuildICmp( | |||
mask->bld->builder, | |||
LLVMIntNE, | |||
LLVMBuildBitCast(mask->bld->builder, mask->break_mask, reg_type, ""), | |||
LLVMConstNull(reg_type), ""); | |||
endloop = lp_build_insert_new_block(mask->bld->builder, "endloop"); | |||
LLVMBuildCondBr(mask->bld->builder, | |||
i1cond, mask->loop_block, endloop); | |||
LLVMPositionBuilderAtEnd(mask->bld->builder, endloop); | |||
mask->loop_block = mask->loop_stack[--mask->loop_stack_size]; | |||
/* pop the break mask */ | |||
if (mask->cont_stack_size) { | |||
mask->cont_mask = mask->cont_stack[--mask->cont_stack_size]; | |||
} | |||
if (mask->break_stack_size) { | |||
mask->break_mask = mask->cont_stack[--mask->break_stack_size]; | |||
} | |||
lp_exec_mask_update(mask); | |||
} | |||
static void lp_exec_mask_store(struct lp_exec_mask *mask, | |||
LLVMValueRef val, | |||
LLVMValueRef dst) | |||
@@ -1363,14 +1479,15 @@ emit_instruction( | |||
case TGSI_OPCODE_TXP: | |||
emit_tex( bld, inst, FALSE, TRUE, dst0 ); | |||
break; | |||
case TGSI_OPCODE_BRK: | |||
/* FIXME */ | |||
return 0; | |||
lp_exec_break(&bld->exec_mask); | |||
break; | |||
case TGSI_OPCODE_IF: | |||
tmp0 = emit_fetch(bld, inst, 0, CHAN_X); | |||
tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_NOTEQUAL, | |||
tmp0, bld->base.zero); | |||
lp_exec_mask_cond_push(&bld->exec_mask, tmp0); | |||
break; | |||
@@ -1380,6 +1497,10 @@ emit_instruction( | |||
return 0; | |||
break; | |||
case TGSI_OPCODE_BGNLOOP: | |||
lp_exec_bgnloop(&bld->exec_mask); | |||
break; | |||
case TGSI_OPCODE_REP: | |||
/* deprecated */ | |||
assert(0); | |||
@@ -1400,6 +1521,10 @@ emit_instruction( | |||
return 0; | |||
break; | |||
case TGSI_OPCODE_ENDLOOP: | |||
lp_exec_endloop(&bld->exec_mask); | |||
break; | |||
case TGSI_OPCODE_ENDREP: | |||
/* deprecated */ | |||
assert(0); | |||
@@ -1499,8 +1624,7 @@ emit_instruction( | |||
break; | |||
case TGSI_OPCODE_CONT: | |||
/* FIXME */ | |||
return 0; | |||
lp_exec_continue(&bld->exec_mask); | |||
break; | |||
case TGSI_OPCODE_EMIT: | |||
@@ -1603,7 +1727,14 @@ lp_build_tgsi_soa(LLVMBuilderRef builder, | |||
assert( 0 ); | |||
} | |||
} | |||
if (0) { | |||
LLVMBasicBlockRef block = LLVMGetInsertBlock(builder); | |||
LLVMValueRef function = LLVMGetBasicBlockParent(block); | |||
debug_printf("11111111111111111111111111111 \n"); | |||
tgsi_dump(tokens, 0); | |||
LLVMDumpValue(function); | |||
debug_printf("2222222222222222222222222222 \n"); | |||
} | |||
tgsi_parse_free( &parse ); | |||
} | |||
@@ -58,7 +58,10 @@ LLVMTypeRef | |||
lp_build_vec_type(struct lp_type type) | |||
{ | |||
LLVMTypeRef elem_type = lp_build_elem_type(type); | |||
return LLVMVectorType(elem_type, type.length); | |||
if (type.length == 1) | |||
return elem_type; | |||
else | |||
return LLVMVectorType(elem_type, type.length); | |||
} | |||
@@ -115,6 +118,9 @@ lp_check_vec_type(struct lp_type type, LLVMTypeRef vec_type) | |||
if(!vec_type) | |||
return FALSE; | |||
if (type.length == 1) | |||
return lp_check_elem_type(type, vec_type); | |||
if(LLVMGetTypeKind(vec_type) != LLVMVectorTypeKind) | |||
return FALSE; | |||
@@ -153,7 +159,10 @@ LLVMTypeRef | |||
lp_build_int_vec_type(struct lp_type type) | |||
{ | |||
LLVMTypeRef elem_type = lp_build_int_elem_type(type); | |||
return LLVMVectorType(elem_type, type.length); | |||
if (type.length == 1) | |||
return elem_type; | |||
else | |||
return LLVMVectorType(elem_type, type.length); | |||
} | |||
@@ -37,7 +37,7 @@ | |||
#define LP_BLD_TYPE_H | |||
#include <llvm-c/Core.h> | |||
#include "os/os_llvm.h" | |||
#include <pipe/p_compiler.h> | |||
@@ -0,0 +1,47 @@ | |||
/************************************************************************** | |||
* | |||
* Copyright 2010 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: | |||
* | |||
* The above copyright notice and this permission notice (including the | |||
* next paragraph) shall be included in all copies or substantial portions | |||
* of the Software. | |||
* | |||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | |||
* IN NO EVENT SHALL VMWARE AND/OR 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. | |||
* | |||
**************************************************************************/ | |||
/** | |||
* @file | |||
* Wrapper for LLVM header file #includes. | |||
*/ | |||
#ifndef OS_LLVM_H | |||
#define OS_LLVM_H | |||
#include <llvm-c/Core.h> | |||
/** Set version to 0 if missing to avoid #ifdef HAVE_LLVM everywhere */ | |||
#ifndef HAVE_LLVM | |||
#define HAVE_LLVM 0x0 | |||
#endif | |||
#endif /* OS_LLVM_H */ |
@@ -71,7 +71,7 @@ os_time_sleep(int64_t usecs); | |||
/* | |||
* Helper function for detecting time outs, taking in account overflow. | |||
* | |||
* Returns true the the current time has elapsed beyond the specified interval. | |||
* Returns true if the current time has elapsed beyond the specified interval. | |||
*/ | |||
static INLINE boolean | |||
os_time_timeout(int64_t start, |
@@ -393,10 +393,10 @@ static fetch_func get_fetch_func( enum pipe_format format ) | |||
return &fetch_R8G8B8A8_SSCALED; | |||
case PIPE_FORMAT_B8G8R8A8_UNORM: | |||
return &fetch_A8R8G8B8_UNORM; | |||
return &fetch_B8G8R8A8_UNORM; | |||
case PIPE_FORMAT_A8R8G8B8_UNORM: | |||
return &fetch_B8G8R8A8_UNORM; | |||
return &fetch_A8R8G8B8_UNORM; | |||
case PIPE_FORMAT_R32_FIXED: | |||
return &fetch_R32_FIXED; | |||
@@ -552,10 +552,10 @@ static emit_func get_emit_func( enum pipe_format format ) | |||
return &emit_R8G8B8A8_SSCALED; | |||
case PIPE_FORMAT_B8G8R8A8_UNORM: | |||
return &emit_A8R8G8B8_UNORM; | |||
return &emit_B8G8R8A8_UNORM; | |||
case PIPE_FORMAT_A8R8G8B8_UNORM: | |||
return &emit_B8G8R8A8_UNORM; | |||
return &emit_A8R8G8B8_UNORM; | |||
default: | |||
assert(0); |
@@ -336,7 +336,7 @@ static boolean translate_attr( struct translate_sse *p, | |||
case PIPE_FORMAT_R32G32B32A32_FLOAT: | |||
emit_load_R32G32B32A32(p, dataXMM, srcECX); | |||
break; | |||
case PIPE_FORMAT_A8R8G8B8_UNORM: | |||
case PIPE_FORMAT_B8G8R8A8_UNORM: | |||
emit_load_R8G8B8A8_UNORM(p, dataXMM, srcECX); | |||
emit_swizzle(p, dataXMM, dataXMM, SHUF(Z,Y,X,W)); | |||
break; | |||
@@ -360,7 +360,7 @@ static boolean translate_attr( struct translate_sse *p, | |||
case PIPE_FORMAT_R32G32B32A32_FLOAT: | |||
emit_store_R32G32B32A32(p, dstEAX, dataXMM); | |||
break; | |||
case PIPE_FORMAT_A8R8G8B8_UNORM: | |||
case PIPE_FORMAT_B8G8R8A8_UNORM: | |||
emit_swizzle(p, dataXMM, dataXMM, SHUF(Z,Y,X,W)); | |||
emit_store_R8G8B8A8_UNORM(p, dstEAX, dataXMM); | |||
break; |
@@ -109,9 +109,9 @@ struct blitter_context_priv | |||
struct blitter_context *util_blitter_create(struct pipe_context *pipe) | |||
{ | |||
struct blitter_context_priv *ctx; | |||
struct pipe_blend_state blend = { 0 }; | |||
struct pipe_depth_stencil_alpha_state dsa = { { 0 } }; | |||
struct pipe_rasterizer_state rs_state = { 0 }; | |||
struct pipe_blend_state blend; | |||
struct pipe_depth_stencil_alpha_state dsa; | |||
struct pipe_rasterizer_state rs_state; | |||
struct pipe_sampler_state *sampler_state; | |||
struct pipe_vertex_element velem[2]; | |||
unsigned i; | |||
@@ -134,12 +134,14 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) | |||
ctx->blitter.saved_num_sampler_states = ~0; | |||
/* blend state objects */ | |||
memset(&blend, 0, sizeof(blend)); | |||
ctx->blend_keep_color = pipe->create_blend_state(pipe, &blend); | |||
blend.rt[0].colormask = PIPE_MASK_RGBA; | |||
ctx->blend_write_color = pipe->create_blend_state(pipe, &blend); | |||
/* depth stencil alpha state objects */ | |||
memset(&dsa, 0, sizeof(dsa)); | |||
ctx->dsa_keep_depth_stencil = | |||
pipe->create_depth_stencil_alpha_state(pipe, &dsa); | |||
@@ -421,26 +421,31 @@ void debug_dump_image(const char *prefix, | |||
#endif | |||
} | |||
void debug_dump_surface(const char *prefix, | |||
void debug_dump_surface(struct pipe_context *pipe, | |||
const char *prefix, | |||
struct pipe_surface *surface) | |||
{ | |||
struct pipe_texture *texture; | |||
struct pipe_screen *screen; | |||
struct pipe_transfer *transfer; | |||
void *data; | |||
if (!surface) | |||
return; | |||
/* XXX: this doesn't necessarily work, as the driver may be using | |||
* temporary storage for the surface which hasn't been propagated | |||
* back into the texture. Need to nail down the semantics of views | |||
* and transfers a bit better before we can say if extra work needs | |||
* to be done here: | |||
*/ | |||
texture = surface->texture; | |||
screen = texture->screen; | |||
transfer = screen->get_tex_transfer(screen, texture, surface->face, | |||
surface->level, surface->zslice, | |||
PIPE_TRANSFER_READ, 0, 0, surface->width, | |||
surface->height); | |||
transfer = pipe->get_tex_transfer(pipe, texture, surface->face, | |||
surface->level, surface->zslice, | |||
PIPE_TRANSFER_READ, 0, 0, surface->width, | |||
surface->height); | |||
data = screen->transfer_map(screen, transfer); | |||
data = pipe->transfer_map(pipe, transfer); | |||
if(!data) | |||
goto error; | |||
@@ -452,13 +457,14 @@ void debug_dump_surface(const char *prefix, | |||
transfer->stride, | |||
data); | |||
screen->transfer_unmap(screen, transfer); | |||
pipe->transfer_unmap(pipe, transfer); | |||
error: | |||
screen->tex_transfer_destroy(transfer); | |||
pipe->tex_transfer_destroy(pipe, transfer); | |||
} | |||
void debug_dump_texture(const char *prefix, | |||
void debug_dump_texture(struct pipe_context *pipe, | |||
const char *prefix, | |||
struct pipe_texture *texture) | |||
{ | |||
struct pipe_surface *surface; | |||
@@ -473,7 +479,7 @@ void debug_dump_texture(const char *prefix, | |||
surface = screen->get_tex_surface(screen, texture, 0, 0, 0, | |||
PIPE_TEXTURE_USAGE_SAMPLER); | |||
if (surface) { | |||
debug_dump_surface(prefix, surface); | |||
debug_dump_surface(pipe, prefix, surface); | |||
screen->tex_surface_destroy(surface); | |||
} | |||
} | |||
@@ -511,27 +517,28 @@ struct bmp_rgb_quad { | |||
}; | |||
void | |||
debug_dump_surface_bmp(const char *filename, | |||
debug_dump_surface_bmp(struct pipe_context *pipe, | |||
const char *filename, | |||
struct pipe_surface *surface) | |||
{ | |||
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT | |||
struct pipe_transfer *transfer; | |||
struct pipe_texture *texture = surface->texture; | |||
struct pipe_screen *screen = texture->screen; | |||
transfer = screen->get_tex_transfer(screen, texture, surface->face, | |||
surface->level, surface->zslice, | |||
PIPE_TRANSFER_READ, 0, 0, surface->width, | |||
surface->height); | |||
transfer = pipe->get_tex_transfer(pipe, texture, surface->face, | |||
surface->level, surface->zslice, | |||
PIPE_TRANSFER_READ, 0, 0, surface->width, | |||
surface->height); | |||
debug_dump_transfer_bmp(filename, transfer); | |||
debug_dump_transfer_bmp(pipe, filename, transfer); | |||
screen->tex_transfer_destroy(transfer); | |||
pipe->tex_transfer_destroy(pipe, transfer); | |||
#endif | |||
} | |||
void | |||
debug_dump_transfer_bmp(const char *filename, | |||
debug_dump_transfer_bmp(struct pipe_context *pipe, | |||
const char *filename, | |||
struct pipe_transfer *transfer) | |||
{ | |||
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT | |||
@@ -544,7 +551,7 @@ debug_dump_transfer_bmp(const char *filename, | |||
if(!rgba) | |||
goto error1; | |||
pipe_get_tile_rgba(transfer, 0, 0, | |||
pipe_get_tile_rgba(pipe, transfer, 0, 0, | |||
transfer->width, transfer->height, | |||
rgba); | |||
@@ -312,6 +312,7 @@ debug_memory_end(unsigned long beginning); | |||
#ifdef DEBUG | |||
struct pipe_context; | |||
struct pipe_surface; | |||
struct pipe_transfer; | |||
struct pipe_texture; | |||
@@ -321,21 +322,25 @@ void debug_dump_image(const char *prefix, | |||
unsigned width, unsigned height, | |||
unsigned stride, | |||
const void *data); | |||
void debug_dump_surface(const char *prefix, | |||
void debug_dump_surface(struct pipe_context *pipe, | |||
const char *prefix, | |||
struct pipe_surface *surface); | |||
void debug_dump_texture(const char *prefix, | |||
void debug_dump_texture(struct pipe_context *pipe, | |||
const char *prefix, | |||
struct pipe_texture *texture); | |||
void debug_dump_surface_bmp(const char *filename, | |||
void debug_dump_surface_bmp(struct pipe_context *pipe, | |||
const char *filename, | |||
struct pipe_surface *surface); | |||
void debug_dump_transfer_bmp(const char *filename, | |||
void debug_dump_transfer_bmp(struct pipe_context *pipe, | |||
const char *filename, | |||
struct pipe_transfer *transfer); | |||
void debug_dump_float_rgba_bmp(const char *filename, | |||
unsigned width, unsigned height, | |||
float *rgba, unsigned stride); | |||
#else | |||
#define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0) | |||
#define debug_dump_surface(prefix, surface) ((void)0) | |||
#define debug_dump_surface_bmp(filename, surface) ((void)0) | |||
#define debug_dump_surface(pipe, prefix, surface) ((void)0) | |||
#define debug_dump_surface_bmp(pipe, filename, surface) ((void)0) | |||
#define debug_dump_transfer_bmp(filename, transfer) ((void)0) | |||
#define debug_dump_float_rgba_bmp(filename, width, height, rgba, stride) ((void)0) | |||
#endif |
@@ -1119,7 +1119,6 @@ make_1d_mipmap(struct gen_mipmap_state *ctx, | |||
uint face, uint baseLevel, uint lastLevel) | |||
{ | |||
struct pipe_context *pipe = ctx->pipe; | |||
struct pipe_screen *screen = pipe->screen; | |||
const uint zslice = 0; | |||
uint dstLevel; | |||
@@ -1128,27 +1127,27 @@ make_1d_mipmap(struct gen_mipmap_state *ctx, | |||
struct pipe_transfer *srcTrans, *dstTrans; | |||
void *srcMap, *dstMap; | |||
srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, | |||
srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice, | |||
PIPE_TRANSFER_READ, 0, 0, | |||
u_minify(pt->width0, srcLevel), | |||
u_minify(pt->height0, srcLevel)); | |||
dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, | |||
dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice, | |||
PIPE_TRANSFER_WRITE, 0, 0, | |||
u_minify(pt->width0, dstLevel), | |||
u_minify(pt->height0, dstLevel)); | |||
srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); | |||
dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); | |||
srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans); | |||
dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans); | |||
reduce_1d(pt->format, | |||
srcTrans->width, srcMap, | |||
dstTrans->width, dstMap); | |||
screen->transfer_unmap(screen, srcTrans); | |||
screen->transfer_unmap(screen, dstTrans); | |||
pipe->transfer_unmap(pipe, srcTrans); | |||
pipe->transfer_unmap(pipe, dstTrans); | |||
screen->tex_transfer_destroy(srcTrans); | |||
screen->tex_transfer_destroy(dstTrans); | |||
pipe->tex_transfer_destroy(pipe, srcTrans); | |||
pipe->tex_transfer_destroy(pipe, dstTrans); | |||
} | |||
} | |||
@@ -1159,7 +1158,6 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, | |||
uint face, uint baseLevel, uint lastLevel) | |||
{ | |||
struct pipe_context *pipe = ctx->pipe; | |||
struct pipe_screen *screen = pipe->screen; | |||
const uint zslice = 0; | |||
uint dstLevel; | |||
@@ -1171,17 +1169,17 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, | |||
struct pipe_transfer *srcTrans, *dstTrans; | |||
ubyte *srcMap, *dstMap; | |||
srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, | |||
srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice, | |||
PIPE_TRANSFER_READ, 0, 0, | |||
u_minify(pt->width0, srcLevel), | |||
u_minify(pt->height0, srcLevel)); | |||
dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, | |||
dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice, | |||
PIPE_TRANSFER_WRITE, 0, 0, | |||
u_minify(pt->width0, dstLevel), | |||
u_minify(pt->height0, dstLevel)); | |||
srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); | |||
dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); | |||
srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans); | |||
dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans); | |||
reduce_2d(pt->format, | |||
srcTrans->width, srcTrans->height, | |||
@@ -1189,11 +1187,11 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, | |||
dstTrans->width, dstTrans->height, | |||
dstTrans->stride, dstMap); | |||
screen->transfer_unmap(screen, srcTrans); | |||
screen->transfer_unmap(screen, dstTrans); | |||
pipe->transfer_unmap(pipe, srcTrans); | |||
pipe->transfer_unmap(pipe, dstTrans); | |||
screen->tex_transfer_destroy(srcTrans); | |||
screen->tex_transfer_destroy(dstTrans); | |||
pipe->tex_transfer_destroy(pipe, srcTrans); | |||
pipe->tex_transfer_destroy(pipe, dstTrans); | |||
} | |||
} | |||
@@ -1216,17 +1214,17 @@ make_3d_mipmap(struct gen_mipmap_state *ctx, | |||
struct pipe_transfer *srcTrans, *dstTrans; | |||
ubyte *srcMap, *dstMap; | |||
srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, | |||
srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice, | |||
PIPE_TRANSFER_READ, 0, 0, | |||
u_minify(pt->width0, srcLevel), | |||
u_minify(pt->height0, srcLevel)); | |||
dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, | |||
dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice, | |||
PIPE_TRANSFER_WRITE, 0, 0, | |||
u_minify(pt->width0, dstLevel), | |||
u_minify(pt->height0, dstLevel)); | |||
srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); | |||
dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); | |||
srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans); | |||
dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans); | |||
reduce_3d(pt->format, | |||
srcTrans->width, srcTrans->height, | |||
@@ -1234,11 +1232,11 @@ make_3d_mipmap(struct gen_mipmap_state *ctx, | |||
dstTrans->width, dstTrans->height, | |||
dstTrans->stride, dstMap); | |||
screen->transfer_unmap(screen, srcTrans); | |||
screen->transfer_unmap(screen, dstTrans); | |||
pipe->transfer_unmap(pipe, srcTrans); | |||
pipe->transfer_unmap(pipe, dstTrans); | |||
screen->tex_transfer_destroy(srcTrans); | |||
screen->tex_transfer_destroy(dstTrans); | |||
pipe->tex_transfer_destroy(pipe, srcTrans); | |||
pipe->tex_transfer_destroy(pipe, dstTrans); | |||
} | |||
#else | |||
(void) reduce_3d; |
@@ -274,24 +274,24 @@ pipe_buffer_read(struct pipe_screen *screen, | |||
} | |||
static INLINE void * | |||
pipe_transfer_map( struct pipe_transfer *transf ) | |||
pipe_transfer_map( struct pipe_context *context, | |||
struct pipe_transfer *transf ) | |||
{ | |||
struct pipe_screen *screen = transf->texture->screen; | |||
return screen->transfer_map(screen, transf); | |||
return context->transfer_map(context, transf); | |||
} | |||
static INLINE void | |||
pipe_transfer_unmap( struct pipe_transfer *transf ) | |||
pipe_transfer_unmap( struct pipe_context *context, | |||
struct pipe_transfer *transf ) | |||
{ | |||
struct pipe_screen *screen = transf->texture->screen; | |||
screen->transfer_unmap(screen, transf); | |||
context->transfer_unmap(context, transf); | |||
} | |||
static INLINE void | |||
pipe_transfer_destroy( struct pipe_transfer *transf ) | |||
pipe_transfer_destroy( struct pipe_context *context, | |||
struct pipe_transfer *transfer ) | |||
{ | |||
struct pipe_screen *screen = transf->texture->screen; | |||
screen->tex_transfer_destroy(transf); | |||
context->tex_transfer_destroy(context, transfer); | |||
} | |||
static INLINE unsigned |
@@ -169,7 +169,6 @@ util_surface_copy(struct pipe_context *pipe, | |||
unsigned src_x, unsigned src_y, | |||
unsigned w, unsigned h) | |||
{ | |||
struct pipe_screen *screen = pipe->screen; | |||
struct pipe_transfer *src_trans, *dst_trans; | |||
void *dst_map; | |||
const void *src_map; | |||
@@ -182,7 +181,7 @@ util_surface_copy(struct pipe_context *pipe, | |||
src_format = src->texture->format; | |||
dst_format = dst->texture->format; | |||
src_trans = screen->get_tex_transfer(screen, | |||
src_trans = pipe->get_tex_transfer(pipe, | |||
src->texture, | |||
src->face, | |||
src->level, | |||
@@ -190,7 +189,7 @@ util_surface_copy(struct pipe_context *pipe, | |||
PIPE_TRANSFER_READ, | |||
src_x, src_y, w, h); | |||
dst_trans = screen->get_tex_transfer(screen, | |||
dst_trans = pipe->get_tex_transfer(pipe, | |||
dst->texture, | |||
dst->face, | |||
dst->level, | |||
@@ -202,8 +201,8 @@ util_surface_copy(struct pipe_context *pipe, | |||
assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format)); | |||
assert(util_format_get_blockheight(dst_format) == util_format_get_blockheight(src_format)); | |||
src_map = pipe->screen->transfer_map(screen, src_trans); | |||
dst_map = pipe->screen->transfer_map(screen, dst_trans); | |||
src_map = pipe->transfer_map(pipe, src_trans); | |||
dst_map = pipe->transfer_map(pipe, dst_trans); | |||
assert(src_map); | |||
assert(dst_map); | |||
@@ -221,11 +220,11 @@ util_surface_copy(struct pipe_context *pipe, | |||
do_flip ? h - 1 : 0); | |||
} | |||
pipe->screen->transfer_unmap(pipe->screen, src_trans); | |||
pipe->screen->transfer_unmap(pipe->screen, dst_trans); | |||
pipe->transfer_unmap(pipe, src_trans); | |||
pipe->transfer_unmap(pipe, dst_trans); | |||
screen->tex_transfer_destroy(src_trans); | |||
screen->tex_transfer_destroy(dst_trans); | |||
pipe->tex_transfer_destroy(pipe, src_trans); | |||
pipe->tex_transfer_destroy(pipe, dst_trans); | |||
} | |||
@@ -243,14 +242,13 @@ util_surface_fill(struct pipe_context *pipe, | |||
unsigned dstx, unsigned dsty, | |||
unsigned width, unsigned height, unsigned value) | |||
{ | |||
struct pipe_screen *screen = pipe->screen; | |||
struct pipe_transfer *dst_trans; | |||
void *dst_map; | |||
assert(dst->texture); | |||
if (!dst->texture) | |||
return; | |||
dst_trans = screen->get_tex_transfer(screen, | |||
dst_trans = pipe->get_tex_transfer(pipe, | |||
dst->texture, | |||
dst->face, | |||
dst->level, | |||
@@ -258,7 +256,7 @@ util_surface_fill(struct pipe_context *pipe, | |||
PIPE_TRANSFER_WRITE, | |||
dstx, dsty, width, height); | |||
dst_map = pipe->screen->transfer_map(screen, dst_trans); | |||
dst_map = pipe->transfer_map(pipe, dst_trans); | |||
assert(dst_map); | |||
@@ -302,6 +300,6 @@ util_surface_fill(struct pipe_context *pipe, | |||
} | |||
} | |||
pipe->screen->transfer_unmap(pipe->screen, dst_trans); | |||
screen->tex_transfer_destroy(dst_trans); | |||
pipe->transfer_unmap(pipe, dst_trans); | |||
pipe->tex_transfer_destroy(pipe, dst_trans); | |||
} |
@@ -45,11 +45,11 @@ | |||
* Move raw block of pixels from transfer object to user memory. | |||
*/ | |||
void | |||
pipe_get_tile_raw(struct pipe_transfer *pt, | |||
pipe_get_tile_raw(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
void *dst, int dst_stride) | |||
{ | |||
struct pipe_screen *screen = pt->texture->screen; | |||
const void *src; | |||
if (dst_stride == 0) | |||
@@ -58,14 +58,14 @@ pipe_get_tile_raw(struct pipe_transfer *pt, | |||
if (pipe_clip_tile(x, y, &w, &h, pt)) | |||
return; | |||
src = screen->transfer_map(screen, pt); | |||
src = pipe->transfer_map(pipe, pt); | |||
assert(src); | |||
if(!src) | |||
return; | |||
util_copy_rect(dst, pt->texture->format, dst_stride, 0, 0, w, h, src, pt->stride, x, y); | |||
screen->transfer_unmap(screen, pt); | |||
pipe->transfer_unmap(pipe, pt); | |||
} | |||
@@ -73,11 +73,11 @@ pipe_get_tile_raw(struct pipe_transfer *pt, | |||
* Move raw block of pixels from user memory to transfer object. | |||
*/ | |||
void | |||
pipe_put_tile_raw(struct pipe_transfer *pt, | |||
pipe_put_tile_raw(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
const void *src, int src_stride) | |||
{ | |||
struct pipe_screen *screen = pt->texture->screen; | |||
void *dst; | |||
enum pipe_format format = pt->texture->format; | |||
@@ -87,14 +87,14 @@ pipe_put_tile_raw(struct pipe_transfer *pt, | |||
if (pipe_clip_tile(x, y, &w, &h, pt)) | |||
return; | |||
dst = screen->transfer_map(screen, pt); | |||
dst = pipe->transfer_map(pipe, pt); | |||
assert(dst); | |||
if(!dst) | |||
return; | |||
util_copy_rect(dst, format, pt->stride, x, y, w, h, src, src_stride, 0, 0); | |||
screen->transfer_unmap(screen, pt); | |||
pipe->transfer_unmap(pipe, pt); | |||
} | |||
@@ -1246,7 +1246,8 @@ pipe_tile_raw_to_rgba(enum pipe_format format, | |||
void | |||
pipe_get_tile_rgba(struct pipe_transfer *pt, | |||
pipe_get_tile_rgba(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
float *p) | |||
{ | |||
@@ -1265,7 +1266,7 @@ pipe_get_tile_rgba(struct pipe_transfer *pt, | |||
if(format == PIPE_FORMAT_UYVY || format == PIPE_FORMAT_YUYV) | |||
assert((x & 1) == 0); | |||
pipe_get_tile_raw(pt, x, y, w, h, packed, 0); | |||
pipe_get_tile_raw(pipe, pt, x, y, w, h, packed, 0); | |||
pipe_tile_raw_to_rgba(format, packed, w, h, p, dst_stride); | |||
@@ -1274,7 +1275,8 @@ pipe_get_tile_rgba(struct pipe_transfer *pt, | |||
void | |||
pipe_get_tile_swizzle(struct pipe_transfer *pt, | |||
pipe_get_tile_swizzle(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, | |||
uint y, | |||
uint w, | |||
@@ -1304,7 +1306,7 @@ pipe_get_tile_swizzle(struct pipe_transfer *pt, | |||
assert((x & 1) == 0); | |||
} | |||
pipe_get_tile_raw(pt, x, y, w, h, packed, 0); | |||
pipe_get_tile_raw(pipe, pt, x, y, w, h, packed, 0); | |||
pipe_tile_raw_to_rgba(format, packed, w, h, p, dst_stride); | |||
@@ -1336,7 +1338,8 @@ pipe_get_tile_swizzle(struct pipe_transfer *pt, | |||
void | |||
pipe_put_tile_rgba(struct pipe_transfer *pt, | |||
pipe_put_tile_rgba(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
const float *p) | |||
{ | |||
@@ -1425,7 +1428,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt, | |||
0, 0, w, h); | |||
} | |||
pipe_put_tile_raw(pt, x, y, w, h, packed, 0); | |||
pipe_put_tile_raw(pipe, pt, x, y, w, h, packed, 0); | |||
FREE(packed); | |||
} | |||
@@ -1435,11 +1438,11 @@ pipe_put_tile_rgba(struct pipe_transfer *pt, | |||
* Get a block of Z values, converted to 32-bit range. | |||
*/ | |||
void | |||
pipe_get_tile_z(struct pipe_transfer *pt, | |||
pipe_get_tile_z(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
uint *z) | |||
{ | |||
struct pipe_screen *screen = pt->texture->screen; | |||
const uint dstStride = w; | |||
ubyte *map; | |||
uint *pDest = z; | |||
@@ -1449,7 +1452,7 @@ pipe_get_tile_z(struct pipe_transfer *pt, | |||
if (pipe_clip_tile(x, y, &w, &h, pt)) | |||
return; | |||
map = (ubyte *)screen->transfer_map(screen, pt); | |||
map = (ubyte *)pipe->transfer_map(pipe, pt); | |||
if (!map) { | |||
assert(0); | |||
return; | |||
@@ -1515,16 +1518,16 @@ pipe_get_tile_z(struct pipe_transfer *pt, | |||
assert(0); | |||
} | |||
screen->transfer_unmap(screen, pt); | |||
pipe->transfer_unmap(pipe, pt); | |||
} | |||
void | |||
pipe_put_tile_z(struct pipe_transfer *pt, | |||
pipe_put_tile_z(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
const uint *zSrc) | |||
{ | |||
struct pipe_screen *screen = pt->texture->screen; | |||
const uint srcStride = w; | |||
const uint *ptrc = zSrc; | |||
ubyte *map; | |||
@@ -1534,7 +1537,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, | |||
if (pipe_clip_tile(x, y, &w, &h, pt)) | |||
return; | |||
map = (ubyte *)screen->transfer_map(screen, pt); | |||
map = (ubyte *)pipe->transfer_map(pipe, pt); | |||
if (!map) { | |||
assert(0); | |||
return; | |||
@@ -1622,7 +1625,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, | |||
assert(0); | |||
} | |||
screen->transfer_unmap(screen, pt); | |||
pipe->transfer_unmap(pipe, pt); | |||
} | |||
@@ -56,23 +56,27 @@ extern "C" { | |||
#endif | |||
void | |||
pipe_get_tile_raw(struct pipe_transfer *pt, | |||
pipe_get_tile_raw(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
void *p, int dst_stride); | |||
void | |||
pipe_put_tile_raw(struct pipe_transfer *pt, | |||
pipe_put_tile_raw(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
const void *p, int src_stride); | |||
void | |||
pipe_get_tile_rgba(struct pipe_transfer *pt, | |||
pipe_get_tile_rgba(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
float *p); | |||
void | |||
pipe_get_tile_swizzle(struct pipe_transfer *pt, | |||
pipe_get_tile_swizzle(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, | |||
uint y, | |||
uint w, | |||
@@ -85,18 +89,21 @@ pipe_get_tile_swizzle(struct pipe_transfer *pt, | |||
float *p); | |||
void | |||
pipe_put_tile_rgba(struct pipe_transfer *pt, | |||
pipe_put_tile_rgba(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
const float *p); | |||
void | |||
pipe_get_tile_z(struct pipe_transfer *pt, | |||
pipe_get_tile_z(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
uint *z); | |||
void | |||
pipe_put_tile_z(struct pipe_transfer *pt, | |||
pipe_put_tile_z(struct pipe_context *pipe, | |||
struct pipe_transfer *pt, | |||
uint x, uint y, uint w, uint h, | |||
const uint *z); | |||
@@ -680,14 +680,14 @@ xfer_buffers_map(struct vl_mpeg12_mc_renderer *r) | |||
assert(r); | |||
for (i = 0; i < 3; ++i) { | |||
r->tex_transfer[i] = r->pipe->screen->get_tex_transfer | |||
r->tex_transfer[i] = r->pipe->get_tex_transfer | |||
( | |||
r->pipe->screen, r->textures.all[i], | |||
r->pipe, r->textures.all[i], | |||
0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0, | |||
r->textures.all[i]->width0, r->textures.all[i]->height0 | |||
); | |||
r->texels[i] = r->pipe->screen->transfer_map(r->pipe->screen, r->tex_transfer[i]); | |||
r->texels[i] = r->pipe->transfer_map(r->pipe, r->tex_transfer[i]); | |||
} | |||
} | |||
@@ -699,8 +699,8 @@ xfer_buffers_unmap(struct vl_mpeg12_mc_renderer *r) | |||
assert(r); | |||
for (i = 0; i < 3; ++i) { | |||
r->pipe->screen->transfer_unmap(r->pipe->screen, r->tex_transfer[i]); | |||
r->pipe->screen->tex_transfer_destroy(r->tex_transfer[i]); | |||
r->pipe->transfer_unmap(r->pipe, r->tex_transfer[i]); | |||
r->pipe->tex_transfer_destroy(r->pipe, r->tex_transfer[i]); | |||
} | |||
} | |||
@@ -158,6 +158,7 @@ cell_create_context(struct pipe_screen *screen, | |||
cell_init_shader_functions(cell); | |||
cell_init_surface_functions(cell); | |||
cell_init_vertex_functions(cell); | |||
cell_init_texture_transfer_funcs(cell); | |||
cell->draw = cell_draw_create(cell); | |||
@@ -1352,7 +1352,7 @@ gen_stencil_values(struct spe_function *f, | |||
*/ | |||
ASSERT(fbS_reg != newS_reg); | |||
/* The code also assumes the the stencil_max_value is of the form | |||
/* The code also assumes that the stencil_max_value is of the form | |||
* 2^n-1 and can therefore be used as a mask for the valid bits in | |||
* addition to a maximum. Make sure this is the case as well. | |||
* The clever math below exploits the fact that incrementing a |
@@ -135,7 +135,7 @@ cell_thread_function(void *arg) | |||
/** | |||
* Create the SPU threads. This is done once during driver initialization. | |||
* This involves setting the the "init" message which is sent to each SPU. | |||
* This involves setting the "init" message which is sent to each SPU. | |||
* The init message specifies an SPU id, total number of SPUs, location | |||
* and number of batch buffers, etc. | |||
*/ |
@@ -62,7 +62,8 @@ cell_bind_vertex_elements_state(struct pipe_context *pipe, | |||
cell->dirty |= CELL_NEW_VERTEX; | |||
draw_set_vertex_elements(cell->draw, cell_velems->count, cell_velems->velem); | |||
if (cell_velems) | |||
draw_set_vertex_elements(cell->draw, cell_velems->count, cell_velems->velem); | |||
} | |||
void |
@@ -355,7 +355,7 @@ cell_tex_surface_destroy(struct pipe_surface *surf) | |||
* back out for glGetTexImage). | |||
*/ | |||
static struct pipe_transfer * | |||
cell_get_tex_transfer(struct pipe_screen *screen, | |||
cell_get_tex_transfer(struct pipe_context *ctx, | |||
struct pipe_texture *texture, | |||
unsigned face, unsigned level, unsigned zslice, | |||
enum pipe_transfer_usage usage, | |||
@@ -402,7 +402,7 @@ cell_get_tex_transfer(struct pipe_screen *screen, | |||
static void | |||
cell_tex_transfer_destroy(struct pipe_transfer *t) | |||
cell_tex_transfer_destroy(struct pipe_context *ctx, struct pipe_transfer *t) | |||
{ | |||
struct cell_transfer *transfer = cell_transfer(t); | |||
/* Effectively do the texture_update work here - if texture images | |||
@@ -419,7 +419,7 @@ cell_tex_transfer_destroy(struct pipe_transfer *t) | |||
* Return pointer to texture image data in linear layout. | |||
*/ | |||
static void * | |||
cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) | |||
cell_transfer_map(struct pipe_context *ctx, struct pipe_transfer *transfer) | |||
{ | |||
struct cell_transfer *ctrans = cell_transfer(transfer); | |||
struct pipe_texture *pt = transfer->texture; | |||
@@ -471,7 +471,7 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) | |||
* to tiled data. | |||
*/ | |||
static void | |||
cell_transfer_unmap(struct pipe_screen *screen, | |||
cell_transfer_unmap(struct pipe_context *ctx, | |||
struct pipe_transfer *transfer) | |||
{ | |||
struct cell_transfer *ctrans = cell_transfer(transfer); | |||
@@ -560,11 +560,14 @@ cell_init_screen_texture_funcs(struct pipe_screen *screen) | |||
screen->get_tex_surface = cell_get_tex_surface; | |||
screen->tex_surface_destroy = cell_tex_surface_destroy; | |||
screen->get_tex_transfer = cell_get_tex_transfer; | |||
screen->tex_transfer_destroy = cell_tex_transfer_destroy; | |||
screen->transfer_map = cell_transfer_map; | |||
screen->transfer_unmap = cell_transfer_unmap; | |||
screen->flush_frontbuffer = cell_flush_frontbuffer; | |||
} | |||
void | |||
cell_init_texture_transfer_funcs(struct cell_context *cell) | |||
{ | |||
cell->pipe.get_tex_transfer = cell_get_tex_transfer; | |||
cell->pipe.tex_transfer_destroy = cell_tex_transfer_destroy; | |||
cell->pipe.transfer_map = cell_transfer_map; | |||
cell->pipe.transfer_unmap = cell_transfer_unmap; | |||
} |
@@ -95,5 +95,7 @@ cell_transfer(struct pipe_transfer *pt) | |||
extern void | |||
cell_init_screen_texture_funcs(struct pipe_screen *screen); | |||
extern void | |||
cell_init_texture_transfer_funcs(struct cell_context *cell); | |||
#endif /* CELL_TEXTURE_H */ |
@@ -221,6 +221,7 @@ i915_create_context(struct pipe_screen *screen, void *priv) | |||
i915_init_surface_functions(i915); | |||
i915_init_state_functions(i915); | |||
i915_init_flush_functions(i915); | |||
i915_init_texture_functions(i915); | |||
draw_install_aaline_stage(i915->draw, &i915->base); | |||
draw_install_aapoint_stage(i915->draw, &i915->base); |
@@ -349,6 +349,12 @@ struct pipe_context *i915_create_context(struct pipe_screen *screen, | |||
void *priv); | |||
/*********************************************************************** | |||
* i915_texture.c | |||
*/ | |||
void i915_init_texture_functions(struct i915_context *i915 ); | |||
/*********************************************************************** | |||
* Inline conversion functions. These are better-typed than the | |||
* macros used previously: |
@@ -797,7 +797,10 @@ i915_bind_vertex_elements_state(struct pipe_context *pipe, | |||
draw_flush(i915->draw); | |||
/* pass-through to draw module */ | |||
draw_set_vertex_elements(i915->draw, i915_velems->count, i915_velems->velem); | |||
if (i915_velems) { | |||
draw_set_vertex_elements(i915->draw, | |||
i915_velems->count, i915_velems->velem); | |||
} | |||
} | |||
static void |
@@ -795,12 +795,12 @@ i915_tex_surface_destroy(struct pipe_surface *surf) | |||
/* | |||
* Screen transfer functions | |||
* Texture transfer functions | |||
*/ | |||
static struct pipe_transfer* | |||
i915_get_tex_transfer(struct pipe_screen *screen, | |||
static struct pipe_transfer * | |||
i915_get_tex_transfer(struct pipe_context *pipe, | |||
struct pipe_texture *texture, | |||
unsigned face, unsigned level, unsigned zslice, | |||
enum pipe_transfer_usage usage, unsigned x, unsigned y, | |||
@@ -837,7 +837,7 @@ i915_get_tex_transfer(struct pipe_screen *screen, | |||
} | |||
static void * | |||
i915_transfer_map(struct pipe_screen *screen, | |||
i915_transfer_map(struct pipe_context *pipe, | |||
struct pipe_transfer *transfer) | |||
{ | |||
struct i915_texture *tex = (struct i915_texture *)transfer->texture; | |||
@@ -859,7 +859,7 @@ i915_transfer_map(struct pipe_screen *screen, | |||
} | |||
static void | |||
i915_transfer_unmap(struct pipe_screen *screen, | |||
i915_transfer_unmap(struct pipe_context *pipe, | |||
struct pipe_transfer *transfer) | |||
{ | |||
struct i915_texture *tex = (struct i915_texture *)transfer->texture; | |||
@@ -868,7 +868,8 @@ i915_transfer_unmap(struct pipe_screen *screen, | |||
} | |||
static void | |||
i915_tex_transfer_destroy(struct pipe_transfer *trans) | |||
i915_tex_transfer_destroy(struct pipe_context *pipe, | |||
struct pipe_transfer *trans) | |||
{ | |||
pipe_texture_reference(&trans->texture, NULL); | |||
FREE(trans); | |||
@@ -879,6 +880,14 @@ i915_tex_transfer_destroy(struct pipe_transfer *trans) | |||
* Other texture functions | |||
*/ | |||
void | |||
i915_init_texture_functions(struct i915_context *i915 ) | |||
{ | |||
i915->base.get_tex_transfer = i915_get_tex_transfer; | |||
i915->base.transfer_map = i915_transfer_map; | |||
i915->base.transfer_unmap = i915_transfer_unmap; | |||
i915->base.tex_transfer_destroy = i915_tex_transfer_destroy; | |||
} | |||
void | |||
i915_init_screen_texture_functions(struct i915_screen *is) | |||
@@ -889,8 +898,4 @@ i915_init_screen_texture_functions(struct i915_screen *is) | |||
is->base.texture_destroy = i915_texture_destroy; | |||
is->base.get_tex_surface = i915_get_tex_surface; | |||
is->base.tex_surface_destroy = i915_tex_surface_destroy; | |||
is->base.get_tex_transfer = i915_get_tex_transfer; | |||
is->base.transfer_map = i915_transfer_map; | |||
is->base.transfer_unmap = i915_transfer_unmap; | |||
is->base.tex_transfer_destroy = i915_tex_transfer_destroy; | |||
} |
@@ -181,6 +181,10 @@ void brw_update_texture( struct brw_screen *brw_screen, | |||
struct brw_texture *tex ); | |||
/* brw_screen_texture.h | |||
*/ | |||
struct brw_context; | |||
void brw_tex_init( struct brw_context *brw ); | |||
void brw_screen_tex_init( struct brw_screen *brw_screen ); | |||
void brw_screen_tex_surface_init( struct brw_screen *brw_screen ); | |||
@@ -37,6 +37,8 @@ | |||
#include "brw_defines.h" | |||
#include "brw_structs.h" | |||
#include "brw_winsys.h" | |||
#include "brw_context.h" | |||
@@ -479,7 +481,7 @@ boolean brw_is_texture_referenced_by_bo( struct brw_screen *brw_screen, | |||
*/ | |||
static struct pipe_transfer* | |||
brw_get_tex_transfer(struct pipe_screen *screen, | |||
brw_get_tex_transfer(struct pipe_context *pipe, | |||
struct pipe_texture *texture, | |||
unsigned face, unsigned level, unsigned zslice, | |||
enum pipe_transfer_usage usage, unsigned x, unsigned y, | |||
@@ -514,11 +516,11 @@ brw_get_tex_transfer(struct pipe_screen *screen, | |||
} | |||
static void * | |||
brw_transfer_map(struct pipe_screen *screen, | |||
brw_transfer_map(struct pipe_context *pipe, | |||
struct pipe_transfer *transfer) | |||
{ | |||
struct brw_texture *tex = brw_texture(transfer->texture); | |||
struct brw_winsys_screen *sws = brw_screen(screen)->sws; | |||
struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws; | |||
char *map; | |||
unsigned usage = transfer->usage; | |||
@@ -541,23 +543,32 @@ brw_transfer_map(struct pipe_screen *screen, | |||
} | |||
static void | |||
brw_transfer_unmap(struct pipe_screen *screen, | |||
brw_transfer_unmap(struct pipe_context *pipe, | |||
struct pipe_transfer *transfer) | |||
{ | |||
struct brw_texture *tex = brw_texture(transfer->texture); | |||
struct brw_winsys_screen *sws = brw_screen(screen)->sws; | |||
struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws; | |||
sws->bo_unmap(tex->bo); | |||
} | |||
static void | |||
brw_tex_transfer_destroy(struct pipe_transfer *trans) | |||
brw_tex_transfer_destroy(struct pipe_context *pipe, | |||
struct pipe_transfer *trans) | |||
{ | |||
pipe_texture_reference(&trans->texture, NULL); | |||
FREE(trans); | |||
} | |||
void brw_tex_init( struct brw_context *brw ) | |||
{ | |||
brw->base.get_tex_transfer = brw_get_tex_transfer; | |||
brw->base.transfer_map = brw_transfer_map; | |||
brw->base.transfer_unmap = brw_transfer_unmap; | |||
brw->base.tex_transfer_destroy = brw_tex_transfer_destroy; | |||
} | |||
void brw_screen_tex_init( struct brw_screen *brw_screen ) | |||
{ | |||
brw_screen->base.is_format_supported = brw_is_format_supported; | |||
@@ -565,8 +576,4 @@ void brw_screen_tex_init( struct brw_screen *brw_screen ) | |||
brw_screen->base.texture_from_handle = brw_texture_from_handle; | |||
brw_screen->base.texture_get_handle = brw_texture_get_handle; | |||
brw_screen->base.texture_destroy = brw_texture_destroy; | |||
brw_screen->base.get_tex_transfer = brw_get_tex_transfer; | |||
brw_screen->base.transfer_map = brw_transfer_map; | |||
brw_screen->base.transfer_unmap = brw_transfer_unmap; | |||
brw_screen->base.tex_transfer_destroy = brw_tex_transfer_destroy; | |||
} |
@@ -747,6 +747,75 @@ identity_sampler_view_destroy(struct pipe_context *pipe, | |||
free(view); | |||
} | |||
static struct pipe_transfer * | |||
identity_context_get_tex_transfer(struct pipe_context *_context, | |||
struct pipe_texture *_texture, | |||
unsigned face, | |||
unsigned level, | |||
unsigned zslice, | |||
enum pipe_transfer_usage usage, | |||
unsigned x, | |||
unsigned y, | |||
unsigned w, | |||
unsigned h) | |||
{ | |||
struct identity_context *id_context = identity_context(_context); | |||
struct identity_texture *id_texture = identity_texture(_texture); | |||
struct pipe_context *context = id_context->pipe; | |||
struct pipe_texture *texture = id_texture->texture; | |||
struct pipe_transfer *result; | |||
result = context->get_tex_transfer(context, | |||
texture, | |||
face, | |||
level, | |||
zslice, | |||
usage, | |||
x, | |||
y, | |||
w, | |||
h); | |||
if (result) | |||
return identity_transfer_create(id_context, id_texture, result); | |||
return NULL; | |||
} | |||
static void | |||
identity_context_tex_transfer_destroy(struct pipe_context *_pipe, | |||
struct pipe_transfer *_transfer) | |||
{ | |||
identity_transfer_destroy(identity_context(_pipe), | |||
identity_transfer(_transfer)); | |||
} | |||
static void * | |||
identity_context_transfer_map(struct pipe_context *_context, | |||
struct pipe_transfer *_transfer) | |||
{ | |||
struct identity_context *id_context = identity_context(_context); | |||
struct identity_transfer *id_transfer = identity_transfer(_transfer); | |||
struct pipe_context *context = id_context->pipe; | |||
struct pipe_transfer *transfer = id_transfer->transfer; | |||
return context->transfer_map(context, | |||
transfer); | |||
} | |||
static void | |||
identity_context_transfer_unmap(struct pipe_context *_context, | |||
struct pipe_transfer *_transfer) | |||
{ | |||
struct identity_context *id_context = identity_context(_context); | |||
struct identity_transfer *id_transfer = identity_transfer(_transfer); | |||
struct pipe_context *context = id_context->pipe; | |||
struct pipe_transfer *transfer = id_transfer->transfer; | |||
context->transfer_unmap(context, | |||
transfer); | |||
} | |||
struct pipe_context * | |||
identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) | |||
{ | |||
@@ -813,6 +882,10 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) | |||
id_pipe->base.is_buffer_referenced = identity_is_buffer_referenced; | |||
id_pipe->base.create_sampler_view = identity_create_sampler_view; | |||
id_pipe->base.sampler_view_destroy = identity_sampler_view_destroy; | |||
id_pipe->base.get_tex_transfer = identity_context_get_tex_transfer; | |||
id_pipe->base.tex_transfer_destroy = identity_context_tex_transfer_destroy; | |||
id_pipe->base.transfer_map = identity_context_transfer_map; | |||
id_pipe->base.transfer_unmap = identity_context_transfer_unmap; | |||
id_pipe->pipe = pipe; | |||
@@ -30,6 +30,7 @@ | |||
#include "id_screen.h" | |||
#include "id_objects.h" | |||
#include "id_context.h" | |||
struct pipe_buffer * | |||
identity_buffer_create(struct identity_screen *id_screen, | |||
@@ -142,7 +143,8 @@ identity_surface_destroy(struct identity_surface *id_surface) | |||
struct pipe_transfer * | |||
identity_transfer_create(struct identity_texture *id_texture, | |||
identity_transfer_create(struct identity_context *id_context, | |||
struct identity_texture *id_texture, | |||
struct pipe_transfer *transfer) | |||
{ | |||
struct identity_transfer *id_transfer; | |||
@@ -159,25 +161,25 @@ identity_transfer_create(struct identity_texture *id_texture, | |||
memcpy(&id_transfer->base, transfer, sizeof(struct pipe_transfer)); | |||
id_transfer->base.texture = NULL; | |||
pipe_texture_reference(&id_transfer->base.texture, &id_texture->base); | |||
id_transfer->transfer = transfer; | |||
pipe_texture_reference(&id_transfer->base.texture, &id_texture->base); | |||
assert(id_transfer->base.texture == &id_texture->base); | |||
return &id_transfer->base; | |||
error: | |||
transfer->texture->screen->tex_transfer_destroy(transfer); | |||
id_context->pipe->tex_transfer_destroy(id_context->pipe, transfer); | |||
return NULL; | |||
} | |||
void | |||
identity_transfer_destroy(struct identity_transfer *id_transfer) | |||
identity_transfer_destroy(struct identity_context *id_context, | |||
struct identity_transfer *id_transfer) | |||
{ | |||
struct identity_screen *id_screen = identity_screen(id_transfer->base.texture->screen); | |||
struct pipe_screen *screen = id_screen->screen; | |||
pipe_texture_reference(&id_transfer->base.texture, NULL); | |||
screen->tex_transfer_destroy(id_transfer->transfer); | |||
id_context->pipe->tex_transfer_destroy(id_context->pipe, | |||
id_transfer->transfer); | |||
FREE(id_transfer); | |||
} | |||
@@ -35,6 +35,7 @@ | |||
#include "id_screen.h" | |||
struct identity_context; | |||
struct identity_buffer | |||
{ | |||
@@ -72,6 +73,7 @@ struct identity_transfer | |||
{ | |||
struct pipe_transfer base; | |||
struct pipe_context *pipe; | |||
struct pipe_transfer *transfer; | |||
}; | |||
@@ -203,11 +205,13 @@ void | |||
identity_surface_destroy(struct identity_surface *id_surface); | |||
struct pipe_transfer * | |||
identity_transfer_create(struct identity_texture *id_texture, | |||
identity_transfer_create(struct identity_context *id_context, | |||
struct identity_texture *id_texture, | |||
struct pipe_transfer *transfer); | |||
void | |||
identity_transfer_destroy(struct identity_transfer *id_transfer); | |||
identity_transfer_destroy(struct identity_context *id_context, | |||
struct identity_transfer *id_transfer); | |||
struct pipe_video_surface * | |||
identity_video_surface_create(struct identity_screen *id_screen, |
@@ -207,71 +207,6 @@ identity_screen_tex_surface_destroy(struct pipe_surface *_surface) | |||
identity_surface_destroy(identity_surface(_surface)); | |||
} | |||
static struct pipe_transfer * | |||
identity_screen_get_tex_transfer(struct pipe_screen *_screen, | |||
struct pipe_texture *_texture, | |||
unsigned face, | |||
unsigned level, | |||
unsigned zslice, | |||
enum pipe_transfer_usage usage, | |||
unsigned x, | |||
unsigned y, | |||
unsigned w, | |||
unsigned h) | |||
{ | |||
struct identity_screen *id_screen = identity_screen(_screen); | |||
struct identity_texture *id_texture = identity_texture(_texture); | |||
struct pipe_screen *screen = id_screen->screen; | |||
struct pipe_texture *texture = id_texture->texture; | |||
struct pipe_transfer *result; | |||
result = screen->get_tex_transfer(screen, | |||
texture, | |||
face, | |||
level, | |||
zslice, | |||
usage, | |||
x, | |||
y, | |||
w, | |||
h); | |||
if (result) | |||
return identity_transfer_create(id_texture, result); | |||
return NULL; | |||
} | |||
static void | |||
identity_screen_tex_transfer_destroy(struct pipe_transfer *_transfer) | |||
{ | |||
identity_transfer_destroy(identity_transfer(_transfer)); | |||
} | |||
static void * | |||
identity_screen_transfer_map(struct pipe_screen *_screen, | |||
struct pipe_transfer *_transfer) | |||
{ | |||
struct identity_screen *id_screen = identity_screen(_screen); | |||
struct identity_transfer *id_transfer = identity_transfer(_transfer); | |||
struct pipe_screen *screen = id_screen->screen; | |||
struct pipe_transfer *transfer = id_transfer->transfer; | |||
return screen->transfer_map(screen, | |||
transfer); | |||
} | |||
static void | |||
identity_screen_transfer_unmap(struct pipe_screen *_screen, | |||
struct pipe_transfer *_transfer) | |||
{ | |||
struct identity_screen *id_screen = identity_screen(_screen); | |||
struct identity_transfer *id_transfer = identity_transfer(_transfer); | |||
struct pipe_screen *screen = id_screen->screen; | |||
struct pipe_transfer *transfer = id_transfer->transfer; | |||
screen->transfer_unmap(screen, | |||
transfer); | |||
} | |||
static struct pipe_buffer * | |||
identity_screen_buffer_create(struct pipe_screen *_screen, | |||
@@ -488,10 +423,6 @@ identity_screen_create(struct pipe_screen *screen) | |||
id_screen->base.texture_destroy = identity_screen_texture_destroy; | |||
id_screen->base.get_tex_surface = identity_screen_get_tex_surface; | |||
id_screen->base.tex_surface_destroy = identity_screen_tex_surface_destroy; | |||
id_screen->base.get_tex_transfer = identity_screen_get_tex_transfer; | |||
id_screen->base.tex_transfer_destroy = identity_screen_tex_transfer_destroy; | |||
id_screen->base.transfer_map = identity_screen_transfer_map; | |||
id_screen->base.transfer_unmap = identity_screen_transfer_unmap; | |||
id_screen->base.buffer_create = identity_screen_buffer_create; | |||
id_screen->base.user_buffer_create = identity_screen_user_buffer_create; | |||
if (screen->buffer_map) |
@@ -55,7 +55,7 @@ testprogs := lp_test_format \ | |||
LIBS += $(GL_LIB_DEPS) -L. -lllvmpipe -L../../auxiliary/ -lgallium | |||
$(testprogs): lp_test_% : lp_test_%.o lp_test_main.o libllvmpipe.a | |||
$(LD) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group | |||
#$(testprogs): lp_test_% : lp_test_%.o lp_test_main.o libllvmpipe.a | |||
# $(LD) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group | |||
default: $(testprogs) | |||
#default: $(testprogs) |
@@ -33,7 +33,6 @@ | |||
#include "lp_screen.h" | |||
#include "lp_buffer.h" | |||
#include "state_tracker/sw_winsys.h" | |||
static void * | |||
llvmpipe_buffer_map(struct pipe_screen *screen, |
@@ -175,6 +175,7 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv ) | |||
llvmpipe->pipe.is_buffer_referenced = llvmpipe_is_buffer_referenced; | |||
llvmpipe_init_query_funcs( llvmpipe ); | |||
llvmpipe_init_context_texture_funcs( &llvmpipe->pipe ); | |||
/* | |||
* Create drawing context and plug our rendering stage into it. |
@@ -45,7 +45,7 @@ struct draw_stage; | |||
struct lp_fragment_shader; | |||
struct lp_vertex_shader; | |||
struct lp_blend_state; | |||
struct setup_context; | |||
struct lp_setup_context; | |||
struct lp_velems_state; | |||
struct llvmpipe_context { | |||
@@ -98,7 +98,7 @@ struct llvmpipe_context { | |||
int psize_slot; | |||
/** The tiling engine */ | |||
struct setup_context *setup; | |||
struct lp_setup_context *setup; | |||
/** The primitive drawing context */ | |||
struct draw_context *draw; |
@@ -79,12 +79,12 @@ llvmpipe_flush( struct pipe_context *pipe, | |||
for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) { | |||
util_snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no); | |||
debug_dump_surface(filename, llvmpipe->framebuffer.cbufs[i]); | |||
debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.cbufs[0]); | |||
} | |||
if (0) { | |||
util_snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no); | |||
debug_dump_surface(filename, llvmpipe->framebuffer.zsbuf); | |||
debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.zsbuf); | |||
} | |||
++frame_no; |
@@ -57,7 +57,8 @@ lp_jit_init_globals(struct llvmpipe_screen *screen) | |||
elem_types[LP_JIT_TEXTURE_HEIGHT] = LLVMInt32Type(); | |||
elem_types[LP_JIT_TEXTURE_DEPTH] = LLVMInt32Type(); | |||
elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32Type(); | |||
elem_types[LP_JIT_TEXTURE_STRIDE] = LLVMInt32Type(); | |||
elem_types[LP_JIT_TEXTURE_ROW_STRIDE] = | |||
LLVMArrayType(LLVMInt32Type(), LP_MAX_TEXTURE_2D_LEVELS); | |||
elem_types[LP_JIT_TEXTURE_DATA] = | |||
LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0), | |||
LP_MAX_TEXTURE_2D_LEVELS); | |||
@@ -76,9 +77,9 @@ lp_jit_init_globals(struct llvmpipe_screen *screen) | |||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, last_level, | |||
screen->target, texture_type, | |||
LP_JIT_TEXTURE_LAST_LEVEL); | |||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, stride, | |||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, row_stride, | |||
screen->target, texture_type, | |||
LP_JIT_TEXTURE_STRIDE); | |||
LP_JIT_TEXTURE_ROW_STRIDE); | |||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, data, | |||
screen->target, texture_type, | |||
LP_JIT_TEXTURE_DATA); |
@@ -51,7 +51,7 @@ struct lp_jit_texture | |||
uint32_t height; | |||
uint32_t depth; | |||
uint32_t last_level; | |||
uint32_t stride; | |||
uint32_t row_stride[LP_MAX_TEXTURE_2D_LEVELS]; | |||
const void *data[LP_MAX_TEXTURE_2D_LEVELS]; | |||
}; | |||
@@ -61,7 +61,7 @@ enum { | |||
LP_JIT_TEXTURE_HEIGHT, | |||
LP_JIT_TEXTURE_DEPTH, | |||
LP_JIT_TEXTURE_LAST_LEVEL, | |||
LP_JIT_TEXTURE_STRIDE, | |||
LP_JIT_TEXTURE_ROW_STRIDE, | |||
LP_JIT_TEXTURE_DATA | |||
}; | |||
@@ -95,7 +95,7 @@ struct lp_rast_shader_inputs { | |||
* Rasterization information for a triangle known to be in this bin, | |||
* plus inputs to run the shader: | |||
* These fields are tile- and bin-independent. | |||
* Objects of this type are put into the setup_context::data buffer. | |||
* Objects of this type are put into the lp_setup_context::data buffer. | |||
*/ | |||
struct lp_rast_triangle { | |||
#ifdef DEBUG |
@@ -397,7 +397,7 @@ end: | |||
static boolean | |||
lp_scene_map_buffers( struct lp_scene *scene ) | |||
{ | |||
struct pipe_screen *screen = scene->pipe->screen; | |||
struct pipe_context *pipe = scene->pipe; | |||
struct pipe_surface *cbuf, *zsbuf; | |||
int i; | |||
@@ -409,7 +409,7 @@ lp_scene_map_buffers( struct lp_scene *scene ) | |||
for (i = 0; i < scene->fb.nr_cbufs; i++) { | |||
cbuf = scene->fb.cbufs[i]; | |||
if (cbuf) { | |||
scene->cbuf_transfer[i] = screen->get_tex_transfer(screen, | |||
scene->cbuf_transfer[i] = pipe->get_tex_transfer(pipe, | |||
cbuf->texture, | |||
cbuf->face, | |||
cbuf->level, | |||
@@ -421,7 +421,7 @@ lp_scene_map_buffers( struct lp_scene *scene ) | |||
if (!scene->cbuf_transfer[i]) | |||
goto fail; | |||
scene->cbuf_map[i] = screen->transfer_map(screen, | |||
scene->cbuf_map[i] = pipe->transfer_map(pipe, | |||
scene->cbuf_transfer[i]); | |||
if (!scene->cbuf_map[i]) | |||
goto fail; | |||
@@ -432,7 +432,7 @@ lp_scene_map_buffers( struct lp_scene *scene ) | |||
*/ | |||
zsbuf = scene->fb.zsbuf; | |||
if (zsbuf) { | |||
scene->zsbuf_transfer = screen->get_tex_transfer(screen, | |||
scene->zsbuf_transfer = pipe->get_tex_transfer(pipe, | |||
zsbuf->texture, | |||
zsbuf->face, | |||
zsbuf->level, | |||
@@ -444,7 +444,7 @@ lp_scene_map_buffers( struct lp_scene *scene ) | |||
if (!scene->zsbuf_transfer) | |||
goto fail; | |||
scene->zsbuf_map = screen->transfer_map(screen, | |||
scene->zsbuf_map = pipe->transfer_map(pipe, | |||
scene->zsbuf_transfer); | |||
if (!scene->zsbuf_map) | |||
goto fail; | |||
@@ -469,25 +469,25 @@ fail: | |||
static void | |||
lp_scene_unmap_buffers( struct lp_scene *scene ) | |||
{ | |||
struct pipe_screen *screen = scene->pipe->screen; | |||
struct pipe_context *pipe = scene->pipe; | |||
unsigned i; | |||
for (i = 0; i < scene->fb.nr_cbufs; i++) { | |||
if (scene->cbuf_map[i]) | |||
screen->transfer_unmap(screen, scene->cbuf_transfer[i]); | |||
pipe->transfer_unmap(pipe, scene->cbuf_transfer[i]); | |||
if (scene->cbuf_transfer[i]) | |||
screen->tex_transfer_destroy(scene->cbuf_transfer[i]); | |||
pipe->tex_transfer_destroy(pipe, scene->cbuf_transfer[i]); | |||
scene->cbuf_transfer[i] = NULL; | |||
scene->cbuf_map[i] = NULL; | |||
} | |||
if (scene->zsbuf_map) | |||
screen->transfer_unmap(screen, scene->zsbuf_transfer); | |||
pipe->transfer_unmap(pipe, scene->zsbuf_transfer); | |||
if (scene->zsbuf_transfer) | |||
screen->tex_transfer_destroy(scene->zsbuf_transfer); | |||
pipe->tex_transfer_destroy(pipe, scene->zsbuf_transfer); | |||
scene->zsbuf_transfer = NULL; | |||
scene->zsbuf_map = NULL; |
@@ -34,9 +34,7 @@ | |||
#ifndef LP_SCREEN_H | |||
#define LP_SCREEN_H | |||
#include <llvm-c/Core.h> | |||
#include <llvm-c/Analysis.h> | |||
#include <llvm-c/Target.h> | |||
#include "os/os_llvm.h" | |||
#include <llvm-c/ExecutionEngine.h> | |||
#include "pipe/p_screen.h" |
@@ -52,11 +52,11 @@ | |||
#include "draw/draw_vbuf.h" | |||
static void set_scene_state( struct setup_context *, unsigned ); | |||
static void set_scene_state( struct lp_setup_context *, unsigned ); | |||
struct lp_scene * | |||
lp_setup_get_current_scene(struct setup_context *setup) | |||
lp_setup_get_current_scene(struct lp_setup_context *setup) | |||
{ | |||
if (!setup->scene) { | |||
@@ -74,7 +74,7 @@ lp_setup_get_current_scene(struct setup_context *setup) | |||
static void | |||
first_triangle( struct setup_context *setup, | |||
first_triangle( struct lp_setup_context *setup, | |||
const float (*v0)[4], | |||
const float (*v1)[4], | |||
const float (*v2)[4]) | |||
@@ -85,7 +85,7 @@ first_triangle( struct setup_context *setup, | |||
} | |||
static void | |||
first_line( struct setup_context *setup, | |||
first_line( struct lp_setup_context *setup, | |||
const float (*v0)[4], | |||
const float (*v1)[4]) | |||
{ | |||
@@ -95,7 +95,7 @@ first_line( struct setup_context *setup, | |||
} | |||
static void | |||
first_point( struct setup_context *setup, | |||
first_point( struct lp_setup_context *setup, | |||
const float (*v0)[4]) | |||
{ | |||
set_scene_state( setup, SETUP_ACTIVE ); | |||
@@ -103,7 +103,7 @@ first_point( struct setup_context *setup, | |||
setup->point( setup, v0 ); | |||
} | |||
static void reset_context( struct setup_context *setup ) | |||
static void reset_context( struct lp_setup_context *setup ) | |||
{ | |||
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); | |||
@@ -131,7 +131,7 @@ static void reset_context( struct setup_context *setup ) | |||
/** Rasterize all scene's bins */ | |||
static void | |||
lp_setup_rasterize_scene( struct setup_context *setup, | |||
lp_setup_rasterize_scene( struct lp_setup_context *setup, | |||
boolean write_depth ) | |||
{ | |||
struct lp_scene *scene = lp_setup_get_current_scene(setup); | |||
@@ -148,7 +148,7 @@ lp_setup_rasterize_scene( struct setup_context *setup, | |||
static void | |||
begin_binning( struct setup_context *setup ) | |||
begin_binning( struct lp_setup_context *setup ) | |||
{ | |||
struct lp_scene *scene = lp_setup_get_current_scene(setup); | |||
@@ -184,7 +184,7 @@ begin_binning( struct setup_context *setup ) | |||
* TODO: fast path for fullscreen clears and no triangles. | |||
*/ | |||
static void | |||
execute_clears( struct setup_context *setup ) | |||
execute_clears( struct lp_setup_context *setup ) | |||
{ | |||
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); | |||
@@ -194,7 +194,7 @@ execute_clears( struct setup_context *setup ) | |||
static void | |||
set_scene_state( struct setup_context *setup, | |||
set_scene_state( struct lp_setup_context *setup, | |||
unsigned new_state ) | |||
{ | |||
unsigned old_state = setup->state; | |||
@@ -229,7 +229,7 @@ set_scene_state( struct setup_context *setup, | |||
void | |||
lp_setup_flush( struct setup_context *setup, | |||
lp_setup_flush( struct lp_setup_context *setup, | |||
unsigned flags ) | |||
{ | |||
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); | |||
@@ -239,7 +239,7 @@ lp_setup_flush( struct setup_context *setup, | |||
void | |||
lp_setup_bind_framebuffer( struct setup_context *setup, | |||
lp_setup_bind_framebuffer( struct lp_setup_context *setup, | |||
const struct pipe_framebuffer_state *fb ) | |||
{ | |||
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); | |||
@@ -256,7 +256,7 @@ lp_setup_bind_framebuffer( struct setup_context *setup, | |||
void | |||
lp_setup_clear( struct setup_context *setup, | |||
lp_setup_clear( struct lp_setup_context *setup, | |||
const float *color, | |||
double depth, | |||
unsigned stencil, | |||
@@ -314,7 +314,7 @@ lp_setup_clear( struct setup_context *setup, | |||
* Emit a fence. | |||
*/ | |||
struct pipe_fence_handle * | |||
lp_setup_fence( struct setup_context *setup ) | |||
lp_setup_fence( struct lp_setup_context *setup ) | |||
{ | |||
struct lp_scene *scene = lp_setup_get_current_scene(setup); | |||
const unsigned rank = lp_scene_get_num_bins( scene ); /* xxx */ | |||
@@ -334,10 +334,11 @@ lp_setup_fence( struct setup_context *setup ) | |||
void | |||
lp_setup_set_triangle_state( struct setup_context *setup, | |||
lp_setup_set_triangle_state( struct lp_setup_context *setup, | |||
unsigned cull_mode, | |||
boolean ccw_is_frontface, | |||
boolean scissor ) | |||
boolean scissor, | |||
boolean gl_rasterization_rules) | |||
{ | |||
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); | |||
@@ -345,12 +346,13 @@ lp_setup_set_triangle_state( struct setup_context *setup, | |||
setup->cullmode = cull_mode; | |||
setup->triangle = first_triangle; | |||
setup->scissor_test = scissor; | |||
setup->pixel_offset = gl_rasterization_rules ? 0.5f : 0.0f; | |||
} | |||
void | |||
lp_setup_set_fs_inputs( struct setup_context *setup, | |||
lp_setup_set_fs_inputs( struct lp_setup_context *setup, | |||
const struct lp_shader_input *input, | |||
unsigned nr ) | |||
{ | |||
@@ -361,7 +363,7 @@ lp_setup_set_fs_inputs( struct setup_context *setup, | |||
} | |||
void | |||
lp_setup_set_fs_functions( struct setup_context *setup, | |||
lp_setup_set_fs_functions( struct lp_setup_context *setup, | |||
lp_jit_frag_func jit_function0, | |||
lp_jit_frag_func jit_function1, | |||
boolean opaque ) | |||
@@ -376,7 +378,7 @@ lp_setup_set_fs_functions( struct setup_context *setup, | |||
} | |||
void | |||
lp_setup_set_fs_constants(struct setup_context *setup, | |||
lp_setup_set_fs_constants(struct lp_setup_context *setup, | |||
struct pipe_buffer *buffer) | |||
{ | |||
LP_DBG(DEBUG_SETUP, "%s %p\n", __FUNCTION__, (void *) buffer); | |||
@@ -388,7 +390,7 @@ lp_setup_set_fs_constants(struct setup_context *setup, | |||
void | |||
lp_setup_set_alpha_ref_value( struct setup_context *setup, | |||
lp_setup_set_alpha_ref_value( struct lp_setup_context *setup, | |||
float alpha_ref_value ) | |||
{ | |||
LP_DBG(DEBUG_SETUP, "%s %f\n", __FUNCTION__, alpha_ref_value); | |||
@@ -400,7 +402,7 @@ lp_setup_set_alpha_ref_value( struct setup_context *setup, | |||
} | |||
void | |||
lp_setup_set_blend_color( struct setup_context *setup, | |||
lp_setup_set_blend_color( struct lp_setup_context *setup, | |||
const struct pipe_blend_color *blend_color ) | |||
{ | |||
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); | |||
@@ -415,7 +417,7 @@ lp_setup_set_blend_color( struct setup_context *setup, | |||
void | |||
lp_setup_set_scissor( struct setup_context *setup, | |||
lp_setup_set_scissor( struct lp_setup_context *setup, | |||
const struct pipe_scissor_state *scissor ) | |||
{ | |||
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); | |||
@@ -430,7 +432,7 @@ lp_setup_set_scissor( struct setup_context *setup, | |||
void | |||
lp_setup_set_flatshade_first( struct setup_context *setup, | |||
lp_setup_set_flatshade_first( struct lp_setup_context *setup, | |||
boolean flatshade_first ) | |||
{ | |||
setup->flatshade_first = flatshade_first; | |||
@@ -438,7 +440,7 @@ lp_setup_set_flatshade_first( struct setup_context *setup, | |||
void | |||
lp_setup_set_vertex_info( struct setup_context *setup, | |||
lp_setup_set_vertex_info( struct lp_setup_context *setup, | |||
struct vertex_info *vertex_info ) | |||
{ | |||
/* XXX: just silently holding onto the pointer: | |||
@@ -451,7 +453,7 @@ lp_setup_set_vertex_info( struct setup_context *setup, | |||
* Called during state validation when LP_NEW_SAMPLER_VIEW is set. | |||
*/ | |||
void | |||
lp_setup_set_fragment_sampler_views(struct setup_context *setup, | |||
lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, | |||
unsigned num, | |||
struct pipe_sampler_view **views) | |||
{ | |||
@@ -473,13 +475,13 @@ lp_setup_set_fragment_sampler_views(struct setup_context *setup, | |||
jit_tex->height = tex->height0; | |||
jit_tex->depth = tex->depth0; | |||
jit_tex->last_level = tex->last_level; | |||
jit_tex->stride = lp_tex->stride[0]; | |||
if (!lp_tex->dt) { | |||
/* regular texture - setup array of mipmap level pointers */ | |||
int j; | |||
for (j = 0; j < LP_MAX_TEXTURE_2D_LEVELS; j++) { | |||
for (j = 0; j <= tex->last_level; j++) { | |||
jit_tex->data[j] = | |||
(ubyte *) lp_tex->data + lp_tex->level_offset[j]; | |||
jit_tex->row_stride[j] = lp_tex->stride[j]; | |||
} | |||
} | |||
else { | |||
@@ -492,6 +494,7 @@ lp_setup_set_fragment_sampler_views(struct setup_context *setup, | |||
struct sw_winsys *winsys = screen->winsys; | |||
jit_tex->data[0] = winsys->displaytarget_map(winsys, lp_tex->dt, | |||
PIPE_BUFFER_USAGE_CPU_READ); | |||
jit_tex->row_stride[0] = lp_tex->stride[0]; | |||
assert(jit_tex->data[0]); | |||
} | |||
@@ -513,7 +516,7 @@ lp_setup_set_fragment_sampler_views(struct setup_context *setup, | |||
* being rendered and the current scene being built. | |||
*/ | |||
unsigned | |||
lp_setup_is_texture_referenced( const struct setup_context *setup, | |||
lp_setup_is_texture_referenced( const struct lp_setup_context *setup, | |||
const struct pipe_texture *texture ) | |||
{ | |||
unsigned i; | |||
@@ -542,7 +545,7 @@ lp_setup_is_texture_referenced( const struct setup_context *setup, | |||
* Called by vbuf code when we're about to draw something. | |||
*/ | |||
void | |||
lp_setup_update_state( struct setup_context *setup ) | |||
lp_setup_update_state( struct lp_setup_context *setup ) | |||
{ | |||
struct lp_scene *scene = lp_setup_get_current_scene(setup); | |||
@@ -660,7 +663,7 @@ lp_setup_update_state( struct setup_context *setup ) | |||
/* Only caller is lp_setup_vbuf_destroy() | |||
*/ | |||
void | |||
lp_setup_destroy( struct setup_context *setup ) | |||
lp_setup_destroy( struct lp_setup_context *setup ) | |||
{ | |||
reset_context( setup ); | |||
@@ -685,12 +688,12 @@ lp_setup_destroy( struct setup_context *setup ) | |||
* the draw module. Currently also creates a rasterizer to use with | |||
* it. | |||
*/ | |||
struct setup_context * | |||
struct lp_setup_context * | |||
lp_setup_create( struct pipe_context *pipe, | |||
struct draw_context *draw ) | |||
{ | |||
unsigned i; | |||
struct setup_context *setup = CALLOC_STRUCT(setup_context); | |||
struct lp_setup_context *setup = CALLOC_STRUCT(lp_setup_context); | |||
if (!setup) | |||
return NULL; |
@@ -61,79 +61,80 @@ struct pipe_framebuffer_state; | |||
struct lp_fragment_shader; | |||
struct lp_jit_context; | |||
struct setup_context * | |||
struct lp_setup_context * | |||
lp_setup_create( struct pipe_context *pipe, | |||
struct draw_context *draw ); | |||
void | |||
lp_setup_clear(struct setup_context *setup, | |||
lp_setup_clear(struct lp_setup_context *setup, | |||
const float *clear_color, | |||
double clear_depth, | |||
unsigned clear_stencil, | |||
unsigned flags); | |||
struct pipe_fence_handle * | |||
lp_setup_fence( struct setup_context *setup ); | |||
lp_setup_fence( struct lp_setup_context *setup ); | |||
void | |||
lp_setup_flush( struct setup_context *setup, | |||
lp_setup_flush( struct lp_setup_context *setup, | |||
unsigned flags ); | |||
void | |||
lp_setup_bind_framebuffer( struct setup_context *setup, | |||
lp_setup_bind_framebuffer( struct lp_setup_context *setup, | |||
const struct pipe_framebuffer_state *fb ); | |||
void | |||
lp_setup_set_triangle_state( struct setup_context *setup, | |||
lp_setup_set_triangle_state( struct lp_setup_context *setup, | |||
unsigned cullmode, | |||
boolean front_is_ccw, | |||
boolean scissor ); | |||
boolean scissor, | |||
boolean gl_rasterization_rules ); | |||
void | |||
lp_setup_set_fs_inputs( struct setup_context *setup, | |||
lp_setup_set_fs_inputs( struct lp_setup_context *setup, | |||
const struct lp_shader_input *interp, | |||
unsigned nr ); | |||
void | |||
lp_setup_set_fs_functions( struct setup_context *setup, | |||
lp_setup_set_fs_functions( struct lp_setup_context *setup, | |||
lp_jit_frag_func jit_function0, | |||
lp_jit_frag_func jit_function1, | |||
boolean opaque ); | |||
void | |||
lp_setup_set_fs_constants(struct setup_context *setup, | |||
lp_setup_set_fs_constants(struct lp_setup_context *setup, | |||
struct pipe_buffer *buffer); | |||
void | |||
lp_setup_set_alpha_ref_value( struct setup_context *setup, | |||
lp_setup_set_alpha_ref_value( struct lp_setup_context *setup, | |||
float alpha_ref_value ); | |||
void | |||
lp_setup_set_blend_color( struct setup_context *setup, | |||
lp_setup_set_blend_color( struct lp_setup_context *setup, | |||
const struct pipe_blend_color *blend_color ); | |||
void | |||
lp_setup_set_scissor( struct setup_context *setup, | |||
lp_setup_set_scissor( struct lp_setup_context *setup, | |||
const struct pipe_scissor_state *scissor ); | |||
void | |||
lp_setup_set_fragment_sampler_views(struct setup_context *setup, | |||
lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, | |||
unsigned num, | |||
struct pipe_sampler_view **views); | |||
unsigned | |||
lp_setup_is_texture_referenced( const struct setup_context *setup, | |||
lp_setup_is_texture_referenced( const struct lp_setup_context *setup, | |||
const struct pipe_texture *texture ); | |||
void | |||
lp_setup_set_flatshade_first( struct setup_context *setup, | |||
lp_setup_set_flatshade_first( struct lp_setup_context *setup, | |||
boolean flatshade_first ); | |||
void | |||
lp_setup_set_vertex_info( struct setup_context *setup, | |||
lp_setup_set_vertex_info( struct lp_setup_context *setup, | |||
struct vertex_info *info ); | |||
@@ -65,7 +65,7 @@ struct lp_scene_queue; | |||
* Subclass of vbuf_render, plugged directly into the draw module as | |||
* the rendering backend. | |||
*/ | |||
struct setup_context | |||
struct lp_setup_context | |||
{ | |||
struct vbuf_render base; | |||
@@ -89,6 +89,7 @@ struct setup_context | |||
boolean ccw_is_frontface; | |||
boolean scissor_test; | |||
unsigned cullmode; | |||
float pixel_offset; | |||
struct pipe_framebuffer_state fb; | |||
@@ -131,29 +132,29 @@ struct setup_context | |||
unsigned dirty; /**< bitmask of LP_SETUP_NEW_x bits */ | |||
void (*point)( struct setup_context *, | |||
void (*point)( struct lp_setup_context *, | |||
const float (*v0)[4]); | |||
void (*line)( struct setup_context *, | |||
void (*line)( struct lp_setup_context *, | |||
const float (*v0)[4], | |||
const float (*v1)[4]); | |||
void (*triangle)( struct setup_context *, | |||
void (*triangle)( struct lp_setup_context *, | |||
const float (*v0)[4], | |||
const float (*v1)[4], | |||
const float (*v2)[4]); | |||
}; | |||
void lp_setup_choose_triangle( struct setup_context *setup ); | |||
void lp_setup_choose_line( struct setup_context *setup ); | |||
void lp_setup_choose_point( struct setup_context *setup ); | |||
void lp_setup_choose_triangle( struct lp_setup_context *setup ); | |||
void lp_setup_choose_line( struct lp_setup_context *setup ); | |||
void lp_setup_choose_point( struct lp_setup_context *setup ); | |||
struct lp_scene *lp_setup_get_current_scene(struct setup_context *setup); | |||
struct lp_scene *lp_setup_get_current_scene(struct lp_setup_context *setup); | |||
void lp_setup_init_vbuf(struct setup_context *setup); | |||
void lp_setup_init_vbuf(struct lp_setup_context *setup); | |||
void lp_setup_update_state( struct setup_context *setup ); | |||
void lp_setup_update_state( struct lp_setup_context *setup ); | |||
void lp_setup_destroy( struct setup_context *setup ); | |||
void lp_setup_destroy( struct lp_setup_context *setup ); | |||
#endif |