aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/togl/linuxwin/cglmtex.h
diff options
context:
space:
mode:
authorJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
committerJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
commit0d8dceea4310fde5706b3ce1c70609d72a38efdf (patch)
treec831ef32c2c801a5c5a80401736b52c7b5a528ec /mp/src/public/togl/linuxwin/cglmtex.h
parentUpdated the SDK with the latest code from the TF and HL2 branches. (diff)
downloadsource-sdk-2013-master.tar.xz
source-sdk-2013-master.zip
Updated the SDK with the latest code from the TF and HL2 branches.HEADmaster
Diffstat (limited to 'mp/src/public/togl/linuxwin/cglmtex.h')
-rw-r--r--mp/src/public/togl/linuxwin/cglmtex.h52
1 files changed, 43 insertions, 9 deletions
diff --git a/mp/src/public/togl/linuxwin/cglmtex.h b/mp/src/public/togl/linuxwin/cglmtex.h
index cafdd1c7..90870a7f 100644
--- a/mp/src/public/togl/linuxwin/cglmtex.h
+++ b/mp/src/public/togl/linuxwin/cglmtex.h
@@ -1,4 +1,26 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
+// TOGL CODE LICENSE
+//
+// Copyright 2011-2014 Valve Corporation
+// All Rights Reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
//
// cglmtex.h
// GLMgr textures
@@ -11,7 +33,7 @@
#pragma once
#ifdef OSX
-#include "glmgr/glmgrbasics.h"
+#include "glmgrbasics.h"
#endif
#include "tier1/utlhash.h"
#include "tier1/utlmap.h"
@@ -199,6 +221,8 @@ struct GLMTexLockDesc
#define GLM_SAMPLER_COUNT 16
+#define GLM_MAX_PIXEL_TEX_SAMPLERS 16
+#define GLM_MAX_VERTEX_TEX_SAMPLERS 0
typedef CBitVec<GLM_SAMPLER_COUNT> CTexBindMask;
enum EGLMTexSliceFlag
@@ -263,9 +287,11 @@ struct GLMTexSamplingParams
m_packed.m_magFilter = D3DTEXF_POINT;
m_packed.m_mipFilter = D3DTEXF_NONE;
m_packed.m_maxAniso = 1;
+ m_packed.m_compareMode = 0;
m_packed.m_isValid = true;
}
+#ifndef OSX
FORCEINLINE void SetToSamplerObject( GLuint nSamplerObject ) const
{
static const GLenum dxtogl_addressMode[] = { GL_REPEAT, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER, (GLenum)-1 };
@@ -305,6 +331,7 @@ struct GLMTexSamplingParams
gGL->glSamplerParameteri( nSamplerObject, GL_TEXTURE_SRGB_DECODE_EXT, m_packed.m_srgb ? GL_DECODE_EXT : GL_SKIP_DECODE_EXT );
}
}
+#endif // !OSX
inline void DeltaSetToTarget( GLenum target, const GLMTexSamplingParams &curState )
{
@@ -377,7 +404,7 @@ struct GLMTexSamplingParams
}
}
- inline void SetToTargetTexture( GLenum target )
+ inline void SetToTarget( GLenum target )
{
static const GLenum dxtogl_addressMode[] = { GL_REPEAT, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER, (GLenum)-1 };
static const GLenum dxtogl_magFilter[4] = { GL_NEAREST, GL_NEAREST, GL_LINEAR, GL_LINEAR };
@@ -427,6 +454,7 @@ public:
void Lock( GLMTexLockParams *params, char** addressOut, int* yStrideOut, int *zStrideOut );
void Unlock( GLMTexLockParams *params );
+ GLuint GetTexName() { return m_texName; }
protected:
friend class GLMContext; // only GLMContext can make CGLMTex objects
@@ -440,7 +468,7 @@ protected:
friend struct IDirect3DCubeTexture9;
friend struct IDirect3DVolumeTexture9;
- CGLMTex( GLMContext *ctx, GLMTexLayout *layout, const char *debugLabel = NULL );
+ CGLMTex( GLMContext *ctx, GLMTexLayout *layout, uint levels, const char *debugLabel = NULL );
~CGLMTex( );
int CalcSliceIndex( int face, int mip );
@@ -450,13 +478,17 @@ protected:
void WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice=true, bool noDataWrite=false );
// last param lets us send NULL data ptr (only legal with uncompressed formats, beware)
// this helps out ResetSRGB.
+
+#if defined( OSX )
+ void HandleSRGBMismatch( bool srgb, int &srgbFlipCount );
+ void ResetSRGB( bool srgb, bool noDataWrite );
+ // re-specify texture format to match desired sRGB form
+ // noWrite means send NULL for texel source addresses instead of actual data - ideal for RT's
+#endif
bool IsRBODirty() const;
void ForceRBONonDirty();
void ForceRBODirty();
-
- void AllocBacking();
- void ReleaseBacking();
// re-specify texture format to match desired sRGB form
// noWrite means send NULL for texel source addresses instead of actual data - ideal for RT's
@@ -464,25 +496,26 @@ protected:
GLuint m_texName; // name of this texture in the context
GLenum m_texGLTarget;
uint m_nSamplerType; // SAMPLER_2D, etc.
+
GLMTexSamplingParams m_SamplingParams;
+
GLMTexLayout *m_layout; // layout of texture (shared across all tex with same layout)
uint m_nLastResolvedBatchCounter;
int m_minActiveMip;//index of lowest mip that has been written. used to drive setting of GL_TEXTURE_MAX_LEVEL.
int m_maxActiveMip;//index of highest mip that has been written. used to drive setting of GL_TEXTURE_MAX_LEVEL.
- int m_mipCount;
GLMContext *m_ctx; // link back to parent context
+
CGLMFBO *m_pBlitSrcFBO;
CGLMFBO *m_pBlitDstFBO;
-
GLuint m_rboName; // name of MSAA RBO backing the tex if MSAA enabled (or zero)
int m_rtAttachCount; // how many RT's have this texture attached somewhere
- char *m_pBacking; // backing storage if available
+ char *m_backing; // backing storage if available
int m_lockCount; // lock reqs are stored in the GLMContext for tracking
@@ -493,6 +526,7 @@ protected:
bool m_texClientStorage; // was CS selected for texture
bool m_texPreloaded; // has it been kicked into VRAM with GLMContext::PreloadTex yet
+ int m_srgbFlipCount;
#if GLMDEBUG
CGLMTex *m_pPrevTex;
CGLMTex *m_pNextTex;