Patch from Degasus that removes the last of the the GL_TEXTURE_RECTANGLE usages. This is needed to have GLES3 support.

This commit is contained in:
Ryan Houdek 2013-07-13 17:24:23 -05:00
parent 52cb398804
commit 737df2a68c
15 changed files with 163 additions and 126 deletions

View File

@ -2,6 +2,9 @@
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<excludeFromCompile>
<directory url="file://$PROJECT_DIR$/gen" includeSubdirectories="true" />
</excludeFromCompile>
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
@ -19,5 +22,8 @@
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="MAXIMUM_HEAP_SIZE" value="512" />
</component>
</project>

View File

@ -1,5 +1,7 @@
<component name="CopyrightManager">
<settings default="">
<module2copyright />
<settings default="Dolphin">
<module2copyright>
<element module="Copywrite" copyright="Dolphin" />
</module2copyright>
</settings>
</component>

View File

@ -47,6 +47,9 @@
<rightPanel />
<splitter proportion="0.5" />
</component>
<component name="CompilerWorkspaceConfiguration">
<option name="PARALLEL_COMPILATION" value="true" />
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
@ -54,7 +57,6 @@
<disable_hints />
</component>
<component name="DebuggerManager">
<ui_properties default_suspend_policy="SuspendAll" default_condition_enabled="true" />
<breakpoint_any default_suspend_policy="SuspendAll" default_condition_enabled="true">
<breakpoint>
<option name="NOTIFY_CAUGHT" value="true" />
@ -91,6 +93,7 @@
<option name="LOG_MESSAGE" value="" />
</breakpoint>
</breakpoint_any>
<ui_properties default_suspend_policy="SuspendAll" default_condition_enabled="true" />
<breakpoint_rules />
<ui_properties />
</component>
@ -103,7 +106,7 @@
<file leaf-file-name="DolphinEmulator.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/DolphinEmulator.java">
<provider selected="true" editor-type-id="text-editor">
<state line="224" column="45" selection-start="6730" selection-end="6769" vertical-scroll-proportion="0.0" vertical-offset="2846" max-vertical-offset="3585">
<state line="224" column="45" selection-start="6730" selection-end="6769" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="4302">
<folding />
</state>
</provider>
@ -112,7 +115,7 @@
<file leaf-file-name="GameListActivity.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/GameListActivity.java">
<provider selected="true" editor-type-id="text-editor">
<state line="173" column="16" selection-start="5541" selection-end="5638" vertical-scroll-proportion="0.0" vertical-offset="2070" max-vertical-offset="3390">
<state line="173" column="16" selection-start="5541" selection-end="5638" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="4068">
<folding />
</state>
</provider>
@ -121,7 +124,7 @@
<file leaf-file-name="PrefsActivity.java" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/PrefsActivity.java">
<provider selected="true" editor-type-id="text-editor">
<state line="177" column="17" selection-start="5357" selection-end="5357" vertical-scroll-proportion="0.09090909" vertical-offset="2619" max-vertical-offset="3375">
<state line="21" column="4" selection-start="629" selection-end="629" vertical-scroll-proportion="0.7099237" vertical-offset="99" max-vertical-offset="4014">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -129,45 +132,6 @@
</provider>
</entry>
</file>
<file leaf-file-name="prefs.xml" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/res/layout/prefs.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="20" column="33" selection-start="799" selection-end="819" vertical-scroll-proportion="-12.0" vertical-offset="0" max-vertical-offset="435">
<folding />
</state>
</provider>
<provider editor-type-id="android-designer">
<state />
</provider>
</entry>
</file>
<file leaf-file-name="strings.xml" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/res/values/strings.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="210">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="prefvalues.xml" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/res/values/prefvalues.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="14" selection-start="231" selection-end="248" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="255">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="GameListItem.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/GameListItem.java">
<provider selected="true" editor-type-id="text-editor">
<state line="22" column="24" selection-start="570" selection-end="570" vertical-scroll-proportion="0.0" vertical-offset="225" max-vertical-offset="1140">
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindManager">
@ -260,6 +224,16 @@
<sortByType />
</navigator>
<panes>
<pane id="PackagesPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="" />
<option name="myItemType" value="" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="ProjectPane">
<subPane>
<PATH>
@ -298,7 +272,6 @@
</PATH>
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope">
<subPane subId="Project Files">
<PATH>
@ -419,7 +392,7 @@
<property name="MemberChooser.sorted" value="false" />
<property name="recentsLimit" value="5" />
<property name="ExportedApkPath" value="$USER_HOME$/Desktop/DolphinEmu-0.9.apk" />
<property name="options.lastSelected" value="project.propCompiler" />
<property name="options.lastSelected" value="copyright" />
<property name="ExportedModule" value="Android" />
<property name="last_opened_file_path" value="$USER_HOME$/NavigationDrawer/libs/android-support-v4.jar" />
<property name="project.structure.side.proportion" value="0.2" />
@ -427,7 +400,7 @@
<property name="MemberChooser.copyJavadoc" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
<property name="AndroidRunProguardForReleaseBuild" value="false" />
<property name="ANDROID_EXTENDED_DEVICE_CHOOSER_AVD" value="YES" />
<property name="ANDROID_EXTENDED_DEVICE_CHOOSER_AVD" value="Mips" />
<property name="restartRequiresConfirmation" value="true" />
<property name="FullScreen" value="false" />
<property name="MemberChooser.showClasses" value="true" />
@ -640,14 +613,15 @@
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2179289" sideWeight="0.29026845" order="3" side_tool="true" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32718122" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32659933" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Android" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.7466443" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32998326" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32998455" sideWeight="0.69630873" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.21378776" sideWeight="0.7080537" order="0" side_tool="false" content_ui="combo" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.29194632" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.21301317" sideWeight="0.7104377" order="0" side_tool="false" content_ui="combo" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.28956228" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
@ -752,8 +726,8 @@
<provider selected="true" editor-type-id="text-editor">
<state line="59" column="5" selection-start="1460" selection-end="1460" vertical-scroll-proportion="0.8684211" vertical-offset="360" max-vertical-offset="975">
<folding>
<element signature="e#493#661#0" expanded="true" />
<element signature="e#654#655#0" expanded="true" />
<element signature="e#493#661#0" expanded="false" />
<element signature="e#654#655#0" expanded="false" />
</folding>
</state>
</provider>
@ -793,13 +767,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/DolphinEmulator.java">
<provider selected="true" editor-type-id="text-editor">
<state line="224" column="45" selection-start="6730" selection-end="6769" vertical-scroll-proportion="0.0" vertical-offset="2668" max-vertical-offset="3315">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/AndroidManifest.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="3" column="26" selection-start="174" selection-end="174" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="825">
@ -821,6 +788,27 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/GameListActivity.java">
<provider selected="true" editor-type-id="text-editor">
<state line="173" column="16" selection-start="5541" selection-end="5638" vertical-scroll-proportion="0.0" vertical-offset="2070" max-vertical-offset="3390">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/DolphinEmulator.java">
<provider selected="true" editor-type-id="text-editor">
<state line="224" column="45" selection-start="6730" selection-end="6769" vertical-scroll-proportion="0.0" vertical-offset="2668" max-vertical-offset="3315">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/res/values/prefvalues.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="14" selection-start="231" selection-end="248" vertical-scroll-proportion="0.25396827" vertical-offset="0" max-vertical-offset="567">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/res/values/strings.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="396">
@ -830,7 +818,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/res/layout/prefs.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="20" column="33" selection-start="799" selection-end="819" vertical-scroll-proportion="-12.0" vertical-offset="0" max-vertical-offset="435">
<state line="20" column="33" selection-start="799" selection-end="819" vertical-scroll-proportion="0.66790354" vertical-offset="0" max-vertical-offset="539">
<folding />
</state>
</provider>
@ -838,23 +826,9 @@
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/res/values/prefvalues.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="14" selection-start="231" selection-end="248" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="255">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/GameListActivity.java">
<provider selected="true" editor-type-id="text-editor">
<state line="173" column="16" selection-start="5541" selection-end="5638" vertical-scroll-proportion="0.0" vertical-offset="2070" max-vertical-offset="3390">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/PrefsActivity.java">
<provider selected="true" editor-type-id="text-editor">
<state line="177" column="17" selection-start="5357" selection-end="5357" vertical-scroll-proportion="0.09090909" vertical-offset="2619" max-vertical-offset="3375">
<state line="21" column="4" selection-start="629" selection-end="629" vertical-scroll-proportion="0.7099237" vertical-offset="99" max-vertical-offset="4014">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -876,6 +850,18 @@
</splitter-proportions>
</settings>
</state>
<state key="Copyright.UI">
<settings>
<last-edited>Dolphin</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>Dolphin Emulator (Android)|Android</last-edited>
@ -948,6 +934,21 @@
</splitter-proportions>
</settings>
</state>
<state key="ScopeChooserConfigurable.UI">
<settings>
<last-edited>Copywrite</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
<order>
<scope name="Copywrite" />
</order>
</settings>
</state>
</states>
</component>
</project>

View File

@ -2,7 +2,6 @@ package org.dolphinemu.dolphinemu;
import android.app.Activity;
import android.content.Intent;
import android.opengl.GLSurfaceView;
import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
@ -20,14 +19,13 @@ import javax.microedition.khronos.opengles.GL10;
*/
public class PrefsActivity extends PreferenceActivity {
private PrefsActivity m_activity;
private String m_GLVersion;
private String m_GLVendor;
private String m_GLRenderer;
public class VersionCheck {
GLSurfaceView.Renderer mRenderer; // borrow this interface
EGL10 mEGL;
EGLDisplay mEGLDisplay;
EGLConfig[] mEGLConfigs;

View File

@ -666,7 +666,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
{
char ppcInst[256];
DisassembleGekko(ops[i].inst.hex, em_address, ppcInst, 256);
NOTICE_LOG(DYNA_REC, "Unflushed register: %s", ppcInst);
//NOTICE_LOG(DYNA_REC, "Unflushed register: %s", ppcInst);
}
#endif
if (js.skipnext) {

View File

@ -18,7 +18,11 @@
#define _INTERFACEEGL_H_
#if USE_GLES
#ifdef USE_GLES3
#include <GLES3/gl3.h>
#else
#include <GLES2/gl2.h>
#endif
#else
#include <GL/glxew.h>
#include <GL/gl.h>

View File

@ -59,6 +59,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
// Create EFB target.
glGenFramebuffers(1, &m_efbFramebuffer);
glActiveTexture(GL_TEXTURE0 + 9);
if (m_msaaSamples <= 1)
{
@ -69,20 +70,20 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
m_efbColor = glObj[0];
m_efbDepth = glObj[1];
glBindTexture(GL_TEXTURE_RECTANGLE, m_efbColor);
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA8, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glBindTexture(getFbType(), m_efbColor);
glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(getFbType(), 0, GL_RGBA8, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glBindTexture(GL_TEXTURE_RECTANGLE, m_efbDepth);
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
glBindTexture(GL_TEXTURE_RECTANGLE, 0);
glBindTexture(getFbType(), m_efbDepth);
glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(getFbType(), 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
// Bind target textures to the EFB framebuffer.
glBindFramebuffer(GL_FRAMEBUFFER, m_efbFramebuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE, m_efbColor, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_RECTANGLE, m_efbDepth, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, getFbType(), m_efbColor, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, getFbType(), m_efbDepth, 0);
GL_REPORT_FBO_ERROR();
}
@ -131,20 +132,20 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
m_resolvedColorTexture = glObj[0];
m_resolvedDepthTexture = glObj[1];
glBindTexture(GL_TEXTURE_RECTANGLE, m_resolvedColorTexture);
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA8, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glBindTexture(getFbType(), m_resolvedColorTexture);
glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(getFbType(), 0, GL_RGBA8, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glBindTexture(GL_TEXTURE_RECTANGLE, m_resolvedDepthTexture);
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
glBindTexture(GL_TEXTURE_RECTANGLE, 0);
glBindTexture(getFbType(), m_resolvedDepthTexture);
glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(getFbType(), 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
// Bind resolved textures to resolved framebuffer.
glBindFramebuffer(GL_FRAMEBUFFER, m_resolvedFramebuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE, m_resolvedColorTexture, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_RECTANGLE, m_resolvedDepthTexture, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, getFbType(), m_resolvedColorTexture, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, getFbType(), m_resolvedDepthTexture, 0);
GL_REPORT_FBO_ERROR();

View File

@ -7,6 +7,7 @@
#include "GLUtil.h"
#include "FramebufferManagerBase.h"
#include "Render.h"
// On the GameCube, the game sends a request for the graphics processor to
// transfer its internal EFB (Embedded Framebuffer) to an area in GameCube RAM
@ -55,6 +56,17 @@ struct XFBSource : public XFBSourceBase
const GLuint renderbuf;
};
inline GLenum getFbType()
{
#ifndef USE_GLES3
if(g_ogl_config.eSupportedGLSLVersion == GLSL_120)
{
return GL_TEXTURE_RECTANGLE;
}
#endif
return GL_TEXTURE_2D;
}
class FramebufferManager : public FramebufferManagerBase
{
public:

View File

@ -23,12 +23,22 @@
#define TEXFUNC "texture2D"
#ifdef USE_GLES3
#include "GLFunctions.h"
#define GLAPIENTRY GL_APIENTRY
#define GL_SAMPLES_PASSED GL_ANY_SAMPLES_PASSED
#define GL_READ_ONLY 0x88B8
#define GL_WRITE_ONLY 0x88B9
#define GL_READ_WRITE 0x88BA
#define GL_SRC1_ALPHA 0
#define GL_BGRA GL_RGBA
#define glDrawElementsBaseVertex
#define GLRENDERBUFFERFORMAT 0x8058 /* RGBA8_OES */
#endif
#else
#define TEX2D GL_TEXTURE_RECTANGLE_ARB
#define PREC
#define TEXTYPE "sampler2DRect"
#define TEXFUNC "texture2DRect"
#define GLRENDERBUFFERFORMAT GL_RGBA
#endif

View File

@ -509,7 +509,6 @@ void ProgramShaderCache::CreateHeader ( void )
snprintf(s_glsl_header, sizeof(s_glsl_header),
"#version %s\n"
"%s\n" // default precision
"%s\n" // tex_rect
"%s\n" // ubo
"\n"// A few required defines and ones that will make our lives a lot easier
@ -534,10 +533,14 @@ void ProgramShaderCache::CreateHeader ( void )
"%s\n"
"%s\n"
"#define COLOROUT(name) %s\n"
// texture2d hack
"%s\n"
"%s\n"
"%s\n"
, v==GLSLES3 ? "300 es" : v==GLSL_120 ? "120" : v==GLSL_130 ? "130" : "140"
, v==GLSLES3 ? "precision highp float;" : ""
, v==GLSLES3 ? "" : v<=GLSL_130 ? "#extension GL_ARB_texture_rectangle : enable" : "#define texture2DRect texture"
, g_ActiveConfig.backend_info.bSupportsGLSLUBO && v<GLSL_140 ? "#extension GL_ARB_uniform_buffer_object : enable" : ""
, v==GLSL_120 ? "attribute" : "in"
, v==GLSL_120 ? "attribute" : "out"
@ -549,6 +552,9 @@ void ProgramShaderCache::CreateHeader ( void )
, v==GLSL_120 ? "#define ocol0 gl_FragColor" : ""
, v==GLSL_120 ? "#define ocol1 gl_FragColor" : "" //TODO: implement dual source blend
, v==GLSL_120 ? "" : "out vec4 name;"
, v==GLSL_120 ? "#extension GL_ARB_texture_rectangle : enable" : ""
, v==GLSL_120 ? "" : "#define texture2DRect(samp, uv) texelFetch(samp, ivec2(floor(uv)), 0)"
, v==GLSL_120 ? "" : "#define sampler2DRect sampler2D"
);
}

View File

@ -149,8 +149,7 @@ RasterFont::RasterFont()
}
}
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, char_width*char_count, char_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture_data);
delete [] texture_data;

View File

@ -984,7 +984,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
#ifdef USE_GLES3
// XXX: Swap colours
glReadPixels(targetPixelRc.left, targetPixelRc.bottom, targetPixelRcWidth, targetPixelRcHeight,
GL_RGBA, GL_UNSIGNED_INT, colorMap);
GL_RGBA, GL_UNSIGNED_BYTE, colorMap);
#else
glReadPixels(targetPixelRc.left, targetPixelRc.bottom, targetPixelRcWidth, targetPixelRcHeight,
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, colorMap);
@ -1559,7 +1559,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
// For testing zbuffer targets.
// Renderer::SetZBufferRender();
// SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget,
// SaveTexture("tex.tga", GL_TEXTURE_2D, s_FakeZTarget,
// GetTargetWidth(), GetTargetHeight());
Core::Callback_VideoCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB));
XFBWrited = false;

View File

@ -95,13 +95,15 @@ void SamplerCache::SetParameters(GLuint sampler_id, const Params& params)
glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_S, wrap_settings[tm0.wrap_s]);
glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_T, wrap_settings[tm0.wrap_t]);
glSamplerParameterf(sampler_id, GL_TEXTURE_LOD_BIAS, tm0.lod_bias / 32.f);
glSamplerParameterf(sampler_id, GL_TEXTURE_MIN_LOD, tm1.min_lod / 16.f);
glSamplerParameterf(sampler_id, GL_TEXTURE_MAX_LOD, tm1.max_lod / 16.f);
#ifndef USE_GLES3
glSamplerParameterf(sampler_id, GL_TEXTURE_LOD_BIAS, tm0.lod_bias / 32.f);
if (g_ActiveConfig.iMaxAnisotropy > 0)
glSamplerParameterf(sampler_id, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)(1 << g_ActiveConfig.iMaxAnisotropy));
#endif
}
void SamplerCache::Clear()

View File

@ -63,6 +63,7 @@ static std::map<u64,VBOCache> s_VBO;
bool SaveTexture(const char* filename, u32 textarget, u32 tex, int virtual_width, int virtual_height, unsigned int level)
{
#ifndef USE_GLES3
int width = std::max(virtual_width >> level, 1);
int height = std::max(virtual_height >> level, 1);
std::vector<u32> data(width * height);
@ -80,6 +81,9 @@ bool SaveTexture(const char* filename, u32 textarget, u32 tex, int virtual_width
}
return SaveTGA(filename, width, height, &data[0]);
#else
return false;
#endif
}
TextureCache::TCacheEntry::~TCacheEntry()
@ -158,7 +162,7 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width,
gl_iformat = GL_RGBA;
gl_type = GL_UNSIGNED_BYTE;
break;
#ifndef USE_GLES3
case PC_TEX_FMT_I4_AS_I8:
gl_format = GL_LUMINANCE;
gl_iformat = GL_INTENSITY4;
@ -182,7 +186,7 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width,
gl_iformat = GL_LUMINANCE8_ALPHA8;
gl_type = GL_UNSIGNED_BYTE;
break;
#endif
case PC_TEX_FMT_RGB565:
gl_format = GL_RGB;
gl_iformat = GL_RGB;
@ -296,7 +300,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
GL_REPORT_ERRORD();
glActiveTexture(GL_TEXTURE0+9);
glBindTexture(GL_TEXTURE_RECTANGLE, read_texture);
glBindTexture(getFbType(), read_texture);
glViewport(0, 0, virtual_width, virtual_height);
@ -360,8 +364,6 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
glBindVertexArray(vbo_it->second.vao);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
GL_REPORT_ERRORD();
}

View File

@ -167,11 +167,10 @@ void Init()
s_srcTextureWidth = 0;
s_srcTextureHeight = 0;
glActiveTexture(GL_TEXTURE0 + 9);
glGenTextures(1, &s_srcTexture);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_srcTexture);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
glBindTexture(getFbType(), s_srcTexture);
glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0);
CreatePrograms();
}
@ -213,17 +212,17 @@ void EncodeToRamUsingShader(GLuint srcTexture, const TargetRectangle& sourceRc,
// set source texture
glActiveTexture(GL_TEXTURE0+9);
glBindTexture(GL_TEXTURE_RECTANGLE, srcTexture);
glBindTexture(getFbType(), srcTexture);
if (linearFilter)
{
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(getFbType(), GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(getFbType(), GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(getFbType(), GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(getFbType(), GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
GL_REPORT_ERRORD();
@ -251,8 +250,6 @@ void EncodeToRamUsingShader(GLuint srcTexture, const TargetRectangle& sourceRc,
glBindVertexArray( s_encode_VAO );
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
GL_REPORT_ERRORD();
// .. and then read back the results.
@ -386,17 +383,17 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destRender
// activate source texture
// set srcAddr as data for source texture
glActiveTexture(GL_TEXTURE0+9);
glBindTexture(GL_TEXTURE_RECTANGLE, s_srcTexture);
glBindTexture(getFbType(), s_srcTexture);
// TODO: make this less slow. (How?)
if ((GLsizei)s_srcTextureWidth == (GLsizei)srcFmtWidth && (GLsizei)s_srcTextureHeight == (GLsizei)srcHeight)
{
glTexSubImage2D(GL_TEXTURE_RECTANGLE, 0,0,0,s_srcTextureWidth, s_srcTextureHeight,
glTexSubImage2D(getFbType(), 0,0,0,s_srcTextureWidth, s_srcTextureHeight,
GL_BGRA, GL_UNSIGNED_BYTE, srcAddr);
}
else
{
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA8, (GLsizei)srcFmtWidth, (GLsizei)srcHeight,
glTexImage2D(getFbType(), 0, GL_RGBA8, (GLsizei)srcFmtWidth, (GLsizei)srcHeight,
0, GL_BGRA, GL_UNSIGNED_BYTE, srcAddr);
s_srcTextureWidth = (GLsizei)srcFmtWidth;
s_srcTextureHeight = (GLsizei)srcHeight;
@ -431,9 +428,6 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destRender
GL_REPORT_ERRORD();
// reset state
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
VertexShaderManager::SetViewportChanged();
FramebufferManager::SetFramebuffer(0);