int depthtest;
int depthfunc;
int scissortest;
- int alphatest;
- int alphafunc;
- float alphavalue;
int viewport[4];
int scissor[4];
float depthrange[2];
command->mode = mode;
}
-DEFCOMMAND(15, AlphaTest, int enable;)
-static void DPSOFTRAST_Interpret_AlphaTest(DPSOFTRAST_State_Thread *thread, DPSOFTRAST_Command_AlphaTest *command)
-{
- thread->alphatest = command->enable;
-}
-void DPSOFTRAST_AlphaTest(int enable)
-{
- DPSOFTRAST_Command_AlphaTest *command = DPSOFTRAST_ALLOCATECOMMAND(AlphaTest);
- command->enable = enable;
-}
-
-DEFCOMMAND(16, AlphaFunc, int func; float ref;)
-static void DPSOFTRAST_Interpret_AlphaFunc(DPSOFTRAST_State_Thread *thread, DPSOFTRAST_Command_AlphaFunc *command)
-{
- thread->alphafunc = command->func;
- thread->alphavalue = command->ref;
-}
-void DPSOFTRAST_AlphaFunc(int func, float ref)
-{
- DPSOFTRAST_Command_AlphaFunc *command = DPSOFTRAST_ALLOCATECOMMAND(AlphaFunc);
- command->func = func;
- command->ref = ref;
-}
-
void DPSOFTRAST_Color4f(float r, float g, float b, float a)
{
dpsoftrast.color[0] = r;
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->alphatest)
+ if (thread->shader_permutation & SHADERPERMUTATION_ALPHAKILL)
for (x = startx;x < endx;x++)
if (in4ub[x*4+3] < 128)
pixelmask[x] = false;
unsigned char buffer_FragColorbgra8[DPSOFTRAST_DRAW_MAXSPANLENGTH*4];
DPSOFTRAST_Draw_Span_Begin(thread, triangle, span, buffer_z);
DPSOFTRAST_Draw_Span_Texture2DVaryingBGRA8(thread, triangle, span, buffer_texture_colorbgra8, GL20TU_COLOR, 2, buffer_z);
- if (thread->alphatest || thread->fb_blendmode != DPSOFTRAST_BLENDMODE_OPAQUE)
+ if ((thread->shader_permutation & SHADERPERMUTATION_ALPHAKILL) || thread->fb_blendmode != DPSOFTRAST_BLENDMODE_OPAQUE)
pixel = buffer_FragColorbgra8;
Color_Ambientm = _mm_shuffle_epi32(_mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(&thread->uniform4f[DPSOFTRAST_UNIFORM_Color_Ambient*4]), _mm_set1_ps(256.0f))), _MM_SHUFFLE(3, 0, 1, 2));
Color_Ambientm = _mm_and_si128(Color_Ambientm, _mm_setr_epi32(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0));
int arrayindex = DPSOFTRAST_ARRAY_COLOR;
DPSOFTRAST_Draw_Span_Begin(thread, triangle, span, buffer_z);
DPSOFTRAST_Draw_Span_Texture2DVaryingBGRA8(thread, triangle, span, buffer_texture_colorbgra8, GL20TU_COLOR, 2, buffer_z);
- if (thread->alphatest || thread->fb_blendmode != DPSOFTRAST_BLENDMODE_OPAQUE)
+ if ((thread->shader_permutation & SHADERPERMUTATION_ALPHAKILL) || thread->fb_blendmode != DPSOFTRAST_BLENDMODE_OPAQUE)
pixel = buffer_FragColorbgra8;
Color_Ambientm = _mm_shuffle_epi32(_mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(&thread->uniform4f[DPSOFTRAST_UNIFORM_Color_Ambient*4]), _mm_set1_ps(256.0f))), _MM_SHUFFLE(3, 0, 1, 2));
Color_Ambientm = _mm_and_si128(Color_Ambientm, _mm_setr_epi32(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DPSOFTRAST_Draw_Span_Begin(thread, triangle, span, buffer_z);
DPSOFTRAST_Draw_Span_Texture2DVaryingBGRA8(thread, triangle, span, buffer_texture_colorbgra8, GL20TU_COLOR, DPSOFTRAST_ARRAY_TEXCOORD0, buffer_z);
DPSOFTRAST_Draw_Span_Texture2DVaryingBGRA8(thread, triangle, span, buffer_texture_lightmapbgra8, GL20TU_LIGHTMAP, DPSOFTRAST_ARRAY_TEXCOORD4, buffer_z);
- if (thread->alphatest || thread->fb_blendmode != DPSOFTRAST_BLENDMODE_OPAQUE)
+ if ((thread->shader_permutation & SHADERPERMUTATION_ALPHAKILL) || thread->fb_blendmode != DPSOFTRAST_BLENDMODE_OPAQUE)
pixel = buffer_FragColorbgra8;
Color_Ambientm = _mm_shuffle_epi32(_mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(&thread->uniform4f[DPSOFTRAST_UNIFORM_Color_Ambient*4]), _mm_set1_ps(256.0f))), _MM_SHUFFLE(3, 0, 1, 2));
Color_Ambientm = _mm_and_si128(Color_Ambientm, _mm_setr_epi32(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0));
float EyeVectorslope[4];
// uniforms
- float ScreenScaleRefractReflect[2];
- float ScreenCenterRefractReflect[2];
- float DistortScaleRefractReflect[2];
+ float ScreenScaleRefractReflect[4];
+ float ScreenCenterRefractReflect[4];
+ float DistortScaleRefractReflect[4];
float RefractColor[4];
float ReflectColor[4];
float ReflectFactor;
INTERPCOMMAND(DepthRange)
INTERPCOMMAND(PolygonOffset)
INTERPCOMMAND(CullFace)
- INTERPCOMMAND(AlphaTest)
- INTERPCOMMAND(AlphaFunc)
INTERPCOMMAND(SetTexture)
INTERPCOMMAND(SetShader)
INTERPCOMMAND(Uniform4f)
thread->depthtest = true;
thread->depthfunc = GL_LEQUAL;
thread->scissortest = false;
- thread->alphatest = false;
- thread->alphafunc = GL_GREATER;
- thread->alphavalue = 0.5f;
thread->viewport[0] = 0;
thread->viewport[1] = 0;
thread->viewport[2] = dpsoftrast.fb_width;