if (mField != null) {
return mField;
}
RenderScriptGL rs = SceneManager.getRS();
Resources res = SceneManager.getRes();
if (rs == null || res == null) {
return null;
}
ScriptField_FragmentShader_s.Item item = new ScriptField_FragmentShader_s.Item();
item.program = mProgram;
ScriptField_ShaderParam_s texParams = getTextureParams();
if (texParams != null) {
item.shaderTextureParams = texParams.getAllocation();
}
linkConstants(rs);
if (mPerShaderConstants != null) {
item.shaderConst = mConstantBuffer;
item.shaderConstParams = mConstantBufferParams.getAllocation();
mProgram.bindConstants(item.shaderConst, 0);
}
item.objectConstIndex = -1;
if (mPerObjConstants != null) {
item.objectConstIndex = mPerShaderConstants != null ? 1 : 0;
}
mField = new ScriptField_FragmentShader_s(rs, 1);
mField.set(item, 0, true);
return mField;