Mesa (master): graw: Export graw_save_surface_to_file().
Module: Mesa Branch: master Commit: 136ff67ce8a626e628dd76aeb7feba8cf9436cd7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=136ff67ce8a626e628dd76aeb7feba8cf9436cd7 Author: Michal Krol Date: Fri Nov 5 18:54:02 2010 +0100 graw: Export graw_save_surface_to_file(). Allows applications to dump surfaces to file without referencing gallium/auxiliary entry points statically. Existing test apps have been modified such that they save the contents of the fronbuffer only when the `-o' option's specified. --- src/gallium/include/state_tracker/graw.h | 21 +++ src/gallium/targets/graw-null/graw_util.c | 39 + src/gallium/tests/graw/clear.c| 25 +- src/gallium/tests/graw/fs-test.c | 26 +++ src/gallium/tests/graw/gs-test.c | 27 src/gallium/tests/graw/quad-tex.c | 25 +- src/gallium/tests/graw/shader-leak.c |1 - src/gallium/tests/graw/tri-gs.c |1 - src/gallium/tests/graw/tri-instanced.c| 26 +-- src/gallium/tests/graw/tri.c | 25 +- src/gallium/tests/graw/vs-test.c | 26 +++ 11 files changed, 141 insertions(+), 101 deletions(-) diff --git a/src/gallium/include/state_tracker/graw.h b/src/gallium/include/state_tracker/graw.h index 6a99b23..8da197f 100644 --- a/src/gallium/include/state_tracker/graw.h +++ b/src/gallium/include/state_tracker/graw.h @@ -71,4 +71,25 @@ PUBLIC void *graw_parse_vertex_shader( struct pipe_context *pipe, PUBLIC void *graw_parse_fragment_shader( struct pipe_context *pipe, const char *text ); +/* Parse a single command-line option, if any. Options include: + * + * -o + * + * If an option has been successfully parsed, argi is updated + * to point just after the option and return TRUE. + */ +PUBLIC boolean graw_parse_args(int *argi, int argc, char *argv[]); + +/* Saves surface contents to a file. + * + * If filename is NULL, the filename provided with the `-o' option + * is used. If the option has not been specified, the surface + * will not be saved. + * + * Returns TRUE if the surface has been saved. + */ +PUBLIC boolean graw_save_surface_to_file(struct pipe_context *pipe, + struct pipe_surface *surface, + const char *filename); + #endif diff --git a/src/gallium/targets/graw-null/graw_util.c b/src/gallium/targets/graw-null/graw_util.c index 531757f..e5cf526 100644 --- a/src/gallium/targets/graw-null/graw_util.c +++ b/src/gallium/targets/graw-null/graw_util.c @@ -3,6 +3,7 @@ #include "pipe/p_context.h" #include "pipe/p_state.h" #include "tgsi/tgsi_text.h" +#include "util/u_debug.h" #include "util/u_memory.h" #include "state_tracker/graw.h" @@ -51,3 +52,41 @@ graw_parse_fragment_shader(struct pipe_context *pipe, return pipe->create_fs_state(pipe, &state); } +static char out_filename[256] = ""; + +PUBLIC boolean +graw_parse_args(int *argi, +int argc, +char *argv[]) +{ + if (strcmp(argv[*argi], "-o") == 0) { + if (*argi + 1 >= argc) { + return FALSE; + } + + strncpy(out_filename, argv[*argi + 1], sizeof(out_filename) - 1); + out_filename[sizeof(out_filename) - 1] = '\0'; + *argi += 2; + return TRUE; + } + + return FALSE; +} + +PUBLIC boolean +graw_save_surface_to_file(struct pipe_context *pipe, + struct pipe_surface *surface, + const char *filename) +{ + if (!filename || !*filename) { + filename = out_filename; + if (!filename || !*filename) { + return FALSE; + } + } + + /* XXX: Make that working in release builds. +*/ + debug_dump_surface_bmp(pipe, filename, surface); + return TRUE; +} diff --git a/src/gallium/tests/graw/clear.c b/src/gallium/tests/graw/clear.c index ce52a93..ee4581e 100644 --- a/src/gallium/tests/graw/clear.c +++ b/src/gallium/tests/graw/clear.c @@ -8,8 +8,6 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" -#include "util/u_debug.h" /* debug_dump_surface_bmp() */ - enum pipe_format formats[] = { PIPE_FORMAT_R8G8B8A8_UNORM, PIPE_FORMAT_B8G8R8A8_UNORM, @@ -31,17 +29,7 @@ static void draw( void ) ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0); ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); -#if 0 - /* At the moment, libgraw leaks out/makes available some of the -* symbols from gallium/auxiliary, including these debug helpers. -* Will eventually want to bless some of these paths, and lock the -* others down so they aren't accessible from test programs. -* -* This currently just happens to work on debug builds - a release -* build will probably fail to link here: -*/ - debug_dump_surface_bmp(ctx, "result.bmp", surf); -#endif + g
Mesa (master): os: Open file streams in binary mode.
Module: Mesa Branch: master Commit: 9e7132b52debd3d592391ce89d3582027cb0e161 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e7132b52debd3d592391ce89d3582027cb0e161 Author: Michal Krol Date: Mon Nov 8 17:23:32 2010 +0100 os: Open file streams in binary mode. Otherwise we'll get garbled data on Windows. --- src/gallium/auxiliary/os/os_stream_stdc.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/gallium/auxiliary/os/os_stream_stdc.c b/src/gallium/auxiliary/os/os_stream_stdc.c index 37e7d06..afd3ff6 100644 --- a/src/gallium/auxiliary/os/os_stream_stdc.c +++ b/src/gallium/auxiliary/os/os_stream_stdc.c @@ -106,7 +106,7 @@ os_file_stream_create(const char *filename) stream->base.flush = &os_stdc_stream_flush; stream->base.vprintf = &os_stdc_stream_vprintf; - stream->file = fopen(filename, "w"); + stream->file = fopen(filename, "wb"); if(!stream->file) goto no_file; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): graw/gdi: Fix window dimensions.
Module: Mesa Branch: master Commit: 5d28d2f9d4eb783dbf738e36bf60c6c5275d1db9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d28d2f9d4eb783dbf738e36bf60c6c5275d1db9 Author: Michal Krol Date: Thu Nov 4 15:12:47 2010 +0100 graw/gdi: Fix window dimensions. The requested window size is of the client area, so account for surrounding borders and bars when creating the window. --- src/gallium/targets/graw-gdi/graw_gdi.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gallium/targets/graw-gdi/graw_gdi.c b/src/gallium/targets/graw-gdi/graw_gdi.c index 018b153..52a4e3c 100644 --- a/src/gallium/targets/graw-gdi/graw_gdi.c +++ b/src/gallium/targets/graw-gdi/graw_gdi.c @@ -68,6 +68,8 @@ graw_create_window_and_screen(int x, struct sw_winsys *winsys = NULL; struct pipe_screen *screen = NULL; WNDCLASSEX wc = {sizeof(wc)}; + UINT style = WS_VISIBLE | WS_TILEDWINDOW; + RECT rect; HWND hWnd = NULL; HDC hDC = NULL; @@ -91,14 +93,17 @@ graw_create_window_and_screen(int x, wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); RegisterClassEx(&wc); + SetRect(&rect, 0, 0, width, height); + AdjustWindowRectEx(&rect, style, FALSE, 0); + hWnd = CreateWindowEx(0, wc.lpszClassName, wc.lpszClassName, - WS_VISIBLE | WS_TILEDWINDOW, + style, x, y, - width, - height, + rect.right - rect.left, + rect.bottom - rect.top, NULL, NULL, wc.hInstance, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): graw/gdi: Initial commit.
Module: Mesa Branch: master Commit: 29beaed6dccce5ccedc72446c8d2011324fc92f4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=29beaed6dccce5ccedc72446c8d2011324fc92f4 Author: Michal Krol Date: Thu Nov 4 14:33:11 2010 +0100 graw/gdi: Initial commit. --- src/gallium/targets/graw-gdi/SConscript | 41 src/gallium/targets/graw-gdi/graw_gdi.c | 153 +++ 2 files changed, 194 insertions(+), 0 deletions(-) diff --git a/src/gallium/targets/graw-gdi/SConscript b/src/gallium/targets/graw-gdi/SConscript new file mode 100644 index 000..8ee8915 --- /dev/null +++ b/src/gallium/targets/graw-gdi/SConscript @@ -0,0 +1,41 @@ +### +# SConscript for graw-gdi + +Import('*') + +env = env.Clone() + +env.Append(CPPPATH = [ +'#src/gallium/winsys/sw', +]) + +env.Prepend(LIBS = [ +gallium, +'gdi32', +identity, +rbug, +trace, +'user32', +'ws2_32', +]) + +sources = [ +'graw_gdi.c', +graw_util, +] + +env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') +env.Prepend(LIBS = [softpipe]) + +graw = env.SharedLibrary( +target = 'graw', +source = sources, +LIBS = ws_gdi + env['LIBS'], +) + +if env['platform'] == 'windows': +graw = env.FindIxes(graw, 'LIBPREFIX', 'LIBSUFFIX') +else: +graw = env.FindIxes(graw, 'SHLIBPREFIX', 'SHLIBSUFFIX') + +env.Alias('graw-gdi', graw) diff --git a/src/gallium/targets/graw-gdi/graw_gdi.c b/src/gallium/targets/graw-gdi/graw_gdi.c new file mode 100644 index 000..018b153 --- /dev/null +++ b/src/gallium/targets/graw-gdi/graw_gdi.c @@ -0,0 +1,153 @@ +/** + * + * 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * + **/ + +#include "gdi/gdi_sw_winsys.h" +#include "pipe/p_screen.h" +#include "softpipe/sp_public.h" +#include "state_tracker/graw.h" +#include "sw/sw_public.h" +#include "target-helpers/wrap_screen.h" +#include + + +static LRESULT CALLBACK +window_proc(HWND hWnd, +UINT uMsg, +WPARAM wParam, +LPARAM lParam) +{ + switch (uMsg) { + case WM_DESTROY: + PostQuitMessage(0); + break; + + default: + return DefWindowProc(hWnd, uMsg, wParam, lParam); + } + + return 0; +} + +static struct { + void (* draw)(void); +} graw; + +struct pipe_screen * +graw_create_window_and_screen(int x, + int y, + unsigned width, + unsigned height, + enum pipe_format format, + void **handle) +{ + struct sw_winsys *winsys = NULL; + struct pipe_screen *screen = NULL; + WNDCLASSEX wc = {sizeof(wc)}; + HWND hWnd = NULL; + HDC hDC = NULL; + + if (format != PIPE_FORMAT_R8G8B8A8_UNORM) + goto fail; + + winsys = gdi_create_sw_winsys(); + if (winsys == NULL) + goto fail; + + screen = softpipe_create_screen(winsys); + if (screen == NULL) + goto fail; + + wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = window_proc; + wc.lpszClassName = "graw-gdi"; + wc.hInstance = GetModuleHandle(NULL); + wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + RegisterClassEx(&wc); + + hWnd = CreateWindowEx(0, + wc.lpszClassName, + wc.lpszClassName, + WS_VISIBLE | WS_TILEDWINDOW, + x, + y, + width, + height, + NULL, + NULL, +
Mesa (master): scons: Hook-up graw-gdi target.
Module: Mesa Branch: master Commit: c69979f243fe7ac15d638f9b2b5cf35b30b07939 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c69979f243fe7ac15d638f9b2b5cf35b30b07939 Author: Michal Krol Date: Thu Nov 4 14:33:31 2010 +0100 scons: Hook-up graw-gdi target. --- src/gallium/SConscript |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/gallium/SConscript b/src/gallium/SConscript index eb4f49f..b5bc9ec 100644 --- a/src/gallium/SConscript +++ b/src/gallium/SConscript @@ -81,6 +81,7 @@ if env['x11']: if env['platform'] == 'windows': SConscript([ +'targets/graw-gdi/SConscript', 'targets/libgl-gdi/SConscript', #'egl-gdi/SConscript', ]) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): tgsi/build: Reduce interface clutter.
Module: Mesa Branch: master Commit: 420400f67fce15512a8fcab770dde83a3eacc5cc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=420400f67fce15512a8fcab770dde83a3eacc5cc Author: Michal Krol Date: Thu Nov 4 12:20:14 2010 +0100 tgsi/build: Reduce interface clutter. Make private those functions that are used internally only. --- src/gallium/auxiliary/tgsi/tgsi_build.c | 747 +++ src/gallium/auxiliary/tgsi/tgsi_build.h | 161 --- 2 files changed, 367 insertions(+), 541 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 6dbedf1..1f7d7f1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -64,25 +64,14 @@ header_bodysize_grow( struct tgsi_header *header ) } struct tgsi_processor -tgsi_default_processor( void ) -{ - struct tgsi_processor processor; - - processor.Processor = TGSI_PROCESSOR_FRAGMENT; - processor.Padding = 0; - - return processor; -} - -struct tgsi_processor tgsi_build_processor( unsigned type, struct tgsi_header *header ) { struct tgsi_processor processor; - processor = tgsi_default_processor(); processor.Processor = type; + processor.Padding = 0; header_headersize_grow( header ); @@ -93,7 +82,19 @@ tgsi_build_processor( * declaration */ -struct tgsi_declaration +static void +declaration_grow( + struct tgsi_declaration *declaration, + struct tgsi_header *header ) +{ + assert( declaration->NrTokens < 0xFF ); + + declaration->NrTokens++; + + header_bodysize_grow( header ); +} + +static struct tgsi_declaration tgsi_default_declaration( void ) { struct tgsi_declaration declaration; @@ -112,7 +113,7 @@ tgsi_default_declaration( void ) return declaration; } -struct tgsi_declaration +static struct tgsi_declaration tgsi_build_declaration( unsigned file, unsigned usage_mask, @@ -144,16 +145,96 @@ tgsi_build_declaration( return declaration; } -static void -declaration_grow( +static struct tgsi_declaration_range +tgsi_default_declaration_range( void ) +{ + struct tgsi_declaration_range dr; + + dr.First = 0; + dr.Last = 0; + + return dr; +} + +static struct tgsi_declaration_range +tgsi_build_declaration_range( + unsigned first, + unsigned last, struct tgsi_declaration *declaration, struct tgsi_header *header ) { - assert( declaration->NrTokens < 0xFF ); + struct tgsi_declaration_range declaration_range; - declaration->NrTokens++; + assert( last >= first ); + assert( last <= 0x ); - header_bodysize_grow( header ); + declaration_range.First = first; + declaration_range.Last = last; + + declaration_grow( declaration, header ); + + return declaration_range; +} + +static struct tgsi_declaration_dimension +tgsi_default_declaration_dimension(void) +{ + struct tgsi_declaration_dimension dd; + + dd.Index2D = 0; + dd.Padding = 0; + + return dd; +} + +static struct tgsi_declaration_dimension +tgsi_build_declaration_dimension(unsigned index_2d, + struct tgsi_declaration *declaration, + struct tgsi_header *header) +{ + struct tgsi_declaration_dimension dd; + + assert(index_2d <= 0x); + + dd.Index2D = index_2d; + dd.Padding = 0; + + declaration_grow(declaration, header); + + return dd; +} + +static struct tgsi_declaration_semantic +tgsi_default_declaration_semantic( void ) +{ + struct tgsi_declaration_semantic ds; + + ds.Name = TGSI_SEMANTIC_POSITION; + ds.Index = 0; + ds.Padding = 0; + + return ds; +} + +static struct tgsi_declaration_semantic +tgsi_build_declaration_semantic( + unsigned semantic_name, + unsigned semantic_index, + struct tgsi_declaration *declaration, + struct tgsi_header *header ) +{ + struct tgsi_declaration_semantic ds; + + assert( semantic_name <= TGSI_SEMANTIC_COUNT ); + assert( semantic_index <= 0x ); + + ds.Name = semantic_name; + ds.Index = semantic_index; + ds.Padding = 0; + + declaration_grow( declaration, header ); + + return ds; } struct tgsi_full_declaration @@ -257,104 +338,11 @@ tgsi_build_full_declaration( return size; } -struct tgsi_declaration_range -tgsi_default_declaration_range( void ) -{ - struct tgsi_declaration_range dr; - - dr.First = 0; - dr.Last = 0; - - return dr; -} - -struct tgsi_declaration_range -tgsi_build_declaration_range( - unsigned first, - unsigned last, - struct tgsi_declaration *declaration, - struct tgsi_header *header ) -{ - struct tgsi_declaration_range declaration_range; - - assert( last >= first ); - assert( last <= 0x ); - - declaration_range = tgsi_default_declaration_range(); - declaration_range.First = first; - declaration_range.Last = last; - - declaration_grow( declaration, header ); - - return declaration_range; -} - -struct tgsi_declaration_dimension -tgsi_default_declaration_dimension(v
Mesa (master): tgsi/exec: Get rid of obsolete condition codes.
Module: Mesa Branch: master Commit: f93d6f929f2439f87950df2c30c6c48b6dcac395 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f93d6f929f2439f87950df2c30c6c48b6dcac395 Author: Michal Krol Date: Thu Nov 4 11:51:10 2010 +0100 tgsi/exec: Get rid of obsolete condition codes. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 10 -- src/gallium/auxiliary/tgsi/tgsi_exec.h | 27 --- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 57ae56e..7892a67 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -477,8 +477,6 @@ enum tgsi_exec_datatype { #define TEMP_OUTPUT_C TGSI_EXEC_TEMP_OUTPUT_C #define TEMP_PRIMITIVE_I TGSI_EXEC_TEMP_PRIMITIVE_I #define TEMP_PRIMITIVE_C TGSI_EXEC_TEMP_PRIMITIVE_C -#define TEMP_CC_I TGSI_EXEC_TEMP_CC_I -#define TEMP_CC_C TGSI_EXEC_TEMP_CC_C /** The execution mask depends on the conditional mask and the loop mask */ @@ -3719,14 +3717,6 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach ) mach->Primitives[0] = 0; } - for (i = 0; i < QUAD_SIZE; i++) { - mach->Temps[TEMP_CC_I].xyzw[TEMP_CC_C].u[i] = - (TGSI_EXEC_CC_EQ << TGSI_EXEC_CC_X_SHIFT) | - (TGSI_EXEC_CC_EQ << TGSI_EXEC_CC_Y_SHIFT) | - (TGSI_EXEC_CC_EQ << TGSI_EXEC_CC_Z_SHIFT) | - (TGSI_EXEC_CC_EQ << TGSI_EXEC_CC_W_SHIFT); - } - /* execute declarations (interpolants) */ for (i = 0; i < mach->NumDeclarations; i++) { exec_declaration( mach, mach->Declarations+i ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 9d62c1d..bd5492e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -131,34 +131,15 @@ struct tgsi_sampler #define TGSI_EXEC_TEMP_PRIMITIVE_I (TGSI_EXEC_NUM_TEMPS + 2) #define TGSI_EXEC_TEMP_PRIMITIVE_C 2 -/* NVIDIA condition code (CC) vector - */ -#define TGSI_EXEC_CC_GT 0x01 -#define TGSI_EXEC_CC_EQ 0x02 -#define TGSI_EXEC_CC_LT 0x04 -#define TGSI_EXEC_CC_UN 0x08 - -#define TGSI_EXEC_CC_X_MASK 0x00ff -#define TGSI_EXEC_CC_X_SHIFT 0 -#define TGSI_EXEC_CC_Y_MASK 0xff00 -#define TGSI_EXEC_CC_Y_SHIFT 8 -#define TGSI_EXEC_CC_Z_MASK 0x00ff -#define TGSI_EXEC_CC_Z_SHIFT 16 -#define TGSI_EXEC_CC_W_MASK 0xff00 -#define TGSI_EXEC_CC_W_SHIFT 24 - -#define TGSI_EXEC_TEMP_CC_I (TGSI_EXEC_NUM_TEMPS + 2) -#define TGSI_EXEC_TEMP_CC_C 3 - -#define TGSI_EXEC_TEMP_THREE_I (TGSI_EXEC_NUM_TEMPS + 3) -#define TGSI_EXEC_TEMP_THREE_C 0 +#define TGSI_EXEC_TEMP_THREE_I (TGSI_EXEC_NUM_TEMPS + 2) +#define TGSI_EXEC_TEMP_THREE_C 3 #define TGSI_EXEC_TEMP_HALF_I (TGSI_EXEC_NUM_TEMPS + 3) -#define TGSI_EXEC_TEMP_HALF_C 1 +#define TGSI_EXEC_TEMP_HALF_C 0 /* execution mask, each value is either 0 or ~0 */ #define TGSI_EXEC_MASK_I(TGSI_EXEC_NUM_TEMPS + 3) -#define TGSI_EXEC_MASK_C2 +#define TGSI_EXEC_MASK_C1 /* 4 register buffer for various purposes */ #define TGSI_EXEC_TEMP_R0 (TGSI_EXEC_NUM_TEMPS + 4) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): tgsi/exec: Cleanup the remaining arithmetic instructions.
Module: Mesa Branch: master Commit: ee9366ab363a71407e4806ce079f98fc064d8734 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee9366ab363a71407e4806ce079f98fc064d8734 Author: Michal Krol Date: Thu Nov 4 11:37:24 2010 +0100 tgsi/exec: Cleanup the remaining arithmetic instructions. As a result remove some nasty macros. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 791 +--- 1 files changed, 413 insertions(+), 378 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 3a71540..57ae56e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -429,6 +429,24 @@ micro_sne(union tgsi_exec_channel *dst, } static void +micro_sfl(union tgsi_exec_channel *dst) +{ + dst->f[0] = 0.0f; + dst->f[1] = 0.0f; + dst->f[2] = 0.0f; + dst->f[3] = 0.0f; +} + +static void +micro_str(union tgsi_exec_channel *dst) +{ + dst->f[0] = 1.0f; + dst->f[1] = 1.0f; + dst->f[2] = 1.0f; + dst->f[3] = 1.0f; +} + +static void micro_trunc(union tgsi_exec_channel *dst, const union tgsi_exec_channel *src) { @@ -453,22 +471,6 @@ enum tgsi_exec_datatype { /* * Shorthand locations of various utility registers (_I = Index, _C = Channel) */ -#define TEMP_0_I TGSI_EXEC_TEMP__I -#define TEMP_0_C TGSI_EXEC_TEMP__C -#define TEMP_7F_I TGSI_EXEC_TEMP_7FFF_I -#define TEMP_7F_C TGSI_EXEC_TEMP_7FFF_C -#define TEMP_80_I TGSI_EXEC_TEMP_8000_I -#define TEMP_80_C TGSI_EXEC_TEMP_8000_C -#define TEMP_FF_I TGSI_EXEC_TEMP__I -#define TEMP_FF_C TGSI_EXEC_TEMP__C -#define TEMP_1_I TGSI_EXEC_TEMP_ONE_I -#define TEMP_1_C TGSI_EXEC_TEMP_ONE_C -#define TEMP_2_I TGSI_EXEC_TEMP_TWO_I -#define TEMP_2_C TGSI_EXEC_TEMP_TWO_C -#define TEMP_128_I TGSI_EXEC_TEMP_128_I -#define TEMP_128_C TGSI_EXEC_TEMP_128_C -#define TEMP_M128_ITGSI_EXEC_TEMP_MINUS_128_I -#define TEMP_M128_CTGSI_EXEC_TEMP_MINUS_128_C #define TEMP_KILMASK_I TGSI_EXEC_TEMP_KILMASK_I #define TEMP_KILMASK_C TGSI_EXEC_TEMP_KILMASK_C #define TEMP_OUTPUT_I TGSI_EXEC_TEMP_OUTPUT_I @@ -477,26 +479,6 @@ enum tgsi_exec_datatype { #define TEMP_PRIMITIVE_C TGSI_EXEC_TEMP_PRIMITIVE_C #define TEMP_CC_I TGSI_EXEC_TEMP_CC_I #define TEMP_CC_C TGSI_EXEC_TEMP_CC_C -#define TEMP_3_I TGSI_EXEC_TEMP_THREE_I -#define TEMP_3_C TGSI_EXEC_TEMP_THREE_C -#define TEMP_HALF_ITGSI_EXEC_TEMP_HALF_I -#define TEMP_HALF_CTGSI_EXEC_TEMP_HALF_C -#define TEMP_R0TGSI_EXEC_TEMP_R0 -#define TEMP_P0TGSI_EXEC_TEMP_P0 - -#define IS_CHANNEL_ENABLED(INST, CHAN)\ - ((INST).Dst[0].Register.WriteMask & (1 << (CHAN))) - -#define IS_CHANNEL_ENABLED2(INST, CHAN)\ - ((INST).Dst[1].Register.WriteMask & (1 << (CHAN))) - -#define FOR_EACH_ENABLED_CHANNEL(INST, CHAN)\ - for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++)\ - if (IS_CHANNEL_ENABLED( INST, CHAN )) - -#define FOR_EACH_ENABLED_CHANNEL2(INST, CHAN)\ - for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++)\ - if (IS_CHANNEL_ENABLED2( INST, CHAN )) /** The execution mask depends on the conditional mask and the loop mask */ @@ -511,6 +493,14 @@ static const union tgsi_exec_channel OneVec = { {1.0f, 1.0f, 1.0f, 1.0f} }; +static const union tgsi_exec_channel P128Vec = { + {128.0f, 128.0f, 128.0f, 128.0f} +}; + +static const union tgsi_exec_channel M128Vec = { + {-128.0f, -128.0f, -128.0f, -128.0f} +}; + /** * Assert that none of the float values in 'chan' are infinite or NaN. @@ -572,8 +562,6 @@ tgsi_exec_set_constant_buffers(struct tgsi_exec_machine *mach, } - - /** * Check if there's a potential src/dst register data dependency when * using SOA execution. @@ -607,18 +595,20 @@ tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst) inst->Dst[0].Register.File) && ((inst->Src[i].Register.Index == inst->Dst[0].Register.Index) || - inst->Src[i].Register.Indirect || - inst->Dst[0].Register.Indirect)) { + inst->Src[i].Register.Indirect || + inst->Dst[0].Register.Indirect)) { /* loop over dest channels */ uint channelsWritten = 0x0; - FOR_EACH_ENABLED_CHANNEL(*inst, chan) { -/* check if we're reading a channel that's been written */ -uint swizzle = tgsi_util_get_full_src_register_swizzle(&inst->Src[i], chan); -if (channelsWritten & (1 << swizzle)) { - return TRUE; -} + for (chan = 0; chan < NUM_CHANNELS; chan++) { +if (inst->Dst[0].Register.WriteMask & (1 << chan)) { + /* check if we're reading a channel that's been written */ + uint swizzle = tgsi_util_get_full_src_register_swizzle(&inst->Src[i
Mesa (master): util: Fix build for C++ compilers.
Module: Mesa Branch: master Commit: a43a2f0662c4aa33b50882411181252198819942 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a43a2f0662c4aa33b50882411181252198819942 Author: Michal Krol Date: Fri Aug 20 18:51:22 2010 +0200 util: Fix build for C++ compilers. --- src/gallium/auxiliary/util/u_debug_describe.h |8 src/gallium/auxiliary/util/u_debug_refcnt.h |8 2 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/util/u_debug_describe.h b/src/gallium/auxiliary/util/u_debug_describe.h index cab614b..8c32f02 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.h +++ b/src/gallium/auxiliary/util/u_debug_describe.h @@ -1,10 +1,18 @@ #ifndef U_DEBUG_DESCRIBE_H_ #define U_DEBUG_DESCRIBE_H_ +#ifdef __cplusplus +extern "C" { +#endif + /* a 256-byte buffer is necessary and sufficient */ void debug_describe_reference(char* buf, const struct pipe_reference*ptr); void debug_describe_resource(char* buf, const struct pipe_resource *ptr); void debug_describe_surface(char* buf, const struct pipe_surface *ptr); void debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr); +#ifdef __cplusplus +} +#endif + #endif /* U_DEBUG_DESCRIBE_H_ */ diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.h b/src/gallium/auxiliary/util/u_debug_refcnt.h index e48a2a6..ba40999 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.h +++ b/src/gallium/auxiliary/util/u_debug_refcnt.h @@ -11,6 +11,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)) extern int debug_refcnt_state; @@ -26,4 +30,8 @@ static INLINE void debug_reference(const struct pipe_reference* p, void* get_des {} #endif +#ifdef __cplusplus +} +#endif + #endif /* U_DEBUG_REFCNT_H_ */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallivm: Use proper index to lookup predicate register array .
Module: Mesa Branch: master Commit: 8690c6a6b4fb0b48e2ae75cd0f64de86b039081c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8690c6a6b4fb0b48e2ae75cd0f64de86b039081c Author: michal Date: Wed Aug 18 13:16:42 2010 +0200 gallivm: Use proper index to lookup predicate register array. Doesn't fix anything, as those indices were both always 0. --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 0aa64af..ca8db9c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -802,7 +802,7 @@ emit_store( case TGSI_FILE_PREDICATE: lp_exec_mask_store(&bld->exec_mask, pred, value, - bld->preds[index][chan_index]); + bld->preds[reg->Register.Index][chan_index]); break; default: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Fix unpacking of R8G8Bx_SNORM format.
Module: Mesa Branch: master Commit: c1f33097f4a6cd33df57dc601ba1733985979a4f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1f33097f4a6cd33df57dc601ba1733985979a4f Author: Michal Krol Date: Fri Jul 30 16:59:05 2010 +0200 util: Fix unpacking of R8G8Bx_SNORM format. Apparently, we must always use integers to perform calculations, otherwise the results won't match D3D's CxV8U8 definition. --- src/gallium/auxiliary/util/u_format_other.c | 15 --- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/util/u_format_other.c b/src/gallium/auxiliary/util/u_format_other.c index 723fa8c..fa42ec3 100644 --- a/src/gallium/auxiliary/util/u_format_other.c +++ b/src/gallium/auxiliary/util/u_format_other.c @@ -121,6 +121,15 @@ util_format_r1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, * A.k.a. D3DFMT_CxV8U8 */ +static uint8_t +r8g8bx_derive(int16_t r, int16_t g) +{ + /* Derive blue from red and green components. +* Apparently, we must always use integers to perform calculations, +* otherwise the results won't match D3D's CxV8U8 definition. +*/ + return (uint8_t)sqrtf(0x7f * 0x7f - r * r - g * g) * 0xff / 0x7f; +} void util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, @@ -145,7 +154,7 @@ util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, dst[0] = (float)(r * (1.0f/0x7f)); /* r */ dst[1] = (float)(g * (1.0f/0x7f)); /* g */ - dst[2] = sqrtf(1.0f - dst[0] * dst[0] - dst[1] * dst[1]); /* b */ + dst[2] = r8g8bx_derive(r, g) * (1.0f/0xff); /* b */ dst[3] = 1.0f; /* a */ dst += 4; } @@ -177,7 +186,7 @@ util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_strid dst[0] = (uint8_t)(((uint16_t)MAX2(r, 0)) * 0xff / 0x7f); /* r */ dst[1] = (uint8_t)(((uint16_t)MAX2(g, 0)) * 0xff / 0x7f); /* g */ - dst[2] = (uint8_t)sqrtf(0x7f*0x7f - r * r - g * g) * 0xff / 0x7f; /* b */ + dst[2] = r8g8bx_derive(r, g); /* b */ dst[3] = 255; /* a */ dst += 4; } @@ -262,6 +271,6 @@ util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src, dst[0] = r * (1.0f/0x7f); /* r */ dst[1] = g * (1.0f/0x7f); /* g */ - dst[2] = sqrtf(1.0f - dst[0] * dst[0] - dst[1] * dst[1]); /* b */ + dst[2] = r8g8bx_derive(r, g) * (1.0f/0xff); /* b */ dst[3] = 1.0f; /* a */ } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): softpipe: Check for NULL pointer in sp_destroy_tile_cache().
Module: Mesa Branch: master Commit: 8122baf8badfa9fe7a80bfc904ad7b6ddcdecb0c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8122baf8badfa9fe7a80bfc904ad7b6ddcdecb0c Author: Michal Krol Date: Thu Jul 22 18:32:50 2010 +0200 softpipe: Check for NULL pointer in sp_destroy_tile_cache(). --- src/gallium/drivers/softpipe/sp_tile_cache.c | 18 ++ 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index d7bc356..bf33fd9 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -115,16 +115,18 @@ sp_create_tile_cache( struct pipe_context *pipe ) void sp_destroy_tile_cache(struct softpipe_tile_cache *tc) { - uint pos; + if (tc) { + uint pos; - for (pos = 0; pos < NUM_ENTRIES; pos++) { - /*assert(tc->entries[pos].x < 0);*/ - } - if (tc->transfer) { - tc->pipe->transfer_destroy(tc->pipe, tc->transfer); - } + for (pos = 0; pos < NUM_ENTRIES; pos++) { + /*assert(tc->entries[pos].x < 0);*/ + } + if (tc->transfer) { + tc->pipe->transfer_destroy(tc->pipe, tc->transfer); + } - FREE( tc ); + FREE( tc ); + } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): softpipe: Check for NULL pointer in sp_destroy_tex_tile_cache().
Module: Mesa Branch: master Commit: a0fc83b277ad26d63545996b2affa7da6772e32a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0fc83b277ad26d63545996b2affa7da6772e32a Author: Michal Krol Date: Thu Jul 22 18:32:31 2010 +0200 softpipe: Check for NULL pointer in sp_destroy_tex_tile_cache(). --- src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 24 +++-- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c index b3e1c49..eb74f14 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c @@ -63,19 +63,21 @@ sp_create_tex_tile_cache( struct pipe_context *pipe ) void sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc) { - uint pos; + if (tc) { + uint pos; - for (pos = 0; pos < NUM_ENTRIES; pos++) { - /*assert(tc->entries[pos].x < 0);*/ - } - if (tc->transfer) { - tc->pipe->transfer_destroy(tc->pipe, tc->transfer); - } - if (tc->tex_trans) { - tc->pipe->transfer_destroy(tc->pipe, tc->tex_trans); - } + for (pos = 0; pos < NUM_ENTRIES; pos++) { + /*assert(tc->entries[pos].x < 0);*/ + } + if (tc->transfer) { + tc->pipe->transfer_destroy(tc->pipe, tc->transfer); + } + if (tc->tex_trans) { + tc->pipe->transfer_destroy(tc->pipe, tc->tex_trans); + } - FREE( tc ); + FREE( tc ); + } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): softpipe: Support non-depth-stencil formats in sp_tile_cache_flush_clear().
Module: Mesa Branch: master Commit: 3b2ca688a7016fe504768ecb72f2e42c7b2905ac URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b2ca688a7016fe504768ecb72f2e42c7b2905ac Author: Michal Krol Date: Tue Jul 20 15:00:28 2010 +0200 softpipe: Support non-depth-stencil formats in sp_tile_cache_flush_clear(). --- src/gallium/drivers/softpipe/sp_tile_cache.c |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index f4db6f6..05a3294 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -284,7 +284,11 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc) assert(pt->resource); /* clear the scratch tile to the clear value */ - clear_tile(&tc->tile, pt->resource->format, tc->clear_val); + if (tc->depth_stencil) { + clear_tile(&tc->tile, pt->resource->format, tc->clear_val); + } else { + clear_tile_rgba(&tc->tile, pt->resource->format, tc->clear_color); + } /* push the tile to all positions marked as clear */ for (y = 0; y < h; y += TILE_SIZE) { @@ -292,10 +296,11 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc) union tile_address addr = tile_address(x, y); if (is_clear_flag_set(tc->clear_flags, addr)) { +/* write the scratch tile to the surface */ pipe_put_tile_raw(tc->pipe, pt, x, y, TILE_SIZE, TILE_SIZE, - tc->tile.data.color32, 0/*STRIDE*/); + tc->tile.data.any, 0/*STRIDE*/); numCleared++; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): softpipe: Calculate slice_stride field in get_transfer().
Module: Mesa Branch: master Commit: 5a5a82d7e88c2971acad026b94e90588b2367a22 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5a5a82d7e88c2971acad026b94e90588b2367a22 Author: Michal Krol Date: Tue May 18 12:39:01 2010 +0200 softpipe: Calculate slice_stride field in get_transfer(). --- src/gallium/drivers/softpipe/sp_texture.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 7aa8555..4e6123f 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -343,11 +343,15 @@ softpipe_get_transfer(struct pipe_context *pipe, if (spt) { struct pipe_transfer *pt = &spt->base; enum pipe_format format = resource->format; + const unsigned hgt = u_minify(spr->base.height0, sr.level); + const unsigned nblocksy = util_format_get_nblocksy(format, hgt); + pipe_resource_reference(&pt->resource, resource); pt->sr = sr; pt->usage = usage; pt->box = *box; pt->stride = spr->stride[sr.level]; + pt->slice_stride = pt->stride * nblocksy; spt->offset = sp_get_tex_image_offset(spr, sr.level, sr.face, box->z); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): tgsi: Implement OPCODE_DIV.
Module: Mesa Branch: master Commit: 83826dac9b83a167b224282327105ccd67306c53 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=83826dac9b83a167b224282327105ccd67306c53 Author: Michal Krol Date: Thu May 13 16:37:35 2010 +0200 tgsi: Implement OPCODE_DIV. --- src/gallium/auxiliary/tgsi/tgsi_exec.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 1218242..c15d970 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -3136,7 +3136,7 @@ exec_instruction( break; case TGSI_OPCODE_DIV: - assert( 0 ); + exec_vector_binary(mach, inst, micro_div, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; case TGSI_OPCODE_DP2: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Fix util_dynarray_trim().
Module: Mesa Branch: master Commit: ddc42b6380d0380a6f519df268a8b3531ddb81fb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddc42b6380d0380a6f519df268a8b3531ddb81fb Author: Michal Krol Date: Tue Apr 13 08:59:49 2010 +0100 util: Fix util_dynarray_trim(). --- src/gallium/auxiliary/util/u_dynarray.h | 19 ++- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gallium/auxiliary/util/u_dynarray.h b/src/gallium/auxiliary/util/u_dynarray.h index 5597581..9d1c171 100644 --- a/src/gallium/auxiliary/util/u_dynarray.h +++ b/src/gallium/auxiliary/util/u_dynarray.h @@ -87,15 +87,16 @@ util_dynarray_grow(struct util_dynarray *buf, int diff) static INLINE void util_dynarray_trim(struct util_dynarray *buf) { - if(buf->size != buf->capacity) - {} - else if(buf->size) { - buf->data = REALLOC(buf->data, buf->capacity, buf->size); - buf->capacity = buf->size; - } else { - FREE(buf->data); - buf->data = 0; - buf->capacity = 0; + if (buf->size != buf->capacity) { + if (buf->size) { + buf->data = REALLOC(buf->data, buf->capacity, buf->size); + buf->capacity = buf->size; + } + else { + FREE(buf->data); + buf->data = 0; + buf->capacity = 0; + } } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-resources): scons: Add missing sources.
Module: Mesa Branch: gallium-resources Commit: a3c99807de37dc2c072f1d75ed3a11da333bc9a1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3c99807de37dc2c072f1d75ed3a11da333bc9a1 Author: unknown Date: Fri Apr 9 18:51:39 2010 +0200 scons: Add missing sources. --- src/gallium/auxiliary/SConscript|1 + src/gallium/drivers/svga/SConscript |6 ++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index b857999..d00d5d0 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -171,6 +171,7 @@ source = [ 'util/u_math.c', 'util/u_mm.c', 'util/u_rect.c', +'util/u_resource.c', 'util/u_ringbuffer.c', 'util/u_sampler.c', 'util/u_simple_shaders.c', diff --git a/src/gallium/drivers/svga/SConscript b/src/gallium/drivers/svga/SConscript index ba1b81d..12ce473 100644 --- a/src/gallium/drivers/svga/SConscript +++ b/src/gallium/drivers/svga/SConscript @@ -38,6 +38,11 @@ sources = [ 'svga_pipe_sampler.c', 'svga_pipe_vertex.c', 'svga_pipe_vs.c', +'svga_resource.c', +'svga_resource_buffer.c', +'svga_resource_buffer_upload.c', +'svga_resource_texture.c', +'svga_sampler_view.c', 'svga_screen.c', 'svga_screen_cache.c', 'svga_state.c', @@ -49,6 +54,7 @@ sources = [ 'svga_state_vdecl.c', 'svga_state_fs.c', 'svga_state_vs.c', +'svga_surface.c', 'svga_swtnl_backend.c', 'svga_swtnl_draw.c', 'svga_swtnl_state.c', ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-resources): util: Fix type cast.
Module: Mesa Branch: gallium-resources Commit: 7c8763aa6cfc74adf1ea49c2bab25ca17b32575f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c8763aa6cfc74adf1ea49c2bab25ca17b32575f Author: unknown Date: Fri Apr 9 18:05:20 2010 +0200 util: Fix type cast. --- src/gallium/auxiliary/util/u_inlines.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index f9cd4e1..c2f4f05 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -161,7 +161,7 @@ pipe_buffer_map_range(struct pipe_context *pipe, struct pipe_transfer **transfer) { struct pipe_box box; - char *map; + void *map; assert(offset < buffer->width0); assert(offset + length <= buffer->width0); @@ -187,7 +187,7 @@ pipe_buffer_map_range(struct pipe_context *pipe, /* Match old screen->buffer_map_range() behaviour, return pointer * to where the beginning of the buffer would be: */ - return (void *)(map - offset); + return (void *)((char *)map - offset); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-resources): libgl-gdi: Use proper unwrap functions for resources.
Module: Mesa Branch: gallium-resources Commit: 9d0086411a104b7cc9297aac0d1f82853118d7bf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d0086411a104b7cc9297aac0d1f82853118d7bf Author: unknown Date: Fri Apr 9 18:04:33 2010 +0200 libgl-gdi: Use proper unwrap functions for resources. --- .../targets/libgl-gdi/gdi_llvmpipe_winsys.c|2 +- .../targets/libgl-gdi/gdi_softpipe_winsys.c|2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/targets/libgl-gdi/gdi_llvmpipe_winsys.c b/src/gallium/targets/libgl-gdi/gdi_llvmpipe_winsys.c index 29316a1..58c941a 100644 --- a/src/gallium/targets/libgl-gdi/gdi_llvmpipe_winsys.c +++ b/src/gallium/targets/libgl-gdi/gdi_llvmpipe_winsys.c @@ -83,7 +83,7 @@ gdi_llvmpipe_present(struct pipe_screen *screen, * other structs such as this stw_winsys as well... */ gdi_sw_display(llvmpipe_screen(screen)->winsys, - llvmpipe_texture(surface->texture)->dt, + llvmpipe_resource(surface->texture)->dt, hDC); } diff --git a/src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c b/src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c index dfe6019..4ac507f 100644 --- a/src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c +++ b/src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c @@ -83,7 +83,7 @@ gdi_softpipe_present(struct pipe_screen *screen, * other structs such as this stw_winsys as well... */ gdi_sw_display(softpipe_screen(screen)->winsys, - softpipe_texture(surface->texture)->dt, + softpipe_resource(surface->texture)->dt, hDC); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Respect destination stride in pipe_get_tile_swizzle().
Module: Mesa Branch: master Commit: 859642c655b149a1321f214e6a731eb1ea991dc7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=859642c655b149a1321f214e6a731eb1ea991dc7 Author: Michal Krol Date: Tue Apr 6 17:19:28 2010 +0200 util: Respect destination stride in pipe_get_tile_swizzle(). --- src/gallium/auxiliary/util/u_tile.c | 26 -- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 33cdbe4..9f2bb81 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -416,7 +416,7 @@ pipe_get_tile_swizzle(struct pipe_context *pipe, { unsigned dst_stride = w * 4; void *packed; - uint i; + uint iy; float rgba01[6]; if (pipe_clip_tile(x, y, &w, &h, pt)) { @@ -449,16 +449,22 @@ pipe_get_tile_swizzle(struct pipe_context *pipe, rgba01[PIPE_SWIZZLE_ZERO] = 0.0f; rgba01[PIPE_SWIZZLE_ONE] = 1.0f; - for (i = 0; i < w * h; i++) { - rgba01[PIPE_SWIZZLE_RED] = p[0]; - rgba01[PIPE_SWIZZLE_GREEN] = p[1]; - rgba01[PIPE_SWIZZLE_BLUE] = p[2]; - rgba01[PIPE_SWIZZLE_ALPHA] = p[3]; + for (iy = 0; iy < h; iy++) { + float *row = p; + uint ix; - *p++ = rgba01[swizzle_r]; - *p++ = rgba01[swizzle_g]; - *p++ = rgba01[swizzle_b]; - *p++ = rgba01[swizzle_a]; + for (ix = 0; ix < w; ix++) { + rgba01[PIPE_SWIZZLE_RED] = row[0]; + rgba01[PIPE_SWIZZLE_GREEN] = row[1]; + rgba01[PIPE_SWIZZLE_BLUE] = row[2]; + rgba01[PIPE_SWIZZLE_ALPHA] = row[3]; + + *row++ = rgba01[swizzle_r]; + *row++ = rgba01[swizzle_g]; + *row++ = rgba01[swizzle_b]; + *row++ = rgba01[swizzle_a]; + } + p += dst_stride; } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Declare .CRT$XCU data segment.
Module: Mesa Branch: master Commit: 13d2f3c7380be6cf476d56269c17b52c53f313b3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=13d2f3c7380be6cf476d56269c17b52c53f313b3 Author: Michal Krol Date: Thu Apr 1 19:25:25 2010 +0200 util: Declare .CRT$XCU data segment. --- src/gallium/auxiliary/util/u_init.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/util/u_init.h b/src/gallium/auxiliary/util/u_init.h index edbcf2d..40dafad 100644 --- a/src/gallium/auxiliary/util/u_init.h +++ b/src/gallium/auxiliary/util/u_init.h @@ -40,6 +40,7 @@ /* add a pointer to the section where MSVC stores global constructor pointers */ /* see http://blogs.msdn.com/vcblog/archive/2006/10/20/crt-initialization.aspx and http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc */ +#pragma data_seg(".CRT$XCU") #define UTIL_INIT(f) static void __cdecl f##__init(void) {f();}; __declspec(allocate(".CRT$XCU")) void (__cdecl* f##__xcu)(void) = f##__init; #elif defined(__GNUC__) #define UTIL_INIT(f) static void f##__init(void) __attribute__((constructor)); static void f##__init(void) {f();} ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): scons: Remove `util/u_gctors.cpp'.
Module: Mesa Branch: master Commit: 8c519e5f87ad6e96c68a13fab636ffdb8c4930e9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c519e5f87ad6e96c68a13fab636ffdb8c4930e9 Author: Michal Krol Date: Thu Apr 1 19:06:05 2010 +0200 scons: Remove `util/u_gctors.cpp'. --- src/gallium/auxiliary/SConscript |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 02b8045..d0443db 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -143,7 +143,6 @@ source = [ 'util/u_format_s3tc.c', 'util/u_format_table.c', 'util/u_format_tests.c', -'util/u_gctors.cpp', 'util/u_gen_mipmap.c', 'util/u_half.c', 'util/u_handle_table.c', ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Generate correct format conversions for half floats.
Module: Mesa Branch: master Commit: 943408533d2ccbb3743dcbdf143f1d23d23f29a9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=943408533d2ccbb3743dcbdf143f1d23d23f29a9 Author: Michal Krol Date: Thu Apr 1 13:56:03 2010 +0200 util: Generate correct format conversions for half floats. --- src/gallium/auxiliary/util/u_format_pack.py | 98 --- 1 files changed, 59 insertions(+), 39 deletions(-) diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py index d36c637..390be0c 100644 --- a/src/gallium/auxiliary/util/u_format_pack.py +++ b/src/gallium/auxiliary/util/u_format_pack.py @@ -231,66 +231,86 @@ def conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=True if src_channel == dst_channel: return value -if src_channel.type == FLOAT and dst_channel.type == FLOAT: -if src_channel.size == 64: -value = '(float)%s' % (value) -elif src_channel.size == 16: -value = 'util_half_to_float(%s)' % (value) +src_type = src_channel.type +src_size = src_channel.size +src_norm = src_channel.norm -if dst_channel.size == 16: -value = 'util_float_to_half(%s)' % (value) -elif dst_channel.size == 64: -value = '(double)%s' % (value) - -return value +# Promote half to float +if src_type == FLOAT and src_size == 16: +value = 'util_half_to_float(%s)' % value +src_size = 32 if clamp: -value = clamp_expr(src_channel, dst_channel, dst_native_type, value) - -if dst_channel.type == FLOAT: -if src_channel.norm: -one = get_one(src_channel) -if src_channel.size <= 23: -scale = '(1.0f/0x%x)' % one -else: -# bigger than single precision mantissa, use double -scale = '(1.0/0x%x)' % one -value = '(%s * %s)' % (value, scale) -return '(%s)%s' % (dst_native_type, value) - -if src_channel.type == FLOAT: -if dst_channel.norm: -dst_one = get_one(dst_channel) -if dst_channel.size <= 23: -scale = '0x%x' % dst_one -else: -# bigger than single precision mantissa, use double -scale = '(double)0x%x' % dst_one -value = '(%s * %s)' % (value, scale) -return '(%s)%s' % (dst_native_type, value) +if dst_channel.type != FLOAT or src_type != FLOAT: +value = clamp_expr(src_channel, dst_channel, dst_native_type, value) -if src_channel.type in (SIGNED, UNSIGNED) and dst_channel.type in (SIGNED, UNSIGNED): -if not src_channel.norm and not dst_channel.norm: +if src_type in (SIGNED, UNSIGNED) and dst_channel.type in (SIGNED, UNSIGNED): +if not src_norm and not dst_channel.norm: # neither is normalized -- just cast return '(%s)%s' % (dst_native_type, value) src_one = get_one(src_channel) dst_one = get_one(dst_channel) -if src_one > dst_one and src_channel.norm and dst_channel.norm: +if src_one > dst_one and src_norm and dst_channel.norm: # We can just bitshift src_shift = get_one_shift(src_channel) dst_shift = get_one_shift(dst_channel) value = '(%s >> %s)' % (value, src_shift - dst_shift) else: # We need to rescale using an intermediate type big enough to hold the multiplication of both -tmp_native_type = intermediate_native_type(src_channel.size + dst_channel.size, src_channel.sign and dst_channel.sign) +tmp_native_type = intermediate_native_type(src_size + dst_channel.size, src_channel.sign and dst_channel.sign) value = '((%s)%s)' % (tmp_native_type, value) value = '(%s * 0x%x / 0x%x)' % (value, dst_one, src_one) value = '(%s)%s' % (dst_native_type, value) return value -assert False +# Promote to either float or double +if src_type != FLOAT: +if src_norm: +one = get_one(src_channel) +if src_size <= 23: +value = '(%s * (1.0f/0x%x))' % (value, one) +if dst_channel.size <= 32: +value = '(float)%s' % value +src_size = 32 +else: +# bigger than single precision mantissa, use double +value = '(%s * (1.0/0x%x))' % (value, one) +src_size = 64 +src_norm = False +else: +if src_size <= 23 or dst_channel.size <= 32: +value = '(float)%s' % value +src_size = 32 +else: +# bigger than single precision mantissa, use double +value = '(double)%s' % value +src_size = 64 +src_type = FLOAT + +# Convert double or float to non-float +if dst_c
Mesa (master): util: Use u_half to perform half <--> float conversions.
Module: Mesa Branch: master Commit: b7bca4b28cb5b12bc84391c53ea932cfd117dc52 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7bca4b28cb5b12bc84391c53ea932cfd117dc52 Author: Michal Krol Date: Thu Apr 1 09:52:40 2010 +0200 util: Use u_half to perform half <--> float conversions. --- src/gallium/auxiliary/util/u_format_pack.py | 53 +++ 1 files changed, 6 insertions(+), 47 deletions(-) diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py index 90c1ae9..d36c637 100644 --- a/src/gallium/auxiliary/util/u_format_pack.py +++ b/src/gallium/auxiliary/util/u_format_pack.py @@ -43,45 +43,6 @@ import math from u_format_parse import * -def generate_f16_to_f32(): -'''Naive implementation, need something faster that operates on bits''' - -print ''' -static float -f16_to_f32(uint16_t h) -{ -unsigned mantissa = h & 0x3ff; -unsigned exponent = (h >> 10) & 0x1f; -float sign = (h & 0x8000) ? -1.0f : 1.0f; - -if (exponent == 0) { -if (mantissa == 0) { -return sign * 0.0f; -} -return sign * powf(2.0f, -14.0f) * (float)mantissa / 1024.0f; -} -if (exponent == 31) { -if (mantissa == 0) { -/* XXX: infinity */ -return sign * 10.0f; -} -/* XXX: NaN */ -return 1000.0f; -} -return sign * powf(2.0f, (float)exponent - 15.0f) * (1.0f + (float)mantissa / 1024.0f); -} -''' - -def generate_f32_to_f16(): -print ''' -static uint16_t -f32_to_f16(float f) -{ -/* TODO */ -return 0; -} -''' - def generate_format_type(format): '''Generate a structure that describes the format.''' @@ -271,18 +232,18 @@ def conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=True return value if src_channel.type == FLOAT and dst_channel.type == FLOAT: -if src_channel.size == dst_channel.size: -return value if src_channel.size == 64: value = '(float)%s' % (value) elif src_channel.size == 16: -value = 'f16_to_f32(%s)' % (value) +value = 'util_half_to_float(%s)' % (value) + if dst_channel.size == 16: -value = 'f32_to_f16(%s)' % (value) +value = 'util_float_to_half(%s)' % (value) elif dst_channel.size == 64: value = '(double)%s' % (value) + return value - + if clamp: value = clamp_expr(src_channel, dst_channel, dst_native_type, value) @@ -584,11 +545,9 @@ def generate(formats): print '#include "pipe/p_compiler.h"' print '#include "u_math.h"' print '#include "u_format.h"' +print '#include "u_half.h"' print -generate_f16_to_f32() -generate_f32_to_f16() - for format in formats: if is_format_supported(format): generate_format_type(format) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium: Integrate util_half with scons.
Module: Mesa Branch: master Commit: 5a359df2195583f94f7d6bcd28144677630df03b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5a359df2195583f94f7d6bcd28144677630df03b Author: Michal Krol Date: Thu Apr 1 09:51:54 2010 +0200 gallium: Integrate util_half with scons. --- src/gallium/auxiliary/SConscript |2 ++ src/gallium/include/pipe/p_compiler.h |1 + 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index ed719f9..02b8045 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -143,7 +143,9 @@ source = [ 'util/u_format_s3tc.c', 'util/u_format_table.c', 'util/u_format_tests.c', +'util/u_gctors.cpp', 'util/u_gen_mipmap.c', +'util/u_half.c', 'util/u_handle_table.c', 'util/u_hash.c', 'util/u_hash_table.c', diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index e2766d1..d645fd0 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -74,6 +74,7 @@ typedef unsigned char boolean; #define FALSE false #endif +typedef unsigned short half; /* Function inlining */ #ifndef INLINE ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium/util: add fast half float conversion functions
Module: Mesa Branch: master Commit: 3ff175d6de89ad92d167362355501f99d06f0f97 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ff175d6de89ad92d167362355501f99d06f0f97 Author: Luca Barbieri Date: Wed Mar 24 18:12:45 2010 +0100 gallium/util: add fast half float conversion functions This adds a fast half float conversion facility to Gallium. Mesa already contains such a facility, but using a much worse algorithm. This one is an implementation of www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf and uses a branch-less algorithm with some lookup tables small enough to fit in the L1 cache. Ideally, Mesa should start using these functions too, but I'm not sure how to arrange that with the current build system. A new "u_gctors.cpp" is added that defines a global C++ constructor allowing to initialize to conversion lookup tables at library init. --- src/gallium/auxiliary/Makefile |4 + src/gallium/auxiliary/util/u_gctors.cpp | 17 src/gallium/auxiliary/util/u_half.c | 123 +++ src/gallium/auxiliary/util/u_half.h | 55 ++ 4 files changed, 199 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 4c62992..14c0fb1 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -110,6 +110,7 @@ C_SOURCES = \ util/u_format_table.c \ util/u_format_tests.c \ util/u_gen_mipmap.c \ + util/u_half.c \ util/u_handle_table.c \ util/u_hash_table.c \ util/u_hash.c \ @@ -138,6 +139,9 @@ C_SOURCES = \ #vl/vl_csc.c \ #vl/vl_shader_build.c \ +CPP_SOURCES = \ + util/u_gctors.cpp + GALLIVM_SOURCES = \ gallivm/lp_bld_alpha.c \ gallivm/lp_bld_arit.c \ diff --git a/src/gallium/auxiliary/util/u_gctors.cpp b/src/gallium/auxiliary/util/u_gctors.cpp new file mode 100644 index 000..9ea9819 --- /dev/null +++ b/src/gallium/auxiliary/util/u_gctors.cpp @@ -0,0 +1,17 @@ +/* this file uses the C++ global constructor mechanism to automatically + initialize global data + + __attribute__((constructor)) allows to do this in C, but is GCC-only +*/ + +extern "C" void util_half_init_tables(void); + +struct util_gctor_t +{ + util_gctor_t() + { + util_half_init_tables(); + } +}; + +static struct util_gctor_t util_gctor; diff --git a/src/gallium/auxiliary/util/u_half.c b/src/gallium/auxiliary/util/u_half.c new file mode 100644 index 000..8865acb --- /dev/null +++ b/src/gallium/auxiliary/util/u_half.c @@ -0,0 +1,123 @@ +#include "util/u_half.h" + +/* see www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf + * "Fast Half Float Conversions" by Jeroen van der Zijp, Nov 2008 + */ + +/* Note that using a 64K * 4 table is a terrible idea since it will not fit + * in the L1 cache and will massively pollute the L2 cache as well + * + * These should instead fit in the L1 cache. + * + * TODO: we could use a denormal bias table instead of the mantissa/offset + * tables: this would reduce the L1 cache usage from 8704 to 2304 bytes + * but would involve more computation + * + * Note however that if denormals are never encountered, the L1 cache usage + * is only about 4608 bytes anyway. + */ +uint32_t util_half_to_float_mantissa_table[2048]; +uint32_t util_half_to_float_exponent_table[64]; +uint32_t util_half_to_float_offset_table[64]; +uint16_t util_float_to_half_base_table[512]; +uint8_t util_float_to_half_shift_table[512]; + +/* called by u_gctors.cpp, which defines the prototype itself */ +void util_half_init_tables(void); + +void util_half_init_tables(void) +{ + int i; + + /* zero */ + util_half_to_float_mantissa_table[0] = 0; + + /* denormals */ + for(i = 1; i < 1024; ++i) { + unsigned int m = i << 13; + unsigned int e = 0; + + /* Normalize number */ + while(!(m & 0x0080)) { + e -= 0x0080; + m<<=1; + } + m &= ~0x0080; + e+= 0x3880; + util_half_to_float_mantissa_table[i] = m | e; + } + + /* normals */ + for(i = 1024; i < 2048; ++i) + util_half_to_float_mantissa_table[i] = ((i-1024)<<13); + + /* positive zero or denormals */ + util_half_to_float_exponent_table[0] = 0; + + /* positive numbers */ + for(i = 1; i <= 30; ++i) + util_half_to_float_exponent_table[i] = 0x3800 + (i << 23); + + /* positive infinity/NaN */ + util_half_to_float_exponent_table[31] = 0x7f80; + + /* negative zero or denormals */ + util_half_to_float_exponent_table[32] = 0x8000; + + /* negative numbers */ + for(i = 33; i <= 62; ++i) + util_half_to_float_exponent_table[i] = 0xb800 + ((i - 32) << 23); + + /* negative infinity/NaN */ + util_half_to_
Mesa (master): util: First stab at half-float conversion.
Module: Mesa Branch: master Commit: b8012643e1f5f6e49593ec8f04d3721df53e6afb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8012643e1f5f6e49593ec8f04d3721df53e6afb Author: Michal Krol Date: Wed Mar 31 21:54:54 2010 +0200 util: First stab at half-float conversion. --- src/gallium/auxiliary/util/u_format_pack.py | 101 +++ 1 files changed, 55 insertions(+), 46 deletions(-) diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py index c74900c..26f8748 100644 --- a/src/gallium/auxiliary/util/u_format_pack.py +++ b/src/gallium/auxiliary/util/u_format_pack.py @@ -43,6 +43,45 @@ import math from u_format_parse import * +def generate_f16_to_f32(): +'''Naive implementation, need something faster that operates on bits''' + +print ''' +static float +f16_to_f32(uint16_t h) +{ +unsigned mantissa = h & 0x3ff; +unsigned exponent = (h >> 10) & 0x1f; +float sign = (h & 0x8000) ? -1.0f : 1.0f; + +if (exponent == 0) { +if (mantissa == 0) { +return sign * 0.0f; +} +return sign * powf(2.0f, -14.0f) * (float)mantissa / 1024.0f; +} +if (exponent == 31) { +if (mantissa == 0) { +/* XXX: infinity */ +return sign * 10.0f; +} +/* XXX: NaN */ +return 1000.0f; +} +return sign * powf(2.0f, (float)exponent - 15.0f) * (1.0f + (float)mantissa / 1024.0f); +} +''' + +def generate_f32_to_f16(): +print ''' +static uint16_t +f32_to_f16(float f) +{ +/* TODO */ +return 0; +} +''' + def generate_format_type(format): '''Generate a structure that describes the format.''' @@ -127,9 +166,6 @@ def is_format_supported(format): channel = format.channels[i] if channel.type not in (VOID, UNSIGNED, SIGNED, FLOAT): return False -if channel.type == FLOAT: -if channel.size not in (32, 64): - return False # We can only read a color from a depth/stencil format if the depth channel is present if format.colorspace == 'zs' and format.swizzles[0] == SWIZZLE_NONE: @@ -153,7 +189,9 @@ def native_type(format): elif channel.type == SIGNED: return 'int%u_t' % channel.size elif channel.type == FLOAT: -if channel.size == 32: +if channel.size == 16: +return 'uint16_t' +elif channel.size == 32: return 'float' elif channel.size == 64: return 'double' @@ -202,31 +240,6 @@ def get_one(type): return (1 << get_one_shift(type)) - 1 -def generate_clamp(): -'''Code generate the clamping functions for each type. - -We don't use a macro so that arguments with side effects, -like *src_pixel++ are correctly handled. -''' - -for suffix, native_type in [ -('', 'double'), -('f', 'float'), -('ui', 'unsigned int'), -('si', 'int'), -]: -print 'static INLINE %s' % native_type -print 'clamp%s(%s value, %s lbound, %s ubound)' % (suffix, native_type, native_type, native_type) -print '{' -print ' if(value < lbound)' -print ' return lbound;' -print ' if(value > ubound)' -print ' return ubound;' -print ' return value;' -print '}' -print - - def clamp_expr(src_channel, dst_channel, dst_native_type, value): '''Generate the expression to clamp the value in the source type to the destination type range.''' @@ -234,21 +247,6 @@ def clamp_expr(src_channel, dst_channel, dst_native_type, value): if src_channel == dst_channel: return value -# Pick the approriate clamp function -if src_channel.type == FLOAT: -if src_channel.size == 32: -func = 'clampf' -elif src_channel.size == 64: -func = 'clamp' -else: -assert False -elif src_channel.type == UNSIGNED: -func = 'clampui' -elif src_channel.type == SIGNED: -func = 'clampsi' -else: -assert False - src_min = src_channel.min() src_max = src_channel.max() dst_min = dst_channel.min() @@ -273,7 +271,17 @@ def conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=True return value if src_channel.type == FLOAT and dst_channel.type == FLOAT: -return '(%s)%s' % (dst_native_type, value) +if src_channel.size == dst_channel.size: +return value +if src_channel.size == 64: +value = '(float)%s' % (value) +elif src_channel.size == 16: +value = 'f16_to_f32(%s)' % (value) +if dst_channel.size == 16: +value = 'f32_to_f16(%s)' % (value) +elif dst_channel.size == 64: +value = '(double)%s' % (value) +return value if clamp:
Mesa (master): softpipe: Map GS constants, too.
Module: Mesa Branch: master Commit: 37877b192e4f9e753f5e837520090206b342a6ea URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=37877b192e4f9e753f5e837520090206b342a6ea Author: Michal Krol Date: Tue Mar 23 16:21:03 2010 +0100 softpipe: Map GS constants, too. --- src/gallium/drivers/softpipe/sp_state_fs.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index 2b089c2..d6f3229 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -181,9 +181,8 @@ softpipe_set_constant_buffer(struct pipe_context *pipe, /* note: reference counting */ pipe_buffer_reference(&softpipe->constants[shader][index], constants); - if(shader == PIPE_SHADER_VERTEX) { - draw_set_mapped_constant_buffer(softpipe->draw, PIPE_SHADER_VERTEX, index, - data, size); + if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) { + draw_set_mapped_constant_buffer(softpipe->draw, shader, index, data, size); } softpipe->mapped_constants[shader][index] = data; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-resources): softpipe: Map GS constants, too.
Module: Mesa Branch: gallium-resources Commit: 7810606f423ef2f51f0a14b919640c2fd2c931aa URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7810606f423ef2f51f0a14b919640c2fd2c931aa Author: Michal Krol Date: Tue Mar 23 16:21:03 2010 +0100 softpipe: Map GS constants, too. --- src/gallium/drivers/softpipe/sp_state_fs.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index 64d26c1..7f072f5 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -181,9 +181,8 @@ softpipe_set_constant_buffer(struct pipe_context *pipe, /* note: reference counting */ pipe_resource_reference(&softpipe->constants[shader][index], constants); - if(shader == PIPE_SHADER_VERTEX) { - draw_set_mapped_constant_buffer(softpipe->draw, PIPE_SHADER_VERTEX, index, - data, size); + if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) { + draw_set_mapped_constant_buffer(softpipe->draw, shader, index, data, size); } softpipe->mapped_constants[shader][index] = data; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-resources): gallium: Usage parameter of get_transfer/ transfer_inline_write is a bitfield.
Module: Mesa Branch: gallium-resources Commit: b33fd3ce3daf2921a895367d0ed3fd9c718a8575 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b33fd3ce3daf2921a895367d0ed3fd9c718a8575 Author: Michal Krol Date: Mon Mar 22 21:03:26 2010 +0100 gallium: Usage parameter of get_transfer/transfer_inline_write is a bitfield. --- src/gallium/auxiliary/util/u_resource.c |2 +- src/gallium/auxiliary/util/u_transfer.c |4 ++-- src/gallium/auxiliary/util/u_transfer.h | 12 ++-- src/gallium/drivers/cell/ppu/cell_texture.c |2 +- src/gallium/drivers/i915/i915_resource_buffer.c |2 +- src/gallium/drivers/identity/id_context.c|4 ++-- src/gallium/drivers/llvmpipe/lp_texture.c|2 +- src/gallium/drivers/nv50/nv50_transfer.c |2 +- src/gallium/drivers/nv50/nv50_transfer.h |2 +- src/gallium/drivers/nvfx/nvfx_transfer.c |2 +- src/gallium/drivers/nvfx/nvfx_transfer.h |2 +- src/gallium/drivers/softpipe/sp_texture.c|2 +- src/gallium/drivers/svga/svga_resource_texture.c |2 +- src/gallium/drivers/trace/tr_context.c |4 ++-- src/gallium/include/pipe/p_context.h |4 ++-- 15 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/gallium/auxiliary/util/u_resource.c b/src/gallium/auxiliary/util/u_resource.c index e0fa2dc..c37a68b 100644 --- a/src/gallium/auxiliary/util/u_resource.c +++ b/src/gallium/auxiliary/util/u_resource.c @@ -75,7 +75,7 @@ void u_transfer_unmap_vtbl( struct pipe_context *pipe, void u_transfer_inline_write_vtbl( struct pipe_context *pipe, struct pipe_resource *resource, struct pipe_subresource sr, - enum pipe_transfer_usage usage, + unsigned usage, const struct pipe_box *box, const void *data, unsigned stride, diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c index 24a7873..02e714f 100644 --- a/src/gallium/auxiliary/util/u_transfer.c +++ b/src/gallium/auxiliary/util/u_transfer.c @@ -10,7 +10,7 @@ void u_default_transfer_inline_write( struct pipe_context *pipe, struct pipe_resource *resource, struct pipe_subresource sr, - enum pipe_transfer_usage usage, + unsigned usage, const struct pipe_box *box, const void *data, unsigned stride, @@ -79,7 +79,7 @@ unsigned u_default_is_resource_referenced( struct pipe_context *pipe, struct pipe_transfer * u_default_get_transfer(struct pipe_context *context, struct pipe_resource *resource, struct pipe_subresource sr, - enum pipe_transfer_usage usage, + unsigned usage, const struct pipe_box *box) { struct pipe_transfer *transfer = CALLOC_STRUCT(pipe_transfer); diff --git a/src/gallium/auxiliary/util/u_transfer.h b/src/gallium/auxiliary/util/u_transfer.h index 4d67b85..eb07945 100644 --- a/src/gallium/auxiliary/util/u_transfer.h +++ b/src/gallium/auxiliary/util/u_transfer.h @@ -16,7 +16,7 @@ boolean u_default_resource_get_handle(struct pipe_screen *screen, void u_default_transfer_inline_write( struct pipe_context *pipe, struct pipe_resource *resource, struct pipe_subresource sr, - enum pipe_transfer_usage usage, + unsigned usage, const struct pipe_box *box, const void *data, unsigned stride, @@ -33,7 +33,7 @@ unsigned u_default_is_resource_referenced( struct pipe_context *pipe, struct pipe_transfer * u_default_get_transfer(struct pipe_context *context, struct pipe_resource *resource, struct pipe_subresource sr, - enum pipe_transfer_usage usage, + unsigned usage, const struct pipe_box *box); void u_default_transfer_unmap( struct pipe_context *pipe, @@ -63,7 +63,7 @@ struct u_resource_vtbl { struct pipe_transfer *(*get_transfer)(struct pipe_context *, struct pipe_resource *resource, struct pipe_subre
Mesa (gallium-resources): scons: Update file lists after gallium-resources changes.
Module: Mesa Branch: gallium-resources Commit: 9c1162d9d656062a490a529997def3f674cc61fc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c1162d9d656062a490a529997def3f674cc61fc Author: Michal Krol Date: Mon Mar 22 20:50:49 2010 +0100 scons: Update file lists after gallium-resources changes. --- src/gallium/auxiliary/SConscript|3 +-- src/gallium/drivers/softpipe/SConscript |1 - src/gallium/drivers/svga/SConscript |2 -- 3 files changed, 1 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 65e1dc8..6988de7 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -168,9 +168,8 @@ source = [ 'util/u_surface.c', 'util/u_texture.c', 'util/u_tile.c', -'util/u_timed_winsys.c', +'util/u_transfer.c', 'util/u_upload_mgr.c', -'util/u_simple_screen.c', # Disabling until pipe-video branch gets merged in #'vl/vl_bitstream_parser.c', #'vl/vl_mpeg12_mc_renderer.c', diff --git a/src/gallium/drivers/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript index 9949a53..6bd7e07 100644 --- a/src/gallium/drivers/softpipe/SConscript +++ b/src/gallium/drivers/softpipe/SConscript @@ -7,7 +7,6 @@ softpipe = env.ConvenienceLibrary( source = [ 'sp_fs_exec.c', 'sp_fs_sse.c', - 'sp_buffer.c', 'sp_clear.c', 'sp_context.c', 'sp_draw_arrays.c', diff --git a/src/gallium/drivers/svga/SConscript b/src/gallium/drivers/svga/SConscript index 737b791..ba1b81d 100644 --- a/src/gallium/drivers/svga/SConscript +++ b/src/gallium/drivers/svga/SConscript @@ -39,9 +39,7 @@ sources = [ 'svga_pipe_vertex.c', 'svga_pipe_vs.c', 'svga_screen.c', -'svga_screen_buffer.c', 'svga_screen_cache.c', -'svga_screen_texture.c', 'svga_state.c', 'svga_state_constants.c', 'svga_state_framebuffer.c', ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-resources): gallium: Do not use `template` for formal parameter names.
Module: Mesa Branch: gallium-resources Commit: af9793ab9e5386b150d6b25c0d1978fdc67172e4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=af9793ab9e5386b150d6b25c0d1978fdc67172e4 Author: Michal Krol Date: Mon Mar 22 20:04:39 2010 +0100 gallium: Do not use `template` for formal parameter names. --- src/gallium/include/pipe/p_screen.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index cc9cebc..8fa648e 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -107,7 +107,7 @@ struct pipe_screen { * Create a new texture object, using the given template info. */ struct pipe_resource * (*resource_create)(struct pipe_screen *, -const struct pipe_resource *template); +const struct pipe_resource *templat); /** * Create a texture from a winsys_handle. The handle is often created in @@ -115,7 +115,7 @@ struct pipe_screen { * texture_get_handle. */ struct pipe_resource * (*resource_from_handle)(struct pipe_screen *, - const struct pipe_resource *template, + const struct pipe_resource *templat, struct winsys_handle *handle); /** ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium/docs: Clarify sampler view descriptions.
Module: Mesa Branch: master Commit: 980da4aed28eca5770323e4fa55b2fd2670261cf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=980da4aed28eca5770323e4fa55b2fd2670261cf Author: Michal Krol Date: Fri Mar 19 09:08:33 2010 +0100 gallium/docs: Clarify sampler view descriptions. --- src/gallium/docs/source/context.rst | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index e7a6932..2b09410 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -74,11 +74,11 @@ is being cast to another format. Casting can be done only between compatible formats, that is formats that have matching component order and sizes. Swizzle fields specify they way in which fetched texel components are placed -in the result register. For example, swizzle_r specifies what is going to be -placed in destination register x (AKA r). +in the result register. For example, ``swizzle_r`` specifies what is going to be +placed in first component of result register. -first_level and last_level fields of sampler view template specify the LOD -range the texture is going to be constrained to. +The ``first_level`` and ``last_level`` fields of sampler view template specify +the LOD range the texture is going to be constrained to. * ``set_fragment_sampler_views`` binds an array of sampler views to fragment shader stage. Every binding point acquires a reference @@ -89,7 +89,7 @@ range the texture is going to be constrained to. shader stage. Every binding point acquires a reference to a respective sampler view and releases a reference to the previous sampler view. -* ``create_sampler_view`` creates a new sampler view. texture is associated +* ``create_sampler_view`` creates a new sampler view. ``texture`` is associated with the sampler view which results in sampler view holding a reference to the texture. Format specified in template must be compatible with texture format. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: Invalidate sampler view when texture object changes .
Module: Mesa Branch: master Commit: 40c3861e1e98116c573027b054a6a05208c53b6a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=40c3861e1e98116c573027b054a6a05208c53b6a Author: Michal Krol Date: Tue Mar 16 19:39:09 2010 +0100 st/mesa: Invalidate sampler view when texture object changes. --- src/mesa/state_tracker/st_cb_texture.c |3 +++ src/mesa/state_tracker/st_gen_mipmap.c |1 + 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 6ed1c60..3ef030f 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -571,6 +571,7 @@ st_TexImage(GLcontext * ctx, DBG("release it\n"); pipe_texture_reference(&stObj->pt, NULL); assert(!stObj->pt); + pipe_sampler_view_reference(&stObj->sampler_view, NULL); stObj->teximage_realloc = FALSE; } } @@ -1807,6 +1808,7 @@ st_finalize_texture(GLcontext *ctx, firstImage->pt != stObj->pt && firstImage->pt->last_level >= stObj->lastLevel) { pipe_texture_reference(&stObj->pt, firstImage->pt); + pipe_sampler_view_reference(&stObj->sampler_view, NULL); } /* bytes per pixel block (blocks are usually 1x1) */ @@ -1826,6 +1828,7 @@ st_finalize_texture(GLcontext *ctx, stObj->pt->depth0 != firstImage->base.Depth2) { pipe_texture_reference(&stObj->pt, NULL); + pipe_sampler_view_reference(&stObj->sampler_view, NULL); ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER; } } diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 97f6903..030b0a0 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -256,6 +256,7 @@ st_generate_mipmap(GLcontext *ctx, GLenum target, /* release the old tex (will likely be freed too) */ pipe_texture_reference(&oldTex, NULL); + pipe_sampler_view_reference(&stObj->sampler_view, NULL); pt = stObj->pt; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): 51 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f55a95178069d5e8b18647e6b675fc403d68073 Author: Roland Scheidegger Date: Mon Mar 15 21:55:08 2010 +0100 gallium: change remaining util functions to use cso sampler views changes arguments of util_blit_pixels_tex and util_gen_mipmap to struct pipe_sampler_view * instead of struct pipe_texture *. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4b8a307b25146202b1fb64339b307bde5ec3b30 Author: Michal Krol Date: Tue Mar 16 10:58:33 2010 +0100 gallium/docs: Create a separate section for Sampler Views. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8cdfd1219a2d13d252a8691ee6dddb0d773bdc77 Merge: 6420aca08ba6910dce22ab9f813cc57d611b0aa8 e0ce4a4a0994211ead8e5a77cccdd2a084e8a288 Author: Keith Whitwell Date: Tue Mar 16 09:02:38 2010 + Merge commit 'origin/master' into gallium-sampler-view This branch already seems to have the nv50_tex.c fix. Conflicts: src/gallium/drivers/nv50/nv50_tex.c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6420aca08ba6910dce22ab9f813cc57d611b0aa8 Author: Keith Whitwell Date: Mon Mar 15 17:56:19 2010 +0100 cso: Do not hold references to bound textures. Sampler views already hold references to those. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3949388ca34c4578455be6db65d140c8e8f2184a Author: Michal Krol Date: Mon Mar 15 15:04:12 2010 +0100 st/mesa: Fix a call to st_get_stobj_sampler_view(). URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b60820fde8596966b1ffdb5d008e94773b2f321 Author: Michal Krol Date: Mon Mar 15 15:03:44 2010 +0100 st/mesa: Pass in correct sampler view object to blitter. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=df65fc8100f267b3167012d4f8502cf9eed526df Author: Michal Krol Date: Mon Mar 15 14:42:44 2010 +0100 util: Fix nil pointer reference. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2bc089d148253d7a411e94257633ce40ec1c6a9 Author: Michal Krol Date: Mon Mar 15 13:20:37 2010 +0100 gallium: util_blit_pixels() takes source sampler view as argument. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbf20a1f0fa7965254aa8a0e2ea35a6b8576fd7d Author: Michal Krol Date: Mon Mar 15 13:18:30 2010 +0100 st/mesa: Cache FBO texture's sampler view object. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=08189e639195ecb619ed37250b6dbb63017584b8 Author: Keith Whitwell Date: Mon Mar 15 10:27:25 2010 + nvfx: fix up after merge URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=506130fff5685742d280bde8800be036c8e8ebfa Author: Keith Whitwell Date: Mon Mar 15 10:24:55 2010 + r300g: fix up after merge URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=42910ebe7b9748c0ecb6a597bae3e7d43c7e170f Merge: 47bfbd452c93e6a8db013fb90d9f42210cf24889 68e58a96e80865878e6881dc4d34fcc3ec24eb19 Author: Keith Whitwell Date: Mon Mar 15 09:44:52 2010 + Merge commit 'origin/master' into gallium-sampler-view Conflicts: src/gallium/drivers/nv30/nv30_context.h src/gallium/drivers/nv30/nv30_state.c src/gallium/drivers/nv40/nv40_context.h src/gallium/drivers/nv40/nv40_state.c src/gallium/drivers/r300/r300_emit.c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=47bfbd452c93e6a8db013fb90d9f42210cf24889 Merge: faa14818856e1e9a4ee624c2bc04d7aecabd07ab a80e33f40731f07e8a39896bfdcd1b1504aedc1f Author: Keith Whitwell Date: Sat Mar 13 15:06:35 2010 + Merge commit 'origin/master' into gallium-sampler-view 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.c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=faa14818856e1e9a4ee624c2bc04d7aecabd07ab Author: Michal Krol Date: Fri Mar 12 14:43:11 2010 +0100 cso: Remove set/save/restore_vertex_sampler_textures(). URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8030c6561e019e079b5be2fe64ec804df4bfa03 Author: Michal Krol Date: Fri Mar 12 14:37:36 2010 +0100 st/mesa: Associate a sampler view with an st texture object. Lazily create a sampler view when the texture is being bound for the first time. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=08f89988c8738029c60e89c61c9da0522bd53087 Author: Michal Krol Date: Fri Mar 12 14:36:23 2010 +0100 cso: Add entry points for vertex/fragment sampler views. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a671a9eed08e63e97ec4257adea2c09dd7d2b4e2 Author: Christoph Bumi
Mesa (gallium-sampler-view): gallium: change remaining util functions to use cso sampler views
Module: Mesa Branch: gallium-sampler-view Commit: 8f55a95178069d5e8b18647e6b675fc403d68073 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f55a95178069d5e8b18647e6b675fc403d68073 Author: Roland Scheidegger Date: Mon Mar 15 21:55:08 2010 +0100 gallium: change remaining util functions to use cso sampler views changes arguments of util_blit_pixels_tex and util_gen_mipmap to struct pipe_sampler_view * instead of struct pipe_texture *. --- src/gallium/auxiliary/util/u_blit.c | 22 -- src/gallium/auxiliary/util/u_blit.h |2 +- src/gallium/auxiliary/util/u_gen_mipmap.c | 13 +++-- src/gallium/auxiliary/util/u_gen_mipmap.h |2 +- src/mesa/state_tracker/st_cb_texture.c| 18 +++--- src/mesa/state_tracker/st_gen_mipmap.c| 11 ++- 6 files changed, 42 insertions(+), 26 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 4d9168f..cd95f85 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -555,21 +555,23 @@ void util_blit_flush( struct blit_state *ctx ) */ void util_blit_pixels_tex(struct blit_state *ctx, - struct pipe_texture *tex, - int srcX0, int srcY0, - int srcX1, int srcY1, - struct pipe_surface *dst, - int dstX0, int dstY0, - int dstX1, int dstY1, - float z, uint filter) + struct pipe_sampler_view *src_sampler_view, + int srcX0, int srcY0, + int srcX1, int srcY1, + struct pipe_surface *dst, + int dstX0, int dstY0, + int dstX1, int dstY1, + float z, uint filter) { struct pipe_framebuffer_state fb; float s0, t0, s1, t1; unsigned offset; + struct pipe_texture *tex = src_sampler_view->texture; assert(filter == PIPE_TEX_MIPFILTER_NEAREST || filter == PIPE_TEX_MIPFILTER_LINEAR); + assert(tex); assert(tex->width0 != 0); assert(tex->height0 != 0); @@ -588,7 +590,7 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_save_depth_stencil_alpha(ctx->cso); cso_save_rasterizer(ctx->cso); cso_save_samplers(ctx->cso); - cso_save_sampler_textures(ctx->cso); + cso_save_fragment_sampler_views(ctx->cso); cso_save_framebuffer(ctx->cso); cso_save_fragment_shader(ctx->cso); cso_save_vertex_shader(ctx->cso); @@ -620,7 +622,7 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_set_viewport(ctx->cso, &ctx->viewport); /* texture */ - cso_set_sampler_textures(ctx->cso, 1, &tex); + cso_set_fragment_sampler_views(ctx->cso, 1, &src_sampler_view); /* shaders */ cso_set_fragment_shader_handle(ctx->cso, ctx->fs[TGSI_WRITEMASK_XYZW]); @@ -654,7 +656,7 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_restore_depth_stencil_alpha(ctx->cso); cso_restore_rasterizer(ctx->cso); cso_restore_samplers(ctx->cso); - cso_restore_sampler_textures(ctx->cso); + cso_restore_fragment_sampler_views(ctx->cso); cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); cso_restore_vertex_shader(ctx->cso); diff --git a/src/gallium/auxiliary/util/u_blit.h b/src/gallium/auxiliary/util/u_blit.h index 2d8cdd2..1ebe65b 100644 --- a/src/gallium/auxiliary/util/u_blit.h +++ b/src/gallium/auxiliary/util/u_blit.h @@ -75,7 +75,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, extern void util_blit_pixels_tex(struct blit_state *ctx, - struct pipe_texture *tex, + struct pipe_sampler_view *src_sampler_view, int srcX0, int srcY0, int srcX1, int srcY1, struct pipe_surface *dst, diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 5c51b53..61d64cf 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1460,7 +1460,7 @@ void util_gen_mipmap_flush( struct gen_mipmap_state *ctx ) * Generate mipmap images. It's assumed all needed texture memory is * already allocated. * - * \param pt the texture to generate mipmap levels for + * \param psv the sampler view to the texture to generate mipmap levels for * \param face which cube face to generate mipmaps for (0 for non-cube maps) * \param baseLevel the first mipmap level to use as a src * \param lastLevel the last mipmap level to generate @@ -1469,12 +1469,13 @@ void util_gen_mipmap_flush( struct gen_mipmap_state *ctx ) */ void util_gen_mipmap(struct gen_mipmap_state *ctx, -struct pipe_texture *pt, +struct pipe_sampler_view *psv, uint face, uint baseLevel, uint lastLevel, uint filter) { struct pipe_context *pipe = ctx->pipe; struct pipe_screen *screen = pipe
Mesa (gallium-sampler-view): gallium/docs: Create a separate section for Sampler Views.
Module: Mesa Branch: gallium-sampler-view Commit: e4b8a307b25146202b1fb64339b307bde5ec3b30 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4b8a307b25146202b1fb64339b307bde5ec3b30 Author: Michal Krol Date: Tue Mar 16 10:58:33 2010 +0100 gallium/docs: Create a separate section for Sampler Views. --- src/gallium/docs/source/context.rst | 52 +++--- 1 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index ef3e463..1f02257 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -41,23 +41,6 @@ buffers, surfaces) are bound to the driver. * ``set_framebuffer_state`` -* ``set_fragment_sampler_views`` binds an array of sampler views to - fragment shader stage. Every binding point acquires a reference - to a respective sampler view and releases a reference to the previous - sampler view. - -* ``set_vertex_sampler_views`` binds an array of sampler views to vertex - shader stage. Every binding point acquires a reference to a respective - sampler view and releases a reference to the previous sampler view. - -* ``create_sampler_view`` creates a new sampler view. texture is associated - with the sampler view which results in sampler view holding a reference - to the texture. Format specified in template must be compatible - with texture format. - -* ``sampler_view_destroy`` destroys a sampler view and releases its reference - to associated texture. - * ``set_vertex_buffers`` @@ -79,6 +62,41 @@ objects. They all follow simple, one-method binding calls, e.g. * ``set_viewport_state`` +Sampler Views +^ + +These are the means to bind textures to shader stages. To create one, specify +its format, swizzle and LOD range in sampler view template. + +If texture format is different than template format, it is said the texture +is being cast to another format. Casting can be done only between compatible +formats, that is formats that have matching component order and sizes. + +Swizzle fields specify they way in which fetched texel components are placed +in the result register. For example, swizzle_r specifies what is going to be +placed in destination register x (AKA r). + +first_level and last_level fields of sampler view template specify the LOD +range the texture is going to be constrained to. + +* ``set_fragment_sampler_views`` binds an array of sampler views to + fragment shader stage. Every binding point acquires a reference + to a respective sampler view and releases a reference to the previous + sampler view. + +* ``set_vertex_sampler_views`` binds an array of sampler views to vertex + shader stage. Every binding point acquires a reference to a respective + sampler view and releases a reference to the previous sampler view. + +* ``create_sampler_view`` creates a new sampler view. texture is associated + with the sampler view which results in sampler view holding a reference + to the texture. Format specified in template must be compatible + with texture format. + +* ``sampler_view_destroy`` destroys a sampler view and releases its reference + to associated texture. + + Clearing ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): cso: Do not hold references to bound textures.
Module: Mesa Branch: gallium-sampler-view Commit: 6420aca08ba6910dce22ab9f813cc57d611b0aa8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6420aca08ba6910dce22ab9f813cc57d611b0aa8 Author: Keith Whitwell Date: Mon Mar 15 17:56:19 2010 +0100 cso: Do not hold references to bound textures. Sampler views already hold references to those. --- src/gallium/auxiliary/cso_cache/cso_context.c | 30 ++-- 1 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 648ba10..4ed9e09 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -71,16 +71,12 @@ struct cso_context { unsigned nr_vertex_samplers_saved; void *vertex_samplers_saved[PIPE_MAX_VERTEX_SAMPLERS]; - struct pipe_texture *textures[PIPE_MAX_SAMPLERS]; uint nr_fragment_sampler_views; struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; - uint nr_textures; uint nr_vertex_sampler_views; struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; - uint nr_textures_saved; - struct pipe_texture *textures_saved[PIPE_MAX_SAMPLERS]; uint nr_fragment_sampler_views_saved; struct pipe_sampler_view *fragment_sampler_views_saved[PIPE_MAX_SAMPLERS]; @@ -299,8 +295,6 @@ void cso_release_all( struct cso_context *ctx ) } for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - pipe_texture_reference(&ctx->textures[i], NULL); - pipe_texture_reference(&ctx->textures_saved[i], NULL); pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL); pipe_sampler_view_reference(&ctx->fragment_sampler_views_saved[i], NULL); } @@ -630,7 +624,7 @@ enum pipe_error cso_set_sampler_textures( struct cso_context *ctx, { uint i; - ctx->nr_textures = count; + ctx->nr_fragment_sampler_views = count; for (i = 0; i < count; i++) { struct pipe_sampler_view templ, *view; @@ -638,15 +632,14 @@ enum pipe_error cso_set_sampler_textures( struct cso_context *ctx, u_sampler_view_default_template(&templ, textures[i], textures[i]->format); + view = ctx->pipe->create_sampler_view(ctx->pipe, textures[i], &templ); - pipe_texture_reference(&ctx->textures[i], textures[i]); pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], view); } for ( ; i < PIPE_MAX_SAMPLERS; i++) { - pipe_texture_reference(&ctx->textures[i], NULL); pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL); } @@ -661,12 +654,10 @@ void cso_save_sampler_textures( struct cso_context *ctx ) { uint i; - ctx->nr_textures_saved = ctx->nr_textures; - for (i = 0; i < ctx->nr_textures; i++) { - assert(!ctx->textures_saved[i]); + ctx->nr_fragment_sampler_views_saved = ctx->nr_fragment_sampler_views; + for (i = 0; i < ctx->nr_fragment_sampler_views; i++) { assert(!ctx->fragment_sampler_views_saved[i]); - pipe_texture_reference(&ctx->textures_saved[i], ctx->textures[i]); pipe_sampler_view_reference(&ctx->fragment_sampler_views_saved[i], ctx->fragment_sampler_views[i]); } @@ -676,27 +667,22 @@ void cso_restore_sampler_textures( struct cso_context *ctx ) { uint i; - ctx->nr_textures = ctx->nr_textures_saved; - - for (i = 0; i < ctx->nr_textures; i++) { - pipe_texture_reference(&ctx->textures[i], NULL); - ctx->textures[i] = ctx->textures_saved[i]; - ctx->textures_saved[i] = NULL; + ctx->nr_fragment_sampler_views = ctx->nr_fragment_sampler_views_saved; + for (i = 0; i < ctx->nr_fragment_sampler_views; i++) { pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL); ctx->fragment_sampler_views[i] = ctx->fragment_sampler_views_saved[i]; ctx->fragment_sampler_views_saved[i] = NULL; } for ( ; i < PIPE_MAX_SAMPLERS; i++) { - pipe_texture_reference(&ctx->textures[i], NULL); pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL); } ctx->pipe->set_fragment_sampler_views(ctx->pipe, - ctx->nr_textures, + ctx->nr_fragment_sampler_views, ctx->fragment_sampler_views); - ctx->nr_textures_saved = 0; + ctx->nr_fragment_sampler_views_saved = 0; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): st/mesa: Pass in correct sampler view object to blitter.
Module: Mesa Branch: gallium-sampler-view Commit: 6b60820fde8596966b1ffdb5d008e94773b2f321 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b60820fde8596966b1ffdb5d008e94773b2f321 Author: Michal Krol Date: Mon Mar 15 15:03:44 2010 +0100 st/mesa: Pass in correct sampler view object to blitter. --- src/mesa/state_tracker/st_cb_texture.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 7fcd1e9..0c518a7 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1598,7 +1598,7 @@ st_copy_texsubimage(GLcontext *ctx, } util_blit_pixels_writemask(ctx->st->blit, strb->surface, -st_get_stobj_sampler_view(stObj), +st_renderbuffer_get_sampler_view(strb, pipe), srcX, srcY0, srcX + width, srcY1, dest_surface, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): st/mesa: Fix a call to st_get_stobj_sampler_view().
Module: Mesa Branch: gallium-sampler-view Commit: 3949388ca34c4578455be6db65d140c8e8f2184a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3949388ca34c4578455be6db65d140c8e8f2184a Author: Michal Krol Date: Mon Mar 15 15:04:12 2010 +0100 st/mesa: Fix a call to st_get_stobj_sampler_view(). --- src/mesa/state_tracker/st_cb_blit.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index abf0ac0..06b0a18 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -133,7 +133,7 @@ st_BlitFramebuffer(GLcontext *ctx, return; util_blit_pixels(st->blit, - srcSurf, st_get_stobj_sampler_view(srcObj, pipe), + srcSurf, st_get_stobj_sampler_view(srcObj), srcX0, srcY0, srcX1, srcY1, dstSurf, dstX0, dstY0, dstX1, dstY1, 0.0, pFilter); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): util: Fix nil pointer reference.
Module: Mesa Branch: gallium-sampler-view Commit: df65fc8100f267b3167012d4f8502cf9eed526df URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=df65fc8100f267b3167012d4f8502cf9eed526df Author: Michal Krol Date: Mon Mar 15 14:42:44 2010 +0100 util: Fix nil pointer reference. --- src/gallium/auxiliary/util/u_blit.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 803086b..4d9168f 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -292,7 +292,6 @@ util_blit_pixels_writemask(struct blit_state *ctx, { struct pipe_context *pipe = ctx->pipe; struct pipe_screen *screen = pipe->screen; - struct pipe_texture *tex = NULL; struct pipe_sampler_view *sampler_view = NULL; struct pipe_framebuffer_state fb; const int srcW = abs(srcX1 - srcX0); @@ -348,6 +347,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, src->texture->last_level != 0) { struct pipe_texture texTemp; + struct pipe_texture *tex; struct pipe_sampler_view sv_templ; struct pipe_surface *texSurf; const int srcLeft = MIN2(srcX0, srcX1); @@ -416,10 +416,10 @@ util_blit_pixels_writemask(struct blit_state *ctx, } else { pipe_sampler_view_reference(&sampler_view, src_sampler_view); - s0 = srcX0 / (float)tex->width0; - s1 = srcX1 / (float)tex->width0; - t0 = srcY0 / (float)tex->height0; - t1 = srcY1 / (float)tex->height0; + s0 = srcX0 / (float)src->texture->width0; + s1 = srcX1 / (float)src->texture->width0; + t0 = srcY0 / (float)src->texture->height0; + t1 = srcY1 / (float)src->texture->height0; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): st/mesa: Cache FBO texture' s sampler view object.
Module: Mesa Branch: gallium-sampler-view Commit: dbf20a1f0fa7965254aa8a0e2ea35a6b8576fd7d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbf20a1f0fa7965254aa8a0e2ea35a6b8576fd7d Author: Michal Krol Date: Mon Mar 15 13:18:30 2010 +0100 st/mesa: Cache FBO texture's sampler view object. --- src/mesa/state_tracker/st_cb_fbo.c | 15 +++ src/mesa/state_tracker/st_cb_fbo.h |6 ++ src/mesa/state_tracker/st_framebuffer.c |1 + src/mesa/state_tracker/st_texture.c |9 + 4 files changed, 31 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index abf0c8d..b219763 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -103,6 +103,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, */ pipe_surface_reference( &strb->surface, NULL ); pipe_texture_reference( &strb->texture, NULL ); + pipe_sampler_view_reference(&strb->sampler_view, NULL); /* Setup new texture template. */ @@ -162,6 +163,7 @@ st_renderbuffer_delete(struct gl_renderbuffer *rb) ASSERT(strb); pipe_surface_reference(&strb->surface, NULL); pipe_texture_reference(&strb->texture, NULL); + pipe_sampler_view_reference(&strb->sampler_view, NULL); free(strb->data); free(strb); } @@ -368,6 +370,8 @@ st_render_texture(GLcontext *ctx, pipe_surface_reference(&strb->surface, NULL); + pipe_sampler_view_reference(&strb->sampler_view, st_get_stobj_sampler_view(stObj)); + assert(strb->rtt_level <= strb->texture->last_level); /* new surface for rendering into the texture */ @@ -647,3 +651,14 @@ void st_init_fbo_functions(struct dd_function_table *functions) functions->DrawBuffers = st_DrawBuffers; functions->ReadBuffer = st_ReadBuffer; } + +struct pipe_sampler_view * +st_renderbuffer_get_sampler_view(struct st_renderbuffer *rb, + struct pipe_context *pipe) +{ + if (!rb->sampler_view) { + rb->sampler_view = st_sampler_view_from_texture(pipe, rb->texture); + } + + return rb->sampler_view; +} diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h index bea6eb8..7a45a60 100644 --- a/src/mesa/state_tracker/st_cb_fbo.h +++ b/src/mesa/state_tracker/st_cb_fbo.h @@ -39,6 +39,7 @@ struct st_renderbuffer struct gl_renderbuffer Base; struct pipe_texture *texture; struct pipe_surface *surface; /* temporary view into texture */ + struct pipe_sampler_view *sampler_view; enum pipe_format format; /** preferred format, or PIPE_FORMAT_NONE */ GLboolean defined;/**< defined contents? */ @@ -55,6 +56,7 @@ struct st_renderbuffer /** Render to texture state */ struct pipe_texture *texture_save; struct pipe_surface *surface_save; + struct pipe_sampler_view *sampler_view_save; }; @@ -71,5 +73,9 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw); extern void st_init_fbo_functions(struct dd_function_table *functions); +extern struct pipe_sampler_view * +st_renderbuffer_get_sampler_view(struct st_renderbuffer *rb, + struct pipe_context *pipe); + #endif /* ST_CB_FBO_H */ diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 0a91183..d3c43bb 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -197,6 +197,7 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb, /* replace the renderbuffer's surface/texture pointers */ pipe_surface_reference( &strb->surface, surf ); pipe_texture_reference( &strb->texture, surf->texture ); + pipe_sampler_view_reference(&strb->sampler_view, NULL); if (ctx) { /* If ctx isn't set, we've likely not made current yet. diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 10a38be..ef97d87 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -528,14 +528,21 @@ st_bind_teximage(struct st_framebuffer *stfb, uint surfIndex, /* save the renderbuffer's surface/texture info */ pipe_texture_reference(&strb->texture_save, strb->texture); pipe_surface_reference(&strb->surface_save, strb->surface); + pipe_sampler_view_reference(&strb->sampler_view_save, strb->sampler_view); /* plug in new surface/texture info */ pipe_texture_reference(&strb->texture, stImage->pt); + + /* XXX: Shouldn't we release reference to old surface here? +*/ + strb->surface = screen->get_tex_surface(screen, strb->texture, face, level, slice, (PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE)); + pipe_sampler_view_reference(&strb->sampler_view, NULL); +
Mesa (gallium-sampler-view): gallium: util_blit_pixels() takes source sampler view as argument.
Module: Mesa Branch: gallium-sampler-view Commit: f2bc089d148253d7a411e94257633ce40ec1c6a9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2bc089d148253d7a411e94257633ce40ec1c6a9 Author: Michal Krol Date: Mon Mar 15 13:20:37 2010 +0100 gallium: util_blit_pixels() takes source sampler view as argument. --- src/gallium/auxiliary/util/u_blit.c| 28 ++-- src/gallium/auxiliary/util/u_blit.h|2 ++ src/mesa/state_tracker/st_cb_blit.c| 15 ++- src/mesa/state_tracker/st_cb_texture.c |2 ++ 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 4d0737c..803086b 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -45,6 +45,7 @@ #include "util/u_format.h" #include "util/u_math.h" #include "util/u_memory.h" +#include "util/u_sampler.h" #include "util/u_simple_shaders.h" #include "util/u_surface.h" #include "util/u_rect.h" @@ -280,6 +281,7 @@ regions_overlap(int srcX0, int srcY0, void util_blit_pixels_writemask(struct blit_state *ctx, struct pipe_surface *src, + struct pipe_sampler_view *src_sampler_view, int srcX0, int srcY0, int srcX1, int srcY1, struct pipe_surface *dst, @@ -291,6 +293,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, struct pipe_context *pipe = ctx->pipe; struct pipe_screen *screen = pipe->screen; struct pipe_texture *tex = NULL; + struct pipe_sampler_view *sampler_view = NULL; struct pipe_framebuffer_state fb; const int srcW = abs(srcX1 - srcX0); const int srcH = abs(srcY1 - srcY0); @@ -345,6 +348,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, src->texture->last_level != 0) { struct pipe_texture texTemp; + struct pipe_sampler_view sv_templ; struct pipe_surface *texSurf; const int srcLeft = MIN2(srcX0, srcX1); const int srcTop = MIN2(srcY0, srcY1); @@ -376,6 +380,14 @@ util_blit_pixels_writemask(struct blit_state *ctx, if (!tex) return; + u_sampler_view_default_template(&sv_templ, tex, tex->format); + + sampler_view = ctx->pipe->create_sampler_view(ctx->pipe, tex, &sv_templ); + if (!sampler_view) { + pipe_texture_reference(&tex, NULL); + return; + } + texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE); @@ -399,22 +411,25 @@ util_blit_pixels_writemask(struct blit_state *ctx, s1 = 1.0f; t0 = 0.0f; t1 = 1.0f; + + pipe_texture_reference(&tex, NULL); } else { - pipe_texture_reference(&tex, src->texture); + pipe_sampler_view_reference(&sampler_view, src_sampler_view); s0 = srcX0 / (float)tex->width0; s1 = srcX1 / (float)tex->width0; t0 = srcY0 / (float)tex->height0; t1 = srcY1 / (float)tex->height0; } + /* save state (restored below) */ cso_save_blend(ctx->cso); cso_save_depth_stencil_alpha(ctx->cso); cso_save_rasterizer(ctx->cso); cso_save_samplers(ctx->cso); - cso_save_sampler_textures(ctx->cso); + cso_save_fragment_sampler_views(ctx->cso); cso_save_viewport(ctx->cso); cso_save_framebuffer(ctx->cso); cso_save_fragment_shader(ctx->cso); @@ -447,7 +462,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_set_viewport(ctx->cso, &ctx->viewport); /* texture */ - cso_set_sampler_textures(ctx->cso, 1, &tex); + cso_set_fragment_sampler_views(ctx->cso, 1, &sampler_view); if (ctx->fs[writemask] == NULL) ctx->fs[writemask] = @@ -486,7 +501,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_restore_depth_stencil_alpha(ctx->cso); cso_restore_rasterizer(ctx->cso); cso_restore_samplers(ctx->cso); - cso_restore_sampler_textures(ctx->cso); + cso_restore_fragment_sampler_views(ctx->cso); cso_restore_viewport(ctx->cso); cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); @@ -494,13 +509,14 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_restore_clip(ctx->cso); cso_restore_vertex_elements(ctx->cso); - pipe_texture_reference(&tex, NULL); + pipe_sampler_view_reference(&sampler_view, NULL); } void util_blit_pixels(struct blit_state *ctx, struct pipe_surface *src, + struct pipe_sampler_view *src_sampler_view, int srcX0, int srcY0, int srcX1, int srcY1, struct pipe_surface *dst, @@ -508,7 +524,7 @@ util_blit_pixels(struct blit_state *ctx, int dstX1, int dstY1, float z, uint filter ) { - util_blit_pixels_writemask( ctx, src, + util_blit_pixels_writemask( ctx, src, src_sampler_view,
Mesa (gallium-sampler-view): cso: Remove set/save/ restore_vertex_sampler_textures().
Module: Mesa Branch: gallium-sampler-view Commit: faa14818856e1e9a4ee624c2bc04d7aecabd07ab URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=faa14818856e1e9a4ee624c2bc04d7aecabd07ab Author: Michal Krol Date: Fri Mar 12 14:43:11 2010 +0100 cso: Remove set/save/restore_vertex_sampler_textures(). --- src/gallium/auxiliary/cso_cache/cso_context.c | 87 - src/gallium/auxiliary/cso_cache/cso_context.h | 11 --- 2 files changed, 0 insertions(+), 98 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 5c16e09..648ba10 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -76,18 +76,14 @@ struct cso_context { struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; uint nr_textures; - struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS]; uint nr_vertex_sampler_views; struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; - uint nr_vertex_textures; uint nr_textures_saved; struct pipe_texture *textures_saved[PIPE_MAX_SAMPLERS]; uint nr_fragment_sampler_views_saved; struct pipe_sampler_view *fragment_sampler_views_saved[PIPE_MAX_SAMPLERS]; - uint nr_vertex_textures_saved; - struct pipe_texture *vertex_textures_saved[PIPE_MAX_VERTEX_SAMPLERS]; uint nr_vertex_sampler_views_saved; struct pipe_sampler_view *vertex_sampler_views_saved[PIPE_MAX_VERTEX_SAMPLERS]; @@ -310,8 +306,6 @@ void cso_release_all( struct cso_context *ctx ) } for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { - pipe_texture_reference(&ctx->vertex_textures[i], NULL); - pipe_texture_reference(&ctx->vertex_textures_saved[i], NULL); pipe_sampler_view_reference(&ctx->vertex_sampler_views[i], NULL); pipe_sampler_view_reference(&ctx->vertex_sampler_views_saved[i], NULL); } @@ -706,87 +700,6 @@ void cso_restore_sampler_textures( struct cso_context *ctx ) } - -enum pipe_error -cso_set_vertex_sampler_textures(struct cso_context *ctx, -uint count, -struct pipe_texture **textures) -{ - uint i; - - ctx->nr_vertex_textures = count; - - for (i = 0; i < count; i++) { - struct pipe_sampler_view templ, *view; - - u_sampler_view_default_template(&templ, - textures[i], - textures[i]->format); - view = ctx->pipe->create_sampler_view(ctx->pipe, -textures[i], -&templ); - - pipe_texture_reference(&ctx->vertex_textures[i], textures[i]); - pipe_sampler_view_reference(&ctx->vertex_sampler_views[i], view); - } - for ( ; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { - pipe_texture_reference(&ctx->vertex_textures[i], NULL); - pipe_sampler_view_reference(&ctx->vertex_sampler_views[i], NULL); - } - - ctx->pipe->set_vertex_sampler_views(ctx->pipe, - count, - ctx->vertex_sampler_views); - - return PIPE_OK; -} - -void -cso_save_vertex_sampler_textures(struct cso_context *ctx) -{ - uint i; - - ctx->nr_vertex_textures_saved = ctx->nr_vertex_textures; - for (i = 0; i < ctx->nr_vertex_textures; i++) { - assert(!ctx->vertex_textures_saved[i]); - assert(!ctx->vertex_sampler_views_saved[i]); - - pipe_texture_reference(&ctx->vertex_textures_saved[i], ctx->vertex_textures[i]); - pipe_sampler_view_reference(&ctx->vertex_sampler_views_saved[i], - ctx->vertex_sampler_views[i]); - } -} - -void -cso_restore_vertex_sampler_textures(struct cso_context *ctx) -{ - uint i; - - ctx->nr_vertex_textures = ctx->nr_vertex_textures_saved; - - for (i = 0; i < ctx->nr_vertex_textures; i++) { - pipe_texture_reference(&ctx->vertex_textures[i], NULL); - ctx->vertex_textures[i] = ctx->vertex_textures_saved[i]; - ctx->vertex_textures_saved[i] = NULL; - - pipe_sampler_view_reference(&ctx->vertex_sampler_views[i], NULL); - ctx->vertex_sampler_views[i] = ctx->vertex_sampler_views_saved[i]; - ctx->vertex_sampler_views_saved[i] = NULL; - } - for ( ; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { - pipe_texture_reference(&ctx->vertex_textures[i], NULL); - pipe_sampler_view_reference(&ctx->vertex_sampler_views[i], NULL); - } - - ctx->pipe->set_vertex_sampler_views(ctx->pipe, - ctx->nr_vertex_textures, - ctx->vertex_sampler_views); - - ctx->nr_vertex_textures_saved = 0; -} - - - enum pipe_error cso_set_depth_stencil_alpha(struct cso_context *ctx, const struct pipe_depth_stencil_alpha_state *templ) { diff --git a/src/gallium/auxiliary/cso_cache/cso_
Mesa (gallium-sampler-view): cso: Add entry points for vertex/ fragment sampler views.
Module: Mesa Branch: gallium-sampler-view Commit: 08f89988c8738029c60e89c61c9da0522bd53087 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=08f89988c8738029c60e89c61c9da0522bd53087 Author: Michal Krol Date: Fri Mar 12 14:36:23 2010 +0100 cso: Add entry points for vertex/fragment sampler views. --- src/gallium/auxiliary/cso_cache/cso_context.c | 154 ++--- src/gallium/auxiliary/cso_cache/cso_context.h | 28 + 2 files changed, 167 insertions(+), 15 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 8568a00..5c16e09 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -37,6 +37,7 @@ #include "pipe/p_state.h" #include "util/u_inlines.h" +#include "util/u_math.h" #include "util/u_memory.h" #include "util/u_sampler.h" #include "tgsi/tgsi_parse.h" @@ -71,19 +72,23 @@ struct cso_context { void *vertex_samplers_saved[PIPE_MAX_VERTEX_SAMPLERS]; struct pipe_texture *textures[PIPE_MAX_SAMPLERS]; - struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS]; + uint nr_fragment_sampler_views; + struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; uint nr_textures; struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS]; + uint nr_vertex_sampler_views; struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; uint nr_vertex_textures; uint nr_textures_saved; struct pipe_texture *textures_saved[PIPE_MAX_SAMPLERS]; - struct pipe_sampler_view *sampler_views_saved[PIPE_MAX_SAMPLERS]; + uint nr_fragment_sampler_views_saved; + struct pipe_sampler_view *fragment_sampler_views_saved[PIPE_MAX_SAMPLERS]; uint nr_vertex_textures_saved; struct pipe_texture *vertex_textures_saved[PIPE_MAX_VERTEX_SAMPLERS]; + uint nr_vertex_sampler_views_saved; struct pipe_sampler_view *vertex_sampler_views_saved[PIPE_MAX_VERTEX_SAMPLERS]; /** Current and saved state. @@ -300,8 +305,8 @@ void cso_release_all( struct cso_context *ctx ) for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { pipe_texture_reference(&ctx->textures[i], NULL); pipe_texture_reference(&ctx->textures_saved[i], NULL); - pipe_sampler_view_reference(&ctx->sampler_views[i], NULL); - pipe_sampler_view_reference(&ctx->sampler_views_saved[i], NULL); + pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL); + pipe_sampler_view_reference(&ctx->fragment_sampler_views_saved[i], NULL); } for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { @@ -644,16 +649,16 @@ enum pipe_error cso_set_sampler_textures( struct cso_context *ctx, &templ); pipe_texture_reference(&ctx->textures[i], textures[i]); - pipe_sampler_view_reference(&ctx->sampler_views[i], view); + pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], view); } for ( ; i < PIPE_MAX_SAMPLERS; i++) { pipe_texture_reference(&ctx->textures[i], NULL); - pipe_sampler_view_reference(&ctx->sampler_views[i], NULL); + pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL); } ctx->pipe->set_fragment_sampler_views(ctx->pipe, count, - ctx->sampler_views); + ctx->fragment_sampler_views); return PIPE_OK; } @@ -665,11 +670,11 @@ void cso_save_sampler_textures( struct cso_context *ctx ) ctx->nr_textures_saved = ctx->nr_textures; for (i = 0; i < ctx->nr_textures; i++) { assert(!ctx->textures_saved[i]); - assert(!ctx->sampler_views_saved[i]); + assert(!ctx->fragment_sampler_views_saved[i]); pipe_texture_reference(&ctx->textures_saved[i], ctx->textures[i]); - pipe_sampler_view_reference(&ctx->sampler_views_saved[i], - ctx->sampler_views[i]); + pipe_sampler_view_reference(&ctx->fragment_sampler_views_saved[i], + ctx->fragment_sampler_views[i]); } } @@ -684,18 +689,18 @@ void cso_restore_sampler_textures( struct cso_context *ctx ) ctx->textures[i] = ctx->textures_saved[i]; ctx->textures_saved[i] = NULL; - pipe_sampler_view_reference(&ctx->sampler_views[i], NULL); - ctx->sampler_views[i] = ctx->sampler_views_saved[i]; - ctx->sampler_views_saved[i] = NULL; + pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL); + ctx->fragment_sampler_views[i] = ctx->fragment_sampler_views_saved[i]; + ctx->fragment_sampler_views_saved[i] = NULL; } for ( ; i < PIPE_MAX_SAMPLERS; i++) { pipe_texture_reference(&ctx->textures[i], NULL); - pipe_sampler_view_reference(&ctx->sampler_views[i], NULL); + pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL); } ctx->pipe->set_fragment_
Mesa (gallium-sampler-view): st/mesa: Associate a sampler view with an st texture object.
Module: Mesa Branch: gallium-sampler-view Commit: b8030c6561e019e079b5be2fe64ec804df4bfa03 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8030c6561e019e079b5be2fe64ec804df4bfa03 Author: Michal Krol Date: Fri Mar 12 14:37:36 2010 +0100 st/mesa: Associate a sampler view with an st texture object. Lazily create a sampler view when the texture is being bound for the first time. --- src/mesa/state_tracker/st_atom_pixeltransfer.c |2 + src/mesa/state_tracker/st_atom_texture.c | 20 +- src/mesa/state_tracker/st_cb_bitmap.c | 48 +++ src/mesa/state_tracker/st_cb_drawpixels.c | 46 ++ src/mesa/state_tracker/st_cb_texture.c |4 ++ src/mesa/state_tracker/st_context.c|4 +- src/mesa/state_tracker/st_context.h|3 +- src/mesa/state_tracker/st_texture.h| 39 +++ 8 files changed, 119 insertions(+), 47 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index 0b2e3f5..e766b3a 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -257,6 +257,8 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key) /* create the colormap/texture now if not already done */ if (!st->pixel_xfer.pixelmap_texture) { st->pixel_xfer.pixelmap_texture = create_color_map_texture(ctx); + st->pixel_xfer.pixelmap_sampler_view = st_sampler_view_from_texture(ctx->st->pipe, + st->pixel_xfer.pixelmap_texture); } /* with a little effort, we can do four pixel map look-ups with diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 57b71c1..241c001 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -56,7 +56,7 @@ update_textures(struct st_context *st) /* loop over sampler units (aka tex image units) */ for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) { - struct pipe_texture *pt = NULL; + struct pipe_sampler_view *sampler_view = NULL; if (samplersUsed & (1 << su)) { struct gl_texture_object *texObj; @@ -84,7 +84,7 @@ update_textures(struct st_context *st) st->state.num_textures = su + 1; - pt = st_get_stobj_texture(stObj); + sampler_view = st_get_stobj_sampler_view(stObj); } /* @@ -96,17 +96,17 @@ update_textures(struct st_context *st) } */ - pipe_texture_reference(&st->state.sampler_texture[su], pt); + pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view); } - cso_set_sampler_textures(st->cso_context, -st->state.num_textures, -st->state.sampler_texture); + cso_set_fragment_sampler_views(st->cso_context, + st->state.num_textures, + st->state.sampler_views); if (st->ctx->Const.MaxVertexTextureImageUnits > 0) { - cso_set_vertex_sampler_textures(st->cso_context, - MIN2(st->state.num_textures, - st->ctx->Const.MaxVertexTextureImageUnits), - st->state.sampler_texture); + cso_set_vertex_sampler_views(st->cso_context, + MIN2(st->state.num_textures, + st->ctx->Const.MaxVertexTextureImageUnits), + st->state.sampler_views); } } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index f326601..25d33b9 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -398,7 +398,7 @@ setup_bitmap_vertex_data(struct st_context *st, static void draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, GLsizei width, GLsizei height, - struct pipe_texture *pt, + struct pipe_sampler_view *sv, const GLfloat *color) { struct st_context *st = ctx->st; @@ -436,7 +436,7 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, cso_save_rasterizer(cso); cso_save_samplers(cso); - cso_save_sampler_textures(cso); + cso_save_fragment_sampler_views(cso); cso_save_viewport(cso); cso_save_fragment_shader(cso); cso_save_vertex_shader(cso); @@ -466,11 +466,11 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, /* user textures, plus the bitmap texture */ { - struct pipe_texture *textures[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS]; uint num = MAX2(stfp->bitmap_sampler + 1, st->sta
Mesa (gallium-sampler-view): gallium: Check for OOM condition when creating a sampler view.
Module: Mesa Branch: gallium-sampler-view Commit: 530b9910c2fd25344e6d28b6d9aa0eaad31618e7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=530b9910c2fd25344e6d28b6d9aa0eaad31618e7 Author: Michal Krol Date: Thu Mar 11 15:30:21 2010 +0100 gallium: Check for OOM condition when creating a sampler view. --- src/gallium/drivers/cell/ppu/cell_pipe_state.c | 12 +++- src/gallium/drivers/i915/i915_state.c | 12 +++- src/gallium/drivers/i965/brw_pipe_sampler.c | 12 +++- src/gallium/drivers/llvmpipe/lp_state_sampler.c | 12 +++- src/gallium/drivers/nv30/nv30_state.c | 12 +++- src/gallium/drivers/nv40/nv40_state.c | 12 +++- src/gallium/drivers/r300/r300_state.c | 12 +++- src/gallium/drivers/softpipe/sp_state_sampler.c | 12 +++- src/gallium/drivers/svga/svga_pipe_sampler.c| 12 +++- 9 files changed, 63 insertions(+), 45 deletions(-) diff --git a/src/gallium/drivers/cell/ppu/cell_pipe_state.c b/src/gallium/drivers/cell/ppu/cell_pipe_state.c index 2fc8293..059ce85 100644 --- a/src/gallium/drivers/cell/ppu/cell_pipe_state.c +++ b/src/gallium/drivers/cell/ppu/cell_pipe_state.c @@ -298,11 +298,13 @@ cell_create_sampler_view(struct pipe_context *pipe, { struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); - *view = *templ; - view->reference.count = 1; - view->texture = NULL; - pipe_texture_reference(&view->texture, texture); - view->context = pipe; + if (view) { + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + } return view; } diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 884abe6..e549977 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -598,11 +598,13 @@ i915_create_sampler_view(struct pipe_context *pipe, { struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); - *view = *templ; - view->reference.count = 1; - view->texture = NULL; - pipe_texture_reference(&view->texture, texture); - view->context = pipe; + if (view) { + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + } return view; } diff --git a/src/gallium/drivers/i965/brw_pipe_sampler.c b/src/gallium/drivers/i965/brw_pipe_sampler.c index fbc3a07..d2aa2bc 100644 --- a/src/gallium/drivers/i965/brw_pipe_sampler.c +++ b/src/gallium/drivers/i965/brw_pipe_sampler.c @@ -219,11 +219,13 @@ brw_create_sampler_view(struct pipe_context *pipe, { struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); - *view = *templ; - view->reference.count = 1; - view->texture = NULL; - pipe_texture_reference(&view->texture, texture); - view->context = pipe; + if (view) { + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + } return view; } diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 2df86a0..2645441 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -170,11 +170,13 @@ llvmpipe_create_sampler_view(struct pipe_context *pipe, { struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); - *view = *templ; - view->reference.count = 1; - view->texture = NULL; - pipe_texture_reference(&view->texture, texture); - view->context = pipe; + if (view) { + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + } return view; } diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c index 321575d..fb3075f 100644 --- a/src/gallium/drivers/nv30/nv30_state.c +++ b/src/gallium/drivers/nv30/nv30_state.c @@ -304,11 +304,13 @@ nv30_create_sampler_view(struct pipe_context *pipe, { struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); - *view = *templ; - view->reference.count = 1; - view->texture = NULL; - pipe_texture_reference(&view->texture, texture); - view->context = pipe; + if (view) { + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + } return view; } diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c index 120dc42..28a48a6 100644 --- a/src/gallium/drivers/nv40/nv40_state.c
Mesa (gallium-sampler-view): gallium: Use last_level for pipe_sampler_view instead of num_levels.
Module: Mesa Branch: gallium-sampler-view Commit: 252dc5f897f9d124459e3afebf6686d1fe271511 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=252dc5f897f9d124459e3afebf6686d1fe271511 Author: Michal Krol Date: Thu Mar 11 15:25:52 2010 +0100 gallium: Use last_level for pipe_sampler_view instead of num_levels. It's more consistent with the rest of the interfaces. --- src/gallium/auxiliary/util/u_sampler.c |2 +- src/gallium/drivers/nv50/nv50_tex.c|2 +- src/gallium/include/pipe/p_state.h |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/util/u_sampler.c b/src/gallium/auxiliary/util/u_sampler.c index 08cf1fc..4d8f861 100644 --- a/src/gallium/auxiliary/util/u_sampler.c +++ b/src/gallium/auxiliary/util/u_sampler.c @@ -41,7 +41,7 @@ default_template(struct pipe_sampler_view *view, view->format = format; view->first_level = 0; - view->num_levels = texture->last_level + 1; + view->last_level = texture->last_level; view->swizzle_r = PIPE_SWIZZLE_RED; view->swizzle_g = PIPE_SWIZZLE_GREEN; view->swizzle_b = PIPE_SWIZZLE_BLUE; diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index c5029ba..7ed73ea 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -152,7 +152,7 @@ nv50_tex_construct(struct nv50_sampler_view *view) tic[6] = 0x0300; - tic[7] = (view->pipe.num_levels - view->pipe.first_level - 1) << 4; + tic[7] = (view->pipe.last_level - view->pipe.first_level) << 4; tic[7] |= view->pipe.first_level; return TRUE; diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 3c7c0a5..1107240 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -309,7 +309,7 @@ struct pipe_sampler_view struct pipe_texture *texture; /**< texture into which this is a view */ struct pipe_context *context; /**< context this view belongs to */ unsigned first_level:8; /**< first mipmap level */ - unsigned num_levels:8;/**< number of mipamp levels */ + unsigned last_level:8;/**< last mipmap level */ unsigned swizzle_r:3; /**< PIPE_SWIZZLE_x for red component */ unsigned swizzle_g:3; /**< PIPE_SWIZZLE_x for green component */ unsigned swizzle_b:3; /**< PIPE_SWIZZLE_x for blue component */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): progs: Add arbocclude2 demo.
Module: Mesa Branch: master Commit: 2b15f4fc6840b4bb5ca81d3ed0137c31f63725e8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b15f4fc6840b4bb5ca81d3ed0137c31f63725e8 Author: Michal Krol Date: Fri Mar 5 18:42:42 2010 +0100 progs: Add arbocclude2 demo. --- progs/demos/SConscript|1 + progs/demos/arbocclude2.c | 314 + 2 files changed, 315 insertions(+), 0 deletions(-) diff --git a/progs/demos/SConscript b/progs/demos/SConscript index 067c162..20ec6a0 100644 --- a/progs/demos/SConscript +++ b/progs/demos/SConscript @@ -4,6 +4,7 @@ progs = [ 'arbfplight', 'arbfslight', 'arbocclude', +'arbocclude2', 'bounce', 'clearspd', 'copypix', diff --git a/progs/demos/arbocclude2.c b/progs/demos/arbocclude2.c new file mode 100644 index 000..195a238 --- /dev/null +++ b/progs/demos/arbocclude2.c @@ -0,0 +1,314 @@ +/* + * GL_ARB_occlusion_query demo + * + * Brian Paul + * 12 June 2003 + * + * Copyright (C) 2003 Brian Paul 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, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include + +static GLboolean Anim = GL_TRUE; +static GLfloat Xpos = 0; +static GLuint OccQuery1; +static GLuint OccQuery2; +static GLint Win = 0; + + +static void +PrintString(const char *s) +{ + while (*s) { + glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); + s++; + } +} + + + +static void Idle(void) +{ + static int lastTime = 0; + static int sign = +1; + int time = glutGet(GLUT_ELAPSED_TIME); + float step; + + if (lastTime == 0) + lastTime = time; + else if (time - lastTime < 20) /* 50Hz update */ + return; + + step = (time - lastTime) / 1000.0 * sign; + lastTime = time; + + Xpos += step; + + if (Xpos > 2.5) { + Xpos = 2.5; + sign = -1; + } + else if (Xpos < -2.5) { + Xpos = -2.5; + sign = +1; + } + glutPostRedisplay(); +} + + +static void Display( void ) +{ + GLuint passed1, passed2; + GLint ready; + char s[100]; + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -15.0 ); + + /* draw the occluding polygons */ + glColor3f(0, 0.6, 0.8); + glBegin(GL_QUADS); + glVertex2f(-1.6, -1.5); + glVertex2f(-0.4, -1.5); + glVertex2f(-0.4, 1.5); + glVertex2f(-1.6, 1.5); + + glVertex2f( 0.4, -1.5); + glVertex2f( 1.6, -1.5); + glVertex2f( 1.6, 1.5); + glVertex2f( 0.4, 1.5); + glEnd(); + +#if defined(GL_ARB_occlusion_query) + glColorMask(0, 0, 0, 0); + glDepthMask(GL_FALSE); + + /* draw the first polygon with occlusion testing */ + glPushMatrix(); + glTranslatef(Xpos, 0.4, -0.5); + glScalef(0.3, 0.3, 1.0); + glRotatef(-90.0 * Xpos, 0, 0, 1); + + glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery1); + + glBegin(GL_POLYGON); + glVertex3f(-1, -1, 0); + glVertex3f( 1, -1, 0); + glVertex3f( 1, 1, 0); + glVertex3f(-1, 1, 0); + glEnd(); + + glEndQueryARB(GL_SAMPLES_PASSED_ARB); + + /* draw the second polygon with occlusion testing */ + glPopMatrix(); + glPushMatrix(); + glTranslatef(Xpos, -0.4, -0.5); + glScalef(0.3, 0.3, 1.0); + + glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery2); + + glBegin(GL_POLYGON); + glVertex3f(-1, -1, 0); + glVertex3f( 1, -1, 0); + glVertex3f( 1, 1, 0); + glVertex3f(-1, 1, 0); + glEnd(); + + glEndQueryARB(GL_SAMPLES_PASSED_ARB); + + /* turn off occlusion testing */ + glColorMask(1, 1, 1, 1); + glDepthMask(GL_TRUE); + + do { + /* do useful work here, if any */ + glGetQueryObjectivARB(OccQuery1, GL_QUERY_RESULT_AVAILABLE_ARB, &ready); + } while (!ready); + glGetQueryObjectuivARB(OccQuery1, GL_QUERY_RESULT_ARB, &passed1); + + do { + /* do useful work here, if
Mesa (gallium-tgsi-semantic-cleanup): gallium: Remove TGSI_SEMANTIC_NORMAL.
Module: Mesa Branch: gallium-tgsi-semantic-cleanup Commit: 7230cb625c688aac7f43817bf83be542f99abd13 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7230cb625c688aac7f43817bf83be542f99abd13 Author: Michal Krol Date: Wed Mar 3 10:29:31 2010 +0100 gallium: Remove TGSI_SEMANTIC_NORMAL. Use TGSI_SEMANTIC_GENERIC for this kind of stuff. --- src/gallium/auxiliary/tgsi/tgsi_dump.c |2 +- src/gallium/auxiliary/tgsi/tgsi_text.c |2 +- src/gallium/docs/source/tgsi.rst |6 -- src/gallium/drivers/svga/svga_tgsi_decl_sm30.c |4 src/gallium/include/pipe/p_shader_tokens.h |2 +- 5 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 5703141..b6df249 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -120,7 +120,7 @@ static const char *semantic_names[] = "FOG", "PSIZE", "GENERIC", - "NORMAL", + "", "FACE", "EDGEFLAG", "PRIM_ID", diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index f918151..356eee0 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -933,7 +933,7 @@ static const char *semantic_names[TGSI_SEMANTIC_COUNT] = "FOG", "PSIZE", "GENERIC", - "NORMAL", + "", "FACE", "EDGEFLAG", "PRIM_ID", diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index c292cd3..d5e0220 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1397,12 +1397,6 @@ These attributes are called "generic" because they may be used for anything else, including parameters, texture generation information, or anything that can be stored inside a four-component vector. -TGSI_SEMANTIC_NORMAL - - -Vertex normal; could be used to implement per-pixel lighting for legacy APIs -that allow mixing fixed-function and programmable stages. - TGSI_SEMANTIC_FACE "" diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c index 73102a7..05d9102 100644 --- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c +++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c @@ -61,10 +61,6 @@ static boolean translate_vs_ps_semantic( struct tgsi_declaration_semantic semant *idx = semantic.Index + 1; /* texcoord[0] is reserved for fog */ *usage = SVGA3D_DECLUSAGE_TEXCOORD; break; - case TGSI_SEMANTIC_NORMAL: - *idx = semantic.Index; - *usage = SVGA3D_DECLUSAGE_NORMAL; - break; default: assert(0); *usage = SVGA3D_DECLUSAGE_TEXCOORD; diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index c5c480f..baff802 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -139,7 +139,7 @@ struct tgsi_declaration_dimension #define TGSI_SEMANTIC_FOG3 #define TGSI_SEMANTIC_PSIZE 4 #define TGSI_SEMANTIC_GENERIC5 -#define TGSI_SEMANTIC_NORMAL 6 +/* gap */ #define TGSI_SEMANTIC_FACE 7 #define TGSI_SEMANTIC_EDGEFLAG 8 #define TGSI_SEMANTIC_PRIMID 9 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): Merge branch 'gallium-no-rhw-position'
Module: Mesa Branch: master Commit: 4ca70c489baed3e23dbf5e5e5794385113e22252 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4ca70c489baed3e23dbf5e5e5794385113e22252 Author: Michal Krol Date: Tue Mar 2 13:35:30 2010 +0100 Merge branch 'gallium-no-rhw-position' Conflicts: src/gallium/drivers/r300/r300_blit.c src/gallium/drivers/r300/r300_emit.c src/gallium/drivers/r300/r300_state_derived.c --- ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util/blitter: Fix the viewport transformation for Z coordinates
Module: Mesa Branch: master Commit: ff9ddf4d39be9e36d3e1dd9e10e889efa40dfb1e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff9ddf4d39be9e36d3e1dd9e10e889efa40dfb1e Author: Marek Olšák Date: Tue Mar 2 02:37:45 2010 +0100 util/blitter: Fix the viewport transformation for Z coordinates When clearing buffers, the depth is specified in the range [0, 1] and should be passed through blitter "as is". --- src/gallium/auxiliary/util/u_blitter.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index f93c69d..0ba09d3 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -320,11 +320,11 @@ static void blitter_set_rectangle(struct blitter_context_priv *ctx, /* viewport */ ctx->viewport.scale[0] = 0.5f * width; ctx->viewport.scale[1] = 0.5f * height; - ctx->viewport.scale[2] = 0.5f; + ctx->viewport.scale[2] = 1.0f; ctx->viewport.scale[3] = 1.0f; ctx->viewport.translate[0] = 0.5f * width; ctx->viewport.translate[1] = 0.5f * height; - ctx->viewport.translate[2] = 0.5f; + ctx->viewport.translate[2] = 0.0f; ctx->viewport.translate[3] = 0.0f; ctx->pipe->set_viewport_state(ctx->pipe, &ctx->viewport); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r300: Save viewport and clip states before invoking blitter.
Module: Mesa Branch: master Commit: b42455c4f48076eec34e383d5b9cc4670f2d048f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b42455c4f48076eec34e383d5b9cc4670f2d048f Author: Michal Krol Date: Mon Mar 1 17:07:03 2010 +0100 r300: Save viewport and clip states before invoking blitter. --- src/gallium/drivers/r300/r300_blit.c|2 ++ src/gallium/drivers/r300/r300_context.h |4 src/gallium/drivers/r300/r300_state.c |4 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index eb9b0be..ec7414d 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -34,6 +34,8 @@ static void r300_blitter_save_states(struct r300_context* r300) util_blitter_save_rasterizer(r300->blitter, r300->rs_state.state); util_blitter_save_fragment_shader(r300->blitter, r300->fs); util_blitter_save_vertex_shader(r300->blitter, r300->vs); +util_blitter_save_viewport(r300->blitter, &r300->viewport); +util_blitter_save_clip(r300->blitter, &r300->clip); } /* Clear currently bound buffers. */ diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 2f056aa..97100c0 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -333,6 +333,10 @@ struct r300_context { struct pipe_stencil_ref stencil_ref; +struct pipe_clip_state clip; + +struct pipe_viewport_state viewport; + /* Bitmask of dirty state objects. */ uint32_t dirty_state; /* Flag indicating whether or not the HW is dirty. */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 3550c69..ebb8591 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -376,6 +376,8 @@ static void r300_set_clip_state(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); +r300->clip = *state; + if (r300_screen(pipe->screen)->caps->has_tcl) { memcpy(r300->clip_state.state, state, sizeof(struct pipe_clip_state)); r300->clip_state.size = 29; @@ -986,6 +988,8 @@ static void r300_set_viewport_state(struct pipe_context* pipe, struct r300_viewport_state* viewport = (struct r300_viewport_state*)r300->viewport_state.state; +r300->viewport = *state; + /* Do the transform in HW. */ viewport->vte_control = R300_VTX_W0_FMT; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Fix u_blitter setup code after bypass_vs_clip_and_viewport removal.
Module: Mesa Branch: master Commit: 932e6f8d527d2147ecc4e75ce9ae2f71e23e61af URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=932e6f8d527d2147ecc4e75ce9ae2f71e23e61af Author: Michal Krol Date: Mon Mar 1 17:06:20 2010 +0100 util: Fix u_blitter setup code after bypass_vs_clip_and_viewport removal. Not tested. --- src/gallium/auxiliary/util/u_blitter.c | 46 --- src/gallium/auxiliary/util/u_blitter.h | 16 +++ 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 50877f6..f93c69d 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -93,6 +93,12 @@ struct blitter_context_priv /* Rasterizer state. */ void *rs_state; + + /* Viewport state. */ + struct pipe_viewport_state viewport; + + /* Clip state. */ + struct pipe_clip_state clip; }; struct blitter_context *util_blitter_create(struct pipe_context *pipe) @@ -262,6 +268,9 @@ static void blitter_restore_CSOs(struct blitter_context_priv *ctx) pipe->set_stencil_ref(pipe, &ctx->blitter.saved_stencil_ref); + pipe->set_viewport_state(pipe, &ctx->blitter.saved_viewport); + pipe->set_clip_state(pipe, &ctx->blitter.saved_clip); + /* restore the state objects which are required to be saved before copy/fill */ if (ctx->blitter.saved_fb_state.nr_cbufs != ~0) { @@ -287,25 +296,40 @@ static void blitter_restore_CSOs(struct blitter_context_priv *ctx) static void blitter_set_rectangle(struct blitter_context_priv *ctx, unsigned x1, unsigned y1, unsigned x2, unsigned y2, + unsigned width, unsigned height, float depth) { int i; /* set vertex positions */ - ctx->vertices[0][0][0] = x1; /*v0.x*/ - ctx->vertices[0][0][1] = y1; /*v0.y*/ + ctx->vertices[0][0][0] = (float)x1 / width * 2.0f - 1.0f; /*v0.x*/ + ctx->vertices[0][0][1] = (float)y1 / height * 2.0f - 1.0f; /*v0.y*/ - ctx->vertices[1][0][0] = x2; /*v1.x*/ - ctx->vertices[1][0][1] = y1; /*v1.y*/ + ctx->vertices[1][0][0] = (float)x2 / width * 2.0f - 1.0f; /*v1.x*/ + ctx->vertices[1][0][1] = (float)y1 / height * 2.0f - 1.0f; /*v1.y*/ - ctx->vertices[2][0][0] = x2; /*v2.x*/ - ctx->vertices[2][0][1] = y2; /*v2.y*/ + ctx->vertices[2][0][0] = (float)x2 / width * 2.0f - 1.0f; /*v2.x*/ + ctx->vertices[2][0][1] = (float)y2 / height * 2.0f - 1.0f; /*v2.y*/ - ctx->vertices[3][0][0] = x1; /*v3.x*/ - ctx->vertices[3][0][1] = y2; /*v3.y*/ + ctx->vertices[3][0][0] = (float)x1 / width * 2.0f - 1.0f; /*v3.x*/ + ctx->vertices[3][0][1] = (float)y2 / height * 2.0f - 1.0f; /*v3.y*/ for (i = 0; i < 4; i++) ctx->vertices[i][0][2] = depth; /*z*/ + + /* viewport */ + ctx->viewport.scale[0] = 0.5f * width; + ctx->viewport.scale[1] = 0.5f * height; + ctx->viewport.scale[2] = 0.5f; + ctx->viewport.scale[3] = 1.0f; + ctx->viewport.translate[0] = 0.5f * width; + ctx->viewport.translate[1] = 0.5f * height; + ctx->viewport.translate[2] = 0.5f; + ctx->viewport.translate[3] = 0.0f; + ctx->pipe->set_viewport_state(ctx->pipe, &ctx->viewport); + + /* clip */ + ctx->pipe->set_clip_state(ctx->pipe, &ctx->clip); } static void blitter_set_clear_color(struct blitter_context_priv *ctx, @@ -549,7 +573,7 @@ void util_blitter_clear(struct blitter_context *blitter, pipe->bind_vs_state(pipe, ctx->vs_col); blitter_set_clear_color(ctx, rgba); - blitter_set_rectangle(ctx, 0, 0, width, height, depth); + blitter_set_rectangle(ctx, 0, 0, width, height, width, height, depth); blitter_draw_quad(ctx); blitter_restore_CSOs(ctx); } @@ -632,7 +656,7 @@ static void util_blitter_do_copy(struct blitter_context *blitter, assert(0); } - blitter_set_rectangle(ctx, dstx, dsty, dstx+width, dsty+height, 0); + blitter_set_rectangle(ctx, dstx, dsty, dstx+width, dsty+height, dst->width, dst->height, 0); blitter_draw_quad(ctx); } @@ -793,7 +817,7 @@ void util_blitter_fill(struct blitter_context *blitter, pipe->set_framebuffer_state(pipe, &fb_state); blitter_set_clear_color(ctx, rgba); - blitter_set_rectangle(ctx, 0, 0, width, height, 0); + blitter_set_rectangle(ctx, 0, 0, width, height, dst->width, dst->height, 0); blitter_draw_quad(ctx); blitter_restore_CSOs(ctx); } diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index a2f1707..92008fc 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -48,6 +48,8 @@ struct blitter_context struct pipe_framebuffer_state saved_fb_state; /**< framebuffer state */ struct pipe_stencil_ref saved_stencil_ref; /**< stencil ref */ + struct pipe_viewport_state saved_viewport; + struct pipe_clip_state saved_clip;
Mesa (master): util: Fix blitter vertex and viewport setup.
Module: Mesa Branch: master Commit: 235c6bdf6dc0a687a7313f948444c4294abc0ea1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=235c6bdf6dc0a687a7313f948444c4294abc0ea1 Author: Michal Krol Date: Thu Feb 25 10:22:30 2010 +0100 util: Fix blitter vertex and viewport setup. --- src/gallium/auxiliary/util/u_blit.c | 27 +-- 1 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 95567d0..0b263a9 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -426,11 +426,11 @@ util_blit_pixels_writemask(struct blit_state *ctx, /* viewport */ ctx->viewport.scale[0] = 0.5f * dst->width; ctx->viewport.scale[1] = 0.5f * dst->height; - ctx->viewport.scale[2] = 1.0f; + ctx->viewport.scale[2] = 0.5f; ctx->viewport.scale[3] = 1.0f; ctx->viewport.translate[0] = 0.5f * dst->width; ctx->viewport.translate[1] = 0.5f * dst->height; - ctx->viewport.translate[2] = 0.0f; + ctx->viewport.translate[2] = 0.5f; ctx->viewport.translate[3] = 0.0f; cso_set_viewport(ctx->cso, &ctx->viewport); @@ -456,8 +456,10 @@ util_blit_pixels_writemask(struct blit_state *ctx, /* draw quad */ offset = setup_vertex_data_tex(ctx, - (float) dstX0, (float) dstY0, - (float) dstX1, (float) dstY1, + (float) dstX0 / dst->width * 2.0f - 1.0f, + (float) dstY0 / dst->height * 2.0f - 1.0f, + (float) dstX1 / dst->width * 2.0f - 1.0f, + (float) dstY1 / dst->height * 2.0f - 1.0f, s0, t0, s1, t1, z); @@ -575,6 +577,17 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_single_sampler(ctx->cso, 0, &ctx->sampler); cso_single_sampler_done(ctx->cso); + /* viewport */ + ctx->viewport.scale[0] = 0.5f * dst->width; + ctx->viewport.scale[1] = 0.5f * dst->height; + ctx->viewport.scale[2] = 0.5f; + ctx->viewport.scale[3] = 1.0f; + ctx->viewport.translate[0] = 0.5f * dst->width; + ctx->viewport.translate[1] = 0.5f * dst->height; + ctx->viewport.translate[2] = 0.5f; + ctx->viewport.translate[3] = 0.0f; + cso_set_viewport(ctx->cso, &ctx->viewport); + /* texture */ cso_set_sampler_textures(ctx->cso, 1, &tex); @@ -592,8 +605,10 @@ util_blit_pixels_tex(struct blit_state *ctx, /* draw quad */ offset = setup_vertex_data_tex(ctx, - (float) dstX0, (float) dstY0, - (float) dstX1, (float) dstY1, + (float) dstX0 / dst->width * 2.0f - 1.0f, + (float) dstY0 / dst->height * 2.0f - 1.0f, + (float) dstX1 / dst->width * 2.0f - 1.0f, + (float) dstY1 / dst->height * 2.0f - 1.0f, s0, t0, s1, t1, z); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Reset clip state when doing blitting.
Module: Mesa Branch: master Commit: 5b3f8369c693e75d1dbc7587e4e0d77934c0cd77 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b3f8369c693e75d1dbc7587e4e0d77934c0cd77 Author: Michal Krol Date: Wed Feb 24 15:48:30 2010 +0100 util: Reset clip state when doing blitting. --- src/gallium/auxiliary/util/u_blit.c |8 +++- src/gallium/auxiliary/util/u_gen_mipmap.c |4 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 90a3230..95567d0 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -62,6 +62,7 @@ struct blit_state struct pipe_rasterizer_state rasterizer; struct pipe_sampler_state sampler; struct pipe_viewport_state viewport; + struct pipe_clip_state clip; void *vs; void *fs[TGSI_WRITEMASK_XYZW + 1]; @@ -264,7 +265,6 @@ regions_overlap(int srcX0, int srcY0, * \param writemask controls which channels in the dest surface are sourced * from the src surface. Disabled channels are sourced * from (0,0,0,1). - * XXX what about clipping??? * XXX need some control over blitting Z and/or stencil. */ void @@ -409,11 +409,13 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_save_framebuffer(ctx->cso); cso_save_fragment_shader(ctx->cso); cso_save_vertex_shader(ctx->cso); + cso_save_clip(ctx->cso); /* set misc state we care about */ cso_set_blend(ctx->cso, &ctx->blend); cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); + cso_set_clip(ctx->cso, &ctx->clip); /* sampler */ ctx->sampler.min_img_filter = filter; @@ -475,6 +477,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); cso_restore_vertex_shader(ctx->cso); + cso_restore_clip(ctx->cso); pipe_texture_reference(&tex, NULL); } @@ -558,11 +561,13 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_save_framebuffer(ctx->cso); cso_save_fragment_shader(ctx->cso); cso_save_vertex_shader(ctx->cso); + cso_save_clip(ctx->cso); /* set misc state we care about */ cso_set_blend(ctx->cso, &ctx->blend); cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); + cso_set_clip(ctx->cso, &ctx->clip); /* sampler */ ctx->sampler.min_img_filter = filter; @@ -607,4 +612,5 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); cso_restore_vertex_shader(ctx->cso); + cso_restore_clip(ctx->cso); } diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 4f9ff1d..f423882 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -61,6 +61,7 @@ struct gen_mipmap_state struct pipe_depth_stencil_alpha_state depthstencil; struct pipe_rasterizer_state rasterizer; struct pipe_sampler_state sampler; + struct pipe_clip_state clip; void *vs; void *fs2d, *fsCube; @@ -1499,11 +1500,13 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_save_fragment_shader(ctx->cso); cso_save_vertex_shader(ctx->cso); cso_save_viewport(ctx->cso); + cso_save_clip(ctx->cso); /* bind our state */ cso_set_blend(ctx->cso, &ctx->blend); cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); + cso_set_clip(ctx->cso, &ctx->clip); cso_set_fragment_shader_handle(ctx->cso, fs); cso_set_vertex_shader_handle(ctx->cso, ctx->vs); @@ -1589,4 +1592,5 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_restore_fragment_shader(ctx->cso); cso_restore_vertex_shader(ctx->cso); cso_restore_viewport(ctx->cso); + cso_restore_clip(ctx->cso); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: Reset clip state when clearing with quads.
Module: Mesa Branch: master Commit: a9aa811af01273cef8a73118abdc87313f365ad3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9aa811af01273cef8a73118abdc87313f365ad3 Author: Michal Krol Date: Wed Feb 24 16:41:18 2010 +0100 st/mesa: Reset clip state when clearing with quads. --- src/mesa/state_tracker/st_cb_clear.c |6 +- src/mesa/state_tracker/st_context.h |1 + 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 5edab55..9e66eed 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -62,7 +62,8 @@ st_init_clear(struct st_context *st) { struct pipe_context *pipe = st->pipe; - memset(&st->clear.raster, 0, sizeof(st->clear.raster)); + memset(&st->clear, 0, sizeof(st->clear)); + st->clear.raster.gl_rasterization_rules = 1; /* fragment shader state: color pass-through program */ @@ -209,6 +210,7 @@ clear_with_quad(GLcontext *ctx, cso_save_depth_stencil_alpha(st->cso_context); cso_save_rasterizer(st->cso_context); cso_save_viewport(st->cso_context); + cso_save_clip(st->cso_context); cso_save_fragment_shader(st->cso_context); cso_save_vertex_shader(st->cso_context); @@ -279,6 +281,7 @@ clear_with_quad(GLcontext *ctx, cso_set_viewport(st->cso_context, &vp); } + cso_set_clip(st->cso_context, &st->clear.clip); cso_set_fragment_shader_handle(st->cso_context, st->clear.fs); cso_set_vertex_shader_handle(st->cso_context, st->clear.vs); @@ -291,6 +294,7 @@ clear_with_quad(GLcontext *ctx, cso_restore_depth_stencil_alpha(st->cso_context); cso_restore_rasterizer(st->cso_context); cso_restore_viewport(st->cso_context); + cso_restore_clip(st->cso_context); cso_restore_fragment_shader(st->cso_context); cso_restore_vertex_shader(st->cso_context); } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 13b7b0e..045c029 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -166,6 +166,7 @@ struct st_context struct { struct pipe_rasterizer_state raster; struct pipe_viewport_state viewport; + struct pipe_clip_state clip; void *vs; void *fs; float vertices[4][2][4]; /**< vertex pos + color */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: Use cso context to manage clip state.
Module: Mesa Branch: master Commit: 8039ee09b8c78a70c1c50207cce9a7bb4cffc675 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8039ee09b8c78a70c1c50207cce9a7bb4cffc675 Author: Michal Krol Date: Wed Feb 24 15:28:41 2010 +0100 st/mesa: Use cso context to manage clip state. --- src/mesa/state_tracker/st_atom_clip.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_clip.c b/src/mesa/state_tracker/st_atom_clip.c index 23d709b..80c0e92 100644 --- a/src/mesa/state_tracker/st_atom_clip.c +++ b/src/mesa/state_tracker/st_atom_clip.c @@ -35,6 +35,8 @@ #include "pipe/p_context.h" #include "st_atom.h" +#include "cso_cache/cso_context.h" + /* Second state atom for user clip planes: */ @@ -56,7 +58,7 @@ static void update_clip( struct st_context *st ) if (memcmp(&clip, &st->state.clip, sizeof(clip)) != 0) { st->state.clip = clip; - st->pipe->set_clip_state(st->pipe, &clip); + cso_set_clip(st->cso_context, &clip); } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium: Remove bypass_vs_clip_and_viewport from rasteriser state.
Module: Mesa Branch: master Commit: 63cb6f59eac91ba34cf80ff3736568e40b094fe1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=63cb6f59eac91ba34cf80ff3736568e40b094fe1 Author: Michal Krol Date: Mon Feb 22 21:36:22 2010 +0100 gallium: Remove bypass_vs_clip_and_viewport from rasteriser state. Needs testing. --- src/gallium/auxiliary/draw/draw_context.c |8 +- src/gallium/auxiliary/draw/draw_pt.c |4 +- .../auxiliary/draw/draw_pt_fetch_shade_emit.c |3 +- .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 15 +- src/gallium/auxiliary/util/u_blit.c| 15 +- src/gallium/auxiliary/util/u_blitter.c |1 - src/gallium/auxiliary/util/u_dump_state.c |1 - src/gallium/auxiliary/util/u_gen_mipmap.c | 39 ++- src/gallium/docs/source/cso/rasterizer.rst | 12 - src/gallium/drivers/nv30/nv30_context.h|1 - src/gallium/drivers/nv30/nv30_state_viewport.c | 58 +--- src/gallium/drivers/nv40/nv40_context.h|1 - src/gallium/drivers/nv40/nv40_state_viewport.c | 57 +--- src/gallium/drivers/nv50/nv50_context.h|1 - src/gallium/drivers/nv50/nv50_state_validate.c | 62 ++--- src/gallium/drivers/r300/r300_context.h|2 - src/gallium/drivers/r300/r300_emit.c | 46 ++-- src/gallium/drivers/r300/r300_state.c |5 +- src/gallium/drivers/r300/r300_state_derived.c |8 +- src/gallium/drivers/softpipe/sp_video_context.c|1 - src/gallium/drivers/svga/svga_state_framebuffer.c | 285 +--- src/gallium/drivers/svga/svga_state_need_swtnl.c |3 +- src/gallium/drivers/trace/tr_dump_state.c |1 - src/gallium/include/pipe/p_state.h | 10 - src/mesa/state_tracker/st_cb_clear.c | 44 ++-- 25 files changed, 271 insertions(+), 412 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index d5ddc4a..bb09885 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -128,9 +128,7 @@ void draw_set_rasterizer_state( struct draw_context *draw, draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); draw->rasterizer = raster; - draw->bypass_clipping = - ((draw->rasterizer && draw->rasterizer->bypass_vs_clip_and_viewport) || - draw->driver.bypass_clipping); + draw->bypass_clipping = draw->driver.bypass_clipping; } @@ -140,9 +138,7 @@ void draw_set_driver_clipping( struct draw_context *draw, draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); draw->driver.bypass_clipping = bypass_clipping; - draw->bypass_clipping = - ((draw->rasterizer && draw->rasterizer->bypass_vs_clip_and_viewport) || - draw->driver.bypass_clipping); + draw->bypass_clipping = draw->driver.bypass_clipping; } diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 341353f..6d90a6c 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -87,9 +87,7 @@ draw_pt_arrays(struct draw_context *draw, opt |= PT_CLIPTEST; } - if (!draw->rasterizer->bypass_vs_clip_and_viewport) { - opt |= PT_SHADE; - } + opt |= PT_SHADE; } if (opt == 0) diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c index c5dfbcf..1aecb51 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c @@ -100,8 +100,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle, fse->key.nr_elements = MAX2(fse->key.nr_outputs, /* outputs - translate to hw format */ fse->key.nr_inputs); /* inputs - fetch from api format */ - fse->key.viewport = (!draw->rasterizer->bypass_vs_clip_and_viewport && -!draw->identity_viewport); + fse->key.viewport = !draw->identity_viewport; fse->key.clip = !draw->bypass_clipping; fse->key.const_vbuffers = 0; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 56b6935..da51064 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -96,8 +96,7 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle, */ draw_pt_post_vs_prepare( fpme->post_vs, (boolean)draw->bypass_clipping, - (boolean)(draw->identity_viewport || - draw->rasterizer->bypass_vs_clip_and_viewport), + (boolean)draw->identity_viewport, (boolean)draw->rasterizer->gl_rasterization_rules,
Mesa (master): cso: Track clip state with cso context.
Module: Mesa Branch: master Commit: 227ae7b968c1351921babdbf6f052239766ffce4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=227ae7b968c1351921babdbf6f052239766ffce4 Author: Michal Krol Date: Wed Feb 24 15:16:54 2010 +0100 cso: Track clip state with cso context. --- src/gallium/auxiliary/cso_cache/cso_context.c | 54 + src/gallium/auxiliary/cso_cache/cso_context.h | 13 ++ 2 files changed, 67 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index b5241fa..a7335c3 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -90,6 +90,9 @@ struct cso_context { void *fragment_shader, *fragment_shader_saved, *geometry_shader; void *vertex_shader, *vertex_shader_saved, *geometry_shader_saved; + struct pipe_clip_state clip; + struct pipe_clip_state clip_saved; + struct pipe_framebuffer_state fb, fb_saved; struct pipe_viewport_state vp, vp_saved; struct pipe_blend_color blend_color; @@ -1126,3 +1129,54 @@ void cso_restore_geometry_shader(struct cso_context *ctx) } ctx->geometry_shader_saved = NULL; } + + +/* clip state */ + +static INLINE void +clip_state_cpy(struct pipe_clip_state *dst, + const struct pipe_clip_state *src) +{ + dst->nr = src->nr; + if (src->nr) { + memcpy(dst->ucp, src->ucp, src->nr * sizeof(src->ucp[0])); + } +} + +static INLINE int +clip_state_cmp(const struct pipe_clip_state *a, + const struct pipe_clip_state *b) +{ + if (a->nr != b->nr) { + return 1; + } + if (a->nr) { + return memcmp(a->ucp, b->ucp, a->nr * sizeof(a->ucp[0])); + } + return 0; +} + +void +cso_set_clip(struct cso_context *ctx, + const struct pipe_clip_state *clip) +{ + if (clip_state_cmp(&ctx->clip, clip)) { + clip_state_cpy(&ctx->clip, clip); + ctx->pipe->set_clip_state(ctx->pipe, clip); + } +} + +void +cso_save_clip(struct cso_context *ctx) +{ + clip_state_cpy(&ctx->clip_saved, &ctx->clip); +} + +void +cso_restore_clip(struct cso_context *ctx) +{ + if (clip_state_cmp(&ctx->clip, &ctx->clip_saved)) { + clip_state_cpy(&ctx->clip, &ctx->clip_saved); + ctx->pipe->set_clip_state(ctx->pipe, &ctx->clip_saved); + } +} diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 707b3c2..251a9a6 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -180,6 +180,19 @@ void cso_save_stencil_ref(struct cso_context *cso); void cso_restore_stencil_ref(struct cso_context *cso); +/* clip state */ + +void +cso_set_clip(struct cso_context *cso, + const struct pipe_clip_state *clip); + +void +cso_save_clip(struct cso_context *cso); + +void +cso_restore_clip(struct cso_context *cso); + + #ifdef __cplusplus } #endif ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-no-nvidia-opcodes): gallium: Remove TGSI_OPCODE_X2D.
Module: Mesa Branch: gallium-no-nvidia-opcodes Commit: 1a29c2b5b3356451f4e419f409dece4f821fda54 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a29c2b5b3356451f4e419f409dece4f821fda54 Author: Michal Krol Date: Tue Mar 2 12:33:55 2010 +0100 gallium: Remove TGSI_OPCODE_X2D. --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c|6 --- .../auxiliary/tgsi/tgsi-instruction-set.txt|8 src/gallium/auxiliary/tgsi/tgsi_exec.c | 39 src/gallium/auxiliary/tgsi/tgsi_info.c |2 +- src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |1 - src/gallium/auxiliary/tgsi/tgsi_sse2.c |4 -- src/gallium/docs/source/tgsi.rst | 17 - src/gallium/drivers/cell/spu/spu_exec.c|4 -- src/gallium/drivers/r300/r300_tgsi_to_rc.c |1 - src/gallium/include/pipe/p_shader_tokens.h |1 - 10 files changed, 1 insertions(+), 82 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 5224db4..4c1993d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -1014,12 +1014,6 @@ emit_instruction( return 0; break; - case TGSI_OPCODE_X2D: - /* deprecated? */ - assert(0); - return 0; - break; - case TGSI_OPCODE_ARA: /* deprecated */ assert(0); diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt index e7534b8..5f9d2d5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt @@ -443,14 +443,6 @@ TGSI Instruction Specification TBD -1.5.30 X2D - 2D Coordinate Transformation - - dst.x = src0.x + src1.x * src2.x + src1.y * src2.y - dst.y = src0.y + src1.x * src2.z + src1.y * src2.w - dst.z = src0.x + src1.x * src2.x + src1.y * src2.y - dst.w = src0.y + src1.x * src2.z + src1.y * src2.w - - 1.6 GL_NV_vertex_program2 -- diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 6d92b36..978b87c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -2829,45 +2829,6 @@ exec_instruction( exec_tex(mach, inst, TEX_MODIFIER_PROJECTED); break; - case TGSI_OPCODE_X2D: - FETCH(&r[0], 1, CHAN_X); - FETCH(&r[1], 1, CHAN_Y); - if (IS_CHANNEL_ENABLED(*inst, CHAN_X) || - IS_CHANNEL_ENABLED(*inst, CHAN_Z)) { - FETCH(&r[2], 2, CHAN_X); - micro_mul(&r[2], &r[2], &r[0]); - FETCH(&r[3], 2, CHAN_Y); - micro_mul(&r[3], &r[3], &r[1]); - micro_add(&r[2], &r[2], &r[3]); - FETCH(&r[3], 0, CHAN_X); - micro_add(&d[CHAN_X], &r[2], &r[3]); - - } - if (IS_CHANNEL_ENABLED(*inst, CHAN_Y) || - IS_CHANNEL_ENABLED(*inst, CHAN_W)) { - FETCH(&r[2], 2, CHAN_Z); - micro_mul(&r[2], &r[2], &r[0]); - FETCH(&r[3], 2, CHAN_W); - micro_mul(&r[3], &r[3], &r[1]); - micro_add(&r[2], &r[2], &r[3]); - FETCH(&r[3], 0, CHAN_Y); - micro_add(&d[CHAN_Y], &r[2], &r[3]); - - } - if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) { - STORE(&d[CHAN_X], 0, CHAN_X); - } - if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) { - STORE(&d[CHAN_Y], 0, CHAN_Y); - } - if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) { - STORE(&d[CHAN_X], 0, CHAN_Z); - } - if (IS_CHANNEL_ENABLED(*inst, CHAN_W)) { - STORE(&d[CHAN_Y], 0, CHAN_W); - } - break; - case TGSI_OPCODE_ARA: assert (0); break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 0162f29..a4a7f79 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -90,7 +90,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 0, 0, 0, 0, 0, 0, "", 56 }, /* removed */ { 0, 0, 0, 0, 0, 0, "", 57 }, /* removed */ { 0, 0, 0, 0, 0, 0, "", 58 }, /* removed */ - { 1, 3, 0, 0, 0, 0, "X2D", TGSI_OPCODE_X2D }, + { 0, 0, 0, 0, 0, 0, "", 59 }, /* removed */ { 1, 1, 0, 0, 0, 0, "ARA", TGSI_OPCODE_ARA }, { 1, 1, 0, 0, 0, 0, "ARR", TGSI_OPCODE_ARR }, { 0, 1, 0, 0, 0, 0, "BRA", TGSI_OPCODE_BRA }, diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h index 376df65..9a1ca80 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h +++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h @@ -83,7 +83,6 @@ OP12(SNE) OP12_TEX(TEX) OP14_TEX(TXD) OP12_TEX(TXP) -OP13(X2D) OP11(ARA) OP11(ARR) OP01(BRA) diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index d260187..1e5751e 100644
Mesa (gallium-no-nvidia-opcodes): gallium: Remove TGSI_OPCODE_RCC.
Module: Mesa Branch: gallium-no-nvidia-opcodes Commit: 759ccf7acee45af9f8481686fb65d2e85cf22fd0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=759ccf7acee45af9f8481686fb65d2e85cf22fd0 Author: Michal Krol Date: Tue Mar 2 12:30:46 2010 +0100 gallium: Remove TGSI_OPCODE_RCC. --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c|5 --- .../auxiliary/tgsi/tgsi-instruction-set.txt|8 src/gallium/auxiliary/tgsi/tgsi_exec.c | 35 src/gallium/auxiliary/tgsi/tgsi_info.c |2 +- src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |1 - src/gallium/auxiliary/tgsi/tgsi_sse2.c |4 -- src/gallium/docs/source/tgsi.rst | 11 -- src/gallium/drivers/cell/spu/spu_exec.c|4 -- src/gallium/drivers/r300/r300_tgsi_to_rc.c |1 - src/gallium/include/pipe/p_shader_tokens.h |2 +- 10 files changed, 2 insertions(+), 71 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index b297e65..5224db4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -911,11 +911,6 @@ emit_instruction( } break; - case TGSI_OPCODE_RCC: - /* deprecated? */ - assert(0); - return 0; - case TGSI_OPCODE_DPH: tmp0 = emit_fetch( bld, inst, 0, CHAN_X ); tmp1 = emit_fetch( bld, inst, 1, CHAN_X ); diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt index d6fe930..e7534b8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt @@ -317,14 +317,6 @@ TGSI Instruction Specification dst.w = abs(src.w) -1.4.2 RCC - Reciprocal Clamped - - dst.x = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020) - dst.y = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020) - dst.z = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020) - dst.w = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020) - - 1.4.3 DPH - Homogeneous Dot Product dst.x = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 5274ec0..6d92b36 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -840,32 +840,6 @@ micro_div( } static void -micro_float_clamp(union tgsi_exec_channel *dst, - const union tgsi_exec_channel *src) -{ - uint i; - - for (i = 0; i < 4; i++) { - if (src->f[i] > 0.0f) { - if (src->f[i] > 1.884467e+019f) -dst->f[i] = 1.884467e+019f; - else if (src->f[i] < 5.42101e-020f) -dst->f[i] = 5.42101e-020f; - else -dst->f[i] = src->f[i]; - } - else { - if (src->f[i] < -1.884467e+019f) -dst->f[i] = -1.884467e+019f; - else if (src->f[i] > -5.42101e-020f) -dst->f[i] = -5.42101e-020f; - else -dst->f[i] = src->f[i]; - } - } -} - -static void micro_lt( union tgsi_exec_channel *dst, const union tgsi_exec_channel *src0, @@ -2774,15 +2748,6 @@ exec_instruction( exec_vector_unary(mach, inst, micro_abs, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; - case TGSI_OPCODE_RCC: - FETCH(&r[0], 0, CHAN_X); - micro_div(&r[0], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &r[0]); - micro_float_clamp(&r[0], &r[0]); - FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { - STORE(&r[0], 0, chan_index); - } - break; - case TGSI_OPCODE_DPH: exec_dph(mach, inst); break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 240ab69..0162f29 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -65,7 +65,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 2, 0, 0, 0, 0, "XPD", TGSI_OPCODE_XPD }, { 0, 0, 0, 0, 0, 0, "", 32 }, /* removed */ { 1, 1, 0, 0, 0, 0, "ABS", TGSI_OPCODE_ABS }, - { 1, 1, 0, 0, 0, 0, "RCC", TGSI_OPCODE_RCC }, + { 0, 0, 0, 0, 0, 0, "", 34 }, /* removed */ { 1, 2, 0, 0, 0, 0, "DPH", TGSI_OPCODE_DPH }, { 1, 1, 0, 0, 0, 0, "COS", TGSI_OPCODE_COS }, { 1, 1, 0, 0, 0, 0, "DDX", TGSI_OPCODE_DDX }, diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h index 66464f6..376df65 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h +++ b/src/galli
Mesa (gallium-no-nvidia-opcodes): gallium: Remove TGSI_OPCODE_RFL.
Module: Mesa Branch: gallium-no-nvidia-opcodes Commit: 0d87cea21c55fdec57a55965a9d468bfb688bdad URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d87cea21c55fdec57a55965a9d468bfb688bdad Author: Michal Krol Date: Tue Mar 2 12:16:54 2010 +0100 gallium: Remove TGSI_OPCODE_RFL. --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c|4 -- .../auxiliary/tgsi/tgsi-instruction-set.txt|8 --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 49 src/gallium/auxiliary/tgsi/tgsi_info.c |2 +- src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |1 - src/gallium/auxiliary/tgsi/tgsi_sse2.c |4 -- src/gallium/docs/source/tgsi.rst | 17 --- src/gallium/drivers/cell/spu/spu_exec.c|4 -- src/gallium/drivers/nv30/nv30_fragprog.c |3 - src/gallium/drivers/nv40/nv40_fragprog.c |9 src/gallium/drivers/r300/r300_tgsi_to_rc.c |1 - src/gallium/include/pipe/p_shader_tokens.h |1 - 12 files changed, 1 insertions(+), 102 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 497f328..b297e65 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -966,10 +966,6 @@ emit_instruction( emit_kil( bld, inst ); break; - case TGSI_OPCODE_RFL: - return 0; - break; - case TGSI_OPCODE_SEQ: FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt index 008114d..d6fe930 100644 --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt @@ -396,14 +396,6 @@ TGSI Instruction Specification Alias for POWER. -1.5.15 RFL - Reflection Vector - - dst.x = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.x - src1.x - dst.y = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.y - src1.y - dst.z = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.z - src1.z - dst.w = 1.0 - - 1.5.16 SEQ - Set On Equal dst.x = (src0.x == src1.x) ? 1.0 : 0.0 diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 899265d..5274ec0 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -2807,55 +2807,6 @@ exec_instruction( exec_kil (mach, inst); break; - case TGSI_OPCODE_RFL: - if (IS_CHANNEL_ENABLED(*inst, CHAN_X) || - IS_CHANNEL_ENABLED(*inst, CHAN_Y) || - IS_CHANNEL_ENABLED(*inst, CHAN_Z)) { - /* r0 = dp3(src0, src0) */ - FETCH(&r[2], 0, CHAN_X); - micro_mul(&r[0], &r[2], &r[2]); - FETCH(&r[4], 0, CHAN_Y); - micro_mul(&r[8], &r[4], &r[4]); - micro_add(&r[0], &r[0], &r[8]); - FETCH(&r[6], 0, CHAN_Z); - micro_mul(&r[8], &r[6], &r[6]); - micro_add(&r[0], &r[0], &r[8]); - - /* r1 = dp3(src0, src1) */ - FETCH(&r[3], 1, CHAN_X); - micro_mul(&r[1], &r[2], &r[3]); - FETCH(&r[5], 1, CHAN_Y); - micro_mul(&r[8], &r[4], &r[5]); - micro_add(&r[1], &r[1], &r[8]); - FETCH(&r[7], 1, CHAN_Z); - micro_mul(&r[8], &r[6], &r[7]); - micro_add(&r[1], &r[1], &r[8]); - - /* r1 = 2 * r1 / r0 */ - micro_add(&r[1], &r[1], &r[1]); - micro_div(&r[1], &r[1], &r[0]); - - if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) { -micro_mul(&r[2], &r[2], &r[1]); -micro_sub(&r[2], &r[2], &r[3]); -STORE(&r[2], 0, CHAN_X); - } - if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) { -micro_mul(&r[4], &r[4], &r[1]); -micro_sub(&r[4], &r[4], &r[5]); -STORE(&r[4], 0, CHAN_Y); - } - if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) { -micro_mul(&r[6], &r[6], &r[1]); -micro_sub(&r[6], &r[6], &r[7]); -STORE(&r[6], 0, CHAN_Z); - } - } - if (IS_CHANNEL_ENABLED(*inst, CHAN_W)) { - STORE(&mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W); - } - break; - case TGSI_OPCODE_SEQ: exec_vector_binary(mach, inst, micro_seq, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 227c352..240ab69 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -75,7 +75,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI
Mesa (gallium-sampler-view): softpipe: Implement sampler view swizzling.
Module: Mesa Branch: gallium-sampler-view Commit: f59f28093ea827bd234d8e1a36bdd56a9fce5f09 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f59f28093ea827bd234d8e1a36bdd56a9fce5f09 Author: Michal Krol Date: Tue Mar 2 12:03:24 2010 +0100 softpipe: Implement sampler view swizzling. --- src/gallium/drivers/softpipe/sp_state_sampler.c |6 +--- src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 29 -- src/gallium/drivers/softpipe/sp_tex_tile_cache.h |9 +- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index 8922941..68ea13f 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -166,10 +166,9 @@ softpipe_set_sampler_views(struct pipe_context *pipe, for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { struct pipe_sampler_view *view = i < num ? views[i] : NULL; - struct pipe_texture *texture = view ? view->texture : NULL; pipe_sampler_view_reference(&softpipe->sampler_views[i], view); - sp_tex_tile_cache_set_texture(softpipe->tex_cache[i], texture); + sp_tex_tile_cache_set_sampler_view(softpipe->tex_cache[i], view); } softpipe->num_sampler_views = num; @@ -198,10 +197,9 @@ softpipe_set_vertex_sampler_views(struct pipe_context *pipe, for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { struct pipe_sampler_view *view = i < num ? views[i] : NULL; - struct pipe_texture *texture = view ? view->texture : NULL; pipe_sampler_view_reference(&softpipe->vertex_sampler_views[i], view); - sp_tex_tile_cache_set_texture(softpipe->vertex_tex_cache[i], texture); + sp_tex_tile_cache_set_sampler_view(softpipe->vertex_tex_cache[i], view); } softpipe->num_vertex_sampler_views = num; diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c index a0b95c8..b9635be 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c @@ -119,12 +119,13 @@ sp_tex_tile_cache_validate_texture(struct softpipe_tex_tile_cache *tc) } /** - * Specify the texture to cache. + * Specify the sampler view to cache. */ void -sp_tex_tile_cache_set_texture(struct softpipe_tex_tile_cache *tc, - struct pipe_texture *texture) +sp_tex_tile_cache_set_sampler_view(struct softpipe_tex_tile_cache *tc, + struct pipe_sampler_view *view) { + struct pipe_texture *texture = view ? view->texture : NULL; uint i; assert(!tc->transfer); @@ -144,6 +145,13 @@ sp_tex_tile_cache_set_texture(struct softpipe_tex_tile_cache *tc, tc->tex_trans = NULL; } + if (view) { + tc->swizzle_r = view->swizzle_r; + tc->swizzle_g = view->swizzle_g; + tc->swizzle_b = view->swizzle_b; + tc->swizzle_a = view->swizzle_a; + } + /* mark as entries as invalid/empty */ /* XXX we should try to avoid this when the teximage hasn't changed */ for (i = 0; i < NUM_ENTRIES; i++) { @@ -257,11 +265,16 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, } /* get tile from the transfer (view into texture) */ - pipe_get_tile_rgba(tc->tex_trans, - addr.bits.x * TILE_SIZE, - addr.bits.y * TILE_SIZE, - TILE_SIZE, TILE_SIZE, - (float *) tile->data.color); + pipe_get_tile_swizzle(tc->tex_trans, +addr.bits.x * TILE_SIZE, +addr.bits.y * TILE_SIZE, +TILE_SIZE, +TILE_SIZE, +tc->swizzle_r, +tc->swizzle_g, +tc->swizzle_b, +tc->swizzle_a, +(float *) tile->data.color); tile->addr = addr; } diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h index ac6886a..c562f72 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h @@ -83,6 +83,11 @@ struct softpipe_tex_tile_cache void *tex_trans_map; int tex_face, tex_level, tex_z; + unsigned swizzle_r; + unsigned swizzle_g; + unsigned swizzle_b; + unsigned swizzle_a; + struct softpipe_tex_cached_tile *last_tile; /**< most recently retrieved tile */ }; @@ -101,8 +106,8 @@ extern void sp_tex_tile_cache_unmap_transfers(struct softpipe_tex_tile_cache *tc); extern void -sp_tex_tile_cache_set_texture(struct softpipe_tex_tile_cache *tc, - struct pipe_texture *texture); +sp_tex_tile_cache_set_sampler_view(struct softpipe_tex_tile_cache *tc, +
Mesa (gallium-sampler-view): util: Add pipe_get_tile_swizzle().
Module: Mesa Branch: gallium-sampler-view Commit: 5587097b53afbce52f7e26568d2dde11de96e1ec URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5587097b53afbce52f7e26568d2dde11de96e1ec Author: Michal Krol Date: Tue Mar 2 12:02:31 2010 +0100 util: Add pipe_get_tile_swizzle(). --- src/gallium/auxiliary/util/u_tile.c | 42 +++ src/gallium/auxiliary/util/u_tile.h | 12 ++ 2 files changed, 54 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 0051258..813ce4e 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -1274,6 +1274,48 @@ pipe_get_tile_rgba(struct pipe_transfer *pt, void +pipe_get_tile_swizzle(struct pipe_transfer *pt, + uint x, + uint y, + uint w, + uint h, + uint swizzle_r, + uint swizzle_g, + uint swizzle_b, + uint swizzle_a, + float *p) +{ + uint i; + float rgba01[6]; + + pipe_get_tile_rgba(pt, x, y, w, h, p); + + if (swizzle_r == PIPE_SWIZZLE_RED && + swizzle_g == PIPE_SWIZZLE_GREEN && + swizzle_b == PIPE_SWIZZLE_BLUE && + swizzle_a == PIPE_SWIZZLE_ALPHA) { + /* no-op, skip */ + return; + } + + rgba01[PIPE_SWIZZLE_ZERO] = 0.0f; + rgba01[PIPE_SWIZZLE_ONE] = 1.0f; + + for (i = 0; i < w * h; i++) { + rgba01[PIPE_SWIZZLE_RED] = p[0]; + rgba01[PIPE_SWIZZLE_GREEN] = p[1]; + rgba01[PIPE_SWIZZLE_BLUE] = p[2]; + rgba01[PIPE_SWIZZLE_ALPHA] = p[3]; + + *p++ = rgba01[swizzle_r]; + *p++ = rgba01[swizzle_g]; + *p++ = rgba01[swizzle_b]; + *p++ = rgba01[swizzle_a]; + } +} + + +void pipe_put_tile_rgba(struct pipe_transfer *pt, uint x, uint y, uint w, uint h, const float *p) diff --git a/src/gallium/auxiliary/util/u_tile.h b/src/gallium/auxiliary/util/u_tile.h index 1453af3..b470617 100644 --- a/src/gallium/auxiliary/util/u_tile.h +++ b/src/gallium/auxiliary/util/u_tile.h @@ -72,6 +72,18 @@ pipe_get_tile_rgba(struct pipe_transfer *pt, float *p); void +pipe_get_tile_swizzle(struct pipe_transfer *pt, + uint x, + uint y, + uint w, + uint h, + uint swizzle_r, + uint swizzle_g, + uint swizzle_b, + uint swizzle_a, + float *p); + +void pipe_put_tile_rgba(struct pipe_transfer *pt, uint x, uint y, uint w, uint h, const float *p); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-no-rhw-position): util/blitter: Fix the viewport transformation for Z coordinates
Module: Mesa Branch: gallium-no-rhw-position Commit: ff9ddf4d39be9e36d3e1dd9e10e889efa40dfb1e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff9ddf4d39be9e36d3e1dd9e10e889efa40dfb1e Author: Marek Olšák Date: Tue Mar 2 02:37:45 2010 +0100 util/blitter: Fix the viewport transformation for Z coordinates When clearing buffers, the depth is specified in the range [0, 1] and should be passed through blitter "as is". --- src/gallium/auxiliary/util/u_blitter.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index f93c69d..0ba09d3 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -320,11 +320,11 @@ static void blitter_set_rectangle(struct blitter_context_priv *ctx, /* viewport */ ctx->viewport.scale[0] = 0.5f * width; ctx->viewport.scale[1] = 0.5f * height; - ctx->viewport.scale[2] = 0.5f; + ctx->viewport.scale[2] = 1.0f; ctx->viewport.scale[3] = 1.0f; ctx->viewport.translate[0] = 0.5f * width; ctx->viewport.translate[1] = 0.5f * height; - ctx->viewport.translate[2] = 0.5f; + ctx->viewport.translate[2] = 0.0f; ctx->viewport.translate[3] = 0.0f; ctx->pipe->set_viewport_state(ctx->pipe, &ctx->viewport); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-format-cleanup): util: Generate linear<-> sRGB conversion tables.
Module: Mesa Branch: gallium-format-cleanup Commit: c863f30155f26d47dc45736ffbbc0e9d96009756 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c863f30155f26d47dc45736ffbbc0e9d96009756 Author: Michal Krol Date: Mon Mar 1 19:00:40 2010 +0100 util: Generate linear<->sRGB conversion tables. --- src/gallium/auxiliary/util/u_format_access.py | 17 + 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/util/u_format_access.py b/src/gallium/auxiliary/util/u_format_access.py index 1c9be1b..0042477 100644 --- a/src/gallium/auxiliary/util/u_format_access.py +++ b/src/gallium/auxiliary/util/u_format_access.py @@ -37,6 +37,7 @@ ''' +import math import sys from u_format_pack import * @@ -94,6 +95,20 @@ def native_type(format): assert False +def generate_srgb_tables(): +print 'static ubyte srgb_to_linear[256] = {' +for i in range(256): +print ' %s,' % (int(math.pow((i / 255.0 + 0.055) / 1.055, 2.4) * 255)) +print '};' +print +print 'static ubyte linear_to_srgb[256] = {' +print ' 0,' +for i in range(1, 256): +print ' %s,' % (int((1.055 * math.pow(i / 255.0, 0.41666) - 0.055) * 255)) +print '};' +print + + def generate_format_read(format, dst_channel, dst_native_type, dst_suffix): '''Generate the function to read pixels from a particular format''' @@ -305,6 +320,8 @@ def main(): print '#include "u_format_pack.h"' print +generate_srgb_tables() + type = Channel(FLOAT, False, 32) native_type = 'float' suffix = '4f' ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-no-nvidia-opcodes): gallium: Remove TGSI_OPCODE_UP2H/UP2US/ UP4B/UP4UB.
Module: Mesa Branch: gallium-no-nvidia-opcodes Commit: 99be17a85522f252ad004612c863ab28e4e7bd42 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=99be17a85522f252ad004612c863ab28e4e7bd42 Author: Michal Krol Date: Mon Mar 1 18:27:44 2010 +0100 gallium: Remove TGSI_OPCODE_UP2H/UP2US/UP4B/UP4UB. --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c| 24 --- .../auxiliary/tgsi/tgsi-instruction-set.txt| 20 src/gallium/auxiliary/tgsi/tgsi_exec.c | 16 -- src/gallium/auxiliary/tgsi/tgsi_info.c |8 ++-- src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |4 -- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 16 -- src/gallium/docs/source/tgsi.rst | 32 src/gallium/drivers/cell/spu/spu_exec.c| 16 -- src/gallium/drivers/r300/r300_tgsi_to_rc.c |4 -- src/gallium/include/pipe/p_shader_tokens.h |5 +-- 10 files changed, 5 insertions(+), 140 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index c1ad0b7..497f328 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -1023,30 +1023,6 @@ emit_instruction( return 0; break; - case TGSI_OPCODE_UP2H: - /* deprecated */ - assert (0); - return 0; - break; - - case TGSI_OPCODE_UP2US: - /* deprecated */ - assert(0); - return 0; - break; - - case TGSI_OPCODE_UP4B: - /* deprecated */ - assert(0); - return 0; - break; - - case TGSI_OPCODE_UP4UB: - /* deprecated */ - assert(0); - return 0; - break; - case TGSI_OPCODE_X2D: /* deprecated? */ assert(0); diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt index 5f80655..008114d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt @@ -459,26 +459,6 @@ TGSI Instruction Specification TBD -1.5.26 UP2H - Unpack Two 16-Bit Floats - - TBD - - -1.5.27 UP2US - Unpack Two Unsigned 16-Bit Scalars - - TBD - - -1.5.28 UP4B - Unpack Four Signed 8-Bit Values - - TBD - - -1.5.29 UP4UB - Unpack Four Unsigned 8-Bit Scalars - - TBD - - 1.5.30 X2D - 2D Coordinate Transformation dst.x = src0.x + src1.x * src2.x + src1.y * src2.y diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index e0d2cdc..899265d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -2913,22 +2913,6 @@ exec_instruction( exec_tex(mach, inst, TEX_MODIFIER_PROJECTED); break; - case TGSI_OPCODE_UP2H: - assert (0); - break; - - case TGSI_OPCODE_UP2US: - assert (0); - break; - - case TGSI_OPCODE_UP4B: - assert (0); - break; - - case TGSI_OPCODE_UP4UB: - assert (0); - break; - case TGSI_OPCODE_X2D: FETCH(&r[0], 1, CHAN_X); FETCH(&r[1], 1, CHAN_Y); diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index f2a63d2..227c352 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -86,10 +86,10 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 2, 1, 0, 0, 0, "TEX", TGSI_OPCODE_TEX }, { 1, 4, 1, 0, 0, 0, "TXD", TGSI_OPCODE_TXD }, { 1, 2, 1, 0, 0, 0, "TXP", TGSI_OPCODE_TXP }, - { 1, 1, 0, 0, 0, 0, "UP2H", TGSI_OPCODE_UP2H }, - { 1, 1, 0, 0, 0, 0, "UP2US", TGSI_OPCODE_UP2US }, - { 1, 1, 0, 0, 0, 0, "UP4B", TGSI_OPCODE_UP4B }, - { 1, 1, 0, 0, 0, 0, "UP4UB", TGSI_OPCODE_UP4UB }, + { 0, 0, 0, 0, 0, 0, "", 55 }, /* removed */ + { 0, 0, 0, 0, 0, 0, "", 56 }, /* removed */ + { 0, 0, 0, 0, 0, 0, "", 57 }, /* removed */ + { 0, 0, 0, 0, 0, 0, "", 58 }, /* removed */ { 1, 3, 0, 0, 0, 0, "X2D", TGSI_OPCODE_X2D }, { 1, 1, 0, 0, 0, 0, "ARA", TGSI_OPCODE_ARA }, { 1, 1, 0, 0, 0, 0, "ARR", TGSI_OPCODE_ARR }, diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h index 58bb445..69b1573 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h +++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h @@ -85,10 +85,6 @@ OP12(SNE) OP12_TEX(TEX) OP14_TEX(TXD) OP12_TEX(TXP) -OP11(UP2H) -OP11(UP2US) -OP11(UP4B) -OP11(UP4UB) OP13(X2D) OP11(ARA) OP11(ARR) diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 8600d74..4765bf6 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -2296,22 +2296,6 @@ emit_instruction( return 0; break; - case TGSI_OPCODE_UP2H: - return 0; - break; - - case TGSI_OPCODE_UP2US: -
Mesa (gallium-no-nvidia-opcodes): gallium: Remove TGSI_OPCODE_SFL/STR.
Module: Mesa Branch: gallium-no-nvidia-opcodes Commit: 02c51967741b8d4c767ff49f9f187c551bec69ae URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=02c51967741b8d4c767ff49f9f187c551bec69ae Author: Michal Krol Date: Mon Mar 1 18:23:11 2010 +0100 gallium: Remove TGSI_OPCODE_SFL/STR. --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c| 12 -- .../auxiliary/tgsi/tgsi-instruction-set.txt| 16 -- src/gallium/auxiliary/tgsi/tgsi_exec.c | 12 -- src/gallium/auxiliary/tgsi/tgsi_info.c |4 +- src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |2 - src/gallium/auxiliary/tgsi/tgsi_sse2.c |8 --- src/gallium/docs/source/tgsi.rst | 22 src/gallium/drivers/cell/spu/spu_exec.c|8 --- src/gallium/drivers/nv40/nv40_fragprog.c |6 - src/gallium/drivers/r300/r300_tgsi_to_rc.c |2 - src/gallium/include/pipe/p_shader_tokens.h |4 +- 11 files changed, 4 insertions(+), 92 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 8a1c9ec..c1ad0b7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -979,12 +979,6 @@ emit_instruction( } break; - case TGSI_OPCODE_SFL: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { - dst0[chan_index] = bld->base.zero; - } - break; - case TGSI_OPCODE_SGT: FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { src0 = emit_fetch( bld, inst, 0, chan_index ); @@ -1020,12 +1014,6 @@ emit_instruction( } break; - case TGSI_OPCODE_STR: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { - dst0[chan_index] = bld->base.one; - } - break; - case TGSI_OPCODE_TEX: emit_tex( bld, inst, FALSE, FALSE, dst0 ); break; diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt index 0d53ff5..5f80655 100644 --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt @@ -412,14 +412,6 @@ TGSI Instruction Specification dst.w = (src0.w == src1.w) ? 1.0 : 0.0 -1.5.17 SFL - Set On False - - dst.x = 0.0 - dst.y = 0.0 - dst.z = 0.0 - dst.w = 0.0 - - 1.5.18 SGT - Set On Greater Than dst.x = (src0.x > src1.x) ? 1.0 : 0.0 @@ -452,14 +444,6 @@ TGSI Instruction Specification dst.w = (src0.w != src1.w) ? 1.0 : 0.0 -1.5.22 STR - Set On True - - dst.x = 1.0 - dst.y = 1.0 - dst.z = 1.0 - dst.w = 1.0 - - 1.5.23 TEX - Texture Lookup TBD diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 939786c..e0d2cdc 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -2860,12 +2860,6 @@ exec_instruction( exec_vector_binary(mach, inst, micro_seq, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; - case TGSI_OPCODE_SFL: - FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { - STORE(&mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], 0, chan_index); - } - break; - case TGSI_OPCODE_SGT: exec_vector_binary(mach, inst, micro_sgt, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; @@ -2882,12 +2876,6 @@ exec_instruction( exec_vector_binary(mach, inst, micro_sne, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; - case TGSI_OPCODE_STR: - FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { - STORE(&mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, chan_index); - } - break; - case TGSI_OPCODE_TEX: /* simple texture lookup */ /* src[0] = texcoord */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index b858ff9..f2a63d2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -77,12 +77,12 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 0, 0, 0, 0, 0, 0, "", 43 }, /* removed */ { 1, 2, 0, 0, 0, 0, "RFL", TGSI_OPCODE_RFL }, { 1, 2, 0, 0, 0, 0, "SEQ", TGSI_OPCODE_SEQ }, - { 1, 2, 0, 0, 0, 0, "SFL", TGSI_OPCODE_SFL }, + { 0, 0, 0, 0, 0, 0, "", 46 }, /* removed */ { 1, 2, 0, 0, 0, 0, "SGT", TGSI_OPCODE_SGT }, { 1, 1, 0, 0, 0, 0, "SIN", TGSI_OPCODE_SIN }, { 1, 2, 0, 0, 0, 0, "SLE", TGSI_OPCODE_SLE }, { 1, 2, 0, 0, 0, 0, "SNE", TGSI_OPCODE_SNE }, - { 1, 2, 0, 0, 0, 0, "STR", TGSI_OPCODE_STR }, + { 0, 0, 0, 0, 0, 0, "", 51 }, /* removed */ { 1, 2, 1, 0, 0, 0, "TEX", TGSI_OPCODE_TEX }, { 1, 4, 1, 0, 0, 0, "TXD", TGSI_OPCODE_TXD }, { 1, 2, 1, 0, 0, 0, "TXP", TGSI_OPCODE_TXP }, diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h index
Mesa (gallium-no-nvidia-opcodes): gallium: Remove TGSI_OPCODE_PK2H/PK2US/ PK4B/PK4UB.
Module: Mesa Branch: gallium-no-nvidia-opcodes Commit: 5efeade4dc7ffe2d10b231b56fac60dbaa8aa0c8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5efeade4dc7ffe2d10b231b56fac60dbaa8aa0c8 Author: Michal Krol Date: Mon Mar 1 18:12:00 2010 +0100 gallium: Remove TGSI_OPCODE_PK2H/PK2US/PK4B/PK4UB. --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c| 16 .../auxiliary/tgsi/tgsi-instruction-set.txt| 20 src/gallium/auxiliary/tgsi/tgsi_exec.c | 16 src/gallium/auxiliary/tgsi/tgsi_info.c |8 src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |4 src/gallium/auxiliary/tgsi/tgsi_sse2.c | 16 src/gallium/docs/source/tgsi.rst | 20 src/gallium/drivers/cell/spu/spu_exec.c| 16 src/gallium/drivers/r300/r300_tgsi_to_rc.c |4 src/gallium/include/pipe/p_shader_tokens.h |5 + 10 files changed, 5 insertions(+), 120 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 4cf28a9..8a1c9ec 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -966,22 +966,6 @@ emit_instruction( emit_kil( bld, inst ); break; - case TGSI_OPCODE_PK2H: - return 0; - break; - - case TGSI_OPCODE_PK2US: - return 0; - break; - - case TGSI_OPCODE_PK4B: - return 0; - break; - - case TGSI_OPCODE_PK4UB: - return 0; - break; - case TGSI_OPCODE_RFL: return 0; break; diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt index 080fd4c..0d53ff5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt @@ -391,26 +391,6 @@ TGSI Instruction Specification Alias for LERP. -1.5.10 PK2H - Pack Two 16-bit Floats - - TBD - - -1.5.11 PK2US - Pack Two Unsigned 16-bit Scalars - - TBD - - -1.5.12 PK4B - Pack Four Signed 8-bit Scalars - - TBD - - -1.5.13 PK4UB - Pack Four Unsigned 8-bit Scalars - - TBD - - 1.5.14 POW - Power Alias for POWER. diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index f853ea2..939786c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -2807,22 +2807,6 @@ exec_instruction( exec_kil (mach, inst); break; - case TGSI_OPCODE_PK2H: - assert (0); - break; - - case TGSI_OPCODE_PK2US: - assert (0); - break; - - case TGSI_OPCODE_PK4B: - assert (0); - break; - - case TGSI_OPCODE_PK4UB: - assert (0); - break; - case TGSI_OPCODE_RFL: if (IS_CHANNEL_ENABLED(*inst, CHAN_X) || IS_CHANNEL_ENABLED(*inst, CHAN_Y) || diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index de0e09c..b858ff9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -71,10 +71,10 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 1, 0, 0, 0, 0, "DDX", TGSI_OPCODE_DDX }, { 1, 1, 0, 0, 0, 0, "DDY", TGSI_OPCODE_DDY }, { 0, 0, 0, 0, 0, 0, "KILP", TGSI_OPCODE_KILP }, - { 1, 1, 0, 0, 0, 0, "PK2H", TGSI_OPCODE_PK2H }, - { 1, 1, 0, 0, 0, 0, "PK2US", TGSI_OPCODE_PK2US }, - { 1, 1, 0, 0, 0, 0, "PK4B", TGSI_OPCODE_PK4B }, - { 1, 1, 0, 0, 0, 0, "PK4UB", TGSI_OPCODE_PK4UB }, + { 0, 0, 0, 0, 0, 0, "", 40 }, /* removed */ + { 0, 0, 0, 0, 0, 0, "", 41 }, /* removed */ + { 0, 0, 0, 0, 0, 0, "", 42 }, /* removed */ + { 0, 0, 0, 0, 0, 0, "", 43 }, /* removed */ { 1, 2, 0, 0, 0, 0, "RFL", TGSI_OPCODE_RFL }, { 1, 2, 0, 0, 0, 0, "SEQ", TGSI_OPCODE_SEQ }, { 1, 2, 0, 0, 0, 0, "SFL", TGSI_OPCODE_SFL }, diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h index e4af15c..a0e454b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h +++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h @@ -76,10 +76,6 @@ OP11(COS) OP11(DDX) OP11(DDY) OP00(KILP) -OP11(PK2H) -OP11(PK2US) -OP11(PK4B) -OP11(PK4UB) OP12(RFL) OP12(SEQ) OP12(SFL) diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index a85cc46..1ad9e46 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -2260,22 +2260,6 @@ emit_instruction( emit_kil( func, &inst->Src[0] ); break; - case TGSI_OPCODE_PK2H: - return 0; - break; - - case TGSI_OPCODE_PK2US: - return 0; - break; - - case TGSI_OPCODE_PK4B: - return 0; - break; - - case TGSI_OPCODE_PK4UB: - return 0; - break; - case T
Mesa (master): tgsi: Cleanup exec code for CLAMP, CMP and CND.
Module: Mesa Branch: master Commit: 9a2c4f907b87e81173f50222c4bc325064609392 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a2c4f907b87e81173f50222c4bc325064609392 Author: Michal Krol Date: Mon Mar 1 17:57:18 2010 +0100 tgsi: Cleanup exec code for CLAMP, CMP and CND. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 67 ++- 1 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 68566d3..f853ea2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -110,6 +110,42 @@ micro_ceil(union tgsi_exec_channel *dst, } static void +micro_clamp(union tgsi_exec_channel *dst, +const union tgsi_exec_channel *src0, +const union tgsi_exec_channel *src1, +const union tgsi_exec_channel *src2) +{ + dst->f[0] = src0->f[0] < src1->f[0] ? src1->f[0] : src0->f[0] > src2->f[0] ? src2->f[0] : src0->f[0]; + dst->f[1] = src0->f[1] < src1->f[1] ? src1->f[1] : src0->f[1] > src2->f[1] ? src2->f[1] : src0->f[1]; + dst->f[2] = src0->f[2] < src1->f[2] ? src1->f[2] : src0->f[2] > src2->f[2] ? src2->f[2] : src0->f[2]; + dst->f[3] = src0->f[3] < src1->f[3] ? src1->f[3] : src0->f[3] > src2->f[3] ? src2->f[3] : src0->f[3]; +} + +static void +micro_cmp(union tgsi_exec_channel *dst, + const union tgsi_exec_channel *src0, + const union tgsi_exec_channel *src1, + const union tgsi_exec_channel *src2) +{ + dst->f[0] = src0->f[0] < 0.0f ? src1->f[0] : src2->f[0]; + dst->f[1] = src0->f[1] < 0.0f ? src1->f[1] : src2->f[1]; + dst->f[2] = src0->f[2] < 0.0f ? src1->f[2] : src2->f[2]; + dst->f[3] = src0->f[3] < 0.0f ? src1->f[3] : src2->f[3]; +} + +static void +micro_cnd(union tgsi_exec_channel *dst, + const union tgsi_exec_channel *src0, + const union tgsi_exec_channel *src1, + const union tgsi_exec_channel *src2) +{ + dst->f[0] = src2->f[0] > 0.5f ? src0->f[0] : src1->f[0]; + dst->f[1] = src2->f[1] > 0.5f ? src0->f[1] : src1->f[1]; + dst->f[2] = src2->f[2] > 0.5f ? src0->f[2] : src1->f[2]; + dst->f[3] = src2->f[3] > 0.5f ? src0->f[3] : src1->f[3]; +} + +static void micro_cos(union tgsi_exec_channel *dst, const union tgsi_exec_channel *src) { @@ -2653,15 +2689,7 @@ exec_instruction( break; case TGSI_OPCODE_CND: - FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { - FETCH(&r[0], 0, chan_index); - FETCH(&r[1], 1, chan_index); - FETCH(&r[2], 2, chan_index); - micro_lt(&d[chan_index], &mach->Temps[TEMP_HALF_I].xyzw[TEMP_HALF_C], &r[2], &r[0], &r[1]); - } - FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { - STORE(&d[chan_index], 0, chan_index); - } + exec_vector_trinary(mach, inst, micro_cnd, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; case TGSI_OPCODE_DP2A: @@ -2673,16 +2701,7 @@ exec_instruction( break; case TGSI_OPCODE_CLAMP: - FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { - FETCH(&r[0], 0, chan_index); - FETCH(&r[1], 1, chan_index); - micro_max(&r[0], &r[0], &r[1]); - FETCH(&r[1], 2, chan_index); - micro_min(&d[chan_index], &r[0], &r[1]); - } - FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { - STORE(&d[chan_index], 0, chan_index); - } + exec_vector_trinary(mach, inst, micro_clamp, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; case TGSI_OPCODE_FLR: @@ -3076,15 +3095,7 @@ exec_instruction( break; case TGSI_OPCODE_CMP: - FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { - FETCH(&r[0], 0, chan_index); - FETCH(&r[1], 1, chan_index); - FETCH(&r[2], 2, chan_index); - micro_lt(&d[chan_index], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[1], &r[2]); - } - FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { - STORE(&d[chan_index], 0, chan_index); - } + exec_vector_trinary(mach, inst, micro_cmp, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; case TGSI_OPCODE_SCS: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-no-rhw-position): r300: Save viewport and clip states before invoking blitter.
Module: Mesa Branch: gallium-no-rhw-position Commit: b42455c4f48076eec34e383d5b9cc4670f2d048f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b42455c4f48076eec34e383d5b9cc4670f2d048f Author: Michal Krol Date: Mon Mar 1 17:07:03 2010 +0100 r300: Save viewport and clip states before invoking blitter. --- src/gallium/drivers/r300/r300_blit.c|2 ++ src/gallium/drivers/r300/r300_context.h |4 src/gallium/drivers/r300/r300_state.c |4 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index eb9b0be..ec7414d 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -34,6 +34,8 @@ static void r300_blitter_save_states(struct r300_context* r300) util_blitter_save_rasterizer(r300->blitter, r300->rs_state.state); util_blitter_save_fragment_shader(r300->blitter, r300->fs); util_blitter_save_vertex_shader(r300->blitter, r300->vs); +util_blitter_save_viewport(r300->blitter, &r300->viewport); +util_blitter_save_clip(r300->blitter, &r300->clip); } /* Clear currently bound buffers. */ diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 2f056aa..97100c0 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -333,6 +333,10 @@ struct r300_context { struct pipe_stencil_ref stencil_ref; +struct pipe_clip_state clip; + +struct pipe_viewport_state viewport; + /* Bitmask of dirty state objects. */ uint32_t dirty_state; /* Flag indicating whether or not the HW is dirty. */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 3550c69..ebb8591 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -376,6 +376,8 @@ static void r300_set_clip_state(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); +r300->clip = *state; + if (r300_screen(pipe->screen)->caps->has_tcl) { memcpy(r300->clip_state.state, state, sizeof(struct pipe_clip_state)); r300->clip_state.size = 29; @@ -986,6 +988,8 @@ static void r300_set_viewport_state(struct pipe_context* pipe, struct r300_viewport_state* viewport = (struct r300_viewport_state*)r300->viewport_state.state; +r300->viewport = *state; + /* Do the transform in HW. */ viewport->vte_control = R300_VTX_W0_FMT; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-no-rhw-position): util: Fix u_blitter setup code after bypass_vs_clip_and_viewport removal.
Module: Mesa Branch: gallium-no-rhw-position Commit: 932e6f8d527d2147ecc4e75ce9ae2f71e23e61af URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=932e6f8d527d2147ecc4e75ce9ae2f71e23e61af Author: Michal Krol Date: Mon Mar 1 17:06:20 2010 +0100 util: Fix u_blitter setup code after bypass_vs_clip_and_viewport removal. Not tested. --- src/gallium/auxiliary/util/u_blitter.c | 46 --- src/gallium/auxiliary/util/u_blitter.h | 16 +++ 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 50877f6..f93c69d 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -93,6 +93,12 @@ struct blitter_context_priv /* Rasterizer state. */ void *rs_state; + + /* Viewport state. */ + struct pipe_viewport_state viewport; + + /* Clip state. */ + struct pipe_clip_state clip; }; struct blitter_context *util_blitter_create(struct pipe_context *pipe) @@ -262,6 +268,9 @@ static void blitter_restore_CSOs(struct blitter_context_priv *ctx) pipe->set_stencil_ref(pipe, &ctx->blitter.saved_stencil_ref); + pipe->set_viewport_state(pipe, &ctx->blitter.saved_viewport); + pipe->set_clip_state(pipe, &ctx->blitter.saved_clip); + /* restore the state objects which are required to be saved before copy/fill */ if (ctx->blitter.saved_fb_state.nr_cbufs != ~0) { @@ -287,25 +296,40 @@ static void blitter_restore_CSOs(struct blitter_context_priv *ctx) static void blitter_set_rectangle(struct blitter_context_priv *ctx, unsigned x1, unsigned y1, unsigned x2, unsigned y2, + unsigned width, unsigned height, float depth) { int i; /* set vertex positions */ - ctx->vertices[0][0][0] = x1; /*v0.x*/ - ctx->vertices[0][0][1] = y1; /*v0.y*/ + ctx->vertices[0][0][0] = (float)x1 / width * 2.0f - 1.0f; /*v0.x*/ + ctx->vertices[0][0][1] = (float)y1 / height * 2.0f - 1.0f; /*v0.y*/ - ctx->vertices[1][0][0] = x2; /*v1.x*/ - ctx->vertices[1][0][1] = y1; /*v1.y*/ + ctx->vertices[1][0][0] = (float)x2 / width * 2.0f - 1.0f; /*v1.x*/ + ctx->vertices[1][0][1] = (float)y1 / height * 2.0f - 1.0f; /*v1.y*/ - ctx->vertices[2][0][0] = x2; /*v2.x*/ - ctx->vertices[2][0][1] = y2; /*v2.y*/ + ctx->vertices[2][0][0] = (float)x2 / width * 2.0f - 1.0f; /*v2.x*/ + ctx->vertices[2][0][1] = (float)y2 / height * 2.0f - 1.0f; /*v2.y*/ - ctx->vertices[3][0][0] = x1; /*v3.x*/ - ctx->vertices[3][0][1] = y2; /*v3.y*/ + ctx->vertices[3][0][0] = (float)x1 / width * 2.0f - 1.0f; /*v3.x*/ + ctx->vertices[3][0][1] = (float)y2 / height * 2.0f - 1.0f; /*v3.y*/ for (i = 0; i < 4; i++) ctx->vertices[i][0][2] = depth; /*z*/ + + /* viewport */ + ctx->viewport.scale[0] = 0.5f * width; + ctx->viewport.scale[1] = 0.5f * height; + ctx->viewport.scale[2] = 0.5f; + ctx->viewport.scale[3] = 1.0f; + ctx->viewport.translate[0] = 0.5f * width; + ctx->viewport.translate[1] = 0.5f * height; + ctx->viewport.translate[2] = 0.5f; + ctx->viewport.translate[3] = 0.0f; + ctx->pipe->set_viewport_state(ctx->pipe, &ctx->viewport); + + /* clip */ + ctx->pipe->set_clip_state(ctx->pipe, &ctx->clip); } static void blitter_set_clear_color(struct blitter_context_priv *ctx, @@ -549,7 +573,7 @@ void util_blitter_clear(struct blitter_context *blitter, pipe->bind_vs_state(pipe, ctx->vs_col); blitter_set_clear_color(ctx, rgba); - blitter_set_rectangle(ctx, 0, 0, width, height, depth); + blitter_set_rectangle(ctx, 0, 0, width, height, width, height, depth); blitter_draw_quad(ctx); blitter_restore_CSOs(ctx); } @@ -632,7 +656,7 @@ static void util_blitter_do_copy(struct blitter_context *blitter, assert(0); } - blitter_set_rectangle(ctx, dstx, dsty, dstx+width, dsty+height, 0); + blitter_set_rectangle(ctx, dstx, dsty, dstx+width, dsty+height, dst->width, dst->height, 0); blitter_draw_quad(ctx); } @@ -793,7 +817,7 @@ void util_blitter_fill(struct blitter_context *blitter, pipe->set_framebuffer_state(pipe, &fb_state); blitter_set_clear_color(ctx, rgba); - blitter_set_rectangle(ctx, 0, 0, width, height, 0); + blitter_set_rectangle(ctx, 0, 0, width, height, dst->width, dst->height, 0); blitter_draw_quad(ctx); blitter_restore_CSOs(ctx); } diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index a2f1707..92008fc 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -48,6 +48,8 @@ struct blitter_context struct pipe_framebuffer_state saved_fb_state; /**< framebuffer state */ struct pipe_stencil_ref saved_stencil_ref; /**< stencil ref */ + struct pipe_viewport_state saved_viewport; + struct pipe_clip_state
Mesa (gallium-sampler-view): docs: Document sampler view entry points.
Module: Mesa Branch: gallium-sampler-view Commit: e81caade02a51da65eb28eba6816503305a97920 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e81caade02a51da65eb28eba6816503305a97920 Author: Michal Krol Date: Thu Feb 25 15:33:15 2010 +0100 docs: Document sampler view entry points. --- src/gallium/docs/source/context.rst | 22 ++ 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 827db83..2d495f5 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -39,10 +39,24 @@ buffers, surfaces) are bound to the driver. are mostly restricted to the first one right now). * ``set_framebuffer_state`` -* ``set_fragment_sampler_views`` -* ``set_vertex_sampler_views`` -* ``create_sampler_view`` -* ``sampler_view_destroy`` + +* ``set_fragment_sampler_views`` binds an array of sampler views to + fragment shader stage. Every binding point acquires a reference + to a respective sampler view and releases a reference to the previous + sampler view. + +* ``set_vertex_sampler_views`` binds an array of sampler views to vertex + shader stage. Every binding point acquires a reference to a respective + sampler view and releases a reference to the previous sampler view. + +* ``create_sampler_view`` creates a new sampler view. texture is associated + with the sampler view which results in sampler view holding a reference + to the texture. Format specified in template must be compatible + with texture format. + +* ``sampler_view_destroy`` destroys a sampler view and releases its reference + to associated texture. + * ``set_vertex_buffers`` ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): cell: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 9aeb206e17181dfba4a40a41dbfc11560269e942 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9aeb206e17181dfba4a40a41dbfc11560269e942 Author: Michal Krol Date: Thu Feb 25 15:16:18 2010 +0100 cell: Fix after sampler view changes. Did not test build. --- src/gallium/drivers/cell/ppu/cell_context.h|1 + src/gallium/drivers/cell/ppu/cell_pipe_state.c | 45 --- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/cell/ppu/cell_context.h b/src/gallium/drivers/cell/ppu/cell_context.h index a77cc5b..0724da9 100644 --- a/src/gallium/drivers/cell/ppu/cell_context.h +++ b/src/gallium/drivers/cell/ppu/cell_context.h @@ -121,6 +121,7 @@ struct cell_context struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; struct cell_texture *texture[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; uint num_textures; struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; diff --git a/src/gallium/drivers/cell/ppu/cell_pipe_state.c b/src/gallium/drivers/cell/ppu/cell_pipe_state.c index 3d8b440..e1cf9db 100644 --- a/src/gallium/drivers/cell/ppu/cell_pipe_state.c +++ b/src/gallium/drivers/cell/ppu/cell_pipe_state.c @@ -257,8 +257,9 @@ cell_delete_sampler_state(struct pipe_context *pipe, static void -cell_set_sampler_textures(struct pipe_context *pipe, - unsigned num, struct pipe_texture **texture) +cell_set_fragment_sampler_views(struct pipe_context *pipe, +unsigned num, +struct pipe_sampler_view **views) { struct cell_context *cell = cell_context(pipe); uint i, changed = 0x0; @@ -266,10 +267,14 @@ cell_set_sampler_textures(struct pipe_context *pipe, assert(num <= CELL_MAX_SAMPLERS); for (i = 0; i < CELL_MAX_SAMPLERS; i++) { - struct cell_texture *new_tex = cell_texture(i < num ? texture[i] : NULL); - struct cell_texture *old_tex = cell->texture[i]; - if (old_tex != new_tex) { + struct pipe_sampler_view *new_view = i < num ? views[i] : NULL; + struct pipe_sampler_view *old_view = cell->fragment_sampler_views[i]; + if (old_view != new_view) { + struct pipe_texture *new_tex = new_view ? new_view->texture : NULL; + + pipe_sampler_view_reference(&cell->fragment_sampler_views[i], + views[i]); pipe_texture_reference((struct pipe_texture **) &cell->texture[i], (struct pipe_texture *) new_tex); @@ -286,6 +291,32 @@ cell_set_sampler_textures(struct pipe_context *pipe, } +static struct pipe_sampler_view * +cell_create_sampler_view(struct pipe_context *pipe, + struct pipe_texture *texture, + const struct pipe_sampler_view *templ) +{ + struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); + + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + + return view; +} + + +static void +cell_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view) +{ + pipe_texture_reference(&view->texture, NULL); + FREE(view); +} + + /** * Map color and z/stencil framebuffer surfaces. */ @@ -399,7 +430,9 @@ cell_init_state_functions(struct cell_context *cell) cell->pipe.bind_fragment_sampler_states = cell_bind_sampler_states; cell->pipe.delete_sampler_state = cell_delete_sampler_state; - cell->pipe.set_fragment_sampler_textures = cell_set_sampler_textures; + cell->pipe.set_fragment_sampler_views = cell_set_fragment_sampler_views; + cell->pipe.create_sampler_view = cell_create_sampler_view; + cell->pipe.sampler_view_destroy = cell_sampler_view_destroy; cell->pipe.create_depth_stencil_alpha_state = cell_create_depth_stencil_alpha_state; cell->pipe.bind_depth_stencil_alpha_state = cell_bind_depth_stencil_alpha_state; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): tgsi: Remove dead code.
Module: Mesa Branch: master Commit: aa799fa2d0701fbaa968036c0c1964d00a530c6d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa799fa2d0701fbaa968036c0c1964d00a530c6d Author: Michal Krol Date: Thu Feb 25 15:01:10 2010 +0100 tgsi: Remove dead code. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 12 1 files changed, 0 insertions(+), 12 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 593c3cb..68566d3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -960,18 +960,6 @@ micro_pow( #endif } -#if 0 -static void -micro_sqrt( union tgsi_exec_channel *dst, -const union tgsi_exec_channel *src ) -{ - dst->f[0] = sqrtf( src->f[0] ); - dst->f[1] = sqrtf( src->f[1] ); - dst->f[2] = sqrtf( src->f[2] ); - dst->f[3] = sqrtf( src->f[3] ); -} -#endif - static void micro_sub(union tgsi_exec_channel *dst, const union tgsi_exec_channel *src0, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): nv50: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 6a8961a2479288df4ec736f94b8bf990c1fe0d72 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a8961a2479288df4ec736f94b8bf990c1fe0d72 Author: Michal Krol Date: Thu Feb 25 14:56:19 2010 +0100 nv50: Fix after sampler view changes. Did not test build. --- src/gallium/drivers/nv50/nv50_context.h |1 + src/gallium/drivers/nv50/nv50_state.c | 61 --- 2 files changed, 49 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index b4de3e2..7b87985 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -173,6 +173,7 @@ struct nv50_context { struct nv50_sampler_stateobj *sampler[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; unsigned sampler_nr[PIPE_SHADER_TYPES]; struct nv50_miptree *miptree[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; + struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; unsigned miptree_nr[PIPE_SHADER_TYPES]; uint16_t vbo_fifo; diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index 7d30490..8e5f166 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -269,33 +269,66 @@ nv50_sampler_state_delete(struct pipe_context *pipe, void *hwcso) } static INLINE void -nv50_set_sampler_texture(struct pipe_context *pipe, unsigned type, -unsigned nr, struct pipe_texture **pt) +nv50_set_sampler_views(struct pipe_context *pipe, + unsigned type, + unsigned nr, + struct pipe_sampler_view **views) { struct nv50_context *nv50 = nv50_context(pipe); unsigned i; - for (i = 0; i < nr; i++) - pipe_texture_reference((void *)&nv50->miptree[type][i], pt[i]); - for (i = nr; i < nv50->miptree_nr[type]; i++) + for (i = 0; i < nr; i++) { + pipe_sampler_view_reference(&nv50->sampler_views[type][i], views[i]); + pipe_texture_reference((void *)&nv50->miptree[type][i], views[i]->texture); + } + for (i = nr; i < nv50->miptree_nr[type]; i++) { + pipe_sampler_view_reference(&nv50->sampler_views[type][i], NULL); pipe_texture_reference((void *)&nv50->miptree[type][i], NULL); + } nv50->miptree_nr[type] = nr; nv50->dirty |= NV50_NEW_TEXTURE; } static void -nv50_set_vp_sampler_textures(struct pipe_context *pipe, -unsigned nr, struct pipe_texture **pt) +nv50_set_vp_sampler_views(struct pipe_context *pipe, + unsigned nr, + struct pipe_sampler_view **views) +{ + nv50_set_sampler_views(pipe, PIPE_SHADER_VERTEX, nr, views); +} + +static void +nv50_set_fp_sampler_views(struct pipe_context *pipe, + unsigned nr, + struct pipe_sampler_view **views) { - nv50_set_sampler_texture(pipe, PIPE_SHADER_VERTEX, nr, pt); + nv50_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, nr, views); } +static struct pipe_sampler_view * +nv50_create_sampler_view(struct pipe_context *pipe, +struct pipe_texture *texture, +const struct pipe_sampler_view *templ) +{ + struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); + + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + + return view; +} + + static void -nv50_set_fp_sampler_textures(struct pipe_context *pipe, -unsigned nr, struct pipe_texture **pt) +nv50_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view) { - nv50_set_sampler_texture(pipe, PIPE_SHADER_FRAGMENT, nr, pt); + pipe_texture_reference(&view->texture, NULL); + FREE(view); } static void * @@ -743,8 +776,10 @@ nv50_init_state_functions(struct nv50_context *nv50) nv50->pipe.delete_sampler_state = nv50_sampler_state_delete; nv50->pipe.bind_fragment_sampler_states = nv50_fp_sampler_state_bind; nv50->pipe.bind_vertex_sampler_states = nv50_vp_sampler_state_bind; - nv50->pipe.set_fragment_sampler_textures = nv50_set_fp_sampler_textures; - nv50->pipe.set_vertex_sampler_textures = nv50_set_vp_sampler_textures; + nv50->pipe.set_fragment_sampler_views = nv50_set_fp_sampler_views; + nv50->pipe.set_vertex_sampler_views = nv50_set_vp_sampler_views; + nv50->pipe.create_sampler_view = nv50_create_sampler_view; + nv50->pipe.sampler_view_destroy = nv50_sampler_view_destroy; nv50->pipe.create_rasterizer_state = nv50_rasterizer_state_create; nv50->pipe.bind_r
Mesa (gallium-sampler-view): nv30: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: e3c2a053cf4ac761d672ec64cb18c099b4ac3bc2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e3c2a053cf4ac761d672ec64cb18c099b4ac3bc2 Author: Michal Krol Date: Thu Feb 25 14:40:56 2010 +0100 nv30: Fix after sampler view changes. Did not test build. --- src/gallium/drivers/nv30/nv30_context.h |1 + src/gallium/drivers/nv30/nv30_state.c | 38 +++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h index ca3d6ac..0481352 100644 --- a/src/gallium/drivers/nv30/nv30_context.h +++ b/src/gallium/drivers/nv30/nv30_context.h @@ -138,6 +138,7 @@ struct nv30_context { unsigned idxbuf_format; struct nv30_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS]; struct nv30_miptree *tex_miptree[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; unsigned nr_samplers; unsigned nr_textures; unsigned dirty_samplers; diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c index d911c80..1d484ec 100644 --- a/src/gallium/drivers/nv30/nv30_state.c +++ b/src/gallium/drivers/nv30/nv30_state.c @@ -272,19 +272,22 @@ nv30_sampler_state_delete(struct pipe_context *pipe, void *hwcso) } static void -nv30_set_sampler_texture(struct pipe_context *pipe, unsigned nr, -struct pipe_texture **miptree) +nv30_set_fragment_sampler_views(struct pipe_context *pipe, + unsigned nr, + struct pipe_sampler_view **views) { struct nv30_context *nv30 = nv30_context(pipe); unsigned unit; for (unit = 0; unit < nr; unit++) { + pipe_sampler_view_reference(&nv30->fragment_sampler_views[unit], views[unit]); pipe_texture_reference((struct pipe_texture **) - &nv30->tex_miptree[unit], miptree[unit]); + &nv30->tex_miptree[unit], views[unit]->texture); nv30->dirty_samplers |= (1 << unit); } for (unit = nr; unit < nv30->nr_textures; unit++) { + pipe_sampler_view_reference(&nv30->fragment_sampler_views[unit], NULL); pipe_texture_reference((struct pipe_texture **) &nv30->tex_miptree[unit], NULL); nv30->dirty_samplers |= (1 << unit); @@ -294,6 +297,31 @@ nv30_set_sampler_texture(struct pipe_context *pipe, unsigned nr, nv30->dirty |= NV30_NEW_SAMPLER; } +static struct pipe_sampler_view * +nv30_create_sampler_view(struct pipe_context *pipe, +struct pipe_texture *texture, +const struct pipe_sampler_view *templ) +{ + struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); + + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + + return view; +} + + +static void +nv30_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view) +{ + pipe_texture_reference(&view->texture, NULL); + FREE(view); +} + static void * nv30_rasterizer_state_create(struct pipe_context *pipe, const struct pipe_rasterizer_state *cso) @@ -692,7 +720,9 @@ nv30_init_state_functions(struct nv30_context *nv30) nv30->pipe.create_sampler_state = nv30_sampler_state_create; nv30->pipe.bind_fragment_sampler_states = nv30_sampler_state_bind; nv30->pipe.delete_sampler_state = nv30_sampler_state_delete; - nv30->pipe.set_fragment_sampler_textures = nv30_set_sampler_texture; + nv30->pipe.set_fragment_sampler_views = nv30_set_fragment_sampler_view; + nv30->pipe.create_sampler_view = nv30_create_sampler_view; + nv30->pipe.sampler_view_destroy = nv30_sampler_view_destroy; nv30->pipe.create_rasterizer_state = nv30_rasterizer_state_create; nv30->pipe.bind_rasterizer_state = nv30_rasterizer_state_bind; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): nv40: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 512d3e691e43b663932fcf22a8c333c79033cb8b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=512d3e691e43b663932fcf22a8c333c79033cb8b Author: Michal Krol Date: Thu Feb 25 14:46:31 2010 +0100 nv40: Fix after sampler view changes. Did not test build. --- src/gallium/drivers/nv40/nv40_context.h |1 + src/gallium/drivers/nv40/nv40_state.c | 38 +++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h index 4861924..3d41042 100644 --- a/src/gallium/drivers/nv40/nv40_context.h +++ b/src/gallium/drivers/nv40/nv40_context.h @@ -153,6 +153,7 @@ struct nv40_context { unsigned idxbuf_format; struct nv40_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS]; struct nv40_miptree *tex_miptree[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; unsigned nr_samplers; unsigned nr_textures; unsigned dirty_samplers; diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c index 4f28675..dbb52bf 100644 --- a/src/gallium/drivers/nv40/nv40_state.c +++ b/src/gallium/drivers/nv40/nv40_state.c @@ -282,19 +282,22 @@ nv40_sampler_state_delete(struct pipe_context *pipe, void *hwcso) } static void -nv40_set_sampler_texture(struct pipe_context *pipe, unsigned nr, -struct pipe_texture **miptree) +nv40_set_fragment_sampler_views(struct pipe_context *pipe, + unsigned nr, + struct pipe_sampler_view **views) { struct nv40_context *nv40 = nv40_context(pipe); unsigned unit; for (unit = 0; unit < nr; unit++) { + pipe_sampler_view_reference(&nv40->fragment_sampler_views[unit], views[unit]); pipe_texture_reference((struct pipe_texture **) - &nv40->tex_miptree[unit], miptree[unit]); + &nv40->tex_miptree[unit], views[unit]->texture); nv40->dirty_samplers |= (1 << unit); } for (unit = nr; unit < nv40->nr_textures; unit++) { + pipe_sampler_view_reference(&nv40->fragment_sampler_views[unit], NULL); pipe_texture_reference((struct pipe_texture **) &nv40->tex_miptree[unit], NULL); nv40->dirty_samplers |= (1 << unit); @@ -304,6 +307,31 @@ nv40_set_sampler_texture(struct pipe_context *pipe, unsigned nr, nv40->dirty |= NV40_NEW_SAMPLER; } +static struct pipe_sampler_view * +nv40_create_sampler_view(struct pipe_context *pipe, +struct pipe_texture *texture, +const struct pipe_sampler_view *templ) +{ + struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); + + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + + return view; +} + + +static void +nv40_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view) +{ + pipe_texture_reference(&view->texture, NULL); + FREE(view); +} + static void * nv40_rasterizer_state_create(struct pipe_context *pipe, const struct pipe_rasterizer_state *cso) @@ -707,7 +735,9 @@ nv40_init_state_functions(struct nv40_context *nv40) nv40->pipe.create_sampler_state = nv40_sampler_state_create; nv40->pipe.bind_fragment_sampler_states = nv40_sampler_state_bind; nv40->pipe.delete_sampler_state = nv40_sampler_state_delete; - nv40->pipe.set_fragment_sampler_textures = nv40_set_sampler_texture; + nv40->pipe.set_fragment_sampler_views = nv40_set_fragment_sampler_views; + nv40->pipe.create_sampler_view = nv40_create_sampler_view; + nv40->pipe.sampler_view_destroy = nv40_sampler_view_destroy; nv40->pipe.create_rasterizer_state = nv40_rasterizer_state_create; nv40->pipe.bind_rasterizer_state = nv40_rasterizer_state_bind; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): docs: Update after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 06f63457908a997828e93f3141ecdde59392b7d5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=06f63457908a997828e93f3141ecdde59392b7d5 Author: Michal Krol Date: Thu Feb 25 14:27:34 2010 +0100 docs: Update after sampler view changes. --- src/gallium/docs/source/context.rst |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 9080add..827db83 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -39,8 +39,10 @@ buffers, surfaces) are bound to the driver. are mostly restricted to the first one right now). * ``set_framebuffer_state`` -* ``set_fragment_sampler_textures`` -* ``set_vertex_sampler_textures`` +* ``set_fragment_sampler_views`` +* ``set_vertex_sampler_views`` +* ``create_sampler_view`` +* ``sampler_view_destroy`` * ``set_vertex_buffers`` ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): python: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 92a8c42baa64fbf8e1a986a0b820fe1744c1b3b3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=92a8c42baa64fbf8e1a986a0b820fe1744c1b3b3 Author: Michal Krol Date: Thu Feb 25 14:19:54 2010 +0100 python: Fix after sampler view changes. --- src/gallium/state_trackers/python/gallium.i |1 + src/gallium/state_trackers/python/p_context.i | 33 +++-- src/gallium/state_trackers/python/st_device.c | 32 ++-- src/gallium/state_trackers/python/st_device.h |4 +- 4 files changed, 52 insertions(+), 18 deletions(-) diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i index ffb084e..632d71c 100644 --- a/src/gallium/state_trackers/python/gallium.i +++ b/src/gallium/state_trackers/python/gallium.i @@ -49,6 +49,7 @@ #include "util/u_format.h" #include "util/u_dump.h" #include "util/u_memory.h" +#include "util/u_sampler.h" #include "cso_cache/cso_context.h" #include "tgsi/tgsi_text.h" #include "tgsi/tgsi_dump.h" diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 3f36ccb..85c9598 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -169,22 +169,39 @@ struct st_context { void set_fragment_sampler_texture(unsigned index, struct pipe_texture *texture) { + struct pipe_sampler_view templ; + if(!texture) texture = $self->default_texture; - pipe_texture_reference(&$self->fragment_sampler_textures[index], texture); - $self->pipe->set_fragment_sampler_textures($self->pipe, - PIPE_MAX_SAMPLERS, - $self->fragment_sampler_textures); + pipe_sampler_view_reference(&$self->fragment_sampler_views[index], NULL); + u_sampler_view_default_template(&templ, + texture, + texture->format); + $self->fragment_sampler_views[index] = $self->pipe->create_sampler_view($self->pipe, + texture, + &templ); + $self->pipe->set_fragment_sampler_views($self->pipe, + PIPE_MAX_SAMPLERS, + $self->fragment_sampler_views); } void set_vertex_sampler_texture(unsigned index, struct pipe_texture *texture) { + struct pipe_sampler_view templ; + if(!texture) texture = $self->default_texture; - pipe_texture_reference(&$self->vertex_sampler_textures[index], texture); - $self->pipe->set_vertex_sampler_textures($self->pipe, - PIPE_MAX_VERTEX_SAMPLERS, - $self->vertex_sampler_textures); + pipe_sampler_view_reference(&$self->vertex_sampler_views[index], NULL); + u_sampler_view_default_template(&templ, + texture, + texture->format); + $self->vertex_sampler_views[index] = $self->pipe->create_sampler_view($self->pipe, + texture, + &templ); + + $self->pipe->set_vertex_sampler_views($self->pipe, +PIPE_MAX_VERTEX_SAMPLERS, +$self->vertex_sampler_views); } void set_vertex_buffer(unsigned index, diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index a3798a5..d5a14fd 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -33,6 +33,7 @@ #include "cso_cache/cso_context.h" #include "util/u_math.h" #include "util/u_memory.h" +#include "util/u_sampler.h" #include "util/u_simple_shaders.h" #include "trace/tr_screen.h" #include "trace/tr_context.h" @@ -134,9 +135,9 @@ st_context_destroy(struct st_context *st_ctx) st_ctx->pipe->destroy(st_ctx->pipe); for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) - pipe_texture_reference(&st_ctx->fragment_sampler_textures[i], NULL); + pipe_sampler_view_reference(&st_ctx->fragment_sampler_views[i], NULL); for(i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; ++i) - pipe_texture_reference(&st_ctx->vertex_sampler_textures[i], NULL); + pipe_sampler_view_reference(&st_ctx->vertex_sampler_views[i], NULL); pipe_texture_reference(&st_ctx->default_texture, NULL); FREE(st_ctx); @@ -240,
Mesa (gallium-sampler-view): python: Fix typo.
Module: Mesa Branch: gallium-sampler-view Commit: 3e0181f47334534be081caa912a20d278fd07149 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e0181f47334534be081caa912a20d278fd07149 Author: Michal Krol Date: Thu Feb 25 14:21:50 2010 +0100 python: Fix typo. --- src/gallium/state_trackers/python/p_state.i|2 +- .../tests/regress/fragment-shader/frag-abs.png | Bin 0 -> 8750 bytes 2 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/gallium/state_trackers/python/p_state.i b/src/gallium/state_trackers/python/p_state.i index 5afe4d4..eda77b5 100644 --- a/src/gallium/state_trackers/python/p_state.i +++ b/src/gallium/state_trackers/python/p_state.i @@ -69,7 +69,7 @@ pipe_blend_state(const char *STRING, unsigned LENGTH) { struct pipe_blend_state *state; - state = CALLOC_STRUCT(pipe_framebuffer_state); + state = CALLOC_STRUCT(pipe_blend_state); if (state) { LENGTH = MIN2(sizeof *state, LENGTH); memcpy(state, STRING, LENGTH); diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.png b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.png new file mode 100644 index 000..c947a7b Binary files /dev/null and b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.png differ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): gallium: Silence compiler warnings.
Module: Mesa Branch: gallium-sampler-view Commit: 3a7314a78d2d239aef4032445c41e530ec13d3e0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a7314a78d2d239aef4032445c41e530ec13d3e0 Author: michal Date: Thu Dec 10 09:29:15 2009 +0100 gallium: Silence compiler warnings. --- src/gallium/drivers/i915/i915_state.c |1 - src/gallium/drivers/i965/brw_pipe_sampler.c |1 - src/gallium/drivers/softpipe/sp_state_sampler.c |3 --- src/gallium/drivers/svga/svga_pipe_sampler.c|3 --- 4 files changed, 0 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index b38d1b2..46703dc 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -596,7 +596,6 @@ i915_create_sampler_view(struct pipe_context *pipe, struct pipe_texture *texture, const struct pipe_sampler_view *templ) { - struct i915_context *i915 = i915_context(pipe); struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); *view = *templ; diff --git a/src/gallium/drivers/i965/brw_pipe_sampler.c b/src/gallium/drivers/i965/brw_pipe_sampler.c index fe1d18a..fbc3a07 100644 --- a/src/gallium/drivers/i965/brw_pipe_sampler.c +++ b/src/gallium/drivers/i965/brw_pipe_sampler.c @@ -217,7 +217,6 @@ brw_create_sampler_view(struct pipe_context *pipe, struct pipe_texture *texture, const struct pipe_sampler_view *templ) { - struct brw_context *brw = brw_context(pipe); struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); *view = *templ; diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index 5a92e22..8922941 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -126,7 +126,6 @@ softpipe_create_sampler_view(struct pipe_context *pipe, struct pipe_texture *texture, const struct pipe_sampler_view *templ) { - struct softpipe_context *softpipe = softpipe_context(pipe); struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); *view = *templ; @@ -143,8 +142,6 @@ void softpipe_sampler_view_destroy(struct pipe_context *pipe, struct pipe_sampler_view *view) { - struct softpipe_context *softpipe = softpipe_context(pipe); - pipe_texture_reference(&view->texture, NULL); FREE(view); } diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index 2687817..50fe962 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -181,7 +181,6 @@ svga_create_sampler_view(struct pipe_context *pipe, struct pipe_texture *texture, const struct pipe_sampler_view *templ) { - struct svga_context *softpipe = svga_context(pipe); struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); *view = *templ; @@ -198,8 +197,6 @@ static void svga_sampler_view_destroy(struct pipe_context *pipe, struct pipe_sampler_view *view) { - struct svga_context *svga = svga_context(pipe); - pipe_texture_reference(&view->texture, NULL); FREE(view); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): llvmpipe: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 1fb440beb9cccbe6f4bbd309792a89f6e1b4ee3f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1fb440beb9cccbe6f4bbd309792a89f6e1b4ee3f Author: michal Date: Thu Dec 10 09:23:15 2009 +0100 llvmpipe: Fix after sampler view changes. --- src/gallium/drivers/llvmpipe/lp_context.c | 10 ++-- src/gallium/drivers/llvmpipe/lp_context.h |8 ++-- src/gallium/drivers/llvmpipe/lp_setup.c | 12 +++-- src/gallium/drivers/llvmpipe/lp_setup.h |5 +- src/gallium/drivers/llvmpipe/lp_state.h | 23 ++--- src/gallium/drivers/llvmpipe/lp_state_derived.c | 12 ++-- src/gallium/drivers/llvmpipe/lp_state_fs.c |2 +- src/gallium/drivers/llvmpipe/lp_state_sampler.c | 63 --- 8 files changed, 88 insertions(+), 47 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index 9120226..0e385f8 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -68,11 +68,11 @@ static void llvmpipe_destroy( struct pipe_context *pipe ) pipe_surface_reference(&llvmpipe->framebuffer.zsbuf, NULL); for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - pipe_texture_reference(&llvmpipe->texture[i], NULL); + pipe_sampler_view_reference(&llvmpipe->fragment_sampler_views[i], NULL); } for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { - pipe_texture_reference(&llvmpipe->vertex_textures[i], NULL); + pipe_sampler_view_reference(&llvmpipe->vertex_sampler_views[i], NULL); } for (i = 0; i < Elements(llvmpipe->constants); i++) { @@ -152,8 +152,10 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv ) llvmpipe->pipe.set_framebuffer_state = llvmpipe_set_framebuffer_state; llvmpipe->pipe.set_polygon_stipple = llvmpipe_set_polygon_stipple; llvmpipe->pipe.set_scissor_state = llvmpipe_set_scissor_state; - llvmpipe->pipe.set_fragment_sampler_textures = llvmpipe_set_sampler_textures; - llvmpipe->pipe.set_vertex_sampler_textures = llvmpipe_set_vertex_sampler_textures; + llvmpipe->pipe.set_fragment_sampler_views = llvmpipe_set_fragment_sampler_views; + llvmpipe->pipe.set_vertex_sampler_views = llvmpipe_set_vertex_sampler_views; + llvmpipe->pipe.create_sampler_view = llvmpipe_create_sampler_view; + llvmpipe->pipe.sampler_view_destroy = llvmpipe_sampler_view_destroy; llvmpipe->pipe.set_viewport_state = llvmpipe_set_viewport_state; llvmpipe->pipe.set_vertex_buffers = llvmpipe_set_vertex_buffers; diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index 955c7eb..1b98e30 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -67,16 +67,16 @@ struct llvmpipe_context { struct pipe_framebuffer_state framebuffer; struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; - struct pipe_texture *texture[PIPE_MAX_SAMPLERS]; - struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; unsigned num_samplers; - unsigned num_textures; + unsigned num_fragment_sampler_views; unsigned num_vertex_samplers; - unsigned num_vertex_textures; + unsigned num_vertex_sampler_views; unsigned num_vertex_elements; unsigned num_vertex_buffers; diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index cb87366..7d52765 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -453,11 +453,12 @@ lp_setup_set_vertex_info( struct setup_context *setup, /** - * Called during state validation when LP_NEW_TEXTURE is set. + * Called during state validation when LP_NEW_SAMPLER_VIEW is set. */ void -lp_setup_set_sampler_textures( struct setup_context *setup, - unsigned num, struct pipe_texture **texture) +lp_setup_set_fragment_sampler_views(struct setup_context *setup, +unsigned num, +struct pipe_sampler_view **views) { unsigned i; @@ -466,9 +467,10 @@ lp_setup_set_sampler_textures( struct setup_context *setup, assert(num <= PIPE_MAX_SAMPLERS); for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - struct pipe_texture *tex = i < num ? texture[i] : NULL; + struct pipe_sampler_view *view = i < num ? views[i] : NULL; - if(tex) { + if(view) { + struct pipe_texture *tex = view->texture; struct llvmpipe_texture *lp_tex = llvmpipe_texture(tex); struct lp_jit_textu
Mesa (gallium-sampler-view): r300: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 3710a6f6cc84f46b6e1fb6a6a9f9eb6e7047c4e0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3710a6f6cc84f46b6e1fb6a6a9f9eb6e7047c4e0 Author: michal Date: Thu Dec 10 08:46:19 2009 +0100 r300: Fix after sampler view changes. --- src/gallium/drivers/r300/r300_blit.c|6 ++-- src/gallium/drivers/r300/r300_context.h |6 ++-- src/gallium/drivers/r300/r300_emit.c| 20 ++-- src/gallium/drivers/r300/r300_state.c | 54 -- 4 files changed, 59 insertions(+), 27 deletions(-) diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index eb9b0be..c48684f 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -108,9 +108,9 @@ static void r300_hw_copy(struct pipe_context* pipe, util_blitter_save_fragment_sampler_states( r300->blitter, r300->sampler_count, (void**)r300->sampler_states); -util_blitter_save_fragment_sampler_textures( -r300->blitter, r300->texture_count, -(struct pipe_texture**)r300->textures); +util_blitter_save_fragment_sampler_views( +r300->blitter, r300->fragment_sampler_view_count, +r300->fragment_sampler_views); /* Do a copy */ util_blitter_copy(r300->blitter, diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 1eba8a8..2edf657 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -300,9 +300,9 @@ struct r300_context { int sampler_count; /* Scissor state. */ struct r300_atom scissor_state; -/* Texture states. */ -struct r300_texture* textures[8]; -int texture_count; +/* Sampler view states. */ +struct pipe_sampler_view* fragment_sampler_views[8]; +int fragment_sampler_view_count; /* Vertex shader. */ struct r300_vertex_shader* vs; /* Viewport state. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 88fe166..4310ff1 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -159,7 +159,7 @@ static const float * get_shader_constant( /* Factor for converting rectangle coords to * normalized coords. Should only show up on non-r500. */ case RC_STATE_R300_TEXRECT_FACTOR: -tex = &r300->textures[constant->u.State[1]]->tex; +tex = r300->fragment_sampler_views[constant->u.State[1]]->texture; vec[0] = 1.0 / tex->width0; vec[1] = 1.0 / tex->height0; break; @@ -967,11 +967,11 @@ void r300_emit_texture_count(struct r300_context* r300) int i; CS_LOCALS(r300); -/* Notice that texture_count and sampler_count are just sizes +/* Notice that fragment_sampler_view_count and sampler_count are just sizes * of the respective arrays. We still have to check for the individual * elements. */ -for (i = 0; i < MIN2(r300->sampler_count, r300->texture_count); i++) { -if (r300->textures[i]) { +for (i = 0; i < MIN2(r300->sampler_count, r300->fragment_sampler_view_count); i++) { +if (r300->fragment_sampler_views[i]) { tx_enable |= 1 << i; } } @@ -1043,10 +1043,10 @@ validate: } } /* ...textures... */ -for (i = 0; i < r300->texture_count; i++) { -tex = r300->textures[i]; -if (!tex) +for (i = 0; i < r300->fragment_sampler_view_count; i++) { +if (!r300->fragment_sampler_views[i]) continue; +tex = (struct r300_texture *)r300->fragment_sampler_views[i]->texture; if (!r300->winsys->add_buffer(r300->winsys, tex->buffer, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) { r300->context.flush(&r300->context, 0, NULL); @@ -1145,13 +1145,13 @@ void r300_emit_dirty_state(struct r300_context* r300) (R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES)) { r300_emit_texture_count(r300); -for (i = 0; i < MIN2(r300->sampler_count, r300->texture_count); i++) { +for (i = 0; i < MIN2(r300->sampler_count, r300->fragment_sampler_view_count); i++) { if (r300->dirty_state & ((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i))) { - if (r300->textures[i]) { + if (r300->fragment_sampler_views[i]) { r300_emit_texture(r300, r300->sampler_states[i], - r300->textures[i], + (struct r300_texture *)r300->fragment_sampler_views[i]->texture, i); dirty_tex |= r300->dirty_state & (R300_NEW_TEXTURE << i); } diff --git a/src/gallium/drivers/
Mesa (gallium-sampler-view): i965: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 875f6d20b1180a4cafc747bd295b24ae1799a964 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=875f6d20b1180a4cafc747bd295b24ae1799a964 Author: michal Date: Thu Dec 10 08:05:45 2009 +0100 i965: Fix after sampler view changes. --- src/gallium/drivers/i965/brw_context.h |4 +- src/gallium/drivers/i965/brw_pipe_sampler.c | 53 +- src/gallium/drivers/i965/brw_wm.c |4 +- src/gallium/drivers/i965/brw_wm_sampler_state.c |8 ++-- src/gallium/drivers/i965/brw_wm_surface_state.c |6 +- 5 files changed, 52 insertions(+), 23 deletions(-) diff --git a/src/gallium/drivers/i965/brw_context.h b/src/gallium/drivers/i965/brw_context.h index 12cfa7b..8816714 100644 --- a/src/gallium/drivers/i965/brw_context.h +++ b/src/gallium/drivers/i965/brw_context.h @@ -550,11 +550,11 @@ struct brw_context const struct brw_sampler *sampler[PIPE_MAX_SAMPLERS]; unsigned num_samplers; - struct pipe_texture *texture[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; unsigned num_vertex_elements; - unsigned num_textures; + unsigned num_fragment_sampler_views; unsigned num_vertex_buffers; struct pipe_scissor_state scissor; diff --git a/src/gallium/drivers/i965/brw_pipe_sampler.c b/src/gallium/drivers/i965/brw_pipe_sampler.c index c7c0e2a..fe1d18a 100644 --- a/src/gallium/drivers/i965/brw_pipe_sampler.c +++ b/src/gallium/drivers/i965/brw_pipe_sampler.c @@ -183,26 +183,26 @@ static void brw_delete_sampler_state(struct pipe_context *pipe, FREE(cso); } -static void brw_set_sampler_textures(struct pipe_context *pipe, -unsigned num, -struct pipe_texture **texture) +static void brw_set_fragment_sampler_views(struct pipe_context *pipe, + unsigned num, + struct pipe_sampler_view **views) { struct brw_context *brw = brw_context(pipe); int i; for (i = 0; i < num; i++) - pipe_texture_reference(&brw->curr.texture[i], texture[i]); + pipe_sampler_view_reference(&brw->curr.fragment_sampler_views[i], views[i]); - for (i = num; i < brw->curr.num_textures; i++) - pipe_texture_reference(&brw->curr.texture[i], NULL); + for (i = num; i < brw->curr.num_fragment_sampler_views; i++) + pipe_sampler_view_reference(&brw->curr.fragment_sampler_views[i], NULL); - brw->curr.num_textures = num; + brw->curr.num_fragment_sampler_views = num; brw->state.dirty.mesa |= PIPE_NEW_BOUND_TEXTURES; } -static void brw_set_vertex_sampler_textures(struct pipe_context *pipe, -unsigned num, -struct pipe_texture **texture) +static void brw_set_vertex_sampler_views(struct pipe_context *pipe, + unsigned num, + struct pipe_sampler_view **views) { } @@ -212,17 +212,46 @@ static void brw_bind_vertex_sampler_state(struct pipe_context *pipe, } +static struct pipe_sampler_view * +brw_create_sampler_view(struct pipe_context *pipe, +struct pipe_texture *texture, +const struct pipe_sampler_view *templ) +{ + struct brw_context *brw = brw_context(pipe); + struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); + + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + + return view; +} + + +static void +brw_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view) +{ + pipe_texture_reference(&view->texture, NULL); + FREE(view); +} + + void brw_pipe_sampler_init( struct brw_context *brw ) { brw->base.create_sampler_state = brw_create_sampler_state; brw->base.delete_sampler_state = brw_delete_sampler_state; - brw->base.set_fragment_sampler_textures = brw_set_sampler_textures; + brw->base.set_fragment_sampler_views = brw_set_fragment_sampler_views; brw->base.bind_fragment_sampler_states = brw_bind_sampler_state; - brw->base.set_vertex_sampler_textures = brw_set_vertex_sampler_textures; + brw->base.set_vertex_sampler_views = brw_set_vertex_sampler_views; brw->base.bind_vertex_sampler_states = brw_bind_vertex_sampler_state; + brw->base.create_sampler_view = brw_create_sampler_view; + brw->base.sampler_view_destroy = brw_sampler_view_destroy; } void brw_pipe_sampler_cleanup( struct brw_context *brw ) { diff --git a/src/gallium/drivers/i965/brw_wm.c b/src/gallium/drivers/i965/brw_wm.c index 5164c90..3724adc 100
Mesa (gallium-sampler-view): i915: Fix for sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 1f5285f99771243b636deb9ae0a17c54f818fac6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f5285f99771243b636deb9ae0a17c54f818fac6 Author: michal Date: Thu Dec 10 07:52:45 2009 +0100 i915: Fix for sampler view changes. --- src/gallium/drivers/i915/i915_context.h |6 +- src/gallium/drivers/i915/i915_state.c | 54 +++-- src/gallium/drivers/i915/i915_state_derived.c |4 +- src/gallium/drivers/i915/i915_state_emit.c|3 +- src/gallium/drivers/i915/i915_state_sampler.c | 18 +--- 5 files changed, 59 insertions(+), 26 deletions(-) diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index da769e7..cd6dcd5 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -239,14 +239,14 @@ struct i915_context struct pipe_framebuffer_state framebuffer; struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; - struct i915_texture *texture[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; unsigned dirty; unsigned num_samplers; - unsigned num_textures; + unsigned num_fragment_sampler_views; unsigned num_vertex_elements; unsigned num_vertex_buffers; @@ -276,7 +276,7 @@ struct i915_context #define I915_NEW_ALPHA_TEST0x100 #define I915_NEW_DEPTH_STENCIL 0x200 #define I915_NEW_SAMPLER 0x400 -#define I915_NEW_TEXTURE 0x800 +#define I915_NEW_SAMPLER_VIEW 0x800 #define I915_NEW_CONSTANTS 0x1000 #define I915_NEW_VBO 0x2000 #define I915_NEW_VS0x4000 diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 6216991..b38d1b2 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -560,9 +560,9 @@ static void i915_set_constant_buffer(struct pipe_context *pipe, } -static void i915_set_sampler_textures(struct pipe_context *pipe, - unsigned num, - struct pipe_texture **texture) +static void i915_set_fragment_sampler_views(struct pipe_context *pipe, +unsigned num, +struct pipe_sampler_view **views) { struct i915_context *i915 = i915_context(pipe); uint i; @@ -570,27 +570,53 @@ static void i915_set_sampler_textures(struct pipe_context *pipe, assert(num <= PIPE_MAX_SAMPLERS); /* Check for no-op */ - if (num == i915->num_textures && - !memcmp(i915->texture, texture, num * sizeof(struct pipe_texture *))) + if (num == i915->num_fragment_sampler_views && + !memcmp(i915->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) return; /* Fixes wrong texture in texobj with VBUF */ draw_flush(i915->draw); for (i = 0; i < num; i++) - pipe_texture_reference((struct pipe_texture **) &i915->texture[i], - texture[i]); + pipe_sampler_view_reference(&i915->fragment_sampler_views[i], + views[i]); - for (i = num; i < i915->num_textures; i++) - pipe_texture_reference((struct pipe_texture **) &i915->texture[i], - NULL); + for (i = num; i < i915->num_fragment_sampler_views; i++) + pipe_sampler_view_reference(&i915->fragment_sampler_views[i], + NULL); - i915->num_textures = num; + i915->num_fragment_sampler_views = num; - i915->dirty |= I915_NEW_TEXTURE; + i915->dirty |= I915_NEW_SAMPLER_VIEW; } +static struct pipe_sampler_view * +i915_create_sampler_view(struct pipe_context *pipe, + struct pipe_texture *texture, + const struct pipe_sampler_view *templ) +{ + struct i915_context *i915 = i915_context(pipe); + struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); + + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + + return view; +} + + +static void +i915_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view) +{ + pipe_texture_reference(&view->texture, NULL); + FREE(view); +} + static void i915_set_framebuffer_state(struct pipe_context *pipe, const struct pipe_framebuffer_state *fb) @@ -791,7 +817,9 @@ i915_init_state_functions( struct i915_context *i915 ) i915->base.set_polygon_stipple = i915_set_polygon_stipple; i915->base.set_scissor_state = i915_set_scissor_state; - i915->base.set_fragment_sampler_textures = i915_set_sampler_textures; + i915
Mesa (gallium-no-rhw-position): util: Fix blitter vertex and viewport setup .
Module: Mesa Branch: gallium-no-rhw-position Commit: 235c6bdf6dc0a687a7313f948444c4294abc0ea1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=235c6bdf6dc0a687a7313f948444c4294abc0ea1 Author: Michal Krol Date: Thu Feb 25 10:22:30 2010 +0100 util: Fix blitter vertex and viewport setup. --- src/gallium/auxiliary/util/u_blit.c | 27 +-- 1 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 95567d0..0b263a9 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -426,11 +426,11 @@ util_blit_pixels_writemask(struct blit_state *ctx, /* viewport */ ctx->viewport.scale[0] = 0.5f * dst->width; ctx->viewport.scale[1] = 0.5f * dst->height; - ctx->viewport.scale[2] = 1.0f; + ctx->viewport.scale[2] = 0.5f; ctx->viewport.scale[3] = 1.0f; ctx->viewport.translate[0] = 0.5f * dst->width; ctx->viewport.translate[1] = 0.5f * dst->height; - ctx->viewport.translate[2] = 0.0f; + ctx->viewport.translate[2] = 0.5f; ctx->viewport.translate[3] = 0.0f; cso_set_viewport(ctx->cso, &ctx->viewport); @@ -456,8 +456,10 @@ util_blit_pixels_writemask(struct blit_state *ctx, /* draw quad */ offset = setup_vertex_data_tex(ctx, - (float) dstX0, (float) dstY0, - (float) dstX1, (float) dstY1, + (float) dstX0 / dst->width * 2.0f - 1.0f, + (float) dstY0 / dst->height * 2.0f - 1.0f, + (float) dstX1 / dst->width * 2.0f - 1.0f, + (float) dstY1 / dst->height * 2.0f - 1.0f, s0, t0, s1, t1, z); @@ -575,6 +577,17 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_single_sampler(ctx->cso, 0, &ctx->sampler); cso_single_sampler_done(ctx->cso); + /* viewport */ + ctx->viewport.scale[0] = 0.5f * dst->width; + ctx->viewport.scale[1] = 0.5f * dst->height; + ctx->viewport.scale[2] = 0.5f; + ctx->viewport.scale[3] = 1.0f; + ctx->viewport.translate[0] = 0.5f * dst->width; + ctx->viewport.translate[1] = 0.5f * dst->height; + ctx->viewport.translate[2] = 0.5f; + ctx->viewport.translate[3] = 0.0f; + cso_set_viewport(ctx->cso, &ctx->viewport); + /* texture */ cso_set_sampler_textures(ctx->cso, 1, &tex); @@ -592,8 +605,10 @@ util_blit_pixels_tex(struct blit_state *ctx, /* draw quad */ offset = setup_vertex_data_tex(ctx, - (float) dstX0, (float) dstY0, - (float) dstX1, (float) dstY1, + (float) dstX0 / dst->width * 2.0f - 1.0f, + (float) dstY0 / dst->height * 2.0f - 1.0f, + (float) dstX1 / dst->width * 2.0f - 1.0f, + (float) dstY1 / dst->height * 2.0f - 1.0f, s0, t0, s1, t1, z); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-no-rhw-position): cso: Track clip state with cso context.
Module: Mesa Branch: gallium-no-rhw-position Commit: 227ae7b968c1351921babdbf6f052239766ffce4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=227ae7b968c1351921babdbf6f052239766ffce4 Author: Michal Krol Date: Wed Feb 24 15:16:54 2010 +0100 cso: Track clip state with cso context. --- src/gallium/auxiliary/cso_cache/cso_context.c | 54 + src/gallium/auxiliary/cso_cache/cso_context.h | 13 ++ 2 files changed, 67 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index b5241fa..a7335c3 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -90,6 +90,9 @@ struct cso_context { void *fragment_shader, *fragment_shader_saved, *geometry_shader; void *vertex_shader, *vertex_shader_saved, *geometry_shader_saved; + struct pipe_clip_state clip; + struct pipe_clip_state clip_saved; + struct pipe_framebuffer_state fb, fb_saved; struct pipe_viewport_state vp, vp_saved; struct pipe_blend_color blend_color; @@ -1126,3 +1129,54 @@ void cso_restore_geometry_shader(struct cso_context *ctx) } ctx->geometry_shader_saved = NULL; } + + +/* clip state */ + +static INLINE void +clip_state_cpy(struct pipe_clip_state *dst, + const struct pipe_clip_state *src) +{ + dst->nr = src->nr; + if (src->nr) { + memcpy(dst->ucp, src->ucp, src->nr * sizeof(src->ucp[0])); + } +} + +static INLINE int +clip_state_cmp(const struct pipe_clip_state *a, + const struct pipe_clip_state *b) +{ + if (a->nr != b->nr) { + return 1; + } + if (a->nr) { + return memcmp(a->ucp, b->ucp, a->nr * sizeof(a->ucp[0])); + } + return 0; +} + +void +cso_set_clip(struct cso_context *ctx, + const struct pipe_clip_state *clip) +{ + if (clip_state_cmp(&ctx->clip, clip)) { + clip_state_cpy(&ctx->clip, clip); + ctx->pipe->set_clip_state(ctx->pipe, clip); + } +} + +void +cso_save_clip(struct cso_context *ctx) +{ + clip_state_cpy(&ctx->clip_saved, &ctx->clip); +} + +void +cso_restore_clip(struct cso_context *ctx) +{ + if (clip_state_cmp(&ctx->clip, &ctx->clip_saved)) { + clip_state_cpy(&ctx->clip, &ctx->clip_saved); + ctx->pipe->set_clip_state(ctx->pipe, &ctx->clip_saved); + } +} diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 707b3c2..251a9a6 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -180,6 +180,19 @@ void cso_save_stencil_ref(struct cso_context *cso); void cso_restore_stencil_ref(struct cso_context *cso); +/* clip state */ + +void +cso_set_clip(struct cso_context *cso, + const struct pipe_clip_state *clip); + +void +cso_save_clip(struct cso_context *cso); + +void +cso_restore_clip(struct cso_context *cso); + + #ifdef __cplusplus } #endif ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-no-rhw-position): util: Reset clip state when doing blitting.
Module: Mesa Branch: gallium-no-rhw-position Commit: 5b3f8369c693e75d1dbc7587e4e0d77934c0cd77 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b3f8369c693e75d1dbc7587e4e0d77934c0cd77 Author: Michal Krol Date: Wed Feb 24 15:48:30 2010 +0100 util: Reset clip state when doing blitting. --- src/gallium/auxiliary/util/u_blit.c |8 +++- src/gallium/auxiliary/util/u_gen_mipmap.c |4 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 90a3230..95567d0 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -62,6 +62,7 @@ struct blit_state struct pipe_rasterizer_state rasterizer; struct pipe_sampler_state sampler; struct pipe_viewport_state viewport; + struct pipe_clip_state clip; void *vs; void *fs[TGSI_WRITEMASK_XYZW + 1]; @@ -264,7 +265,6 @@ regions_overlap(int srcX0, int srcY0, * \param writemask controls which channels in the dest surface are sourced * from the src surface. Disabled channels are sourced * from (0,0,0,1). - * XXX what about clipping??? * XXX need some control over blitting Z and/or stencil. */ void @@ -409,11 +409,13 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_save_framebuffer(ctx->cso); cso_save_fragment_shader(ctx->cso); cso_save_vertex_shader(ctx->cso); + cso_save_clip(ctx->cso); /* set misc state we care about */ cso_set_blend(ctx->cso, &ctx->blend); cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); + cso_set_clip(ctx->cso, &ctx->clip); /* sampler */ ctx->sampler.min_img_filter = filter; @@ -475,6 +477,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); cso_restore_vertex_shader(ctx->cso); + cso_restore_clip(ctx->cso); pipe_texture_reference(&tex, NULL); } @@ -558,11 +561,13 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_save_framebuffer(ctx->cso); cso_save_fragment_shader(ctx->cso); cso_save_vertex_shader(ctx->cso); + cso_save_clip(ctx->cso); /* set misc state we care about */ cso_set_blend(ctx->cso, &ctx->blend); cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); + cso_set_clip(ctx->cso, &ctx->clip); /* sampler */ ctx->sampler.min_img_filter = filter; @@ -607,4 +612,5 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); cso_restore_vertex_shader(ctx->cso); + cso_restore_clip(ctx->cso); } diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 4f9ff1d..f423882 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -61,6 +61,7 @@ struct gen_mipmap_state struct pipe_depth_stencil_alpha_state depthstencil; struct pipe_rasterizer_state rasterizer; struct pipe_sampler_state sampler; + struct pipe_clip_state clip; void *vs; void *fs2d, *fsCube; @@ -1499,11 +1500,13 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_save_fragment_shader(ctx->cso); cso_save_vertex_shader(ctx->cso); cso_save_viewport(ctx->cso); + cso_save_clip(ctx->cso); /* bind our state */ cso_set_blend(ctx->cso, &ctx->blend); cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); + cso_set_clip(ctx->cso, &ctx->clip); cso_set_fragment_shader_handle(ctx->cso, fs); cso_set_vertex_shader_handle(ctx->cso, ctx->vs); @@ -1589,4 +1592,5 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_restore_fragment_shader(ctx->cso); cso_restore_vertex_shader(ctx->cso); cso_restore_viewport(ctx->cso); + cso_restore_clip(ctx->cso); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-no-rhw-position): st/mesa: Reset clip state when clearing with quads.
Module: Mesa Branch: gallium-no-rhw-position Commit: a9aa811af01273cef8a73118abdc87313f365ad3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9aa811af01273cef8a73118abdc87313f365ad3 Author: Michal Krol Date: Wed Feb 24 16:41:18 2010 +0100 st/mesa: Reset clip state when clearing with quads. --- src/mesa/state_tracker/st_cb_clear.c |6 +- src/mesa/state_tracker/st_context.h |1 + 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 5edab55..9e66eed 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -62,7 +62,8 @@ st_init_clear(struct st_context *st) { struct pipe_context *pipe = st->pipe; - memset(&st->clear.raster, 0, sizeof(st->clear.raster)); + memset(&st->clear, 0, sizeof(st->clear)); + st->clear.raster.gl_rasterization_rules = 1; /* fragment shader state: color pass-through program */ @@ -209,6 +210,7 @@ clear_with_quad(GLcontext *ctx, cso_save_depth_stencil_alpha(st->cso_context); cso_save_rasterizer(st->cso_context); cso_save_viewport(st->cso_context); + cso_save_clip(st->cso_context); cso_save_fragment_shader(st->cso_context); cso_save_vertex_shader(st->cso_context); @@ -279,6 +281,7 @@ clear_with_quad(GLcontext *ctx, cso_set_viewport(st->cso_context, &vp); } + cso_set_clip(st->cso_context, &st->clear.clip); cso_set_fragment_shader_handle(st->cso_context, st->clear.fs); cso_set_vertex_shader_handle(st->cso_context, st->clear.vs); @@ -291,6 +294,7 @@ clear_with_quad(GLcontext *ctx, cso_restore_depth_stencil_alpha(st->cso_context); cso_restore_rasterizer(st->cso_context); cso_restore_viewport(st->cso_context); + cso_restore_clip(st->cso_context); cso_restore_fragment_shader(st->cso_context); cso_restore_vertex_shader(st->cso_context); } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 13b7b0e..045c029 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -166,6 +166,7 @@ struct st_context struct { struct pipe_rasterizer_state raster; struct pipe_viewport_state viewport; + struct pipe_clip_state clip; void *vs; void *fs; float vertices[4][2][4]; /**< vertex pos + color */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-no-rhw-position): st/mesa: Use cso context to manage clip state.
Module: Mesa Branch: gallium-no-rhw-position Commit: 8039ee09b8c78a70c1c50207cce9a7bb4cffc675 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8039ee09b8c78a70c1c50207cce9a7bb4cffc675 Author: Michal Krol Date: Wed Feb 24 15:28:41 2010 +0100 st/mesa: Use cso context to manage clip state. --- src/mesa/state_tracker/st_atom_clip.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_clip.c b/src/mesa/state_tracker/st_atom_clip.c index 23d709b..80c0e92 100644 --- a/src/mesa/state_tracker/st_atom_clip.c +++ b/src/mesa/state_tracker/st_atom_clip.c @@ -35,6 +35,8 @@ #include "pipe/p_context.h" #include "st_atom.h" +#include "cso_cache/cso_context.h" + /* Second state atom for user clip planes: */ @@ -56,7 +58,7 @@ static void update_clip( struct st_context *st ) if (memcmp(&clip, &st->state.clip, sizeof(clip)) != 0) { st->state.clip = clip; - st->pipe->set_clip_state(st->pipe, &clip); + cso_set_clip(st->cso_context, &clip); } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): trace: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 92b781c2dda9ae5aeec7e32cfc9902057edd0a9d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=92b781c2dda9ae5aeec7e32cfc9902057edd0a9d Author: Michal Krol Date: Tue Feb 23 19:18:27 2010 +0100 trace: Fix after sampler view changes. --- src/gallium/drivers/trace/tr_context.c | 59 src/gallium/drivers/trace/tr_texture.h |2 - 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 6293dd7..c84cbd0 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -25,6 +25,7 @@ * **/ +#include "util/u_inlines.h" #include "util/u_memory.h" #include "util/u_simple_list.h" @@ -949,6 +950,62 @@ trace_context_set_viewport_state(struct pipe_context *_pipe, } +static struct pipe_sampler_view * +trace_create_sampler_view(struct pipe_context *_pipe, + struct pipe_texture *_texture, + const struct pipe_sampler_view *templ) +{ + struct trace_context *tr_ctx = trace_context(_pipe); + struct trace_texture *tr_tex = trace_texture(_texture); + struct pipe_context *pipe = tr_ctx->pipe; + struct pipe_texture *texture = tr_tex->texture; + struct trace_sampler_view *result = CALLOC_STRUCT(trace_sampler_view); + + trace_dump_call_begin("pipe_context", "create_sampler_view"); + + trace_dump_arg(ptr, pipe); + trace_dump_arg(ptr, texture); + trace_dump_arg(ptr, templ); + + result->sampler_view = pipe->create_sampler_view(pipe, texture, templ); + + result->base = *templ; + result->base.reference.count = 1; + result->base.texture = NULL; + pipe_texture_reference(&result->base.texture, _texture); + result->base.context = _pipe; + + trace_dump_ret(ptr, result); + + trace_dump_call_end(); + + return &result->base; +} + + +static void +trace_sampler_view_destroy(struct pipe_context *_pipe, + struct pipe_sampler_view *_view) +{ + struct trace_context *tr_ctx = trace_context(_pipe); + struct trace_sampler_view *tr_view = trace_sampler_view(_view); + struct pipe_context *pipe = tr_ctx->pipe; + struct pipe_sampler_view *view = tr_view->sampler_view; + + trace_dump_call_begin("pipe_context", "sampler_view_destroy"); + + trace_dump_arg(ptr, pipe); + trace_dump_arg(ptr, view); + + pipe->sampler_view_destroy(pipe, view); + + trace_dump_call_end(); + + pipe_texture_reference(&_view->texture, NULL); + FREE(_view); +} + + static INLINE void trace_context_set_fragment_sampler_views(struct pipe_context *_pipe, unsigned num, @@ -1313,6 +1370,8 @@ trace_context_create(struct trace_screen *tr_scr, tr_ctx->base.set_viewport_state = trace_context_set_viewport_state; tr_ctx->base.set_fragment_sampler_views = trace_context_set_fragment_sampler_views; tr_ctx->base.set_vertex_sampler_views = trace_context_set_vertex_sampler_views; + tr_ctx->base.create_sampler_view = trace_create_sampler_view; + tr_ctx->base.sampler_view_destroy = trace_sampler_view_destroy; tr_ctx->base.set_vertex_buffers = trace_context_set_vertex_buffers; tr_ctx->base.set_vertex_elements = trace_context_set_vertex_elements; if (pipe->surface_copy) diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h index a2ca3c2..3a99dcd 100644 --- a/src/gallium/drivers/trace/tr_texture.h +++ b/src/gallium/drivers/trace/tr_texture.h @@ -60,8 +60,6 @@ struct trace_sampler_view struct pipe_sampler_view base; struct pipe_sampler_view *sampler_view; - - struct tr_list list; }; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): svga: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: ad230a1fb12640ac515096d892b58e2bfdb995e7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad230a1fb12640ac515096d892b58e2bfdb995e7 Author: Michal Krol Date: Tue Feb 23 17:03:56 2010 +0100 svga: Fix after sampler view changes. --- src/gallium/drivers/svga/svga_pipe_sampler.c | 30 ++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index a2dfa45..2687817 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -176,6 +176,34 @@ static void svga_delete_sampler_state(struct pipe_context *pipe, } +static struct pipe_sampler_view * +svga_create_sampler_view(struct pipe_context *pipe, + struct pipe_texture *texture, + const struct pipe_sampler_view *templ) +{ + struct svga_context *softpipe = svga_context(pipe); + struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); + + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + + return view; +} + + +static void +svga_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view) +{ + struct svga_context *svga = svga_context(pipe); + + pipe_texture_reference(&view->texture, NULL); + FREE(view); +} + static void svga_set_sampler_views(struct pipe_context *pipe, unsigned num, struct pipe_sampler_view **views) @@ -232,6 +260,8 @@ void svga_init_sampler_functions( struct svga_context *svga ) svga->pipe.bind_fragment_sampler_states = svga_bind_sampler_states; svga->pipe.delete_sampler_state = svga_delete_sampler_state; svga->pipe.set_fragment_sampler_views = svga_set_sampler_views; + svga->pipe.create_sampler_view = svga_create_sampler_view; + svga->pipe.sampler_view_destroy = svga_sampler_view_destroy; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): softpipe: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: eb9c9efedf9e0b1fdb000a3d175285764759af2a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=eb9c9efedf9e0b1fdb000a3d175285764759af2a Author: Michal Krol Date: Tue Feb 23 16:37:42 2010 +0100 softpipe: Fix after sampler view changes. --- src/gallium/drivers/softpipe/sp_context.c |2 + src/gallium/drivers/softpipe/sp_state.h |9 +++ src/gallium/drivers/softpipe/sp_state_sampler.c | 29 +++ 3 files changed, 40 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 858e118..0c74b49 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -254,6 +254,8 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.set_scissor_state = softpipe_set_scissor_state; softpipe->pipe.set_fragment_sampler_views = softpipe_set_sampler_views; softpipe->pipe.set_vertex_sampler_views = softpipe_set_vertex_sampler_views; + softpipe->pipe.create_sampler_view = softpipe_create_sampler_view; + softpipe->pipe.sampler_view_destroy = softpipe_sampler_view_destroy; softpipe->pipe.set_viewport_state = softpipe_set_viewport_state; softpipe->pipe.set_vertex_buffers = softpipe_set_vertex_buffers; diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index ba9bbfe..b37bb95 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -175,6 +175,15 @@ softpipe_set_vertex_sampler_views(struct pipe_context *, unsigned num, struct pipe_sampler_view **); +struct pipe_sampler_view * +softpipe_create_sampler_view(struct pipe_context *pipe, + struct pipe_texture *texture, + const struct pipe_sampler_view *templ); + +void +softpipe_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view); + void softpipe_set_viewport_state( struct pipe_context *, const struct pipe_viewport_state * ); diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index c985b5c..5a92e22 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -121,6 +121,35 @@ softpipe_bind_vertex_sampler_states(struct pipe_context *pipe, } +struct pipe_sampler_view * +softpipe_create_sampler_view(struct pipe_context *pipe, + struct pipe_texture *texture, + const struct pipe_sampler_view *templ) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); + + *view = *templ; + view->reference.count = 1; + view->texture = NULL; + pipe_texture_reference(&view->texture, texture); + view->context = pipe; + + return view; +} + + +void +softpipe_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + + pipe_texture_reference(&view->texture, NULL); + FREE(view); +} + + void softpipe_set_sampler_views(struct pipe_context *pipe, unsigned num, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-sampler-view): failover: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 9187b25a15145933ca014556e109b17ecf38ece4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9187b25a15145933ca014556e109b17ecf38ece4 Author: Michal Krol Date: Tue Feb 23 16:09:10 2010 +0100 failover: Fix after sampler view changes. --- src/gallium/drivers/failover/fo_context.h| 18 -- src/gallium/drivers/failover/fo_state.c | 80 +++--- src/gallium/drivers/failover/fo_state_emit.c | 22 ++-- 3 files changed, 89 insertions(+), 31 deletions(-) diff --git a/src/gallium/drivers/failover/fo_context.h b/src/gallium/drivers/failover/fo_context.h index ae3b0b0..53e1a02 100644 --- a/src/gallium/drivers/failover/fo_context.h +++ b/src/gallium/drivers/failover/fo_context.h @@ -47,7 +47,7 @@ #define FO_NEW_ALPHA_TEST 0x100 #define FO_NEW_DEPTH_STENCIL 0x200 #define FO_NEW_SAMPLER 0x400 -#define FO_NEW_TEXTURE 0x800 +#define FO_NEW_SAMPLER_VIEW0x800 #define FO_NEW_VERTEX 0x2000 #define FO_NEW_VERTEX_SHADER 0x4000 #define FO_NEW_BLEND_COLOR 0x8000 @@ -65,6 +65,13 @@ struct fo_state { void *sw_state; void *hw_state; }; + +struct fo_sampler_view { + struct pipe_sampler_view base; + struct pipe_sampler_view *sw; + struct pipe_sampler_view *hw; +}; + struct failover_context { struct pipe_context pipe; /**< base class */ @@ -85,8 +92,6 @@ struct failover_context { struct pipe_framebuffer_state framebuffer; struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; - struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS]; - struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS]; struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS]; @@ -99,12 +104,15 @@ struct failover_context { void *sw_vertex_sampler_state[PIPE_MAX_VERTEX_SAMPLERS]; void *hw_vertex_sampler_state[PIPE_MAX_VERTEX_SAMPLERS]; + struct fo_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; + struct fo_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; + unsigned num_fragment_sampler_views; + unsigned num_vertex_sampler_views; + unsigned dirty; unsigned num_samplers; unsigned num_vertex_samplers; - unsigned num_sampler_views; - unsigned num_vertex_sampler_views; unsigned mode; struct pipe_context *hw; diff --git a/src/gallium/drivers/failover/fo_state.c b/src/gallium/drivers/failover/fo_state.c index b16f219..d0c2f14 100644 --- a/src/gallium/drivers/failover/fo_state.c +++ b/src/gallium/drivers/failover/fo_state.c @@ -404,30 +404,66 @@ failover_delete_sampler_state(struct pipe_context *pipe, void *sampler) } +static struct pipe_sampler_view * +failover_create_sampler_view(struct pipe_context *pipe, + struct pipe_texture *texture, + const struct pipe_sampler_view *templ) +{ + struct fo_sampler_view *view = malloc(sizeof(struct fo_sampler_view)); + struct failover_context *failover = failover_context(pipe); + + view->sw = failover->sw->create_sampler_view(failover->sw, texture, templ); + view->hw = failover->hw->create_sampler_view(failover->hw, texture, templ); + + view->base = *templ; + view->base.reference.count = 1; + view->base.texture = NULL; + pipe_texture_reference(&view->base.texture, texture); + view->base.context = pipe; + + return &view->base; +} + +static void +failover_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view) +{ + struct fo_sampler_view *fo_view = (struct fo_sampler_view *)view; + struct failover_context *failover = failover_context(pipe); + + failover->sw->sampler_view_destroy(failover->sw, fo_view->sw); + failover->hw->sampler_view_destroy(failover->hw, fo_view->hw); + + pipe_texture_reference(&fo_view->base.texture, NULL); + free(fo_view); +} + static void failover_set_fragment_sampler_views(struct pipe_context *pipe, unsigned num, struct pipe_sampler_view **views) { struct failover_context *failover = failover_context(pipe); + struct pipe_sampler_view *hw_views[PIPE_MAX_SAMPLERS]; uint i; assert(num <= PIPE_MAX_SAMPLERS); /* Check for no-op */ - if (num == failover->num_sampler_views && - !memcmp(failover->sampler_views, views, num * sizeof(struct pipe_sampler_view *))) + if (num == failover->num_fragment_sampler_views && + !memcmp(failover->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) return; - for (i = 0; i < num; i++) - pipe_sampler_view_reference((struct pipe_sampler_view **) &failover->sampler_views[i], - views[i]); - for (i = num; i < failover->num_sampler_views; i++) - pipe_sam
Mesa (gallium-sampler-view): identity: Fix after sampler view changes.
Module: Mesa Branch: gallium-sampler-view Commit: 14a146c4995da5074eb1192a818b7a3dfc3bb438 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=14a146c4995da5074eb1192a818b7a3dfc3bb438 Author: Michal Krol Date: Tue Feb 23 16:09:40 2010 +0100 identity: Fix after sampler view changes. --- src/gallium/drivers/identity/id_context.c | 42 + 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 2272f4a..442d851 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -685,6 +685,46 @@ identity_is_buffer_referenced(struct pipe_context *_pipe, buffer); } +static struct pipe_sampler_view * +identity_create_sampler_view(struct pipe_context *pipe, + struct pipe_texture *texture, + const struct pipe_sampler_view *templ) +{ + struct identity_context *id_pipe = identity_context(pipe); + struct identity_texture *id_texture = identity_texture(texture); + struct pipe_context *pipe_unwrapped = id_pipe->pipe; + struct pipe_texture *texture_unwrapped = id_texture->texture; + struct identity_sampler_view *view = malloc(sizeof(struct identity_sampler_view)); + + view->sampler_view = pipe_unwrapped->create_sampler_view(pipe_unwrapped, +texture_unwrapped, +templ); + + view->base = *templ; + view->base.reference.count = 1; + view->base.texture = NULL; + pipe_texture_reference(&view->base.texture, texture); + view->base.context = pipe; + + return &view->base; +} + +static void +identity_sampler_view_destroy(struct pipe_context *pipe, + struct pipe_sampler_view *view) +{ + struct identity_context *id_pipe = identity_context(pipe); + struct identity_sampler_view *id_view = identity_sampler_view(view); + struct pipe_context *pipe_unwrapped = id_pipe->pipe; + struct pipe_sampler_view *view_unwrapped = id_view->sampler_view; + + pipe_unwrapped->sampler_view_destroy(pipe_unwrapped, +view_unwrapped); + + pipe_texture_reference(&view->texture, NULL); + free(view); +} + struct pipe_context * identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) { @@ -747,6 +787,8 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) id_pipe->base.flush = identity_flush; id_pipe->base.is_texture_referenced = identity_is_texture_referenced; 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->pipe = pipe; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (gallium-no-rhw-position): gallium: Remove bypass_vs_clip_and_viewport from rasteriser state.
Module: Mesa Branch: gallium-no-rhw-position Commit: 63cb6f59eac91ba34cf80ff3736568e40b094fe1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=63cb6f59eac91ba34cf80ff3736568e40b094fe1 Author: Michal Krol Date: Mon Feb 22 21:36:22 2010 +0100 gallium: Remove bypass_vs_clip_and_viewport from rasteriser state. Needs testing. --- src/gallium/auxiliary/draw/draw_context.c |8 +- src/gallium/auxiliary/draw/draw_pt.c |4 +- .../auxiliary/draw/draw_pt_fetch_shade_emit.c |3 +- .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 15 +- src/gallium/auxiliary/util/u_blit.c| 15 +- src/gallium/auxiliary/util/u_blitter.c |1 - src/gallium/auxiliary/util/u_dump_state.c |1 - src/gallium/auxiliary/util/u_gen_mipmap.c | 39 ++- src/gallium/docs/source/cso/rasterizer.rst | 12 - src/gallium/drivers/nv30/nv30_context.h|1 - src/gallium/drivers/nv30/nv30_state_viewport.c | 58 +--- src/gallium/drivers/nv40/nv40_context.h|1 - src/gallium/drivers/nv40/nv40_state_viewport.c | 57 +--- src/gallium/drivers/nv50/nv50_context.h|1 - src/gallium/drivers/nv50/nv50_state_validate.c | 62 ++--- src/gallium/drivers/r300/r300_context.h|2 - src/gallium/drivers/r300/r300_emit.c | 46 ++-- src/gallium/drivers/r300/r300_state.c |5 +- src/gallium/drivers/r300/r300_state_derived.c |8 +- src/gallium/drivers/softpipe/sp_video_context.c|1 - src/gallium/drivers/svga/svga_state_framebuffer.c | 285 +--- src/gallium/drivers/svga/svga_state_need_swtnl.c |3 +- src/gallium/drivers/trace/tr_dump_state.c |1 - src/gallium/include/pipe/p_state.h | 10 - src/mesa/state_tracker/st_cb_clear.c | 44 ++-- 25 files changed, 271 insertions(+), 412 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index d5ddc4a..bb09885 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -128,9 +128,7 @@ void draw_set_rasterizer_state( struct draw_context *draw, draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); draw->rasterizer = raster; - draw->bypass_clipping = - ((draw->rasterizer && draw->rasterizer->bypass_vs_clip_and_viewport) || - draw->driver.bypass_clipping); + draw->bypass_clipping = draw->driver.bypass_clipping; } @@ -140,9 +138,7 @@ void draw_set_driver_clipping( struct draw_context *draw, draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); draw->driver.bypass_clipping = bypass_clipping; - draw->bypass_clipping = - ((draw->rasterizer && draw->rasterizer->bypass_vs_clip_and_viewport) || - draw->driver.bypass_clipping); + draw->bypass_clipping = draw->driver.bypass_clipping; } diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 341353f..6d90a6c 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -87,9 +87,7 @@ draw_pt_arrays(struct draw_context *draw, opt |= PT_CLIPTEST; } - if (!draw->rasterizer->bypass_vs_clip_and_viewport) { - opt |= PT_SHADE; - } + opt |= PT_SHADE; } if (opt == 0) diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c index c5dfbcf..1aecb51 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c @@ -100,8 +100,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle, fse->key.nr_elements = MAX2(fse->key.nr_outputs, /* outputs - translate to hw format */ fse->key.nr_inputs); /* inputs - fetch from api format */ - fse->key.viewport = (!draw->rasterizer->bypass_vs_clip_and_viewport && -!draw->identity_viewport); + fse->key.viewport = !draw->identity_viewport; fse->key.clip = !draw->bypass_clipping; fse->key.const_vbuffers = 0; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 56b6935..da51064 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -96,8 +96,7 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle, */ draw_pt_post_vs_prepare( fpme->post_vs, (boolean)draw->bypass_clipping, - (boolean)(draw->identity_viewport || - draw->rasterizer->bypass_vs_clip_and_viewport), + (boolean)draw->identity_viewport, (boolean)draw->rasterizer->gl_rasteriza
Mesa (master): tgsi: Change prototypes of micro opcodes to explicitly indicates number of args.
Module: Mesa Branch: master Commit: f1f7006d1f547571ec300277d7d5eef2007e9de1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f1f7006d1f547571ec300277d7d5eef2007e9de1 Author: Michal Krol Date: Thu Feb 18 11:56:14 2010 +0100 tgsi: Change prototypes of micro opcodes to explicitly indicates number of args. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 370 ++-- 1 files changed, 206 insertions(+), 164 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 14035d4..76ce3a8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -232,22 +232,26 @@ micro_lg2(union tgsi_exec_channel *dst, static void micro_lrp(union tgsi_exec_channel *dst, - const union tgsi_exec_channel *src) + const union tgsi_exec_channel *src0, + const union tgsi_exec_channel *src1, + const union tgsi_exec_channel *src2) { - dst->f[0] = src[0].f[0] * (src[1].f[0] - src[2].f[0]) + src[2].f[0]; - dst->f[1] = src[0].f[1] * (src[1].f[1] - src[2].f[1]) + src[2].f[1]; - dst->f[2] = src[0].f[2] * (src[1].f[2] - src[2].f[2]) + src[2].f[2]; - dst->f[3] = src[0].f[3] * (src[1].f[3] - src[2].f[3]) + src[2].f[3]; + dst->f[0] = src0->f[0] * (src1->f[0] - src2->f[0]) + src2->f[0]; + dst->f[1] = src0->f[1] * (src1->f[1] - src2->f[1]) + src2->f[1]; + dst->f[2] = src0->f[2] * (src1->f[2] - src2->f[2]) + src2->f[2]; + dst->f[3] = src0->f[3] * (src1->f[3] - src2->f[3]) + src2->f[3]; } static void micro_mad(union tgsi_exec_channel *dst, - const union tgsi_exec_channel *src) + const union tgsi_exec_channel *src0, + const union tgsi_exec_channel *src1, + const union tgsi_exec_channel *src2) { - dst->f[0] = src[0].f[0] * src[1].f[0] + src[2].f[0]; - dst->f[1] = src[0].f[1] * src[1].f[1] + src[2].f[1]; - dst->f[2] = src[0].f[2] * src[1].f[2] + src[2].f[2]; - dst->f[3] = src[0].f[3] * src[1].f[3] + src[2].f[3]; + dst->f[0] = src0->f[0] * src1->f[0] + src2->f[0]; + dst->f[1] = src0->f[1] * src1->f[1] + src2->f[1]; + dst->f[2] = src0->f[2] * src1->f[2] + src2->f[2]; + dst->f[3] = src0->f[3] * src1->f[3] + src2->f[3]; } static void @@ -304,22 +308,24 @@ micro_rsq(union tgsi_exec_channel *dst, static void micro_seq(union tgsi_exec_channel *dst, - const union tgsi_exec_channel *src) + const union tgsi_exec_channel *src0, + const union tgsi_exec_channel *src1) { - dst->f[0] = src[0].f[0] == src[1].f[0] ? 1.0f : 0.0f; - dst->f[1] = src[0].f[1] == src[1].f[1] ? 1.0f : 0.0f; - dst->f[2] = src[0].f[2] == src[1].f[2] ? 1.0f : 0.0f; - dst->f[3] = src[0].f[3] == src[1].f[3] ? 1.0f : 0.0f; + dst->f[0] = src0->f[0] == src1->f[0] ? 1.0f : 0.0f; + dst->f[1] = src0->f[1] == src1->f[1] ? 1.0f : 0.0f; + dst->f[2] = src0->f[2] == src1->f[2] ? 1.0f : 0.0f; + dst->f[3] = src0->f[3] == src1->f[3] ? 1.0f : 0.0f; } static void micro_sge(union tgsi_exec_channel *dst, - const union tgsi_exec_channel *src) + const union tgsi_exec_channel *src0, + const union tgsi_exec_channel *src1) { - dst->f[0] = src[0].f[0] >= src[1].f[0] ? 1.0f : 0.0f; - dst->f[1] = src[0].f[1] >= src[1].f[1] ? 1.0f : 0.0f; - dst->f[2] = src[0].f[2] >= src[1].f[2] ? 1.0f : 0.0f; - dst->f[3] = src[0].f[3] >= src[1].f[3] ? 1.0f : 0.0f; + dst->f[0] = src0->f[0] >= src1->f[0] ? 1.0f : 0.0f; + dst->f[1] = src0->f[1] >= src1->f[1] ? 1.0f : 0.0f; + dst->f[2] = src0->f[2] >= src1->f[2] ? 1.0f : 0.0f; + dst->f[3] = src0->f[3] >= src1->f[3] ? 1.0f : 0.0f; } static void @@ -334,12 +340,13 @@ micro_sgn(union tgsi_exec_channel *dst, static void micro_sgt(union tgsi_exec_channel *dst, - const union tgsi_exec_channel *src) + const union tgsi_exec_channel *src0, + const union tgsi_exec_channel *src1) { - dst->f[0] = src[0].f[0] > src[1].f[0] ? 1.0f : 0.0f; - dst->f[1] = src[0].f[1] > src[1].f[1] ? 1.0f : 0.0f; - dst->f[2] = src[0].f[2] > src[1].f[2] ? 1.0f : 0.0f; - dst->f[3] = src[0].f[3] > src[1].f[3] ? 1.0f : 0.0f; + dst->f[0] = src0->f[0] > src1->f[0] ? 1.0f : 0.0f; + dst->f[1] = src0->f[1] > src1->f[1] ? 1.0f : 0.0f; + dst->f[2] = src0->f[2] > src1->f[2] ? 1.0f : 0.0f; + dst->f[3] = src0->f[3] > src1->f[3] ? 1.0f : 0.0f; } static void @@ -354,32 +361,35 @@ micro_sin(union tgsi_exec_channel *dst, static void micro_sle(union tgsi_exec_channel *dst, - const union tgsi_exec_channel *src) + const union tgsi_exec_channel *src0, + const union tgsi_exec_channel *src1) { - dst->f[0] = src[0].f[0] <= src[1].f[0] ? 1.0f : 0.0f; - dst->f[1] = src[0].f[1] <= src[1].f[1] ? 1.0f : 0.0f; - dst->f[2] = src[0].f[2] <= src[1].f[2] ? 1.0f : 0.0f; - dst->f[3] = src[0].f[3] <= src[1].f[3] ? 1.0f : 0.0f; + dst->f[0] = src0->f[0] <= src1->f[0] ? 1.0f : 0.0f; + dst->f[1] = src0->f[1] <= src1->f[1] ? 1.0f :