Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
2e5b5c23
There was an error fetching the commit references. Please try again later.
Commit
2e5b5c23
authored
6 years ago
by
ReinUsesLisp
Browse files
Options
Downloads
Patches
Plain Diff
gl_rasterizer: Split SetupTextures
parent
4ee99496
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/video_core/renderer_opengl/gl_rasterizer.cpp
+30
-20
30 additions, 20 deletions
src/video_core/renderer_opengl/gl_rasterizer.cpp
src/video_core/renderer_opengl/gl_rasterizer.h
+8
-2
8 additions, 2 deletions
src/video_core/renderer_opengl/gl_rasterizer.h
with
38 additions
and
22 deletions
src/video_core/renderer_opengl/gl_rasterizer.cpp
+
30
−
20
View file @
2e5b5c23
...
...
@@ -331,7 +331,7 @@ void RasterizerOpenGL::SetupShaders(GLenum primitive_mode) {
const
auto
stage_enum
=
static_cast
<
Maxwell
::
ShaderStage
>
(
stage
);
SetupDrawConstBuffers
(
stage_enum
,
shader
);
SetupDrawGlobalMemory
(
stage_enum
,
shader
);
const
auto
texture_buffer_usage
{
SetupTextures
(
stage_enum
,
shader
,
base_bindings
)};
const
auto
texture_buffer_usage
{
Setup
Draw
Textures
(
stage_enum
,
shader
,
base_bindings
)};
const
ProgramVariant
variant
{
base_bindings
,
primitive_mode
,
texture_buffer_usage
};
const
auto
[
program_handle
,
next_bindings
]
=
shader
->
GetProgramHandle
(
variant
);
...
...
@@ -981,8 +981,9 @@ void RasterizerOpenGL::SetupGlobalMemory(const GLShader::GlobalMemoryEntry& entr
bind_ssbo_pushbuffer
.
Push
(
ssbo
,
buffer_offset
,
static_cast
<
GLsizeiptr
>
(
size
));
}
TextureBufferUsage
RasterizerOpenGL
::
SetupTextures
(
Maxwell
::
ShaderStage
stage
,
const
Shader
&
shader
,
BaseBindings
base_bindings
)
{
TextureBufferUsage
RasterizerOpenGL
::
SetupDrawTextures
(
Maxwell
::
ShaderStage
stage
,
const
Shader
&
shader
,
BaseBindings
base_bindings
)
{
MICROPROFILE_SCOPE
(
OpenGL_Texture
);
const
auto
&
gpu
=
system
.
GPU
();
const
auto
&
maxwell3d
=
gpu
.
Maxwell3D
();
...
...
@@ -1004,30 +1005,39 @@ TextureBufferUsage RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, c
}
else
{
texture
=
maxwell3d
.
GetStageTexture
(
stage
,
entry
.
GetOffset
());
}
const
u32
current_bindpoint
=
base_bindings
.
sampler
+
bindpoint
;
auto
&
unit
{
state
.
texture_units
[
current_bindpoint
]};
unit
.
sampler
=
sampler_cache
.
GetSampler
(
texture
.
tsc
);
if
(
const
auto
view
{
texture_cache
.
GetTextureSurface
(
texture
,
entry
)};
view
)
{
if
(
view
->
GetSurfaceParams
().
IsBuffer
())
{
// Record that this texture is a texture buffer.
texture_buffer_usage
.
set
(
bindpoint
);
}
else
{
// Apply swizzle to textures that are not buffers.
view
->
ApplySwizzle
(
texture
.
tic
.
x_source
,
texture
.
tic
.
y_source
,
texture
.
tic
.
z_source
,
texture
.
tic
.
w_source
);
}
state
.
texture_units
[
current_bindpoint
].
texture
=
view
->
GetTexture
();
}
else
{
// Can occur when texture addr is null or its memory is unmapped/invalid
unit
.
texture
=
0
;
if
(
SetupTexture
(
shader
,
base_bindings
.
sampler
+
bindpoint
,
texture
,
entry
))
{
texture_buffer_usage
.
set
(
bindpoint
);
}
}
return
texture_buffer_usage
;
}
bool
RasterizerOpenGL
::
SetupTexture
(
const
Shader
&
shader
,
u32
binding
,
const
Tegra
::
Texture
::
FullTextureInfo
&
texture
,
const
GLShader
::
SamplerEntry
&
entry
)
{
auto
&
unit
{
state
.
texture_units
[
binding
]};
unit
.
sampler
=
sampler_cache
.
GetSampler
(
texture
.
tsc
);
const
auto
view
=
texture_cache
.
GetTextureSurface
(
texture
,
entry
);
if
(
!
view
)
{
// Can occur when texture addr is null or its memory is unmapped/invalid
unit
.
texture
=
0
;
return
false
;
}
unit
.
texture
=
view
->
GetTexture
();
if
(
view
->
GetSurfaceParams
().
IsBuffer
())
{
return
true
;
}
// Apply swizzle to textures that are not buffers.
view
->
ApplySwizzle
(
texture
.
tic
.
x_source
,
texture
.
tic
.
y_source
,
texture
.
tic
.
z_source
,
texture
.
tic
.
w_source
);
return
false
;
}
void
RasterizerOpenGL
::
SyncViewport
(
OpenGLState
&
current_state
)
{
const
auto
&
regs
=
system
.
GPU
().
Maxwell3D
().
regs
;
const
bool
geometry_shaders_enabled
=
...
...
This diff is collapsed.
Click to expand it.
src/video_core/renderer_opengl/gl_rasterizer.h
+
8
−
2
View file @
2e5b5c23
...
...
@@ -32,6 +32,7 @@
#include
"video_core/renderer_opengl/gl_state.h"
#include
"video_core/renderer_opengl/gl_texture_cache.h"
#include
"video_core/renderer_opengl/utils.h"
#include
"video_core/textures/texture.h"
namespace
Core
{
class
System
;
...
...
@@ -137,8 +138,13 @@ private:
/// Configures the current textures to use for the draw command. Returns shaders texture buffer
/// usage.
TextureBufferUsage
SetupTextures
(
Tegra
::
Engines
::
Maxwell3D
::
Regs
::
ShaderStage
stage
,
const
Shader
&
shader
,
BaseBindings
base_bindings
);
TextureBufferUsage
SetupDrawTextures
(
Tegra
::
Engines
::
Maxwell3D
::
Regs
::
ShaderStage
stage
,
const
Shader
&
shader
,
BaseBindings
base_bindings
);
/// Configures a texture. Returns true when the texture is a texture buffer.
bool
SetupTexture
(
const
Shader
&
shader
,
u32
binding
,
const
Tegra
::
Texture
::
FullTextureInfo
&
texture
,
const
GLShader
::
SamplerEntry
&
entry
);
/// Syncs the viewport and depth range to match the guest state
void
SyncViewport
(
OpenGLState
&
current_state
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment