#include "r700_assembler.h"
#define USE_CF_FOR_CONTINUE_BREAK 1
+#define USE_CF_FOR_POP_AFTER 1
BITS addrmode_PVSDST(PVSDST * pPVSDST)
{
pAsm->unCallerArrayPointer = 0;
pAsm->CALLSP = 0;
- pAsm->CALLSTACK[0].FCSP_BeforeEntry;
+ pAsm->CALLSTACK[0].FCSP_BeforeEntry = 0;
pAsm->CALLSTACK[0].plstCFInstructions_local
= &(pAsm->pR700Shader->lstCFInstructions);
+ pAsm->CALLSTACK[0].stackUsage.bits = 0;
+
SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[0].plstCFInstructions_local);
pAsm->unCFflags = 0;
return GL_TRUE;
}
+inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason)
+{
+ switch (uReason)
+ {
+ case FC_PUSH_VPM:
+ break;
+ case FC_PUSH_WQM:
+ break;
+ case FC_LOOP:
+ break;
+ case FC_REP:
+ break;
+ };
+}
+
GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset)
{
if(GL_FALSE == add_cf_instruction(pAsm) )
return GL_TRUE;
}
-GLboolean assemble_IF(r700_AssemblerBase *pAsm)
+GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse)
{
if(GL_FALSE == add_cf_instruction(pAsm) )
{
pAsm->fc_stack[pAsm->FCSP].midLen= 0;
pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr;
+#ifndef USE_CF_FOR_POP_AFTER
if(GL_TRUE != bHasElse)
{
pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER;
}
+#endif /* USE_CF_FOR_POP_AFTER */
pAsm->branch_depth++;
GLboolean assemble_ELSE(r700_AssemblerBase *pAsm)
{
+#ifdef USE_CF_FOR_POP_AFTER
+ pops(pAsm, 1);
+#endif /* USE_CF_FOR_POP_AFTER */
+
if(GL_FALSE == add_cf_instruction(pAsm) )
{
return GL_FALSE;
pAsm->fc_stack[pAsm->FCSP].mid[0] = pAsm->cf_current_cf_clause_ptr;
//pAsm->fc_stack[pAsm->FCSP].unNumMid = 1;
+#ifndef USE_CF_FOR_POP_AFTER
pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER;
+#endif /* USE_CF_FOR_POP_AFTER */
pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode - 1;
GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm)
{
+#ifdef USE_CF_FOR_POP_AFTER
+ pops(pAsm, 1);
+#endif /* USE_CF_FOR_POP_AFTER */
+
pAsm->alu_x_opcode = SQ_CF_INST_ALU;
if(NULL == pAsm->fc_stack[pAsm->FCSP].mid)
pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry = pAsm->FCSP;
pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local
= &(pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local);
+ pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.bits = 0;
SetActiveCFlist(pAsm->pR700Shader,
pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local);
FC_IF = 1,
FC_LOOP = 2,
FC_REP = 3,
+ FC_PUSH_VPM = 4,
+ FC_PUSH_WQM = 5,
COND_NONE = 0,
COND_BOOL = 1,
#define SQ_MAX_CALL_DEPTH 0x00000020
+typedef struct STACK_USAGE
+{
+ BITS pushs :8;
+ BITS current :8;
+ BITS max :8;
+} STACK_USAGE;
+
+typedef union STACKDWORDtag
+{
+ BITS bits;
+ STACK_USAGE su;
+} STACKDWORD;
+
typedef struct CALL_LEVEL
{
unsigned int FCSP_BeforeEntry;
+ STACKDWORD stackUsage;
TypedShaderList * plstCFInstructions_local;
} CALL_LEVEL;
+#define HAS_CURRENT_LOOPRET 0x1L
+#define HAS_LOOPRET 0x2L
+#define LOOPRET_FLAGS HAS_LOOPRET | HAS_CURRENT_LOOPRET
+
typedef struct r700_AssemblerBase
{
R700ControlFlowSXClause* cf_last_export_ptr;
} r700_AssemblerBase;
//Internal use
+inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason);
BITS addrmode_PVSDST(PVSDST * pPVSDST);
void setaddrmode_PVSDST(PVSDST * pPVSDST, BITS addrmode);
void nomask_PVSDST(PVSDST * pPVSDST);