// --------------------------------------------------------------- bool MyPVRDemo::LoadTextures(CPVRTString* const pErrorStr) { ASSERT(ELEMENTS_IN_ARRAY(c_pszTextures) == enumTEXTURE_MAX); // Load Textures from PVR files for(int i = 0; i < enumTEXTURE_MAX; ++i) { if(PVRTTextureLoadFromPVR(c_pszTextures[i], &m_tex[i]) != PVR_SUCCESS) { *pErrorStr = CPVRTString("ERROR: Could not load: ") + CPVRTString(c_pszTextures[i]); return false; } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); } // Set some options glBindTexture(GL_TEXTURE_2D, m_tex[enumTEXTURE_BloomMap]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Allocate a texture for the RTT glGenTextures(enumFB_MAX, m_uiRTT); for(int i = 0; i < enumFB_MAX; i++) { glBindTexture(GL_TEXTURE_2D, m_uiRTT[i]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, RTT_SIZE, RTT_SIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } // Allocate a texture for the shadow map glGenTextures(1, &m_uiShadowMapTex); glBindTexture(GL_TEXTURE_2D, m_uiShadowMapTex); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_MAP_SIZE, SHADOW_MAP_SIZE, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); return true; }
/* Microphone Input Terminal */ static uwd_audio_in_trm_t mic_trm = { UWD_AUDIO_TT_MICROPHONE, /* trm_type */ 0, /* assoc_terminal */ CHANNELS, /* nr_channels */ CHANNEL_CONFIG /* channel_config */ }; /* Selector Unit */ static juint8_t selector_sources[] = { MIC_TRM_ID, /* source_id */ USB_IT_ID /* source_id */ }; static uwd_audio_selector_unit_t selector_unit = { ELEMENTS_IN_ARRAY(selector_sources), /* nr_in_pins */ selector_sources /* *sources */ }; static juint8_t selector_state = 1; /* Extension Unit */ static juint8_t extension_unit_sources[] = { SELECTOR_UNIT_ID, FEATURE_UNIT_ID }; static uwd_audio_extension_unit_t extension_unit = { 0x1234, /* extension_code */ ELEMENTS_IN_ARRAY(extension_unit_sources), /* nr_in_pins */ extension_unit_sources, /* *source_id */ CHANNELS, /* nr_channels */ CHANNEL_CONFIG, /* channel_config */
static bool detect_bin(const uint8_t *data, uint32_t size); static error_t open_bin(void *state); static error_t write_bin(void *state, const uint8_t *data, uint32_t size); static error_t close_bin(void *state); static bool detect_hex(const uint8_t *data, uint32_t size); static error_t open_hex(void *state); static error_t write_hex(void *state, const uint8_t *data, uint32_t size); static error_t close_hex(void *state); stream_t stream[] = { {detect_bin, open_bin, write_bin, close_bin}, // STREAM_TYPE_BIN {detect_hex, open_hex, write_hex, close_hex}, // STREAM_TYPE_HEX }; COMPILER_ASSERT(ELEMENTS_IN_ARRAY(stream) == STREAM_TYPE_COUNT); // STREAM_TYPE_NONE must not be included in count COMPILER_ASSERT(STREAM_TYPE_NONE > STREAM_TYPE_COUNT); static shared_state_t shared_state; static stream_state_t state = STREAM_STATE_CLOSED; static stream_t *current_stream = 0; // Thread variables (STUB these if RTX is not used) static osThreadId_t stream_thread_tid = 0; static void stream_thread_set(void) { stream_thread_tid = osThreadGetId(); } static void stream_thread_assert(void) {