X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=dpsoftrast.c;h=b8262b4c505f5c3432eb776f9c6498d068801841;hb=2048a824c4d5c5d4d031e519dd3a125db35415fd;hp=a646db35bd13d32da8f143f7d5b75f028e8ca292;hpb=e362fefcd05e3d1c5a8e5987916085de5cc368c5;p=xonotic%2Fdarkplaces.git diff --git a/dpsoftrast.c b/dpsoftrast.c index a646db35..b8262b4c 100644 --- a/dpsoftrast.c +++ b/dpsoftrast.c @@ -617,9 +617,6 @@ int DPSOFTRAST_Texture_New(int flags, int width, int height, int depth) d = depth; size = 0; mipmaps = 0; - w = width; - h = height; - d = depth; for (;;) { s = w * h * d * sides * 4; @@ -1314,7 +1311,8 @@ void DPSOFTRAST_SetTexture(int unitnum, int index) command->texture = texture; dpsoftrast.texbound[unitnum] = texture; - ATOMIC_ADD(texture->binds, dpsoftrast.numthreads); + if (texture) + ATOMIC_ADD(texture->binds, dpsoftrast.numthreads); } void DPSOFTRAST_SetVertexPointer(const float *vertex3f, size_t stride) @@ -2054,11 +2052,9 @@ static void DPSOFTRAST_Draw_Span_FinishBGRA8(DPSOFTRAST_State_Thread *thread, co int subx; const unsigned int * RESTRICT ini = (const unsigned int *)in4ub; unsigned char * RESTRICT pixelmask = span->pixelmask; - unsigned char * RESTRICT pixel = (unsigned char *)dpsoftrast.fb_colorpixels[0]; unsigned int * RESTRICT pixeli = (unsigned int *)dpsoftrast.fb_colorpixels[0]; - if (!pixel) + if (!pixeli) return; - pixel += (span->y * dpsoftrast.fb_width + span->x) * 4; pixeli += span->y * dpsoftrast.fb_width + span->x; // handle alphatest now (this affects depth writes too) if (thread->shader_permutation & SHADERPERMUTATION_ALPHAKILL) @@ -3262,6 +3258,12 @@ static void DPSOFTRAST_PixelShader_Generic(DPSOFTRAST_State_Thread *thread, cons } else DPSOFTRAST_Draw_Span_VaryingBGRA8(triangle, span, buffer_FragColorbgra8, 1, buffer_z); + if(thread->shader_permutation & SHADERPERMUTATION_ALPHAKILL) + { + int x; + for (x = span->startx;x < span->endx;x++) + buffer_FragColorbgra8[x*4+3] = buffer_FragColorbgra8[x*4+3] * thread->uniform4f[DPSOFTRAST_UNIFORM_Alpha*4+0]; + } DPSOFTRAST_Draw_Span_FinishBGRA8(thread, triangle, span, buffer_FragColorbgra8); } @@ -4045,7 +4047,7 @@ void DPSOFTRAST_PixelShader_LightDirection(DPSOFTRAST_State_Thread *thread, cons { for (x = startx;x < endx;x++) { - z = buffer_z[x]; + // z = buffer_z[x]; diffusetex[0] = buffer_texture_colorbgra8[x*4+0]; diffusetex[1] = buffer_texture_colorbgra8[x*4+1]; diffusetex[2] = buffer_texture_colorbgra8[x*4+2]; @@ -4582,7 +4584,7 @@ static void DPSOFTRAST_VertexShader_Water(void) static void DPSOFTRAST_PixelShader_Water(DPSOFTRAST_State_Thread *thread, const DPSOFTRAST_State_Triangle * RESTRICT triangle, const DPSOFTRAST_State_Span * RESTRICT span) { float buffer_z[DPSOFTRAST_DRAW_MAXSPANLENGTH]; - float z; + // float z; int x, startx = span->startx, endx = span->endx; // texture reads @@ -4651,7 +4653,7 @@ static void DPSOFTRAST_PixelShader_Water(DPSOFTRAST_State_Thread *thread, const unsigned char c2[4]; float Fresnel; - z = buffer_z[x]; + // z = buffer_z[x]; // " vec4 ScreenScaleRefractReflectIW = ScreenScaleRefractReflect * (1.0 / ModelViewProjectionPosition.w);\n" iw = 1.0f / (ModelViewProjectionPositiondata[3] + ModelViewProjectionPositionslope[3]*x); // / z @@ -4790,8 +4792,6 @@ static void DPSOFTRAST_Draw_DepthTest(DPSOFTRAST_State_Thread *thread, DPSOFTRAS int depthslope; unsigned int d; unsigned char *pixelmask; - DPSOFTRAST_State_Triangle *triangle; - triangle = &thread->triangles[span->triangle]; depthpixel = dpsoftrast.fb_depthpixels + span->y * dpsoftrast.fb_width + span->x; startx = span->startx; endx = span->endx;