summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/auxiliary/util/u_simple_shaders.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-12-11 08:40:05 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-12-11 08:40:05 +0000
commit21ab4c9f31674b113c24177398ed39f29b7cd8e6 (patch)
tree8be392d7a792d9663c2586396be77bfd506f5164 /lib/mesa/src/gallium/auxiliary/util/u_simple_shaders.c
parenta8f0a7916e26e550dd2a26e7188835c481978004 (diff)
Import Mesa 13.0.2
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/util/u_simple_shaders.c')
-rw-r--r--lib/mesa/src/gallium/auxiliary/util/u_simple_shaders.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/util/u_simple_shaders.c b/lib/mesa/src/gallium/auxiliary/util/u_simple_shaders.c
index 7ffb27124..1220e187e 100644
--- a/lib/mesa/src/gallium/auxiliary/util/u_simple_shaders.c
+++ b/lib/mesa/src/gallium/auxiliary/util/u_simple_shaders.c
@@ -79,7 +79,7 @@ util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe,
struct ureg_program *ureg;
uint i;
- ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
+ ureg = ureg_create( PIPE_SHADER_VERTEX );
if (!ureg)
return NULL;
@@ -121,12 +121,13 @@ void *util_make_layered_clear_vertex_shader(struct pipe_context *pipe)
"MOV OUT[2], SV[0]\n"
"END\n";
struct tgsi_token tokens[1000];
- struct pipe_shader_state state = {tokens};
+ struct pipe_shader_state state;
- if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+ if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
assert(0);
return NULL;
}
+ pipe_shader_state_from_tgsi(&state, tokens);
return pipe->create_vs_state(pipe, &state);
}
@@ -149,12 +150,13 @@ void *util_make_layered_clear_helper_vertex_shader(struct pipe_context *pipe)
"MOV OUT[2].x, SV[0].xxxx\n"
"END\n";
struct tgsi_token tokens[1000];
- struct pipe_shader_state state = {tokens};
+ struct pipe_shader_state state;
- if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+ if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
assert(0);
return NULL;
}
+ pipe_shader_state_from_tgsi(&state, tokens);
return pipe->create_vs_state(pipe, &state);
}
@@ -192,12 +194,13 @@ void *util_make_layered_clear_geometry_shader(struct pipe_context *pipe)
"EMIT IMM[0].xxxx\n"
"END\n";
struct tgsi_token tokens[1000];
- struct pipe_shader_state state = {tokens};
+ struct pipe_shader_state state;
- if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+ if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
assert(0);
return NULL;
}
+ pipe_shader_state_from_tgsi(&state, tokens);
return pipe->create_gs_state(pipe, &state);
}
@@ -227,7 +230,7 @@ util_make_fragment_tex_shader_writemask(struct pipe_context *pipe,
assert(interp_mode == TGSI_INTERPOLATE_LINEAR ||
interp_mode == TGSI_INTERPOLATE_PERSPECTIVE);
- ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
+ ureg = ureg_create( PIPE_SHADER_FRAGMENT );
if (!ureg)
return NULL;
@@ -297,7 +300,7 @@ util_make_fragment_tex_shader_writedepth(struct pipe_context *pipe,
struct ureg_dst out, depth;
struct ureg_src imm;
- ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
+ ureg = ureg_create( PIPE_SHADER_FRAGMENT );
if (!ureg)
return NULL;
@@ -349,7 +352,7 @@ util_make_fragment_tex_shader_writedepthstencil(struct pipe_context *pipe,
struct ureg_dst out, depth, stencil;
struct ureg_src imm;
- ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
+ ureg = ureg_create( PIPE_SHADER_FRAGMENT );
if (!ureg)
return NULL;
@@ -413,7 +416,7 @@ util_make_fragment_tex_shader_writestencil(struct pipe_context *pipe,
struct ureg_dst out, stencil;
struct ureg_src imm;
- ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
+ ureg = ureg_create( PIPE_SHADER_FRAGMENT );
if (!ureg)
return NULL;
@@ -471,17 +474,18 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe,
char text[sizeof(shader_templ)+100];
struct tgsi_token tokens[1000];
- struct pipe_shader_state state = {tokens};
+ struct pipe_shader_state state;
sprintf(text, shader_templ,
write_all_cbufs ? "PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1\n" : "",
tgsi_semantic_names[input_semantic],
tgsi_interpolate_names[input_interpolate]);
- if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+ if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
assert(0);
return NULL;
}
+ pipe_shader_state_from_tgsi(&state, tokens);
#if 0
tgsi_dump(state.tokens, 0);
#endif
@@ -493,7 +497,7 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe,
void *
util_make_empty_fragment_shader(struct pipe_context *pipe)
{
- struct ureg_program *ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT);
+ struct ureg_program *ureg = ureg_create(PIPE_SHADER_FRAGMENT);
if (!ureg)
return NULL;
@@ -517,7 +521,7 @@ util_make_fragment_cloneinput_shader(struct pipe_context *pipe, int num_cbufs,
assert(num_cbufs <= PIPE_MAX_COLOR_BUFS);
- ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
+ ureg = ureg_create( PIPE_SHADER_FRAGMENT );
if (!ureg)
return NULL;
@@ -558,7 +562,7 @@ util_make_fs_blit_msaa_gen(struct pipe_context *pipe,
const char *type = tgsi_texture_names[tgsi_tex];
char text[sizeof(shader_templ)+100];
struct tgsi_token tokens[1000];
- struct pipe_shader_state state = {tokens};
+ struct pipe_shader_state state;
assert(tgsi_tex == TGSI_TEXTURE_2D_MSAA ||
tgsi_tex == TGSI_TEXTURE_2D_ARRAY_MSAA);
@@ -566,11 +570,12 @@ util_make_fs_blit_msaa_gen(struct pipe_context *pipe,
sprintf(text, shader_templ, type, samp_type,
output_semantic, output_mask, type);
- if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+ if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
puts(text);
assert(0);
return NULL;
}
+ pipe_shader_state_from_tgsi(&state, tokens);
#if 0
tgsi_dump(state.tokens, 0);
#endif
@@ -646,6 +651,7 @@ util_make_fs_blit_msaa_depthstencil(struct pipe_context *pipe,
"FRAG\n"
"DCL IN[0], GENERIC[0], LINEAR\n"
"DCL SAMP[0..1]\n"
+ "DCL SVIEW[0..1], %s, FLOAT\n"
"DCL OUT[0], POSITION\n"
"DCL OUT[1], STENCIL\n"
"DCL TEMP[0]\n"
@@ -658,17 +664,18 @@ util_make_fs_blit_msaa_depthstencil(struct pipe_context *pipe,
const char *type = tgsi_texture_names[tgsi_tex];
char text[sizeof(shader_templ)+100];
struct tgsi_token tokens[1000];
- struct pipe_shader_state state = {tokens};
+ struct pipe_shader_state state;
assert(tgsi_tex == TGSI_TEXTURE_2D_MSAA ||
tgsi_tex == TGSI_TEXTURE_2D_ARRAY_MSAA);
- sprintf(text, shader_templ, type, type);
+ sprintf(text, shader_templ, type, type, type);
- if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+ if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
assert(0);
return NULL;
}
+ pipe_shader_state_from_tgsi(&state, tokens);
#if 0
tgsi_dump(state.tokens, 0);
#endif
@@ -685,9 +692,9 @@ util_make_fs_msaa_resolve(struct pipe_context *pipe,
struct ureg_program *ureg;
struct ureg_src sampler, coord;
struct ureg_dst out, tmp_sum, tmp_coord, tmp;
- int i;
+ unsigned i;
- ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT);
+ ureg = ureg_create(PIPE_SHADER_FRAGMENT);
if (!ureg)
return NULL;
@@ -746,9 +753,9 @@ util_make_fs_msaa_resolve_bilinear(struct pipe_context *pipe,
struct ureg_src sampler, coord;
struct ureg_dst out, tmp, top, bottom;
struct ureg_dst tmp_coord[4], tmp_sum[4];
- int i, c;
+ unsigned i, c;
- ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT);
+ ureg = ureg_create(PIPE_SHADER_FRAGMENT);
if (!ureg)
return NULL;
@@ -847,7 +854,7 @@ util_make_geometry_passthrough_shader(struct pipe_context *pipe,
unsigned i;
- ureg = ureg_create(TGSI_PROCESSOR_GEOMETRY);
+ ureg = ureg_create(PIPE_SHADER_GEOMETRY);
if (!ureg)
return NULL;