summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/common/meta_blit.c
diff options
context:
space:
mode:
authorVinson Lee <[email protected]>2014-02-21 19:37:31 -0800
committerVinson Lee <[email protected]>2014-02-21 19:40:00 -0800
commit24ce678f83ce232f795548c5d27ae36b22e27dc4 (patch)
treee33a387ff56181b2d16451f6f9cd4c842876e434 /src/mesa/drivers/common/meta_blit.c
parentdcbf404c0d1e9a40e0e75562e5112f53f95abe9d (diff)
mesa: Move declarations before code.
This patch fixes these MSVC build errors. Compiling src\mesa\drivers\common\meta_blit.c ... meta_blit.c src\mesa\drivers\common\meta_blit.c(255) : error C2143: syntax error : missing ';' before 'type' src\mesa\drivers\common\meta_blit.c(255) : error C2143: syntax error : missing ')' before 'type' src\mesa\drivers\common\meta_blit.c(255) : error C2065: 'i' : undeclared identifier src\mesa\drivers\common\meta_blit.c(255) : warning C4552: '<' : operator has no effect; expected operator with side-effect src\mesa\drivers\common\meta_blit.c(255) : error C2059: syntax error : ')' src\mesa\drivers\common\meta_blit.c(255) : error C2143: syntax error : missing ';' before '{' src\mesa\drivers\common\meta_blit.c(258) : error C2065: 'i' : undeclared identifier src\mesa\drivers\common\meta_blit.c(263) : error C2143: syntax error : missing ';' before 'type' src\mesa\drivers\common\meta_blit.c(263) : error C2143: syntax error : missing ')' before 'type' src\mesa\drivers\common\meta_blit.c(263) : error C2065: 'step' : undeclared identifier src\mesa\drivers\common\meta_blit.c(263) : warning C4552: '<=' : operator has no effect; expected operator with side-effect src\mesa\drivers\common\meta_blit.c(263) : error C2059: syntax error : ')' src\mesa\drivers\common\meta_blit.c(263) : error C2143: syntax error : missing ';' before '{' src\mesa\drivers\common\meta_blit.c(264) : error C2143: syntax error : missing ';' before 'type' src\mesa\drivers\common\meta_blit.c(264) : error C2143: syntax error : missing ')' before 'type' src\mesa\drivers\common\meta_blit.c(264) : error C2065: 'i' : undeclared identifier src\mesa\drivers\common\meta_blit.c(264) : warning C4552: '<' : operator has no effect; expected operator with side-effect src\mesa\drivers\common\meta_blit.c(264) : error C2059: syntax error : ')' src\mesa\drivers\common\meta_blit.c(264) : error C2065: 'step' : undeclared identifier src\mesa\drivers\common\meta_blit.c(264) : error C2143: syntax error : missing ';' before '{' src\mesa\drivers\common\meta_blit.c(268) : error C2065: 'step' : undeclared identifier src\mesa\drivers\common\meta_blit.c(268) : error C2065: 'i' : undeclared identifier src\mesa\drivers\common\meta_blit.c(269) : error C2065: 'step' : undeclared identifier src\mesa\drivers\common\meta_blit.c(269) : error C2065: 'i' : undeclared identifier src\mesa\drivers\common\meta_blit.c(270) : error C2065: 'step' : undeclared identifier src\mesa\drivers\common\meta_blit.c(270) : error C2065: 'i' : undeclared identifier src\mesa\drivers\common\meta_blit.c(559) : warning C4244: 'function' : conversion from 'const GLint' to 'GLfloat', possible loss of data src\mesa\drivers\common\meta_blit.c(723) : warning C4244: 'function' : conversion from 'const GLint' to 'GLfloat', possible loss of data src\mesa\drivers\common\meta_blit.c(773) : warning C4244: 'function' : conversion from 'const GLint' to 'GLfloat', possible loss of data Signed-off-by: Vinson Lee <[email protected]>
Diffstat (limited to 'src/mesa/drivers/common/meta_blit.c')
-rw-r--r--src/mesa/drivers/common/meta_blit.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 69c2590b443..112fbb15a9e 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -218,16 +218,21 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
/* You can create 2D_MULTISAMPLE textures with 0 sample count (meaning 1
* sample). Yes, this is ridiculous.
*/
- int samples = MAX2(src_rb->NumSamples, 1);
+ int samples;
char *sample_resolve;
const char *arb_sample_shading_extension_string;
const char *merge_function;
+ samples = MAX2(src_rb->NumSamples, 1);
+
if (dst_is_msaa) {
arb_sample_shading_extension_string = "#extension GL_ARB_sample_shading : enable";
sample_resolve = ralloc_asprintf(mem_ctx, " out_color = texelFetch(texSampler, ivec2(texCoords), gl_SampleID);");
merge_function = "";
} else {
+ int i;
+ int step;
+
if (src_datatype == GL_INT) {
merge_function =
"ivec4 merge(ivec4 a, ivec4 b) { return (a >> ivec4(1)) + (b >> ivec4(1)) + (a & b & ivec4(1)); }\n";
@@ -252,7 +257,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
assert((samples & (samples - 1)) == 0);
/* Fetch each individual sample. */
sample_resolve = rzalloc_size(mem_ctx, 1);
- for (int i = 0; i < samples; i++) {
+ for (i = 0; i < samples; i++) {
ralloc_asprintf_append(&sample_resolve,
" %svec4 sample_1_%d = texelFetch(texSampler, ivec2(texCoords), %d);\n",
vec4_prefix, i, i);
@@ -260,8 +265,8 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
/* Now, merge each pair of samples, then merge each pair of those,
* etc.
*/
- for (int step = 2; step <= samples; step *= 2) {
- for (int i = 0; i < samples; i += step) {
+ for (step = 2; step <= samples; step *= 2) {
+ for (i = 0; i < samples; i += step) {
ralloc_asprintf_append(&sample_resolve,
" %svec4 sample_%d_%d = merge(sample_%d_%d, sample_%d_%d);\n",
vec4_prefix,