查看: 1522|回复: 5
打印 上一主题 下一主题

[其它] Genetic Programming for Shader Simplification

[复制链接]

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

跳转到指定楼层
楼主
发表于 2011-12-28 09:32:17 |只看该作者 |倒序浏览
Genetic Programming for Shader Simplification

Abstract

We present a framework based on Genetic Programming (GP) for

automatically simplifying procedural shaders. Our approach com-

putes a series of increasingly simplified shaders that expose the in-

herent trade-off between speed and accuracy. Compared to exist-

ing automatic methods for pixel shader simplification [Olano et al.

2003; Pellacini 2005], our approach considers a wider space of code

transformations and produces faster and more faithful results. We

further demonstrate how our cost function can be rapidly evaluated

using graphics hardware, which allows tens of thousands of shader

variants to be considered during the optimization process. Our

approach is also applicable to multi-pass shaders and perceptual-

based error metrics.

Keywords: procedural texturing, pixel shaders, code simplifica-

tion, genetic programming



1 Introduction

The complexity of procedural shaders [Cook 1984; Perlin 1985] has

continued to grow alongside the steady increase in performance and

programmability of graphics hardware. Modern interactive render-

ing systems often contain hundreds of pixel shaders, each of which

may perform thousands of arithmetic operations and texture fetches

to generate a single frame.

Although this rise in complexity has brought considerable improve-

ments to the realism of interactive 3D content, there is a growing

need for automated tools to optimize procedural shaders to meet a

computational budget or set of hardware constraints. For example,

the popular virtual world Second Life allows users to supply cus-

tom models and textures, but not custom shaders: the performance

of a potentially-complex custom shader cannot be guaranteed on

all client hardware. Automatic optimization algorithms could adapt

such shaders to multiple platform capabilities while retaining the

intent of the original.

As with traditional computer programs, pixel shaders can be ex-

ecuted faster through a variety of semantics-preserving transfor-

mations like dead code elimination or constant folding [Muchnick

1997]. Unlike traditional programs, however, shaders also admit

lossy optimizations [Olano et al. 2003]. A user will likely tolerate a

shader that is incorrect in a minority of cases or that deviates from

its ideal value by a small percentage in exchange for a significant

performance boost.

One common way to achieve this type of optimization is through

code simplification. The methods proposed by Olano et al. [2003]

and Pellacini [2005] automatically generate a sequence of progres-

sively simplified versions of an input pixel shader. These may be

used in place of the original to improve performance at an accept-

able reduction in detail. However, these methods have a number

of important disadvantages. The system proposed by Olano et al.

[2003] only considers code transformations that replace a texture

with its average color. This overlooks many possible opportuni-

ties involving source-level modifications. The system proposed by

Pellacini [2005] does consider source-level simplifications. How-

ever, that approach is limited to a small number of code transfor-

mations and uses a brute-force optimization strategy that can easily

miss profitable areas of the objective function. Furthermore, both

approaches were demonstrated only on shaders that require a sin-

gle rendering pass. Modern shaders often involve multiple inter-

dependent passes. Finally, in both of these systems, only a single

error metric is used to evaluate the fidelity of a modified shader. It

would be desirable for a simplification algorithm to support a range

of error metrics, including those that are designed to predict per-

ceptual differences [Wang et al. 2004].

Intuitively, we hypothesize that a shader contains the seeds of its

own optimization: relevant functions such as sin and cos, opera-

tions such as * or +, or constants such as 1.0 are already present in

the shader source code. We propose to produce optimized shader

variants by copying, reordering and deleting the statements and ex-

pressions already available. We also hypothesize that the landscape

of possible shader variants is sufficiently complex that a simple hill-

climbing search will not suffice to avoid being trapped in local op-

tima. We thus present a novel framework for simplifying shaders

that is based on Genetic Programming (GP). GP is a computational

method inspired by biological evolution which evolves computer

programs tailored to a particular task [Koza 1992]. GP maintains

a population of program variants, each of which is evaluated for

suitability using a task-specific fitness function. High-fitness vari-

ants are selected for continued evolution. Computational analogs of

biological crossover and mutation help to locate global optima by

combining partial solutions and variations of the high-fitness pro-

grams; the process repeats until a fit program is located.

Our approach is related to recent software engineering work that

applies GP to automatic program repair [Weimer et al. 2009, 2010].

Our approach is novel not only in the domain considered (contin-

uous shader output vs. discrete software test cases) but also in the

techniques used: to take advantage of the special structure of shader

software, we apply new mutation operations, new approaches to

select a diverse population of variants, new handling for multiple

competing objectives, and optimizations to rapidly approximate the

performance of a shader variant.

Our approach offers a number of benefits over existing methods for

shader simplification. In particular, it explores optimizations be-

yond just texture lookups (cf. Olano et al. [2003]), is not limited to

an a priori set of simplifying transformations (cf. Pellacini [2005]),

does not require the user to specify continuous domains for shader

input parameters (cf. Pellacini [2005]), is demonstrably applicable

to multi-pass shaders and perceptual-based error metrics, and out-

performs previous work in a direct comparison.









全文请下载附件:


分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

5969

主题

1

听众

39万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

沙发
发表于 2012-2-15 23:32:46 |只看该作者
凡系斑竹滴话要听;凡系朋友滴帖要顶!
回复

使用道具 举报

462

主题

1

听众

31万

积分

首席设计师

Rank: 8Rank: 8

纳金币
2
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

板凳
发表于 2012-4-9 23:26:58 |只看该作者
水。。。
回复

使用道具 举报

5969

主题

1

听众

39万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

地板
发表于 2012-7-4 23:20:07 |只看该作者
楼主收集的可真全哦
回复

使用道具 举报

tc    

5089

主题

1

听众

33万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

5#
发表于 2012-7-15 23:21:35 |只看该作者
响应天帅号召,顶
回复

使用道具 举报

   

671

主题

1

听众

3247

积分

中级设计师

Rank: 5Rank: 5

纳金币
324742
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

6#
发表于 2012-11-28 23:19:26 |只看该作者
你们都躲开,我来顶
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2025-7-23 21:51 , Processed in 0.064245 second(s), 29 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部